summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorAlastair Tse <liquidx@gentoo.org>2005-04-23 10:29:51 +0000
committerAlastair Tse <liquidx@gentoo.org>2005-04-23 10:29:51 +0000
commitfc5051c46a479b6e1dedbbab1e981045946fe461 (patch)
tree277507e481fa4d77e50ec58f5d749b26dc928c56 /eclass
parentFixed bug #76491 (diff)
downloadgentoo-2-fc5051c46a479b6e1dedbbab1e981045946fe461.tar.gz
gentoo-2-fc5051c46a479b6e1dedbbab1e981045946fe461.tar.bz2
gentoo-2-fc5051c46a479b6e1dedbbab1e981045946fe461.zip
fix python version extraction and add version extract test to be sure
Diffstat (limited to 'eclass')
-rw-r--r--eclass/python.eclass32
1 files changed, 27 insertions, 5 deletions
diff --git a/eclass/python.eclass b/eclass/python.eclass
index 75fb08fc6d53..0e853f2a69a7 100644
--- a/eclass/python.eclass
+++ b/eclass/python.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.17 2005/04/23 03:40:10 pythonhead Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.18 2005/04/23 10:29:51 liquidx Exp $
#
# Author: Alastair Tse <liquidx@gentoo.org>
#
@@ -22,6 +22,22 @@ inherit alternatives
ECLASS="python"
INHERITED="$INHERITED $ECLASS"
+
+__python_eclass_test() {
+ __python_version_extract 2.3
+ echo -n "2.3 -> PYVER: $PYVER PYVER_MAJOR: $PYVER_MAJOR"
+ echo " PYVER_MINOR: $PYVER_MINOR PYVER_MICRO: $PYVER_MICRO"
+ __python_version_extract 2.3.4
+ echo -n "2.3.4 -> PYVER: $PYVER PYVER_MAJOR: $PYVER_MAJOR"
+ echo " PYVER_MINOR: $PYVER_MINOR PYVER_MICRO: $PYVER_MICRO"
+ __python_version_extract 2.3.5
+ echo -n "2.3.5 -> PYVER: $PYVER PYVER_MAJOR: $PYVER_MAJOR"
+ echo " PYVER_MINOR: $PYVER_MINOR PYVER_MICRO: $PYVER_MICRO"
+ __python_version_extract 2.4
+ echo -n "2.4 -> PYVER: $PYVER PYVER_MAJOR: $PYVER_MAJOR"
+ echo " PYVER_MINOR: $PYVER_MINOR PYVER_MICRO: $PYVER_MICRO"
+}
+
#
# name: python_disable/enable_pyc
# desc: tells python not to automatically recompile modules to .pyc/.pyo
@@ -45,15 +61,21 @@ python_disable_pyc
# desc: run without arguments and it will export the version of python
# currently in use as $PYVER
#
+
+__python_version_extract() {
+ verstr=$1
+ export PYVER_MAJOR=${verstr:0:1}
+ export PYVER_MINOR=${verstr:2:1}
+ export PYVER_MICRO=${verstr:4}
+ export PYVER="${PYVER_MAJOR}.${PYVER_MINOR}"
+}
+
python_version() {
local tmpstr
python=${python:-/usr/bin/python}
tmpstr="$(${python} -V 2>&1 )"
export PYVER_ALL="${tmpstr#Python }"
- export PYVER_MAJOR=$(echo ${PYVER_ALL} | cut -d. -f1)
- export PYVER_MINOR=$(echo ${PYVER_ALL} | cut -d. -f2)
- export PYVER_MICRO=$(echo ${PYVER_ALL} | cut -d. -f3-)
- export PYVER="${PYVER_MAJOR}.${PYVER_MINOR}"
+ __python_version_extract $PYVER_ALL
}
#