bazelbuild / bazel-skylib

Common useful functions and rules for Bazel
https://bazel.build/
Apache License 2.0
395 stars 179 forks source link

paths.relativize doesn't support a path not fully under start #30

Open thomasvl opened 6 years ago

thomasvl commented 6 years ago

The docs for paths.relativize compares itself to os.path.relpath, but the current implementation requires path be fully under start.

In theory it could also work for things that have a common prefix:

Right now these cases fail, so adding the support shouldn't break anyone. If callers want something fully nested, they could check the result to ensure it doesn't start with ...

jfirebaugh commented 1 year ago

Aspect's Bazel library has this: https://docs.aspect.build/rules/aspect_bazel_lib/docs/paths/#relative_file