Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Jan 2013 16:29:52 +0400
From:      Ruslan Makhmatkhanov <cvs-src@yandex.ru>
To:        python <python@FreeBSD.org>
Subject:   bsd.python.mk: python3 plist shim
Message-ID:  <50FFD7C0.9060208@yandex.ru>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------050001020602030809000801
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit


Hello,

I'm planning to apply this patch to Mk/bsd.python.mk soon. It's an 
nivit's solution from devel/py-virtualenv for changes, introduced in PEP 
3147 [1]. It will not affect default packages build, because packages 
are not yet building for python3 on cluster, but it will affect python 
ports, built with python3, that already has fix like that applied 
locally. I tested it with dozen of ports and everything seems fine. 
Local fixes will be removed right after this change. Please tell me if 
there is any objections or suggestions on this. Thanks.

[1] http://www.python.org/dev/peps/pep-3147/

-- 
Regards,
Ruslan

Tinderboxing kills... the drives.

--------------050001020602030809000801
Content-Type: text/plain; charset=UTF-8;
 name="py3-plist.diff.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="py3-plist.diff.txt"

Index: bsd.python.mk
===================================================================
--- bsd.python.mk	(revision 310860)
+++ bsd.python.mk	(working copy)
@@ -666,6 +666,23 @@
 
 .endif # defined(USE_TWISTED)
 
+.if ${PYTHON_REL} >= 320
+# 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())'
+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} \
+		/^@dirrm / {d = substr($$0, 8); if (d in dirs) {print $$0 "/" pc}; print $$0; next} \
+		{print} \
+		END {if (sp in dirs) {print "@dirrm " sp "/" pc}} \
+		' \
+		pc="__pycache__" mt="$$(${PYMAGICTAG})" sp="${PYTHON_SITELIBDIR:S,${PYTHONBASE}/,,g}" \
+		${TMPPLIST} > ${TMPPLIST}.pyc_tmp
+	@${MV} ${TMPPLIST}.pyc_tmp ${TMPPLIST}
+.endif
+
 # XXX Hm, should I export some of the variables above to *_ENV?
 
 # If multiple Python versions are installed and cmake is used, it might

--------------050001020602030809000801--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50FFD7C0.9060208>