Relocatability of launchers?
Issue #3
resolved
Pip seems to be using this library for creating standalone launchers (I'm guessing based on finding "C:\Users\Vinay\Projects\simple_launcher\x64\Release\CLISimpleLauncher.pdb" in the launcher executables created by pip.)
I am working on Conda and Conda-build, and I need to make these executables portable (created at build time, and patched with a new prefix at install time is our current modus operandi). We have a scheme for prefix replacement in text and in binaries, and this seems to replace the python prefix correctly, but I get an error:
(C:\MC2x64\envs\_test) C:\MC2x64\conda-bld\test-tmp_dir>conda build -h
Traceback (most recent call last):
File "C:\MC2x64\envs\_test\lib\runpy.py", line 165, in _run_module_as_main
mod_name, loader, code, fname = _get_main_module_details(_Error)
File "C:\MC2x64\envs\_test\lib\runpy.py", line 133, in _get_main_module_details
return _get_module_details(main_name)
File "C:\MC2x64\envs\_test\lib\runpy.py", line 121, in _get_module_details
raise error(format(e))
ImportError: bad local file header: C:\MC2x64\envs\_test\Scripts\conda-build.exe
Is there a way that you would recommend to make these launchers portable?
Comments (4)
-
repo owner -
repo owner -
reporter Thank you, Vinay. That's very helpful. Closing this issue.
-
reporter - changed status to resolved
Resolved with direction from Vinay.
- Log in to comment
Executable launchers created with
distlib
consist of a launcher from this project + a shebang + a zip file containing the actual Python script to run (the payload). Here is the code which writes the executable.You would need to split the file up into launcher, shebang and payload, update the shebang and then save launcher + updated shebang + payload. An example of a program which updates shebangs in such a file is my
pyzzer
tool, available from here. The relevant unpacking code is here.