What is the recommended way to implement a py_binary
that writes output(s) to $BINDIR?
#23073
Unanswered
nicholasjng
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello Bazel friends, my question is in the title.
The project+PR I'm referencing is nicholasjng/nanobind-bazel#35.
tl,dr: I have a Python script that takes in an .so file, which Bazel also produces in a preceding build step. When I pass that .so file (or rather, its
rlocationpath
) to the script, it generates a Python stub (.pyi) and optionally a typing marker file, which I intend to put into $BINDIR, because that's where my setuptools extension looks when copying build artifacts from Bazel into the generated wheel.My question is: Is this a sound approach? I was able to obtain $BINDIR easily from the Python script's location by walking up the path on Unix (because runfiles dirs are contained in / symlinked into the bindir), but it seems that does not work on Windows. So I wanted to get a second opinion on whether this makes sense.
NB: I did not want to use a
genrule
since that would also have caused problems with Windows compatibility as I understand it (on Windows systems that don't have Bash for instance).Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions