aboutsummaryrefslogtreecommitdiffstats
path: root/tools/tox_pip.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/tox_pip.py')
-rw-r--r--tools/tox_pip.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/tox_pip.py b/tools/tox_pip.py
index 2d33e9e5..1b7eeda5 100644
--- a/tools/tox_pip.py
+++ b/tools/tox_pip.py
@@ -1,6 +1,7 @@
import os
import subprocess
import sys
+import re
def remove_setuptools():
@@ -20,12 +21,29 @@ def bootstrap():
subprocess.check_call(cmd)
+def is_install_self(args):
+ """
+ Do the args represent an install of .?
+ """
+ def strip_extras(arg):
+ match = re.match(r'(.*)?\[.*\]$', arg)
+ return match.group(1) if match else arg
+
+ return (
+ 'install' in args
+ and any(
+ arg in ['.', os.getcwd()]
+ for arg in map(strip_extras, args)
+ )
+ )
+
+
def pip(args):
# Honor requires-python when installing test suite dependencies
if any('-r' in arg for arg in args):
os.environ['PIP_IGNORE_REQUIRES_PYTHON'] = '0'
- if '.' in args:
+ if is_install_self(args):
remove_setuptools()
bootstrap()