Skip to content

Commit

Permalink
fix inconsistent naming between packages and dependencies
Browse files Browse the repository at this point in the history
This works around:
pypa/setuptools#2522

For example, when building a module which depends on 'backports_abc',
fpm will currently translate that into a dependency on 'backports-abc'.
When building the 'backports_abc' module, fpm will currently retain the
original name. Thus, it is not possible to use fpm to meet some
dependencies.

Underscores should be allowed in package names, but the most important
thing is to be internally consistent. If and when setuptools fixes
safe_name(), then the behavior will automatically change and remain
consistent.

Note that this change matches both methods ok loading requirements:
* for setup.py, setuptools internally calls pkg_resources.safe_name()
* for requirements.txt, pkg_resources uses its own safe_anem()
  • Loading branch information
bugfood committed Jul 28, 2021
1 parent a0efa4f commit a707787
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fpm/package/pyfpm/get_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def process_dep(self, dep):

def run(self):
data = {
"name": self.distribution.get_name(),
"name": pkg_resources.safe_name(self.distribution.get_name()),
"version": self.distribution.get_version(),
"author": u("%s <%s>") % (
u(self.distribution.get_author()),
Expand Down

0 comments on commit a707787

Please sign in to comment.