[Distutils] Using an egg like a Java jar file
mhearne808
mhearne808 at gmail.com
Mon Jul 27 21:13:23 CEST 2009
In Java, it is possible to create a .jar file with a main() method
embedded somewhere in one of the .class files. It is then possible to
run the main() method from the command line something like this:
java -jar foo.jar
I believe this will work with only one main() defined - if there are
multiple ones, then you have to specify the path (internal to the jar
file).
I gather from previous googling that there isn't a python command line
option equivalent to -jar for eggs (although that might be kind of
handy)
but that you can add an egg to your path without installing it by
doing something like the following (in a bash shell):
export PYTHONPATH=foo.egg
This will then allow you to run a python script at the command line
without having to actually install the egg to the normal "site-
packages" directory.
My questions:
- Is it possible to embed a script with a "main" entry point in an
egg, and run that from the command line?
- If so, how do you pass command line arguments to that main?
- Is this a massive abuse of the intended usage of setuptools?
Thanks,
Mike
More information about the Distutils-SIG
mailing list