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
+13 -18
View File
@@ -232,26 +232,21 @@ def setup_python(
sys.exit(1)
# ensure pip is installed
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",
)
call(["python", "-m", "ensurepip"], env=env, cwd="/tmp")
# ensure we have the version that matches our constraints
# 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(
["python", "-m", "pip", "install", "--upgrade", "pip", *dependency_constraint_flags],
[
"python",
"-m",
"pip",
"install",
"--force-reinstall" if requires_reinstall else "--upgrade",
"pip",
*dependency_constraint_flags,
],
env=env,
cwd="/tmp",
)
+13 -17
View File
@@ -176,25 +176,21 @@ def setup_python(
log.step("Installing build tools...")
# ensure pip is installed
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,
)
call(["python", "-m", "ensurepip"], env=env, cwd="C:\\cibw")
# ensure we have the version that matches our constraints
# 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(
["python", "-m", "pip", "install", "--upgrade", "pip", *dependency_constraint_flags],
[
"python",
"-m",
"pip",
"install",
"--force-reinstall" if requires_reinstall else "--upgrade",
"pip",
*dependency_constraint_flags,
],
env=env,
)