Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Apr 2012 13:22:17 -0600
From:      John Hein <jhein@symmetricom.com>
To:        Ruslan Mahmatkhanov <cvs-src@yandex.ru>
Cc:        freebsd-python@FreeBSD.org, mexas@bristol.ac.uk, bug-followup@FreeBSD.org, miwi@FreeBSD.org
Subject:   Re: ports/159215: Mk/bsd.python.mk: PYTHON_VERSION is ignored
Message-ID:  <20357.55785.187568.687487@gromit.timing.com>
In-Reply-To: <4F858621.603@yandex.ru>
References:  <201204111317.q3BDHksK038176@freefall.freebsd.org> <4F858621.603@yandex.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Ruslan Mahmatkhanov wrote at 17:24 +0400 on Apr 11, 2012:
 > miwi@FreeBSD.org wrote on 11.04.2012 17:17:
 > > Synopsis: Mk/bsd.python.mk: PYTHON_VERSION is ignored
 > >
 > > State-Changed-From-To: open->closed
 > > State-Changed-By: miwi
 > > State-Changed-When: Wed Apr 11 13:17:46 UTC 2012
 > > State-Changed-Why:
 > > user mistake, you have to set USE_PYTHON= 2.6.
 > >
 > > http://www.freebsd.org/cgi/query-pr.cgi?pr=159215
 > 
 > Martin, I'm not sure about. There is a comment in bsd.python.mk that states:
 > 
 > """
 > Define PYTHON_VERSION to override the defaults that USE_PYTHON would 
 > give you.
 > """
 > 
 > In PR I tried to do just that, but it didn't working.

In the french/aster/Makefile, PYTHON_VERSION=2.6 should be
PYTHON_VERSION=python2.6 (or use USE_PYTHON=2.6 as Martin suggested).

But (#1) neither work because bsd.port.pre.mk defines PYTHON_PORTSDIR
before the new python version can be set by the ARCH == amd64 test.

But (#2) you can't put the ARCH .if test before bsd.port.pre.mk since
ARCH is not defined at that point.

So, you're stuck with an ARCH before USE_PYTHON and USE_PYTHON before
ARCH chicken and egg problem if you want to change the python version
based on ARCH.

The following ugly hack to french/aster/Makefile works around the issue.
It includes bsd.port.pre.mk twice, setting USE_PYTHON
based on ARCH in between.
There may be a better fix that could be made to bsd.python.mk

Index: Makefile
===================================================================
RCS file: /base/FreeBSD-CVS/ports/french/aster/Makefile,v
retrieving revision 1.89
diff -u -p -r1.89 Makefile
--- Makefile	12 Dec 2011 00:29:42 -0000	1.89
+++ Makefile	11 Apr 2012 19:14:52 -0000
@@ -50,7 +50,6 @@ MANUAL_PACKAGE_BUILD=	runaway python on 
 LICENSE=	GPLv2
 
 USE_BISON=	build
-USE_PYTHON=	yes
 HAS_CONFIGURE=	yes
 REINPLACE_ARGS=	-i ""
 
@@ -67,6 +66,11 @@ INTERACTIVE_SCRIPTS=	check_compilers.py 
 
 .include "${.CURDIR}/../../french/aster/bsd.aster.mk"
 .include <bsd.port.pre.mk>
+.if ${ARCH} == "amd64"
+# python 2.7 causes process runaway
+USE_PYTHON=	2.6
+.endif
+.include <bsd.port.pre.mk>
 
 .if ${ARCH} == "i386"
 FLAGARCH=	-DP_LINUX -DLINUX
@@ -76,10 +80,6 @@ FLAGARCH=	-DLINUX64
 FFLAGARCH=	-fdefault-integer-8 -fdefault-real-8
 .endif
 
-.if ${ARCH} == "amd64"
-# python 2.7 causes process runaway
-PYTHON_VERSION=	2.6
-.endif
 # Avoid renaming .f into .F
 #F90FLAGS=	-x f77-cpp-input ${FFLAGS}
 



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