3 ms·
I engaged in this sort of shenanigans recently when I wanted to pull a Python interpreter out of a .zip file, save it somewhere temporary, and then execute the
by thundergolfer 5y ago
I engaged in this sort of shenanigans recently when I wanted to pull a Python interpreter out of a .zip file, save it somewhere temporary, and then execute the .zip file with that extracted Python interpreter, all when you did ./runme.zip.
It's then a (mostly) hermetic Python executable.
When I got it working, it felt like the first genuine 'hack' of my career. Something that's awful, novel*, and awesome at the same time.
* novel at least to me. It wasn't something I copied off stack overflow or a blog post.
- syllogism 5y agoYou might be interested in pex: https://pex.readthedocs.io/en/latest/ https://pex.readthedocs.io/en/latest/
- BiteCode_dev 5y agoPex doesn't embed the executable. Besides, it doesn't work on Windows, if you want a zipapp, shiv is a better alternative: http://shiv.readthedocs.io http://shiv.readthedocs.io
- gompertz 5y agoYou may also want to look into 'EEE'. EEE is a program that combines multiple files and actions into a compressed Windows, Linux or Mac OS X (Darwin). executable. http://www.erikveen.dds.nl/eee/index.html http://www.erikveen.dds.nl/eee/index.html
- brnt 5y agoUnrelated, but it's been some time since I last heard or thought about DDS.nl! This was an early (90ies?) Dutch internet community which completely left my field of view for decades but apparently is still a thing!
- thundergolfer 5y agoThanks, yeah I'm familiar with Pex, and used google/subpar for a few years. This was hacking I was doing with a google/subpar (.par) file.
- bitwize 5y ago"This is impressive, disturbing, and makes me uncomfortable!" --Strong Bad
- jfrunyon 5y agoThis sounds like "freezing" a script, which there are many solutions to do, f.e. https://pypi.org/project/cx-Freeze/ https://pypi.org/project/cx-Freeze/ You might be running with your interpreter, but are you running with your standard library? The solutions out there will make sure to package up not only the interpreter and your files, but also any other files you import.