summary refs log tree commit diff
path: root/pkgs/applications/science/math/sage/patches/ignore-pip-deprecation.patch
blob: 95b377dc9550dc840c12497b696d23fb5fa8eca9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff --git a/src/sage/misc/package.py b/src/sage/misc/package.py
index 689e5a23b9..4e16fe3a8d 100644
--- a/src/sage/misc/package.py
+++ b/src/sage/misc/package.py
@@ -142,9 +142,14 @@ def pip_installed_packages():
         sage: d['beautifulsoup']   # optional - beautifulsoup
         u'...'
     """
-    proc = subprocess.Popen(["pip", "list", "--no-index", "--format", "json"], stdout=subprocess.PIPE)
-    stdout = proc.communicate()[0].decode()
-    return {package['name'].lower():package['version'] for package in json.loads(stdout)}
+    with open(os.devnull, 'w')  as devnull:
+        proc = subprocess.Popen(
+            ["pip", "list", "--no-index", "--format", "json"],
+            stdout=subprocess.PIPE,
+            stderr=devnull,
+        )
+        stdout = proc.communicate()[0].decode()
+        return {package['name'].lower():package['version'] for package in json.loads(stdout)}
 
 def list_packages(*pkg_types, **opts):
     r"""