public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Arfrever Frehtes Taifersar Arahesis (arfrever)" <arfrever@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in eclass: python.eclass
Date: Sat, 20 Mar 2010 17:59:40 +0000	[thread overview]
Message-ID: <E1Nt2xY-0002I4-Hm@stork.gentoo.org> (raw)

arfrever    10/03/20 17:59:40

  Modified:             python.eclass
  Log:
  Fix handling of PYTHON_USE_WITH_OPT in python_pkg_setup().
  Improve error messages in some functions.
  Delete python_set_build_dir_symlink().
  Fix wrapper scripts generated by python_generate_wrapper_scripts().
  Improve deprecation warnings in python_version(), python_mod_exists() and python_tkinter_exists().

Revision  Changes    Path
1.95                 eclass/python.eclass

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.95&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.95&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?r1=1.94&r2=1.95

Index: python.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- python.eclass	13 Mar 2010 13:46:20 -0000	1.94
+++ python.eclass	20 Mar 2010 17:59:40 -0000	1.95
@@ -1,6 +1,6 @@
 # Copyright 1999-2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.94 2010/03/13 13:46:20 arfrever Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.95 2010/03/20 17:59:40 arfrever Exp $
 
 # @ECLASS: python.eclass
 # @MAINTAINER:
@@ -198,7 +198,13 @@
 			die "${1}"
 		}
 
-		[[ ${PYTHON_USE_WITH_OPT} ]] && use !${PYTHON_USE_WITH_OPT} && return
+		if [[ "${PYTHON_USE_WITH_OPT}" ]]; then
+			if [[ "${PYTHON_USE_WITH_OPT}" == !* ]]; then
+				use ${PYTHON_USE_WITH_OPT#!} && return
+			else
+				use !${PYTHON_USE_WITH_OPT} && return
+			fi
+		fi
 
 		python_pkg_setup_check_USE_flags() {
 			local pyatom use
@@ -221,7 +227,7 @@
 			fi
 		}
 
-		if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+		if _python_package_supporting_installation_for_multiple_python_abis; then
 			python_execute_function -q python_pkg_setup_check_USE_flags
 		else
 			python_pkg_setup_check_USE_flags
@@ -261,13 +267,13 @@
 unset _PYTHON_ATOMS
 
 # ================================================================================================
-# ======== FUNCTIONS FOR PACKAGES SUPPORTING INSTALLATION FOR MULTIPLE VERSIONS OF PYTHON ========
+# =========== FUNCTIONS FOR PACKAGES SUPPORTING INSTALLATION FOR MULTIPLE PYTHON ABIS ============
 # ================================================================================================
 
 # @ECLASS-VARIABLE: SUPPORT_PYTHON_ABIS
 # @DESCRIPTION:
 # Set this in EAPI <= 4 to indicate that current package supports installation for
-# multiple versions of Python.
+# multiple Python ABIs.
 
 # @ECLASS-VARIABLE: PYTHON_EXPORT_PHASE_FUNCTIONS
 # @DESCRIPTION:
@@ -275,11 +281,19 @@
 # src_prepare, src_configure, src_compile, src_test, src_install.
 if ! has "${EAPI:-0}" 0 1; then
 	python_src_prepare() {
+		if ! _python_package_supporting_installation_for_multiple_python_abis; then
+			die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+		fi
+
 		python_copy_sources
 	}
 
 	for python_default_function in src_configure src_compile src_test src_install; do
 		eval "python_${python_default_function}() {
+			if ! _python_package_supporting_installation_for_multiple_python_abis; then
+				die \"\${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs\"
+			fi
+
 			python_execute_function -d -s \"\$@\"
 		}"
 	done
