[Distutils] Using an egg like a Java jar file
Floris Bruynooghe
floris.bruynooghe at gmail.com
Tue Jul 28 09:53:38 CEST 2009
On Mon, Jul 27, 2009 at 10:57:28PM +0100, Paul Moore wrote:
> 2009/7/27 mhearne808 <mhearne808 at gmail.com>:
> > 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?
>
> In Python 2.6, you can definitely use a zip file like this. See
> http://docs.python.org/using/cmdline.html#command-line
>
> python foo.zip arg1 arg2 ...
>
> foo.zip should contain a __main__.py which is run. sys.argv holds the
> arguments as usual.
On UNIX systems you can even do something like IIRC:
$ echo '#!/usr/bin/python' > tmp
$ cat tmp foo.zip > foo
$ chmod +x foo
$ ./foo arg1 arg2 ...
Regards
Floris
--
Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org
More information about the Distutils-SIG
mailing list