New (optional) python egg dependency generator for RPM
Donald Stufft
donald at stufft.io
Tue Nov 17 14:57:46 UTC 2015
> On Nov 17, 2015, at 9:53 AM, Neal Gompa <ngompa13 at gmail.com> wrote:
>
> On Tue, Nov 17, 2015 at 9:35 AM, Donald Stufft <donald at stufft.io> wrote:
>>
>>> On Nov 17, 2015, at 9:26 AM, Neal Gompa <ngompa13 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.fedoraproject.org/pipermail/python-devel/attachments/20151117/aae9f498/attachment.sig>
More information about the python-devel
mailing list