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

From: Charlie Li <vishwin_at_FreeBSD.org>
Date: Sun, 05 Feb 2023 19:41:26 UTC
The branch main has been updated by vishwin:

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

commit f5890bd3cbc66a805bfc04a1a45688b5a3e68c50
Author:     Charlie Li <vishwin@FreeBSD.org>
AuthorDate: 2023-02-05 19:05:02 +0000
Commit:     Charlie Li <vishwin@FreeBSD.org>
CommitDate: 2023-02-05 19:05:02 +0000

    Revert "Mk/Uses/python.mk: Fix USE_PYTHON=pep517: always compile and install bytecode"
    
    Despite installer's default behaviour to compile and install bytecode,
    we are not doing so going forward at stage/package time. [0] During
    initial development and qualification of PEP-517 framework support,
    compiling and installing bytecode at stage/package time was considered,
    but was found problematic, fragile and ultimately unreliable, both
    currently and historically (with USE_PYTHON=distutils), due to our
    fixed plist requirement. While the living binary distribution format
    (wheel) specification [1] says to compile bytecode, that is in the
    pure Python package management context (pip, etc); nuance always
    exists when interacting with "system" package management.
    
    Additionally, "bytecode is an implementation detail of the CPython
    interpreter. No guarantees are made that bytecode will not be added,
    removed, or changed between versions of Python," thus "should not
    be considered to work across Python VMs or Python releases." [2]
    This is important to ensuring correctness for those ports specifying
    NO_ARCH.
    
    Instead of compiling and installing bytecode at stage/package time,
    there is a WIP, review D34739, that compiles and installs bytecode
    at install time instead, using triggers.
    
    The aforementioned build_fs_violations will be investigated.
    
    This reverts commit de6965254c3a007efcf697c3d455b54d2aeb2383.
    
    With hat:       python
    Approved by:    tcberner (mentor, portmgr)
    Reference:      https://wiki.freebsd.org/Python/PEP-517 [0]
                    https://packaging.python.org/en/latest/specifications/binary-distribution-format/ [1]
                    https://docs.python.org/3/library/dis.html [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, 11 insertions(+), 30 deletions(-)

diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk
index 6c6c5415c9cc..8ac80fcacd76 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 --no-isolation --wheel
+#			  default: ${PYTHON_CMD} -m build -n -w
 #
 # 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 --destdir ${STAGEDIR} ${BUILD_WRKSRC}/dist/${PORTNAME:C|[-_]+|_|g}-${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}
@@ -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 --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}
+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}
 
 # nose support
 .  if defined(_PYTHON_FEATURE_NOSE)
