sage: patch for pip 19

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
This commit is contained in:
Timo Kaufmann 2019-03-03 13:21:22 +01:00
parent 7455307b60
commit 2de81ee78f
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,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"""

View File

@ -112,6 +112,9 @@ stdenv.mkDerivation rec {
url = "https://git.sagemath.org/sage.git/patch?id=a05b6b038e1571ab15464e98f76d1927c0c3fd12";
sha256 = "05yq97pq84xi60wb1p9skrad5h5x770gq98ll4frr7hvvmlwsf58";
})
# https://trac.sagemath.org/ticket/27405
./patches/ignore-pip-deprecation.patch
];
patches = nixPatches ++ packageUpgradePatches;