Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion prelude/python/tools/BUCK
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@prelude//:is_full_meta_repo.bzl", "is_full_meta_repo")
load("@prelude//python:internal_tools.bzl", "python_internal_tools")
load("@prelude//utils:source_listing.bzl", "source_listing")

Expand Down Expand Up @@ -65,7 +66,7 @@ prelude.command_alias(
"$(location :run_inplace.py.in)",
"--template-lite",
"$(location :run_inplace_lite.py.in)",
],
] + (["--use-absolute-path-for-python-interpreter"] if is_full_meta_repo() else []),
exe = ":make_py_package_inplace.py",
visibility = ["PUBLIC"],
)
Expand Down
11 changes: 10 additions & 1 deletion prelude/python/tools/make_py_package_inplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ def parse_args() -> argparse.Namespace:
required=True,
help="The host python binary to use to e.g. compiling bytecode",
)
parser.add_argument(
"--use-absolute-path-for-python-interpreter",
action="store_true",
help="Convert relative python interpreter paths to absolute paths",
)
parser.add_argument(
"--python-interpreter-flags",
default="-Es",
Expand Down Expand Up @@ -186,7 +191,11 @@ def write_bootstrapper(args: argparse.Namespace) -> None:
ld_preload = [p.name for p in args.preload_libraries]

python = str(args.python)
if not os.path.isabs(python) and os.path.sep in python:
if (
args.use_absolute_path_for_python_interpreter
and not os.path.isabs(python)
and os.path.sep in python
):
python = os.path.abspath(python)

new_data = data.replace("<PYTHON>", f"/usr/bin/env {python}")
Expand Down
Loading