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 desired $PY interpreter #7338

Conversation

Projects
None yet
3 participants
@Eric-Arellano
Copy link
Contributor

commented Mar 8, 2019

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 https://travis-ci.com/Eric-Arellano/pants/jobs/183283217#L613, 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 ci.sh

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.

Eric-Arellano added some commits Mar 8, 2019

Allow ./pants2 to have predefined PY
We should allow the user to set a more specific Python 2 interpreter if they'd like. If they don't go out of their way, then we simply use `python2`.
Simplify ci.sh to always use ./pants
Because we override $PY and $PANTS_PYTHON_SETUP_INTERPRETER_CONSTRAINTS already, there is no advantage to using ./pants2 vs ./pants beyond additional complexity.

@Eric-Arellano Eric-Arellano changed the title Fix ./pants2 overriding desired interpreter Fix ./pants2 overriding desired $PY interpreter Mar 8, 2019

@stuhood

stuhood approved these changes Mar 8, 2019

@cosmicexplorer
Copy link
Contributor

left a comment

I have weirdly been seeing $PY being incorrect or unset when running pants in a docker image and hadn't followed up on why the heck that would be happening, and I think this change will either fix that or at least page me into what's probably going on if I see it again.

This led to an issue where we meant to bootstrap Pants with Python 2.7.15 but instead bootstrapped with 2.7.13.

What issue is this referring to (and can it be linked?).

Thanks for fixing this!!

@Eric-Arellano

This comment has been minimized.

Copy link
Contributor Author

commented Mar 8, 2019

@cosmicexplorer yes, this should fix it! Specifically if the docker image is using ./pants2 instead of ./pants.

I updated the description with a link to the Travis log for what motivated this fix.

@Eric-Arellano Eric-Arellano merged commit 646699b into pantsbuild:master Mar 8, 2019

1 check passed

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

@Eric-Arellano Eric-Arellano deleted the Eric-Arellano:fix-pants2-not-allowing-specific-interpreter branch Mar 8, 2019

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.