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",
+8 -4
View File
@@ -175,12 +175,15 @@ def setup_python(
log.step("Installing build tools...")
# ensure pip is installed
call(["python", "-m", "ensurepip"], env=env, cwd="C:\\cibw")
# Install pip
# upgrade to the version matching our constraints
# if necessary, reinstall it to ensure that it's installed as 'pip.exe'
requires_reinstall = not (installation_path / "Scripts" / "pip.exe").exists()
if requires_reinstall:
# maybe pip isn't installed at all. ensurepip resolves that.
call(["python", "-m", "ensurepip"], env=env, cwd="C:\\cibw")
# upgrade pip to the version matching our constraints
# if necessary, reinstall it to ensure that it's available on PATH as 'pip.exe'
call(
[
"python",
@@ -192,6 +195,7 @@ def setup_python(
*dependency_constraint_flags,
],
env=env,
cwd="C:\\cibw",
)
assert (installation_path / "Scripts" / "pip.exe").exists()