Finding application data after install - a solution?

Wolodja Wentland wentland at cl.uni-heidelberg.de
Tue Sep 22 06:34:10 CEST 2009


On Mon, Sep 21, 2009 at 23:52 -0300, Gabriel Genellina wrote:
> En Sat, 19 Sep 2009 12:03:52 -0300, Wolodja Wentland
> <wentland at cl.uni-heidelberg.de> escribió:
> 
> >reliably finding distribution data from your program seems to be an
> >unsolved issue for programs packaged with distutils.

[...]

> Isn't pkgutil.get_data() what you're looking for?
> I'm not sure it covers all your use cases though.

No that pkgutil.get_data() is exactly *not* what I am looking for ;-)

I have a library which *could* use external data and use this additional
information to cover more cases, but works perfectly fine without this
data. The data could change more frequently than i want to release the
library.

I use distutils data_files=... to have the data installed, but there
is/was (until the recipe I posted here) no way to find that data again,
because the admin could define arbitrary prefixes for libs, scripts and
data. That means that there might be absolutely no relation between the
module path and the data file path.

I want to:

    1. Give administrators the freedom to install the data wherever they
       want
    2. Adhere to the FHS (installing data within modules breaks it)
    3. Be able to find that data again regardless of the installation
      scheme used

1 and 2 are easily solved... It was just not possible to find the data
again. The snippet in the original code solves that.

I still don't think that relying on these internal structures within
distutils is supported, but can't think of a better way.

so long and thanks for all the fish

    Wolodja
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 852 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20090922/116e7d99/attachment.pgp>


More information about the Python-list mailing list