Skip to content

Commit

Permalink
Fix show config when package names are not canonical (#2103)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat authored Jul 13, 2021
1 parent 4c0e09b commit fc593d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/changelog/2103.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
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
Original file line number Diff line number Diff line change
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 fc593d2

Please sign in to comment.