Changeset View
Changeset View
Standalone View
Standalone View
Mk/Uses/python.mk
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | |||||
# kept as separate ports. | # kept as separate ports. | ||||
# | # | ||||
# optsuffix - Set PKGNAMESUFFIX to PYTHON_PKGNAMESUFFIX if not the | # optsuffix - Set PKGNAMESUFFIX to PYTHON_PKGNAMESUFFIX if not the | ||||
# default python version. | # default python version. | ||||
# | # | ||||
# 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. | ||||
# | # | ||||
# build - Use build/installer 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 | ||||
# | # | ||||
# py3kplist - Automatically generates Python 3.x compatible | # py3kplist - Automatically generates Python 3.x compatible | ||||
# __pycache__ entries from a Python 2.x packaging list | # __pycache__ entries from a Python 2.x packaging list | ||||
# when defined. Use this for ports that do *not* use | # when defined. Use this for ports that do *not* use | ||||
# standard Python packaging mechanisms such as | # standard Python packaging mechanisms such as | ||||
▲ Show 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | |||||
# When adding a version, please keep the comment in | # When adding a version, please keep the comment in | ||||
# Mk/bsd.default-versions.mk in sync. | # Mk/bsd.default-versions.mk in sync. | ||||
_PYTHON_VERSIONS= 3.9 3.8 3.7 3.10 3.11 2.7 # preferred first | _PYTHON_VERSIONS= 3.9 3.8 3.7 3.10 3.11 2.7 # preferred first | ||||
_PYTHON_PORTBRANCH= 3.9 # ${_PYTHON_VERSIONS:[1]} | _PYTHON_PORTBRANCH= 3.9 # ${_PYTHON_VERSIONS:[1]} | ||||
_PYTHON_BASECMD= ${LOCALBASE}/bin/python | _PYTHON_BASECMD= ${LOCALBASE}/bin/python | ||||
_PYTHON_RELPORTDIR= lang/python | _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 build concurrent cython cython_run \ | ||||
distutils flavors noegginfo noflavors nose nose2 \ | distutils flavors noegginfo noflavors nose nose2 \ | ||||
optsuffix py3kplist pytest pytest4 pythonprefix \ | optsuffix py3kplist pytest pytest4 pythonprefix \ | ||||
unittest unittest2 | unittest unittest2 | ||||
_INVALID_PYTHON_FEATURES= | _INVALID_PYTHON_FEATURES= | ||||
. for var in ${USE_PYTHON} | . for var in ${USE_PYTHON} | ||||
. if empty(_VALID_PYTHON_FEATURES:M${var}) | . if empty(_VALID_PYTHON_FEATURES:M${var}) | ||||
_INVALID_PYTHON_FEATURES+= ${var} | _INVALID_PYTHON_FEATURES+= ${var} | ||||
. endif | . endif | ||||
Show All 11 Lines | |||||
. endif | . endif | ||||
# distutils automatically generates flavors depending on the supported | # distutils automatically generates flavors depending on the supported | ||||
# versions. | # versions. | ||||
. if defined(_PYTHON_FEATURE_DISTUTILS) | . if defined(_PYTHON_FEATURE_DISTUTILS) | ||||
_PYTHON_FEATURE_FLAVORS= yes | _PYTHON_FEATURE_FLAVORS= yes | ||||
. endif | . endif | ||||
# build automatically generates flavors depending on the supported | |||||
# versions. | |||||
. if defined(_PYTHON_FEATURE_BUILD) | |||||
_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 | ||||
# Make sure that no dependency or some other environment variable | # Make sure that no dependency or some other environment variable | ||||
# pollutes the build/run dependency detection | # pollutes the build/run dependency detection | ||||
.undef _PYTHON_BUILD_DEP | .undef _PYTHON_BUILD_DEP | ||||
.undef _PYTHON_RUN_DEP | .undef _PYTHON_RUN_DEP | ||||
▲ Show 20 Lines • Show All 270 Lines • ▼ Show 20 Lines | |||||
BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools44>0:devel/py-setuptools44@${PY_FLAVOR} | BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools44>0:devel/py-setuptools44@${PY_FLAVOR} | ||||
RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools44>0:devel/py-setuptools44@${PY_FLAVOR} | RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools44>0:devel/py-setuptools44@${PY_FLAVOR} | ||||
. else | . else | ||||
BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools>=63.1.0:devel/py-setuptools@${PY_FLAVOR} | BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools>=63.1.0:devel/py-setuptools@${PY_FLAVOR} | ||||
RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools>=63.1.0:devel/py-setuptools@${PY_FLAVOR} | RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools>=63.1.0:devel/py-setuptools@${PY_FLAVOR} | ||||
. endif | . endif | ||||
. endif | . endif | ||||
. if defined(_PYTHON_FEATURE_BUILD) | |||||
. if ${PYTHON_VER} == 2.7 | |||||
DEV_ERROR+= "USES=python:2.7 is incompatible with USE_PYTHON=build" | |||||
. endif | |||||
. if defined(_PYTHON_FEATURE_DISTUTILS) | |||||
DEV_ERROR+= "USE_PYTHON=distutils is incompatible with USE_PYTHON=build" | |||||
. endif | |||||
. if defined(_PYTHON_FEATURE_AUTOPLIST) | |||||
DEV_ERROR+= "USE_PYTHON=autoplist is incompatible with USE_PYTHON=build" | |||||
. endif | |||||
. if defined(_PYTHON_FEATURE_PY3KPLIST) | |||||
DEV_ERROR+= "USE_PYTHON=py3kplist is incompatible with USE_PYTHON=build" | |||||
. endif | |||||
. if defined(_PYTHON_FEATURE_NOEGGINFO) | |||||
DEV_ERROR+= "USE_PYTHON=noegginfo is incompatible with USE_PYTHON=build" | |||||
. endif | |||||
BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}build>0:devel/py-build@${PY_FLAVOR} \ | |||||
${PYTHON_PKGNAMEPREFIX}installer>0:devel/py-installer@${PY_FLAVOR} | |||||
. endif | |||||
# distutils support | # distutils support | ||||
PYSETUP?= setup.py | PYSETUP?= setup.py | ||||
PYDISTUTILS_SETUP?= -c \ | PYDISTUTILS_SETUP?= -c \ | ||||
"import sys; import setuptools; \ | "import sys; import setuptools; \ | ||||
__file__='${PYSETUP}'; sys.argv[0]='${PYSETUP}'; \ | __file__='${PYSETUP}'; sys.argv[0]='${PYSETUP}'; \ | ||||
exec(compile(open(__file__, 'rb').read().replace(b'\\r\\n', b'\\n'), __file__, 'exec'))" | exec(compile(open(__file__, 'rb').read().replace(b'\\r\\n', b'\\n'), __file__, 'exec'))" | ||||
PYDISTUTILS_CONFIGUREARGS?= # empty | PYDISTUTILS_CONFIGUREARGS?= # empty | ||||
PYDISTUTILS_BUILDARGS?= # empty | PYDISTUTILS_BUILDARGS?= # empty | ||||
▲ Show 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | do-build: | ||||
@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS}) | @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_BUILD_TARGET} ${PYDISTUTILS_BUILDARGS}) | ||||
. endif | . endif | ||||
. if !target(do-install) | . if !target(do-install) | ||||
do-install: | do-install: | ||||
@(cd ${INSTALL_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_INSTALL_TARGET} ${PYDISTUTILS_INSTALLARGS}) | @(cd ${INSTALL_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYDISTUTILS_SETUP} ${PYDISTUTILS_INSTALL_TARGET} ${PYDISTUTILS_INSTALLARGS}) | ||||
. endif | . endif | ||||
. endif # defined(_PYTHON_FEATURE_DISTUTILS) | . endif # defined(_PYTHON_FEATURE_DISTUTILS) | ||||
. if defined(_PYTHON_FEATURE_BUILD) | |||||
. if !target(do-configure) | |||||
do-configure: | |||||
@${DO_NADA} | |||||
. endif | |||||
. if !target(do-build) | |||||
do-build: | |||||
@cd ${BUILD_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} -m build --wheel --no-isolation --outdir ${WRKDIR} | |||||
. endif | |||||
. if !target(do-install) | |||||
do-install: | |||||
@cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} -m installer ${WRKDIR}/*.whl --destdir ${STAGEDIR} | |||||
. endif | |||||
. endif # defined(_PYTHON_FEATURE_BUILD) | |||||
. if defined(_PYTHON_FEATURE_NOSE) | . if defined(_PYTHON_FEATURE_NOSE) | ||||
. if !target(do-test) | . if !target(do-test) | ||||
do-test: | do-test: | ||||
cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m nose ${TEST_ARGS:NDESTDIR=*} -v | cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m nose ${TEST_ARGS:NDESTDIR=*} -v | ||||
. endif | . endif | ||||
. endif # defined(_PYTHON_FEATURE_NOSE) | . endif # defined(_PYTHON_FEATURE_NOSE) | ||||
Show All 29 Lines |