/[gentoo-x86]/eclass/python.eclass
Gentoo

Diff of /eclass/python.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.41 Revision 1.45
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-2008 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.41 2008/05/30 09:58:28 hawking Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.45 2008/09/01 14:11:54 hawking Exp $
4 4
5# @ECLASS: python.eclass 5# @ECLASS: python.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# python@gentoo.org 7# python@gentoo.org
8# 8#
61# @FUNCTION: python_version 61# @FUNCTION: python_version
62# @DESCRIPTION: 62# @DESCRIPTION:
63# Run without arguments and it will export the version of python 63# Run without arguments and it will export the version of python
64# currently in use as $PYVER; sets PYVER/PYVER_MAJOR/PYVER_MINOR 64# currently in use as $PYVER; sets PYVER/PYVER_MAJOR/PYVER_MINOR
65__python_version_extract() { 65__python_version_extract() {
66 verstr=$1 66 local verstr=$1
67 export PYVER_MAJOR=${verstr:0:1} 67 export PYVER_MAJOR=${verstr:0:1}
68 export PYVER_MINOR=${verstr:2:1} 68 export PYVER_MINOR=${verstr:2:1}
69 if [ "${verstr:3}x" = ".x" ]; then 69 if [ "${verstr:3}x" = ".x" ]; then
70 export PYVER_MICRO=${verstr:4} 70 export PYVER_MICRO=${verstr:4}
71 fi 71 fi
72 export PYVER="${PYVER_MAJOR}.${PYVER_MINOR}" 72 export PYVER="${PYVER_MAJOR}.${PYVER_MINOR}"
73} 73}
74 74
75python_version() { 75python_version() {
76 [[ -n "${PYVER}" ]] && return 0
76 local tmpstr 77 local tmpstr
77 python=${python:-/usr/bin/python} 78 python=${python:-/usr/bin/python}
78 tmpstr="$(${python} -V 2>&1 )" 79 tmpstr="$(${python} -V 2>&1 )"
79 export PYVER_ALL="${tmpstr#Python }" 80 export PYVER_ALL="${tmpstr#Python }"
80 __python_version_extract $PYVER_ALL 81 __python_version_extract $PYVER_ALL
82}
83
84# @FUNCTION: python_get_libdir
85# @DESCRIPTION:
86# Run without arguments, returns the python library dir
87python_get_libdir() {
88 python_version
89 echo "/usr/$(get_libdir)/python${PYVER}"
90}
91
92# @FUNCTION: python_get_sitedir
93# @DESCRIPTION:
94# Run without arguments, returns the python site-packages dir
95python_get_sitedir() {
96 echo "$(python_get_libdir)/site-packages"
81} 97}
82 98
83# @FUNCTION: python_makesym 99# @FUNCTION: python_makesym
84# @DESCRIPTION: 100# @DESCRIPTION:
85# Run without arguments, it will create the /usr/bin/python symlinks 101# Run without arguments, it will create the /usr/bin/python symlinks

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.45

  ViewVC Help
Powered by ViewVC 1.1.20