![Timo Kaufmann](/assets/img/avatar_default.png)
pip 19 introduced a deprecation warning for python 2.7. Since sage internally uses pip to query for installed packages, this deprecation warning will show up at unexpected times. That is ugly and messes with the testsuite. Upstream: https://trac.sagemath.org/ticket/27405
23 lines
958 B
Diff
23 lines
958 B
Diff
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"""
|