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

Diff of /eclass/python.eclass

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

Revision 1.46 Revision 1.47
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.46 2008/10/26 17:11:51 hawking Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.47 2008/10/26 17:26:18 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#
42# currently in use as $PYVER; sets PYVER/PYVER_MAJOR/PYVER_MINOR 42# currently in use as $PYVER; sets PYVER/PYVER_MAJOR/PYVER_MINOR
43__python_version_extract() { 43__python_version_extract() {
44 local verstr=$1 44 local verstr=$1
45 export PYVER_MAJOR=${verstr:0:1} 45 export PYVER_MAJOR=${verstr:0:1}
46 export PYVER_MINOR=${verstr:2:1} 46 export PYVER_MINOR=${verstr:2:1}
47 if [ "${verstr:3}x" = ".x" ]; then 47 if [[ ${verstr:3:1} == . ]]; then
48 export PYVER_MICRO=${verstr:4} 48 export PYVER_MICRO=${verstr:4}
49 fi 49 fi
50 export PYVER="${PYVER_MAJOR}.${PYVER_MINOR}" 50 export PYVER="${PYVER_MAJOR}.${PYVER_MINOR}"
51} 51}
52 52
140# Example: 140# Example:
141# if python_mod_exists gtk; then 141# if python_mod_exists gtk; then
142# echo "gtk support enabled" 142# echo "gtk support enabled"
143# fi 143# fi
144python_mod_exists() { 144python_mod_exists() {
145 [ -z "$1" ] && die "${FUNCTION} requires an argument!" 145 [[ "$1" ]] && die "${FUNCNAME} requires an argument!"
146 if ! python -c "import $1" >/dev/null 2>&1; then 146 python -c "import $1" >/dev/null 2>&1
147 return 1
148 fi
149 return 0
150} 147}
151 148
152# @FUNCTION: python_mod_compile 149# @FUNCTION: python_mod_compile
153# @USAGE: < file > [more files ...] 150# @USAGE: < file > [more files ...]
154# @DESCRIPTION: 151# @DESCRIPTION:

Legend:
Removed from v.1.46  
changed lines
  Added in v.1.47

  ViewVC Help
Powered by ViewVC 1.1.20