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 provisioning from pyvenv interpreter #1452

Merged
merged 1 commit into from Nov 11, 2019

Conversation

@Kentzo
Copy link
Contributor

Kentzo commented Nov 6, 2019

The bug is related to #148.

When the original interpreter [0] tox is called with is actually a pyvenv
it will set the __PYVENV_LAUNCHER__ environment variable the path of pyvenv
interpreter.

If tox configuration specifies requires and the requirements are not
satifsfied by [0], tox will create an intermediate virtual environment [1].

After setting up [1] tox will delegate the original call to it by spawning
a new [1] interpreter with the list of arguments identical to [0].

It would also pass the value of __PYVENV_LAUNCHER__ if present. This in turn
causes sys.executable to resolve to [0] instead of [1] therefore ignoring all
modifications including installed requirements.

The fix is to make sure that when [0] spawns [1], __PYVENV_LAUNCHER__ is removed
from the environment.

Contribution checklist:

(also see CONTRIBUTING.rst for details)

  • wrote descriptive pull request text
  • added/updated test(s)
  • updated/extended the documentation
  • added relevant issue keyword
    in message body
  • added news fragment in changelog folder
    • fragment name: <issue number>.<type>.rst for example (588.bugfix.rst)
    • <type> is must be one of bugfix, feature, deprecation,breaking, doc, misc
    • if PR has no issue: consider creating one first or change it to the PR number after creating the PR
    • "sign" fragment with "by :user:<your username>"
    • please use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files - by :user:superuser."
    • also see examples
  • added yourself to CONTRIBUTORS (preserving alphabetical order)
@Kentzo Kentzo force-pushed the Kentzo:fix-provisioning-from-pyvenv branch from 19d6e1c to 4f1743a Nov 6, 2019
When the original interpreter [0] tox is called with is actually a pyvenv
it will set the `__PYVENV_LAUNCHER__` environment variable to the path of
pyvenv interpreter.

If tox configuration specifies `requires` and the requirements are not
satifsfied by [0], tox will create an intermediate virtual environment [1].

After setting up [1] tox will delegate the original call by spawning
a new [1] interpreter with the identical identical list of arguments.

It will also pass the value of `__PYVENV_LAUNCHER__` if present. This in turn
causes `sys.executable` to resolve to [0] instead of [1] therefore ignoring all
modifications including installed requirements.

The fix is to make sure that when [0] spawns [1], `__PYVENV_LAUNCHER__` is
removed from the environment.
@Kentzo Kentzo force-pushed the Kentzo:fix-provisioning-from-pyvenv branch from 4f1743a to 40f4860 Nov 6, 2019
Copy link
Member

asottile left a comment

@asottile

This comment has been minimized.

Copy link
Member

asottile commented Nov 7, 2019

@Kentzo could you fix the tests so this can be merged? thanks!

@Kentzo

This comment has been minimized.

Copy link
Contributor Author

Kentzo commented Nov 7, 2019

@asottile Are you sure the failure is related to the change? I may take a look, but I'm completely unfamiliar with the codebase.

@gaborbernat

This comment has been minimized.

Copy link
Member

gaborbernat commented Nov 7, 2019

I don't think the ci failure is related, but let's not merge until we fix master and rebase. Thanks!

@gaborbernat gaborbernat merged commit 5582194 into tox-dev:master Nov 11, 2019
1 of 2 checks passed
1 of 2 checks passed
tox ci #tox ci_20191106.03 failed
Details
Timeline protection Timeline protection: Good to go
Details
@Kentzo Kentzo deleted the Kentzo:fix-provisioning-from-pyvenv branch Nov 11, 2019
@gaborbernat

This comment has been minimized.

Copy link
Member

gaborbernat commented Nov 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.