aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Brodin <antoine@FreeBSD.org>2023-04-04 18:27:33 +0000
committerAntoine Brodin <antoine@FreeBSD.org>2023-04-04 18:27:33 +0000
commit378e09115cbe9a584e3f497c39891619eb3b6ad0 (patch)
treea146e2839b47b36a007d3d5392cb9ce0b5f87f26
parent4cda17ab14588e6e4fdac7f697e246554ce82af3 (diff)
downloadports-378e09115cbe9a584e3f497c39891619eb3b6ad0.tar.gz
ports-378e09115cbe9a584e3f497c39891619eb3b6ad0.zip
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
-rw-r--r--Mk/Uses/python.mk5
-rw-r--r--devel/py-flit-core/Makefile5
-rw-r--r--devel/py-virtualenv/Makefile6
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}