[Distutils] pkg_resources: parsing requires.txt without .egg-info/ directory
P.J. Eby
pje at telecommunity.com
Wed Jul 22 03:04:00 CEST 2009
At 05:27 PM 7/21/2009 -0700, Sridhar Ratnakumar wrote:
>Ok, I give up.
>
>To parse I need access to the .egg-info/ directory. Why? This is the code
>I currently use to access _dep_map.
>
>>>>import pkg_resources as pr
>>>>egg_info = '[...]/src/zope.component.egg-info'
>>>>base_dir = os.path.dirname(egg_info)
>>>>metadata = pr.PathMetadata(base_dir, egg_info)
>>>>dist = pr.Distribution(base_dir,
>>>>project_name=os.path.splitext(os.path.basename(egg_info))[0],
>>>>metadata=metadata)
>>>>dist._dep_map
>
>Is there anyway to get access to this parsed _dep_map without having a
>reference to the .egg-info directory? After all, everything needed to
>parse requires.txt is that file alone.
>
>Note: requires.txt is extracted and stored elsewhere, so I cannot rely in
>it being inside .egg-info/ directory in order to parse it.
print require('zope.component')[0]._dep_map would be the normal way
to get it, for a package that's already installed.
However, from some of the rest of what you're saying, it sounds like
you're trying to parse this for an un-built package. Is that the case?
More information about the Distutils-SIG
mailing list