distutils possibilities

Sridhar R sridharinfinity at yahoo.com
Sat Feb 14 05:57:43 EST 2004


I learnt that distutils can be used to package python modules and
packages.  Fine it does that well.

Suppose I am writing an python application (not package or module),
and suppose that I am using Linux.  Where should I install the python
source files and bin scripts and data in my /usr directory?

Should the python (.py) files go into /usr/lib/pythonXX/site-packages
or /usr/lib/myapp or /usr/share/myapp ?

Should the data files go to /usr/share/myapp or anything else?

Should the pixmap files go to /usr/share/pixmaps/myapp?

I can write setup.py to do all these things.  But in general are there
any standards for installation directories? Note that I am asking this
for python _applications_ not packages like PIL,Numeric.  Hope you get
me.  There are python source files, executable scripts (/usr/bin) and
data files distributed in a typical applications.

Finally, since the installation directory can vary (as the sys admin
can customize the prefix and also during development the prefix is
usually current directory), I need pythonic solution for such a
dynamic constants.py file.
In automake world, one would write constants.py.in and transform this
into constants.py.  Rememerber constants.py file contain different
values during development (prefix=/home/sri/Projects/myapp) and
different values during deployment (prefix=/usr/)  Again, I can follow
my logic, to create such a constants.py script, by coding the logic in
setup.py script and supporting extra command line option.  But are
there any standard tool or any support from distutils to do such
things?

Now a bit of relaxation, what abt installtion directories in other
platforms?



More information about the Python-list mailing list