From e742ca662b10aad880475897a75cacc96e5d6fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Tue, 13 Jul 2021 14:24:45 +0100 Subject: [PATCH] Fix show config when package names are not canonical MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- docs/changelog/2103.bugfix.rst | 2 ++ src/tox/session/commands/show_config.py | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 docs/changelog/2103.bugfix.rst diff --git a/docs/changelog/2103.bugfix.rst b/docs/changelog/2103.bugfix.rst new file mode 100644 index 0000000000..b7e9d73f5f --- /dev/null +++ b/docs/changelog/2103.bugfix.rst @@ -0,0 +1,2 @@ +Fix show config when the package names are not in canonical form - by :user:`gaborbernat`. + diff --git a/src/tox/session/commands/show_config.py b/src/tox/session/commands/show_config.py index 7fb03a28b0..f0ff955fc1 100644 --- a/src/tox/session/commands/show_config.py +++ b/src/tox/session/commands/show_config.py @@ -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 @@ -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)