git: de6965254c3a - main - Mk/Uses/python.mk: Fix USE_PYTHON=pep517: always compile and install bytecode

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Sun, 05 Feb 2023 18:18:15 UTC
The branch main has been updated by sunpoet:

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

commit de6965254c3a007efcf697c3d455b54d2aeb2383
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-02-05 18:16:47 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-02-05 18:16:47 +0000

    Mk/Uses/python.mk: Fix USE_PYTHON=pep517: always compile and install bytecode
    
    - While I'm here, use long options for easier reading [1][2]
    - Bump PORTREVISION of dependent ports (USE_PYTHON=pep517) for package change
    
    It fixes build_fs_violation of dependent ports in poudriere (with -t flag).
    It is also the default behavior of installer [2].
    
    from py-sphinx log:
    =>> Checking for staging violations... done
    =>> Error: Filesystem touched during stage (files must install to ${STAGEDIR}):
    extra: usr/local/lib/python3.9/site-packages/importlib_metadata/__pycache__
    =>> Cleaning up wrkdir
    
    from installer documentation:
    --compile-bytecode
        Possible choices: 0, 1, 2
        generate bytecode for the specified optimization level(s) (default=0, 1)
    --no-compile-bytecode
        don’t generate bytecode for installed modules
        Default: False
    
    With hat:       python
    Reference:      https://pypa-build.readthedocs.io/en/stable/ [1]
                    https://installer.pypa.io/en/stable/cli/installer/ [2]
---
 Mk/Uses/python.mk                      | 15 ++++++++-------
 audio/py-gtts/Makefile                 |  1 +
 biology/py-resdk/Makefile              |  1 +
 cad/py-cocotb/Makefile                 |  1 +
 devel/poetry/Makefile                  |  2 +-
 devel/py-find-libpython/Makefile       |  1 +
 devel/py-importlib-metadata/Makefile   |  1 +
 devel/py-interface-meta/Makefile       |  1 +
 devel/py-mediafile/Makefile            |  2 +-
 devel/py-poetry-plugin-export/Makefile |  1 +
 devel/py-pyls-black/Makefile           |  2 +-
 devel/py-pytoolconfig/Makefile         |  1 +
 dns/letsdns/Makefile                   |  2 +-
 graphics/py-glcontext/Makefile         |  1 +
 graphics/py-moderngl-window/Makefile   |  1 +
 graphics/py-moderngl/Makefile          |  1 +
 graphics/py-traitsui/Makefile          |  1 +
 misc/py-einops/Makefile                |  1 +
 security/py-securesystemslib/Makefile  |  1 +
 security/py-tuf/Makefile               |  1 +
 sysutils/py-docker/Makefile            |  1 +
 textproc/py-sphinx-autoapi/Makefile    |  1 +
 www/py-fastapi/Makefile                |  1 +
 23 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk
index 8ac80fcacd76..6c6c5415c9cc 100644
--- a/Mk/Uses/python.mk
+++ b/Mk/Uses/python.mk
@@ -179,13 +179,13 @@
 #			  default: ${PYDISTUTILS_PKGNAME:C/[^A-Za-z0-9.]+/_/g}-${PYDISTUTILS_PKGVERSION:C/[^A-Za-z0-9.]+/_/g}-py${PYTHON_VER}.egg-info
 #
 # PEP517_BUILD_CMD	- Command sequence for a PEP-517 build frontend that builds a wheel.
-#			  default: ${PYTHON_CMD} -m build -n -w
+#			  default: ${PYTHON_CMD} -m build --no-isolation --wheel
 #
 # PEP517_BUILD_DEPEND	- Port needed to execute ${PEP517_BUILD_CMD}.
 #			  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:C/[-_]+/_/g}-${PORTVERSION}-*.whl
+#			  default: ${PYTHON_CMD} -m installer --destdir ${STAGEDIR} ${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}
@@ -656,10 +656,10 @@ PYDISTUTILS_EGGINFO?=	${PYDISTUTILS_PKGNAME:C/[^A-Za-z0-9.]+/_/g}-${PYDISTUTILS_
 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:C/[-_]+/_/g}-${PORTVERSION}-*.whl
