-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
repository_ctx.path should be able to handle an alias to an exported source file #8674
Comments
What makes this even less ideal is that if we want to make it configurable by the user, so they could set themselves what node to run in the repository rules there is no nice way to let them set that with just one label. |
Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so. |
Hi @sgowroji, I have encountered the same issue when trying to let bazel_dep(name = "rules_python", version = "0.26.0")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
configure_coverage_tool = True,
python_version = "3.8",
)
use_repo(python, "python_versions", "python_3_8")
bazel_dep(name = "pybind11_bazel", version = "2.11.1")
python_configure = use_extension("@pybind11_bazel//:python_configure.bzl", "extension")
python_configure.toolchain(python_interpreter_target = "@python_3_8//:python3")
use_repo(python_configure, "local_config_python", "pybind11") The implementation of mutongx/bzlmod-pybind11-fail is a full example that demonstrates the use case. The error can be reproduced by running My current workaround is replacing |
Repo rules can only operate on file targets, instead of rule targets like |
OK. Thanks for your reply! |
@mutongx wants to use a specific Python version whereas I want to use the default Python version, but either way, it should be straightforward to make pybind11_bazel's Ping, @rickeylev and @rwgk. :) |
Description of the problem / feature request:
If I try to call
repository_ctx.path
on a label that corresponds to an alias that points to an exported source file I get the errorNot a regular file: ...
. I would expect that to just give me the path of the actual source file.Feature requests: what underlying problem are you trying to solve with this feature?
In https://github.com/bazelbuild/rules_nodejs we expose an external repository called
nodejs
which downloads the node binary for the corresponding host platform to be able to run things like the package manager, etc on the host platform. To make it easy for other call-sites from within the rules itself but also for users we expose an aliasnode_bin
which points to the actual binary, which on linux and darwin isnode
and on windows 'node.exe'. So now I have to decide on which binary to use in multiple places rather than just relying on that already existing alias.See code here: https://github.com/bazelbuild/rules_nodejs/pull/827/files#diff-67b0f7c2b38c3bbb6dd40c85eb923174R452
What operating system are you running Bazel on?
Elementary OS 5 (Ubuntu 18.04)
What's the output of
bazel info release
?release 0.27.0
Have you found anything relevant by searching the web?
Somewhat related: #3901
Also somewhat related to this specific issue: #1485
The text was updated successfully, but these errors were encountered: