approval to commit addition of PYTHON_VER variable
Alexander Botero-Lowry
alexbl at FreeBSD.org
Thu Dec 21 22:01:55 PST 2006
Hey guys,
With the further proliferation of Python eggs, it's about time for
us python@ folks to start dealing with that seriously, but for now
I don't want to start doing any restructing until 6.2 is out. With
that in mind, I decided to add a PYTHON_VER variable to bsd.python.mk
which is just the major number release (2.1, 2.2, 2.3, etc) of the
installed Python version. This is used in the filename of eggs, and
the solutions I have seen to derieve it are pretty scary. Among them
are:
EGGEXT=py2.4.egg # notice the hardcoded version number
PYTHONVER?= ${_PYTHON_VERSION} # which annoys me for using an
internal variable, but is sadly
the cleanest solution. It's also
bad because it's not hardcoded by
${PYTHON_VERSION} so it could be
incorrect
PYVER=${PYTHON_VERSION:S/python//} # this is the nice regex solution
${PYTHON_PKGNAMEPREFIX:C|([0-9])([0-9])|\1.\2|} # the nasty regex solution
Basically, it's clear to me that i should just provide a ${PYTHON_VER} which
is safely set in the ${PYTHON_VERSION} process so that the version number is
correct.
I've made up a patch for this, but wanted to be sure it was ok with portmgr,
anyone on python@ is also welcome to comment on it.
-------------- next part --------------
? python_ver.diff
Index: bsd.python.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.python.mk,v
retrieving revision 1.90
diff -u -r1.90 bsd.python.mk
--- bsd.python.mk 22 Dec 2006 05:26:01 -0000 1.90
+++ bsd.python.mk 22 Dec 2006 05:32:09 -0000
@@ -327,6 +327,7 @@
PYTHON_PORTSDIR= ${PORTSDIR}/lang/python25
PYTHON_REL= 250
PYTHON_SUFFIX= 25
+PYTHON_VER= 2.5
# Python-2.4
.elif ${PYTHON_VERSION} == "python2.4"
@@ -334,6 +335,7 @@
PYTHON_PORTSDIR= ${PORTSDIR}/lang/python24
PYTHON_REL= 243
PYTHON_SUFFIX= 24
+PYTHON_VER= 2.4
# Python-2.3
.elif ${PYTHON_VERSION} == "python2.3"
@@ -341,6 +343,7 @@
PYTHON_PORTSDIR= ${PORTSDIR}/lang/python23
PYTHON_REL= 235
PYTHON_SUFFIX= 23
+PYTHON_VER= 2.3
# Python-2.2
.elif ${PYTHON_VERSION} == "python2.2"
@@ -348,6 +351,7 @@
PYTHON_PORTSDIR= ${PORTSDIR}/lang/python22
PYTHON_REL= 223
PYTHON_SUFFIX= 22
+PYTHON_VER= 2.2
# Python-2.1
.elif ${PYTHON_VERSION} == "python2.1"
@@ -355,6 +359,7 @@
PYTHON_PORTSDIR= ${PORTSDIR}/lang/python21
PYTHON_REL= 213
PYTHON_SUFFIX= 21
+PYTHON_VER= 2.1
# Python versions in development
.elif defined(FORCE_PYTHON_VERSION)
@@ -364,6 +369,7 @@
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]'
.else
check-makevars::
More information about the freebsd-python
mailing list