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

Diff of /eclass/python.eclass

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

Revision 1.134 Revision 1.139
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.134 2011/10/07 10:49:26 djc Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.139 2011/10/15 20:58:08 phajdan.jr 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
9# @DESCRIPTION: 9# @DESCRIPTION:
10# The python eclass contains miscellaneous, useful functions for Python packages. 10# The python eclass contains miscellaneous, useful functions for Python packages.
11 11
12inherit multilib 12inherit multilib
13 13
14if ! has "${EAPI:-0}" 0 1 2 3; then 14if ! has "${EAPI:-0}" 0 1 2 3 4; then
15 die "API of python.eclass in EAPI=\"${EAPI}\" not established" 15 die "API of python.eclass in EAPI=\"${EAPI}\" not established"
16fi 16fi
17 17
18_CPYTHON2_GLOBALLY_SUPPORTED_ABIS=(2.4 2.5 2.6 2.7) 18_CPYTHON2_GLOBALLY_SUPPORTED_ABIS=(2.4 2.5 2.6 2.7)
19_CPYTHON3_GLOBALLY_SUPPORTED_ABIS=(3.1 3.2) 19_CPYTHON3_GLOBALLY_SUPPORTED_ABIS=(3.1 3.2)
1231import os 1231import os
1232import re 1232import re
1233import subprocess 1233import subprocess
1234import sys 1234import sys
1235 1235
1236cpython_re = re.compile(r"^python(\d+\.\d+)$") 1236cpython_ABI_re = re.compile(r"^(\d+\.\d+)$")
1237jython_ABI_re = re.compile(r"^(\d+\.\d+)-jython$")
1238pypy_ABI_re = re.compile(r"^\d+\.\d+-pypy-(\d+\.\d+)$")
1239cpython_interpreter_re = re.compile(r"^python(\d+\.\d+)$")
1237jython_re = re.compile(r"^jython(\d+\.\d+)$") 1240jython_interpreter_re = re.compile(r"^jython(\d+\.\d+)$")
1238pypy_re = re.compile(r"^pypy-c(\d+\.\d+)$") 1241pypy_interpreter_re = re.compile(r"^pypy-c(\d+\.\d+)$")
1239cpython_shebang_re = re.compile(r"^#![ \t]*(?:${EPREFIX}/usr/bin/python|(?:${EPREFIX})?/usr/bin/env[ \t]+(?:${EPREFIX}/usr/bin/)?python)") 1242cpython_shebang_re = re.compile(r"^#![ \t]*(?:${EPREFIX}/usr/bin/python|(?:${EPREFIX})?/usr/bin/env[ \t]+(?:${EPREFIX}/usr/bin/)?python)")
1240python_shebang_options_re = re.compile(r"^#![ \t]*${EPREFIX}/usr/bin/(?:jython|pypy-c|python)(?:\d+(?:\.\d+)?)?[ \t]+(-\S)") 1243python_shebang_options_re = re.compile(r"^#![ \t]*${EPREFIX}/usr/bin/(?:jython|pypy-c|python)(?:\d+(?:\.\d+)?)?[ \t]+(-\S)")
1241python_verification_output_re = re.compile("^GENTOO_PYTHON_TARGET_SCRIPT_PATH supported\n$") 1244python_verification_output_re = re.compile("^GENTOO_PYTHON_TARGET_SCRIPT_PATH supported\n$")
1242 1245
1243pypy_versions_mapping = { 1246pypy_versions_mapping = {
1244 "1.5": "2.7" 1247 "1.5": "2.7"
1245} 1248}
1246 1249
1247def get_PYTHON_ABI(EPYTHON): 1250def get_PYTHON_ABI(python_interpreter):
1248 cpython_matched = cpython_re.match(EPYTHON) 1251 cpython_matched = cpython_interpreter_re.match(python_interpreter)
1249 jython_matched = jython_re.match(EPYTHON) 1252 jython_matched = jython_interpreter_re.match(python_interpreter)
1250 pypy_matched = pypy_re.match(EPYTHON) 1253 pypy_matched = pypy_interpreter_re.match(python_interpreter)
1251 if cpython_matched is not None: 1254 if cpython_matched is not None:
1252 PYTHON_ABI = cpython_matched.group(1) 1255 PYTHON_ABI = cpython_matched.group(1)
1253 elif jython_matched is not None: 1256 elif jython_matched is not None:
1254 PYTHON_ABI = jython_matched.group(1) + "-jython" 1257 PYTHON_ABI = jython_matched.group(1) + "-jython"
1255 elif pypy_matched is not None: 1258 elif pypy_matched is not None:
1256 PYTHON_ABI = pypy_versions_mapping[pypy_matched.group(1)] + "-pypy-" + pypy_matched.group(1) 1259 PYTHON_ABI = pypy_versions_mapping[pypy_matched.group(1)] + "-pypy-" + pypy_matched.group(1)
1257 else: 1260 else:
1258 PYTHON_ABI = None 1261 PYTHON_ABI = None
1259 return PYTHON_ABI 1262 return PYTHON_ABI
1260 1263
1264def get_python_interpreter(PYTHON_ABI):
1265 cpython_matched = cpython_ABI_re.match(PYTHON_ABI)
1266 jython_matched = jython_ABI_re.match(PYTHON_ABI)
1267 pypy_matched = pypy_ABI_re.match(PYTHON_ABI)
1268 if cpython_matched is not None:
1269 python_interpreter = "python" + cpython_matched.group(1)
1270 elif jython_matched is not None:
1271 python_interpreter = "jython" + jython_matched.group(1)
1272 elif pypy_matched is not None:
1273 python_interpreter = "pypy-c" + pypy_matched.group(1)
1274 else:
1275 python_interpreter = None
1276 return python_interpreter
1277
1261EOF 1278EOF
1262 if [[ "$?" != "0" ]]; then 1279 if [[ "$?" != "0" ]]; then
1263 die "${FUNCNAME}(): Generation of '$1' failed" 1280 die "${FUNCNAME}(): Generation of '$1' failed"
1264 fi 1281 fi
1265 if [[ "${respect_EPYTHON}" == "1" ]]; then 1282 if [[ "${respect_EPYTHON}" == "1" ]]; then
1266 cat << EOF >> "${file}" 1283 cat << EOF >> "${file}"
1267EPYTHON = os.environ.get("EPYTHON") 1284python_interpreter = os.environ.get("EPYTHON")
1268if EPYTHON: 1285if python_interpreter:
1269 PYTHON_ABI = get_PYTHON_ABI(EPYTHON) 1286 PYTHON_ABI = get_PYTHON_ABI(python_interpreter)
1270 if PYTHON_ABI is None: 1287 if PYTHON_ABI is None:
1271 sys.stderr.write("%s: EPYTHON variable has unrecognized value '%s'\n" % (sys.argv[0], EPYTHON)) 1288 sys.stderr.write("%s: EPYTHON variable has unrecognized value '%s'\n" % (sys.argv[0], python_interpreter))
1272 sys.exit(1) 1289 sys.exit(1)
1273else: 1290else:
1274 try: 1291 try:
1275 environment = os.environ.copy() 1292 environment = os.environ.copy()
1276 environment["ROOT"] = "/" 1293 environment["ROOT"] = "/"
1279 raise ValueError 1296 raise ValueError
1280 except (OSError, ValueError): 1297 except (OSError, ValueError):
1281 sys.stderr.write("%s: Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n" % sys.argv[0]) 1298 sys.stderr.write("%s: Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n" % sys.argv[0])
1282 sys.exit(1) 1299 sys.exit(1)
1283 1300
1284 EPYTHON = eselect_process.stdout.read() 1301 python_interpreter = eselect_process.stdout.read()
1285 if not isinstance(EPYTHON, str): 1302 if not isinstance(python_interpreter, str):
1286 # Python 3 1303 # Python 3
1287 EPYTHON = EPYTHON.decode() 1304 python_interpreter = python_interpreter.decode()
1288 EPYTHON = EPYTHON.rstrip("\n") 1305 python_interpreter = python_interpreter.rstrip("\n")
1289 1306
1290 PYTHON_ABI = get_PYTHON_ABI(EPYTHON) 1307 PYTHON_ABI = get_PYTHON_ABI(python_interpreter)
1291 if PYTHON_ABI is None: 1308 if PYTHON_ABI is None:
1292 sys.stderr.write("%s: 'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % (sys.argv[0], EPYTHON)) 1309 sys.stderr.write("%s: 'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % (sys.argv[0], python_interpreter))
1293 sys.exit(1) 1310 sys.exit(1)
1294 1311
1295wrapper_script_path = os.path.realpath(sys.argv[0]) 1312wrapper_script_path = os.path.realpath(sys.argv[0])
1296target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI) 1313target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI)
1297if not os.path.exists(target_executable_path): 1314if not os.path.exists(target_executable_path):
1311 raise ValueError 1328 raise ValueError
1312except (OSError, ValueError): 1329except (OSError, ValueError):
1313 sys.stderr.write("%s: Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n" % sys.argv[0]) 1330 sys.stderr.write("%s: Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n" % sys.argv[0])
1314 sys.exit(1) 1331 sys.exit(1)
1315 1332
1316EPYTHON = eselect_process.stdout.read() 1333python_interpreter = eselect_process.stdout.read()
1317if not isinstance(EPYTHON, str): 1334if not isinstance(python_interpreter, str):
1318 # Python 3 1335 # Python 3
1319 EPYTHON = EPYTHON.decode() 1336 python_interpreter = python_interpreter.decode()
1320EPYTHON = EPYTHON.rstrip("\n") 1337python_interpreter = python_interpreter.rstrip("\n")
1321 1338
1322PYTHON_ABI = get_PYTHON_ABI(EPYTHON) 1339PYTHON_ABI = get_PYTHON_ABI(python_interpreter)
1323if PYTHON_ABI is None: 1340if PYTHON_ABI is None:
1324 sys.stderr.write("%s: 'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % (sys.argv[0], EPYTHON)) 1341 sys.stderr.write("%s: 'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % (sys.argv[0], python_interpreter))
1325 sys.exit(1) 1342 sys.exit(1)
1326 1343
1327wrapper_script_path = os.path.realpath(sys.argv[0]) 1344wrapper_script_path = os.path.realpath(sys.argv[0])
1328for PYTHON_ABI in [PYTHON_ABI, ${PYTHON_ABIS_list}]: 1345for PYTHON_ABI in [PYTHON_ABI, ${PYTHON_ABIS_list}]:
1329 target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI) 1346 target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI)
1330 if os.path.exists(target_executable_path): 1347 if os.path.exists(target_executable_path):
1331 break 1348 break
1332else: 1349else:
1333 sys.stderr.write("%s: No target script exists for '%s'\n" % (sys.argv[0], wrapper_script_path)) 1350 sys.stderr.write("%s: No target script exists for '%s'\n" % (sys.argv[0], wrapper_script_path))
1334 sys.exit(1) 1351 sys.exit(1)
1352
1353python_interpreter = get_python_interpreter(PYTHON_ABI)
1354if python_interpreter is None:
1355 sys.stderr.write("%s: Unrecognized Python ABI '%s'\n" % (sys.argv[0], PYTHON_ABI))
1356 sys.exit(1)
1335EOF 1357EOF
1336 if [[ "$?" != "0" ]]; then 1358 if [[ "$?" != "0" ]]; then
1337 die "${FUNCNAME}(): Generation of '$1' failed" 1359 die "${FUNCNAME}(): Generation of '$1' failed"
1338 fi 1360 fi
1339 fi 1361 fi
1353 1375
1354cpython_shebang_matched = cpython_shebang_re.match(target_executable_first_line) 1376cpython_shebang_matched = cpython_shebang_re.match(target_executable_first_line)
1355 1377
1356if cpython_shebang_matched is not None: 1378if cpython_shebang_matched is not None:
1357 try: 1379 try:
1358 python_interpreter_path = "${EPREFIX}/usr/bin/%s" % EPYTHON 1380 python_interpreter_path = "${EPREFIX}/usr/bin/%s" % python_interpreter
1359 os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"] = "1" 1381 os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"] = "1"
1360 python_verification_process = subprocess.Popen([python_interpreter_path, "-c", "pass"], stdout=subprocess.PIPE) 1382 python_verification_process = subprocess.Popen([python_interpreter_path, "-c", "pass"], stdout=subprocess.PIPE)
1361 del os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"] 1383 del os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"]
1362 if python_verification_process.wait() != 0: 1384 if python_verification_process.wait() != 0:
1363 raise ValueError 1385 raise ValueError
1368 python_verification_output = python_verification_output.decode() 1390 python_verification_output = python_verification_output.decode()
1369 1391
1370 if not python_verification_output_re.match(python_verification_output): 1392 if not python_verification_output_re.match(python_verification_output):
1371 raise ValueError 1393 raise ValueError
1372 1394
1373 if cpython_re.match(EPYTHON) is not None: 1395 if cpython_interpreter_re.match(python_interpreter) is not None:
1374 os.environ["GENTOO_PYTHON_PROCESS_NAME"] = os.path.basename(sys.argv[0]) 1396 os.environ["GENTOO_PYTHON_PROCESS_NAME"] = os.path.basename(sys.argv[0])
1375 os.environ["GENTOO_PYTHON_WRAPPER_SCRIPT_PATH"] = sys.argv[0] 1397 os.environ["GENTOO_PYTHON_WRAPPER_SCRIPT_PATH"] = sys.argv[0]
1376 os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH"] = target_executable_path 1398 os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH"] = target_executable_path
1377 1399
1378 if hasattr(os, "execv"): 1400 if hasattr(os, "execv"):
1599 stdout = sys.stdout.buffer 1621 stdout = sys.stdout.buffer
1600else: 1622else:
1601 # Python 2 1623 # Python 2
1602 stdout = sys.stdout 1624 stdout = sys.stdout
1603 1625
1626python_wrapper_scripts_file = open('${T}/python_wrapper_scripts', 'rb')
1604files = set(open('${T}/python_wrapper_scripts', 'rb').read().rstrip(${b}'\x00').split(${b}'\x00')) 1627files = set(python_wrapper_scripts_file.read().rstrip(${b}'\x00').split(${b}'\x00'))
1628python_wrapper_scripts_file.close()
1605 1629
1606for file in sorted(files): 1630for file in sorted(files):
1607 stdout.write(file) 1631 stdout.write(file)
1608 stdout.write(${b}'\x00')" || die "${FUNCNAME}(): Failure of extraction of set of wrapper scripts") 1632 stdout.write(${b}'\x00')" || die "${FUNCNAME}(): Failure of extraction of set of wrapper scripts")
1609 1633
2384_python_test_hook() { 2408_python_test_hook() {
2385 if [[ "$#" -ne 1 ]]; then 2409 if [[ "$#" -ne 1 ]]; then
2386 die "${FUNCNAME}() requires 1 argument" 2410 die "${FUNCNAME}() requires 1 argument"
2387 fi 2411 fi
2388 2412
2389 if _python_package_supporting_installation_for_multiple_python_abis && [[ "$(type -t "${FUNCNAME[3]}_$1_hook")" == "function" ]]; then 2413 if _python_package_supporting_installation_for_multiple_python_abis && [[ "$(type -t "${_PYTHON_TEST_FUNCTION}_$1_hook")" == "function" ]]; then
2390 "${FUNCNAME[3]}_$1_hook" 2414 "${_PYTHON_TEST_FUNCTION}_$1_hook"
2391 fi 2415 fi
2392} 2416}
2393 2417
2394# @FUNCTION: python_execute_nosetests 2418# @FUNCTION: python_execute_nosetests
2395# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments] 2419# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments]
2429 python_test_function() { 2453 python_test_function() {
2430 local evaluated_PYTHONPATH 2454 local evaluated_PYTHONPATH
2431 2455
2432 eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\"" 2456 eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
2433 2457
2434 _python_test_hook pre 2458 _PYTHON_TEST_FUNCTION="python_execute_nosetests" _python_test_hook pre
2435 2459
2436 if [[ -n "${evaluated_PYTHONPATH}" ]]; then 2460 if [[ -n "${evaluated_PYTHONPATH}" ]]; then
2437 echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL} 2461 echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL}
2438 PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?" 2462 PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?"
2439 else 2463 else
2440 echo ${_BOLD}nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL} 2464 echo ${_BOLD}nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL}
2441 nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?" 2465 nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?"
2442 fi 2466 fi
2443 2467
2444 _python_test_hook post 2468 _PYTHON_TEST_FUNCTION="python_execute_nosetests" _python_test_hook post
2445 } 2469 }
2446 if _python_package_supporting_installation_for_multiple_python_abis; then 2470 if _python_package_supporting_installation_for_multiple_python_abis; then
2447 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@" 2471 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
2448 else 2472 else
2449 if [[ -n "${separate_build_dirs}" ]]; then 2473 if [[ -n "${separate_build_dirs}" ]]; then
2493 python_test_function() { 2517 python_test_function() {
2494 local evaluated_PYTHONPATH 2518 local evaluated_PYTHONPATH
2495 2519
2496 eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\"" 2520 eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
2497 2521
2498 _python_test_hook pre 2522 _PYTHON_TEST_FUNCTION="python_execute_py.test" _python_test_hook pre
2499 2523
2500 if [[ -n "${evaluated_PYTHONPATH}" ]]; then 2524 if [[ -n "${evaluated_PYTHONPATH}" ]]; then
2501 echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@"${_NORMAL} 2525 echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@"${_NORMAL}
2502 PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@" || return "$?" 2526 PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@" || return "$?"
2503 else 2527 else
2504 echo ${_BOLD}py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@"${_NORMAL} 2528 echo ${_BOLD}py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@"${_NORMAL}
2505 py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@" || return "$?" 2529 py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@" || return "$?"
2506 fi 2530 fi
2507 2531
2508 _python_test_hook post 2532 _PYTHON_TEST_FUNCTION="python_execute_py.test" _python_test_hook post
2509 } 2533 }
2510 if _python_package_supporting_installation_for_multiple_python_abis; then 2534 if _python_package_supporting_installation_for_multiple_python_abis; then
2511 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@" 2535 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
2512 else 2536 else
2513 if [[ -n "${separate_build_dirs}" ]]; then 2537 if [[ -n "${separate_build_dirs}" ]]; then
2557 python_test_function() { 2581 python_test_function() {
2558 local evaluated_PYTHONPATH 2582 local evaluated_PYTHONPATH
2559 2583
2560 eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\"" 2584 eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
2561 2585
2562 _python_test_hook pre 2586 _PYTHON_TEST_FUNCTION="python_execute_trial" _python_test_hook pre
2563 2587
2564 if [[ -n "${evaluated_PYTHONPATH}" ]]; then 2588 if [[ -n "${evaluated_PYTHONPATH}" ]]; then
2565 echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL} 2589 echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL}
2566 PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?" 2590 PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?"
2567 else 2591 else
2568 echo ${_BOLD}trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL} 2592 echo ${_BOLD}trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL}
2569 trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?" 2593 trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?"
2570 fi 2594 fi
2571 2595
2572 _python_test_hook post 2596 _PYTHON_TEST_FUNCTION="python_execute_trial" _python_test_hook post
2573 } 2597 }
2574 if _python_package_supporting_installation_for_multiple_python_abis; then 2598 if _python_package_supporting_installation_for_multiple_python_abis; then
2575 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@" 2599 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
2576 else 2600 else
2577 if [[ -n "${separate_build_dirs}" ]]; then 2601 if [[ -n "${separate_build_dirs}" ]]; then
2836 done 2860 done
2837 for dir in "${evaluated_dirs[@]}"; do 2861 for dir in "${evaluated_dirs[@]}"; do
2838 eval "dirs+=(\"\${root}${dir}\")" 2862 eval "dirs+=(\"\${root}${dir}\")"
2839 done 2863 done
2840 stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m compileall "${options[@]}" "${dirs[@]}" 2>&1)" || return_code="1" 2864 stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m compileall "${options[@]}" "${dirs[@]}" 2>&1)" || return_code="1"
2841 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2865 if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
2842 "$(PYTHON)" -O -m compileall "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1" 2866 "$(PYTHON)" -O -m compileall "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1"
2843 fi 2867 fi
2844 _python_clean_compiled_modules "${dirs[@]}" 2868 _python_clean_compiled_modules "${dirs[@]}"
2845 fi 2869 fi
2846 if ((${#site_packages_files[@]})) || ((${#evaluated_files[@]})); then 2870 if ((${#site_packages_files[@]})) || ((${#evaluated_files[@]})); then
2849 done 2873 done
2850 for file in "${evaluated_files[@]}"; do 2874 for file in "${evaluated_files[@]}"; do
2851 eval "files+=(\"\${root}${file}\")" 2875 eval "files+=(\"\${root}${file}\")"
2852 done 2876 done
2853 stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m py_compile "${files[@]}" 2>&1)" || return_code="1" 2877 stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m py_compile "${files[@]}" 2>&1)" || return_code="1"
2854 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2878 if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
2855 "$(PYTHON)" -O -m py_compile "${files[@]}" &> /dev/null || return_code="1" 2879 "$(PYTHON)" -O -m py_compile "${files[@]}" &> /dev/null || return_code="1"
2856 fi 2880 fi
2857 _python_clean_compiled_modules "${files[@]}" 2881 _python_clean_compiled_modules "${files[@]}"
2858 fi 2882 fi
2859 eend "${return_code}" 2883 eend "${return_code}"
2880 return_code="0" 2904 return_code="0"
2881 stderr="" 2905 stderr=""
2882 ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for $(python_get_implementation_and_version)" 2906 ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for $(python_get_implementation_and_version)"
2883 if ((${#other_dirs[@]})); then 2907 if ((${#other_dirs[@]})); then
2884 stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m compileall "${options[@]}" "${other_dirs[@]}" 2>&1)" || return_code="1" 2908 stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m compileall "${options[@]}" "${other_dirs[@]}" 2>&1)" || return_code="1"
2885 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2909 if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
2886 "$(PYTHON ${PYTHON_ABI})" -O -m compileall "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1" 2910 "$(PYTHON ${PYTHON_ABI})" -O -m compileall "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1"
2887 fi 2911 fi
2888 _python_clean_compiled_modules "${other_dirs[@]}" 2912 _python_clean_compiled_modules "${other_dirs[@]}"
2889 fi 2913 fi
2890 if ((${#other_files[@]})); then 2914 if ((${#other_files[@]})); then
2891 stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m py_compile "${other_files[@]}" 2>&1)" || return_code="1" 2915 stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m py_compile "${other_files[@]}" 2>&1)" || return_code="1"
2892 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then 2916 if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
2893 "$(PYTHON ${PYTHON_ABI})" -O -m py_compile "${other_files[@]}" &> /dev/null || return_code="1" 2917 "$(PYTHON ${PYTHON_ABI})" -O -m py_compile "${other_files[@]}" &> /dev/null || return_code="1"
2894 fi 2918 fi
2895 _python_clean_compiled_modules "${other_files[@]}" 2919 _python_clean_compiled_modules "${other_files[@]}"
2896 fi 2920 fi
2897 eend "${return_code}" 2921 eend "${return_code}"

Legend:
Removed from v.1.134  
changed lines
  Added in v.1.139

  ViewVC Help
Powered by ViewVC 1.1.20