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

Diff of /eclass/python.eclass

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

Revision 1.112 Revision 1.116
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.112 2011/07/04 10:50:28 djc Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.116 2011/07/04 11:27:53 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
23# ================================================================================================ 23# ================================================================================================
24# ===================================== HANDLING OF METADATA ===================================== 24# ===================================== HANDLING OF METADATA =====================================
25# ================================================================================================ 25# ================================================================================================
26 26
27_python_check_python_abi_matching() { 27_python_check_python_abi_matching() {
28 local pattern patterns patterns_list="0" PYTHON_ABI
29
30 while (($#)); do
31 case "$1" in
32 --patterns-list)
33 patterns_list="1"
34 ;;
35 --)
36 shift
37 break
38 ;;
39 -*)
40 die "${FUNCNAME}(): Unrecognized option '$1'"
41 ;;
42 *)
43 break
44 ;;
45 esac
46 shift
47 done
48
28 if [[ "$#" -ne 2 ]]; then 49 if [[ "$#" -ne 2 ]]; then
29 die "${FUNCNAME}() requires 2 arguments" 50 die "${FUNCNAME}() requires 2 arguments"
30 fi 51 fi
31 52
53 PYTHON_ABI="$1"
54
55 if [[ "${patterns_list}" == "0" ]]; then
56 pattern="$2"
57
32 if [[ "$2" == *"-cpython" ]]; then 58 if [[ "${pattern}" == *"-cpython" ]]; then
33 [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+$ && "$1" == ${2%-cpython} ]] 59 [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+$ && "${PYTHON_ABI}" == ${pattern%-cpython} ]]
34 elif [[ "$2" == *"-jython" ]]; then 60 elif [[ "${pattern}" == *"-jython" ]]; then
35 [[ "$1" == $2 ]] 61 [[ "${PYTHON_ABI}" == ${pattern} ]]
36 else
37 if [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then
38 [[ "$1" == $2 ]]
39 elif [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then
40 [[ "${1%-jython}" == $2 ]]
41 else 62 else
63 if [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then
64 [[ "${PYTHON_ABI}" == ${pattern} ]]
65 elif [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then
66 [[ "${PYTHON_ABI%-jython}" == ${pattern} ]]
67 else
42 die "${FUNCNAME}(): Unrecognized Python ABI '$1'" 68 die "${FUNCNAME}(): Unrecognized Python ABI '${PYTHON_ABI}'"
43 fi 69 fi
70 fi
71 else
72 patterns="${2// /$'\n'}"
73
74 while read pattern; do
75 if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
76 return 0
77 fi
78 done <<< "${patterns}"
79
80 return 1
44 fi 81 fi
45} 82}
46 83
47# @ECLASS-VARIABLE: PYTHON_DEPEND 84# @ECLASS-VARIABLE: PYTHON_DEPEND
48# @DESCRIPTION: 85# @DESCRIPTION:
358# @DESCRIPTION: 395# @DESCRIPTION:
359# Perform sanity checks and initialize environment. 396# Perform sanity checks and initialize environment.
360# 397#
361# This function is exported in EAPI 2 and 3 when PYTHON_USE_WITH or PYTHON_USE_WITH_OR variable 398# This function is exported in EAPI 2 and 3 when PYTHON_USE_WITH or PYTHON_USE_WITH_OR variable
362# is set and always in EAPI >=4. Calling of this function is mandatory in EAPI >=4. 399# is set and always in EAPI >=4. Calling of this function is mandatory in EAPI >=4.
363#
364# This function can be used only in pkg_setup() phase.
365python_pkg_setup() { 400python_pkg_setup() {
366 # Check if phase is pkg_setup(). 401 if [[ "${EBUILD_PHASE}" != "setup" ]]; then
367 [[ "${EBUILD_PHASE}" != "setup" ]] && die "${FUNCNAME}() can be used only in pkg_setup() phase" 402 die "${FUNCNAME}() can be used only in pkg_setup() phase"
403 fi
368 404
369 if [[ "$#" -ne 0 ]]; then 405 if [[ "$#" -ne 0 ]]; then
370 die "${FUNCNAME}() does not accept arguments" 406 die "${FUNCNAME}() does not accept arguments"
371 fi 407 fi
372 408
513 549
514# @FUNCTION: python_clean_installation_image 550# @FUNCTION: python_clean_installation_image
515# @USAGE: [-q|--quiet] 551# @USAGE: [-q|--quiet]
516# @DESCRIPTION: 552# @DESCRIPTION:
517# Delete needless files in installation image. 553# Delete needless files in installation image.
554#
555# This function can be used only in src_install() phase.
518python_clean_installation_image() { 556python_clean_installation_image() {
557 if [[ "${EBUILD_PHASE}" != "install" ]]; then
558 die "${FUNCNAME}() can be used only in src_install() phase"
559 fi
560
519 _python_check_python_pkg_setup_execution 561 _python_check_python_pkg_setup_execution
520 _python_initialize_prefix_variables 562 _python_initialize_prefix_variables
521 563
522 local file files=() quiet="0" 564 local file files=() quiet="0"
523
524 # Check if phase is src_install().
525 [[ "${EBUILD_PHASE}" != "install" ]] && die "${FUNCNAME}() can be used only in src_install() phase"
526 565
527 while (($#)); do 566 while (($#)); do
528 case "$1" in 567 case "$1" in
529 -q|--quiet) 568 -q|--quiet)
530 quiet="1" 569 quiet="1"
581# @ECLASS-VARIABLE: SUPPORT_PYTHON_ABIS 620# @ECLASS-VARIABLE: SUPPORT_PYTHON_ABIS
582# @DESCRIPTION: 621# @DESCRIPTION:
583# Set this in EAPI <= 4 to indicate that current package supports installation for 622# Set this in EAPI <= 4 to indicate that current package supports installation for
584# multiple Python ABIs. 623# multiple Python ABIs.
585 624
625# @ECLASS-VARIABLE: PYTHON_TESTS_RESTRICTED_ABIS
626# @DESCRIPTION:
627# Space-separated list of Python ABI patterns. Testing in Python ABIs matching any Python ABI
628# patterns specified in this list is skipped.
629
586# @ECLASS-VARIABLE: PYTHON_EXPORT_PHASE_FUNCTIONS 630# @ECLASS-VARIABLE: PYTHON_EXPORT_PHASE_FUNCTIONS
587# @DESCRIPTION: 631# @DESCRIPTION:
588# Set this to export phase functions for the following ebuild phases: 632# Set this to export phase functions for the following ebuild phases:
589# src_prepare, src_configure, src_compile, src_test, src_install. 633# src_prepare(), src_configure(), src_compile(), src_test(), src_install().
590if ! has "${EAPI:-0}" 0 1; then 634if ! has "${EAPI:-0}" 0 1; then
591 python_src_prepare() { 635 python_src_prepare() {
592 _python_check_python_pkg_setup_execution 636 if [[ "${EBUILD_PHASE}" != "prepare" ]]; then
637 die "${FUNCNAME}() can be used only in src_prepare() phase"
638 fi
593 639
594 if ! _python_package_supporting_installation_for_multiple_python_abis; then 640 if ! _python_package_supporting_installation_for_multiple_python_abis; then
595 die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" 641 die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
596 fi 642 fi
597 643
644 _python_check_python_pkg_setup_execution
645
598 if [[ "$#" -ne 0 ]]; then 646 if [[ "$#" -ne 0 ]]; then
599 die "${FUNCNAME}() does not accept arguments" 647 die "${FUNCNAME}() does not accept arguments"
600 fi 648 fi
601 649
602 python_copy_sources 650 python_copy_sources
603 } 651 }
604 652
605 for python_default_function in src_configure src_compile src_test src_install; do 653 for python_default_function in src_configure src_compile src_test; do
606 eval "python_${python_default_function}() { 654 eval "python_${python_default_function}() {
607 _python_check_python_pkg_setup_execution 655 if [[ \"\${EBUILD_PHASE}\" != \"${python_default_function#src_}\" ]]; then
656 die \"\${FUNCNAME}() can be used only in ${python_default_function}() phase\"
657 fi
608 658
609 if ! _python_package_supporting_installation_for_multiple_python_abis; then 659 if ! _python_package_supporting_installation_for_multiple_python_abis; then
610 die \"\${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs\" 660 die \"\${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs\"
611 fi 661 fi
612 662
663 _python_check_python_pkg_setup_execution
664
613 python_execute_function -d -s -- \"\$@\" 665 python_execute_function -d -s -- \"\$@\"
614 }" 666 }"
615 done 667 done
616 unset python_default_function 668 unset python_default_function
669
670 python_src_install() {
671 if [[ "${EBUILD_PHASE}" != "install" ]]; then
672 die "${FUNCNAME}() can be used only in src_install() phase"
673 fi
674
675 if ! _python_package_supporting_installation_for_multiple_python_abis; then
676 die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
677 fi
678
679 _python_check_python_pkg_setup_execution
680
681 if has "${EAPI:-0}" 0 1 2 3; then
682 python_execute_function -d -s -- "$@"
683 else
684 python_installation() {
685 emake DESTDIR="${T}/images/${PYTHON_ABI}" install "$@"
686 }
687 python_execute_function -s python_installation "$@"
688 unset python_installation
689
690 python_merge_intermediate_installation_images "${T}/images"
691 fi
692 }
617 693
618 if [[ -n "${PYTHON_EXPORT_PHASE_FUNCTIONS}" ]]; then 694 if [[ -n "${PYTHON_EXPORT_PHASE_FUNCTIONS}" ]]; then
619 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install 695 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
620 fi 696 fi
621fi 697fi
668 744
669 if [[ "${cpython_enabled}" == "0" ]]; then 745 if [[ "${cpython_enabled}" == "0" ]]; then
670 die "USE_PYTHON variable does not enable any CPython ABI" 746 die "USE_PYTHON variable does not enable any CPython ABI"
671 fi 747 fi
672 else 748 else
673 local python_version python2_version= python3_version= support_python_major_version 749 local python_version python2_version python3_version support_python_major_version
674 750
675 if ! has_version "dev-lang/python"; then 751 if ! has_version "dev-lang/python"; then
676 die "${FUNCNAME}(): 'dev-lang/python' is not installed" 752 die "${FUNCNAME}(): 'dev-lang/python' is not installed"
677 fi 753 fi
678 754
808# @USAGE: [--action-message message] [-d|--default-function] [--failure-message message] [-f|--final-ABI] [--nonfatal] [-q|--quiet] [-s|--separate-build-dirs] [--source-dir source_directory] [--] <function> [arguments] 884# @USAGE: [--action-message message] [-d|--default-function] [--failure-message message] [-f|--final-ABI] [--nonfatal] [-q|--quiet] [-s|--separate-build-dirs] [--source-dir source_directory] [--] <function> [arguments]
809# @DESCRIPTION: 885# @DESCRIPTION:
810# Execute specified function for each value of PYTHON_ABIS, optionally passing additional 886# Execute specified function for each value of PYTHON_ABIS, optionally passing additional
811# arguments. The specified function can use PYTHON_ABI and BUILDDIR variables. 887# arguments. The specified function can use PYTHON_ABI and BUILDDIR variables.
812python_execute_function() { 888python_execute_function() {
813 _python_check_python_pkg_setup_execution
814
815 if ! _python_package_supporting_installation_for_multiple_python_abis; then 889 if ! _python_package_supporting_installation_for_multiple_python_abis; then
816 die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" 890 die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
817 fi 891 fi
818 892
893 _python_check_python_pkg_setup_execution
819 _python_set_color_variables 894 _python_set_color_variables
820 895
821 local action action_message action_message_template= default_function="0" failure_message failure_message_template= final_ABI="0" function iterated_PYTHON_ABIS nonfatal="0" previous_directory previous_directory_stack previous_directory_stack_length PYTHON_ABI quiet="0" return_code separate_build_dirs="0" source_dir= 896 local action action_message action_message_template default_function="0" failure_message failure_message_template final_ABI="0" function iterated_PYTHON_ABIS nonfatal="0" previous_directory previous_directory_stack previous_directory_stack_length PYTHON_ABI quiet="0" return_code separate_build_dirs="0" source_dir
822 897
823 while (($#)); do 898 while (($#)); do
824 case "$1" in 899 case "$1" in
825 --action-message) 900 --action-message)
826 action_message_template="$2" 901 action_message_template="$2"
938 iterated_PYTHON_ABIS="$(PYTHON -f --ABI)" 1013 iterated_PYTHON_ABIS="$(PYTHON -f --ABI)"
939 else 1014 else
940 iterated_PYTHON_ABIS="${PYTHON_ABIS}" 1015 iterated_PYTHON_ABIS="${PYTHON_ABIS}"
941 fi 1016 fi
942 for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do 1017 for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
1018 if [[ "${EBUILD_PHASE}" == "test" ]] && _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${PYTHON_TESTS_RESTRICTED_ABIS}"; then
1019 if [[ "${quiet}" == "0" ]]; then
1020 echo " ${_GREEN}*${_NORMAL} ${_BLUE}Testing of ${CATEGORY}/${PF} with $(python_get_implementation) $(python_get_version) skipped${_NORMAL}"
1021 fi
1022 continue
1023 fi
1024
943 _python_prepare_flags 1025 _python_prepare_flags
944 1026
945 if [[ "${quiet}" == "0" ]]; then 1027 if [[ "${quiet}" == "0" ]]; then
946 if [[ -n "${action_message_template}" ]]; then 1028 if [[ -n "${action_message_template}" ]]; then
947 eval "action_message=\"${action_message_template}\"" 1029 eval "action_message=\"${action_message_template}\""
1041# @FUNCTION: python_copy_sources 1123# @FUNCTION: python_copy_sources
1042# @USAGE: <directory="${S}"> [directory] 1124# @USAGE: <directory="${S}"> [directory]
1043# @DESCRIPTION: 1125# @DESCRIPTION:
1044# Copy unpacked sources of current package to separate build directory for each Python ABI. 1126# Copy unpacked sources of current package to separate build directory for each Python ABI.
1045python_copy_sources() { 1127python_copy_sources() {
1046 _python_check_python_pkg_setup_execution
1047
1048 if ! _python_package_supporting_installation_for_multiple_python_abis; then 1128 if ! _python_package_supporting_installation_for_multiple_python_abis; then
1049 die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" 1129 die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
1050 fi 1130 fi
1131
1132 _python_check_python_pkg_setup_execution
1051 1133
1052 local dir dirs=() PYTHON_ABI 1134 local dir dirs=() PYTHON_ABI
1053 1135
1054 if [[ "$#" -eq 0 ]]; then 1136 if [[ "$#" -eq 0 ]]; then
1055 if [[ "${WORKDIR}" == "${S}" ]]; then 1137 if [[ "${WORKDIR}" == "${S}" ]]; then
1072# @USAGE: [-E|--respect-EPYTHON] [-f|--force] [-q|--quiet] [--] <file> [files] 1154# @USAGE: [-E|--respect-EPYTHON] [-f|--force] [-q|--quiet] [--] <file> [files]
1073# @DESCRIPTION: 1155# @DESCRIPTION:
1074# Generate wrapper scripts. Existing files are overwritten only with --force option. 1156# Generate wrapper scripts. Existing files are overwritten only with --force option.
1075# If --respect-EPYTHON option is specified, then generated wrapper scripts will 1157# If --respect-EPYTHON option is specified, then generated wrapper scripts will
1076# respect EPYTHON variable at run time. 1158# respect EPYTHON variable at run time.
1159#
1160# This function can be used only in src_install() phase.
1077python_generate_wrapper_scripts() { 1161python_generate_wrapper_scripts() {
1078 _python_check_python_pkg_setup_execution 1162 if [[ "${EBUILD_PHASE}" != "install" ]]; then
1163 die "${FUNCNAME}() can be used only in src_install() phase"
1164 fi
1079 1165
1080 if ! _python_package_supporting_installation_for_multiple_python_abis; then 1166 if ! _python_package_supporting_installation_for_multiple_python_abis; then
1081 die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" 1167 die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
1082 fi 1168 fi
1083 1169
1170 _python_check_python_pkg_setup_execution
1084 _python_initialize_prefix_variables 1171 _python_initialize_prefix_variables
1085 1172
1086 local eselect_python_option file force="0" quiet="0" PYTHON_ABI PYTHON_ABIS_list python2_enabled="0" python3_enabled="0" respect_EPYTHON="0" 1173 local eselect_python_option file force="0" quiet="0" PYTHON_ABI PYTHON_ABIS_list python2_enabled="0" python3_enabled="0" respect_EPYTHON="0"
1087 1174
1088 while (($#)); do 1175 while (($#)); do
1319 1406
1320# @FUNCTION: python_merge_intermediate_installation_images 1407# @FUNCTION: python_merge_intermediate_installation_images
1321# @USAGE: [-q|--quiet] [--] <intermediate_installation_images_directory> 1408# @USAGE: [-q|--quiet] [--] <intermediate_installation_images_directory>
1322# @DESCRIPTION: 1409# @DESCRIPTION:
1323# Merge intermediate installation images into installation image. 1410# Merge intermediate installation images into installation image.
1411#
1412# This function can be used only in src_install() phase.
1324python_merge_intermediate_installation_images() { 1413python_merge_intermediate_installation_images() {
1414 if [[ "${EBUILD_PHASE}" != "install" ]]; then
1415 die "${FUNCNAME}() can be used only in src_install() phase"
1416 fi
1417
1418 if ! _python_package_supporting_installation_for_multiple_python_abis; then
1419 die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
1420 fi
1421
1325 _python_check_python_pkg_setup_execution 1422 _python_check_python_pkg_setup_execution
1326 _python_initialize_prefix_variables 1423 _python_initialize_prefix_variables
1327 1424
1328 local b file files=() intermediate_installation_images_directory PYTHON_ABI quiet="0" regex shebang version_executable wrapper_scripts=() wrapper_scripts_set=() 1425 local b file files=() intermediate_installation_images_directory PYTHON_ABI quiet="0" regex shebang version_executable wrapper_scripts=() wrapper_scripts_set=()
1329
1330 # Check if phase is src_install().
1331 [[ "${EBUILD_PHASE}" != "install" ]] && die "${FUNCNAME}() can be used only in src_install() phase"
1332 1426
1333 while (($#)); do 1427 while (($#)); do
1334 case "$1" in 1428 case "$1" in
1335 -q|--quiet) 1429 -q|--quiet)
1336 quiet="1" 1430 quiet="1"
1502# If 2 argument is specified, then active version of CPython 2 is used. 1596# If 2 argument is specified, then active version of CPython 2 is used.
1503# If 3 argument is specified, then active version of CPython 3 is used. 1597# If 3 argument is specified, then active version of CPython 3 is used.
1504# 1598#
1505# This function can be used only in pkg_setup() phase. 1599# This function can be used only in pkg_setup() phase.
1506python_set_active_version() { 1600python_set_active_version() {
1507 # Check if phase is pkg_setup(). 1601 if [[ "${EBUILD_PHASE}" != "setup" ]]; then
1508 [[ "${EBUILD_PHASE}" != "setup" ]] && die "${FUNCNAME}() can be used only in pkg_setup() phase" 1602 die "${FUNCNAME}() can be used only in pkg_setup() phase"
1603 fi
1509 1604
1510 if _python_package_supporting_installation_for_multiple_python_abis; then 1605 if _python_package_supporting_installation_for_multiple_python_abis; then
1511 die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple Python ABIs" 1606 die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
1512 fi 1607 fi
1513 1608
1553 1648
1554# @FUNCTION: python_need_rebuild 1649# @FUNCTION: python_need_rebuild
1555# @DESCRIPTION: Mark current package for rebuilding by python-updater after 1650# @DESCRIPTION: Mark current package for rebuilding by python-updater after
1556# switching of active version of Python. 1651# switching of active version of Python.
1557python_need_rebuild() { 1652python_need_rebuild() {
1558 _python_check_python_pkg_setup_execution
1559
1560 if _python_package_supporting_installation_for_multiple_python_abis; then 1653 if _python_package_supporting_installation_for_multiple_python_abis; then
1561 die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple Python ABIs" 1654 die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
1562 fi 1655 fi
1656
1657 _python_check_python_pkg_setup_execution
1563 1658
1564 if [[ "$#" -ne 0 ]]; then 1659 if [[ "$#" -ne 0 ]]; then
1565 die "${FUNCNAME}() does not accept arguments" 1660 die "${FUNCNAME}() does not accept arguments"
1566 fi 1661 fi
1567 1662
2162# python_execute_nosetests_pre_hook() and python_execute_nosetests_post_hook(), if they are defined. 2257# python_execute_nosetests_pre_hook() and python_execute_nosetests_post_hook(), if they are defined.
2163python_execute_nosetests() { 2258python_execute_nosetests() {
2164 _python_check_python_pkg_setup_execution 2259 _python_check_python_pkg_setup_execution
2165 _python_set_color_variables 2260 _python_set_color_variables
2166 2261
2167 local PYTHONPATH_template= separate_build_dirs= 2262 local PYTHONPATH_template separate_build_dirs
2168 2263
2169 while (($#)); do 2264 while (($#)); do
2170 case "$1" in 2265 case "$1" in
2171 -P|--PYTHONPATH) 2266 -P|--PYTHONPATH)
2172 PYTHONPATH_template="$2" 2267 PYTHONPATH_template="$2"
2226# python_execute_py.test_pre_hook() and python_execute_py.test_post_hook(), if they are defined. 2321# python_execute_py.test_pre_hook() and python_execute_py.test_post_hook(), if they are defined.
2227python_execute_py.test() { 2322python_execute_py.test() {
2228 _python_check_python_pkg_setup_execution 2323 _python_check_python_pkg_setup_execution
2229 _python_set_color_variables 2324 _python_set_color_variables
2230 2325
2231 local PYTHONPATH_template= separate_build_dirs= 2326 local PYTHONPATH_template separate_build_dirs
2232 2327
2233 while (($#)); do 2328 while (($#)); do
2234 case "$1" in 2329 case "$1" in
2235 -P|--PYTHONPATH) 2330 -P|--PYTHONPATH)
2236 PYTHONPATH_template="$2" 2331 PYTHONPATH_template="$2"
2290# calls python_execute_trial_pre_hook() and python_execute_trial_post_hook(), if they are defined. 2385# calls python_execute_trial_pre_hook() and python_execute_trial_post_hook(), if they are defined.
2291python_execute_trial() { 2386python_execute_trial() {
2292 _python_check_python_pkg_setup_execution 2387 _python_check_python_pkg_setup_execution
2293 _python_set_color_variables 2388 _python_set_color_variables
2294 2389
2295 local PYTHONPATH_template= separate_build_dirs= 2390 local PYTHONPATH_template separate_build_dirs
2296 2391
2297 while (($#)); do 2392 while (($#)); do
2298 case "$1" in 2393 case "$1" in
2299 -P|--PYTHONPATH) 2394 -P|--PYTHONPATH)
2300 PYTHONPATH_template="$2" 2395 PYTHONPATH_template="$2"
2475# Byte-compile specified Python modules. 2570# Byte-compile specified Python modules.
2476# -d, -f, -l, -q and -x options passed to this function are passed to compileall.py. 2571# -d, -f, -l, -q and -x options passed to this function are passed to compileall.py.
2477# 2572#
2478# This function can be used only in pkg_postinst() phase. 2573# This function can be used only in pkg_postinst() phase.
2479python_mod_optimize() { 2574python_mod_optimize() {
2575 if [[ "${EBUILD_PHASE}" != "postinst" ]]; then
2576 die "${FUNCNAME}() can be used only in pkg_postinst() phase"
2577 fi
2578
2480 _python_check_python_pkg_setup_execution 2579 _python_check_python_pkg_setup_execution
2481 _python_initialize_prefix_variables 2580 _python_initialize_prefix_variables
2482
2483 # Check if phase is pkg_postinst().
2484 [[ "${EBUILD_PHASE}" != "postinst" ]] && die "${FUNCNAME}() can be used only in pkg_postinst() phase"
2485 2581
2486 if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then 2582 if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then
2487 # PYTHON_ABI variable cannot be local in packages not supporting installation for multiple Python ABIs. 2583 # PYTHON_ABI variable cannot be local in packages not supporting installation for multiple Python ABIs.
2488 local allow_evaluated_non_sitedir_paths="0" dir dirs=() evaluated_dirs=() evaluated_files=() file files=() iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_dirs=() site_packages_files=() 2584 local allow_evaluated_non_sitedir_paths="0" dir dirs=() evaluated_dirs=() evaluated_files=() file files=() iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_dirs=() site_packages_files=()
2489 2585
2734# @DESCRIPTION: 2830# @DESCRIPTION:
2735# Delete orphaned byte-compiled Python modules corresponding to specified Python modules. 2831# Delete orphaned byte-compiled Python modules corresponding to specified Python modules.
2736# 2832#
2737# This function can be used only in pkg_postrm() phase. 2833# This function can be used only in pkg_postrm() phase.
2738python_mod_cleanup() { 2834python_mod_cleanup() {
2835 if [[ "${EBUILD_PHASE}" != "postrm" ]]; then
2836 die "${FUNCNAME}() can be used only in pkg_postrm() phase"
2837 fi
2838
2739 _python_check_python_pkg_setup_execution 2839 _python_check_python_pkg_setup_execution
2740 _python_initialize_prefix_variables 2840 _python_initialize_prefix_variables
2741 2841
2742 local allow_evaluated_non_sitedir_paths="0" dir iterated_PYTHON_ABIS PYTHON_ABI="${PYTHON_ABI}" root search_paths=() sitedir 2842 local allow_evaluated_non_sitedir_paths="0" dir iterated_PYTHON_ABIS PYTHON_ABI="${PYTHON_ABI}" root search_paths=() sitedir
2743
2744 # Check if phase is pkg_postrm().
2745 [[ "${EBUILD_PHASE}" != "postrm" ]] && die "${FUNCNAME}() can be used only in pkg_postrm() phase"
2746 2843
2747 if _python_package_supporting_installation_for_multiple_python_abis; then 2844 if _python_package_supporting_installation_for_multiple_python_abis; then
2748 if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then 2845 if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then
2749 die "${FUNCNAME}(): python_pkg_setup() or python_execute_function() not called" 2846 die "${FUNCNAME}(): python_pkg_setup() or python_execute_function() not called"
2750 fi 2847 fi

Legend:
Removed from v.1.112  
changed lines
  Added in v.1.116

  ViewVC Help
Powered by ViewVC 1.1.20