Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bazel-contrib/rules_python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: Ubehebe/rules_python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Jan 8, 2025

  1. fix: _which_unchecked: don't watch PATH if binary exists.

    Fixes #2551.
    
    Currently, the _which_unchecked helper unconditionally watches the
    `PATH` env var via repository_ctx.getenv. getenv is documented
    https://bazel.build/rules/lib/builtins/repository_ctx#getenv:
    
    > any change to the value of the variable named by name will cause
    > this repository to be re-fetched.
    
    Thus, any change to `PATH` will cause any repository rule that
    transitively calls _which_unchecked to be re-fetched. This includes
    python_repository and whl_library.
    
    There are reasonable development workflows that modify `PATH`. In
    particular, when git runs a hook, it adds the value of `GIT_EXEC_PATH`
    to `PATH` before invoking the hook. If the hook invokes bazel (for
    example, a pre-commit hook running `bazel build ...`), it will cause
    the Python repository rules to be re-fetched.
    
    This commit lowers the repository_ctx.getenv("PATH") call to its only
    use site in _which_unchecked, which happens to be a failure case (when
    the binary is not found). This allows the success case to not watch
    `PATH`, and therefore not to re-fetch the repository rule when it
    changes.
    Ubehebe committed Jan 8, 2025
    Configuration menu
    Copy the full SHA
    4e31043 View commit details
    Browse the repository at this point in the history
Loading