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

Contents of /eclass/distutils.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.85 - (hide annotations) (download)
Thu Nov 20 15:32:09 2014 UTC (4 weeks, 2 days ago) by mgorny
Branch: MAIN
CVS Tags: HEAD
Changes since 1.84: +4 -2 lines
Deprecate the few eclasses.

1 mgorny 1.85 # Copyright 1999-2014 Gentoo Foundation
2 vapier 1.4 # Distributed under the terms of the GNU General Public License v2
3 mgorny 1.85 # $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.84 2013/08/03 13:28:22 patrick Exp $
4 dev-zero 1.46
5     # @ECLASS: distutils.eclass
6     # @MAINTAINER:
7 arfrever 1.70 # Gentoo Python Project <python@gentoo.org>
8     # @BLURB: Eclass for packages with build systems using Distutils
9 dev-zero 1.46 # @DESCRIPTION:
10 arfrever 1.73 # The distutils eclass defines phase functions for packages with build systems using Distutils.
11 mgorny 1.85 #
12     # This eclass is DEPRECATED. Please use distutils-r1 instead.
13 jnelson 1.1
14 floppym 1.81 if [[ -z "${_PYTHON_ECLASS_INHERITED}" ]]; then
15     inherit python
16     fi
17    
18     inherit multilib
19 liquidx 1.16
20 pva 1.55 case "${EAPI:-0}" in
21     0|1)
22     EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm
23     ;;
24     *)
25 arfrever 1.73 EXPORT_FUNCTIONS src_prepare src_compile src_install pkg_postinst pkg_postrm
26 pva 1.55 ;;
27     esac
28    
29 arfrever 1.74 if [[ -z "$(declare -p PYTHON_DEPEND 2> /dev/null)" ]]; then
30 arfrever 1.73 DEPEND="dev-lang/python"
31 arfrever 1.62 RDEPEND="${DEPEND}"
32     fi
33 arfrever 1.68
34 arfrever 1.79 if has "${EAPI:-0}" 0 1 && [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
35     ewarn
36     ewarn "\"${EBUILD}\":"
37     ewarn "Deprecation Warning: Usage of distutils.eclass in packages supporting installation"
38 patrick 1.83 ewarn "for multiple Python ABIs in EAPI <=1 is deprecated."
39     ewarn "The ebuild should to be fixed. Please report a bug, if it has not been already reported."
40 arfrever 1.79 ewarn
41     elif has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
42     ewarn
43     ewarn "\"${EBUILD}\":"
44     ewarn "Deprecation Warning: Usage of distutils.eclass in packages not supporting installation"
45 patrick 1.83 ewarn "for multiple Python ABIs in EAPI <=2 is deprecated."
46     ewarn "The ebuild should to be fixed. Please report a bug, if it has not been already reported."
47 arfrever 1.79 ewarn
48     fi
49    
50 arfrever 1.74 # 'python' variable is deprecated. Use PYTHON() instead.
51 arfrever 1.73 if has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
52 arfrever 1.68 python="python"
53     else
54     python="die"
55     fi
56 arfrever 1.60
57 arfrever 1.61 # @ECLASS-VARIABLE: DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES
58     # @DESCRIPTION:
59     # Set this to use separate source directories for each enabled version of Python.
60    
61 arfrever 1.76 # @ECLASS-VARIABLE: DISTUTILS_SETUP_FILES
62     # @DESCRIPTION:
63 arfrever 1.80 # Array of paths to setup files.
64     # Syntax:
65     # [current_working_directory|]path_to_setup_file
66 arfrever 1.76
67 arfrever 1.60 # @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS
68 dev-zero 1.46 # @DESCRIPTION:
69 arfrever 1.80 # Array of global options passed to setup files.
70     # Syntax in EAPI <4:
71     # global_option
72     # Syntax in EAPI >=4:
73     # Python_ABI_pattern global_option
74 jnelson 1.1
75 arfrever 1.70 # @ECLASS-VARIABLE: DISTUTILS_SRC_TEST
76     # @DESCRIPTION:
77     # Type of test command used by distutils_src_test().
78     # IUSE and DEPEND are automatically adjusted, unless DISTUTILS_DISABLE_TEST_DEPENDENCY is set.
79     # Valid values:
80     # setup.py
81     # nosetests
82     # py.test
83     # trial [arguments]
84    
85     # @ECLASS-VARIABLE: DISTUTILS_DISABLE_TEST_DEPENDENCY
86     # @DESCRIPTION:
87     # Disable modification of IUSE and DEPEND caused by setting of DISTUTILS_SRC_TEST.
88    
89     if [[ -n "${DISTUTILS_SRC_TEST}" && ! "${DISTUTILS_SRC_TEST}" =~ ^(setup\.py|nosetests|py\.test|trial(\ .*)?)$ ]]; then
90     die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'"
91     fi
92    
93     if [[ -z "${DISTUTILS_DISABLE_TEST_DEPENDENCY}" ]]; then
94     if [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
95     IUSE="test"
96     DEPEND+="${DEPEND:+ }test? ( dev-python/nose )"
97     elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
98     IUSE="test"
99 arfrever 1.78 DEPEND+="${DEPEND:+ }test? ( dev-python/pytest )"
100 arfrever 1.70 # trial requires an argument, which is usually equal to "${PN}".
101     elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
102     IUSE="test"
103 patrick 1.84 DEPEND+="${DEPEND:+ }test? ( dev-python/twisted-core )"
104 arfrever 1.70 fi
105     fi
106    
107     if [[ -n "${DISTUTILS_SRC_TEST}" ]]; then
108     EXPORT_FUNCTIONS src_test
109     fi
110    
111 arfrever 1.80 # Scheduled for deletion on 2011-06-01.
112 arfrever 1.79 if [[ -n "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" ]]; then
113 arfrever 1.80 eerror "Use PYTHON_NONVERSIONED_EXECUTABLES=(\".*\") instead of DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable."
114     die "DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable is banned"
115 arfrever 1.79 fi
116 arfrever 1.73
117 dev-zero 1.46 # @ECLASS-VARIABLE: DOCS
118     # @DESCRIPTION:
119 arfrever 1.70 # Additional documentation files installed by distutils_src_install().
120    
121     _distutils_get_build_dir() {
122 arfrever 1.77 if _python_package_supporting_installation_for_multiple_python_abis && [[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
123 arfrever 1.70 echo "build-${PYTHON_ABI}"
124     else
125     echo "build"
126     fi
127     }
128    
129     _distutils_get_PYTHONPATH() {
130 arfrever 1.77 if _python_package_supporting_installation_for_multiple_python_abis && [[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
131 arfrever 1.70 ls -d build-${PYTHON_ABI}/lib* 2> /dev/null
132     else
133     ls -d build/lib* 2> /dev/null
134     fi
135     }
136 dev-zero 1.46
137 arfrever 1.67 _distutils_hook() {
138     if [[ "$#" -ne 1 ]]; then
139     die "${FUNCNAME}() requires 1 argument"
140     fi
141     if [[ "$(type -t "distutils_src_${EBUILD_PHASE}_$1_hook")" == "function" ]]; then
142     "distutils_src_${EBUILD_PHASE}_$1_hook"
143     fi
144     }
145    
146 arfrever 1.80 _distutils_prepare_global_options() {
147     local element option pattern
148    
149     if [[ -n "$(declare -p DISTUTILS_GLOBAL_OPTIONS 2> /dev/null)" && "$(declare -p DISTUTILS_GLOBAL_OPTIONS)" != "declare -a DISTUTILS_GLOBAL_OPTIONS="* ]]; then
150     die "DISTUTILS_GLOBAL_OPTIONS should be indexed array"
151     fi
152    
153     if has "${EAPI:-0}" 0 1 2 3; then
154     _DISTUTILS_GLOBAL_OPTIONS=("${DISTUTILS_GLOBAL_OPTIONS[@]}")
155     else
156     _DISTUTILS_GLOBAL_OPTIONS=()
157    
158     for element in "${DISTUTILS_GLOBAL_OPTIONS[@]}"; do
159     if [[ ! "${element}" =~ ^[^[:space:]]+\ . ]]; then
160     die "Element '${element}' of DISTUTILS_GLOBAL_OPTIONS array has invalid syntax"
161     fi
162     pattern="${element%% *}"
163     option="${element#* }"
164     if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
165     _DISTUTILS_GLOBAL_OPTIONS+=("${option}")
166     fi
167     done
168     fi
169     }
170    
171     _distutils_prepare_current_working_directory() {
172     if [[ "$1" == *"|"*"|"* ]]; then
173     die "Element '$1' of DISTUTILS_SETUP_FILES array has invalid syntax"
174     fi
175    
176     if [[ "$1" == *"|"* ]]; then
177     echo "${_BOLD}[${1%|*}]${_NORMAL}"
178     pushd "${1%|*}" > /dev/null || die "Entering directory '${1%|*}' failed"
179     fi
180     }
181    
182     _distutils_restore_current_working_directory() {
183     if [[ "$1" == *"|"* ]]; then
184     popd > /dev/null || die "Leaving directory '${1%|*}' failed"
185     fi
186     }
187    
188 dev-zero 1.46 # @FUNCTION: distutils_src_unpack
189     # @DESCRIPTION:
190 arfrever 1.70 # The distutils src_unpack function. This function is exported.
191 lucass 1.41 distutils_src_unpack() {
192 arfrever 1.73 if ! has "${EAPI:-0}" 0 1; then
193     die "${FUNCNAME}() cannot be used in this EAPI"
194     fi
195    
196 arfrever 1.59 if [[ "${EBUILD_PHASE}" != "unpack" ]]; then
197     die "${FUNCNAME}() can be used only in src_unpack() phase"
198     fi
199    
200 lucass 1.41 unpack ${A}
201     cd "${S}"
202    
203 arfrever 1.73 distutils_src_prepare
204 pva 1.55 }
205    
206     # @FUNCTION: distutils_src_prepare
207     # @DESCRIPTION:
208 arfrever 1.70 # The distutils src_prepare function. This function is exported.
209 pva 1.55 distutils_src_prepare() {
210 arfrever 1.59 if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then
211     die "${FUNCNAME}() can be used only in src_prepare() phase"
212     fi
213    
214 arfrever 1.80 _python_check_python_pkg_setup_execution
215    
216     local distribute_setup_existence="0" ez_setup_existence="0"
217    
218     if [[ "$#" -ne 0 ]]; then
219     die "${FUNCNAME}() does not accept arguments"
220     fi
221    
222 arfrever 1.70 # Delete ez_setup files to prevent packages from installing Setuptools on their own.
223 arfrever 1.63 [[ -d ez_setup || -f ez_setup.py ]] && ez_setup_existence="1"
224 arfrever 1.61 rm -fr ez_setup*
225 arfrever 1.63 if [[ "${ez_setup_existence}" == "1" ]]; then
226 arfrever 1.61 echo "def use_setuptools(*args, **kwargs): pass" > ez_setup.py
227     fi
228    
229 arfrever 1.70 # Delete distribute_setup files to prevent packages from installing Distribute on their own.
230 arfrever 1.66 [[ -d distribute_setup || -f distribute_setup.py ]] && distribute_setup_existence="1"
231     rm -fr distribute_setup*
232     if [[ "${distribute_setup_existence}" == "1" ]]; then
233     echo "def use_setuptools(*args, **kwargs): pass" > distribute_setup.py
234     fi
235    
236 arfrever 1.61 if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
237     python_copy_sources
238     fi
239 lucass 1.41 }
240    
241 dev-zero 1.46 # @FUNCTION: distutils_src_compile
242     # @DESCRIPTION:
243 arfrever 1.70 # The distutils src_compile function. This function is exported.
244     # In ebuilds of packages supporting installation for multiple versions of Python, this function
245     # calls distutils_src_compile_pre_hook() and distutils_src_compile_post_hook(), if they are defined.
246 jnelson 1.1 distutils_src_compile() {
247 arfrever 1.59 if [[ "${EBUILD_PHASE}" != "compile" ]]; then
248     die "${FUNCNAME}() can be used only in src_compile() phase"
249     fi
250    
251 arfrever 1.80 _python_check_python_pkg_setup_execution
252 arfrever 1.73 _python_set_color_variables
253    
254 arfrever 1.80 local setup_file
255    
256 arfrever 1.77 if _python_package_supporting_installation_for_multiple_python_abis; then
257 arfrever 1.70 distutils_building() {
258     _distutils_hook pre
259    
260 arfrever 1.80 _distutils_prepare_global_options
261    
262 arfrever 1.76 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
263 arfrever 1.80 _distutils_prepare_current_working_directory "${setup_file}"
264    
265     echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL}
266     "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@" || return "$?"
267    
268     _distutils_restore_current_working_directory "${setup_file}"
269 arfrever 1.76 done
270 arfrever 1.70
271     _distutils_hook post
272     }
273     python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_building "$@"
274 arfrever 1.80 unset -f distutils_building
275 arfrever 1.70 else
276 arfrever 1.80 _distutils_prepare_global_options
277    
278 arfrever 1.76 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
279 arfrever 1.80 _distutils_prepare_current_working_directory "${setup_file}"
280    
281     echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"${_NORMAL}
282     "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"
283    
284     _distutils_restore_current_working_directory "${setup_file}"
285 arfrever 1.76 done
286 arfrever 1.70 fi
287     }
288 arfrever 1.67
289 arfrever 1.74 _distutils_src_test_hook() {
290     if [[ "$#" -ne 1 ]]; then
291     die "${FUNCNAME}() requires 1 arguments"
292     fi
293    
294 arfrever 1.77 if ! _python_package_supporting_installation_for_multiple_python_abis; then
295 arfrever 1.74 return
296     fi
297    
298     if [[ "$(type -t "distutils_src_test_pre_hook")" == "function" ]]; then
299     eval "python_execute_$1_pre_hook() {
300     distutils_src_test_pre_hook
301     }"
302     fi
303    
304     if [[ "$(type -t "distutils_src_test_post_hook")" == "function" ]]; then
305     eval "python_execute_$1_post_hook() {
306     distutils_src_test_post_hook
307     }"
308     fi
309     }
310    
311 arfrever 1.70 # @FUNCTION: distutils_src_test
312     # @DESCRIPTION:
313     # The distutils src_test function. This function is exported, when DISTUTILS_SRC_TEST variable is set.
314 arfrever 1.74 # In ebuilds of packages supporting installation for multiple versions of Python, this function
315     # calls distutils_src_test_pre_hook() and distutils_src_test_post_hook(), if they are defined.
316 arfrever 1.70 distutils_src_test() {
317 arfrever 1.75 if [[ "${EBUILD_PHASE}" != "test" ]]; then
318     die "${FUNCNAME}() can be used only in src_test() phase"
319     fi
320    
321 arfrever 1.80 _python_check_python_pkg_setup_execution
322 arfrever 1.73 _python_set_color_variables
323    
324 arfrever 1.80 local arguments setup_file
325    
326 arfrever 1.70 if [[ "${DISTUTILS_SRC_TEST}" == "setup.py" ]]; then
327 arfrever 1.77 if _python_package_supporting_installation_for_multiple_python_abis; then
328 arfrever 1.70 distutils_testing() {
329 arfrever 1.74 _distutils_hook pre
330    
331 arfrever 1.80 _distutils_prepare_global_options
332    
333 arfrever 1.76 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
334 arfrever 1.80 _distutils_prepare_current_working_directory "${setup_file}"
335    
336     echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@"${_NORMAL}
337     PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@" || return "$?"
338    
339     _distutils_restore_current_working_directory "${setup_file}"
340 arfrever 1.76 done
341 arfrever 1.74
342     _distutils_hook post
343 arfrever 1.61 }
344 arfrever 1.70 python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_testing "$@"
345 arfrever 1.80 unset -f distutils_testing
346 arfrever 1.70 else
347 arfrever 1.80 _distutils_prepare_global_options
348    
349 arfrever 1.76 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
350 arfrever 1.80 _distutils_prepare_current_working_directory "${setup_file}"
351    
352     echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL}
353     PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed"
354    
355     _distutils_restore_current_working_directory "${setup_file}"
356 arfrever 1.76 done
357 arfrever 1.70 fi
358     elif [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
359 arfrever 1.74 _distutils_src_test_hook nosetests
360    
361 arfrever 1.70 python_execute_nosetests -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
362     elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
363 arfrever 1.74 _distutils_src_test_hook py.test
364    
365 arfrever 1.70 python_execute_py.test -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
366     # trial requires an argument, which is usually equal to "${PN}".
367     elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
368     if [[ "${DISTUTILS_SRC_TEST}" == "trial "* ]]; then
369 arfrever 1.80 arguments="${DISTUTILS_SRC_TEST#trial }"
370 arfrever 1.61 else
371 arfrever 1.80 arguments="${PN}"
372 arfrever 1.70 fi
373 arfrever 1.67
374 arfrever 1.74 _distutils_src_test_hook trial
375    
376 arfrever 1.80 python_execute_trial -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- ${arguments} "$@"
377 arfrever 1.56 else
378 arfrever 1.70 die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'"
379 arfrever 1.56 fi
380 jnelson 1.1 }
381    
382 dev-zero 1.46 # @FUNCTION: distutils_src_install
383     # @DESCRIPTION:
384 arfrever 1.70 # The distutils src_install function. This function is exported.
385     # In ebuilds of packages supporting installation for multiple versions of Python, this function
386     # calls distutils_src_install_pre_hook() and distutils_src_install_post_hook(), if they are defined.
387     # It also installs some standard documentation files (AUTHORS, Change*, CHANGELOG, CONTRIBUTORS,
388 arfrever 1.80 # KNOWN_BUGS, MAINTAINERS, NEWS, README*, TODO).
389 jnelson 1.1 distutils_src_install() {
390 arfrever 1.59 if [[ "${EBUILD_PHASE}" != "install" ]]; then
391     die "${FUNCNAME}() can be used only in src_install() phase"
392     fi
393    
394 arfrever 1.80 _python_check_python_pkg_setup_execution
395 arfrever 1.74 _python_initialize_prefix_variables
396 arfrever 1.73 _python_set_color_variables
397    
398 arfrever 1.80 local default_docs doc line nspkg_pth_file nspkg_pth_files=() setup_file
399    
400 arfrever 1.77 if _python_package_supporting_installation_for_multiple_python_abis; then
401 arfrever 1.70 distutils_installation() {
402     _distutils_hook pre
403 arfrever 1.61
404 arfrever 1.80 _distutils_prepare_global_options
405    
406 arfrever 1.76 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
407 arfrever 1.80 _distutils_prepare_current_working_directory "${setup_file}"
408    
409     echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --no-compile --root="${T}/images/${PYTHON_ABI}" "$@"${_NORMAL}
410     "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --no-compile --root="${T}/images/${PYTHON_ABI}" "$@" || return "$?"
411    
412     _distutils_restore_current_working_directory "${setup_file}"
413 arfrever 1.76 done
414 arfrever 1.67
415 arfrever 1.70 _distutils_hook post
416     }
417     python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_installation "$@"
418 arfrever 1.80 unset -f distutils_installation
419 arfrever 1.67
420 arfrever 1.79 python_merge_intermediate_installation_images "${T}/images"
421 liquidx 1.18 else
422 arfrever 1.69 # Mark the package to be rebuilt after a Python upgrade.
423     python_need_rebuild
424    
425 arfrever 1.80 _distutils_prepare_global_options
426    
427 arfrever 1.76 for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
428 arfrever 1.80 _distutils_prepare_current_working_directory "${setup_file}"
429    
430     echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"${_NORMAL}
431     "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed"
432    
433     _distutils_restore_current_working_directory "${setup_file}"
434     done
435     fi
436    
437     while read -d $'\0' -r nspkg_pth_file; do
438     nspkg_pth_files+=("${nspkg_pth_file}")
439     done < <(find "${ED}" -name "*-nspkg.pth" -type f -print0)
440    
441     if [[ "${#nspkg_pth_files[@]}" -gt 0 ]]; then
442     einfo
443     einfo "Python namespaces:"
444     for nspkg_pth_file in "${nspkg_pth_files[@]}"; do
445     einfo " '${nspkg_pth_file#${ED%/}}':"
446     while read -r line; do
447     einfo " $(echo "${line}" | sed -e "s/.*types\.ModuleType('\([^']\+\)').*/\1/")"
448     done < "${nspkg_pth_file}"
449 patrick 1.82 #if ! has "${EAPI:-0}" 0 1 2 3; then
450     # rm -f "${nspkg_pth_file}" || die "Deletion of '${nspkg_pth_file}' failed"
451     #fi
452 arfrever 1.76 done
453 arfrever 1.80 einfo
454 swegener 1.28 fi
455 lanius 1.20
456 arfrever 1.74 if [[ -e "${ED}usr/local" ]]; then
457 arfrever 1.64 die "Illegal installation into /usr/local"
458     fi
459    
460 arfrever 1.80 default_docs="AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAINERS NEWS README* TODO"
461 lanius 1.20
462 arfrever 1.62 for doc in ${default_docs}; do
463     [[ -s "${doc}" ]] && dodoc "${doc}"
464 lanius 1.20 done
465    
466 arfrever 1.80 if has "${EAPI:-0}" 0 1 2 3; then
467     if [[ -n "${DOCS}" ]]; then
468     dodoc ${DOCS} || die "dodoc failed"
469     fi
470     else
471     if [[ -n "${DOCS}" ]]; then
472     dodoc -r ${DOCS} || die "dodoc failed"
473     fi
474 arfrever 1.62 fi
475 arfrever 1.80
476     DISTUTILS_SRC_INSTALL_EXECUTED="1"
477 jnelson 1.1 }
478 kutsuya 1.6
479 arfrever 1.63 # @FUNCTION: distutils_pkg_postinst
480 dev-zero 1.46 # @DESCRIPTION:
481 arfrever 1.70 # The distutils pkg_postinst function. This function is exported.
482     # When PYTHON_MODNAME variable is set, then this function calls python_mod_optimize() with modules
483     # specified in PYTHON_MODNAME variable. Otherwise it calls python_mod_optimize() with module, whose
484     # name is equal to name of current package, if this module exists.
485 arfrever 1.63 distutils_pkg_postinst() {
486     if [[ "${EBUILD_PHASE}" != "postinst" ]]; then
487     die "${FUNCNAME}() can be used only in pkg_postinst() phase"
488 arfrever 1.59 fi
489    
490 arfrever 1.80 _python_check_python_pkg_setup_execution
491 arfrever 1.74 _python_initialize_prefix_variables
492    
493 arfrever 1.80 if [[ -z "${DISTUTILS_SRC_INSTALL_EXECUTED}" ]]; then
494     die "${FUNCNAME}() called illegally"
495     fi
496    
497 arfrever 1.56 local pylibdir pymod
498 arfrever 1.80
499     if [[ "$#" -ne 0 ]]; then
500     die "${FUNCNAME}() does not accept arguments"
501     fi
502    
503 arfrever 1.75 if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
504 arfrever 1.77 for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/jython-*/Lib; do
505 arfrever 1.56 if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
506     PYTHON_MODNAME="${PN}"
507 hawking 1.54 fi
508     done
509 hawking 1.49 fi
510 liquidx 1.19
511 arfrever 1.75 if [[ -n "${PYTHON_MODNAME}" ]]; then
512 arfrever 1.77 if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
513 arfrever 1.75 python_mod_optimize ${PYTHON_MODNAME}
514     else
515     for pymod in ${PYTHON_MODNAME}; do
516     python_mod_optimize "$(python_get_sitedir)/${pymod}"
517     done
518     fi
519 swegener 1.28 fi
520 liquidx 1.19 }
521    
522 arfrever 1.63 # @FUNCTION: distutils_pkg_postrm
523 dev-zero 1.46 # @DESCRIPTION:
524 arfrever 1.70 # The distutils pkg_postrm function. This function is exported.
525     # When PYTHON_MODNAME variable is set, then this function calls python_mod_cleanup() with modules
526     # specified in PYTHON_MODNAME variable. Otherwise it calls python_mod_cleanup() with module, whose
527     # name is equal to name of current package, if this module exists.
528 arfrever 1.63 distutils_pkg_postrm() {
529     if [[ "${EBUILD_PHASE}" != "postrm" ]]; then
530     die "${FUNCNAME}() can be used only in pkg_postrm() phase"
531 arfrever 1.59 fi
532    
533 arfrever 1.80 _python_check_python_pkg_setup_execution
534 arfrever 1.74 _python_initialize_prefix_variables
535    
536 arfrever 1.80 if [[ -z "${DISTUTILS_SRC_INSTALL_EXECUTED}" ]]; then
537     die "${FUNCNAME}() called illegally"
538     fi
539    
540 hawking 1.54 local pylibdir pymod
541 arfrever 1.80
542     if [[ "$#" -ne 0 ]]; then
543     die "${FUNCNAME}() does not accept arguments"
544     fi
545    
546 arfrever 1.75 if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
547 arfrever 1.77 for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/jython-*/Lib; do
548 arfrever 1.56 if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
549     PYTHON_MODNAME="${PN}"
550 hawking 1.54 fi
551     done
552 hawking 1.50 fi
553 swegener 1.28
554 arfrever 1.63 if [[ -n "${PYTHON_MODNAME}" ]]; then
555 arfrever 1.77 if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
556 arfrever 1.65 python_mod_cleanup ${PYTHON_MODNAME}
557     else
558     for pymod in ${PYTHON_MODNAME}; do
559 arfrever 1.74 for pylibdir in "${EROOT}"usr/$(get_libdir)/python*; do
560 arfrever 1.63 if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then
561 arfrever 1.74 python_mod_cleanup "${pylibdir#${EROOT%/}}/site-packages/${pymod}"
562 arfrever 1.63 fi
563     done
564 arfrever 1.65 done
565     fi
566 swegener 1.28 fi
567 liquidx 1.19 }
568    
569 arfrever 1.80 # @FUNCTION: distutils_get_intermediate_installation_image
570     # @DESCRIPTION:
571     # Print path to intermediate installation image.
572     #
573     # This function can be used only in distutils_src_install_pre_hook() and distutils_src_install_post_hook().
574     distutils_get_intermediate_installation_image() {
575     if [[ "${EBUILD_PHASE}" != "install" ]]; then
576     die "${FUNCNAME}() can be used only in src_install() phase"
577     fi
578    
579     if ! _python_package_supporting_installation_for_multiple_python_abis; then
580     die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
581     fi
582    
583     _python_check_python_pkg_setup_execution
584    
585     if [[ ! "${FUNCNAME[1]}" =~ ^distutils_src_install_(pre|post)_hook$ ]]; then
586     die "${FUNCNAME}() can be used only in distutils_src_install_pre_hook() and distutils_src_install_post_hook()"
587     fi
588    
589     if [[ "$#" -ne 0 ]]; then
590     die "${FUNCNAME}() does not accept arguments"
591     fi
592 liquidx 1.12
593 arfrever 1.80 echo "${T}/images/${PYTHON_ABI}"
594 vapier 1.8 }

  ViewVC Help
Powered by ViewVC 1.1.20