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

Diff of /eclass/python.eclass

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

Revision 1.121 Revision 1.122
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 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.121 2011/07/08 07:41:56 djc Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.122 2011/07/08 07:43:38 djc Exp $
4 4
5# @ECLASS: python.eclass 5# @ECLASS: python.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Gentoo Python Project <python@gentoo.org> 7# Gentoo Python Project <python@gentoo.org>
8# @BLURB: Eclass for Python packages 8# @BLURB: Eclass for Python packages
1254 if PYTHON_ABI is None: 1254 if PYTHON_ABI is None:
1255 sys.stderr.write("EPYTHON variable has unrecognized value '%s'\n" % EPYTHON) 1255 sys.stderr.write("EPYTHON variable has unrecognized value '%s'\n" % EPYTHON)
1256 sys.exit(1) 1256 sys.exit(1)
1257else: 1257else:
1258 try: 1258 try:
1259 environment = os.environ.copy()
1260 environment["ROOT"] = "/"
1259 eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], stdout=subprocess.PIPE) 1261 eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], env=environment, stdout=subprocess.PIPE)
1260 if eselect_process.wait() != 0: 1262 if eselect_process.wait() != 0:
1261 raise ValueError 1263 raise ValueError
1262 except (OSError, ValueError): 1264 except (OSError, ValueError):
1263 sys.stderr.write("Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n") 1265 sys.stderr.write("Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n")
1264 sys.exit(1) 1266 sys.exit(1)
1284 die "${FUNCNAME}(): Generation of '$1' failed" 1286 die "${FUNCNAME}(): Generation of '$1' failed"
1285 fi 1287 fi
1286 else 1288 else
1287 cat << EOF >> "${file}" 1289 cat << EOF >> "${file}"
1288try: 1290try:
1291 environment = os.environ.copy()
1292 environment["ROOT"] = "/"
1289 eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], stdout=subprocess.PIPE) 1293 eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], env=environment, stdout=subprocess.PIPE)
1290 if eselect_process.wait() != 0: 1294 if eselect_process.wait() != 0:
1291 raise ValueError 1295 raise ValueError
1292except (OSError, ValueError): 1296except (OSError, ValueError):
1293 sys.stderr.write("Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n") 1297 sys.stderr.write("Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n")
1294 sys.exit(1) 1298 sys.exit(1)
1756 die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" 1760 die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
1757 fi 1761 fi
1758 _python_calculate_PYTHON_ABIS 1762 _python_calculate_PYTHON_ABIS
1759 PYTHON_ABI="${PYTHON_ABIS##* }" 1763 PYTHON_ABI="${PYTHON_ABIS##* }"
1760 elif [[ "${python2}" == "1" ]]; then 1764 elif [[ "${python2}" == "1" ]]; then
1761 PYTHON_ABI="$(eselect python show --python2 --ABI)" 1765 PYTHON_ABI="$(ROOT="/" eselect python show --python2 --ABI)"
1762 if [[ -z "${PYTHON_ABI}" ]]; then 1766 if [[ -z "${PYTHON_ABI}" ]]; then
1763 die "${FUNCNAME}(): Active version of CPython 2 not set" 1767 die "${FUNCNAME}(): Active version of CPython 2 not set"
1764 elif [[ "${PYTHON_ABI}" != "2."* ]]; then 1768 elif [[ "${PYTHON_ABI}" != "2."* ]]; then
1765 die "${FUNCNAME}(): Internal error in \`eselect python show --python2\`" 1769 die "${FUNCNAME}(): Internal error in \`eselect python show --python2\`"
1766 fi 1770 fi
1767 elif [[ "${python3}" == "1" ]]; then 1771 elif [[ "${python3}" == "1" ]]; then
1768 PYTHON_ABI="$(eselect python show --python3 --ABI)" 1772 PYTHON_ABI="$(ROOT="/" eselect python show --python3 --ABI)"
1769 if [[ -z "${PYTHON_ABI}" ]]; then 1773 if [[ -z "${PYTHON_ABI}" ]]; then
1770 die "${FUNCNAME}(): Active version of CPython 3 not set" 1774 die "${FUNCNAME}(): Active version of CPython 3 not set"
1771 elif [[ "${PYTHON_ABI}" != "3."* ]]; then 1775 elif [[ "${PYTHON_ABI}" != "3."* ]]; then
1772 die "${FUNCNAME}(): Internal error in \`eselect python show --python3\`" 1776 die "${FUNCNAME}(): Internal error in \`eselect python show --python3\`"
1773 fi 1777 fi

Legend:
Removed from v.1.121  
changed lines
  Added in v.1.122

  ViewVC Help
Powered by ViewVC 1.1.20