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 pex --no-build --lock .... #2390

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pex/resolve/lock_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(
self._password_entries = password_entries
self._cache = cache
self._build_configuration = attr.evolve(
build_configuration, allow_wheels=False, prefer_older_binary=False
build_configuration, allow_wheels=False, allow_builds=True, prefer_older_binary=False
)
self._pip_version = pip_version
self._resolver = resolver
Expand Down
60 changes: 60 additions & 0 deletions tests/integration/test_issue_2389.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Copyright 2024 Pex project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).

import os.path
import subprocess
import sys

from pex.interpreter import PythonInterpreter
from pex.typing import TYPE_CHECKING
from testing import PY310, ensure_python_interpreter, run_pex_command
from testing.cli import run_pex3

if TYPE_CHECKING:
from typing import Any


def test_lock_use_no_build_wheel(tmpdir):
# type: (Any)-> None

lock = os.path.join(str(tmpdir), "black.lock")
run_pex3(
"lock",
"create",
"black==22.8.0",
"-o",
lock,
"--style",
"universal",
"--indent",
"2",
"--interpreter-constraint",
"CPython==3.10.*",
"--wheel",
"--no-build",
).assert_success()

pex = os.path.join(str(tmpdir), "black.pex")
python = sys.executable if sys.version_info[:2] == (3, 10) else ensure_python_interpreter(PY310)
run_pex_command(
args=[
"-o",
pex,
"--python",
python,
"-c",
"black",
"--lock",
lock,
"--wheel",
"--no-build",
]
).assert_success()

output = subprocess.check_output(args=[pex, "--version"])
assert (
"black.pex, 22.8.0 (compiled: {compiled})".format(
compiled="no" if PythonInterpreter.from_binary(python).is_pypy else "yes"
)
in output.decode("utf-8").splitlines()
)