Browse code

remove obsolete

Hanno Böck authored on07/05/2020 09:24:11
Showing18 changed files
1 1
deleted file mode 100644
... ...
@@ -1,599 +0,0 @@
1
-# Copyright 1999-2017 Gentoo Foundation
2
-# Distributed under the terms of the GNU General Public License v2
3
-
4
-# @DEAD
5
-# Removal on 2017-03-18.
6
-
7
-# @ECLASS: distutils.eclass
8
-# @MAINTAINER:
9
-# Gentoo Python Project <python@gentoo.org>
10
-# @BLURB: Eclass for packages with build systems using Distutils
11
-# @DESCRIPTION:
12
-# The distutils eclass defines phase functions for packages with build systems using Distutils.
13
-#
14
-# This eclass is DEPRECATED. Please use distutils-r1 instead.
15
-
16
-if [[ -z "${_PYTHON_ECLASS_INHERITED}" ]]; then
17
-	inherit python
18
-fi
19
-
20
-inherit multilib
21
-
22
-case "${EAPI:-0}" in
23
-	6)
24
-		die "${ECLASS}.eclass is banned in EAPI ${EAPI}"
25
-		;;
26
-	0|1)
27
-		EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm
28
-		;;
29
-	*)
30
-		EXPORT_FUNCTIONS src_prepare src_compile src_install pkg_postinst pkg_postrm
31
-		;;
32
-esac
33
-
34
-if [[ -z "$(declare -p PYTHON_DEPEND 2> /dev/null)" ]]; then
35
-	DEPEND="dev-lang/python"
36
-	RDEPEND="${DEPEND}"
37
-fi
38
-
39
-	if has "${EAPI:-0}" 0 1 && [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
40
-		ewarn
41
-		ewarn "\"${EBUILD}\":"
42
-		ewarn "Deprecation Warning: Usage of distutils.eclass in packages supporting installation"
43
-		ewarn "for multiple Python ABIs in EAPI <=1 is deprecated."
44
-		ewarn "The ebuild should to be fixed. Please report a bug, if it has not been already reported."
45
-		ewarn
46
-	elif has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
47
-		ewarn
48
-		ewarn "\"${EBUILD}\":"
49
-		ewarn "Deprecation Warning: Usage of distutils.eclass in packages not supporting installation"
50
-		ewarn "for multiple Python ABIs in EAPI <=2 is deprecated."
51
-		ewarn "The ebuild should to be fixed. Please report a bug, if it has not been already reported."
52
-		ewarn
53
-	fi
54
-
55
-# 'python' variable is deprecated. Use PYTHON() instead.
56
-if has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
57
-	python="python"
58
-else
59
-	python="die"
60
-fi
61
-
62
-# @ECLASS-VARIABLE: DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES
63
-# @DESCRIPTION:
64
-# Set this to use separate source directories for each enabled version of Python.
65
-
66
-# @ECLASS-VARIABLE: DISTUTILS_SETUP_FILES
67
-# @DESCRIPTION:
68
-# Array of paths to setup files.
69
-# Syntax:
70
-#   [current_working_directory|]path_to_setup_file
71
-
72
-# @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS
73
-# @DESCRIPTION:
74
-# Array of global options passed to setup files.
75
-# Syntax in EAPI <4:
76
-#   global_option
77
-# Syntax in EAPI >=4:
78
-#   Python_ABI_pattern global_option
79
-
80
-# @ECLASS-VARIABLE: DISTUTILS_SRC_TEST
81
-# @DESCRIPTION:
82
-# Type of test command used by distutils_src_test().
83
-# IUSE and DEPEND are automatically adjusted, unless DISTUTILS_DISABLE_TEST_DEPENDENCY is set.
84
-# Valid values:
85
-#   setup.py
86
-#   nosetests
87
-#   py.test
88
-#   trial [arguments]
89
-
90
-# @ECLASS-VARIABLE: DISTUTILS_DISABLE_TEST_DEPENDENCY
91
-# @DESCRIPTION:
92
-# Disable modification of IUSE and DEPEND caused by setting of DISTUTILS_SRC_TEST.
93
-
94
-if [[ -n "${DISTUTILS_SRC_TEST}" && ! "${DISTUTILS_SRC_TEST}" =~ ^(setup\.py|nosetests|py\.test|trial(\ .*)?)$ ]]; then
95
-	die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'"
96
-fi
97
-
98
-if [[ -z "${DISTUTILS_DISABLE_TEST_DEPENDENCY}" ]]; then
99
-	if [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
100
-		IUSE="test"
101
-		DEPEND+="${DEPEND:+ }test? ( dev-python/nose )"
102
-	elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
103
-		IUSE="test"
104
-		DEPEND+="${DEPEND:+ }test? ( dev-python/pytest )"
105
-	# trial requires an argument, which is usually equal to "${PN}".
106
-	elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
107
-		IUSE="test"
108
-		DEPEND+="${DEPEND:+ }test? ( dev-python/twisted-core )"
109
-	fi
110
-fi
111
-
112
-if [[ -n "${DISTUTILS_SRC_TEST}" ]]; then
113
-	EXPORT_FUNCTIONS src_test
114
-fi
115
-
116
-# Scheduled for deletion on 2011-06-01.
117
-if [[ -n "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" ]]; then
118
-	eerror "Use PYTHON_NONVERSIONED_EXECUTABLES=(\".*\") instead of DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable."
119
-	die "DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable is banned"
120
-fi
121
-
122
-# @ECLASS-VARIABLE: DOCS
123
-# @DESCRIPTION:
124
-# Additional documentation files installed by distutils_src_install().
125
-
126
-_distutils_get_build_dir() {
127
-	if _python_package_supporting_installation_for_multiple_python_abis && [[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
128
-		echo "build-${PYTHON_ABI}"
129
-	else
130
-		echo "build"
131
-	fi
132
-}
133
-
134
-_distutils_get_PYTHONPATH() {
135
-	if _python_package_supporting_installation_for_multiple_python_abis && [[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
136
-		ls -d build-${PYTHON_ABI}/lib* 2> /dev/null
137
-	else
138
-		ls -d build/lib* 2> /dev/null
139
-	fi
140
-}
141
-
142
-_distutils_hook() {
143
-	if [[ "$#" -ne 1 ]]; then
144
-		die "${FUNCNAME}() requires 1 argument"
145
-	fi
146
-	if [[ "$(type -t "distutils_src_${EBUILD_PHASE}_$1_hook")" == "function" ]]; then
147
-		"distutils_src_${EBUILD_PHASE}_$1_hook"
148
-	fi
149
-}
150
-
151
-_distutils_prepare_global_options() {
152
-	local element option pattern
153
-
154
-	if [[ -n "$(declare -p DISTUTILS_GLOBAL_OPTIONS 2> /dev/null)" && "$(declare -p DISTUTILS_GLOBAL_OPTIONS)" != "declare -a DISTUTILS_GLOBAL_OPTIONS="* ]]; then
155
-		die "DISTUTILS_GLOBAL_OPTIONS should be indexed array"
156
-	fi
157
-
158
-	if has "${EAPI:-0}" 0 1 2 3; then
159
-		_DISTUTILS_GLOBAL_OPTIONS=("${DISTUTILS_GLOBAL_OPTIONS[@]}")
160
-	else
161
-		_DISTUTILS_GLOBAL_OPTIONS=()
162
-
163
-		for element in "${DISTUTILS_GLOBAL_OPTIONS[@]}"; do
164
-			if [[ ! "${element}" =~ ^[^[:space:]]+\ . ]]; then
165
-				die "Element '${element}' of DISTUTILS_GLOBAL_OPTIONS array has invalid syntax"
166
-			fi
167
-			pattern="${element%% *}"
168
-			option="${element#* }"
169
-			if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
170
-				_DISTUTILS_GLOBAL_OPTIONS+=("${option}")
171
-			fi
172
-		done
173
-	fi
174
-}
175
-
176
-_distutils_prepare_current_working_directory() {
177
-	if [[ "$1" == *"|"*"|"* ]]; then
178
-		die "Element '$1' of DISTUTILS_SETUP_FILES array has invalid syntax"
179
-	fi
180
-
181
-	if [[ "$1" == *"|"* ]]; then
182
-		echo "${_BOLD}[${1%|*}]${_NORMAL}"
183
-		pushd "${1%|*}" > /dev/null || die "Entering directory '${1%|*}' failed"
184
-	fi
185
-}
186
-
187
-_distutils_restore_current_working_directory() {
188
-	if [[ "$1" == *"|"* ]]; then
189
-		popd > /dev/null || die "Leaving directory '${1%|*}' failed"
190
-	fi
191
-}
192
-
193
-# @FUNCTION: distutils_src_unpack
194
-# @DESCRIPTION:
195
-# The distutils src_unpack function. This function is exported.
196
-distutils_src_unpack() {
197
-	if ! has "${EAPI:-0}" 0 1; then
198
-		die "${FUNCNAME}() cannot be used in this EAPI"
199
-	fi
200
-
201
-	if [[ "${EBUILD_PHASE}" != "unpack" ]]; then
202
-		die "${FUNCNAME}() can be used only in src_unpack() phase"
203
-	fi
204
-
205
-	unpack ${A}
206
-	cd "${S}"
207
-
208
-	distutils_src_prepare
209
-}
210
-
211
-# @FUNCTION: distutils_src_prepare
212
-# @DESCRIPTION:
213
-# The distutils src_prepare function. This function is exported.
214
-distutils_src_prepare() {
215
-	if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then
216
-		die "${FUNCNAME}() can be used only in src_prepare() phase"
217
-	fi
218
-
219
-	_python_check_python_pkg_setup_execution
220
-
221
-	local distribute_setup_existence="0" ez_setup_existence="0"
222
-
223
-	if [[ "$#" -ne 0 ]]; then
224
-		die "${FUNCNAME}() does not accept arguments"
225
-	fi
226
-
227
-	# Delete ez_setup files to prevent packages from installing Setuptools on their own.
228
-	[[ -d ez_setup || -f ez_setup.py ]] && ez_setup_existence="1"
229
-	rm -fr ez_setup*
230
-	if [[ "${ez_setup_existence}" == "1" ]]; then
231
-		echo "def use_setuptools(*args, **kwargs): pass" > ez_setup.py
232
-	fi
233
-
234
-	# Delete distribute_setup files to prevent packages from installing Distribute on their own.
235
-	[[ -d distribute_setup || -f distribute_setup.py ]] && distribute_setup_existence="1"
236
-	rm -fr distribute_setup*
237
-	if [[ "${distribute_setup_existence}" == "1" ]]; then
238
-		echo "def use_setuptools(*args, **kwargs): pass" > distribute_setup.py
239
-	fi
240
-
241
-	if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
242
-		python_copy_sources
243
-	fi
244
-}
245
-
246
-# @FUNCTION: distutils_src_compile
247
-# @DESCRIPTION:
248
-# The distutils src_compile function. This function is exported.
249
-# In ebuilds of packages supporting installation for multiple versions of Python, this function
250
-# calls distutils_src_compile_pre_hook() and distutils_src_compile_post_hook(), if they are defined.
251
-distutils_src_compile() {
252
-	if [[ "${EBUILD_PHASE}" != "compile" ]]; then
253
-		die "${FUNCNAME}() can be used only in src_compile() phase"
254
-	fi
255
-
256
-	_python_check_python_pkg_setup_execution
257
-	_python_set_color_variables
258
-
259
-	local setup_file
260
-
261
-	if _python_package_supporting_installation_for_multiple_python_abis; then
262
-		distutils_building() {
263
-			_distutils_hook pre
264
-
265
-			_distutils_prepare_global_options
266
-
267
-			for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
268
-				_distutils_prepare_current_working_directory "${setup_file}"
269
-
270
-				echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL}
271
-				"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@" || return "$?"
272
-
273
-				_distutils_restore_current_working_directory "${setup_file}"
274
-			done
275
-
276
-			_distutils_hook post
277
-		}
278
-		python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_building "$@"
279
-		unset -f distutils_building
280
-	else
281
-		_distutils_prepare_global_options
282
-
283
-		for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
284
-			_distutils_prepare_current_working_directory "${setup_file}"
285
-
286
-			echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"${_NORMAL}
287
-			"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"
288
-
289
-			_distutils_restore_current_working_directory "${setup_file}"
290
-		done
291
-	fi
292
-}
293
-
294
-_distutils_src_test_hook() {
295
-	if [[ "$#" -ne 1 ]]; then
296
-		die "${FUNCNAME}() requires 1 arguments"
297
-	fi
298
-
299
-	if ! _python_package_supporting_installation_for_multiple_python_abis; then
300
-		return
301
-	fi
302
-
303
-	if [[ "$(type -t "distutils_src_test_pre_hook")" == "function" ]]; then
304
-		eval "python_execute_$1_pre_hook() {
305
-			distutils_src_test_pre_hook
306
-		}"
307
-	fi
308
-
309
-	if [[ "$(type -t "distutils_src_test_post_hook")" == "function" ]]; then
310
-		eval "python_execute_$1_post_hook() {
311
-			distutils_src_test_post_hook
312
-		}"
313
-	fi
314
-}
315
-
316
-# @FUNCTION: distutils_src_test
317
-# @DESCRIPTION:
318
-# The distutils src_test function. This function is exported, when DISTUTILS_SRC_TEST variable is set.
319
-# In ebuilds of packages supporting installation for multiple versions of Python, this function
320
-# calls distutils_src_test_pre_hook() and distutils_src_test_post_hook(), if they are defined.
321
-distutils_src_test() {
322
-	if [[ "${EBUILD_PHASE}" != "test" ]]; then
323
-		die "${FUNCNAME}() can be used only in src_test() phase"
324
-	fi
325
-
326
-	_python_check_python_pkg_setup_execution
327
-	_python_set_color_variables
328
-
329
-	local arguments setup_file
330
-
331
-	if [[ "${DISTUTILS_SRC_TEST}" == "setup.py" ]]; then
332
-		if _python_package_supporting_installation_for_multiple_python_abis; then
333
-			distutils_testing() {
334
-				_distutils_hook pre
335
-
336
-				_distutils_prepare_global_options
337
-
338
-				for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
339
-					_distutils_prepare_current_working_directory "${setup_file}"
340
-
341
-					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}
342
-					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 "$?"
343
-
344
-					_distutils_restore_current_working_directory "${setup_file}"
345
-				done
346
-
347
-				_distutils_hook post
348
-			}
349
-			python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_testing "$@"
350
-			unset -f distutils_testing
351
-		else
352
-			_distutils_prepare_global_options
353
-
354
-			for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
355
-				_distutils_prepare_current_working_directory "${setup_file}"
356
-
357
-				echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL}
358
-				PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed"
359
-
360
-				_distutils_restore_current_working_directory "${setup_file}"
361
-			done
362
-		fi
363
-	elif [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
364
-		_distutils_src_test_hook nosetests
365
-
366
-		python_execute_nosetests -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
367
-	elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
368
-		_distutils_src_test_hook py.test
369
-
370
-		python_execute_py.test -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
371
-	# trial requires an argument, which is usually equal to "${PN}".
372
-	elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
373
-		if [[ "${DISTUTILS_SRC_TEST}" == "trial "* ]]; then
374
-			arguments="${DISTUTILS_SRC_TEST#trial }"
375
-		else
376
-			arguments="${PN}"
377
-		fi
378
-
379
-		_distutils_src_test_hook trial
380
-
381
-		python_execute_trial -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- ${arguments} "$@"
382
-	else
383
-		die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'"
384
-	fi
385
-}
386
-
387
-# @FUNCTION: distutils_src_install
388
-# @DESCRIPTION:
389
-# The distutils src_install function. This function is exported.
390
-# In ebuilds of packages supporting installation for multiple versions of Python, this function
391
-# calls distutils_src_install_pre_hook() and distutils_src_install_post_hook(), if they are defined.
392
-# It also installs some standard documentation files (AUTHORS, Change*, CHANGELOG, CONTRIBUTORS,
393
-# KNOWN_BUGS, MAINTAINERS, NEWS, README*, TODO).
394
-distutils_src_install() {
395
-	if [[ "${EBUILD_PHASE}" != "install" ]]; then
396
-		die "${FUNCNAME}() can be used only in src_install() phase"
397
-	fi
398
-
399
-	_python_check_python_pkg_setup_execution
400
-	_python_initialize_prefix_variables
401
-	_python_set_color_variables
402
-
403
-	local default_docs doc line nspkg_pth_file nspkg_pth_files=() setup_file
404
-
405
-	if _python_package_supporting_installation_for_multiple_python_abis; then
406
-		distutils_installation() {
407
-			_distutils_hook pre
408
-
409
-			_distutils_prepare_global_options
410
-
411
-			for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
412
-				_distutils_prepare_current_working_directory "${setup_file}"
413
-
414
-				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}
415
-				"$(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 "$?"
416
-
417
-				_distutils_restore_current_working_directory "${setup_file}"
418
-			done
419
-
420
-			_distutils_hook post
421
-		}
422
-		python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_installation "$@"
423
-		unset -f distutils_installation
424
-
425
-		python_merge_intermediate_installation_images "${T}/images"
426
-	else
427
-		# Mark the package to be rebuilt after a Python upgrade.
428
-		python_need_rebuild
429
-
430
-		_distutils_prepare_global_options
431
-
432
-		for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
433
-			_distutils_prepare_current_working_directory "${setup_file}"
434
-
435
-			echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"${_NORMAL}
436
-			"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed"
437
-
438
-			_distutils_restore_current_working_directory "${setup_file}"
439
-		done
440
-	fi
441
-
442
-	while read -d $'\0' -r nspkg_pth_file; do
443
-		nspkg_pth_files+=("${nspkg_pth_file}")
444
-	done < <(find "${ED}" -name "*-nspkg.pth" -type f -print0)
445
-
446
-	if [[ "${#nspkg_pth_files[@]}" -gt 0 ]]; then
447
-		einfo
448
-		einfo "Python namespaces:"
449
-		for nspkg_pth_file in "${nspkg_pth_files[@]}"; do
450
-			einfo "    '${nspkg_pth_file#${ED%/}}':"
451
-			while read -r line; do
452
-				einfo "        $(echo "${line}" | sed -e "s/.*types\.ModuleType('\([^']\+\)').*/\1/")"
453
-			done < "${nspkg_pth_file}"
454
-			#if ! has "${EAPI:-0}" 0 1 2 3; then
455
-			#	rm -f "${nspkg_pth_file}" || die "Deletion of '${nspkg_pth_file}' failed"
456
-			#fi
457
-		done
458
-		einfo
459
-	fi
460
-
461
-	if [[ -e "${ED}usr/local" ]]; then
462
-		die "Illegal installation into /usr/local"
463
-	fi
464
-
465
-	default_docs="AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAINERS NEWS README* TODO"
466
-
467
-	for doc in ${default_docs}; do
468
-		[[ -s "${doc}" ]] && dodoc "${doc}"
469
-	done
470
-
471
-	if has "${EAPI:-0}" 0 1 2 3; then
472
-		if [[ -n "${DOCS}" ]]; then
473
-			dodoc ${DOCS} || die "dodoc failed"
474
-		fi
475
-	else
476
-		if [[ -n "${DOCS}" ]]; then
477
-			dodoc -r ${DOCS} || die "dodoc failed"
478
-		fi
479
-	fi
480
-
481
-	DISTUTILS_SRC_INSTALL_EXECUTED="1"
482
-}
483
-
484
-# @FUNCTION: distutils_pkg_postinst
485
-# @DESCRIPTION:
486
-# The distutils pkg_postinst function. This function is exported.
487
-# When PYTHON_MODNAME variable is set, then this function calls python_mod_optimize() with modules
488
-# specified in PYTHON_MODNAME variable. Otherwise it calls python_mod_optimize() with module, whose
489
-# name is equal to name of current package, if this module exists.
490
-distutils_pkg_postinst() {
491
-	if [[ "${EBUILD_PHASE}" != "postinst" ]]; then
492
-		die "${FUNCNAME}() can be used only in pkg_postinst() phase"
493
-	fi
494
-
495
-	_python_check_python_pkg_setup_execution
496
-	_python_initialize_prefix_variables
497
-
498
-	if [[ -z "${DISTUTILS_SRC_INSTALL_EXECUTED}" ]]; then
499
-		die "${FUNCNAME}() called illegally"
500
-	fi
501
-
502
-	local pylibdir pymod
503
-
504
-	if [[ "$#" -ne 0 ]]; then
505
-		die "${FUNCNAME}() does not accept arguments"
506
-	fi
507
-
508
-	if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
509
-		for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/jython-*/Lib; do
510
-			if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
511
-				PYTHON_MODNAME="${PN}"
512
-			fi
513
-		done
514
-	fi
515
-
516
-	if [[ -n "${PYTHON_MODNAME}" ]]; then
517
-		if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
518
-			python_mod_optimize ${PYTHON_MODNAME}
519
-		else
520
-			for pymod in ${PYTHON_MODNAME}; do
521
-				python_mod_optimize "$(python_get_sitedir)/${pymod}"
522
-			done
523
-		fi
524
-	fi
525
-}
526
-
527
-# @FUNCTION: distutils_pkg_postrm
528
-# @DESCRIPTION:
529
-# The distutils pkg_postrm function. This function is exported.
530
-# When PYTHON_MODNAME variable is set, then this function calls python_mod_cleanup() with modules
531
-# specified in PYTHON_MODNAME variable. Otherwise it calls python_mod_cleanup() with module, whose
532
-# name is equal to name of current package, if this module exists.
533
-distutils_pkg_postrm() {
534
-	if [[ "${EBUILD_PHASE}" != "postrm" ]]; then
535
-		die "${FUNCNAME}() can be used only in pkg_postrm() phase"
536
-	fi
537
-
538
-	_python_check_python_pkg_setup_execution
539
-	_python_initialize_prefix_variables
540
-
541
-	if [[ -z "${DISTUTILS_SRC_INSTALL_EXECUTED}" ]]; then
542
-		die "${FUNCNAME}() called illegally"
543
-	fi
544
-
545
-	local pylibdir pymod
546
-
547
-	if [[ "$#" -ne 0 ]]; then
548
-		die "${FUNCNAME}() does not accept arguments"
549
-	fi
550
-
551
-	if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
552
-		for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/jython-*/Lib; do
553
-			if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
554
-				PYTHON_MODNAME="${PN}"
555
-			fi
556
-		done
557
-	fi
558
-
559
-	if [[ -n "${PYTHON_MODNAME}" ]]; then
560
-		if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
561
-			python_mod_cleanup ${PYTHON_MODNAME}
562
-		else
563
-			for pymod in ${PYTHON_MODNAME}; do
564
-				for pylibdir in "${EROOT}"usr/$(get_libdir)/python*; do
565
-					if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then
566
-						python_mod_cleanup "${pylibdir#${EROOT%/}}/site-packages/${pymod}"
567
-					fi
568
-				done
569
-			done
570
-		fi
571
-	fi
572
-}
573
-
574
-# @FUNCTION: distutils_get_intermediate_installation_image
575
-# @DESCRIPTION:
576
-# Print path to intermediate installation image.
577
-#
578
-# This function can be used only in distutils_src_install_pre_hook() and distutils_src_install_post_hook().
579
-distutils_get_intermediate_installation_image() {
580
-	if [[ "${EBUILD_PHASE}" != "install" ]]; then
581
-		die "${FUNCNAME}() can be used only in src_install() phase"
582
-	fi
583
-
584
-	if ! _python_package_supporting_installation_for_multiple_python_abis; then
585
-		die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
586
-	fi
587
-
588
-	_python_check_python_pkg_setup_execution
589
-
590
-	if [[ ! "${FUNCNAME[1]}" =~ ^distutils_src_install_(pre|post)_hook$ ]]; then
591
-		die "${FUNCNAME}() can be used only in distutils_src_install_pre_hook() and distutils_src_install_post_hook()"
592
-	fi
593
-
594
-	if [[ "$#" -ne 0 ]]; then
595
-		die "${FUNCNAME}() does not accept arguments"
596
-	fi
597
-
598
-	echo "${T}/images/${PYTHON_ABI}"
599
-}
600 0
deleted file mode 100644
... ...
@@ -1,3167 +0,0 @@
1
-# Copyright 1999-2017 Gentoo Foundation
2
-# Distributed under the terms of the GNU General Public License v2
3
-
4
-# @DEAD
5
-# Removal on 2017-03-21.
6
-
7
-# @ECLASS: python.eclass
8
-# @MAINTAINER:
9
-# Gentoo Python Project <python@gentoo.org>
10
-# @BLURB: Eclass for Python packages
11
-# @DESCRIPTION:
12
-# The python eclass contains miscellaneous, useful functions for Python packages.
13
-#
14
-# This eclass is DEPRECATED. Please use python-r1, python-single-r1
15
-# or python-any-r1 instead.
16
-
17
-if [[ ${EAPI} == 6 ]]; then
18
-	die "${ECLASS}.eclass is banned in EAPI ${EAPI}"
19
-fi
20
-
21
-if [[ ${_PYTHON_UTILS_R1} ]]; then
22
-	die 'python.eclass can not be used with python-r1 suite eclasses.'
23
-fi
24
-
25
-# Must call inherit before EXPORT_FUNCTIONS to avoid QA warning.
26
-if [[ -z "${_PYTHON_ECLASS_INHERITED}" ]]; then
27
-	inherit multilib
28
-fi
29
-
30
-# Export pkg_setup every time to avoid issues with eclass inheritance order.
31
-if ! has "${EAPI:-0}" 0 1 2 3 || { has "${EAPI:-0}" 2 3 && [[ -n "${PYTHON_USE_WITH}" || -n "${PYTHON_USE_WITH_OR}" ]]; }; then
32
-	EXPORT_FUNCTIONS pkg_setup
33
-fi
34
-
35
-# Avoid processing this eclass more than once.
36
-if [[ -z "${_PYTHON_ECLASS_INHERITED}" ]]; then
37
-_PYTHON_ECLASS_INHERITED="1"
38
-
39
-if ! has "${EAPI:-0}" 0 1 2 3 4 5; then
40
-	die "API of python.eclass in EAPI=\"${EAPI}\" not established"
41
-fi
42
-
43
-# Please do not add any new versions of Python here! Instead, please
44
-# focus on converting packages to use the new eclasses.
45
-
46
-_CPYTHON2_GLOBALLY_SUPPORTED_ABIS=(2.4 2.5 2.6 2.7)
47
-_CPYTHON3_GLOBALLY_SUPPORTED_ABIS=(3.1 3.2 3.3)
48
-_JYTHON_GLOBALLY_SUPPORTED_ABIS=(2.5-jython 2.7-jython)
49
-_PYPY_GLOBALLY_SUPPORTED_ABIS=(2.7-pypy-1.7 2.7-pypy-1.8 2.7-pypy-1.9 2.7-pypy-2.0)
50
-_PYTHON_GLOBALLY_SUPPORTED_ABIS=(${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]} ${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]} ${_JYTHON_GLOBALLY_SUPPORTED_ABIS[@]} ${_PYPY_GLOBALLY_SUPPORTED_ABIS[@]})
51
-
52
-# ================================================================================================
53
-# ===================================== HANDLING OF METADATA =====================================
54
-# ================================================================================================
55
-
56
-_PYTHON_ABI_PATTERN_REGEX="([[:alnum:]]|\.|-|\*|\[|\])+"
57
-
58
-_python_check_python_abi_matching() {
59
-	local pattern patterns patterns_list="0" PYTHON_ABI
60
-
61
-	while (($#)); do
62
-		case "$1" in
63
-			--patterns-list)
64
-				patterns_list="1"
65
-				;;
66
-			--)
67
-				shift
68
-				break
69
-				;;
70
-			-*)
71
-				die "${FUNCNAME}(): Unrecognized option '$1'"
72
-				;;
73
-			*)
74
-				break
75
-				;;
76
-		esac
77
-		shift
78
-	done
79
-
80
-	if [[ "$#" -ne 2 ]]; then
81
-		die "${FUNCNAME}() requires 2 arguments"
82
-	fi
83
-
84
-	PYTHON_ABI="$1"
85
-
86
-	if [[ "${patterns_list}" == "0" ]]; then
87
-		pattern="$2"
88
-
89
-		if [[ "${pattern}" == *"-cpython" ]]; then
90
-			[[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+$ && "${PYTHON_ABI}" == ${pattern%-cpython} ]]
91
-		elif [[ "${pattern}" == *"-jython" ]]; then
92
-			[[ "${PYTHON_ABI}" == ${pattern} ]]
93
-		elif [[ "${pattern}" == *"-pypy-"* ]]; then
94
-			[[ "${PYTHON_ABI}" == ${pattern} ]]
95
-		else
96
-			if [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then
97
-				[[ "${PYTHON_ABI}" == ${pattern} ]]
98
-			elif [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then
99
-				[[ "${PYTHON_ABI%-jython}" == ${pattern} ]]
100
-			elif [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+-pypy-[[:digit:]]+\.[[:digit:]]+$ ]]; then
101
-				[[ "${PYTHON_ABI%-pypy-*}" == ${pattern} ]]
102
-			else
103
-				die "${FUNCNAME}(): Unrecognized Python ABI '${PYTHON_ABI}'"
104
-			fi
105
-		fi
106
-	else
107
-		patterns="${2// /$'\n'}"
108
-
109
-		while read pattern; do
110
-			if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
111
-				return 0
112
-			fi
113
-		done <<< "${patterns}"
114
-
115
-		return 1
116
-	fi
117
-}
118
-
119
-_python_implementation() {
120
-	if [[ "${CATEGORY}/${PN}" == "dev-lang/python" ]]; then
121
-		return 0
122
-	elif [[ "${CATEGORY}/${PN}" == "dev-java/jython" ]]; then
123
-		return 0
124
-	elif [[ "${CATEGORY}/${PN}" == "virtual/pypy" ]]; then
125
-		return 0
126
-	else
127
-		return 1
128
-	fi
129
-}
130
-
131
-_python_package_supporting_installation_for_multiple_python_abis() {
132
-	[[ -n "${SUPPORT_PYTHON_ABIS}" ]]
133
-}
134
-
135
-# @ECLASS-VARIABLE: PYTHON_DEPEND
136
-# @DESCRIPTION:
137
-# Specification of dependency on dev-lang/python.
138
-# Syntax:
139
-#   PYTHON_DEPEND:             [[!]USE_flag? ]<version_components_group>[ version_components_group]
140
-#   version_components_group:  <major_version[:[minimal_version][:maximal_version]]>
141
-#   major_version:             <2|3|*>
142
-#   minimal_version:           <minimal_major_version.minimal_minor_version>
143
-#   maximal_version:           <maximal_major_version.maximal_minor_version>
144
-
145
-_python_parse_PYTHON_DEPEND() {
146
-	local major_version maximal_version minimal_version python_all="0" python_maximal_version python_minimal_version python_versions=() python2="0" python2_maximal_version python2_minimal_version python3="0" python3_maximal_version python3_minimal_version USE_flag= version_components_group version_components_group_regex version_components_groups
147
-
148
-	version_components_group_regex="(2|3|\*)(:([[:digit:]]+\.[[:digit:]]+)?(:([[:digit:]]+\.[[:digit:]]+)?)?)?"
149
-	version_components_groups="${PYTHON_DEPEND}"
150
-
151
-	if [[ "${version_components_groups}" =~ ^((\!)?[[:alnum:]_-]+\?\ )?${version_components_group_regex}(\ ${version_components_group_regex})?$ ]]; then
152
-		if [[ "${version_components_groups}" =~ ^(\!)?[[:alnum:]_-]+\? ]]; then
153
-			USE_flag="${version_components_groups%\? *}"
154
-			version_components_groups="${version_components_groups#* }"
155
-		fi
156
-		if [[ "${version_components_groups}" =~ ("*".*" "|" *"|^2.*\ (2|\*)|^3.*\ (3|\*)) ]]; then
157
-			die "Invalid syntax of PYTHON_DEPEND: Incorrectly specified groups of versions"
158
-		fi
159
-
160
-		version_components_groups="${version_components_groups// /$'\n'}"
161
-		while read version_components_group; do
162
-			major_version="${version_components_group:0:1}"
163
-			minimal_version="${version_components_group:2}"
164
-			minimal_version="${minimal_version%:*}"
165
-			maximal_version="${version_components_group:$((3 + ${#minimal_version}))}"
166
-
167
-			if [[ "${major_version}" =~ ^(2|3)$ ]]; then
168
-				if [[ -n "${minimal_version}" && "${major_version}" != "${minimal_version:0:1}" ]]; then
169
-					die "Invalid syntax of PYTHON_DEPEND: Minimal version '${minimal_version}' not in specified group of versions"
170
-				fi
171
-				if [[ -n "${maximal_version}" && "${major_version}" != "${maximal_version:0:1}" ]]; then
172
-					die "Invalid syntax of PYTHON_DEPEND: Maximal version '${maximal_version}' not in specified group of versions"
173
-				fi
174
-			fi
175
-
176
-			if [[ "${major_version}" == "2" ]]; then
177
-				python2="1"
178
-				python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}")
179
-				python2_minimal_version="${minimal_version}"
180
-				python2_maximal_version="${maximal_version}"
181
-			elif [[ "${major_version}" == "3" ]]; then
182
-				python3="1"
183
-				python_versions=("${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}")
184
-				python3_minimal_version="${minimal_version}"
185
-				python3_maximal_version="${maximal_version}"
186
-			else
187
-				python_all="1"
188
-				python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}")
189
-				python_minimal_version="${minimal_version}"
190
-				python_maximal_version="${maximal_version}"
191
-			fi
192
-
193
-			if [[ -n "${minimal_version}" ]] && ! has "${minimal_version}" "${python_versions[@]}"; then
194
-				die "Invalid syntax of PYTHON_DEPEND: Unrecognized minimal version '${minimal_version}'"
195
-			fi
196
-			if [[ -n "${maximal_version}" ]] && ! has "${maximal_version}" "${python_versions[@]}"; then
197
-				die "Invalid syntax of PYTHON_DEPEND: Unrecognized maximal version '${maximal_version}'"
198
-			fi
199
-
200
-			if [[ -n "${minimal_version}" && -n "${maximal_version}" && "${minimal_version}" > "${maximal_version}" ]]; then
201
-				die "Invalid syntax of PYTHON_DEPEND: Minimal version '${minimal_version}' greater than maximal version '${maximal_version}'"
202
-			fi
203
-		done <<< "${version_components_groups}"
204
-
205
-		_PYTHON_ATOMS=()
206
-
207
-		_append_accepted_versions_range() {
208
-			local accepted_version="0" i
209
-			for ((i = "${#python_versions[@]}"; i >= 0; i--)); do
210
-				if [[ "${python_versions[${i}]}" == "${python_maximal_version}" ]]; then
211
-					accepted_version="1"
212
-				fi
213
-				if [[ "${accepted_version}" == "1" ]]; then
214
-					_PYTHON_ATOMS+=("=dev-lang/python-${python_versions[${i}]}*")
215
-				fi
216
-				if [[ "${python_versions[${i}]}" == "${python_minimal_version}" ]]; then
217
-					accepted_version="0"
218
-				fi
219
-			done
220
-		}
221
-
222
-		if [[ "${python_all}" == "1" ]]; then
223
-			if [[ -z "${python_minimal_version}" && -z "${python_maximal_version}" ]]; then
224
-				_PYTHON_ATOMS+=("dev-lang/python")
225
-			else
226
-				python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}")
227
-				python_minimal_version="${python_minimal_version:-${python_versions[0]}}"
228
-				python_maximal_version="${python_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"
229
-				_append_accepted_versions_range
230
-			fi
231
-		else
232
-			if [[ "${python3}" == "1" ]]; then
233
-				if [[ -z "${python3_minimal_version}" && -z "${python3_maximal_version}" ]]; then
234
-					_PYTHON_ATOMS+=("=dev-lang/python-3*")
235
-				else
236
-					python_versions=("${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}")
237
-					python_minimal_version="${python3_minimal_version:-${python_versions[0]}}"
238
-					python_maximal_version="${python3_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"
239
-					_append_accepted_versions_range
240
-				fi
241
-			fi
242
-			if [[ "${python2}" == "1" ]]; then
243
-				if [[ -z "${python2_minimal_version}" && -z "${python2_maximal_version}" ]]; then
244
-					_PYTHON_ATOMS+=("=dev-lang/python-2*")
245
-				else
246
-					python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}")
247
-					python_minimal_version="${python2_minimal_version:-${python_versions[0]}}"
248
-					python_maximal_version="${python2_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"
249
-					_append_accepted_versions_range
250
-				fi
251
-			fi
252
-		fi
253
-
254
-		unset -f _append_accepted_versions_range
255
-
256
-		if [[ "${#_PYTHON_ATOMS[@]}" -gt 1 ]]; then
257
-			DEPEND+="${DEPEND:+ }${USE_flag}${USE_flag:+? ( }|| ( ${_PYTHON_ATOMS[@]} )${USE_flag:+ )}"
258
-			RDEPEND+="${RDEPEND:+ }${USE_flag}${USE_flag:+? ( }|| ( ${_PYTHON_ATOMS[@]} )${USE_flag:+ )}"
259
-		else
260
-			DEPEND+="${DEPEND:+ }${USE_flag}${USE_flag:+? ( }${_PYTHON_ATOMS[@]}${USE_flag:+ )}"
261
-			RDEPEND+="${RDEPEND:+ }${USE_flag}${USE_flag:+? ( }${_PYTHON_ATOMS[@]}${USE_flag:+ )}"
262
-		fi
263
-	else
264
-		die "Invalid syntax of PYTHON_DEPEND"
265
-	fi
266
-}
267
-
268
-if _python_implementation; then
269
-	DEPEND=">=app-eselect/eselect-python-20091230"
270
-	RDEPEND="${DEPEND}"
271
-	PDEPEND="app-admin/python-updater"
272
-fi
273
-
274
-if [[ -n "${PYTHON_DEPEND}" ]]; then
275
-	_python_parse_PYTHON_DEPEND
276
-else
277
-	_PYTHON_ATOMS=("dev-lang/python")
278
-fi
279
-unset -f _python_parse_PYTHON_DEPEND
280
-
281
-if [[ -n "${NEED_PYTHON}" ]]; then
282
-	eerror "Use PYTHON_DEPEND variable instead of NEED_PYTHON variable."
283
-	die "NEED_PYTHON variable is banned"
284
-fi
285
-
286
-# @ECLASS-VARIABLE: PYTHON_USE_WITH
287
-# @DESCRIPTION:
288
-# Set this to a space separated list of USE flags the Python slot in use must be built with.
289
-
290
-# @ECLASS-VARIABLE: PYTHON_USE_WITH_OR
291
-# @DESCRIPTION:
292
-# Set this to a space separated list of USE flags of which one must be turned on for the slot in use.
293
-
294
-# @ECLASS-VARIABLE: PYTHON_USE_WITH_OPT
295
-# @DESCRIPTION:
296
-# Set this to a name of a USE flag if you need to make either PYTHON_USE_WITH or
297
-# PYTHON_USE_WITH_OR atoms conditional under a USE flag.
298
-
299
-if ! has "${EAPI:-0}" 0 1 && [[ -n ${PYTHON_USE_WITH} || -n ${PYTHON_USE_WITH_OR} ]]; then
300
-	_PYTHON_USE_WITH_ATOMS_ARRAY=()
301
-	if [[ -n "${PYTHON_USE_WITH}" ]]; then
302
-		for _PYTHON_ATOM in "${_PYTHON_ATOMS[@]}"; do
303
-			_PYTHON_USE_WITH_ATOMS_ARRAY+=("${_PYTHON_ATOM}[${PYTHON_USE_WITH// /,}]")
304
-		done
305
-	elif [[ -n "${PYTHON_USE_WITH_OR}" ]]; then
306
-		for _USE_flag in ${PYTHON_USE_WITH_OR}; do
307
-			for _PYTHON_ATOM in "${_PYTHON_ATOMS[@]}"; do
308
-				_PYTHON_USE_WITH_ATOMS_ARRAY+=("${_PYTHON_ATOM}[${_USE_flag}]")
309
-			done
310
-		done
311
-		unset _USE_flag
312
-	fi
313
-	if [[ "${#_PYTHON_USE_WITH_ATOMS_ARRAY[@]}" -gt 1 ]]; then
314
-		_PYTHON_USE_WITH_ATOMS="|| ( ${_PYTHON_USE_WITH_ATOMS_ARRAY[@]} )"
315
-	else
316
-		_PYTHON_USE_WITH_ATOMS="${_PYTHON_USE_WITH_ATOMS_ARRAY[@]}"
317
-	fi
318
-	if [[ -n "${PYTHON_USE_WITH_OPT}" ]]; then
319
-		_PYTHON_USE_WITH_ATOMS="${PYTHON_USE_WITH_OPT}? ( ${_PYTHON_USE_WITH_ATOMS} )"
320
-	fi
321
-	DEPEND+="${DEPEND:+ }${_PYTHON_USE_WITH_ATOMS}"
322
-	RDEPEND+="${RDEPEND:+ }${_PYTHON_USE_WITH_ATOMS}"
323
-	unset _PYTHON_ATOM _PYTHON_USE_WITH_ATOMS _PYTHON_USE_WITH_ATOMS_ARRAY
324
-fi
325
-
326
-unset _PYTHON_ATOMS
327
-
328
-# ================================================================================================
329
-# =================================== MISCELLANEOUS FUNCTIONS ====================================
330
-# ================================================================================================
331
-
332
-_python_abi-specific_local_scope() {
333
-	[[ " ${FUNCNAME[@]:2} " =~ " "(_python_final_sanity_checks|python_execute_function|python_mod_optimize|python_mod_cleanup)" " ]]
334
-}
335
-
336
-_python_initialize_prefix_variables() {
337
-	if has "${EAPI:-0}" 0 1 2; then
338
-		if [[ -n "${ROOT}" && -z "${EROOT}" ]]; then
339
-			EROOT="${ROOT%/}${EPREFIX}/"
340
-		fi
341
-		if [[ -n "${D}" && -z "${ED}" ]]; then
342
-			ED="${D%/}${EPREFIX}/"
343
-		fi
344
-	fi
345
-}
346
-
347
-unset PYTHON_SANITY_CHECKS_EXECUTED PYTHON_SKIP_SANITY_CHECKS
348
-
349
-_python_initial_sanity_checks() {
350
-	:
351
-}
352
-
353
-_python_final_sanity_checks() {
354
-	if ! _python_implementation && [[ "$(declare -p PYTHON_SANITY_CHECKS_EXECUTED 2> /dev/null)" != "declare -- PYTHON_SANITY_CHECKS_EXECUTED="* || " ${FUNCNAME[@]:1} " =~ " "(python_set_active_version|python_pkg_setup)" " && -z "${PYTHON_SKIP_SANITY_CHECKS}" ]]; then
355
-		local PYTHON_ABI="${PYTHON_ABI}"
356
-		for PYTHON_ABI in ${PYTHON_ABIS-${PYTHON_ABI}}; do
357
-			# Ensure that appropriate version of Python is installed.
358
-			if ! has_version "$(python_get_implementational_package)"; then
359
-				die "$(python_get_implementational_package) is not installed"
360
-			fi
361
-
362
-			# Ensure that EPYTHON variable is respected.
363
-			if [[ "$(EPYTHON="$(PYTHON)" python -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")" != "${PYTHON_ABI}" ]]; then
364
-				eerror "Path to 'python':                 '$(type -p python)'"
365
-				eerror "ABI:                              '${ABI}'"
366
-				eerror "DEFAULT_ABI:                      '${DEFAULT_ABI}'"
367
-				eerror "EPYTHON:                          '$(PYTHON)'"
368
-				eerror "PYTHON_ABI:                       '${PYTHON_ABI}'"
369
-				eerror "Locally active version of Python: '$(EPYTHON="$(PYTHON)" python -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")'"
370
-				die "'python' does not respect EPYTHON variable"
371
-			fi
372
-		done
373
-	fi
374
-	PYTHON_SANITY_CHECKS_EXECUTED="1"
375
-}
376
-
377
-# @ECLASS-VARIABLE: PYTHON_COLORS
378
-# @DESCRIPTION:
379
-# User-configurable colored output.
380
-PYTHON_COLORS="${PYTHON_COLORS:-0}"
381
-
382
-_python_set_color_variables() {
383
-	if [[ "${PYTHON_COLORS}" != "0" && "${NOCOLOR:-false}" =~ ^(false|no)$ ]]; then
384
-		_BOLD=$'\e[1m'
385
-		_RED=$'\e[1;31m'
386
-		_GREEN=$'\e[1;32m'
387
-		_BLUE=$'\e[1;34m'
388
-		_CYAN=$'\e[1;36m'
389
-		_NORMAL=$'\e[0m'
390
-	else
391
-		_BOLD=
392
-		_RED=
393
-		_GREEN=
394
-		_BLUE=
395
-		_CYAN=
396
-		_NORMAL=
397
-	fi
398
-}
399
-
400
-_python_check_python_pkg_setup_execution() {
401
-	[[ " ${FUNCNAME[@]:1} " =~ " "(python_set_active_version|python_pkg_setup)" " ]] && return
402
-
403
-	if ! has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_PKG_SETUP_EXECUTED}" ]]; then
404
-		die "python_pkg_setup() not called"
405
-	fi
406
-}
407
-
408
-# @FUNCTION: python_pkg_setup
409
-# @DESCRIPTION:
410
-# Perform sanity checks and initialize environment.
411
-#
412
-# This function is exported in EAPI 2 and 3 when PYTHON_USE_WITH or PYTHON_USE_WITH_OR variable
413
-# is set and always in EAPI >=4. Calling of this function is mandatory in EAPI >=4.
414
-python_pkg_setup() {
415
-	if [[ "${EBUILD_PHASE}" != "setup" ]]; then
416
-		die "${FUNCNAME}() can be used only in pkg_setup() phase"
417
-	fi
418
-
419
-	if [[ "$#" -ne 0 ]]; then
420
-		die "${FUNCNAME}() does not accept arguments"
421
-	fi
422
-
423
-	export JYTHON_SYSTEM_CACHEDIR="1"
424
-	addwrite "${EPREFIX}/var/cache/jython"
425
-
426
-	if _python_package_supporting_installation_for_multiple_python_abis; then
427
-		_python_calculate_PYTHON_ABIS
428
-		export EPYTHON="$(PYTHON -f)"
429
-	else
430
-		PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
431
-	fi
432
-
433
-	if ! has "${EAPI:-0}" 0 1 && [[ -n "${PYTHON_USE_WITH}" || -n "${PYTHON_USE_WITH_OR}" ]]; then
434
-		if [[ "${PYTHON_USE_WITH_OPT}" ]]; then
435
-			if [[ "${PYTHON_USE_WITH_OPT}" == !* ]]; then
436
-				use ${PYTHON_USE_WITH_OPT#!} && return
437
-			else
438
-				use !${PYTHON_USE_WITH_OPT} && return
439
-			fi
440
-		fi
441
-
442
-		python_pkg_setup_check_USE_flags() {
443
-			local python_atom USE_flag
444
-			python_atom="$(python_get_implementational_package)"
445
-
446
-			for USE_flag in ${PYTHON_USE_WITH}; do
447
-				if ! has_version "${python_atom}[${USE_flag}]"; then
448
-					eerror "Please rebuild ${python_atom} with the following USE flags enabled: ${PYTHON_USE_WITH}"
449
-					die "Please rebuild ${python_atom} with the following USE flags enabled: ${PYTHON_USE_WITH}"
450
-				fi
451
-			done
452
-
453
-			for USE_flag in ${PYTHON_USE_WITH_OR}; do
454
-				if has_version "${python_atom}[${USE_flag}]"; then
455
-					return
456
-				fi
457
-			done
458
-
459
-			if [[ ${PYTHON_USE_WITH_OR} ]]; then
460
-				eerror "Please rebuild ${python_atom} with at least one of the following USE flags enabled: ${PYTHON_USE_WITH_OR}"
461
-				die "Please rebuild ${python_atom} with at least one of the following USE flags enabled: ${PYTHON_USE_WITH_OR}"
462
-			fi
463
-		}
464
-
465
-		if _python_package_supporting_installation_for_multiple_python_abis; then
466
-			PYTHON_SKIP_SANITY_CHECKS="1" python_execute_function -q python_pkg_setup_check_USE_flags
467
-		else
468
-			python_pkg_setup_check_USE_flags
469
-		fi
470
-
471
-		unset -f python_pkg_setup_check_USE_flags
472
-	fi
473
-
474
-	PYTHON_PKG_SETUP_EXECUTED="1"
475
-}
476
-
477
-_PYTHON_SHEBANG_BASE_PART_REGEX='^#![[:space:]]*([^[:space:]]*/usr/bin/env[[:space:]]+)?([^[:space:]]*/)?(jython|pypy-c|python)'
478
-
479
-# @FUNCTION: python_convert_shebangs
480
-# @USAGE: [-q|--quiet] [-r|--recursive] [-x|--only-executables] [--] <Python_ABI|Python_version> <file|directory> [files|directories]
481
-# @DESCRIPTION:
482
-# Convert shebangs in specified files. Directories can be specified only with --recursive option.
483
-python_convert_shebangs() {
484
-	_python_check_python_pkg_setup_execution
485
-
486
-	local argument file files=() only_executables="0" python_interpreter quiet="0" recursive="0" shebangs_converted="0"
487
-
488
-	while (($#)); do
489
-		case "$1" in
490
-			-r|--recursive)
491
-				recursive="1"
492
-				;;
493
-			-q|--quiet)
494
-				quiet="1"
495
-				;;
496
-			-x|--only-executables)
497
-				only_executables="1"
498
-				;;
499
-			--)
500
-				shift
501
-				break
502
-				;;
503
-			-*)
504
-				die "${FUNCNAME}(): Unrecognized option '$1'"
505
-				;;
506
-			*)
507
-				break
508
-				;;
509
-		esac
510
-		shift
511
-	done
512
-
513
-	if [[ "$#" -eq 0 ]]; then
514
-		die "${FUNCNAME}(): Missing Python version and files or directories"
515
-	elif [[ "$#" -eq 1 ]]; then
516
-		die "${FUNCNAME}(): Missing files or directories"
517
-	fi
518
-
519
-	if [[ -n "$(_python_get_implementation --ignore-invalid "$1")" ]]; then
520
-		python_interpreter="$(PYTHON "$1")"
521
-	else
522
-		python_interpreter="python$1"
523
-	fi
524
-	shift
525
-
526
-	for argument in "$@"; do
527
-		if [[ ! -e "${argument}" ]]; then
528
-			die "${FUNCNAME}(): '${argument}' does not exist"
529
-		elif [[ -f "${argument}" ]]; then
530
-			files+=("${argument}")
531
-		elif [[ -d "${argument}" ]]; then
532
-			if [[ "${recursive}" == "1" ]]; then
533
-				while read -d $'\0' -r file; do
534
-					files+=("${file}")
535
-				done < <(find "${argument}" $([[ "${only_executables}" == "1" ]] && echo -perm /111) -type f -print0)
536
-			else
537
-				die "${FUNCNAME}(): '${argument}' is not a regular file"
538
-			fi
539
-		else
540
-			die "${FUNCNAME}(): '${argument}' is not a regular file or a directory"
541
-		fi
542
-	done
543
-
544
-	for file in "${files[@]}"; do
545
-		file="${file#./}"
546
-		[[ "${only_executables}" == "1" && ! -x "${file}" ]] && continue
547
-
548
-		if [[ "$(head -n1 "${file}")" =~ ${_PYTHON_SHEBANG_BASE_PART_REGEX} ]]; then
549
-			[[ "$(sed -ne "2p" "${file}")" =~ ^"# Gentoo '".*"' wrapper script generated by python_generate_wrapper_scripts()"$ ]] && continue
550
-
551
-			shebangs_converted="1"
552
-
553
-			if [[ "${quiet}" == "0" ]]; then
554
-				einfo "Converting shebang in '${file}'"
555
-			fi
556
-
557
-			sed -e "1s:^#![[:space:]]*\([^[:space:]]*/usr/bin/env[[:space:]]\)\?[[:space:]]*\([^[:space:]]*/\)\?\(jython\|pypy-c\|python\)\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?\(\$\|[[:space:]].*\):#!\1\2${python_interpreter}\6:" -i "${file}" || die "Conversion of shebang in '${file}' failed"
558
-		fi
559
-	done
560
-
561
-	if [[ "${shebangs_converted}" == "0" ]]; then
562
-		ewarn "${FUNCNAME}(): Python scripts not found"
563
-	fi
564
-}
565
-
566
-# @FUNCTION: python_clean_py-compile_files
567
-# @USAGE: [-q|--quiet]
568
-# @DESCRIPTION:
569
-# Clean py-compile files to disable byte-compilation.
570
-python_clean_py-compile_files() {
571
-	_python_check_python_pkg_setup_execution
572
-
573
-	local file files=() quiet="0"
574
-
575
-	while (($#)); do
576
-		case "$1" in
577
-			-q|--quiet)
578
-				quiet="1"
579
-				;;
580
-			-*)
581
-				die "${FUNCNAME}(): Unrecognized option '$1'"
582
-				;;
583
-			*)
584
-				die "${FUNCNAME}(): Invalid usage"
585
-				;;
586
-		esac
587
-		shift
588
-	done
589
-
590
-	while read -d $'\0' -r file; do
591
-		files+=("${file#./}")
592
-	done < <(find -name py-compile -type f -print0)
593
-
594
-	for file in "${files[@]}"; do
595
-		if [[ "${quiet}" == "0" ]]; then
596
-			einfo "Cleaning '${file}' file"
597
-		fi
598
-		echo "#!/bin/sh" > "${file}"
599
-	done
600
-}
601
-
602
-# @FUNCTION: python_clean_installation_image
603
-# @USAGE: [-q|--quiet]
604
-# @DESCRIPTION:
605
-# Delete needless files in installation image.
606
-#
607
-# This function can be used only in src_install() phase.
608
-python_clean_installation_image() {
609
-	if [[ "${EBUILD_PHASE}" != "install" ]]; then
610
-		die "${FUNCNAME}() can be used only in src_install() phase"
611
-	fi
612
-
613
-	_python_check_python_pkg_setup_execution
614
-	_python_initialize_prefix_variables
615
-
616
-	local file files=() quiet="0"
617
-
618
-	while (($#)); do
619
-		case "$1" in
620
-			-q|--quiet)
621
-				quiet="1"
622
-				;;
623
-			-*)
624
-				die "${FUNCNAME}(): Unrecognized option '$1'"
625
-				;;
626
-			*)
627
-				die "${FUNCNAME}(): Invalid usage"
628
-				;;
629
-		esac
630
-		shift
631
-	done
632
-
633
-	while read -d $'\0' -r file; do
634
-		files+=("${file}")
635
-	done < <(find "${ED}" "(" -name "*.py[co]" -o -name "*\$py.class" ")" -type f -print0)
636
-
637
-	if [[ "${#files[@]}" -gt 0 ]]; then
638
-		if [[ "${quiet}" == "0" ]]; then
639
-			ewarn "Deleting byte-compiled Python modules needlessly generated by build system:"
640
-		fi
641
-		for file in "${files[@]}"; do
642
-			if [[ "${quiet}" == "0" ]]; then
643
-				ewarn " ${file}"
644
-			fi
645
-			rm -f "${file}"
646
-
647
-			# Delete empty __pycache__ directories.
648
-			if [[ "${file%/*}" == *"/__pycache__" ]]; then
649
-				rmdir "${file%/*}" 2> /dev/null
650
-			fi
651
-		done
652
-	fi
653
-
654
-	python_clean_sitedirs() {
655
-		if [[ -d "${ED}$(python_get_sitedir)" ]]; then
656
-			find "${ED}$(python_get_sitedir)" "(" -name "*.c" -o -name "*.h" -o -name "*.la" ")" -type f -print0 | xargs -0 rm -f
657
-		fi
658
-	}
659
-	if _python_package_supporting_installation_for_multiple_python_abis; then
660
-		python_execute_function -q python_clean_sitedirs
661
-	else
662
-		python_clean_sitedirs
663
-	fi
664
-
665
-	unset -f python_clean_sitedirs
666
-}
667
-
668
-# ================================================================================================
669
-# =========== FUNCTIONS FOR PACKAGES SUPPORTING INSTALLATION FOR MULTIPLE PYTHON ABIS ============
670
-# ================================================================================================
671
-
672
-# @ECLASS-VARIABLE: SUPPORT_PYTHON_ABIS
673
-# @DESCRIPTION:
674
-# Set this in EAPI <= 4 to indicate that current package supports installation for
675
-# multiple Python ABIs.
676
-
677
-# @ECLASS-VARIABLE: PYTHON_TESTS_RESTRICTED_ABIS
678
-# @DESCRIPTION:
679
-# Space-separated list of Python ABI patterns. Testing in Python ABIs matching any Python ABI
680
-# patterns specified in this list is skipped.
681
-
682
-# @ECLASS-VARIABLE: PYTHON_EXPORT_PHASE_FUNCTIONS
683
-# @DESCRIPTION:
684
-# Set this to export phase functions for the following ebuild phases:
685
-# src_prepare(), src_configure(), src_compile(), src_test(), src_install().
686
-if ! has "${EAPI:-0}" 0 1; then
687
-	python_src_prepare() {
688
-		if [[ "${EBUILD_PHASE}" != "prepare" ]]; then
689
-			die "${FUNCNAME}() can be used only in src_prepare() phase"
690
-		fi
691
-
692
-		if ! _python_package_supporting_installation_for_multiple_python_abis; then
693
-			die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
694
-		fi
695
-
696
-		_python_check_python_pkg_setup_execution
697
-
698
-		if [[ "$#" -ne 0 ]]; then
699
-			die "${FUNCNAME}() does not accept arguments"
700
-		fi
701
-
702
-		python_copy_sources
703
-	}
704
-
705
-	for python_default_function in src_configure src_compile src_test; do
706
-		eval "python_${python_default_function}() {
707
-			if [[ \"\${EBUILD_PHASE}\" != \"${python_default_function#src_}\" ]]; then
708
-				die \"\${FUNCNAME}() can be used only in ${python_default_function}() phase\"
709
-			fi
710
-
711
-			if ! _python_package_supporting_installation_for_multiple_python_abis; then
712
-				die \"\${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs\"
713
-			fi
714
-
715
-			_python_check_python_pkg_setup_execution
716
-
717
-			python_execute_function -d -s -- \"\$@\"
718
-		}"
719
-	done
720
-	unset python_default_function
721
-
722
-	python_src_install() {
723
-		if [[ "${EBUILD_PHASE}" != "install" ]]; then
724
-			die "${FUNCNAME}() can be used only in src_install() phase"
725
-		fi
726
-
727
-		if ! _python_package_supporting_installation_for_multiple_python_abis; then
728
-			die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
729
-		fi
730
-
731
-		_python_check_python_pkg_setup_execution
732
-
733
-		if has "${EAPI:-0}" 0 1 2 3; then
734
-			python_execute_function -d -s -- "$@"
735
-		else
736
-			python_installation() {
737
-				emake DESTDIR="${T}/images/${PYTHON_ABI}" install "$@"
738
-			}
739
-			python_execute_function -s python_installation "$@"
740
-			unset python_installation
741
-
742
-			python_merge_intermediate_installation_images "${T}/images"
743
-		fi
744
-	}
745
-
746
-	if [[ -n "${PYTHON_EXPORT_PHASE_FUNCTIONS}" ]]; then
747
-		EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
748
-	fi
749
-fi
750
-
751
-unset PYTHON_ABIS
752
-
753
-_python_calculate_PYTHON_ABIS() {
754
-	if ! _python_package_supporting_installation_for_multiple_python_abis; then
755
-		die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
756
-	fi
757
-
758
-	_python_initial_sanity_checks
759
-
760
-	if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]]; then
761
-		local PYTHON_ABI
762
-
763
-		if [[ "$(declare -p USE_PYTHON 2> /dev/null)" == "declare -x USE_PYTHON="* ]]; then
764
-			local cpython_enabled="0"
765
-
766
-			if [[ -z "${USE_PYTHON}" ]]; then
767
-				die "USE_PYTHON variable is empty"
768
-			fi
769
-
770
-			for PYTHON_ABI in ${USE_PYTHON}; do
771
-				if ! has "${PYTHON_ABI}" "${_PYTHON_GLOBALLY_SUPPORTED_ABIS[@]}"; then
772
-					die "USE_PYTHON variable contains invalid value '${PYTHON_ABI}'"
773
-				fi
774
-
775
-				if has "${PYTHON_ABI}" "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; then
776
-					cpython_enabled="1"
777
-				fi
778
-
779
-				if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
780
-					export PYTHON_ABIS+="${PYTHON_ABIS:+ }${PYTHON_ABI}"
781
-				fi
782
-			done
783
-
784
-			if [[ -z "${PYTHON_ABIS//[${IFS}]/}" ]]; then
785
-				die "USE_PYTHON variable does not enable any Python ABI supported by ${CATEGORY}/${PF}"
786
-			fi
787
-
788
-			if [[ "${cpython_enabled}" == "0" ]]; then
789
-				die "USE_PYTHON variable does not enable any CPython ABI"
790
-			fi
791
-		else
792
-			local python_version python2_version python3_version support_python_major_version
793
-
794
-			if ! has_version "dev-lang/python"; then
795
-				die "${FUNCNAME}(): 'dev-lang/python' is not installed"
796
-			fi
797
-
798
-			python_version="$("${EPREFIX}/usr/bin/python" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"
799
-
800
-			if has_version "=dev-lang/python-2*"; then
801
-				python2_version="$("${EPREFIX}/usr/bin/python2" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"
802
-
803
-				support_python_major_version="0"
804
-				for PYTHON_ABI in "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}"; do
805
-					if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
806
-						support_python_major_version="1"
807
-						break
808
-					fi
809
-				done
810
-				if [[ "${support_python_major_version}" == "1" ]]; then
811
-					if _python_check_python_abi_matching --patterns-list "${python2_version}" "${RESTRICT_PYTHON_ABIS}"; then
812
-						die "Active version of CPython 2 is not supported by ${CATEGORY}/${PF}"
813
-					fi
814
-				else
815
-					python2_version=""
816
-				fi
817
-			fi
818
-
819
-			if has_version "=dev-lang/python-3*"; then
820
-				python3_version="$("${EPREFIX}/usr/bin/python3" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"
821
-
822
-				support_python_major_version="0"
823
-				for PYTHON_ABI in "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; do
824
-					if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
825
-						support_python_major_version="1"
826
-						break
827
-					fi
828
-				done
829
-				if [[ "${support_python_major_version}" == "1" ]]; then
830
-					if _python_check_python_abi_matching --patterns-list "${python3_version}" "${RESTRICT_PYTHON_ABIS}"; then
831
-						die "Active version of CPython 3 is not supported by ${CATEGORY}/${PF}"
832
-					fi
833
-				else
834
-					python3_version=""
835
-				fi
836
-			fi
837
-
838
-			if [[ -z "${python2_version}" && -z "${python3_version}" ]]; then
839
-				eerror "${CATEGORY}/${PF} requires at least one of the following packages:"
840
-				for PYTHON_ABI in "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; do
841
-					if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
842
-						eerror "    dev-lang/python:${PYTHON_ABI}"
843
-					fi
844
-				done
845
-				die "No supported version of CPython installed"
846
-			fi
847
-
848
-			if [[ -n "${python2_version}" && "${python_version}" == "2."* && "${python_version}" != "${python2_version}" ]]; then
849
-				eerror "Python wrapper is configured incorrectly or '${EPREFIX}/usr/bin/python2' symlink"
850
-				eerror "is set incorrectly. Use \`eselect python\` to fix configuration."
851
-				die "Incorrect configuration of Python"
852
-			fi
853
-			if [[ -n "${python3_version}" && "${python_version}" == "3."* && "${python_version}" != "${python3_version}" ]]; then
854
-				eerror "Python wrapper is configured incorrectly or '${EPREFIX}/usr/bin/python3' symlink"
855
-				eerror "is set incorrectly. Use \`eselect python\` to fix configuration."
856
-				die "Incorrect configuration of Python"
857
-			fi
858
-
859
-			PYTHON_ABIS="${python2_version} ${python3_version}"
860
-			PYTHON_ABIS="${PYTHON_ABIS# }"
861
-			export PYTHON_ABIS="${PYTHON_ABIS% }"
862
-		fi
863
-	fi
864
-
865
-	_python_final_sanity_checks
866
-}
867
-
868
-_python_prepare_flags() {
869
-	local array=() deleted_flag element flags new_value old_flag old_value operator pattern prefix variable
870
-
871
-	for variable in CPPFLAGS CFLAGS CXXFLAGS LDFLAGS; do
872
-		eval "_PYTHON_SAVED_${variable}=\"\${!variable}\""
873
-		for prefix in PYTHON_USER_ PYTHON_; do
874
-			if [[ "$(declare -p ${prefix}${variable} 2> /dev/null)" == "declare -a ${prefix}${variable}="* ]]; then
875
-				eval "array=(\"\${${prefix}${variable}[@]}\")"
876
-				for element in "${array[@]}"; do
877
-					if [[ "${element}" =~ ^${_PYTHON_ABI_PATTERN_REGEX}\ (\+|-)\ .+ ]]; then
878
-						pattern="${element%% *}"
879
-						element="${element#* }"
880
-						operator="${element%% *}"
881
-						flags="${element#* }"
882
-						if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
883
-							if [[ "${operator}" == "+" ]]; then
884
-								eval "export ${variable}+=\"\${variable:+ }${flags}\""
885
-							elif [[ "${operator}" == "-" ]]; then
886
-								flags="${flags// /$'\n'}"
887
-								old_value="${!variable// /$'\n'}"
888
-								new_value=""
889
-								while read old_flag; do
890
-									while read deleted_flag; do
891
-										if [[ "${old_flag}" == ${deleted_flag} ]]; then
892
-											continue 2
893
-										fi
894
-									done <<< "${flags}"
895
-									new_value+="${new_value:+ }${old_flag}"
896
-								done <<< "${old_value}"
897
-								eval "export ${variable}=\"\${new_value}\""
898
-							fi
899
-						fi
900
-					else
901
-						die "Element '${element}' of ${prefix}${variable} array has invalid syntax"
902
-					fi
903
-				done
904
-			elif [[ -n "$(declare -p ${prefix}${variable} 2> /dev/null)" ]]; then
905
-				die "${prefix}${variable} should be indexed array"
906
-			fi
907
-		done
908
-	done
909
-}
910
-
911
-_python_restore_flags() {
912
-	local variable
913
-
914
-	for variable in CPPFLAGS CFLAGS CXXFLAGS LDFLAGS; do
915
-		eval "${variable}=\"\${_PYTHON_SAVED_${variable}}\""
916
-		unset _PYTHON_SAVED_${variable}
917
-	done
918
-}
919
-
920
-# @FUNCTION: python_execute_function
921
-# @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]
922
-# @DESCRIPTION:
923
-# Execute specified function for each value of PYTHON_ABIS, optionally passing additional
924
-# arguments. The specified function can use PYTHON_ABI and BUILDDIR variables.
925
-python_execute_function() {
926
-	if ! _python_package_supporting_installation_for_multiple_python_abis; then
927
-		die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
928
-	fi
929
-
930
-	_python_check_python_pkg_setup_execution
931
-	_python_set_color_variables
932
-
933
-	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
934
-
935
-	while (($#)); do
936
-		case "$1" in
937
-			--action-message)
938
-				action_message_template="$2"
939
-				shift
940
-				;;
941
-			-d|--default-function)
942
-				default_function="1"
943
-				;;
944
-			--failure-message)
945
-				failure_message_template="$2"
946
-				shift
947
-				;;
948
-			-f|--final-ABI)
949
-				final_ABI="1"
950
-				;;
951
-			--nonfatal)
952
-				nonfatal="1"
953
-				;;
954
-			-q|--quiet)
955
-				quiet="1"
956
-				;;
957
-			-s|--separate-build-dirs)
958
-				separate_build_dirs="1"
959
-				;;
960
-			--source-dir)
961
-				source_dir="$2"
962
-				shift
963
-				;;
964
-			--)
965
-				shift
966
-				break
967
-				;;
968
-			-*)
969
-				die "${FUNCNAME}(): Unrecognized option '$1'"
970
-				;;
971
-			*)
972
-				break
973
-				;;
974
-		esac
975
-		shift
976
-	done
977
-
978
-	if [[ -n "${source_dir}" && "${separate_build_dirs}" == 0 ]]; then
979
-		die "${FUNCNAME}(): '--source-dir' option can be specified only with '--separate-build-dirs' option"
980
-	fi
981
-
982
-	if [[ "${default_function}" == "0" ]]; then
983
-		if [[ "$#" -eq 0 ]]; then
984
-			die "${FUNCNAME}(): Missing function name"
985
-		fi
986
-		function="$1"
987
-		shift
988
-
989
-		if [[ -z "$(type -t "${function}")" ]]; then
990
-			die "${FUNCNAME}(): '${function}' function is not defined"
991
-		fi
992
-	else
993
-		if has "${EAPI:-0}" 0 1; then
994
-			die "${FUNCNAME}(): '--default-function' option cannot be used in this EAPI"
995
-		fi
996
-
997
-		if [[ "${EBUILD_PHASE}" == "configure" ]]; then
998
-			if has "${EAPI}" 2 3; then
999
-				python_default_function() {
1000
-					econf "$@"
1001
-				}
1002
-			else
1003
-				python_default_function() {
1004
-					nonfatal econf "$@"
1005
-				}
1006
-			fi
1007
-		elif [[ "${EBUILD_PHASE}" == "compile" ]]; then
1008
-			python_default_function() {
1009
-				emake "$@"
1010
-			}
1011
-		elif [[ "${EBUILD_PHASE}" == "test" ]]; then
1012
-			python_default_function() {
1013
-				# Stolen from portage's _eapi0_src_test()
1014
-				local emake_cmd="${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE}"
1015
-				if ${emake_cmd} -j1 -n check &> /dev/null; then
1016
-					${emake_cmd} -j1 check "$@"
1017
-				elif ${emake_cmd} -j1 -n test &> /dev/null; then
1018
-					${emake_cmd} -j1 test "$@"
1019
-				fi
1020
-			}
1021
-		elif [[ "${EBUILD_PHASE}" == "install" ]]; then
1022
-			python_default_function() {
1023
-				emake DESTDIR="${D}" install "$@"
1024
-			}
1025
-		else
1026
-			die "${FUNCNAME}(): '--default-function' option cannot be used in this ebuild phase"
1027
-		fi
1028
-		function="python_default_function"
1029
-	fi
1030
-
1031
-	# Ensure that python_execute_function() cannot be directly or indirectly called by python_execute_function().
1032
-	if _python_abi-specific_local_scope; then
1033
-		die "${FUNCNAME}(): Invalid call stack"
1034
-	fi
1035
-
1036
-	if [[ "${quiet}" == "0" ]]; then
1037
-		[[ "${EBUILD_PHASE}" == "setup" ]] && action="Setting up"
1038
-		[[ "${EBUILD_PHASE}" == "unpack" ]] && action="Unpacking"
1039
-		[[ "${EBUILD_PHASE}" == "prepare" ]] && action="Preparation"
1040
-		[[ "${EBUILD_PHASE}" == "configure" ]] && action="Configuration"
1041
-		[[ "${EBUILD_PHASE}" == "compile" ]] && action="Building"
1042
-		[[ "${EBUILD_PHASE}" == "test" ]] && action="Testing"
1043
-		[[ "${EBUILD_PHASE}" == "install" ]] && action="Installation"
1044
-		[[ "${EBUILD_PHASE}" == "preinst" ]] && action="Preinstallation"
1045
-		[[ "${EBUILD_PHASE}" == "postinst" ]] && action="Postinstallation"
1046
-		[[ "${EBUILD_PHASE}" == "prerm" ]] && action="Preuninstallation"
1047
-		[[ "${EBUILD_PHASE}" == "postrm" ]] && action="Postuninstallation"
1048
-	fi
1049
-
1050
-	_python_calculate_PYTHON_ABIS
1051
-	if [[ "${final_ABI}" == "1" ]]; then
1052
-		iterated_PYTHON_ABIS="$(PYTHON -f --ABI)"
1053
-	else
1054
-		iterated_PYTHON_ABIS="${PYTHON_ABIS}"
1055
-	fi
1056
-	for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
1057
-		if [[ "${EBUILD_PHASE}" == "test" ]] && _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${PYTHON_TESTS_RESTRICTED_ABIS}"; then
1058
-			if [[ "${quiet}" == "0" ]]; then
1059
-				echo " ${_GREEN}*${_NORMAL} ${_BLUE}Testing of ${CATEGORY}/${PF} with $(python_get_implementation_and_version) skipped${_NORMAL}"
1060
-			fi
1061
-			continue
1062
-		fi
1063
-
1064
-		_python_prepare_flags
1065
-
1066
-		if [[ "${quiet}" == "0" ]]; then
1067
-			if [[ -n "${action_message_template}" ]]; then
1068
-				eval "action_message=\"${action_message_template}\""
1069
-			else
1070
-				action_message="${action} of ${CATEGORY}/${PF} with $(python_get_implementation_and_version)..."
1071
-			fi
1072
-			echo " ${_GREEN}*${_NORMAL} ${_BLUE}${action_message}${_NORMAL}"
1073
-		fi
1074
-
1075
-		if [[ "${separate_build_dirs}" == "1" ]]; then
1076
-			if [[ -n "${source_dir}" ]]; then
1077
-				export BUILDDIR="${S}/${source_dir}-${PYTHON_ABI}"
1078
-			else
1079
-				export BUILDDIR="${S}-${PYTHON_ABI}"
1080
-			fi
1081
-			pushd "${BUILDDIR}" > /dev/null || die "pushd failed"
1082
-		else
1083
-			export BUILDDIR="${S}"
1084
-		fi
1085
-
1086
-		previous_directory="$(pwd)"
1087
-		previous_directory_stack="$(dirs -p)"
1088
-		previous_directory_stack_length="$(dirs -p | wc -l)"
1089
-
1090
-		if ! has "${EAPI}" 0 1 2 3 && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then
1091
-			EPYTHON="$(PYTHON)" nonfatal "${function}" "$@"
1092
-		else
1093
-			EPYTHON="$(PYTHON)" "${function}" "$@"
1094
-		fi
1095
-
1096
-		return_code="$?"
1097
-
1098
-		_python_restore_flags
1099
-
1100
-		if [[ "${return_code}" -ne 0 ]]; then
1101
-			if [[ -n "${failure_message_template}" ]]; then
1102
-				eval "failure_message=\"${failure_message_template}\""
1103
-			else
1104
-				failure_message="${action} failed with $(python_get_implementation_and_version) in ${function}() function"
1105
-			fi
1106
-
1107
-			if [[ "${nonfatal}" == "1" ]]; then
1108
-				if [[ "${quiet}" == "0" ]]; then
1109
-					ewarn "${failure_message}"
1110
-				fi
1111
-			elif [[ "${final_ABI}" == "0" ]] && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then
1112
-				if [[ "${EBUILD_PHASE}" != "test" ]] || ! has test-fail-continue ${FEATURES}; then
1113
-					local enabled_PYTHON_ABIS= other_PYTHON_ABI
1114
-					for other_PYTHON_ABI in ${PYTHON_ABIS}; do
1115
-						[[ "${other_PYTHON_ABI}" != "${PYTHON_ABI}" ]] && enabled_PYTHON_ABIS+="${enabled_PYTHON_ABIS:+ }${other_PYTHON_ABI}"
1116
-					done
1117
-					export PYTHON_ABIS="${enabled_PYTHON_ABIS}"
1118
-				fi
1119
-				if [[ "${quiet}" == "0" ]]; then
1120
-					ewarn "${failure_message}"
1121
-				fi
1122
-				if [[ -z "${PYTHON_ABIS}" ]]; then
1123
-					die "${function}() function failed with all enabled Python ABIs"
1124
-				fi
1125
-			else
1126
-				die "${failure_message}"
1127
-			fi
1128
-		fi
1129
-
1130
-		# Ensure that directory stack has not been decreased.
1131
-		if [[ "$(dirs -p | wc -l)" -lt "${previous_directory_stack_length}" ]]; then
1132
-			die "Directory stack decreased illegally"
1133
-		fi
1134
-
1135
-		# Avoid side effects of earlier returning from the specified function.
1136
-		while [[ "$(dirs -p | wc -l)" -gt "${previous_directory_stack_length}" ]]; do
1137
-			popd > /dev/null || die "popd failed"
1138
-		done
1139
-
1140
-		# Ensure that the bottom part of directory stack has not been changed. Restore
1141
-		# previous directory (from before running of the specified function) before
1142
-		# comparison of directory stacks to avoid mismatch of directory stacks after
1143
-		# potential using of 'cd' to change current directory. Restoration of previous
1144
-		# directory allows to safely use 'cd' to change current directory in the
1145
-		# specified function without changing it back to original directory.
1146
-		cd "${previous_directory}"
1147
-		if [[ "$(dirs -p)" != "${previous_directory_stack}" ]]; then
1148
-			die "Directory stack changed illegally"
1149
-		fi
1150
-
1151
-		if [[ "${separate_build_dirs}" == "1" ]]; then
1152
-			popd > /dev/null || die "popd failed"
1153
-		fi
1154
-		unset BUILDDIR
1155
-	done
1156
-
1157
-	if [[ "${default_function}" == "1" ]]; then
1158
-		unset -f python_default_function
1159
-	fi
1160
-}
1161
-
1162
-# @FUNCTION: python_copy_sources
1163
-# @USAGE: <directory="${S}"> [directory]
1164
-# @DESCRIPTION:
1165
-# Copy unpacked sources of current package to separate build directory for each Python ABI.
1166
-python_copy_sources() {
1167
-	if ! _python_package_supporting_installation_for_multiple_python_abis; then
1168
-		die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
1169
-	fi
1170
-
1171
-	_python_check_python_pkg_setup_execution
1172
-
1173
-	local dir dirs=() PYTHON_ABI
1174
-
1175
-	if [[ "$#" -eq 0 ]]; then
1176
-		if [[ "${WORKDIR}" == "${S}" ]]; then
1177
-			die "${FUNCNAME}() cannot be used with current value of S variable"
1178
-		fi
1179
-		dirs=("${S%/}")
1180
-	else
1181
-		dirs=("$@")
1182
-	fi
1183
-
1184
-	_python_calculate_PYTHON_ABIS
1185
-	for PYTHON_ABI in ${PYTHON_ABIS}; do
1186
-		for dir in "${dirs[@]}"; do
1187
-			cp -pr "${dir}" "${dir}-${PYTHON_ABI}" > /dev/null || die "Copying of sources failed"
1188
-		done
1189
-	done
1190
-}
1191
-
1192
-# @FUNCTION: python_generate_wrapper_scripts
1193
-# @USAGE: [-E|--respect-EPYTHON] [-f|--force] [-q|--quiet] [--] <file> [files]
1194
-# @DESCRIPTION:
1195
-# Generate wrapper scripts. Existing files are overwritten only with --force option.
1196
-# If --respect-EPYTHON option is specified, then generated wrapper scripts will
1197
-# respect EPYTHON variable at run time.
1198
-#
1199
-# This function can be used only in src_install() phase.
1200
-python_generate_wrapper_scripts() {
1201
-	if [[ "${EBUILD_PHASE}" != "install" ]]; then
1202
-		die "${FUNCNAME}() can be used only in src_install() phase"
1203
-	fi
1204
-
1205
-	if ! _python_package_supporting_installation_for_multiple_python_abis; then
1206
-		die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
1207
-	fi
1208
-
1209
-	_python_check_python_pkg_setup_execution
1210
-	_python_initialize_prefix_variables
1211
-
1212
-	local eselect_python_option file force="0" quiet="0" PYTHON_ABI PYTHON_ABIS_list python2_enabled="0" python3_enabled="0" respect_EPYTHON="0"
1213
-
1214
-	while (($#)); do
1215
-		case "$1" in
1216
-			-E|--respect-EPYTHON)
1217
-				respect_EPYTHON="1"
1218
-				;;
1219
-			-f|--force)
1220
-				force="1"
1221
-				;;
1222
-			-q|--quiet)
1223
-				quiet="1"
1224
-				;;
1225
-			--)
1226
-				shift
1227
-				break
1228
-				;;
1229
-			-*)
1230
-				die "${FUNCNAME}(): Unrecognized option '$1'"
1231
-				;;
1232
-			*)
1233
-				break
1234
-				;;
1235
-		esac
1236
-		shift
1237
-	done
1238
-
1239
-	if [[ "$#" -eq 0 ]]; then
1240
-		die "${FUNCNAME}(): Missing arguments"
1241
-	fi
1242
-
1243
-	_python_calculate_PYTHON_ABIS
1244
-	for PYTHON_ABI in "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}"; do
1245
-		if has "${PYTHON_ABI}" ${PYTHON_ABIS}; then
1246
-			python2_enabled="1"
1247
-		fi
1248
-	done
1249
-	for PYTHON_ABI in "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; do
1250
-		if has "${PYTHON_ABI}" ${PYTHON_ABIS}; then
1251
-			python3_enabled="1"
1252
-		fi
1253
-	done
1254
-
1255
-	if [[ "${python2_enabled}" == "1" && "${python3_enabled}" == "1" ]]; then
1256
-		eselect_python_option=
1257
-	elif [[ "${python2_enabled}" == "1" && "${python3_enabled}" == "0" ]]; then
1258
-		eselect_python_option="--python2"
1259
-	elif [[ "${python2_enabled}" == "0" && "${python3_enabled}" == "1" ]]; then
1260
-		eselect_python_option="--python3"
1261
-	else
1262
-		die "${FUNCNAME}(): Unsupported environment"
1263
-	fi
1264
-
1265
-	PYTHON_ABIS_list="$("$(PYTHON -f)" -c "print(', '.join('\"%s\"' % x for x in reversed('${PYTHON_ABIS}'.split())))")"
1266
-
1267
-	for file in "$@"; do
1268
-		if [[ -f "${file}" && "${force}" == "0" ]]; then
1269
-			die "${FUNCNAME}(): '${file}' already exists"
1270
-		fi
1271
-
1272
-		if [[ "${quiet}" == "0" ]]; then
1273
-			einfo "Generating '${file#${ED%/}}' wrapper script"
1274
-		fi
1275
-
1276
-		cat << EOF > "${file}"
1277
-#!/usr/bin/env python
1278
-# Gentoo '${file##*/}' wrapper script generated by python_generate_wrapper_scripts()
1279
-
1280
-import os
1281
-import re
1282
-import subprocess
1283
-import sys
1284
-
1285
-cpython_ABI_re = re.compile(r"^(\d+\.\d+)$")
1286
-jython_ABI_re = re.compile(r"^(\d+\.\d+)-jython$")
1287
-pypy_ABI_re = re.compile(r"^\d+\.\d+-pypy-(\d+\.\d+)$")
1288
-cpython_interpreter_re = re.compile(r"^python(\d+\.\d+)$")
1289
-jython_interpreter_re = re.compile(r"^jython(\d+\.\d+)$")
1290
-pypy_interpreter_re = re.compile(r"^pypy-c(\d+\.\d+)$")
1291
-cpython_shebang_re = re.compile(r"^#![ \t]*(?:${EPREFIX}/usr/bin/python|(?:${EPREFIX})?/usr/bin/env[ \t]+(?:${EPREFIX}/usr/bin/)?python)")
1292
-python_shebang_options_re = re.compile(r"^#![ \t]*${EPREFIX}/usr/bin/(?:jython|pypy-c|python)(?:\d+(?:\.\d+)?)?[ \t]+(-\S)")
1293
-python_verification_output_re = re.compile("^GENTOO_PYTHON_TARGET_SCRIPT_PATH supported\n$")
1294
-
1295
-#pypy_versions_mapping = {
1296
-#	"1.5": "2.7",
1297
-#	"1.6": "2.7",
1298
-#	"1.7": "2.7",
1299
-#	"1.8": "2.7",
1300
-#	"1.9": "2.7",
1301
-#	"2.0": "2.7",
1302
-#}
1303
-
1304
-def get_PYTHON_ABI(python_interpreter):
1305
-	cpython_matched = cpython_interpreter_re.match(python_interpreter)
1306
-	jython_matched = jython_interpreter_re.match(python_interpreter)
1307
-	pypy_matched = pypy_interpreter_re.match(python_interpreter)
1308
-	if cpython_matched is not None:
1309
-		PYTHON_ABI = cpython_matched.group(1)
1310
-	elif jython_matched is not None:
1311
-		PYTHON_ABI = jython_matched.group(1) + "-jython"
1312
-	elif pypy_matched is not None:
1313
-		#PYTHON_ABI = pypy_versions_mapping[pypy_matched.group(1)] + "-pypy-" + pypy_matched.group(1)
1314
-		PYTHON_ABI = "2.7-pypy-" + pypy_matched.group(1)
1315
-	else:
1316
-		PYTHON_ABI = None
1317
-	return PYTHON_ABI
1318
-
1319
-def get_python_interpreter(PYTHON_ABI):
1320
-	cpython_matched = cpython_ABI_re.match(PYTHON_ABI)
1321
-	jython_matched = jython_ABI_re.match(PYTHON_ABI)
1322
-	pypy_matched = pypy_ABI_re.match(PYTHON_ABI)
1323
-	if cpython_matched is not None:
1324
-		python_interpreter = "python" + cpython_matched.group(1)
1325
-	elif jython_matched is not None:
1326
-		python_interpreter = "jython" + jython_matched.group(1)
1327
-	elif pypy_matched is not None:
1328
-		python_interpreter = "pypy-c" + pypy_matched.group(1)
1329
-	else:
1330
-		python_interpreter = None
1331
-	return python_interpreter
1332
-
1333
-EOF
1334
-		if [[ "$?" != "0" ]]; then
1335
-			die "${FUNCNAME}(): Generation of '$1' failed"
1336
-		fi
1337
-		if [[ "${respect_EPYTHON}" == "1" ]]; then
1338
-			cat << EOF >> "${file}"
1339
-python_interpreter = os.environ.get("EPYTHON")
1340
-if python_interpreter:
1341
-	PYTHON_ABI = get_PYTHON_ABI(python_interpreter)
1342
-	if PYTHON_ABI is None:
1343
-		sys.stderr.write("%s: EPYTHON variable has unrecognized value '%s'\n" % (sys.argv[0], python_interpreter))
1344
-		sys.exit(1)
1345
-else:
1346
-	try:
1347
-		environment = os.environ.copy()
1348
-		environment["ROOT"] = "/"
1349
-		eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], env=environment, stdout=subprocess.PIPE)
1350
-		if eselect_process.wait() != 0:
1351
-			raise ValueError
1352
-	except (OSError, ValueError):
1353