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
+9 -1
View File
@@ -232,8 +232,8 @@ def setup_python(
sys.exit(1) sys.exit(1)
# ensure pip is installed # ensure pip is installed
if not (installation_bin_path / "pip").exists():
call(["python", "-m", "ensurepip"], env=env, cwd="/tmp") call(["python", "-m", "ensurepip"], env=env, cwd="/tmp")
# ensure we have the version that matches our constraints
# use "--force-reinstall" ensures that it's installed as 'pip' # use "--force-reinstall" ensures that it's installed as 'pip'
call( call(
[ [
@@ -248,6 +248,14 @@ def setup_python(
env=env, env=env,
cwd="/tmp", cwd="/tmp",
) )
# ensure we have the version that matches our constraints
call(
["python", "-m", "pip", "install", "--upgrade", "pip", *dependency_constraint_flags],
env=env,
cwd="/tmp",
)
assert (installation_bin_path / "pip").exists() assert (installation_bin_path / "pip").exists()
call(["which", "pip"], env=env) call(["which", "pip"], env=env)
call(["pip", "--version"], env=env) call(["pip", "--version"], env=env)
+7 -1
View File
@@ -176,8 +176,8 @@ def setup_python(
log.step("Installing build tools...") log.step("Installing build tools...")
# ensure pip is installed # ensure pip is installed
if not (installation_path / "Scripts" / "pip.exe").exists():
call(["python", "-m", "ensurepip"], env=env, cwd="C:\\cibw") call(["python", "-m", "ensurepip"], env=env, cwd="C:\\cibw")
# ensure we have the version that matches our constraints
# use "--force-reinstall" ensures that it's installed as 'pip.exe' # use "--force-reinstall" ensures that it's installed as 'pip.exe'
call( call(
[ [
@@ -192,6 +192,12 @@ def setup_python(
env=env, env=env,
) )
# ensure we have the version that matches our constraints
call(
["python", "-m", "pip", "install", "--upgrade", "pip", *dependency_constraint_flags],
env=env,
)
assert (installation_path / "Scripts" / "pip.exe").exists() assert (installation_path / "Scripts" / "pip.exe").exists()
where_pip = ( where_pip = (
subprocess.run( subprocess.run(