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

Diff of /eclass/python.eclass

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

Revision 1.122 Revision 1.123
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.122 2011/07/08 07:43:38 djc Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.123 2011/07/08 07:44:52 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
1250 cat << EOF >> "${file}" 1250 cat << EOF >> "${file}"
1251EPYTHON = os.environ.get("EPYTHON") 1251EPYTHON = os.environ.get("EPYTHON")
1252if EPYTHON: 1252if EPYTHON:
1253 PYTHON_ABI = get_PYTHON_ABI(EPYTHON) 1253 PYTHON_ABI = get_PYTHON_ABI(EPYTHON)
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("%s: EPYTHON variable has unrecognized value '%s'\n" % (sys.argv[0], EPYTHON))
1256 sys.exit(1) 1256 sys.exit(1)
1257else: 1257else:
1258 try: 1258 try:
1259 environment = os.environ.copy() 1259 environment = os.environ.copy()
1260 environment["ROOT"] = "/" 1260 environment["ROOT"] = "/"
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) 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)
1262 if eselect_process.wait() != 0: 1262 if eselect_process.wait() != 0:
1263 raise ValueError 1263 raise ValueError
1264 except (OSError, ValueError): 1264 except (OSError, ValueError):
1265 sys.stderr.write("Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n") 1265 sys.stderr.write("%s: Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n" % sys.argv[0])
1266 sys.exit(1) 1266 sys.exit(1)
1267 1267
1268 EPYTHON = eselect_process.stdout.read() 1268 EPYTHON = eselect_process.stdout.read()
1269 if not isinstance(EPYTHON, str): 1269 if not isinstance(EPYTHON, str):
1270 # Python 3 1270 # Python 3
1271 EPYTHON = EPYTHON.decode() 1271 EPYTHON = EPYTHON.decode()
1272 EPYTHON = EPYTHON.rstrip("\n") 1272 EPYTHON = EPYTHON.rstrip("\n")
1273 1273
1274 PYTHON_ABI = get_PYTHON_ABI(EPYTHON) 1274 PYTHON_ABI = get_PYTHON_ABI(EPYTHON)
1275 if PYTHON_ABI is None: 1275 if PYTHON_ABI is None:
1276 sys.stderr.write("'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % EPYTHON) 1276 sys.stderr.write("%s: 'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % (sys.argv[0], EPYTHON))
1277 sys.exit(1) 1277 sys.exit(1)
1278 1278
1279wrapper_script_path = os.path.realpath(sys.argv[0]) 1279wrapper_script_path = os.path.realpath(sys.argv[0])
1280target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI) 1280target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI)
1281if not os.path.exists(target_executable_path): 1281if not os.path.exists(target_executable_path):
1282 sys.stderr.write("'%s' does not exist\n" % target_executable_path) 1282 sys.stderr.write("%s: '%s' does not exist\n" % (sys.argv[0], target_executable_path))
1283 sys.exit(1) 1283 sys.exit(1)
1284EOF 1284EOF
1285 if [[ "$?" != "0" ]]; then 1285 if [[ "$?" != "0" ]]; then
1286 die "${FUNCNAME}(): Generation of '$1' failed" 1286 die "${FUNCNAME}(): Generation of '$1' failed"
1287 fi 1287 fi
1292 environment["ROOT"] = "/" 1292 environment["ROOT"] = "/"
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) 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)
1294 if eselect_process.wait() != 0: 1294 if eselect_process.wait() != 0:
1295 raise ValueError 1295 raise ValueError
1296except (OSError, ValueError): 1296except (OSError, ValueError):
1297 sys.stderr.write("Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n") 1297 sys.stderr.write("%s: Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n" % sys.argv[0])
1298 sys.exit(1) 1298 sys.exit(1)
1299 1299
1300EPYTHON = eselect_process.stdout.read() 1300EPYTHON = eselect_process.stdout.read()
1301if not isinstance(EPYTHON, str): 1301if not isinstance(EPYTHON, str):
1302 # Python 3 1302 # Python 3
1303 EPYTHON = EPYTHON.decode() 1303 EPYTHON = EPYTHON.decode()
1304EPYTHON = EPYTHON.rstrip("\n") 1304EPYTHON = EPYTHON.rstrip("\n")
1305 1305
1306PYTHON_ABI = get_PYTHON_ABI(EPYTHON) 1306PYTHON_ABI = get_PYTHON_ABI(EPYTHON)
1307if PYTHON_ABI is None: 1307if PYTHON_ABI is None:
1308 sys.stderr.write("'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % EPYTHON) 1308 sys.stderr.write("%s: 'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % (sys.argv[0], EPYTHON))
1309 sys.exit(1) 1309 sys.exit(1)
1310 1310
1311wrapper_script_path = os.path.realpath(sys.argv[0]) 1311wrapper_script_path = os.path.realpath(sys.argv[0])
1312for PYTHON_ABI in [PYTHON_ABI, ${PYTHON_ABIS_list}]: 1312for PYTHON_ABI in [PYTHON_ABI, ${PYTHON_ABIS_list}]:
1313 target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI) 1313 target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI)
1314 if os.path.exists(target_executable_path): 1314 if os.path.exists(target_executable_path):
1315 break 1315 break
1316else: 1316else:
1317 sys.stderr.write("No target script exists for '%s'\n" % wrapper_script_path) 1317 sys.stderr.write("%s: No target script exists for '%s'\n" % (sys.argv[0], wrapper_script_path))
1318 sys.exit(1) 1318 sys.exit(1)
1319EOF 1319EOF
1320 if [[ "$?" != "0" ]]; then 1320 if [[ "$?" != "0" ]]; then
1321 die "${FUNCNAME}(): Generation of '$1' failed" 1321 die "${FUNCNAME}(): Generation of '$1' failed"
1322 fi 1322 fi

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

  ViewVC Help
Powered by ViewVC 1.1.20