Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Apr 2026 06:46:06 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 294838] Mk/Uses/python.mk: PEP 427 normalization regex [:C|[-]+||g] does not convert '.' to '_', breaking pep517 builds for ports with '.' in PORTNAME
Message-ID:  <bug-294838-7788@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294838

            Bug ID: 294838
           Summary: Mk/Uses/python.mk: PEP 427 normalization regex
                    [:C|[-]+||g] does not convert '.' to '_', breaking
                    pep517 builds for ports with '.' in PORTNAME
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: sunpoet@FreeBSD.org
          Reporter: hajime.murai@gmail.com
          Assignee: sunpoet@FreeBSD.org
             Flags: maintainer-feedback?(sunpoet@FreeBSD.org)

Created attachment 270199
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=270199&action=edit
patch for Mk/Uses/python.mk

In Mk/Uses/python.mk, the following two locations use the make(1) :C
modifier to normalize PORTNAME to a PEP 427-compliant wheel filename stem:
Line 760 (PEP517_INSTALL_CMD):
    PORTNAME:C∣[−]+∣∣g−{PORTNAME:C|[-_]+|_|g}-
PORTNAME:C∣[−]​+∣∣​g−{DISTVERSION}*.whl
Line 993 (strip_RECORD.py invocation):
    PORTNAME:C∣[−]+∣∣g−{PORTNAME:C|[-_]+|_|g}-
PORTNAME:C∣[−]​+∣∣​g−{DISTVERSION}*.dist-info/RECORD
The character class [-_]+ converts hyphens and underscores to _, but does
not convert . (dot) to _.
PEP 427 (wheel filename normalization) and PEP 625 (sdist filename
normalization) both require that . in a distribution name be replaced with
_ when constructing filename components.  The Python build / installer
toolchain honours this: a port named backports.zstd produces
backports_zstd-1.3.0-cp312-cp312-freebsd_15_0_release_p5_amd64.whl
backports_zstd-1.3.0.dist-info/
whereas python.mk constructs the glob
backports.zstd-1.3.0*.whl          (dot retained → no match)
backports.zstd-1.3.0*.dist-info/   (dot retained → no match)
causing both the installer invocation and strip_RECORD.py to raise
FileNotFoundError and abort staging.
Reproduction
cd /usr/ports/devel/py-backports.zstd
make stage
Observed on FreeBSD 15.0-RELEASE amd64 with python312.
Error messages (abridged)
installer (line 760 mismatch):
FileNotFoundError: .../dist/backports.zstd-1.3.0*.whl
strip_RECORD.py (line 993 mismatch):
FileNotFoundError: .../site-packages/backports.zstd-1.3.0*.dist-info/RECORD
Fix
Extend the character class from [-_]+ to [-_.]+ at both sites so that
dots are also collapsed to underscores, matching the upstream wheel toolchain
behaviour.
--- a/Mk/Uses/python.mk
+++ b/Mk/Uses/python.mk
@@ -760 +760 @@
-PEP517_INSTALL_CMD?=   ... PORTNAME:C∣[−]+∣∣g−{PORTNAME:C|[-_]+|_|g}-
PORTNAME:C∣[−]​+∣∣​g−{DISTVERSION}*.whl
+PEP517_INSTALL_CMD?=   ... PORTNAME:C∣[−.]+∣∣g−{PORTNAME:C|[-_.]+|_|g}-
PORTNAME:C∣[−.​]+∣∣​g−{DISTVERSION}*.whl
@@ -993 +993 @@


  ${PORTNAME:C|[-_]+|_|g}-${DISTVERSION}*.dist-info/RECORD ...




  ${PORTNAME:C|[-_.]+|_|g}-${DISTVERSION}*.dist-info/RECORD ...


The complete unified diff is attached as python.mk.patch.
Workaround (port-side, until python.mk is fixed)
Set PORTNAME to the underscore-normalized form and override PKGNAME
to preserve the canonical package name:
PORTNAME=  backports_zstd
  PKGNAME=  
PYTHONPKGNAMEPREFIXbackports.zstd−{PYTHON_PKGNAMEPREFIX}backports.zstd-
PYTHONP​KGNAMEPREFIXbackports.zstd−{PORTVERSION}
References

PEP 427 – The Wheel Binary Package Format:
https://peps.python.org/pep-0427/
PEP 625 – Filename of a Source Distribution:
https://peps.python.org/pep-0625/
devel/py-backports.zstd (port where this was first observed)

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-294838-7788>