Distutils question

Michael Hudson mwh at python.net
Fri Dec 21 06:45:08 EST 2001


Fernando =?ISO-8859-1?Q?P=E9rez?= <fperez528 at yahoo.com> writes:

> I have the following problem with distutils: I want to put a certain 
> directory with data files in a place where, after installation, my Python 
> code will be able to find it.
> 
> The problem with the data_files option is that things can end up in places 
> that depend on python config details (/usr, /usr/local, etc) and later my 
> running script will have no way of knowing where to find the information. 

Well, one option would be to *in your script* ask distutils where they
will have gone:

>>> from distutils.core import Distribution
>>> from distutils.command import install
>>> i = install.install(Distribution()) 
>>> i.finalize_options()
>>> i.install_data 
'/home/crew/mwh'

But that's risky; it can be affected by the user options to setup.py.

I'd hope it would be possible to get distutils to install a file in
your package saying where things ended up, but I have no idea if/how
this is possible.

> I'm sure that people who have used distutils for big projects have
> run into this, 

And they probably hang out on the distutils-sig; I suggest asking
there might have better luck.

Cheers,
M.



More information about the Python-list mailing list