mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
bpo-38927: Use python -m pip to upgrade venv deps (GH-17403)
I suggest you add `bpo-NNNNN: ` as a prefix for the first commit for future PRs. Thanks!
This commit is contained in:
parent
045d4e243d
commit
d9aa216d49
3 changed files with 9 additions and 6 deletions
|
@ -141,16 +141,18 @@ class BasicTest(BaseTest):
|
||||||
def test_upgrade_dependencies(self):
|
def test_upgrade_dependencies(self):
|
||||||
builder = venv.EnvBuilder()
|
builder = venv.EnvBuilder()
|
||||||
bin_path = 'Scripts' if sys.platform == 'win32' else 'bin'
|
bin_path = 'Scripts' if sys.platform == 'win32' else 'bin'
|
||||||
pip_exe = 'pip.exe' if sys.platform == 'win32' else 'pip'
|
python_exe = 'python.exe' if sys.platform == 'win32' else 'python'
|
||||||
with tempfile.TemporaryDirectory() as fake_env_dir:
|
with tempfile.TemporaryDirectory() as fake_env_dir:
|
||||||
|
|
||||||
def pip_cmd_checker(cmd):
|
def pip_cmd_checker(cmd):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
cmd,
|
cmd,
|
||||||
[
|
[
|
||||||
os.path.join(fake_env_dir, bin_path, pip_exe),
|
os.path.join(fake_env_dir, bin_path, python_exe),
|
||||||
|
'-m',
|
||||||
|
'pip',
|
||||||
'install',
|
'install',
|
||||||
'-U',
|
'--upgrade',
|
||||||
'pip',
|
'pip',
|
||||||
'setuptools'
|
'setuptools'
|
||||||
]
|
]
|
||||||
|
|
|
@ -393,10 +393,10 @@ class EnvBuilder:
|
||||||
f'Upgrading {CORE_VENV_DEPS} packages in {context.bin_path}'
|
f'Upgrading {CORE_VENV_DEPS} packages in {context.bin_path}'
|
||||||
)
|
)
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
pip_exe = os.path.join(context.bin_path, 'pip.exe')
|
python_exe = os.path.join(context.bin_path, 'python.exe')
|
||||||
else:
|
else:
|
||||||
pip_exe = os.path.join(context.bin_path, 'pip')
|
python_exe = os.path.join(context.bin_path, 'python')
|
||||||
cmd = [pip_exe, 'install', '-U']
|
cmd = [python_exe, '-m', 'pip', 'install', '--upgrade']
|
||||||
cmd.extend(CORE_VENV_DEPS)
|
cmd.extend(CORE_VENV_DEPS)
|
||||||
subprocess.check_call(cmd)
|
subprocess.check_call(cmd)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Use ``python -m pip`` instead of ``pip`` to upgrade dependencies in venv.
|
Loading…
Add table
Add a link
Reference in a new issue