Re: making symlinks with distutils
From: Sylvain Thenault (sylvain.thenault_at_logilab.fr)
Date: 02/04/05
- Next message: Richard Brodie: "Re: [Fwd: [gnu.org #220719] Re: python and gpl]"
- Previous message: Michele Simionato: "making symlinks with distutils"
- In reply to: Michele Simionato: "making symlinks with distutils"
- Next in thread: Michele Simionato: "Re: making symlinks with distutils"
- Reply: Michele Simionato: "Re: making symlinks with distutils"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 04 Feb 2005 11:59:22 +0100
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
- Next message: Richard Brodie: "Re: [Fwd: [gnu.org #220719] Re: python and gpl]"
- Previous message: Michele Simionato: "making symlinks with distutils"
- In reply to: Michele Simionato: "making symlinks with distutils"
- Next in thread: Michele Simionato: "Re: making symlinks with distutils"
- Reply: Michele Simionato: "Re: making symlinks with distutils"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|