Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pyenv-win paths and Pip upgrade technique. #2689

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,15 +613,23 @@ def ensure_python_distribution(version):
clone_dir = os.path.abspath(
os.path.join(PEX_TEST_DEV_ROOT, "pyenv-win" if WINDOWS else "pyenv")
)
pyenv_root = os.path.join(clone_dir, "pyenv-win") if WINDOWS else clone_dir
interpreter_location = os.path.join(pyenv_root, "versions", version)
with atomic_directory(target_dir=clone_dir) as pyenv_root_atomic_dir:
if not pyenv_root_atomic_dir.is_finalized():
bootstrap_python_installer(pyenv_root_atomic_dir.work_dir)

pyenv_root = os.path.join(clone_dir, "pyenv-win") if WINDOWS else clone_dir
pyenv = os.path.join(pyenv_root, "bin", "pyenv.bat" if WINDOWS else "pyenv")

interpreter_location = os.path.join(pyenv_root, "versions", version)
pip = os.path.join(interpreter_location, SCRIPT_DIR, script_name("pip"))

with atomic_directory(target_dir=pyenv_root) as pyenv_root_atomic_dir:
if not pyenv_root_atomic_dir.is_finalized():
bootstrap_python_installer(pyenv_root_atomic_dir.work_dir)
if WINDOWS:
python = os.path.join(interpreter_location, "python.exe")
else:
major, minor = version.split(".")[:2]
python = os.path.join(
interpreter_location, "bin", "python{major}.{minor}".format(major=major, minor=minor)
)

with atomic_directory(target_dir=interpreter_location) as interpreter_target_dir:
if not interpreter_target_dir.is_finalized():
Expand All @@ -641,15 +649,7 @@ def ensure_python_distribution(version):
# with `--disable-new-dtags`.
env["LDFLAGS"] = "-Wl,--disable-new-dtags"
subprocess.check_call([pyenv, "install", version], env=env)
subprocess.check_call([pip, "install", "-U", "pip<22.1"])

if WINDOWS:
python = os.path.join(interpreter_location, "python.exe")
else:
major, minor = version.split(".")[:2]
python = os.path.join(
interpreter_location, "bin", "python{major}.{minor}".format(major=major, minor=minor)
)
subprocess.check_call([python, "-m", "pip", "install", "-U", "pip<22.1"])

return PyenvPythonDistribution(
home=interpreter_location,
Expand Down
Loading