-
Notifications
You must be signed in to change notification settings - Fork 333
Description
I've encountered an issue with the make_py_package_inplace.py script used in Buck2 for creating .pex files. The script currently includes the absolute path of the Python interpreter in the shebang line.
This works if you're passing a system binary as an argument when invoking it, but we define the python interpreter to use in our project (using nix).
If the action creating the .pex file is run on a remote executor, the path will reference the python binary inside the temporary build directory:
#!/usr/bin/env /build/work/3a1d9a9b-5eba-4272-bd71-ce3e07f3540a/work/buck-out/v2/gen/toolchains/b42aeba648b8c415/__python_bootstrap_interpreter__/out.link/bin/python
Any other dependent action using this script will fail with "no such file or directory".
Because of this, these outputs cannot be cached.
I see this was recently (well Aug 2025, but we updated from 2025-06-15 π) changed by commit 5f5f692
These paths are clearly relative to something, and so the resulting par would only be runnable when CWD is that something. That's suboptimal.
Yes, but I think using relative paths (relative to the project root) should be the most idiomatic way. I can see that this will not work if you run this from a different directory. But if this is needed, those files could be modified by another action doing something sensible.
WDYT @zsol