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 ./pants2 overriding preset interpreter constraints #7334


None yet
2 participants
Copy link

commented Mar 7, 2019


./pants2 would always override PANTS_PYTHON_SETUP_INTERPRETER_CONSTRAINTS. This is not always desired, e.g. when we want to specify you must use Python 2.7.15 instead of 2.7.13.

This fixes an issue introduced by #7257.


Allow the env var to be pre-set, else default to allowing Py2.7 or 3.6+.

@Eric-Arellano Eric-Arellano requested review from stuhood and illicitonion Mar 7, 2019

@Eric-Arellano Eric-Arellano changed the title Allow ./pants2 to have preset interpreter constraints Fix ./pants2 overriding preset interpreter constraints Mar 7, 2019


stuhood approved these changes Mar 7, 2019

Copy link

left a comment


@Eric-Arellano Eric-Arellano merged commit afb8813 into pantsbuild:master Mar 7, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

@Eric-Arellano Eric-Arellano deleted the Eric-Arellano:pants2-allow-tighter-constraint branch Mar 7, 2019

Eric-Arellano added a commit that referenced this pull request Mar 8, 2019

Fix ./pants2 overriding desired $PY interpreter (#7338)
### Problem
Very similar to #7334 that `./pants2` was overriding interpreter constraints, it's become a problem that it also overrides `$PY`, which is to bootstrap Pants.

This led to an issue where we meant to bootstrap Pants with Python 2.7.15 but instead bootstrapped with 2.7.13. Specifically, see, where we had set $PY to point to pyenv's `python2.7`, but it is using the system Python.

### Solution
Allow the env var to be pre-set, else default to using `python2.7`.

#### Also simplify ``
Because we override $PY and $PANTS_PYTHON_SETUP_INTERPRETER_CONSTRAINTS already, there is no advantage to using ./pants2 vs ./pants beyond additional complexity. So, we always use `./pants`.

### Result
`./pants2` will default to using unconstrained Python 2.7. `PY=/usr/bin/python2.7` will run with Python 2 and that specific interpreter.

Both commands will provide default interpreter constraints for spawned subprocesses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.