> On Nov 17, 2015, at 9:53 AM, Neal Gompa <ngomp...@gmail.com> wrote: > > On Tue, Nov 17, 2015 at 9:35 AM, Donald Stufft <don...@stufft.io> wrote: >> >>> On Nov 17, 2015, at 9:26 AM, Neal Gompa <ngomp...@gmail.com> wrote: >>> >>> The dependency generator uses pkg_resources (specifically >>> Distribution, FileMetadata, PathMetadata) to read data in the >>> .egg-info directory. That should still work with .dist-info, right? If >>> it does, then I can easily support it to read and parse the data. If >>> there's something else I have to do, please let me know, so I can add >>> it. >>> >> >> That’s correct. There’s a EggInfoMetadata class and a DistInfoMetadata >> class in pkg_resources. >> > > So the code to pull the metadata works like this: > > if lower.endswith('.egg') or \ > lower.endswith('.egg-info') or \ > lower.endswith('.egg-link') or \ > lower.endswith('.dist-info'): > from pkg_resources import Distribution, FileMetadata, PathMetadata > dist_name = basename(f) > if isdir(f): > path_item = dirname(f) > metadata = PathMetadata(path_item, f) > else: > path_item = f > metadata = FileMetadata(f) > dist = Distribution.from_location(path_item, dist_name, metadata) > > And then for pulling the name for Provides, it uses dist.key and > Requires is iterating over dist.requires() to get the desired info. > > Do I need to actually check the path and force it to use one > particular class over the other? >
I think you could just do ``pkg_resources.get_distribution(“name”)``? ----------------- Donald Stufft PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ python-devel mailing list python-devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/python-devel