git: 2b7d76adec17 - main - Mk/Uses/python.mk: Support PEP440 versioning

From: Matthew Seaman <matthew_at_FreeBSD.org>
Date: Sat, 18 Mar 2023 14:20:21 UTC
The branch main has been updated by matthew:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2b7d76adec17cec8185635e6b2ad46e303cbc77b

commit 2b7d76adec17cec8185635e6b2ad46e303cbc77b
Author:     Matthew Seaman <matthew@FreeBSD.org>
AuthorDate: 2023-03-16 15:55:30 +0000
Commit:     Matthew Seaman <matthew@FreeBSD.org>
CommitDate: 2023-03-18 14:20:02 +0000

    Mk/Uses/python.mk:  Support PEP440 versioning
    
    The python PEP440 version numbering standard is _mostly_ compatible
    with FreeBSD port versioning rules.  Exceptions exist, where the
    PORTVERSION can be derived from the upstream DISTVERSION
    automatically. For example:
    
    PEP440 DISTVERSION:      FreeBSD PORTVERSION:
    2.3.post1                2.3.p1
    
    Now, this interacts badly with PEP517 build setups.  hatchling will
    enforce PEP440 complicance, so it isn't practical to modify the ported
    code to use exactly the FreeBSD version.
    
    Instead, simply referring to DISTVERSION rather than PORTVERSION will
    allow the build process to complete smoothly.
    
    See https://reviews.freebsd.org/D39123 for an example port update
    which depends on this change
    
    Approved by:    python (maintainer, vishwin)
    Differential Revision:  https://reviews.freebsd.org/D39124
---
 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 edf56e387102..b4155814d617 100644
--- a/Mk/Uses/python.mk
+++ b/Mk/Uses/python.mk
@@ -151,7 +151,7 @@
 #			  default: <empty>
 #
 # PEP517_INSTALL_CMD	- Command sequence for a PEP-517 install frontend that installs a wheel.
-#			  default: ${PYTHON_CMD} -m installer -d ${STAGEDIR} -p ${PREFIX} --no-compile-bytecode ${BUILD_WRKSRC}/dist/${PORTNAME:C/[-_]+/_/g}-${PORTVERSION}-*.whl
+#			  default: ${PYTHON_CMD} -m installer -d ${STAGEDIR} -p ${PREFIX} --no-compile-bytecode ${BUILD_WRKSRC}/dist/${PORTNAME:C/[-_]+/_/g}-${DISTVERSION}-*.whl
 #
 # PEP517_INSTALL_DEPEND	- Port needed to execute ${PEP517_INSTALL_CMD}.
 #			  default: ${PYTHON_PKGNAMEPREFIX}installer>0:devel/py-installer@${PY_FLAVOR}
@@ -680,7 +680,7 @@ PYDISTUTILS_EGGINFODIR?=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
 # PEP-517 support
 PEP517_BUILD_CMD?=	${PYTHON_CMD} -m build -n -w ${PEP517_BUILD_CONFIG_SETTING}
 PEP517_BUILD_DEPEND?=	${PYTHON_PKGNAMEPREFIX}build>0:devel/py-build@${PY_FLAVOR}
-PEP517_INSTALL_CMD?=	${PYTHON_CMD} -m installer -d ${STAGEDIR} -p ${PREFIX} --no-compile-bytecode ${BUILD_WRKSRC}/dist/${PORTNAME:C/[-_]+/_/g}-${PORTVERSION}-*.whl
+PEP517_INSTALL_CMD?=	${PYTHON_CMD} -m installer -d ${STAGEDIR} -p ${PREFIX} --no-compile-bytecode ${BUILD_WRKSRC}/dist/${PORTNAME:C/[-_]+/_/g}-${DISTVERSION}-*.whl
 PEP517_INSTALL_DEPEND?=	${PYTHON_PKGNAMEPREFIX}installer>0:devel/py-installer@${PY_FLAVOR}
 
 # nose support
@@ -901,7 +901,7 @@ do-install:
 	@${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
 	@cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PEP517_INSTALL_CMD}
 	@${PYTHON_CMD} -B ${PORTSDIR}/Mk/Scripts/strip_RECORD.py \
-		${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/${PORTNAME:C/[-_]+/_/g}-${PORTVERSION}.dist-info/RECORD >> ${_PYTHONPKGLIST}
+		${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/${PORTNAME:C/[-_]+/_/g}-${DISTVERSION}.dist-info/RECORD >> ${_PYTHONPKGLIST}
 	@${REINPLACE_CMD} -e 's|^|${PYTHONPREFIX_SITELIBDIR}/|' \
 		-e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../etc/|etc/|' \
 		-e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../bin/|bin/|' \