python.mk: introduce USE_PYTHON=pep517 for PEP-517 support
USE_PYTHON=pep517 takes no arguments. Operation is similar to USE_PYTHON=distutils, although the build backend specified in pyproject.toml is to be specified in BUILD_DEPENDS explicitly. A usage guide and implementation primer is available at: https://wiki.freebsd.org/Python/PEP-517 With hat: python Approved by: fluffy (mentor) Co-authored by: yuri PR: 255722 Differential Revision: https://reviews.freebsd.org/D36290
This commit is contained in:
parent
cbb8f210b3
commit
cc8a1878e0
13
CHANGES
13
CHANGES
|
@ -10,6 +10,19 @@ in the release notes and/or placed into UPDATING.
|
||||||
|
|
||||||
All ports committers are allowed to commit to this file.
|
All ports committers are allowed to commit to this file.
|
||||||
|
|
||||||
|
20230111:
|
||||||
|
AUTHOR: vishwin@FreeBSD.org
|
||||||
|
|
||||||
|
USE_PYTHON=pep517 has been added to facilitate building using the
|
||||||
|
new format.
|
||||||
|
|
||||||
|
USE_PYTHON=pep517 takes no arguments. Operation is similar to
|
||||||
|
USE_PYTHON=distutils, although the build backend specified in
|
||||||
|
pyproject.toml shall be specified in BUILD_DEPENDS.
|
||||||
|
|
||||||
|
A usage guide and implementation primer is available at:
|
||||||
|
https://wiki.freebsd.org/Python/PEP-517
|
||||||
|
|
||||||
20221217:
|
20221217:
|
||||||
AUTHOR: tcberner@FreeBSD.org
|
AUTHOR: tcberner@FreeBSD.org
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,9 @@
|
||||||
# distutils - Use distutils as do-configure, do-build and
|
# distutils - Use distutils as do-configure, do-build and
|
||||||
# do-install targets. implies flavors.
|
# do-install targets. implies flavors.
|
||||||
#
|
#
|
||||||
|
# pep517 - Follow the PEP-517 standard to build and install wheels
|
||||||
|
# as do-build and do-install targets. implies flavors.
|
||||||
|
#
|
||||||
# autoplist - Automatically generates the packaging list for a
|
# autoplist - Automatically generates the packaging list for a
|
||||||
# port that uses distutils when defined.
|
# port that uses distutils when defined.
|
||||||
# requires: distutils
|
# requires: distutils
|
||||||
|
@ -175,6 +178,18 @@
|
||||||
# - Canonical name for egg-info.
|
# - Canonical name for egg-info.
|
||||||
# default: ${PYDISTUTILS_PKGNAME:C/[^A-Za-z0-9.]+/_/g}-${PYDISTUTILS_PKGVERSION:C/[^A-Za-z0-9.]+/_/g}-py${PYTHON_VER}.egg-info
|
# 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
|
||||||
|
#
|
||||||
|
# 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}-${PORTVERSION}-*.whl
|
||||||
|
#
|
||||||
|
# PEP517_INSTALL_DEPEND - Port needed to execute ${PEP517_INSTALL_CMD}.
|
||||||
|
# default: ${PYTHON_PKGNAMEPREFIX}installer>0:devel/py-installer@${PY_FLAVOR}
|
||||||
|
#
|
||||||
# PYTEST_BROKEN_TESTS - Lists of 'pytest -k' patterns to skip tests which
|
# PYTEST_BROKEN_TESTS - Lists of 'pytest -k' patterns to skip tests which
|
||||||
# require fixing.
|
# require fixing.
|
||||||
# default: <empty>
|
# default: <empty>
|
||||||
|
@ -283,7 +298,7 @@ _PYTHON_RELPORTDIR= lang/python
|
||||||
# List all valid USE_PYTHON features here
|
# List all valid USE_PYTHON features here
|
||||||
_VALID_PYTHON_FEATURES= allflavors autoplist concurrent cython cython_run \
|
_VALID_PYTHON_FEATURES= allflavors autoplist concurrent cython cython_run \
|
||||||
distutils flavors noegginfo noflavors nose nose2 \
|
distutils flavors noegginfo noflavors nose nose2 \
|
||||||
optsuffix py3kplist pytest pytest4 pythonprefix \
|
optsuffix pep517 py3kplist pytest pytest4 pythonprefix \
|
||||||
unittest unittest2
|
unittest unittest2
|
||||||
_INVALID_PYTHON_FEATURES=
|
_INVALID_PYTHON_FEATURES=
|
||||||
. for var in ${USE_PYTHON}
|
. for var in ${USE_PYTHON}
|
||||||
|
@ -309,6 +324,12 @@ IGNORE= uses either USE_PYTHON=pytest or USE_PYTHON=pytest4, not both of them
|
||||||
_PYTHON_FEATURE_FLAVORS= yes
|
_PYTHON_FEATURE_FLAVORS= yes
|
||||||
. endif
|
. endif
|
||||||
|
|
||||||
|
# pep517 automatically generates flavors depending on the supported
|
||||||
|
# versions.
|
||||||
|
. if defined(_PYTHON_FEATURE_PEP517)
|
||||||
|
_PYTHON_FEATURE_FLAVORS= yes
|
||||||
|
. endif
|
||||||
|
|
||||||
. if defined(_PYTHON_FEATURE_NOFLAVORS)
|
. if defined(_PYTHON_FEATURE_NOFLAVORS)
|
||||||
.undef _PYTHON_FEATURE_FLAVORS
|
.undef _PYTHON_FEATURE_FLAVORS
|
||||||
. endif
|
. endif
|
||||||
|
@ -595,6 +616,21 @@ RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools>=63.1.0:devel/py-setuptools@${P
|
||||||
. endif
|
. endif
|
||||||
. endif
|
. endif
|
||||||
|
|
||||||
|
. if defined(_PYTHON_FEATURE_PEP517)
|
||||||
|
. if ${PYTHON_VER} == 2.7
|
||||||
|
DEV_ERROR+= "USES=python:2.7 is incompatible with USE_PYTHON=pep517"
|
||||||
|
. endif
|
||||||
|
. if defined(_PYTHON_FEATURE_DISTUTILS)
|
||||||
|
DEV_ERROR+= "USE_PYTHON=distutils is incompatible with USE_PYTHON=pep517"
|
||||||
|
. endif
|
||||||
|
. if defined(_PYTHON_FEATURE_PY3KPLIST)
|
||||||
|
DEV_ERROR+= "USE_PYTHON=py3kplist is incompatible with USE_PYTHON=pep517"
|
||||||
|
. endif
|
||||||
|
. if defined(_PYTHON_FEATURE_NOEGGINFO)
|
||||||
|
DEV_ERROR+= "USE_PYTHON=noegginfo is incompatible with USE_PYTHON=pep517"
|
||||||
|
. endif
|
||||||
|
. endif
|
||||||
|
|
||||||
# distutils support
|
# distutils support
|
||||||
PYSETUP?= setup.py
|
PYSETUP?= setup.py
|
||||||
PYDISTUTILS_SETUP?= -c \
|
PYDISTUTILS_SETUP?= -c \
|
||||||
|
@ -618,6 +654,12 @@ PYDISTUTILS_PKGVERSION?=${PORTVERSION}
|
||||||
PYDISTUTILS_EGGINFO?= ${PYDISTUTILS_PKGNAME:C/[^A-Za-z0-9.]+/_/g}-${PYDISTUTILS_PKGVERSION:C/[^A-Za-z0-9.]+/_/g}-py${PYTHON_VER}.egg-info
|
PYDISTUTILS_EGGINFO?= ${PYDISTUTILS_PKGNAME:C/[^A-Za-z0-9.]+/_/g}-${PYDISTUTILS_PKGVERSION:C/[^A-Za-z0-9.]+/_/g}-py${PYTHON_VER}.egg-info
|
||||||
PYDISTUTILS_EGGINFODIR?=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
|
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}-${PORTVERSION}-*.whl
|
||||||
|
PEP517_INSTALL_DEPEND?= ${PYTHON_PKGNAMEPREFIX}installer>0:devel/py-installer@${PY_FLAVOR}
|
||||||
|
|
||||||
# nose support
|
# nose support
|
||||||
. if defined(_PYTHON_FEATURE_NOSE)
|
. if defined(_PYTHON_FEATURE_NOSE)
|
||||||
TEST_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}nose>=0:devel/py-nose@${PY_FLAVOR}
|
TEST_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}nose>=0:devel/py-nose@${PY_FLAVOR}
|
||||||
|
@ -669,7 +711,7 @@ add-plist-egginfo:
|
||||||
. endfor
|
. endfor
|
||||||
. endif
|
. endif
|
||||||
|
|
||||||
. if defined(_PYTHON_FEATURE_AUTOPLIST) && defined(_PYTHON_FEATURE_DISTUTILS)
|
. if defined(_PYTHON_FEATURE_AUTOPLIST) && (defined(_PYTHON_FEATURE_DISTUTILS) || defined(_PYTHON_FEATURE_PEP517))
|
||||||
_RELSITELIBDIR= ${PYTHONPREFIX_SITELIBDIR:S;${PREFIX}/;;}
|
_RELSITELIBDIR= ${PYTHONPREFIX_SITELIBDIR:S;${PREFIX}/;;}
|
||||||
_RELLIBDIR= ${PYTHONPREFIX_LIBDIR:S;${PREFIX}/;;}
|
_RELLIBDIR= ${PYTHONPREFIX_LIBDIR:S;${PREFIX}/;;}
|
||||||
|
|
||||||
|
@ -701,7 +743,7 @@ add-plist-python:
|
||||||
${TMPPLIST} > ${TMPPLIST}.pyc_tmp
|
${TMPPLIST} > ${TMPPLIST}.pyc_tmp
|
||||||
@${MV} ${TMPPLIST}.pyc_tmp ${TMPPLIST}
|
@${MV} ${TMPPLIST}.pyc_tmp ${TMPPLIST}
|
||||||
. endif # ${PYTHON_REL} >= 30200 && defined(_PYTHON_FEATURE_PY3KPLIST)
|
. endif # ${PYTHON_REL} >= 30200 && defined(_PYTHON_FEATURE_PY3KPLIST)
|
||||||
. endif # defined(_PYTHON_FEATURE_AUTOPLIST) && defined(_PYTHON_FEATURE_DISTUTILS)
|
. endif # defined(_PYTHON_FEATURE_AUTOPLIST) && (defined(_PYTHON_FEATURE_DISTUTILS) || defined(_PYTHON_FEATURE_PEP517))
|
||||||
|
|
||||||
# Fix for programs that build python from a GNU auto* environment
|
# Fix for programs that build python from a GNU auto* environment
|
||||||
CONFIGURE_ENV+= PYTHON="${PYTHON_CMD}"
|
CONFIGURE_ENV+= PYTHON="${PYTHON_CMD}"
|
||||||
|
@ -790,6 +832,35 @@ do-install:
|
||||||
. endif
|
. endif
|
||||||
. endif # defined(_PYTHON_FEATURE_DISTUTILS)
|
. endif # defined(_PYTHON_FEATURE_DISTUTILS)
|
||||||
|
|
||||||
|
. if defined(_PYTHON_FEATURE_PEP517)
|
||||||
|
. if !empty(PEP517_BUILD_DEPEND)
|
||||||
|
BUILD_DEPENDS+= ${PEP517_BUILD_DEPEND}
|
||||||
|
. endif
|
||||||
|
. if !empty(PEP517_INSTALL_DEPEND)
|
||||||
|
BUILD_DEPENDS+= ${PEP517_INSTALL_DEPEND}
|
||||||
|
. endif
|
||||||
|
|
||||||
|
. if !target(do-configure)
|
||||||
|
do-configure:
|
||||||
|
@${DO_NADA}
|
||||||
|
. endif
|
||||||
|
|
||||||
|
. if !target(do-build)
|
||||||
|
do-build:
|
||||||
|
@cd ${BUILD_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PEP517_BUILD_CMD}
|
||||||
|
. endif
|
||||||
|
|
||||||
|
. if !target(do-install)
|
||||||
|
do-install:
|
||||||
|
@${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
|
||||||
|
@cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PEP517_INSTALL_CMD}
|
||||||
|
@${SED} -e 's|^|${PYTHONPREFIX_SITELIBDIR}/|' \
|
||||||
|
-e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../bin/|bin/|' \
|
||||||
|
-e 's|\,.*$$||' \
|
||||||
|
${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/${PORTNAME}-${PORTVERSION}.dist-info/RECORD >> ${_PYTHONPKGLIST}
|
||||||
|
. endif
|
||||||
|
. endif # defined(_PYTHON_FEATURE_PEP517)
|
||||||
|
|
||||||
. if defined(_PYTHON_FEATURE_NOSE)
|
. if defined(_PYTHON_FEATURE_NOSE)
|
||||||
. if !target(do-test)
|
. if !target(do-test)
|
||||||
do-test:
|
do-test:
|
||||||
|
|
Loading…
Reference in New Issue