Try adding the existence check before reinstalling

This commit is contained in:
Joe Rickerby
2021-05-15 17:04:39 +01:00
parent 7cde8fb66e
commit 39302c7c43
2 changed files with 36 additions and 22 deletions
+19 -11
View File
@@ -232,22 +232,30 @@ def setup_python(
sys.exit(1)
# ensure pip is installed
call(["python", "-m", "ensurepip"], env=env, cwd="/tmp")
if not (installation_bin_path / "pip").exists():
call(["python", "-m", "ensurepip"], env=env, cwd="/tmp")
# use "--force-reinstall" ensures that it's installed as 'pip'
call(
[
"python",
"-m",
"pip",
"install",
"--force-reinstall",
"pip",
*dependency_constraint_flags,
],
env=env,
cwd="/tmp",
)
# ensure we have the version that matches our constraints
# use "--force-reinstall" ensures that it's installed as 'pip'
call(
[
"python",
"-m",
"pip",
"install",
"--force-reinstall",
"pip",
*dependency_constraint_flags,
],
["python", "-m", "pip", "install", "--upgrade", "pip", *dependency_constraint_flags],
env=env,
cwd="/tmp",
)
assert (installation_bin_path / "pip").exists()
call(["which", "pip"], env=env)
call(["pip", "--version"], env=env)
+17 -11
View File
@@ -176,19 +176,25 @@ def setup_python(
log.step("Installing build tools...")
# ensure pip is installed
call(["python", "-m", "ensurepip"], env=env, cwd="C:\\cibw")
if not (installation_path / "Scripts" / "pip.exe").exists():
call(["python", "-m", "ensurepip"], env=env, cwd="C:\\cibw")
# use "--force-reinstall" ensures that it's installed as 'pip.exe'
call(
[
"python",
"-m",
"pip",
"install",
"--force-reinstall",
"pip",
*dependency_constraint_flags,
],
env=env,
)
# ensure we have the version that matches our constraints
# use "--force-reinstall" ensures that it's installed as 'pip.exe'
call(
[
"python",
"-m",
"pip",
"install",
"--force-reinstall",
"pip",
*dependency_constraint_flags,
],
["python", "-m", "pip", "install", "--upgrade", "pip", *dependency_constraint_flags],
env=env,
)