Quantcast
Channel: LowEndTalk
Viewing all articles
Browse latest Browse all 41885

PySFX, a tool to create self-extracting Python scripts

$
0
0

It's still very much experimental, but seems to work fairly reliably already. I'm using it for CVM and will also be using it for pyLSA. It might come in handy for people wanting to deploy the same thing on a bunch of nodes :)

It basically lets you specify a single file (very much untested) or tar.gz as input (more tested), and creates a single .py file that, upon execution, will extract that data to a temporary directory and optionally autorun a command of choice. There are no dependencies on the extracting system other than the Python standard library and zlib (pretty much every system has this).

Example command:

tar -czf - * | pysfx -as "python test.py" - sfx.py

This will create an SFX file named sfx.py, that contains all the files (and folders) in the current directory, and it will run test.py on execution (after extracting). Do note that you need to specify the entire command to run, not just a .py file. For more help, run pysfx --help.

How to install: pip install pysfx (you might need to easy_install pip if you only have setuptools, or even apt-get install python-setuptools or yum install python-setuptools if you don't even have setuptools)

Source: https://github.com/joepie91/pysfx

Enjoy :)


Viewing all articles
Browse latest Browse all 41885

Trending Articles