Use the same mechanism on mac for ensuring default-pip

This commit is contained in:
Joe Rickerby
2021-05-09 10:42:21 +01:00
parent b0f94c3216
commit b5f8002876
+16 -5
View File
@@ -232,11 +232,22 @@ def setup_python(
sys.exit(1)
# ensure pip is installed
call(
["python", "-m", "ensurepip", "--default-pip"],
env=env,
cwd="/tmp",
)
if not (installation_bin_path / "pip").exists():
# perhaps pip is installed, but not available as 'pip'...
try:
call(["python", "-m", "pip", "--version"], env=env, cwd="/tmp")
except subprocess.CalledProcessError:
pip_is_installed = False
else:
pip_is_installed = True
if pip_is_installed:
# if it's there, remove that version of pip.
call(["python", "-m", "pip", "uninstall", "--yes", "pip"], env=env, cwd="C:\\cibw")
# Then reinstall. '--default-pip' ensures that it's installed as 'pip'
call(["python", "-m", "ensurepip", "--default-pip"], env=env, cwd="C:\\cibw")
# ensure we have the version that matches our constraints
call(
["python", "-m", "pip", "install", "--upgrade", "pip", *dependency_constraint_flags],