-PEP517_INSTALL_DEPEND?=	${PYTHON_PKGNAMEPREFIX}installer>0:devel/py-installer@${PY_FLAVOR}
+PEP517_BUILD_CMD?=	${PYTHON_CMD} -m build --no-isolation --wheel
+PEP517_BUILD_DEPEND?=	${PYTHON_PKGNAMEPREFIX}build>=0:devel/py-build@${PY_FLAVOR}
+PEP517_INSTALL_CMD?=	${PYTHON_CMD} -m installer --destdir ${STAGEDIR} ${BUILD_WRKSRC}/dist/${PORTNAME:C/[-_]+/_/g}-${PORTVERSION}-*.whl
+PEP517_INSTALL_DEPEND?=	${PYTHON_PKGNAMEPREFIX}installer>=0:devel/py-installer@${PY_FLAVOR}
 
 # nose support
 .  if defined(_PYTHON_FEATURE_NOSE)
@@ -858,7 +858,8 @@ do-install:
 	@${SED} -e 's|^|${PYTHONPREFIX_SITELIBDIR}/|' \
 		-e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../bin/|bin/|' \
 		-e 's|\,.*$$||' \
-		${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/${PORTNAME:C/[-_]+/_/g}-${PORTVERSION}.dist-info/RECORD >> ${_PYTHONPKGLIST}
+		${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/${PORTNAME:C|[-_]+|_|g}-${PORTVERSION}.dist-info/RECORD >> ${_PYTHONPKGLIST}
+	@cd ${STAGEDIR}${PREFIX} && ${FIND} lib -name '*.pyc' >> ${_PYTHONPKGLIST}
 .    endif
 .  endif # defined(_PYTHON_FEATURE_PEP517)
 
diff --git a/audio/py-gtts/Makefile b/audio/py-gtts/Makefile
index fcad55b5b02b..bb74ce8681e9 100644
--- a/audio/py-gtts/Makefile
+++ b/audio/py-gtts/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	gTTS
 DISTVERSION=	2.3.1
+PORTREVISION=	1
 CATEGORIES=	audio python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/biology/py-resdk/Makefile b/biology/py-resdk/Makefile
index 8bab7800ba6a..26507db29a15 100644
--- a/biology/py-resdk/Makefile
+++ b/biology/py-resdk/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	resdk
 DISTVERSION=	16.0.0
+PORTREVISION=	1
 CATEGORIES=	biology python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/cad/py-cocotb/Makefile b/cad/py-cocotb/Makefile
index 211f36f0ab29..028bba005c16 100644
--- a/cad/py-cocotb/Makefile
+++ b/cad/py-cocotb/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	cocotb
 DISTVERSIONPREFIX=	v
 DISTVERSION=	1.7.2
+PORTREVISION=	1
 CATEGORIES=	cad python
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
 
diff --git a/devel/poetry/Makefile b/devel/poetry/Makefile
index 0ebd15085d2e..806082d0d190 100644
--- a/devel/poetry/Makefile
+++ b/devel/poetry/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	poetry
 DISTVERSION=	1.3.2
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMESUFFIX=	-python-tool
diff --git a/devel/py-find-libpython/Makefile b/devel/py-find-libpython/Makefile
index 7bcb691dcbee..a73d97f48882 100644
--- a/devel/py-find-libpython/Makefile
+++ b/devel/py-find-libpython/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	find-libpython
 PORTVERSION=	0.3.0
+PORTREVISION=	1
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/devel/py-importlib-metadata/Makefile b/devel/py-importlib-metadata/Makefile
index 51dd799a6911..81e1c488df56 100644
--- a/devel/py-importlib-metadata/Makefile
+++ b/devel/py-importlib-metadata/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	importlib-metadata
 PORTVERSION=	6.0.0
+PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/devel/py-interface-meta/Makefile b/devel/py-interface-meta/Makefile
index 009b6237a262..becf56cb4402 100644
--- a/devel/py-interface-meta/Makefile
+++ b/devel/py-interface-meta/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	interface-meta
 PORTVERSION=	1.3.0
+PORTREVISION=	1
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/devel/py-mediafile/Makefile b/devel/py-mediafile/Makefile
index 7d747c2dca07..6e4331eb660e 100644
--- a/devel/py-mediafile/Makefile
+++ b/devel/py-mediafile/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	mediafile
 DISTVERSION=	0.11.0
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/devel/py-poetry-plugin-export/Makefile b/devel/py-poetry-plugin-export/Makefile
index dab3541c211f..b2cf83d2ca2e 100644
--- a/devel/py-poetry-plugin-export/Makefile
+++ b/devel/py-poetry-plugin-export/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	poetry-plugin-export
 DISTVERSION=	1.2.0
+PORTREVISION=	1
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/devel/py-pyls-black/Makefile b/devel/py-pyls-black/Makefile
index 05739d37292b..578360aedf54 100644
--- a/devel/py-pyls-black/Makefile
+++ b/devel/py-pyls-black/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	pyls-black
 PORTVERSION=	0.4.7
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/devel/py-pytoolconfig/Makefile b/devel/py-pytoolconfig/Makefile
index af425e207357..9f91c819bb37 100644
--- a/devel/py-pytoolconfig/Makefile
+++ b/devel/py-pytoolconfig/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	pytoolconfig
 PORTVERSION=	1.2.5
+PORTREVISION=	1
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/dns/letsdns/Makefile b/dns/letsdns/Makefile
index e06ae3a167ac..ebde0885fe32 100644
--- a/dns/letsdns/Makefile
+++ b/dns/letsdns/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	letsdns
 DISTVERSION=	1.0.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	dns
 
 MAINTAINER=	flo@FreeBSD.org
diff --git a/graphics/py-glcontext/Makefile b/graphics/py-glcontext/Makefile
index a208bdab9399..50beb004d7ae 100644
--- a/graphics/py-glcontext/Makefile
+++ b/graphics/py-glcontext/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	glcontext
 DISTVERSION=	2.3.7
+PORTREVISION=	1
 CATEGORIES=	graphics
 #MASTER_SITES=	PYPI # no tests
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/graphics/py-moderngl-window/Makefile b/graphics/py-moderngl-window/Makefile
index 9fa380b079f8..25eec71294f8 100644
--- a/graphics/py-moderngl-window/Makefile
+++ b/graphics/py-moderngl-window/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	moderngl-window
 DISTVERSION=	2.4.2
+PORTREVISION=	1
 CATEGORIES=	graphics
 #MASTER_SITES=	PYPI # no tests
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/graphics/py-moderngl/Makefile b/graphics/py-moderngl/Makefile
index ea2b34133fdd..21cda7e8a29a 100644
--- a/graphics/py-moderngl/Makefile
+++ b/graphics/py-moderngl/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	moderngl
 DISTVERSION=	5.7.4
+PORTREVISION=	1
 CATEGORIES=	graphics
 #MASTER_SITES=	PYPI # no tests
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/graphics/py-traitsui/Makefile b/graphics/py-traitsui/Makefile
index 9aba963ae11d..f91747b0e797 100644
--- a/graphics/py-traitsui/Makefile
+++ b/graphics/py-traitsui/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	traitsui
 DISTVERSION=	7.4.3
+PORTREVISION=	1
 CATEGORIES=	graphics python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/misc/py-einops/Makefile b/misc/py-einops/Makefile
index cc9798f1751e..714798781c0c 100644
--- a/misc/py-einops/Makefile
+++ b/misc/py-einops/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	einops
 DISTVERSION=	0.6.0
+PORTREVISION=	1
 CATEGORIES=	misc # machine-learning
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/security/py-securesystemslib/Makefile b/security/py-securesystemslib/Makefile
index 344ac32442de..6bf47630822f 100644
--- a/security/py-securesystemslib/Makefile
+++ b/security/py-securesystemslib/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	securesystemslib
 PORTVERSION=	0.26.0
+PORTREVISION=	1
 CATEGORIES=	security python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/security/py-tuf/Makefile b/security/py-tuf/Makefile
index 30a629a08a38..2c9850d56470 100644
--- a/security/py-tuf/Makefile
+++ b/security/py-tuf/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	tuf
 PORTVERSION=	2.1.0
+PORTREVISION=	1
 CATEGORIES=	security devel python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/sysutils/py-docker/Makefile b/sysutils/py-docker/Makefile
index c41ae5e627e3..525ef55930a8 100644
--- a/sysutils/py-docker/Makefile
+++ b/sysutils/py-docker/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	docker
 PORTVERSION=	6.0.1
+PORTREVISION=	1
 CATEGORIES=	sysutils python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/textproc/py-sphinx-autoapi/Makefile b/textproc/py-sphinx-autoapi/Makefile
index 9eaac2011ef2..f69857858aa8 100644
--- a/textproc/py-sphinx-autoapi/Makefile
+++ b/textproc/py-sphinx-autoapi/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	sphinx-autoapi
 DISTVERSION=	2.0.1
+PORTREVISION=	1
 CATEGORIES=	textproc python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/www/py-fastapi/Makefile b/www/py-fastapi/Makefile
index 23ffa657d8c9..1238cb5c2220 100644
--- a/www/py-fastapi/Makefile
+++ b/www/py-fastapi/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	fastapi
 PORTVERSION=	0.89.1
+PORTREVISION=	1
 CATEGORIES=	www python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}