Apply @mayeut's clean up suggestion

This commit is contained in:
Joe Rickerby
2021-05-16 10:13:05 +01:00
parent 39302c7c43
commit 9a07f00545
2 changed files with 26 additions and 35 deletions
+5 -10
View File
@@ -232,16 +232,18 @@ 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")
# use "--force-reinstall" ensures that it's installed as '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()
call( call(
[ [
"python", "python",
"-m", "-m",
"pip", "pip",
"install", "install",
"--force-reinstall", "--force-reinstall" if requires_reinstall else "--upgrade",
"pip", "pip",
*dependency_constraint_flags, *dependency_constraint_flags,
], ],
@@ -249,13 +251,6 @@ def setup_python(
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)
+5 -9
View File
@@ -176,28 +176,24 @@ 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")
# use "--force-reinstall" ensures that it's installed as 'pip.exe'
# 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()
call( call(
[ [
"python", "python",
"-m", "-m",
"pip", "pip",
"install", "install",
"--force-reinstall", "--force-reinstall" if requires_reinstall else "--upgrade",
"pip", "pip",
*dependency_constraint_flags, *dependency_constraint_flags,
], ],
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(