[Rpm-maint] [rpm-software-management/rpm] pythondistdeps: Switch to importlib.metadata (#1317)
Steve Kowalik
notifications at github.com
Tue Sep 29 05:11:15 UTC 2020
@s-t-e-v-e-n-k commented on this pull request.
> from warnings import warn
+try:
+ from importlib.metadata import PathDistribution
+except ImportError:
+ from importlib_metadata import PathDistribution
+
+try:
+ from pathlib import Path
+except ImportError:
+ from pathlib2 import Path
+
+
+class Req(Requirement):
+ @property
+ def key(self):
+ return self.name.lower().replace('_', '-')
I'm sorry, I misread that completely and conflated it with the argument parsing, my apologies.
This would also require massive changes everywhere to stop using the key property, which @torsava has seemed against -- but I'm happy to do so.
Secondly, this doesn't solve it for Distribution, so anything we do for requirements we should also do for the Distribution class -- my current idea is a classmethod on Req that we call there and in Distribution. And a consequence the `normalize_name()` function gets removed as well.
`re.sub('[^A-Za-z0-9.]+', '-', self.name).lower()` is what Distribution current does, which is what `pkg_resources.safe_name()` does.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1317#discussion_r496409925
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20200928/b2648375/attachment.html>
More information about the Rpm-maint
mailing list