[Distutils] command hooks...

Tarek Ziadé tarek at ziade.org
Wed May 23 08:48:27 CEST 2012


On 5/23/12 8:16 AM, Robert Park wrote:
> On Mon, May 21, 2012 at 3:42 PM, Tarek Ziadé<tarek at ziade.org>  wrote:
>> If you are a packager for a project, you can describe in details your data
>> files, and add more metadata that are understood by PyPI.
>>
>> If you are a debian packager, you will be able to define where the data
>> files of a python project should be installed without having to patch some
>> python code.
> This right here is the killer feature for me. By my limited
> observations, most people solve the data files problem either by
> dumping their data files inside their python modules (which is an ugly
> abuse of the filesystem), or are simply using the cumbersome autotools
> in order to record the installation prefix for their data files. It
> blows my mind that it is standard practice for many GNOME apps written
> in Python to use a C compilation preprocessor in order to set a python
> variable so their python scripts can find their data files.
>
> Currently I am hacking distutils in order to accomplish this, like so:
>
> https://github.com/robru/gottengeography/blob/master/setup.py
>
> But this is ugly because it modifies the file in-place, so I always
> have to be careful not to accidentally commit the munged file into my
> git repo.
>
> It's absolutely critical that any replacement for distutils have
> built-in functionality for installed python code being able to query
> at run-time the location that data files were placed at install time.
>
Please read this section and let us know what you think:

http://docs.python.org/dev/packaging/setupcfg.html#resources

This works in conjunction with the new sysconfig module, which can be 
configured system-wide by the linux distribution, or locally per projet

Then you can use an API to get the file from your code.

Gosh the documentation is a mess ... we need to fix this - it has bits 
from the previous version that should be removed :(

Cheers
Tarek


More information about the Distutils-SIG mailing list