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 pkg_resources 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_name()
  • Loading branch information
bugfood committed Jul 28, 2021
1 parent 0f4308e commit 2685594
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 2685594

Please sign in to comment.