On Fri, 04 Feb 2005 02:45:34 -0800, Michele Simionato wrote:

> I want to distribute a pure Python package with this structure:
> 
>>    mypackage
>>         __init__.py
>>         module1.py
>>         module2.py
>>         ...
>>         myexecutable.py
> 
> In particular, myexecutable.py is a script which is intended to be used
> from the command line via the shebang trick. I want to distribute on
> Unices.
> and I want a symlink
> 
> /usr/bin/myexecutable -> <package-path>/mypackage/myexecutable.py
> 
> to be made at installation time, when the user runs "python setup.py
> install".
> 
> What is the recommanded way to do that? Do I need a postinstallation
> script or something like that?
> 
> I could do that in various way, but I don't see the obvious one, maybe
> because I am not a Dutch ;)

i'm not sure there is a standard way to do so with distutils.
My current way to handle executable scripts is to have a run() function in
the myexecutable.py module, and then to have a very simple myexecutable
script with the following content:

#!/usr/bin/python
from mypackage import myexecutable
myexecutable.run()

And then register this script using distutils'"scripts" keyword argument. 
This has the advantage that I can also create a very simple .bat file for
windows users without code duplication.

-- 
Sylvain Thénault                               LOGILAB, Paris (France).

http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to