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
Changes from 9 commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -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):
@@ -140,7 +140,7 @@ 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 target-level and possibly global interpreter compatibility constraints to pex info.
This conversation was marked as resolved by Eric-Arellano

This comment has been minimized.

Copy link
@benjyw

benjyw Feb 27, 2019

Contributor

Where are the global constraints added?

This comment has been minimized.

Copy link
@benjyw

benjyw Feb 27, 2019

Contributor

Ah, explained in the PR message. But should be explained here.

pex_builder.add_interpreter_constraints_from(constraint_tgts)

# Dump everything into the builder's chroot.
@@ -20,6 +20,10 @@
class PytestRunIntegrationTest(PantsRunIntegrationTest):
testproject = 'testprojects/src/python/interpreter_selection'

@classmethod
def hermetic(cls):
return True

def test_pytest_run_timeout_succeeds(self):
pants_run = self.run_pants(['clean-all',
'test.pytest',
@@ -21,6 +21,10 @@
class PythonRunIntegrationTest(PantsRunIntegrationTest):
testproject = 'testprojects/src/python/interpreter_selection'

@classmethod
def hermetic(cls):
return True

@skip_unless_python3
@ensure_daemon
def test_run_3(self):
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.