Skip to content

Commit

Permalink
Fix show config when package names are not canonical
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Jul 13, 2021
1 parent c5e7869 commit e742ca6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions docs/changelog/2103.bugfix.rst
@@ -0,0 +1,2 @@
Fix show config when the package names are not in canonical form - by :user:`gaborbernat`.

8 changes: 3 additions & 5 deletions src/tox/session/commands/show_config.py
Expand Up @@ -2,7 +2,6 @@
from collections import OrderedDict

from packaging.requirements import Requirement
from packaging.utils import canonicalize_name
from six import StringIO
from six.moves import configparser

Expand Down Expand Up @@ -65,16 +64,15 @@ def version_info(parser):
while to_visit:
current = to_visit.pop()
current_dist = importlib_metadata.distribution(current)
current_name = canonicalize_name(current_dist.metadata["name"])
current_name = current_dist.metadata["name"]
versions[current_name] = current_dist.version
if current_dist.requires is not None:
for require in current_dist.requires:
pkg = Requirement(require)
pkg_name = canonicalize_name(pkg.name)
if (
pkg.marker is None or pkg.marker.evaluate({"extra": ""})
) and pkg_name not in versions:
to_visit.add(pkg_name)
) and pkg.name not in versions:
to_visit.add(pkg.name)
set_section(parser, "tox:versions", versions)


Expand Down

0 comments on commit e742ca6

Please sign in to comment.