Commit e549120e authored by antoine's avatar antoine
Browse files

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
parent f1021ef2
...@@ -509,14 +509,19 @@ add-plist-pymod: ...@@ -509,14 +509,19 @@ add-plist-pymod:
# 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())'
.if ${PYTHON_REL} < 3500
PYOEXTENSION= pyo
.else
PYOEXTENSION= opt-1.pyc
.endif
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(/\.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} \ /^@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})" pyo="${PYOEXTENSION}" \
${TMPPLIST} > ${TMPPLIST}.pyc_tmp ${TMPPLIST} > ${TMPPLIST}.pyc_tmp
@${MV} ${TMPPLIST}.pyc_tmp ${TMPPLIST} @${MV} ${TMPPLIST}.pyc_tmp ${TMPPLIST}
.endif # ${PYTHON_REL} >= 3200 && defined(_PYTHON_FEATURE_PY3KPLIST) .endif # ${PYTHON_REL} >= 3200 && defined(_PYTHON_FEATURE_PY3KPLIST)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment