-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 23/02/2013 18:28, PJ Eby ha scritto:
> [...]
>> The get_provider function returns two different distributions, when
>> passing a string or Requirement object.
> 
> This is because a string passed to get_provider() is a *module* name,
> not a distribution name or requirement.  Thus, the first resource
> obtained above is relative to the distribution root for a project
> named 'wsgix', and the second is relative to
> __import__('wsgix').__file__.  The purpose of this difference is to
> allow you to target either module-relative or distribution-relative
> files.
> 

Yes, thanks.
I have read the HTML documentation, and it was a bit more clear.

> So, you need to call it with the right type of object for the result
> you want to get.  In particular, note that when obtaining resources
> from a namespace package, your results will be unpredictable unless
> you either 1) use a distribution-relative path for a specific
> distribution, by passing in a Requirement for that distribution,

I'm rewriting my projects, using a wrapper around pkg resource API that
will make sure to cast a distribution name string to a Requirement, in
order to get "distribution resources, aka non-package data files".

The main problem is that I can no longer use `package_data` setup
argument, but I have to use the `data_file` argument.

Since `data_file` is not very convenient, I have written this (draft)
function:
http://pastebin.com/w5Ejz3Jt

As an example:

    data_files=find_data_files({
        '': ['locale/*/LC_MESSAGES/*.mo'],
        '/tmp/bin': ['tools/*']
        }),

> [...]


Regards   Manlio Perillo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlEpM+IACgkQscQJ24LbaURG8gCfVDL2XEYohx2bUmVOq7r0VNMU
7DcAnio7QpH85b0tKTmKH8MpeqocaNjm
=CcqL
-----END PGP SIGNATURE-----
_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to