Skip to content

Conversation

jsing-canva
Copy link

@jsing-canva jsing-canva commented Jul 14, 2025

The current _FindPythonRunfilesRoot() implementation assumes that
the Python module has been unpacked four levels below the runfiles
directory. This is not the case in multiple situations, for example when
rules_pycross is in use and has installed the module via pypi (in which
case it is five levels below runfiles).

Both strategies already know where the runfiles directory exists -
implement _GetRunfilesDir() on the _DirectoryBased strategy, then call
_GetRunfilesDir() in order to populate self._python_runfiles_dir.

Stop passing a bogus path to runfiles.Create() in testCurrentRepository(),
such that the test actually uses the appropriate runfiles path.

Fixes #3085

The current _FindPythonRunfilesRoot() implementation assumes that
the Python module has been unpacked four levels below the runfiles
directory. This is not the case in multiple situations, for example when
rules_pycross is in use and has installed the module via pypi (in which
case it is five levels below runfiles).

Both strategies already know where the runfiles directory exists -
implement _GetRunfilesDir() on the _DirectoryBased strategy, then call
_GetRunfilesDir() in order to populate self._python_runfiles_dir.

Stop passing a bogus path to runfiles.Create() in testCurrentRepository(),
such that the test actually uses the appropriate runfiles path.

Fixes bazel-contrib#3085
@jsing-canva jsing-canva force-pushed the runfiles-fix-upstream branch from 0e21de0 to fa3209a Compare July 14, 2025 07:41
@aignas
Copy link
Collaborator

aignas commented Oct 11, 2025

Hello, going through old PRs and was wondering if you would like to rebase this and see if you can get the CI pass? Recently there were some changes in runfiles to make the compact manifest work, so this may require some work to cleanly rebase.

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.

bazel-runfiles: incorrect assumption for Python runfiles root

2 participants