blob: f592e41285b3255d4b69c6d02c5cdfd386d5ebb6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import subprocess
import sys
def remove_setuptools():
"""
Remove setuptools from the current environment.
"""
print("Removing setuptools")
cmd = [sys.executable, '-m', 'pip', 'uninstall', '-y', 'setuptools']
# set cwd to something other than '.' to avoid detecting
# '.' as the installed package.
subprocess.check_call(cmd, cwd='.tox')
def pip(args):
# When installing '.', remove setuptools
'.' in args and remove_setuptools()
cmd = [sys.executable, '-m', 'pip'] + args
subprocess.check_call(cmd)
if __name__ == '__main__':
pip(sys.argv[1:])
|