Skip to content
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

--executable option to override sys.executable #257

Open
riastradh opened this issue Jan 15, 2025 · 0 comments
Open

--executable option to override sys.executable #257

riastradh opened this issue Jan 15, 2025 · 0 comments

Comments

@riastradh
Copy link

riastradh commented Jan 15, 2025

python -m installer supports several options for controlling the paths in the output when they don't match the Python system that is running:

  • --destdir puts everything relative to a system root
  • --prefix overrides sys.prefix for the installation prefix within that system root where files are installed

But there appears to be no way to control the path that is stored in #! lines of entry points that installer creates. In contrast, for example, historically with setuptools, python setup.py install would respect [build] executable = '/path/to/python' in setup.cfg; this functionality doesn't appear to be available through installer. It would be nice if python -m installer additionally supported:

  • --executable overrides sys.executable for the Python executable path within that system root used in #! lines generated for entry points

This is important for cross-compilation into a fixed file system layout in the destdir that is independent of where Python happened to be installed on a development machine. For example, if I set up a virtualenv in /home/riastradh/venv for a cross-compilation toolchain, sys.executable will be /home/riastradh/venv/bin/python, but the scripts installed in the destdir need to start with #!/opt/pkg/bin/python -- just like files installed in the destdir need to go under /opt/pkg/lib/python3.12/site-packages according to --prefix, rather than under /home/riastradh/venv/lib/python3.12/site-packages according to sys.prefix.

riastradh pushed a commit to riastradh/pypa-installer that referenced this issue Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant