Skip to content

fix(pip.parse): allow absolute path for python_interpreter; skip hermetic toolchain lookup when used#1619

Merged
aignas merged 2 commits intobazel-contrib:mainfrom
rickeylev:pip.parse.sys.python
Dec 16, 2023
Merged

fix(pip.parse): allow absolute path for python_interpreter; skip hermetic toolchain lookup when used#1619
aignas merged 2 commits intobazel-contrib:mainfrom
rickeylev:pip.parse.sys.python

Conversation

@rickeylev
Copy link
Copy Markdown
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 bazel-contrib#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
Copy Markdown
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 bazel-contrib:main with commit b99027f Dec 16, 2023
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