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(pip.parse): allow absolute path for python_interpreter; skip hermetic toolchain lookup when used #1619

Merged
merged 2 commits into from
Dec 16, 2023

Conversation

rickeylev
Copy link
Collaborator

@rickeylev rickeylev commented Dec 15, 2023

The python_interpreter arg wasn't being properly handled in the bzlmod code in two ways.

  1. Lookup of a hermetic runtime wasn't being skipped when it was set. The net effect was it
    ignored the specified interpreter and would try to lookup a hermetic interpreter using
    the python version. To fix, add a check for python_interpreter to the guard of the lookup.

  2. Specifying an absolute path for the value wasn't being converted to a path object,
    which meant a plain string eventually made its way to some code expecting a path
    object. To fix, call repository_ctx.path() on the path to convert it to a path object.

Fixes #1618

…uire hermetic toolchain of matching version

The `python_interpreter` arg wasn't being properly handled in the bzlmod
code in two ways.

1. Lookup of a hermetic runtime wasn't being skipped when it was set. The
net effect was a hermetic toolchain of a matching version had to be
registered, even if it wasn't used. To fix, add a check for
python_interpreter to the guard of the lookup.

2. Specifying an absolute path for the value wasn't being converted
to a `path` object, which meant a plain string eventually made its way
to some code expecting a `path` object. To fix, call
`repository_ctx.path()` on the path to convert it to a path object.

Fixes bazelbuild#1618
@rickeylev rickeylev marked this pull request as ready for review December 15, 2023 20:38
@rickeylev rickeylev requested a review from aignas December 15, 2023 21:39
Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aignas aignas added this pull request to the merge queue Dec 16, 2023
Merged via the queue into bazelbuild:main with commit b99027f Dec 16, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip.parse doesn't support python_interpreter (string) argument
2 participants