@@ -858,8 +858,7 @@ 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}
-	@cd ${STAGEDIR}${PREFIX} && ${FIND} lib -name '*.pyc' >> ${_PYTHONPKGLIST}
+		${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/${PORTNAME:C/[-_]+/_/g}-${PORTVERSION}.dist-info/RECORD >> ${_PYTHONPKGLIST}
 .    endif
 .  endif # defined(_PYTHON_FEATURE_PEP517)
 
diff --git a/audio/py-gtts/Makefile b/audio/py-gtts/Makefile
index bb74ce8681e9..fcad55b5b02b 100644
--- a/audio/py-gtts/Makefile
+++ b/audio/py-gtts/Makefile
@@ -1,6 +1,5 @@
 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 26507db29a15..8bab7800ba6a 100644
--- a/biology/py-resdk/Makefile
+++ b/biology/py-resdk/Makefile
@@ -1,6 +1,5 @@
 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 028bba005c16..211f36f0ab29 100644
--- a/cad/py-cocotb/Makefile
+++ b/cad/py-cocotb/Makefile
@@ -1,7 +1,6 @@
 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 806082d0d190..0ebd15085d2e 100644
--- a/devel/poetry/Makefile
+++ b/devel/poetry/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	poetry
 DISTVERSION=	1.3.2
-PORTREVISION=	2
+PORTREVISION=	1
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMESUFFIX=	-python-tool
diff --git a/devel/py-find-libpython/Makefile b/devel/py-find-libpython/Makefile
index a73d97f48882..7bcb691dcbee 100644
--- a/devel/py-find-libpython/Makefile
+++ b/devel/py-find-libpython/Makefile
@@ -1,6 +1,5 @@
 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 81e1c488df56..51dd799a6911 100644
--- a/devel/py-importlib-metadata/Makefile
+++ b/devel/py-importlib-metadata/Makefile
@@ -1,6 +1,5 @@
 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 becf56cb4402..009b6237a262 100644
--- a/devel/py-interface-meta/Makefile
+++ b/devel/py-interface-meta/Makefile
@@ -1,6 +1,5 @@
 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 6e4331eb660e..7d747c2dca07 100644
--- a/devel/py-mediafile/Makefile
+++ b/devel/py-mediafile/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	mediafile
 DISTVERSION=	0.11.0
-PORTREVISION=	2
+PORTREVISION=	1
 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 b2cf83d2ca2e..dab3541c211f 100644
--- a/devel/py-poetry-plugin-export/Makefile
+++ b/devel/py-poetry-plugin-export/Makefile
@@ -1,6 +1,5 @@
 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 578360aedf54..05739d37292b 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=	3
+PORTREVISION=	2
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/devel/py-pytoolconfig/Makefile b/devel/py-pytoolconfig/Makefile
index 9f91c819bb37..af425e207357 100644
--- a/devel/py-pytoolconfig/Makefile
+++ b/devel/py-pytoolconfig/Makefile
@@ -1,6 +1,5 @@
 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 ebde0885fe32..e06ae3a167ac 100644
--- a/dns/letsdns/Makefile
+++ b/dns/letsdns/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	letsdns
 DISTVERSION=	1.0.1
-PORTREVISION=	2
+PORTREVISION=	1
 CATEGORIES=	dns
 
 MAINTAINER=	flo@FreeBSD.org
diff --git a/graphics/py-glcontext/Makefile b/graphics/py-glcontext/Makefile
index 50beb004d7ae..a208bdab9399 100644
--- a/graphics/py-glcontext/Makefile
+++ b/graphics/py-glcontext/Makefile
@@ -1,6 +1,5 @@
 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 25eec71294f8..9fa380b079f8 100644
--- a/graphics/py-moderngl-window/Makefile
+++ b/graphics/py-moderngl-window/Makefile
@@ -1,6 +1,5 @@
 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 21cda7e8a29a..ea2b34133fdd 100644
--- a/graphics/py-moderngl/Makefile
+++ b/graphics/py-moderngl/Makefile
@@ -1,6 +1,5 @@
 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 f91747b0e797..9aba963ae11d 100644
--- a/graphics/py-traitsui/Makefile
+++ b/graphics/py-traitsui/Makefile
@@ -1,6 +1,5 @@
 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 714798781c0c..cc9798f1751e 100644
--- a/misc/py-einops/Makefile
+++ b/misc/py-einops/Makefile
@@ -1,6 +1,5 @@
 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 6bf47630822f..344ac32442de 100644
--- a/security/py-securesystemslib/Makefile
+++ b/security/py-securesystemslib/Makefile
@@ -1,6 +1,5 @@
 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 2c9850d56470..30a629a08a38 100644
--- a/security/py-tuf/Makefile
+++ b/security/py-tuf/Makefile
@@ -1,6 +1,5 @@
 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 525ef55930a8..c41ae5e627e3 100644
--- a/sysutils/py-docker/Makefile
+++ b/sysutils/py-docker/Makefile
@@ -1,6 +1,5 @@
 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 f69857858aa8..9eaac2011ef2 100644
--- a/textproc/py-sphinx-autoapi/Makefile
+++ b/textproc/py-sphinx-autoapi/Makefile
@@ -1,6 +1,5 @@
 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 1238cb5c2220..23ffa657d8c9 100644
--- a/www/py-fastapi/Makefile
+++ b/www/py-fastapi/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	fastapi
 PORTVERSION=	0.89.1
-PORTREVISION=	1
 CATEGORIES=	www python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}