@@ -297,9 +311,8 @@
 # Ensure that PYTHON_ABIS variable has valid value.
 # This function usually should not be directly called in ebuilds.
 validate_PYTHON_ABIS() {
-	# Ensure that some functions cannot be accidentally successfully used in EAPI <= 4 without setting SUPPORT_PYTHON_ABIS variable.
-	if has "${EAPI:-0}" 0 1 2 3 4 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
-		die "${FUNCNAME}() cannot be used in this EAPI without setting SUPPORT_PYTHON_ABIS variable"
+	if ! _python_package_supporting_installation_for_multiple_python_abis; then
+		die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
 	fi
 
 	_python_initial_sanity_checks
@@ -336,11 +349,11 @@
 			done
 
 			if [[ -z "${PYTHON_ABIS//[${IFS}]/}" ]]; then
-				die "USE_PYTHON variable does not enable any version of Python supported by ${CATEGORY}/${PF}"
+				die "USE_PYTHON variable does not enable any Python ABI supported by ${CATEGORY}/${PF}"
 			fi
 
 			if [[ "${cpython_enabled}" == "0" ]]; then
-				die "USE_PYTHON variable does not enable any version of CPython"
+				die "USE_PYTHON variable does not enable any CPython ABI"
 			fi
 		else
 			local python_version python2_version= python3_version= support_python_major_version
@@ -427,6 +440,10 @@
 # Execute specified function for each value of PYTHON_ABIS, optionally passing additional
 # arguments. The specified function can use PYTHON_ABI and BUILDDIR variables.
 python_execute_function() {
+	if ! _python_package_supporting_installation_for_multiple_python_abis; then
+		die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+	fi
+
 	_python_set_color_variables
 
 	local action action_message action_message_template= default_function="0" failure_message failure_message_template= final_ABI="0" function i iterated_PYTHON_ABIS nonfatal="0" previous_directory previous_directory_stack previous_directory_stack_length PYTHON_ABI quiet="0" separate_build_dirs="0" source_dir=
@@ -525,6 +542,7 @@
 		function="python_default_function"
 	fi
 
+	# Ensure that python_execute_function() cannot be directly or indirectly called by python_execute_function().
 	for ((i = 1; i < "${#FUNCNAME[@]}"; i++)); do
 		if [[ "${FUNCNAME[${i}]}" == "${FUNCNAME}" ]]; then
 			die "${FUNCNAME}(): Invalid call stack"
@@ -605,7 +623,7 @@
 					ewarn "${_RED}${failure_message}${_NORMAL}"
 				fi
 				if [[ -z "${PYTHON_ABIS}" ]]; then
-					die "${function}() function failed with all enabled versions of Python"
+					die "${function}() function failed with all enabled Python ABIs"
 				fi
 			else
 				die "${failure_message}"
@@ -649,6 +667,10 @@
 # @DESCRIPTION:
 # Copy unpacked sources of current package to separate build directory for each Python ABI.
 python_copy_sources() {
+	if ! _python_package_supporting_installation_for_multiple_python_abis; then
+		die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+	fi
+
 	local dir dirs=() PYTHON_ABI
 
 	if [[ "$#" -eq 0 ]]; then
@@ -668,21 +690,6 @@
 	done
 }
 
-# @FUNCTION: python_set_build_dir_symlink
-# @USAGE: <directory="build">
-# @DESCRIPTION:
-# Create build directory symlink.
-python_set_build_dir_symlink() {
-	local dir="$1"
-
-	[[ -z "${PYTHON_ABI}" ]] && die "PYTHON_ABI variable not set"
-	[[ -z "${dir}" ]] && dir="build"
-
-	# Do not delete preexistent directories.
-	rm -f "${dir}" || die "Deletion of '${dir}' failed"
-	ln -s "${dir}-${PYTHON_ABI}" "${dir}" || die "Creation of '${dir}' directory symlink failed"
-}
-
 # @FUNCTION: python_generate_wrapper_scripts
 # @USAGE: [-E|--respect-EPYTHON] [-f|--force] [-q|--quiet] [--] <file> [files]
 # @DESCRIPTION:
@@ -690,6 +697,10 @@
 # If --respect-EPYTHON option is specified, then generated wrapper scripts will
 # respect EPYTHON variable at run time.
 python_generate_wrapper_scripts() {
+	if ! _python_package_supporting_installation_for_multiple_python_abis; then
+		die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+	fi
+
 	_python_initialize_prefix_variables
 
 	local eselect_python_option file force="0" quiet="0" PYTHON_ABI python2_enabled="0" python3_enabled="0" respect_EPYTHON="0"
@@ -790,16 +801,17 @@
 		sys.stderr.write("Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n")
 		sys.exit(1)
 
-	EPYTHON = eselect_process.stdout.read().rstrip("\n")
+	EPYTHON = eselect_process.stdout.read()
 	if not isinstance(EPYTHON, str):
 		# Python 3
 		EPYTHON = EPYTHON.decode()
+	EPYTHON = EPYTHON.rstrip("\n")
 
 	EPYTHON_matched = EPYTHON_re.match(EPYTHON)
 	if EPYTHON_matched:
 		PYTHON_ABI = EPYTHON_matched.group(1)
 	else:
-		sys.stderr.write("'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s" % EPYTHON)
+		sys.stderr.write("'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % EPYTHON)
 		sys.exit(1)
 EOF
 			if [[ "$?" != "0" ]]; then
@@ -815,16 +827,17 @@
 	sys.stderr.write("Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n")
 	sys.exit(1)
 
-EPYTHON = eselect_process.stdout.read().rstrip("\n")
+EPYTHON = eselect_process.stdout.read()
 if not isinstance(EPYTHON, str):
 	# Python 3
 	EPYTHON = EPYTHON.decode()
+EPYTHON = EPYTHON.rstrip("\n")
 
 EPYTHON_matched = EPYTHON_re.match(EPYTHON)
 if EPYTHON_matched:
 	PYTHON_ABI = EPYTHON_matched.group(1)
 else:
-	sys.stderr.write("'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s" % EPYTHON)
+	sys.stderr.write("'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % EPYTHON)
 	sys.exit(1)
 EOF
 			if [[ "$?" != "0" ]]; then
@@ -883,7 +896,7 @@
 }
 
 # ================================================================================================
-# ====== FUNCTIONS FOR PACKAGES NOT SUPPORTING INSTALLATION FOR MULTIPLE VERSIONS OF PYTHON ======
+# ========= FUNCTIONS FOR PACKAGES NOT SUPPORTING INSTALLATION FOR MULTIPLE PYTHON ABIS ==========
 # ================================================================================================
 
 # @FUNCTION: python_set_active_version
@@ -891,8 +904,8 @@
 # @DESCRIPTION:
 # Set specified version of CPython as active version of Python.
 python_set_active_version() {
-	if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
-		die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple versions of Python"
+	if _python_package_supporting_installation_for_multiple_python_abis; then
+		die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
 	fi
 
 	if [[ "$#" -ne 1 ]]; then
@@ -935,8 +948,8 @@
 # @DESCRIPTION: Mark current package for rebuilding by python-updater after
 # switching of active version of Python.
 python_need_rebuild() {
-	if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
-		die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple versions of Python"
+	if _python_package_supporting_installation_for_multiple_python_abis; then
+		die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
 	fi
 
 	export PYTHON_NEED_REBUILD="$(PYTHON --ABI)"
@@ -1023,8 +1036,8 @@
 
 	if [[ "$#" -eq 0 ]]; then
 		if [[ "${final_ABI}" == "1" ]]; then
-			if has "${EAPI:-0}" 0 1 2 3 4 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
-				die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple versions of Python"
+			if ! _python_package_supporting_installation_for_multiple_python_abis; then
+				die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
 			fi
 			validate_PYTHON_ABIS
 			PYTHON_ABI="${PYTHON_ABIS##* }"
@@ -1042,7 +1055,7 @@
 			elif [[ "${PYTHON_ABI}" != "3."* ]]; then
 				die "${FUNCNAME}(): Internal error in \`eselect python show --python3\`"
 			fi
-		elif [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
+		elif ! _python_package_supporting_installation_for_multiple_python_abis; then
 			PYTHON_ABI="$("${EPREFIX}/usr/bin/python" -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")"
 		elif [[ -z "${PYTHON_ABI}" ]]; then
 			die "${FUNCNAME}(): Invalid usage: ${FUNCNAME}() should be used in ABI-specific local scope"
@@ -1108,6 +1121,9 @@
 	done
 
 	if [[ "${final_ABI}" == "1" ]]; then
+		if ! _python_package_supporting_installation_for_multiple_python_abis; then
+			die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+		fi
 		PYTHON_ABI="$(PYTHON -f --ABI)"
 	elif [[ -z "${PYTHON_ABI}" ]]; then
 		PYTHON_ABI="$(PYTHON --ABI)"
@@ -1140,6 +1156,9 @@
 	done
 
 	if [[ "${final_ABI}" == "1" ]]; then
+		if ! _python_package_supporting_installation_for_multiple_python_abis; then
+			die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+		fi
 		PYTHON_ABI="$(PYTHON -f --ABI)"
 	elif [[ -z "${PYTHON_ABI}" ]]; then
 		PYTHON_ABI="$(PYTHON --ABI)"
@@ -1176,6 +1195,9 @@
 	done
 
 	if [[ "${final_ABI}" == "1" ]]; then
+		if ! _python_package_supporting_installation_for_multiple_python_abis; then
+			die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+		fi
 		PYTHON_ABI="$(PYTHON -f --ABI)"
 	elif [[ -z "${PYTHON_ABI}" ]]; then
 		PYTHON_ABI="$(PYTHON --ABI)"
@@ -1212,6 +1234,9 @@
 	done
 
 	if [[ "${final_ABI}" == "1" ]]; then
+		if ! _python_package_supporting_installation_for_multiple_python_abis; then
+			die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+		fi
 		PYTHON_ABI="$(PYTHON -f --ABI)"
 	elif [[ -z "${PYTHON_ABI}" ]]; then
 		PYTHON_ABI="$(PYTHON --ABI)"
@@ -1235,6 +1260,9 @@
 	while (($#)); do
 		case "$1" in
 			-f|--final-ABI)
+				if ! _python_package_supporting_installation_for_multiple_python_abis; then
+					die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+				fi
 				options+=("$1")
 				;;
 			-*)
@@ -1278,6 +1306,9 @@
 	done
 
 	if [[ "${final_ABI}" == "1" ]]; then
+		if ! _python_package_supporting_installation_for_multiple_python_abis; then
+			die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+		fi
 		PYTHON_ABI="$(PYTHON -f --ABI)"
 	elif [[ -z "${PYTHON_ABI}" ]]; then
 		PYTHON_ABI="$(PYTHON --ABI)"
@@ -1356,6 +1387,9 @@
 	fi
 
 	if [[ "${final_ABI}" == "1" ]]; then
+		if ! _python_package_supporting_installation_for_multiple_python_abis; then
+			die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+		fi
 		"$(PYTHON -f)" -c "${python_command}"
 	else
 		"$(PYTHON ${PYTHON_ABI})" -c "${python_command}"
@@ -1376,6 +1410,22 @@
 	fi
 }
 
+_python_package_supporting_installation_for_multiple_python_abis() {
+	if [[ "${EBUILD_PHASE}" == "depend" ]]; then
+		die "${FUNCNAME}() cannot be used in global scope"
+	fi
+
+	if has "${EAPI:-0}" 0 1 2 3 4; then
+		if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+			return 0
+		else
+			return 1
+		fi
+	else
+		die "${FUNCNAME}(): Support for EAPI=\"${EAPI}\" not implemented"
+	fi
+}
+
 _python_initialize_prefix_variables() {
 	if has "${EAPI:-0}" 0 1 2; then
 		if [[ -n "${ROOT}" && -z "${EROOT}" ]]; then
@@ -1495,11 +1545,9 @@
 			files+=("${argument}")
 		elif [[ -d "${argument}" ]]; then
 			if [[ "${recursive}" == "1" ]]; then
-				if [[ "${only_executables}" == "1" ]]; then
-					files+=($(find "${argument}" -perm /111 -type f))
-				else
-					files+=($(find "${argument}" -type f))
-				fi
+				while read -d $'\0' -r file; do
+					files+=("${file}")
+				done < <(find "${argument}" $([[ "${only_executables}" == "1" ]] && echo -perm /111) -type f -print0)
 			else
 				die "${FUNCNAME}(): '${argument}' is not a regular file"
 			fi
@@ -1551,7 +1599,7 @@
 		die "${FUNCNAME}() requires 1 argument"
 	fi
 
-	if [[ -n "${SUPPORT_PYTHON_ABIS}" && "$(type -t "${FUNCNAME[3]}_$1_hook")" == "function" ]]; then
+	if _python_package_supporting_installation_for_multiple_python_abis && [[ "$(type -t "${FUNCNAME[3]}_$1_hook")" == "function" ]]; then
 		"${FUNCNAME[3]}_$1_hook"
 	fi
 }
@@ -1559,9 +1607,9 @@
 # @FUNCTION: python_execute_nosetests
 # @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments]
 # @DESCRIPTION:
-# Execute nosetests for all enabled versions of Python.
-# In ebuilds of packages supporting installation for multiple versions of Python, this function
-# calls python_execute_nosetests_pre_hook() and python_execute_nosetests_post_hook(), if they are defined.
+# Execute nosetests for all enabled Python ABIs.
+# In ebuilds of packages supporting installation for multiple Python ABIs, this function calls
+# python_execute_nosetests_pre_hook() and python_execute_nosetests_post_hook(), if they are defined.
 python_execute_nosetests() {
 	_python_set_color_variables
 
@@ -1612,7 +1660,7 @@
 
 		_python_test_hook post
 	}
-	if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+	if _python_package_supporting_installation_for_multiple_python_abis; then
 		python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
 	else
 		if [[ -n "${separate_build_dirs}" ]]; then
@@ -1627,9 +1675,9 @@
 # @FUNCTION: python_execute_py.test
 # @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments]
 # @DESCRIPTION:
-# Execute py.test for all enabled versions of Python.
-# In ebuilds of packages supporting installation for multiple versions of Python, this function
-# calls python_execute_py.test_pre_hook() and python_execute_py.test_post_hook(), if they are defined.
+# Execute py.test for all enabled Python ABIs.
+# In ebuilds of packages supporting installation for multiple Python ABIs, this function calls
+# python_execute_py.test_pre_hook() and python_execute_py.test_post_hook(), if they are defined.
 python_execute_py.test() {
 	_python_set_color_variables
 
@@ -1680,7 +1728,7 @@
 
 		_python_test_hook post
 	}
-	if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+	if _python_package_supporting_installation_for_multiple_python_abis; then
 		python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
 	else
 		if [[ -n "${separate_build_dirs}" ]]; then
@@ -1695,8 +1743,8 @@
 # @FUNCTION: python_execute_trial
 # @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments]
 # @DESCRIPTION:
-# Execute trial for all enabled versions of Python.
-# In ebuilds of packages supporting installation for multiple versions of Python, this function
+# Execute trial for all enabled Python ABIs.
+# In ebuilds of packages supporting installation for multiple Python ABIs, this function
 # calls python_execute_trial_pre_hook() and python_execute_trial_post_hook(), if they are defined.
 python_execute_trial() {
 	_python_set_color_variables
@@ -1748,7 +1796,7 @@
 
 		_python_test_hook post
 	}
-	if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+	if _python_package_supporting_installation_for_multiple_python_abis; then
 		python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
 	else
 		if [[ -n "${separate_build_dirs}" ]]; then
@@ -1797,9 +1845,9 @@
 	_python_initialize_prefix_variables
 
 	# Check if phase is pkg_postinst().
-	[[ ${EBUILD_PHASE} != "postinst" ]] && die "${FUNCNAME}() can be used only in pkg_postinst() phase"
+	[[ "${EBUILD_PHASE}" != "postinst" ]] && die "${FUNCNAME}() can be used only in pkg_postinst() phase"
 
-	if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+	if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
 		local dir file options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_absolute_dirs=() site_packages_dirs=() site_packages_absolute_files=() site_packages_files=()
 
 		# Strip trailing slash from ROOT.
@@ -1975,13 +2023,13 @@
 	local path py_file PYTHON_ABI="${PYTHON_ABI}" SEARCH_PATH=() root
 
 	# Check if phase is pkg_postrm().
-	[[ ${EBUILD_PHASE} != "postrm" ]] && die "${FUNCNAME}() can be used only in pkg_postrm() phase"
+	[[ "${EBUILD_PHASE}" != "postrm" ]] && die "${FUNCNAME}() can be used only in pkg_postrm() phase"
 
 	# Strip trailing slash from ROOT.
 	root="${EROOT%/}"
 
 	if (($#)); then
-		if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+		if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
 			while (($#)); do
 				if ! _python_implementation && [[ "$1" =~ ^"${EPREFIX}"/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then
 					die "${FUNCNAME}() does not support absolute paths of directories/files in site-packages directories"
@@ -2058,17 +2106,25 @@
 # Run without arguments and it will export the version of python
 # currently in use as $PYVER; sets PYVER/PYVER_MAJOR/PYVER_MINOR
 python_version() {
-	if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+	if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
 		eerror "Use PYTHON() and/or python_get_*() instead of ${FUNCNAME}()."
 		die "${FUNCNAME}() cannot be used in this EAPI"
 	fi
 
+	_python_set_color_variables
+
 	if [[ "${FUNCNAME[1]}" != "distutils_python_version" ]]; then
-		einfo
-		einfo "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01."
-		einfo "Use PYTHON() instead of python variable. Use python_get_*() instead of PYVER* variables."
-		einfo "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
-		einfo
+		echo
+		echo " ${_RED}*${_NORMAL} ${_RED}Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01.${_NORMAL}"
+		echo " ${_RED}*${_NORMAL} ${_RED}Use PYTHON() instead of python variable. Use python_get_*() instead of PYVER* variables.${_NORMAL}"
+		echo " ${_RED}*${_NORMAL} ${_RED}The ebuild needs to be fixed. Please report a bug, if it has not been already reported.${_NORMAL}"
+		echo
+
+		einfo &> /dev/null
+		einfo "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01." &> /dev/null
+		einfo "Use PYTHON() instead of python variable. Use python_get_*() instead of PYVER* variables." &> /dev/null
+		einfo "The ebuild needs to be fixed. Please report a bug, if it has not been already reported." &> /dev/null
+		einfo &> /dev/null
 	fi
 
 	[[ -n "${PYVER}" ]] && return 0
@@ -2097,16 +2153,22 @@
 #             echo "gtk support enabled"
 #         fi
 python_mod_exists() {
-	if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+	if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
 		eerror "Use USE dependencies and/or has_version() instead of ${FUNCNAME}()."
 		die "${FUNCNAME}() cannot be used in this EAPI"
 	fi
 
-	einfo
-	einfo "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01."
-	einfo "Use USE dependencies and/or has_version() instead of ${FUNCNAME}()."
-	einfo "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
-	einfo
+	echo
+	echo " ${_RED}*${_NORMAL} ${_RED}Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01.${_NORMAL}"
+	echo " ${_RED}*${_NORMAL} ${_RED}Use USE dependencies and/or has_version() instead of ${FUNCNAME}().${_NORMAL}"
+	echo " ${_RED}*${_NORMAL} ${_RED}The ebuild needs to be fixed. Please report a bug, if it has not been already reported.${_NORMAL}"
+	echo
+
+	einfo &> /dev/null
+	einfo "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01." &> /dev/null
+	einfo "Use USE dependencies and/or has_version() instead of ${FUNCNAME}()." &> /dev/null
+	einfo "The ebuild needs to be fixed. Please report a bug, if it has not been already reported." &> /dev/null
+	einfo &> /dev/null
 
 	if [[ "$#" -ne 1 ]]; then
 		die "${FUNCNAME}() requires 1 argument"
@@ -2119,17 +2181,23 @@
 # Run without arguments, checks if Python was compiled with Tkinter
 # support.  If not, prints an error message and dies.
 python_tkinter_exists() {
-	if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+	if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
 		eerror "Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}()."
 		die "${FUNCNAME}() cannot be used in this EAPI"
 	fi
 
 	if [[ "${FUNCNAME[1]}" != "distutils_python_tkinter" ]]; then
-		einfo
-		einfo "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01."
-		einfo "Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}()."
-		einfo "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
-		einfo
+		echo
+		echo " ${_RED}*${_NORMAL} ${_RED}Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01.${_NORMAL}"
+		echo " ${_RED}*${_NORMAL} ${_RED}Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}().${_NORMAL}"
+		echo " ${_RED}*${_NORMAL} ${_RED}The ebuild needs to be fixed. Please report a bug, if it has not been already reported.${_NORMAL}"
+		echo
+
+		einfo &> /dev/null
+		einfo "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01." &> /dev/null
+		einfo "Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}()." &> /dev/null
+		einfo "The ebuild needs to be fixed. Please report a bug, if it has not been already reported." &> /dev/null
+		einfo &> /dev/null
 	fi
 
 	if ! "$(PYTHON ${PYTHON_ABI})" -c "from sys import version_info
@@ -2154,7 +2222,7 @@
 #         python_mod_compile /usr/lib/python2.3/site-packages/pygoogle.py
 #
 python_mod_compile() {
-	if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+	if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
 		eerror "Use python_mod_optimize() instead of ${FUNCNAME}()."
 		die "${FUNCNAME}() cannot be used in this EAPI"
 	fi
@@ -2164,7 +2232,7 @@
 	local f myroot myfiles=()
 
 	# Check if phase is pkg_postinst()
-	[[ ${EBUILD_PHASE} != postinst ]] && die "${FUNCNAME}() can be used only in pkg_postinst() phase"
+	[[ "${EBUILD_PHASE}" != "postinst" ]] && die "${FUNCNAME}() can be used only in pkg_postinst() phase"
 
 	# strip trailing slash
 	myroot="${EROOT%/}"






             reply	other threads:[~2010-03-20 17:59 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-20 17:59 Arfrever Frehtes Taifersar Arahesis (arfrever) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-02-06  5:34 [gentoo-commits] gentoo-x86 commit in eclass: python.eclass Mike Frysinger (vapier)
2011-12-19  1:29 Robin H. Johnson (robbat2)
2011-11-30  8:55 Dirkjan Ochtman (djc)
2011-11-18 23:37 Mike Frysinger (vapier)
2011-10-15 20:58 PaweA Hajdan (phajdan.jr)
2011-10-07 10:57 Dirkjan Ochtman (djc)
2011-10-07 10:55 Dirkjan Ochtman (djc)
2011-10-07 10:53 Dirkjan Ochtman (djc)
2011-10-07 10:52 Dirkjan Ochtman (djc)
2011-10-07 10:49 Dirkjan Ochtman (djc)
2011-10-07 10:48 Dirkjan Ochtman (djc)
2011-09-10 13:48 Dirkjan Ochtman (djc)
2011-08-19 12:16 Fabio Erculiani (lxnay)
2011-08-19 10:18 Fabio Erculiani (lxnay)
2011-08-19 10:10 Fabio Erculiani (lxnay)
2011-07-08  7:49 Dirkjan Ochtman (djc)
2011-07-08  7:48 Dirkjan Ochtman (djc)
2011-07-08  7:47 Dirkjan Ochtman (djc)
2011-07-08  7:46 Dirkjan Ochtman (djc)
2011-07-08  7:44 Dirkjan Ochtman (djc)
2011-07-08  7:43 Dirkjan Ochtman (djc)
2011-07-08  7:41 Dirkjan Ochtman (djc)
2011-07-08  7:40 Dirkjan Ochtman (djc)
2011-07-08  7:39 Dirkjan Ochtman (djc)
2011-07-08  7:37 Dirkjan Ochtman (djc)
2011-07-04 11:28 Dirkjan Ochtman (djc)
2011-07-04 11:27 Dirkjan Ochtman (djc)
2011-07-04 11:27 Dirkjan Ochtman (djc)
2011-07-04 11:00 Dirkjan Ochtman (djc)
2011-07-04 10:59 Dirkjan Ochtman (djc)
2011-07-04 10:50 Dirkjan Ochtman (djc)
2011-07-04 10:48 Dirkjan Ochtman (djc)
2011-03-10 17:49 Arfrever Frehtes Taifersar Arahesis (arfrever)
2011-02-14 20:46 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-12-31 21:51 Jonathan Callen (abcd)
2010-12-26 11:30 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-12-24 15:01 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-10-29 19:09 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-10-25 11:54 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-10-03  0:38 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-07-18 20:45 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-07-17 23:02 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-05-29 16:39 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-05-25 19:49 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-05-25 15:04 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-05-17 18:01 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-03-26 15:23 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-03-13 13:46 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-03-12 18:27 Petteri Raty (betelgeuse)
2010-03-04 17:42 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-02-28 15:49 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-02-28 11:48 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-02-14 18:53 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-02-11 18:52 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-02-02 18:55 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-01-15 14:46 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-01-14 19:23 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-01-11 16:07 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-01-10 17:03 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-12-23 23:43 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-11-22 16:45 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-11-22 13:48 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-11-15 22:00 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-11-15 14:25 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-10-11 13:34 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-10-02 23:09 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-10-02 17:32 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-10-02  2:02 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-09-18 17:50 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-09-11 19:55 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-09-09  4:16 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-09-05 17:30 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-08-31 23:58 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-08-31  0:07 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-08-29  2:15 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-08-28 16:08 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-08-15 23:32 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-08-15 21:50 Petteri Raty (betelgeuse)
2009-08-14 21:22 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-08-13 16:57 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-08-07  0:43 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-08-05 18:31 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-08-04 21:01 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-08-03 22:28 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-08-02 16:56 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-05-27 22:49 Petteri Raty (betelgeuse)
2008-10-30  5:21 Zac Medico (zmedico)
2008-10-27 12:23 Ali Polatel (hawking)
2008-10-27  0:17 Ali Polatel (hawking)
2008-10-26 21:54 Ali Polatel (hawking)
2008-10-26 21:21 Ali Polatel (hawking)
2008-10-26 17:46 Ali Polatel (hawking)
2008-10-26 17:34 Ali Polatel (hawking)
2008-10-26 17:26 Ali Polatel (hawking)
2008-10-26 17:11 Ali Polatel (hawking)
2008-09-01 14:11 Ali Polatel (hawking)
2008-08-29 19:28 Ali Polatel (hawking)
2008-08-01 22:22 Rob Cakebread (pythonhead)
2008-07-28 21:56 Rob Cakebread (pythonhead)
2008-05-30  9:58 Ali Polatel (hawking)
2008-05-29 22:03 Ali Polatel (hawking)
2008-05-29 21:19 Ali Polatel (hawking)
2008-05-29 20:01 Ali Polatel (hawking)
2008-05-29 18:36 Ali Polatel (hawking)
2008-05-29 15:24 Ali Polatel (hawking)
2008-05-29 14:10 Ali Polatel (hawking)
2008-03-28  7:11 Ali Polatel (hawking)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1Nt2xY-0002I4-Hm@stork.gentoo.org \
    --to=arfrever@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox