commit:     73879cf2a41096a80f203bb4b143393601411897
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 13 07:02:09 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed Feb 15 17:49:25 2023 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=73879cf2

python: Fix project normalization regex to replace runs of [._-]

Fix the regex used for project normalization to replace runs of
consecutive `[._-]` symbols with a single hyphen, rather than every
character individually.  Adjust the test to verify that it handles
these sequences correctly.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgcheck/checks/python.py                                           | 2 +-
 .../repos/python/dev-python/python-mismatched-package-name/metadata.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py
index 11ebc1e1..29b3db8e 100644
--- a/src/pkgcheck/checks/python.py
+++ b/src/pkgcheck/checks/python.py
@@ -25,7 +25,7 @@ GITHUB_ARCHIVE_RE = 
re.compile(r"^https://github\.com/[^/]+/[^/]+/archive/";)
 SNAPSHOT_RE = re.compile(r"[a-fA-F0-9]{40}\.tar\.gz$")
 USE_FLAGS_PYTHON_USEDEP = re.compile(r"\[(.+,)?\$\{PYTHON_USEDEP\}(,.+)?\]$")
 
-PEP503_SYMBOL_NORMALIZE_RE = re.compile(r"[-_.]")
+PEP503_SYMBOL_NORMALIZE_RE = re.compile(r"[-_.]+")
 
 
 def get_python_eclass(pkg):

diff --git 
a/testdata/repos/python/dev-python/python-mismatched-package-name/metadata.xml 
b/testdata/repos/python/dev-python/python-mismatched-package-name/metadata.xml
index 10320a70..1870d5ea 100644
--- 
a/testdata/repos/python/dev-python/python-mismatched-package-name/metadata.xml
+++ 
b/testdata/repos/python/dev-python/python-mismatched-package-name/metadata.xml
@@ -2,6 +2,6 @@
 <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
 <pkgmetadata>
        <upstream>
-               <remote-id 
type="pypi">python.mismatched.package.name</remote-id>
+               <remote-id 
type="pypi">python.mismatched_package_-name</remote-id>
        </upstream>
 </pkgmetadata>

Reply via email to