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

'PurePosixPath' object has no attribute 'is_relative_to' #184

Closed
tkocmathla opened this issue Apr 18, 2024 · 4 comments
Closed

'PurePosixPath' object has no attribute 'is_relative_to' #184

tkocmathla opened this issue Apr 18, 2024 · 4 comments

Comments

@tkocmathla
Copy link

tkocmathla commented Apr 18, 2024

My environment has python 3.8, and when I run the refresh_compile_commands target, I get an error.

The target is configured as:

refresh_compile_commands(
    name = "refresh_compile_commands",
    exclude_external_sources = True,
    exclude_headers = "external",
)

The error is:

  File "<elided>/bazel-cache/9c934b8d76651a7ec8785c90c08dde0c/execroot/__main__/bazel-out/k8-fastbuild/bin/refresh_compile_commands.py", line 514, in _file_is_in_main_workspace_and_not_external
    if file_path.is_relative_to(pathlib.PurePath("external")):
AttributeError: 'PurePosixPath' object has no attribute 'is_relative_to'

Digging through the commit history here, I think this is an oversight from 0b821b7. In that commit, other uses of PosixPath.is_relative_to() were reverted back to use _is_relative_to(), but this one wasn't:

0b821b7#diff-a1d7061df7c566a1f7656624ec608ad53dd3aff7a7789b9b6e4866a3b1616042R508

It seems like this is the only remaining offender -- a search of .is_relative_to in the repo just finds this one case:
https://github.com/search?q=repo%3Ahedronvision%2Fbazel-compile-commands-extractor%20.is_relative_to&type=code

@cpsauer
Copy link
Contributor

cpsauer commented Jun 28, 2024

Hey Matt. Yep...that's on me. Casualty of the rules_python reversion, exactly as you'd guessed. Sorry guys. Fixing.

@cpsauer
Copy link
Contributor

cpsauer commented Jun 28, 2024

In the future, y'all, please don't hesitate to throw up a PR for something like this if you want to. Would love to get you on the contributor board.

Again, sorry it took as long for me to get to this as it did--thanks for reporting and backtracking.

@m9rco
Copy link

m9rco commented Aug 12, 2024

thx

@cpsauer
Copy link
Contributor

cpsauer commented Aug 12, 2024

:)

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

No branches or pull requests

3 participants