@hroncok 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('_', '-')
That really depends on `self.name` value. I don't see that from the code here.
In pkg_resources, key is based on `self.project_name` and that [is set
to](https://github.com/pypa/setuptools/blob/73e379cc55ac1e9ec63c4ac30b75ecc82418f513/pkg_resources/__init__.py#L2564)
`safe_name(project_name)`.
In packaging, I believe `self.name` is not pre-processed. See:
```pycon
>>> import pkg_resources
>>> pkg_resources.safe_name("Tree-_-FALLING.Down").lower()
'tree-falling.down'
>>> from packaging.requirements import Requirement
>>> Requirement("Tree-_-FALLING.Down").name.lower().replace('_', '-')
'tree---falling.down'
```
--
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_r494234076
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint