git: 952e0dba497e - main - python.mk: normalise wheel filename arguments in PEP517_INSTALL_CMD

From: Charlie Li <vishwin_at_FreeBSD.org>
Date: Sat, 14 Jan 2023 01:32:05 UTC
The branch main has been updated by vishwin:

URL: https://cgit.FreeBSD.org/ports/commit/?id=952e0dba497e276c99d0ffb78cecb77a65349832

commit 952e0dba497e276c99d0ffb78cecb77a65349832
Author:     Charlie Li <vishwin@FreeBSD.org>
AuthorDate: 2023-01-13 04:12:01 +0000
Commit:     Charlie Li <vishwin@FreeBSD.org>
CommitDate: 2023-01-14 01:31:41 +0000

    python.mk: normalise wheel filename arguments in PEP517_INSTALL_CMD
    
    The living binary distribution format specification derived from
    PEP-427 [0] prescribes that:
    
      In distribution names, any run of -_. characters (HYPHEN-MINUS,
      LOW LINE and FULL STOP) should be replaced with _ (LOW LINE), and
      uppercase characters should be replaced with corresponding lowercase
      ones. This is equivalent to PEP 503 normalisation followed by
      replacing - with _. Tools consuming wheels must be prepared to
      accept . (FULL STOP) and uppercase letters, however, as these
      were allowed by an earlier version of this specification.
    
    This fixes staging for packages built under PEP-517 with dashes
    (HYPHEN-MINUS) in their names.
    
    [0] https://packaging.python.org/en/latest/specifications/binary-distribution-format/
    
    Reported by: amdmi3
    Tested by: yasu, rhurlin
    PR: 268893
    With hat: python
    Approved by: mentors (implicit)
---
 Mk/Uses/python.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk
index 5f9bf0455f0a..0aa9b44f75d2 100644
--- a/Mk/Uses/python.mk
+++ b/Mk/Uses/python.mk
@@ -185,7 +185,7 @@
 #			  default: ${PYTHON_PKGNAMEPREFIX}build>0:devel/py-build@${PY_FLAVOR}
 #
 # PEP517_INSTALL_CMD	- Command sequence for a PEP-517 install frontend that installs a wheel.
-#			  default: ${PYTHON_CMD} -m installer -d ${STAGEDIR} --no-compile-bytecode ${BUILD_WRKSRC}/dist/${PORTNAME}-${PORTVERSION}-*.whl
+#			  default: ${PYTHON_CMD} -m installer -d ${STAGEDIR} --no-compile-bytecode ${BUILD_WRKSRC}/dist/${PORTNAME:C/[-_]+/_/g}-${PORTVERSION}-*.whl
 #
 # PEP517_INSTALL_DEPEND	- Port needed to execute ${PEP517_INSTALL_CMD}.
 #			  default: ${PYTHON_PKGNAMEPREFIX}installer>0:devel/py-installer@${PY_FLAVOR}
@@ -657,7 +657,7 @@ PYDISTUTILS_EGGINFODIR?=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
 # PEP-517 support
 PEP517_BUILD_CMD?=	${PYTHON_CMD} -m build -n -w
 PEP517_BUILD_DEPEND?=	${PYTHON_PKGNAMEPREFIX}build>0:devel/py-build@${PY_FLAVOR}
-PEP517_INSTALL_CMD?=	${PYTHON_CMD} -m installer -d ${STAGEDIR} --no-compile-bytecode ${BUILD_WRKSRC}/dist/${PORTNAME}-${PORTVERSION}-*.whl
+PEP517_INSTALL_CMD?=	${PYTHON_CMD} -m installer -d ${STAGEDIR} --no-compile-bytecode ${BUILD_WRKSRC}/dist/${PORTNAME:C/[-_]+/_/g}-${PORTVERSION}-*.whl
 PEP517_INSTALL_DEPEND?=	${PYTHON_PKGNAMEPREFIX}installer>0:devel/py-installer@${PY_FLAVOR}
 
 # nose support
@@ -857,7 +857,7 @@ do-install:
 	@${SED} -e 's|^|${PYTHONPREFIX_SITELIBDIR}/|' \
 		-e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../bin/|bin/|' \
 		-e 's|\,.*$$||' \
-		${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/${PORTNAME}-${PORTVERSION}.dist-info/RECORD >> ${_PYTHONPKGLIST}
+		${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/${PORTNAME:C/[-_]+/_/g}-${PORTVERSION}.dist-info/RECORD >> ${_PYTHONPKGLIST}
 .    endif
 .  endif # defined(_PYTHON_FEATURE_PEP517)