Date: Mon, 04 Jan 2016 17:13:42 +0200 From: clutton <clutton@zoho.com> To: python <python@FreeBSD.org> Subject: pkg-plist %%PYVER%%.%%PYOEXTENSION%% handling. patch included, feedback needed Message-ID: <1451920422.31882.24.camel@zoho.com>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hi list.
As I can see there are two ways of doing pkg-plist routine.
For pkg-plist which was made for python2 just including USE_PYTHON=
py3kplist would do the trick.
For new python3 ports it's not so straight forward, and when they don't
use setup.py conventions people usually do something like this:
.if ${PYTHON_REL} < 3500
PYOEXTENSION= pyo
.else
PYOEXTENSION= opt-1.pyc
.endif
PLIST_SUB+= PYOEXTENSION=${PYOEXTENSION} \
PYVER=${PYTHON_VER:S/.//}
What a shame!!! Looks like doing twice the same task. I've prepared the
patch and would like to have a feedback before/if it'll go as a ticket.
Since currently it's a hack and what patch is doing is making it
absolute.
[-- Attachment #2 --]
diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk
index a5ebce0..1886919 100644
--- a/Mk/Uses/python.mk
+++ b/Mk/Uses/python.mk
@@ -193,6 +193,8 @@
# PYTHON_SITELIBDIR=${PYTHONPREFIX_SITELIBDIR:S;${PREFIX}/;;}
# PYTHON_VERSION=${PYTHON_VERSION}
# PYTHON_VER=${PYTHON_VER}
+# PYMAGICTAG=${PYMAGICTAG}
+# PYOEXTENSION=${PYOEXTENSION}
#
#
# Deprecated variables, which exist for compatibility and will be removed
@@ -517,12 +519,14 @@ add-plist-pymod:
# When Python version is 3.2+ we rewrite all the filenames
# 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())'
+PYMAGICTAG!= ${PYTHON_CMD} -c 'import imp; print(imp.get_tag())'
.if ${PYTHON_REL} < 3500
PYOEXTENSION= pyo
.else
PYOEXTENSION= opt-1.pyc
.endif
+PLIST_SUB+= PYMAGICTAG=${PYMAGICTAG} \
+ PYOEXTENSION=${PYOEXTENSION}
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(/\.pyc$$/, "." mt "&"); sub(/\.pyo$$/, "." mt "." pyo); sub(/[^\/]+\.py[co]$$/, pc "/&"); print; next} \
@@ -530,7 +534,7 @@ add-plist-post:
/^@dirrmtry / {d = substr($$0, 11); if (d in dirs) {print $$0 "/" pc}; print $$0; next} \
{print} \
' \
- pc="__pycache__" mt="$$(${PYMAGICTAG})" pyo="${PYOEXTENSION}" \
+ pc="__pycache__" mt="${PYMAGICTAG}" pyo="${PYOEXTENSION}" \
${TMPPLIST} > ${TMPPLIST}.pyc_tmp
@${MV} ${TMPPLIST}.pyc_tmp ${TMPPLIST}
.endif # ${PYTHON_REL} >= 3200 && defined(_PYTHON_FEATURE_PY3KPLIST)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1451920422.31882.24.camel>
