Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Apr 2023 18:30:14 GMT
From:      Antoine Brodin <antoine@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 378e09115cbe - main - USE_PYTHON=pep517: package python bytecode
Message-ID:  <202304041830.334IUEkv001356@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by antoine:

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

commit 378e09115cbe9a584e3f497c39891619eb3b6ad0
Author:     Antoine Brodin <antoine@FreeBSD.org>
AuthorDate: 2023-04-04 18:27:33 +0000
Commit:     Antoine Brodin <antoine@FreeBSD.org>
CommitDate: 2023-04-04 18:27:33 +0000

    USE_PYTHON=pep517: package python bytecode
    
    Compile and package python bytecode for python ports using pep517.
    This can be revisited in the future with a trigger.
    
    Approved by:    portmgr
---
 Mk/Uses/python.mk            | 5 +++--
 devel/py-flit-core/Makefile  | 5 +++++
 devel/py-virtualenv/Makefile | 6 ++++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk
index 688736ffefe7..0e8350663076 100644
--- a/Mk/Uses/python.mk
+++ b/Mk/Uses/python.mk
@@ -153,7 +153,7 @@
 #			  default: <empty>
 #
 # PEP517_INSTALL_CMD	- Command sequence for a PEP-517 install frontend that installs a wheel.
-#			  default: ${PYTHON_CMD} -m installer --destdir ${STAGEDIR} --no-compile-bytecode --prefix ${PREFIX} ${BUILD_WRKSRC}/dist/${PORTNAME:C|[-_]+|_|g}-${DISTVERSION}*.whl
+#			  default: ${PYTHON_CMD} -m installer --destdir ${STAGEDIR} --prefix ${PREFIX} ${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}
@@ -687,7 +687,7 @@ PEP517_BUILD_DEPEND?=	${PYTHON_PKGNAMEPREFIX}gpep517>=0:devel/py-gpep517@${PY_FL
 PEP517_BUILD_CMD?=	${PYTHON_CMD} -m build --no-isolation --wheel ${PEP517_BUILD_CONFIG_SETTING}
 PEP517_BUILD_DEPEND?=	${PYTHON_PKGNAMEPREFIX}build>=0:devel/py-build@${PY_FLAVOR}
 .  endif
-PEP517_INSTALL_CMD?=	${PYTHON_CMD} -m installer --destdir ${STAGEDIR} --no-compile-bytecode --prefix ${PREFIX} ${BUILD_WRKSRC}/dist/${PORTNAME:C|[-_]+|_|g}-${DISTVERSION}*.whl
+PEP517_INSTALL_CMD?=	${PYTHON_CMD} -m installer --destdir ${STAGEDIR} --prefix ${PREFIX} ${BUILD_WRKSRC}/dist/${PORTNAME:C|[-_]+|_|g}-${DISTVERSION}*.whl
 PEP517_INSTALL_DEPEND?=	${PYTHON_PKGNAMEPREFIX}installer>=0:devel/py-installer@${PY_FLAVOR}
 
 # nose support
@@ -920,6 +920,7 @@ do-install:
 		-e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../sbin/|sbin/|' \
 		-e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../share/|share/|' \
 		${_PYTHONPKGLIST}
+	@cd ${STAGEDIR}${PREFIX} && ${FIND} lib -name '*.pyc' >> ${_PYTHONPKGLIST}
 .    endif
 .  endif # defined(_PYTHON_FEATURE_PEP517)
 
diff --git a/devel/py-flit-core/Makefile b/devel/py-flit-core/Makefile
index be8b3684ff6d..62ea7ab3766c 100644
--- a/devel/py-flit-core/Makefile
+++ b/devel/py-flit-core/Makefile
@@ -25,4 +25,9 @@ PEP517_BUILD_DEPEND=	# empty
 PEP517_INSTALL_CMD=	${PYTHON_CMD} ${WRKSRC}/bootstrap_install.py --installdir ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} ${WRKSRC}/dist/${DISTNAME}*.whl
 PEP517_INSTALL_DEPEND=	# empty
 
+post-install:
+	${PYTHON_CMD} -m compileall -d ${PYTHON_SITELIBDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}
+	${PYTHON_CMD} -O -m compileall -d ${PYTHON_SITELIBDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}
+	@cd ${STAGEDIR}${PREFIX} && ${FIND} lib -name '*.pyc' >> ${_PYTHONPKGLIST}
+
 .include <bsd.port.mk>
diff --git a/devel/py-virtualenv/Makefile b/devel/py-virtualenv/Makefile
index 36b7a1531c9c..fd203ffca6dc 100644
--- a/devel/py-virtualenv/Makefile
+++ b/devel/py-virtualenv/Makefile
@@ -32,7 +32,7 @@ USE_PYTHON=	autoplist concurrent pep517 pytest
 PEP517_BUILD_DEPEND=	${PYTHON_PKGNAMEPREFIX}hatch-vcs>=0.3:devel/py-hatch-vcs@${PY_FLAVOR}
 PEP517_BUILD_CMD=	${PYTHON_CMD} -m hatchling build --target wheel
 PEP517_INSTALL_DEPEND=	${PKGNAMEPREFIX}pip>=22.3.1:devel/py-pip@${PY_FLAVOR}
-PEP517_INSTALL_CMD=	${PYTHON_CMD} -m pip install --no-color --compile \
+PEP517_INSTALL_CMD=	${PYTHON_CMD} -m pip install --no-color --no-compile \
 			--ignore-installed --no-deps --no-warn-script-location \
 			--prefix ${PREFIX} --progress-bar off --root \
 			${STAGEDIR} --root-user-action ignore --verbose \
@@ -79,7 +79,9 @@ post-patch:
 	${WRKSRC}/docs/conf.py
 
 post-install:
-	${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py -d ${PYTHONPREFIX_SITELIBDIR} -f ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+	${PYTHON_CMD} -m compileall -d ${PYTHON_SITELIBDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}
+	${PYTHON_CMD} -O -m compileall -d ${PYTHON_SITELIBDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}
+	@cd ${STAGEDIR}${PREFIX} && ${FIND} lib -name '*.pyc' >> ${_PYTHONPKGLIST}
 
 post-install-DOCS-on:
 	${LOCALBASE}/bin/sphinx-build-${PYTHON_VER} -d ${WRKDIR} -b html -n ${WRKSRC}/docs ${STAGEDIR}${DOCSDIR}



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