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

Propagate global interpreter constraints when building PEXes with interpreter constraints requested #7285

Merged
Merged
Show file tree
Hide file tree
Changes from 11 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
5 changes: 3 additions & 2 deletions src/python/pants/backend/python/subsystems/pex_build_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,9 @@ def add_interpreter_constraints_from(self, constraint_tgts):
# TODO this would be a great place to validate the constraints and present a good error message
# if they are incompatible because all the sources of the constraints are available.
# See: https://github.com/pantsbuild/pex/blob/584b6e367939d24bc28aa9fa36eb911c8297dac8/pex/interpreter_constraints.py
for tgt in constraint_tgts:
for constraint in tgt.compatibility:
constraint_tuples = {self._python_setup_subsystem.compatibility_or_constraints(tgt) for tgt in constraint_tgts}
for constraint_tuple in constraint_tuples:
for constraint in constraint_tuple:
self.add_interpreter_constraint(constraint)

def add_direct_requirements(self, reqs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ def _create_binary(self, binary_tgt, results_dir):
if is_python_target(tgt):
constraint_tgts.append(tgt)

# Add target's interpreter compatibility constraints to pex info.
# Add interpreter compatibility constraints to pex info. This will first check the targets for any
# constraints, and if they do not have any will resort to the global constraints.
pex_builder.add_interpreter_constraints_from(constraint_tgts)

# Dump everything into the builder's chroot.
Expand Down