aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantoine <antoine@FreeBSD.org>2015-09-14 20:26:28 +0800
committerantoine <antoine@FreeBSD.org>2015-09-14 20:26:28 +0800
commite549120ef3edf4b8a157c0a0b4ef6cf91196da84 (patch)
tree5bec0b18e14a0ef7b453093804e702189573b538
parentf1021ef23837a9f648bb8f8f3a4163e4c007042b (diff)
downloadfreebsd-ports-gnome-e549120ef3edf4b8a157c0a0b4ef6cf91196da84.tar.gz
freebsd-ports-gnome-e549120ef3edf4b8a157c0a0b4ef6cf91196da84.tar.zst
freebsd-ports-gnome-e549120ef3edf4b8a157c0a0b4ef6cf91196da84.zip
Since PEP 0488 and python 3.5, pyo files are eliminated and bytecode files
for level 1 optimization have opt-1.pyc extension Adjust USE_PYTHON=py3kplist to handle this Tested by: koobs
-rw-r--r--Mk/Uses/python.mk9
1 files changed, 7 insertions, 2 deletions
diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk
index 4b960386805e..24dabc81462e 100644
--- a/Mk/Uses/python.mk
+++ b/Mk/Uses/python.mk
@@ -509,14 +509,19 @@ add-plist-pymod:
# of TMPPLIST that end with .py[co], so that they conform
# to PEP 3147 (see http://www.python.org/dev/peps/pep-3147/)
PYMAGICTAG= ${PYTHON_CMD} -c 'import imp; print(imp.get_tag())'
+.if ${PYTHON_REL} < 3500
+PYOEXTENSION= pyo
+.else
+PYOEXTENSION= opt-1.pyc
+.endif
add-plist-post:
@${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(/\.pyc$$/, "." mt "&"); sub(/\.pyo$$/, "." mt "." pyo); sub(/[^\/]+\.py[co]$$/, pc "/&"); print; 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} \
{print} \
' \
- pc="__pycache__" mt="$$(${PYMAGICTAG})" \
+ pc="__pycache__" mt="$$(${PYMAGICTAG})" pyo="${PYOEXTENSION}" \
${TMPPLIST} > ${TMPPLIST}.pyc_tmp
@${MV} ${TMPPLIST}.pyc_tmp ${TMPPLIST}
.endif # ${PYTHON_REL} >= 3200 && defined(_PYTHON_FEATURE_PY3KPLIST)