[Distutils] pkg_resources: inconsistency when using namespace packages

Manlio Perillo manlio.perillo at gmail.com
Fri Feb 22 21:57:03 CET 2013


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

Hi.

I have find an inconstistency when using the pkg_resources module with
namespace packages.

I'm using setuptools 0.6c11-py2.5.egg

Here is an interactive session:

>>> import pkg_resources
>>> dist = pkg_resources.Requirement.parse('wsgix')
>>> dist = pkg_resources.get_provider(dist)
>>> dist.get_resource_filename(dist, 'y')
'/home/manlio/projects/hg/wsgix/wsgix/y'

>>> dist_2 = pkg_resources.get_provider('wsgix')
>>> dist_2.get_resource_filename(dist_2, 'y')
'/home/manlio/projects/hg/wsgix/wsgix.forms.jqueryui/wsgix/y'


The get_provider function returns two different distributions, when
passing a string or Requirement object.

My problem is with the resource API, since get_provider is called with
the object passed (and I pass a string with the package name); instead
the get_distribution function always convert the object passed to a
Requirement object



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

iEYEARECAAYFAlEn258ACgkQscQJ24LbaURXCwCcDeuCWFUANQwsH0Q9CBATghha
ttMAn1GmzdWmefLyP/7rz0/yBKjfcOyU
=85ks
-----END PGP SIGNATURE-----


More information about the Distutils-SIG mailing list