From 903dd36d68cbaeb11fd0146d277b5cc9e5b741e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 18 Jul 2018 11:02:05 +0200 Subject: [PATCH] Strip --no-cache-dir for pip < 1.6 Closes #2738 --- src/octoprint/util/pip.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/octoprint/util/pip.py b/src/octoprint/util/pip.py index 724106ae8..77052c48c 100644 --- a/src/octoprint/util/pip.py +++ b/src/octoprint/util/pip.py @@ -26,6 +26,7 @@ class UnknownPip(Exception): class PipCaller(CommandlineCaller): process_dependency_links = pkg_resources.Requirement.parse("pip>=1.5") + no_cache_dir = pkg_resources.Requirement.parse("pip>=1.6") no_use_wheel = pkg_resources.Requirement.parse("pip==1.5.0") broken = pkg_resources.Requirement.parse("pip>=6.0.1,<=6.0.3") @@ -41,6 +42,11 @@ class PipCaller(CommandlineCaller): pip_version)) args.remove("--process-dependency-links") + # strip --no-cache-dir for versions that don't support it + if not pip_version in cls.no_cache_dir and "--no-cache-dir" in args: + logger.debug("Found --no-cache-dir flag, version {} doesn't support that yet though, removing.".format(pip_version)) + args.remove("--no-cache-dir") + # add --no-use-wheel for versions that otherwise break if pip_version in cls.no_use_wheel and not "--no-use-wheel" in args: logger.debug("Version {} needs --no-use-wheel to properly work.".format(pip_version))