[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to install python applications



We encourage an application's modules to be installed privately when they won't be of any use to other modules / applications.
http://www.debian.org/doc/packaging-manuals/python-policy/ch-programs.html

so what is the preferred way to make the programs find their modules, then?

* put the main python file in /usr/share/my_package/ and symlink it from /usr/bin (as it is done in themole), relying on python to resolve the symlink and find the required modules next to the invoked file

* have a "import sys; sys.path.append('/usr/share/my_program'); import my_main; my_main.run()" main wrapper in /usr/bin/

Choosing between these two is largely a matter of taste. The first one is usually less work, so I prefer it.

* some distutils/distribute/distutils2 magic i'm not aware of

None that I'm aware. ISTR somebody claimed that distutils2 was supposed to have some magic for this, but I can't see anything obvious in the documentation.

and, unless it's the third option: is there an elegant way to integrate that with packages that are already proper (in a python sense) packages and have a setup.py?

Two possible ways that come to mind:

1) python setup.py install --root=debian/foo --install-lib=/usr/share/foo --install-scripts=/usr/share/foo

2) Ignore setup.py completely and use dh_install to move stuff into appropriate places.

(In both cases things get a bit hairy if a script has the name as Python package name...)

--
Jakub Wilk


Reply to: