[Distutils] how can I egt the packages and modules in a distribution?
P.J. Eby
pje at telecommunity.com
Fri Aug 20 01:40:55 CEST 2010
At 12:20 AM 8/20/2010 +0100, Chris Withers wrote:
>P.J. Eby wrote:
>>>Ah, okay. I assume this will only work for packages that use setuptools?
>>Or distribute. Or pip (I assume). Anything but plain distutils, basically.
>
>Well, the packages import setup from setuptools for all of the
>above, apart from plain distutils ;-)
If you use any of those tools to do the installing, it doesn't matter
whether the package itself imports setuptools or distutils.
>>>How do static resources returned with
>>>pkg_resources.resource_filename and friends fare when packages are
>>>installed in a "flat" form?
>>They go in the same relative location as they would in an egg, it's
>>just that in flat layouts everyone's files are in the same namespace.
>>Sort of a "scrambled egg", if you will. ;-)
>
>Okay, so if we have two distributions, x.a and x.b both define
>template folders called 'templates', and each has a template called
>'master', what ends up on disk? what does
>pkg_resources.resource_filename('x.a','templates/master') return?
>It should be different to
>pkg_resources.resource_filename('x.b','templates/master'), but will it be?
You seem to be confusing distributions and packages. If 'x.a' and
'x.b' are package names, then each will have its own directory
('x/a/templates' or 'x/b/templates'). If they used install_data to
specify non-package data, OTOH, it'll be mixed.
That's why the recommendation is to use package_data or
include_package_data; if both projects included their data using one
of those two setup() options, they'll be fine.
More information about the Distutils-SIG
mailing list