Re: git: da6741d218da - main - python.mk: introduce PYTHON_DISABLE_BYTECODE
- In reply to: Charlie Li : "git: da6741d218da - main - python.mk: introduce PYTHON_DISABLE_BYTECODE"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 06 Oct 2026 18:06:28 UTC
Charlie,
On 2026-10-06 19:45, Charlie Li wrote:
> The branch main has been updated by vishwin:
>
> URL: https://deu01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcgit.freebsd.org%2Fports%2Fcommit%2F%3Fid%3Dda6741d218da9a395329248d7467bd8ce8f15938&data=05%7C02%7Cmichael.osipov%40innomotics.com%7Cf2c142e94ffd4bfe756408df23d19802%7C698c6ffb74e34a84be68f22d8d3201a3%7C0%7C0%7C639269055244206708%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=R4%2FQFGhDDCmK6ngHYG%2F6tem%2Bq94jipnsMZvx6WCx9uc%3D&reserved=0
>
> commit da6741d218da9a395329248d7467bd8ce8f15938
> Author: Charlie Li <vishwin@FreeBSD.org>
> AuthorDate: 2026-10-06 17:42:43 +0000
> Commit: Charlie Li <vishwin@FreeBSD.org>
> CommitDate: 2026-10-06 17:42:43 +0000
>
> python.mk: introduce PYTHON_DISABLE_BYTECODE
>
> This is a user variable to allow Python ports to not compile and
> include bytecode. For this setting to take effect on existing
> packages, rebuilds are required. Ports themselves must not set this
> variable.
> ---
> CHANGES | 8 ++++++++
> Mk/Uses/python.mk | 18 +++++++++++++++++-
> 2 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/CHANGES b/CHANGES
> index 9436e9972f5f..f03e7a2884d7 100644
> --- a/CHANGES
> +++ b/CHANGES
> @@ -10,6 +10,14 @@ in the release notes and/or placed into UPDATING.
>
> All ports committers are allowed to commit to this file.
>
> +20261006:
> +AUTHOR: python@FreeBSD.org
> +
> + A new user setting PYTHON_DISABLE_BYTECODE has been added to allow
> + Python ports to not compile and include bytecode. For this setting
> + to take effect on existing packages, rebuilds are required. Ports
> + themselves must not set this variable.
> +
> 20260923:
> AUTHOR: mat@FreeBSD.org
>
> diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk
> index 4fee93a74fee..6016686db5b8 100644
> --- a/Mk/Uses/python.mk
> +++ b/Mk/Uses/python.mk
> @@ -326,6 +326,9 @@
> #
> # The following variables may be set by the user:
> #
> +# PYTHON_DISABLE_BYTECODE - Disable compiling and including bytecode in the
> +# resulting package. To take effect with existing
> +# packages, rebuilds are required.
> # PYTEST_ENABLE_ALL_TESTS - Enable tests skipped by PYTEST_BROKEN_TESTS
> # and PYTEST_IGNORED_TESTS.
> # PYTEST_ENABLE_BROKEN_TESTS - Enable tests skipped by PYTEST_BROKEN_TESTS.
> @@ -743,7 +746,11 @@ PYDISTUTILS_SETUP?= -c \
> exec(compile(open(__file__, 'rb').read().replace(b'\\r\\n', b'\\n'), __file__, 'exec'))"
> PYDISTUTILS_CONFIGUREARGS?= # empty
> PYDISTUTILS_BUILDARGS?= # empty
> +. if defined(PYTHON_DISABLE_BYTECODE)
> +PYDISTUTILS_INSTALLARGS?= --no-compile -O1 --prefix=${PREFIX}
> +. else
> PYDISTUTILS_INSTALLARGS?= -c -O1 --prefix=${PREFIX}
> +. endif
> . if defined(_PYTHON_FEATURE_DISTUTILS)
> . if !defined(PYDISTUTILS_INSTALLNOSINGLE)
> PYDISTUTILS_INSTALLARGS+= --single-version-externally-managed
> @@ -761,7 +768,11 @@ PYDISTUTILS_EGGINFODIR?=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
> # PEP-517 support
> 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}
> +. if defined(PYTHON_DISABLE_BYTECODE)
> +PEP517_INSTALL_CMD?= ${PYTHON_CMD} -m installer --destdir ${STAGEDIR} --no-compile-bytecode --prefix ${PREFIX} ${BUILD_WRKSRC}/dist/${PORTNAME:tl:C|[-_]+|_|g}-${DISTVERSION}*.whl
> +. else
> PEP517_INSTALL_CMD?= ${PYTHON_CMD} -m installer --destdir ${STAGEDIR} --prefix ${PREFIX} ${BUILD_WRKSRC}/dist/${PORTNAME:C|[-_]+|_|g}-${DISTVERSION}*.whl
> +. endif
you might want to review:
> $ grep -r --include=Makefile PEP517_INSTALL_CMD -l .
> ./cad/py-amaranth/Makefile
> ./devel/py-Jinja2/Makefile
> ./devel/py-flit-core/Makefile
> ./devel/py-flufl.i18n/Makefile
> ./devel/py-flufl.lock/Makefile
> ./devel/py-repoze.lru/Makefile
> ./devel/py-stringzilla/Makefile
> ./devel/py-coherent.deps/Makefile
> ./devel/py-coherent.licensed/Makefile
> ./misc/py-polars-runtime/Makefile
> ./misc/py-pytorch/Makefile
> ./misc/py-crewai/Makefile
> ./misc/py-crewai-cli/Makefile
> ./misc/py-sagemaker-schema-inference-artifacts/Makefile
> ./misc/py-tritonclient/Makefile
> ./textproc/py-pallets-sphinx-themes/Makefile
M