Open TomiBelan opened 1 year ago
Just to clarify, I think this problem only happens with real console scripts (e.g. scripts=...
in setup.py), and not console script entry points (e.g. entry_points={ 'console_scripts': [...] }
in setup.py).
Console script entry points are unaffected by this issue because shiv translates them in find_entry_point().
If you use the
-c console_script
option or theSHIV_CONSOLE_SCRIPT
variable, and the console script file returns normally (it does not throw or call sys.exit), running the pyz will print the whole__main__
module dictionary with all global variables to stderr at the end.The root cause is that shiv effectively runs
sys.exit(runpy.run_path(path))
. This is wrong because run_path returns the resulting module globals dictionary. sys.exit converts the dict to a repr string and prints it to stderr.Example:
Notice the global variable
'what': 'world'}
at the end.File hello/helloworld:
File hello/setup.py;
File hello/project.toml: