>Submitter-Id:  current-users
>Originator:    Mel Flynn
>Organization:  
>Confidential:  no 
>Synopsis:      [patch] Mk/bsd.python.mk: Fix python -c commands for python 3+
>Severity:      serious
>Priority:      high
>Category:      ports
>Class:         sw-bug
>Release:       FreeBSD 8.2-STABLE amd64
>Environment:
System: FreeBSD datakitty.lan.rachie.is-a-geek.net 8.2-STABLE FreeBSD 
8.2-STABLE #6 r230977: Sun Feb 5 06:20:11 AKST 2012 
m...@datakitty.lan.rachie.is-a-geek.net:/data/obj/data/RELENG_8/src/sys/GENERIC 
amd64


>Description:
Incompatibilities with python 3.x cause several commands in bsd.python.mk
to fail.
The net result is that when python 3.1+ is installed, any port setting
USE_PYTHON will pull in the default python version and several variables
that should be available to dependent ports are not.

>How-To-Repeat:
Install lang/python31 (uninstall lang/python27 if installed).
make -C /usr/ports/devel/talloc -V BUILD_DEPENDS

>Fix:

--- fix-python-3.x.patch begins here ---
Index: Mk/bsd.python.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.python.mk,v
retrieving revision 1.142
diff -u -r1.142 bsd.python.mk
--- Mk/bsd.python.mk    7 Nov 2011 12:40:53 -0000       1.142
+++ Mk/bsd.python.mk    18 Mar 2012 14:39:38 -0000
@@ -264,7 +268,7 @@
 .if !defined(PYTHON_DEFAULT_VERSION)
 . if exists(${LOCALBASE}/bin/python)
 _PYTHON_DEFAULT_VERSION!=      (${LOCALBASE}/bin/python -c \
-                                                       'import sys; print 
sys.version[:3]' 2> /dev/null \
+                                                       'import sys; 
print(sys.version[:3])' 2> /dev/null \
                                                        || ${ECHO_CMD} 
${_PYTHON_PORTBRANCH}) | ${TAIL} -1
 . else
 _PYTHON_DEFAULT_VERSION=       ${_PYTHON_PORTBRANCH}
@@ -336,7 +340,7 @@
 PYTHON_VERSION?=       python${_PYTHON_VERSION}
 PYTHON_CMD?=           ${_PYTHON_CMD}
 .if !defined(PYTHONBASE)
-PYTHONBASE!=           (${PYTHON_CMD} -c 'import sys; print sys.prefix' \
+PYTHONBASE!=           (${PYTHON_CMD} -c 'import sys; print(sys.prefix)' \
                                                2> /dev/null || ${ECHO_CMD} 
${LOCALBASE}) | ${TAIL} -1
 .endif
 DEPENDS_ARGS+=         PYTHON_VERSION=${PYTHON_VERSION}
@@ -345,8 +349,8 @@
 # should point to some other version we have installed, according to the port 
USE_PYTHON
 # specification
 .if !defined(PYTHON_DEFAULT_PORTVERSION) || (${PYTHON_VERSION} != 
${PYTHON_DEFAULT_VERSION})
-_PYTHON_PORTVERSION!=  (${PYTHON_CMD} -c 'import string, sys; \
-                                                       print 
string.split(sys.version)[0].replace("b",".b")' 2> /dev/null) | ${TAIL} -1
+_PYTHON_PORTVERSION!=  (${PYTHON_CMD} -c 'import sys; \
+                                                       
print(sys.version.split()[0].replace("b",".b"))' 2> /dev/null) | ${TAIL} -1
 .if !defined(PYTHON_NO_DEPENDS) && !empty(_PYTHON_PORTVERSION)
 PYTHON_PORTVERSION=    ${_PYTHON_PORTVERSION}
 .endif
@@ -413,10 +417,10 @@
 PYTHON_PORTSDIR=       # empty
 PYTHON_NO_DEPENDS=     YES
 PYTHON_REL!=           ${PYTHON_CMD} -c 'import sys; h = "%x" % 
sys.hexversion; \
-                                               print h[0]+h[2]+h[4]'
+                                               print(h[0]+h[2]+h[4])'
 PYTHON_SUFFIX!=                ${PYTHON_CMD} -c 'import sys; h = "%x" % 
sys.hexversion; \
-                                               print h[0]+h[2]'
-PYTHON_VER!=           ${PYTHON_CMD} -c 'import sys; print sys.version[:3]'
+                                               print(h[0]+h[2])'
+PYTHON_VER!=           ${PYTHON_CMD} -c 'import sys; print(sys.version[:3])'
 
 .else
 check-makevars::
--- fix-python-3.x.patch ends here ---

_______________________________________________
freebsd-python@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-python
To unsubscribe, send any mail to "freebsd-python-unsubscr...@freebsd.org"

Reply via email to