Only call ensurepip if bin/pip wasn't found

This commit is contained in:
Joe Rickerby
2021-05-16 10:58:12 +01:00
parent 9a07f00545
commit fd94e77db4
2 changed files with 15 additions and 8 deletions
+7 -4
View File
@@ -231,12 +231,15 @@ def setup_python(
)
sys.exit(1)
# ensure pip is installed
call(["python", "-m", "ensurepip"], env=env, cwd="/tmp")
# Install pip
# upgrade to the version matching our constraints
# if necessary, reinstall it to ensure that it's installed as 'pip'
requires_reinstall = not (installation_bin_path / "pip").exists()
if requires_reinstall:
# maybe pip isn't installed at all. ensurepip resolves that.
call(["python", "-m", "ensurepip"], env=env, cwd="/tmp")
# upgrade pip to the version matching our constraints
# if necessary, reinstall it to ensure that it's available on PATH as 'pip'
call(
[
"python",