ahgamut / superconfigure

wrap autotools configure scripts to build with Cosmopolitan Libc
The Unlicense
159 stars 22 forks source link

Adding "-m" argument automatically to Python binaries #37

Closed supriyo-biswas closed 1 month ago

supriyo-biswas commented 1 month ago

As it stands, Python binaries like datasette binaries require -m datasette to be provided as an argument for it to launch said module.

For a Python application I'm developing, I'm hoping to use cosmopolitan, and I'd like to remove this requirement as it conflicts with user expectations. Is there a way I can patch the APE binaries, so that the Python module can be launched directly?

Thanks!

ahgamut commented 1 month ago

This can be done by using a .args file: a .args files contains command line arguments you want to run everytime, and you add it to the APE binary via the zip command.

For python and datasette an example would be something like this:

./datasette.com --help # should show Python's help
cat > .args << EOF
-m
datasette
...
EOF
zip datasette.com .args 
./datasette.com --help # should show datasette's help

The ... means extra parameters provided at the command line should be put there.

Screenshot:

image