[Distutils] how can I egt the packages and modules in a distribution?
P.J. Eby
pje at telecommunity.com
Fri Aug 20 01:14:52 CEST 2010
At 11:32 PM 8/19/2010 +0100, Chris Withers wrote:
>P.J. Eby wrote:
>>>I'm trying to write a scanner than looks for SQLAlchemy table
>>>objects and it would be great to be able to pass a distribution
>>>name rather than a set of dotted package names...
>>get_distribution('projectname').get_metadata('top_level.txt').splitlines()
>>will return you a list of top-level package or module names
>>provided by the package.
>
>Ah, okay. I assume this will only work for packages that use setuptools?
Or distribute. Or pip (I assume). Anything but plain distutils, basically.
>I assume this is only a problem for namespace packages?
>(ie: if so packages each supply part of a namespace, they will both
>have the namespace listed in top_level.txt, right?)
Correct.
>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. ;-)
More information about the Distutils-SIG
mailing list