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

Diff of /eclass/python.eclass

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

Revision 1.82 Revision 1.83
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2010 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.82 2009/12/23 23:43:42 arfrever Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.83 2010/01/10 17:03:08 arfrever Exp $
4 4
5# @ECLASS: python.eclass 5# @ECLASS: python.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# python@gentoo.org 7# python@gentoo.org
8# @BLURB: A utility eclass that should be inherited by anything that deals with Python or Python modules. 8# @BLURB: A utility eclass that should be inherited by anything that deals with Python or Python modules.
9# @DESCRIPTION: 9# @DESCRIPTION:
10# Some useful functions for dealing with Python. 10# Some useful functions for dealing with Python.
11 11
12inherit multilib 12inherit multilib
13
14if ! has "${EAPI:-0}" 0 1 2; then
15 die "API of python.eclass in EAPI=\"${EAPI}\" not established"
16fi
13 17
14if [[ -n "${NEED_PYTHON}" ]]; then 18if [[ -n "${NEED_PYTHON}" ]]; then
15 PYTHON_ATOM=">=dev-lang/python-${NEED_PYTHON}" 19 PYTHON_ATOM=">=dev-lang/python-${NEED_PYTHON}"
16 DEPEND="${PYTHON_ATOM}" 20 DEPEND="${PYTHON_ATOM}"
17 RDEPEND="${DEPEND}" 21 RDEPEND="${DEPEND}"
18else 22else
19 PYTHON_ATOM="dev-lang/python" 23 PYTHON_ATOM="dev-lang/python"
20fi 24fi
21 25
22DEPEND+=" >=app-admin/eselect-python-20090804 26DEPEND+=" >=app-admin/eselect-python-20090804"
23 >=app-shells/bash-3.2"
24 27
25__python_eclass_test() { 28__python_eclass_test() {
26 __python_version_extract 2.3 29 __python_version_extract 2.3
27 echo -n "2.3 -> PYVER: $PYVER PYVER_MAJOR: $PYVER_MAJOR" 30 echo -n "2.3 -> PYVER: $PYVER PYVER_MAJOR: $PYVER_MAJOR"
28 echo " PYVER_MINOR: $PYVER_MINOR PYVER_MICRO: $PYVER_MICRO" 31 echo " PYVER_MINOR: $PYVER_MINOR PYVER_MICRO: $PYVER_MICRO"
62 export PYVER_ALL="${tmpstr#Python }" 65 export PYVER_ALL="${tmpstr#Python }"
63 __python_version_extract $PYVER_ALL 66 __python_version_extract $PYVER_ALL
64} 67}
65 68
66# @FUNCTION: PYTHON 69# @FUNCTION: PYTHON
67# @USAGE: [-2] [-3] [-A|--only-ABI] [-a|--absolute-path] [-f|--final-ABI] [--] <Python_ABI="${PYTHON_ABI}"> 70# @USAGE: [-2] [-3] [--ABI] [-A|--active] [-a|--absolute-path] [-f|--final-ABI] [--] <Python_ABI="${PYTHON_ABI}">
68# @DESCRIPTION: 71# @DESCRIPTION:
69# Get Python interpreter filename for specified Python ABI. If Python_ABI argument 72# Get Python interpreter filename for specified Python ABI. If Python_ABI argument
70# is ommitted, then PYTHON_ABI environment variable must be set and is used. 73# is ommitted, then PYTHON_ABI environment variable must be set and is used.
71# If -2 option is specified, then active version of Python 2 is used. 74# If -2 option is specified, then active version of Python 2 is used.
72# If -3 option is specified, then active version of Python 3 is used. 75# If -3 option is specified, then active version of Python 3 is used.
76# If --active option is specified, then active version of Python is used.
77# Active version of Python can be set by python_set_active_version().
73# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. 78# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
74# -2, -3 and --final-ABI options and Python_ABI argument cannot be specified simultaneously. 79# -2, -3, --active and --final-ABI options and Python_ABI argument cannot be specified simultaneously.
75# If --only-ABI option is specified, then only specified Python ABI is printed instead of 80# If --ABI option is specified, then only specified Python ABI is printed instead of
76# Python interpreter filename. 81# Python interpreter filename.
77# --only-ABI and --absolute-path options cannot be specified simultaneously. 82# --ABI and --absolute-path options cannot be specified simultaneously.
78PYTHON() { 83PYTHON() {
79 local absolute_path="0" final_ABI="0" only_ABI="0" python2="0" python3="0" slot= 84 local ABI_output="0" absolute_path_output="0" active="0" final_ABI="0" python2="0" python3="0" slot=
80 85
81 while (($#)); do 86 while (($#)); do
82 case "$1" in 87 case "$1" in
83 -2) 88 -2)
84 python2="1" 89 python2="1"
85 ;; 90 ;;
86 -3) 91 -3)
87 python3="1" 92 python3="1"
88 ;; 93 ;;
89 -A|--only-ABI) 94 --ABI)
90 only_ABI="1" 95 ABI_output="1"
96 ;;
97 -A|--active)
98 active="1"
91 ;; 99 ;;
92 -a|--absolute-path) 100 -a|--absolute-path)
93 absolute_path="1" 101 absolute_path_output="1"
94 ;; 102 ;;
95 -f|--final-ABI) 103 -f|--final-ABI)
96 final_ABI="1" 104 final_ABI="1"
97 ;; 105 ;;
98 --) 106 --)
106 ;; 114 ;;
107 esac 115 esac
108 shift 116 shift
109 done 117 done
110 118
111 if [[ "${only_ABI}" == "1" && "${absolute_path}" == "1" ]]; then 119 if [[ "${ABI_output}" == "1" && "${absolute_path_output}" == "1" ]]; then
112 die "${FUNCNAME}(): '--only-ABI and '--absolute-path' options cannot be specified simultaneously" 120 die "${FUNCNAME}(): '--ABI and '--absolute-path' options cannot be specified simultaneously"
113 fi 121 fi
114 122
115 if [[ "$((${python2} + ${python3} + ${final_ABI}))" -gt "1" ]]; then 123 if [[ "$((${python2} + ${python3} + ${active} + ${final_ABI}))" -gt 1 ]]; then
116 die "${FUNCNAME}(): '-2', '-3' or '--final-ABI' options cannot be specified simultaneously" 124 die "${FUNCNAME}(): '-2', '-3', '--active' or '--final-ABI' options cannot be specified simultaneously"
117 fi 125 fi
118 126
119 if [[ "$#" -eq "0" ]]; then 127 if [[ "$#" -eq 0 ]]; then
128 if [[ "${active}" == "1" ]]; then
129 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
130 die "${FUNCNAME}(): '--active' option cannot be used in ebuilds of packages supporting installation for multiple versions of Python"
131 fi
132 slot="$(/usr/bin/python -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')"
120 if [[ "${final_ABI}" == "1" ]]; then 133 elif [[ "${final_ABI}" == "1" ]]; then
121 validate_PYTHON_ABIS 134 validate_PYTHON_ABIS
122 slot="${PYTHON_ABIS##* }" 135 slot="${PYTHON_ABIS##* }"
123 elif [[ "${python2}" == "1" ]]; then 136 elif [[ "${python2}" == "1" ]]; then
124 slot="$(eselect python show --python2)" 137 slot="$(eselect python show --python2)"
125 if [[ -z "${slot}" ]]; then 138 if [[ -z "${slot}" ]]; then
139 elif [[ -n "${PYTHON_ABI}" ]]; then 152 elif [[ -n "${PYTHON_ABI}" ]]; then
140 slot="${PYTHON_ABI}" 153 slot="${PYTHON_ABI}"
141 else 154 else
142 die "${FUNCNAME}(): Invalid usage" 155 die "${FUNCNAME}(): Invalid usage"
143 fi 156 fi
144 elif [[ "$#" -eq "1" ]]; then 157 elif [[ "$#" -eq 1 ]]; then
158 if [[ "${active}" == "1" ]]; then
159 die "${FUNCNAME}(): '--active' option and Python ABI cannot be specified simultaneously"
160 fi
145 if [[ "${final_ABI}" == "1" ]]; then 161 if [[ "${final_ABI}" == "1" ]]; then
146 die "${FUNCNAME}(): '--final-ABI' option and Python ABI cannot be specified simultaneously" 162 die "${FUNCNAME}(): '--final-ABI' option and Python ABI cannot be specified simultaneously"
147 fi 163 fi
148 if [[ "${python2}" == "1" ]]; then 164 if [[ "${python2}" == "1" ]]; then
149 die "${FUNCNAME}(): '-2' option and Python ABI cannot be specified simultaneously" 165 die "${FUNCNAME}(): '-2' option and Python ABI cannot be specified simultaneously"
154 slot="$1" 170 slot="$1"
155 else 171 else
156 die "${FUNCNAME}(): Invalid usage" 172 die "${FUNCNAME}(): Invalid usage"
157 fi 173 fi
158 174
159 if [[ "${only_ABI}" == "1" ]]; then 175 if [[ "${ABI_output}" == "1" ]]; then
160 echo -n "${slot}" 176 echo -n "${slot}"
161 return 177 return
162 elif [[ "${absolute_path}" == "1" ]]; then 178 elif [[ "${absolute_path_output}" == "1" ]]; then
163 echo -n "/usr/bin/python${slot}" 179 echo -n "/usr/bin/python${slot}"
164 else 180 else
165 echo -n "python${slot}" 181 echo -n "python${slot}"
166 fi 182 fi
167 183
216 die "${FUNCNAME}() cannot be used in this EAPI without setting SUPPORT_PYTHON_ABIS variable" 232 die "${FUNCNAME}() cannot be used in this EAPI without setting SUPPORT_PYTHON_ABIS variable"
217 fi 233 fi
218 234
219 # Ensure that /usr/bin/python and /usr/bin/python-config are valid. 235 # Ensure that /usr/bin/python and /usr/bin/python-config are valid.
220 if [[ "$(readlink /usr/bin/python)" != "python-wrapper" ]]; then 236 if [[ "$(readlink /usr/bin/python)" != "python-wrapper" ]]; then
237 eerror "'/usr/bin/python' is not valid symlink."
238 eerror "Use \`eselect python set \${python_interpreter}\` to fix this problem."
221 die "'/usr/bin/python' isn't valid symlink" 239 die "'/usr/bin/python' is not valid symlink"
222 fi 240 fi
223 if [[ "$(</usr/bin/python-config)" != *"Gentoo python-config wrapper script"* ]]; then 241 if [[ "$(</usr/bin/python-config)" != *"Gentoo python-config wrapper script"* ]]; then
242 eerror "'/usr/bin/python-config' is not valid script"
243 eerror "Use \`eselect python set \${python_interpreter}\` to fix this problem."
224 die "'/usr/bin/python-config' isn't valid script" 244 die "'/usr/bin/python-config' is not valid script"
225 fi 245 fi
226 246
227 # USE_${ABI_TYPE^^} and RESTRICT_${ABI_TYPE^^}_ABIS variables hopefully will be included in EAPI >= 5. 247 # USE_${ABI_TYPE^^} and RESTRICT_${ABI_TYPE^^}_ABIS variables hopefully will be included in EAPI >= 5.
228 if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3 4; then 248 if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3 4; then
229 local PYTHON_ABI python2_supported_versions python3_supported_versions restricted_ABI support_ABI supported_PYTHON_ABIS= 249 local PYTHON_ABI python2_supported_versions python3_supported_versions restricted_ABI support_ABI supported_PYTHON_ABIS=
392 ;; 412 ;;
393 esac 413 esac
394 shift 414 shift
395 done 415 done
396 416
397 if [[ "$#" -eq "0" ]]; then 417 if [[ "$#" -eq 0 ]]; then
398 if [[ "${WORKDIR}" == "${S}" ]]; then 418 if [[ "${WORKDIR}" == "${S}" ]]; then
399 die "${FUNCNAME}() cannot be used" 419 die "${FUNCNAME}() cannot be used"
400 fi 420 fi
401 dirs="${S}" 421 dirs="${S}"
402 else 422 else
480 if [[ -n "${source_dir}" && "${separate_build_dirs}" == 0 ]]; then 500 if [[ -n "${source_dir}" && "${separate_build_dirs}" == 0 ]]; then
481 die "${FUNCNAME}(): '--source-dir' option can be specified only with '--separate-build-dirs' option" 501 die "${FUNCNAME}(): '--source-dir' option can be specified only with '--separate-build-dirs' option"
482 fi 502 fi
483 503
484 if [[ "${default_function}" == "0" ]]; then 504 if [[ "${default_function}" == "0" ]]; then
485 if [[ "$#" -eq "0" ]]; then 505 if [[ "$#" -eq 0 ]]; then
486 die "${FUNCNAME}(): Missing function name" 506 die "${FUNCNAME}(): Missing function name"
487 fi 507 fi
488 function="$1" 508 function="$1"
489 shift 509 shift
490 510
873 die "${FUNCNAME}(): Generation of '$1' failed" 893 die "${FUNCNAME}(): Generation of '$1' failed"
874 fi 894 fi
875 fi 895 fi
876 cat << EOF >> "${file}" 896 cat << EOF >> "${file}"
877 897
898os.environ["PYTHON_PROCESS_NAME"] = sys.argv[0]
878target_executable = "%s-%s" % (sys.argv[0], PYTHON_ABI) 899target_executable = "%s-%s" % (os.path.realpath(sys.argv[0]), PYTHON_ABI)
879if not os.path.exists(target_executable): 900if not os.path.exists(target_executable):
880 sys.stderr.write("'%s' does not exist\n" % target_executable) 901 sys.stderr.write("'%s' does not exist\n" % target_executable)
881 sys.exit(1) 902 sys.exit(1)
882 903
883os.execv(target_executable, sys.argv) 904os.execv(target_executable, sys.argv)
921 python_pkg_setup_check_USE_flags() { 942 python_pkg_setup_check_USE_flags() {
922 local pyatom use 943 local pyatom use
923 if [[ -n "${PYTHON_ABI}" ]]; then 944 if [[ -n "${PYTHON_ABI}" ]]; then
924 pyatom="dev-lang/python:${PYTHON_ABI}" 945 pyatom="dev-lang/python:${PYTHON_ABI}"
925 else 946 else
926 python_version
927 pyatom="dev-lang/python:${PYVER}" 947 pyatom="dev-lang/python:$(PYTHON -A --ABI)"
928 fi 948 fi
929 949
930 for use in ${PYTHON_USE_WITH}; do 950 for use in ${PYTHON_USE_WITH}; do
931 if ! has_version "${pyatom}[${use}]"; then 951 if ! has_version "${pyatom}[${use}]"; then
932 python_pkg_setup_fail "Please rebuild ${pyatom} with the following USE flags enabled: ${PYTHON_USE_WITH}" 952 python_pkg_setup_fail "Please rebuild ${pyatom} with the following USE flags enabled: ${PYTHON_USE_WITH}"
1006 1026
1007# @FUNCTION: python_need_rebuild 1027# @FUNCTION: python_need_rebuild
1008# @DESCRIPTION: Run without arguments, specifies that the package should be 1028# @DESCRIPTION: Run without arguments, specifies that the package should be
1009# rebuilt after a python upgrade. 1029# rebuilt after a python upgrade.
1010python_need_rebuild() { 1030python_need_rebuild() {
1011 python_version 1031 export PYTHON_NEED_REBUILD="$(PYTHON -A --ABI)"
1012 export PYTHON_NEED_REBUILD=${PYVER}
1013} 1032}
1014 1033
1015# @FUNCTION: python_get_includedir 1034# @FUNCTION: python_get_includedir
1016# @DESCRIPTION: 1035# @DESCRIPTION:
1017# Run without arguments, returns the Python include directory. 1036# Run without arguments, returns the Python include directory.
1018python_get_includedir() { 1037python_get_includedir() {
1019 if [[ -n "${PYTHON_ABI}" ]]; then 1038 if [[ -n "${PYTHON_ABI}" ]]; then
1020 echo "/usr/include/python${PYTHON_ABI}" 1039 echo "/usr/include/python${PYTHON_ABI}"
1021 else 1040 else
1022 python_version
1023 echo "/usr/include/python${PYVER}" 1041 echo "/usr/include/python$(PYTHON -A --ABI)"
1024 fi 1042 fi
1025} 1043}
1026 1044
1027# @FUNCTION: python_get_libdir 1045# @FUNCTION: python_get_libdir
1028# @DESCRIPTION: 1046# @DESCRIPTION:
1029# Run without arguments, returns the Python library directory. 1047# Run without arguments, returns the Python library directory.
1030python_get_libdir() { 1048python_get_libdir() {
1031 if [[ -n "${PYTHON_ABI}" ]]; then 1049 if [[ -n "${PYTHON_ABI}" ]]; then
1032 echo "/usr/$(get_libdir)/python${PYTHON_ABI}" 1050 echo "/usr/$(get_libdir)/python${PYTHON_ABI}"
1033 else 1051 else
1034 python_version
1035 echo "/usr/$(get_libdir)/python${PYVER}" 1052 echo "/usr/$(get_libdir)/python$(PYTHON -A --ABI)"
1036 fi 1053 fi
1037} 1054}
1038 1055
1039# @FUNCTION: python_get_sitedir 1056# @FUNCTION: python_get_sitedir
1040# @DESCRIPTION: 1057# @DESCRIPTION:
1092 1109
1093 # Check if phase is pkg_postinst() 1110 # Check if phase is pkg_postinst()
1094 [[ ${EBUILD_PHASE} != postinst ]] &&\ 1111 [[ ${EBUILD_PHASE} != postinst ]] &&\
1095 die "${FUNCNAME} should only be run in pkg_postinst()" 1112 die "${FUNCNAME} should only be run in pkg_postinst()"
1096 1113
1097 if [[ -n "${PYTHON_ABI}" ]]; then
1098 PYVER="${PYTHON_ABI}"
1099 else
1100 python_version
1101 fi
1102
1103 # strip trailing slash 1114 # strip trailing slash
1104 myroot="${ROOT%/}" 1115 myroot="${ROOT%/}"
1105 1116
1106 # respect ROOT 1117 # respect ROOT
1107 for f in "$@"; do 1118 for f in "$@"; do
1108 [[ -f "${myroot}/${f}" ]] && myfiles+=("${myroot}/${f}") 1119 [[ -f "${myroot}/${f}" ]] && myfiles+=("${myroot}/${f}")
1109 done 1120 done
1110 1121
1111 if ((${#myfiles[@]})); then 1122 if ((${#myfiles[@]})); then
1112 python${PYVER} ${myroot}/usr/$(get_libdir)/python${PYVER}/py_compile.py "${myfiles[@]}" 1123 "$(PYTHON -A)" "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}"
1113 python${PYVER} -O ${myroot}/usr/$(get_libdir)/python${PYVER}/py_compile.py "${myfiles[@]}" &> /dev/null 1124 "$(PYTHON -A)" -O "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" &> /dev/null
1114 else 1125 else
1115 ewarn "No files to compile!" 1126 ewarn "No files to compile!"
1116 fi 1127 fi
1117} 1128}
1118 1129
1165 ewarn "'${root}/$1' is not a file or a directory!" 1176 ewarn "'${root}/$1' is not a file or a directory!"
1166 else 1177 else
1167 ewarn "'${root}/$1' doesn't exist!" 1178 ewarn "'${root}/$1' doesn't exist!"
1168 fi 1179 fi
1169 else 1180 else
1170 for PYTHON_ABI in ${PYTHON_ABIS}; do 1181 for PYTHON_ABI in ${PYTHON_ABIS-${PYTHON_ABI-$(PYTHON -A --ABI)}}; do
1171 if [[ -d "${root}$(python_get_sitedir)/$1" ]]; then 1182 if [[ -d "${root}$(python_get_sitedir)/$1" ]]; then
1172 site_packages_dirs+=("$1") 1183 site_packages_dirs+=("$1")
1173 break 1184 break
1174 elif [[ -f "${root}$(python_get_sitedir)/$1" ]]; then 1185 elif [[ -f "${root}$(python_get_sitedir)/$1" ]]; then
1175 site_packages_files+=("$1") 1186 site_packages_files+=("$1")
1187 done 1198 done
1188 1199
1189 # Set additional options. 1200 # Set additional options.
1190 options+=("-q") 1201 options+=("-q")
1191 1202
1192 for PYTHON_ABI in ${PYTHON_ABIS}; do 1203 for PYTHON_ABI in ${PYTHON_ABIS-${PYTHON_ABI-$(PYTHON -A --ABI)}}; do
1193 if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})); then 1204 if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})); then
1194 return_code="0" 1205 return_code="0"
1195 ebegin "Compilation and optimization of Python modules for Python ${PYTHON_ABI}" 1206 ebegin "Compilation and optimization of Python modules for Python ${PYTHON_ABI}"
1196 if ((${#site_packages_dirs[@]})); then 1207 if ((${#site_packages_dirs[@]})); then
1197 for dir in "${site_packages_dirs[@]}"; do 1208 for dir in "${site_packages_dirs[@]}"; do
1215 # Don't use PYTHON_ABI in next calls to python_get_libdir(). 1226 # Don't use PYTHON_ABI in next calls to python_get_libdir().
1216 unset PYTHON_ABI 1227 unset PYTHON_ABI
1217 1228
1218 if ((${#other_dirs[@]})) || ((${#other_files[@]})); then 1229 if ((${#other_dirs[@]})) || ((${#other_files[@]})); then
1219 return_code="0" 1230 return_code="0"
1220 ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for Python ${PYVER}" 1231 ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for Python $(PYTHON -A --ABI)"
1221 if ((${#other_dirs[@]})); then 1232 if ((${#other_dirs[@]})); then
1222 python${PYVER} "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" || return_code="1" 1233 "$(PYTHON -A)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" || return_code="1"
1223 python${PYVER} -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1" 1234 "$(PYTHON -A)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1"
1224 fi 1235 fi
1225 if ((${#other_files[@]})); then 1236 if ((${#other_files[@]})); then
1226 python${PYVER} "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" || return_code="1" 1237 "$(PYTHON -A)" "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" || return_code="1"
1227 python${PYVER} -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" &> /dev/null || return_code="1" 1238 "$(PYTHON -A)" -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" &> /dev/null || return_code="1"
1228 fi 1239 fi
1229 eend "${return_code}" 1240 eend "${return_code}"
1230 fi 1241 fi
1231 else 1242 else
1232 local myroot mydirs=() myfiles=() myopts=() return_code="0" 1243 local myroot mydirs=() myfiles=() myopts=() return_code="0"
1261 ;; 1272 ;;
1262 esac 1273 esac
1263 shift 1274 shift
1264 done 1275 done
1265 1276
1266 if [[ -n "${PYTHON_ABI}" ]]; then
1267 PYVER="${PYTHON_ABI}"
1268 else
1269 python_version
1270 fi
1271
1272 # set additional opts 1277 # set additional opts
1273 myopts+=(-q) 1278 myopts+=(-q)
1274 1279
1275 ebegin "Compilation and optimization of Python modules for Python ${PYVER}" 1280 ebegin "Compilation and optimization of Python modules for Python $(PYTHON -A --ABI)"
1276 if ((${#mydirs[@]})); then 1281 if ((${#mydirs[@]})); then
1277 python${PYVER} \ 1282 "$(PYTHON -A)" "${myroot}$(python_get_libdir)/compileall.py" "${myopts[@]}" "${mydirs[@]}" || return_code="1"
1278 "${myroot}"/usr/$(get_libdir)/python${PYVER}/compileall.py \ 1283 "$(PYTHON -A)" -O "${myroot}$(python_get_libdir)/compileall.py" "${myopts[@]}" "${mydirs[@]}" &> /dev/null || return_code="1"
1279 "${myopts[@]}" "${mydirs[@]}" || return_code="1"
1280 python${PYVER} -O \
1281 "${myroot}"/usr/$(get_libdir)/python${PYVER}/compileall.py \
1282 "${myopts[@]}" "${mydirs[@]}" &> /dev/null || return_code="1"
1283 fi 1284 fi
1284 1285
1285 if ((${#myfiles[@]})); then 1286 if ((${#myfiles[@]})); then
1286 python_mod_compile "${myfiles[@]}" 1287 python_mod_compile "${myfiles[@]}"
1287 fi 1288 fi
1316 if [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then 1317 if [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then
1317 die "${FUNCNAME} doesn't support absolute paths of directories/files in site-packages directories" 1318 die "${FUNCNAME} doesn't support absolute paths of directories/files in site-packages directories"
1318 elif [[ "$1" =~ ^/ ]]; then 1319 elif [[ "$1" =~ ^/ ]]; then
1319 SEARCH_PATH+=("${root}/${1#/}") 1320 SEARCH_PATH+=("${root}/${1#/}")
1320 else 1321 else
1321 for PYTHON_ABI in ${PYTHON_ABIS}; do 1322 for PYTHON_ABI in ${PYTHON_ABIS-${PYTHON_ABI-$(PYTHON -A --ABI)}}; do
1322 SEARCH_PATH+=("${root}$(python_get_sitedir)/$1") 1323 SEARCH_PATH+=("${root}$(python_get_sitedir)/$1")
1323 done 1324 done
1324 fi 1325 fi
1325 shift 1326 shift
1326 done 1327 done

Legend:
Removed from v.1.82  
changed lines
  Added in v.1.83

  ViewVC Help
Powered by ViewVC 1.1.20