Changeset View
Changeset View
Standalone View
Standalone View
head/Mk/Uses/python.mk
Show First 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | |||||
# interpreter, e.g. /usr/local | # interpreter, e.g. /usr/local | ||||
# | # | ||||
# PYTHON_PORTVERSION | # PYTHON_PORTVERSION | ||||
# - Version number suitable for ${PORTVERSION}. | # - Version number suitable for ${PORTVERSION}. | ||||
# | # | ||||
# PYTHON_PORTSDIR - The port directory of the chosen Python interpreter | # PYTHON_PORTSDIR - The port directory of the chosen Python interpreter | ||||
# | # | ||||
# PYTHON_REL - The release number of the chosen Python interpreter | # PYTHON_REL - The release number of the chosen Python interpreter | ||||
# without dots, e.g. 276, 341, ... | # without dots, e.g. 2706, 3401, ... | ||||
# | # | ||||
# PYTHON_SUFFIX - The major-minor release number of the chosen Python | # PYTHON_SUFFIX - The major-minor release number of the chosen Python | ||||
# interpreter without dots, e.g. 27, 34, ... | # interpreter without dots, e.g. 27, 34, ... | ||||
# Used for prefixes and suffixes. | # Used for prefixes and suffixes. | ||||
# | # | ||||
# PYTHON_MAJOR_VER - The major release version of the chosen Python | # PYTHON_MAJOR_VER - The major release version of the chosen Python | ||||
# interpreter, e.g. 2, 3, ... | # interpreter, e.g. 2, 3, ... | ||||
# | # | ||||
▲ Show 20 Lines • Show All 224 Lines • ▼ Show 20 Lines | |||||
# Got the correct python version, set some publicly accessible variables | # Got the correct python version, set some publicly accessible variables | ||||
PYTHON_VER= ${_PYTHON_VERSION} | PYTHON_VER= ${_PYTHON_VERSION} | ||||
PYTHON_SUFFIX= ${_PYTHON_VERSION:S/.//g} | PYTHON_SUFFIX= ${_PYTHON_VERSION:S/.//g} | ||||
PYTHON_MAJOR_VER= ${PYTHON_VER:R} | PYTHON_MAJOR_VER= ${PYTHON_VER:R} | ||||
PYTHON_REL= # empty | PYTHON_REL= # empty | ||||
PYTHON_ABIVER= # empty | PYTHON_ABIVER= # empty | ||||
PYTHON_PORTSDIR= ${_PYTHON_RELPORTDIR}${PYTHON_SUFFIX} | PYTHON_PORTSDIR= ${_PYTHON_RELPORTDIR}${PYTHON_SUFFIX} | ||||
PYTHON_PORTVERSION!= ${MAKE} -V PORTVERSION -C ${PYTHON_PORTSDIR} | PYTHON_PORTVERSION!= ${MAKE} -V PORTVERSION -C ${PYTHON_PORTSDIR} | ||||
PYTHON_REL= ${PYTHON_PORTVERSION:S/.//g} | PYTHON_REL= ${PYTHON_PORTVERSION:C/\.([0-9]+)$/.0\1/:C/\.0?([0-9][0-9])$/.\1/:S/.//g} | ||||
# Might be overridden by calling ports | # Might be overridden by calling ports | ||||
PYTHON_CMD?= ${_PYTHON_BASECMD}${_PYTHON_VERSION} | PYTHON_CMD?= ${_PYTHON_BASECMD}${_PYTHON_VERSION} | ||||
.if exists(${PYTHON_CMD}-config) && ${PYTHON_VER} != 2.7 | .if exists(${PYTHON_CMD}-config) && ${PYTHON_VER} != 2.7 | ||||
PYTHON_ABIVER!= ${PYTHON_CMD}-config --abiflags | PYTHON_ABIVER!= ${PYTHON_CMD}-config --abiflags | ||||
.endif | .endif | ||||
PYTHONBASE!= (${PYTHON_CMD} -c 'import sys; print(sys.prefix)' \ | PYTHONBASE!= (${PYTHON_CMD} -c 'import sys; print(sys.prefix)' \ | ||||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | |||||
add-plist-pymod: | add-plist-pymod: | ||||
@${SED} -e 's|^${STAGEDIR}${PREFIX}/||' \ | @${SED} -e 's|^${STAGEDIR}${PREFIX}/||' \ | ||||
-e 's|^${PREFIX}/||' \ | -e 's|^${PREFIX}/||' \ | ||||
-e 's|^\(man/.*man[0-9]\)/\(.*\.[0-9]\)$$|\1/\2.gz|' \ | -e 's|^\(man/.*man[0-9]\)/\(.*\.[0-9]\)$$|\1/\2.gz|' \ | ||||
-e 's|[[:alnum:]|[:space:]]*/\.\./*||g; s|/\./|/|g' \ | -e 's|[[:alnum:]|[:space:]]*/\.\./*||g; s|/\./|/|g' \ | ||||
${_PYTHONPKGLIST} | ${SORT} >> ${TMPPLIST} | ${_PYTHONPKGLIST} | ${SORT} >> ${TMPPLIST} | ||||
.else | .else | ||||
.if ${PYTHON_REL} >= 320 && defined(_PYTHON_FEATURE_PY3KPLIST) | .if ${PYTHON_REL} >= 3200 && defined(_PYTHON_FEATURE_PY3KPLIST) | ||||
# When Python version is 3.2+ we rewrite all the filenames | # When Python version is 3.2+ we rewrite all the filenames | ||||
# of TMPPLIST that end with .py[co], so that they conform | # of TMPPLIST that end with .py[co], so that they conform | ||||
# to PEP 3147 (see http://www.python.org/dev/peps/pep-3147/) | # to PEP 3147 (see http://www.python.org/dev/peps/pep-3147/) | ||||
PYMAGICTAG= ${PYTHON_CMD} -c 'import imp; print(imp.get_tag())' | PYMAGICTAG= ${PYTHON_CMD} -c 'import imp; print(imp.get_tag())' | ||||
add-plist-post: | add-plist-post: | ||||
@${AWK} '\ | @${AWK} '\ | ||||
/\.py[co]$$/ && !($$0 ~ "/" pc "/") {id = match($$0, /\/[^\/]+\.py[co]$$/); if (id != 0) {d = substr($$0, 1, RSTART - 1); dirs[d] = 1}; sub(/\.py[co]$$/, "." mt "&"); sub(/[^\/]+\.py[co]$$/, pc "/&"); print; next} \ | /\.py[co]$$/ && !($$0 ~ "/" pc "/") {id = match($$0, /\/[^\/]+\.py[co]$$/); if (id != 0) {d = substr($$0, 1, RSTART - 1); dirs[d] = 1}; sub(/\.py[co]$$/, "." mt "&"); sub(/[^\/]+\.py[co]$$/, pc "/&"); print; next} \ | ||||
/^@dirrm / {d = substr($$0, 8); if (d in dirs) {print $$0 "/" pc}; print $$0; next} \ | /^@dirrm / {d = substr($$0, 8); if (d in dirs) {print $$0 "/" pc}; print $$0; next} \ | ||||
/^@dirrmtry / {d = substr($$0, 11); if (d in dirs) {print $$0 "/" pc}; print $$0; next} \ | /^@dirrmtry / {d = substr($$0, 11); if (d in dirs) {print $$0 "/" pc}; print $$0; next} \ | ||||
{print} \ | {print} \ | ||||
' \ | ' \ | ||||
pc="__pycache__" mt="$$(${PYMAGICTAG})" \ | pc="__pycache__" mt="$$(${PYMAGICTAG})" \ | ||||
${TMPPLIST} > ${TMPPLIST}.pyc_tmp | ${TMPPLIST} > ${TMPPLIST}.pyc_tmp | ||||
@${MV} ${TMPPLIST}.pyc_tmp ${TMPPLIST} | @${MV} ${TMPPLIST}.pyc_tmp ${TMPPLIST} | ||||
.endif # ${PYTHON_REL} >= 320 && defined(_PYTHON_FEATURE_PY3KPLIST) | .endif # ${PYTHON_REL} >= 3200 && defined(_PYTHON_FEATURE_PY3KPLIST) | ||||
.endif # defined(_PYTHON_FEATURE_AUTOPLIST) && defined(_PYTHON_FEATURE_DISTUTILS) | .endif # defined(_PYTHON_FEATURE_AUTOPLIST) && defined(_PYTHON_FEATURE_DISTUTILS) | ||||
# 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}" | ||||
# Python 3rd-party modules | # Python 3rd-party modules | ||||
PYGAME= ${PYTHON_PKGNAMEPREFIX}game>0:${PORTSDIR}/devel/py-game | PYGAME= ${PYTHON_PKGNAMEPREFIX}game>0:${PORTSDIR}/devel/py-game | ||||
PYNUMERIC= ${PYTHON_SITELIBDIR}/Numeric/Numeric.py:${PORTSDIR}/math/py-numeric | PYNUMERIC= ${PYTHON_SITELIBDIR}/Numeric/Numeric.py:${PORTSDIR}/math/py-numeric | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |