From fc593d2ec692fd888aea4dbf0b847e6e192ac975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Tue, 13 Jul 2021 16:48:19 +0100 Subject: [PATCH] Fix show config when package names are not canonical (#2103) --- docs/changelog/2103.bugfix.rst | 1 + src/tox/session/commands/show_config.py | 8 +++----- 2 files changed, 4 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 000000000..3bc7ce398 --- /dev/null +++ b/docs/changelog/2103.bugfix.rst @@ -0,0 +1 @@ +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 7fb03a28b..f0ff955fc 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)