public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Patch for python.eclass
@ 2010-09-20  1:18 Arfrever Frehtes Taifersar Arahesis
  2010-09-24 17:39 ` Arfrever Frehtes Taifersar Arahesis
  0 siblings, 1 reply; 18+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2010-09-20  1:18 UTC (permalink / raw
  To: Gentoo Development; +Cc: qa


[-- Attachment #1.1: Type: Text/Plain, Size: 1630 bytes --]

This patch for python.eclass has been divided into 3 subpatches to simplify review.

Subpatch #1 fixes preservation of whitespace.

Subpatch #2 renames 2 local arrays in python_mod_optimize() function:
  site_packages_absolute_dirs  -> dirs
  site_packages_absolute_files -> files

Subpatch #3 adds --allow-evaluated-non-sitedir-paths option to python_mod_optimize() and
python_mod_cleanup() functions.
In rare cases, packages supporting installation for multiple Python ABIs install .py files
outside of site-packages directories. python_mod_optimize() and python_mod_cleanup()
functions currently don't support such paths. It's better to not allow such paths by
default, so this subpatch adds new --allow-evaluated-non-sitedir-paths option to these
functions. This option is disallowed in packages not supporting installation for multiple
Python ABIs. Such paths are internally evaluated inside these functions. Such paths work
correctly only if they contain '${PYTHON_ABI}' or '$(python_get_version)' (probably with
'$(python_get_implementation)') or '$(custom_function)' (where custom_function() uses
"${PYTHON_ABI}" or "$(python_get_version)" and prints appropriate output), so there are
sanity checks, which ensure that such paths contain '$'.

Example usage:

pkg_postinst() {
    python_mod_optimize --allow-evaluated-non-sitedir-paths '/usr/share/package_name/${PYTHON_ABI}'
}

pkg_postrm() {
    python_mod_cleanup --allow-evaluated-non-sitedir-paths '/usr/share/package_name/${PYTHON_ABI}'
}

This functionality is needed by Zope 2.12 / 2.13.

-- 
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #1.2: python.eclass.patch --]
[-- Type: text/x-patch, Size: 10021 bytes --]

--- python.eclass
+++ python.eclass
@@ -925,7 +925,7 @@
 
 		if [[ "${quiet}" == "0" ]]; then
 			if [[ -n "${action_message_template}" ]]; then
-				action_message="$(eval echo -n "${action_message_template}")"
+				eval "action_message=\"${action_message_template}\""
 			else
 				action_message="${action} of ${CATEGORY}/${PF} with $(python_get_implementation) $(python_get_version)..."
 			fi
@@ -959,7 +959,7 @@
 
 		if [[ "${return_code}" -ne 0 ]]; then
 			if [[ -n "${failure_message_template}" ]]; then
-				failure_message="$(eval echo -n "${failure_message_template}")"
+				eval "failure_message=\"${failure_message_template}\""
 			else
 				failure_message="${action} failed with $(python_get_implementation) $(python_get_version) in ${function}() function"
 			fi
@@ -1925,7 +1925,7 @@
 	python_test_function() {
 		local evaluated_PYTHONPATH
 
-		evaluated_PYTHONPATH="$(eval echo -n "${PYTHONPATH_template}")"
+		eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
 
 		_python_test_hook pre
 
@@ -1989,7 +1989,7 @@
 	python_test_function() {
 		local evaluated_PYTHONPATH
 
-		evaluated_PYTHONPATH="$(eval echo -n "${PYTHONPATH_template}")"
+		eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
 
 		_python_test_hook pre
 
@@ -2053,7 +2053,7 @@
 	python_test_function() {
 		local evaluated_PYTHONPATH
 
-		evaluated_PYTHONPATH="$(eval echo -n "${PYTHONPATH_template}")"
+		eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
 
 		_python_test_hook pre
 
@@ -2223,7 +2223,7 @@
 
 	if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
 		# PYTHON_ABI variable cannot be local in packages not supporting installation for multiple Python ABIs.
-		local dir file iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_absolute_dirs=() site_packages_dirs=() site_packages_absolute_files=() site_packages_files=()
+		local allow_evaluated_non_sitedir_paths="0" dir dirs=() evaluated_dirs=() evaluated_files=() file files=() iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_dirs=() site_packages_files=()
 
 		if _python_package_supporting_installation_for_multiple_python_abis; then
 			if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then
@@ -2243,6 +2243,9 @@
 
 		while (($#)); do
 			case "$1" in
+				--allow-evaluated-non-sitedir-paths)
+					allow_evaluated_non_sitedir_paths="1"
+					;;
 				-l|-f|-q)
 					options+=("$1")
 					;;
@@ -2264,6 +2267,10 @@
 			shift
 		done
 
+		if [[ "${allow_evaluated_non_sitedir_paths}" == "1" ]] && ! _python_package_supporting_installation_for_multiple_python_abis; then
+			die "${FUNCNAME}(): '--allow-evaluated-non-sitedir-paths' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+		fi
+
 		if [[ "$#" -eq 0 ]]; then
 			ewarn
 			ewarn "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be"
@@ -2279,16 +2286,27 @@
 				die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories"
 			elif [[ "$1" =~ ^/ ]]; then
 				if _python_package_supporting_installation_for_multiple_python_abis; then
-					die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
-				fi
-				if [[ -d "${root}$1" ]]; then
-					other_dirs+=("${root}$1")
-				elif [[ -f "${root}$1" ]]; then
-					other_files+=("${root}$1")
-				elif [[ -e "${root}$1" ]]; then
-					eerror "${FUNCNAME}(): '${root}$1' is not a regular file or a directory"
+					if [[ "${allow_evaluated_non_sitedir_paths}" != "1" ]]; then
+						die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
+					fi
+					if [[ "$1" != *\$* ]]; then
+						die "${FUNCNAME}(): '$1' has invalid syntax"
+					fi
+					if [[ "$1" == *.py ]]; then
+						evaluated_files+=("$1")
+					else
+						evaluated_dirs+=("$1")
+					fi
 				else
-					eerror "${FUNCNAME}(): '${root}$1' does not exist"
+					if [[ -d "${root}$1" ]]; then
+						other_dirs+=("${root}$1")
+					elif [[ -f "${root}$1" ]]; then
+						other_files+=("${root}$1")
+					elif [[ -e "${root}$1" ]]; then
+						eerror "${FUNCNAME}(): '${root}$1' is not a regular file or a directory"
+					else
+						eerror "${FUNCNAME}(): '${root}$1' does not exist"
+					fi
 				fi
 			else
 				for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
@@ -2312,32 +2330,38 @@
 		options+=("-q")
 
 		for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
-			if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})); then
+			if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})) || ((${#evaluated_dirs[@]})) || ((${#evaluated_files[@]})); then
 				return_code="0"
 				ebegin "Compilation and optimization of Python modules for $(python_get_implementation) $(python_get_version)"
-				if ((${#site_packages_dirs[@]})); then
+				if ((${#site_packages_dirs[@]})) || ((${#evaluated_dirs[@]})); then
 					for dir in "${site_packages_dirs[@]}"; do
-						site_packages_absolute_dirs+=("${root}$(python_get_sitedir)/${dir}")
+						dirs+=("${root}$(python_get_sitedir)/${dir}")
 					done
-					"$(PYTHON)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${site_packages_absolute_dirs[@]}" || return_code="1"
+					for dir in "${evaluated_dirs[@]}"; do
+						eval "dirs+=(\"\${root}${dir}\")"
+					done
+					"$(PYTHON)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${dirs[@]}" || return_code="1"
 					if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
-						"$(PYTHON)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${site_packages_absolute_dirs[@]}" &> /dev/null || return_code="1"
+						"$(PYTHON)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1"
 					fi
-					_python_clean_compiled_modules "${site_packages_absolute_dirs[@]}"
+					_python_clean_compiled_modules "${dirs[@]}"
 				fi
-				if ((${#site_packages_files[@]})); then
+				if ((${#site_packages_files[@]})) || ((${#evaluated_files[@]})); then
 					for file in "${site_packages_files[@]}"; do
-						site_packages_absolute_files+=("${root}$(python_get_sitedir)/${file}")
+						files+=("${root}$(python_get_sitedir)/${file}")
+					done
+					for file in "${evaluated_files[@]}"; do
+						eval "files+=(\"\${root}${file}\")"
 					done
-					"$(PYTHON)" "${root}$(python_get_libdir)/py_compile.py" "${site_packages_absolute_files[@]}" || return_code="1"
+					"$(PYTHON)" "${root}$(python_get_libdir)/py_compile.py" "${files[@]}" || return_code="1"
 					if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
-						"$(PYTHON)" -O "${root}$(python_get_libdir)/py_compile.py" "${site_packages_absolute_files[@]}" &> /dev/null || return_code="1"
+						"$(PYTHON)" -O "${root}$(python_get_libdir)/py_compile.py" "${files[@]}" &> /dev/null || return_code="1"
 					fi
-					_python_clean_compiled_modules "${site_packages_absolute_files[@]}"
+					_python_clean_compiled_modules "${files[@]}"
 				fi
 				eend "${return_code}"
 			fi
-			unset site_packages_absolute_dirs site_packages_absolute_files
+			unset dirs files
 		done
 
 		if _python_package_supporting_installation_for_multiple_python_abis; then
@@ -2459,7 +2483,7 @@
 	_python_check_python_pkg_setup_execution
 	_python_initialize_prefix_variables
 
-	local dir iterated_PYTHON_ABIS PYTHON_ABI="${PYTHON_ABI}" root search_paths=() sitedir
+	local allow_evaluated_non_sitedir_paths="0" dir iterated_PYTHON_ABIS PYTHON_ABI="${PYTHON_ABI}" root search_paths=() sitedir
 
 	# Check if phase is pkg_postrm().
 	[[ "${EBUILD_PHASE}" != "postrm" ]] && die "${FUNCNAME}() can be used only in pkg_postrm() phase"
@@ -2480,6 +2504,29 @@
 	# Strip trailing slash from EROOT.
 	root="${EROOT%/}"
 
+	while (($#)); do
+		case "$1" in
+			--allow-evaluated-non-sitedir-paths)
+				allow_evaluated_non_sitedir_paths="1"
+				;;
+			--)
+				shift
+				break
+				;;
+			-*)
+				die "${FUNCNAME}(): Unrecognized option '$1'"
+				;;
+			*)
+				break
+				;;
+		esac
+		shift
+	done
+
+	if [[ "${allow_evaluated_non_sitedir_paths}" == "1" ]] && ! _python_package_supporting_installation_for_multiple_python_abis; then
+		die "${FUNCNAME}(): '--allow-evaluated-non-sitedir-paths' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+	fi
+
 	if [[ "$#" -gt 0 ]]; then
 		if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
 			while (($#)); do
@@ -2489,9 +2536,18 @@
 					die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories"
 				elif [[ "$1" =~ ^/ ]]; then
 					if _python_package_supporting_installation_for_multiple_python_abis; then
-						die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
+						if [[ "${allow_evaluated_non_sitedir_paths}" != "1" ]]; then
+							die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
+						fi
+						if [[ "$1" != *\$* ]]; then
+							die "${FUNCNAME}(): '$1' has invalid syntax"
+						fi
+						for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
+							eval "search_paths+=(\"\${root}$1\")"
+						done
+					else
+						search_paths+=("${root}$1")
 					fi
-					search_paths+=("${root}$1")
 				else
 					for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
 						search_paths+=("${root}$(python_get_sitedir)/$1")

[-- Attachment #1.3: python.eclass.patch.1 --]
[-- Type: text/x-patch, Size: 1532 bytes --]

--- python.eclass
+++ python.eclass
@@ -925,7 +925,7 @@
 
 		if [[ "${quiet}" == "0" ]]; then
 			if [[ -n "${action_message_template}" ]]; then
-				action_message="$(eval echo -n "${action_message_template}")"
+				eval "action_message=\"${action_message_template}\""
 			else
 				action_message="${action} of ${CATEGORY}/${PF} with $(python_get_implementation) $(python_get_version)..."
 			fi
@@ -959,7 +959,7 @@
 
 		if [[ "${return_code}" -ne 0 ]]; then
 			if [[ -n "${failure_message_template}" ]]; then
-				failure_message="$(eval echo -n "${failure_message_template}")"
+				eval "failure_message=\"${failure_message_template}\""
 			else
 				failure_message="${action} failed with $(python_get_implementation) $(python_get_version) in ${function}() function"
 			fi
@@ -1925,7 +1925,7 @@
 	python_test_function() {
 		local evaluated_PYTHONPATH
 
-		evaluated_PYTHONPATH="$(eval echo -n "${PYTHONPATH_template}")"
+		eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
 
 		_python_test_hook pre
 
@@ -1989,7 +1989,7 @@
 	python_test_function() {
 		local evaluated_PYTHONPATH
 
-		evaluated_PYTHONPATH="$(eval echo -n "${PYTHONPATH_template}")"
+		eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
 
 		_python_test_hook pre
 
@@ -2053,7 +2053,7 @@
 	python_test_function() {
 		local evaluated_PYTHONPATH
 
-		evaluated_PYTHONPATH="$(eval echo -n "${PYTHONPATH_template}")"
+		eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
 
 		_python_test_hook pre
 

[-- Attachment #1.4: python.eclass.patch.2 --]
[-- Type: text/x-patch, Size: 3143 bytes --]

--- python.eclass
+++ python.eclass
@@ -2223,7 +2223,7 @@
 
 	if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
 		# PYTHON_ABI variable cannot be local in packages not supporting installation for multiple Python ABIs.
-		local dir file iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_absolute_dirs=() site_packages_dirs=() site_packages_absolute_files=() site_packages_files=()
+		local dir dirs=() file files=() iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_dirs=() site_packages_files=()
 
 		if _python_package_supporting_installation_for_multiple_python_abis; then
 			if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then
@@ -2317,27 +2317,27 @@
 				ebegin "Compilation and optimization of Python modules for $(python_get_implementation) $(python_get_version)"
 				if ((${#site_packages_dirs[@]})); then
 					for dir in "${site_packages_dirs[@]}"; do
-						site_packages_absolute_dirs+=("${root}$(python_get_sitedir)/${dir}")
+						dirs+=("${root}$(python_get_sitedir)/${dir}")
 					done
-					"$(PYTHON)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${site_packages_absolute_dirs[@]}" || return_code="1"
+					"$(PYTHON)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${dirs[@]}" || return_code="1"
 					if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
-						"$(PYTHON)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${site_packages_absolute_dirs[@]}" &> /dev/null || return_code="1"
+						"$(PYTHON)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1"
 					fi
-					_python_clean_compiled_modules "${site_packages_absolute_dirs[@]}"
+					_python_clean_compiled_modules "${dirs[@]}"
 				fi
 				if ((${#site_packages_files[@]})); then
 					for file in "${site_packages_files[@]}"; do
-						site_packages_absolute_files+=("${root}$(python_get_sitedir)/${file}")
+						files+=("${root}$(python_get_sitedir)/${file}")
 					done
-					"$(PYTHON)" "${root}$(python_get_libdir)/py_compile.py" "${site_packages_absolute_files[@]}" || return_code="1"
+					"$(PYTHON)" "${root}$(python_get_libdir)/py_compile.py" "${files[@]}" || return_code="1"
 					if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
-						"$(PYTHON)" -O "${root}$(python_get_libdir)/py_compile.py" "${site_packages_absolute_files[@]}" &> /dev/null || return_code="1"
+						"$(PYTHON)" -O "${root}$(python_get_libdir)/py_compile.py" "${files[@]}" &> /dev/null || return_code="1"
 					fi
-					_python_clean_compiled_modules "${site_packages_absolute_files[@]}"
+					_python_clean_compiled_modules "${files[@]}"
 				fi
 				eend "${return_code}"
 			fi
-			unset site_packages_absolute_dirs site_packages_absolute_files
+			unset dirs files
 		done
 
 		if _python_package_supporting_installation_for_multiple_python_abis; then

[-- Attachment #1.5: python.eclass.patch.3 --]
[-- Type: text/x-patch, Size: 7349 bytes --]

--- python.eclass
+++ python.eclass
@@ -2223,7 +2223,7 @@
 
 	if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
 		# PYTHON_ABI variable cannot be local in packages not supporting installation for multiple Python ABIs.
-		local dir dirs=() file files=() iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_dirs=() site_packages_files=()
+		local allow_evaluated_non_sitedir_paths="0" dir dirs=() evaluated_dirs=() evaluated_files=() file files=() iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_dirs=() site_packages_files=()
 
 		if _python_package_supporting_installation_for_multiple_python_abis; then
 			if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then
@@ -2243,6 +2243,9 @@
 
 		while (($#)); do
 			case "$1" in
+				--allow-evaluated-non-sitedir-paths)
+					allow_evaluated_non_sitedir_paths="1"
+					;;
 				-l|-f|-q)
 					options+=("$1")
 					;;
@@ -2264,6 +2267,10 @@
 			shift
 		done
 
+		if [[ "${allow_evaluated_non_sitedir_paths}" == "1" ]] && ! _python_package_supporting_installation_for_multiple_python_abis; then
+			die "${FUNCNAME}(): '--allow-evaluated-non-sitedir-paths' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+		fi
+
 		if [[ "$#" -eq 0 ]]; then
 			ewarn
 			ewarn "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be"
@@ -2279,16 +2286,27 @@
 				die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories"
 			elif [[ "$1" =~ ^/ ]]; then
 				if _python_package_supporting_installation_for_multiple_python_abis; then
-					die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
-				fi
-				if [[ -d "${root}$1" ]]; then
-					other_dirs+=("${root}$1")
-				elif [[ -f "${root}$1" ]]; then
-					other_files+=("${root}$1")
-				elif [[ -e "${root}$1" ]]; then
-					eerror "${FUNCNAME}(): '${root}$1' is not a regular file or a directory"
+					if [[ "${allow_evaluated_non_sitedir_paths}" != "1" ]]; then
+						die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
+					fi
+					if [[ "$1" != *\$* ]]; then
+						die "${FUNCNAME}(): '$1' has invalid syntax"
+					fi
+					if [[ "$1" == *.py ]]; then
+						evaluated_files+=("$1")
+					else
+						evaluated_dirs+=("$1")
+					fi
 				else
-					eerror "${FUNCNAME}(): '${root}$1' does not exist"
+					if [[ -d "${root}$1" ]]; then
+						other_dirs+=("${root}$1")
+					elif [[ -f "${root}$1" ]]; then
+						other_files+=("${root}$1")
+					elif [[ -e "${root}$1" ]]; then
+						eerror "${FUNCNAME}(): '${root}$1' is not a regular file or a directory"
+					else
+						eerror "${FUNCNAME}(): '${root}$1' does not exist"
+					fi
 				fi
 			else
 				for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
@@ -2312,23 +2330,29 @@
 		options+=("-q")
 
 		for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
-			if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})); then
+			if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})) || ((${#evaluated_dirs[@]})) || ((${#evaluated_files[@]})); then
 				return_code="0"
 				ebegin "Compilation and optimization of Python modules for $(python_get_implementation) $(python_get_version)"
-				if ((${#site_packages_dirs[@]})); then
+				if ((${#site_packages_dirs[@]})) || ((${#evaluated_dirs[@]})); then
 					for dir in "${site_packages_dirs[@]}"; do
 						dirs+=("${root}$(python_get_sitedir)/${dir}")
 					done
+					for dir in "${evaluated_dirs[@]}"; do
+						eval "dirs+=(\"\${root}${dir}\")"
+					done
 					"$(PYTHON)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${dirs[@]}" || return_code="1"
 					if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
 						"$(PYTHON)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1"
 					fi
 					_python_clean_compiled_modules "${dirs[@]}"
 				fi
-				if ((${#site_packages_files[@]})); then
+				if ((${#site_packages_files[@]})) || ((${#evaluated_files[@]})); then
 					for file in "${site_packages_files[@]}"; do
 						files+=("${root}$(python_get_sitedir)/${file}")
 					done
+					for file in "${evaluated_files[@]}"; do
+						eval "files+=(\"\${root}${file}\")"
+					done
 					"$(PYTHON)" "${root}$(python_get_libdir)/py_compile.py" "${files[@]}" || return_code="1"
 					if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
 						"$(PYTHON)" -O "${root}$(python_get_libdir)/py_compile.py" "${files[@]}" &> /dev/null || return_code="1"
@@ -2459,7 +2483,7 @@
 	_python_check_python_pkg_setup_execution
 	_python_initialize_prefix_variables
 
-	local dir iterated_PYTHON_ABIS PYTHON_ABI="${PYTHON_ABI}" root search_paths=() sitedir
+	local allow_evaluated_non_sitedir_paths="0" dir iterated_PYTHON_ABIS PYTHON_ABI="${PYTHON_ABI}" root search_paths=() sitedir
 
 	# Check if phase is pkg_postrm().
 	[[ "${EBUILD_PHASE}" != "postrm" ]] && die "${FUNCNAME}() can be used only in pkg_postrm() phase"
@@ -2480,6 +2504,29 @@
 	# Strip trailing slash from EROOT.
 	root="${EROOT%/}"
 
+	while (($#)); do
+		case "$1" in
+			--allow-evaluated-non-sitedir-paths)
+				allow_evaluated_non_sitedir_paths="1"
+				;;
+			--)
+				shift
+				break
+				;;
+			-*)
+				die "${FUNCNAME}(): Unrecognized option '$1'"
+				;;
+			*)
+				break
+				;;
+		esac
+		shift
+	done
+
+	if [[ "${allow_evaluated_non_sitedir_paths}" == "1" ]] && ! _python_package_supporting_installation_for_multiple_python_abis; then
+		die "${FUNCNAME}(): '--allow-evaluated-non-sitedir-paths' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+	fi
+
 	if [[ "$#" -gt 0 ]]; then
 		if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
 			while (($#)); do
@@ -2489,9 +2536,18 @@
 					die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories"
 				elif [[ "$1" =~ ^/ ]]; then
 					if _python_package_supporting_installation_for_multiple_python_abis; then
-						die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
+						if [[ "${allow_evaluated_non_sitedir_paths}" != "1" ]]; then
+							die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
+						fi
+						if [[ "$1" != *\$* ]]; then
+							die "${FUNCNAME}(): '$1' has invalid syntax"
+						fi
+						for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
+							eval "search_paths+=(\"\${root}$1\")"
+						done
+					else
+						search_paths+=("${root}$1")
 					fi
-					search_paths+=("${root}$1")
 				else
 					for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
 						search_paths+=("${root}$(python_get_sitedir)/$1")

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [gentoo-dev] Patch for python.eclass
  2010-09-20  1:18 Arfrever Frehtes Taifersar Arahesis
@ 2010-09-24 17:39 ` Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 18+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2010-09-24 17:39 UTC (permalink / raw
  To: Gentoo Development; +Cc: qa

[-- Attachment #1: Type: Text/Plain, Size: 133 bytes --]

I will commit this patch in 3 days, if there are no other suggestions about this patch.

-- 
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [gentoo-dev] Patch for python.eclass
@ 2010-10-18  1:33 Arfrever Frehtes Taifersar Arahesis
  2010-10-18  7:06 ` [gentoo-dev] " Mike Frysinger
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2010-10-18  1:33 UTC (permalink / raw
  To: Gentoo Development; +Cc: qa


[-- Attachment #1.1: Type: Text/Plain, Size: 2664 bytes --]

This patch for python.eclass is divided into 10 subpatches.

Subpatch #1 adds section header, renames a private function for consistency with other private
functions and adds unsetting of this private function after its using.

Subpatch #2 causes that dev-lang/python and sys-apps/portage don't use deprecated parts of
python_mod_optimize() and python_mod_cleanup(). This change can be safely made, because these
packages install .py files outside of site-packages directories.

Subpatch #3 adds some comments in python_mod_optimize() and python_mod_cleanup() to simplify
future work on python.eclass.

Subpatch #4 adds initial support for using of USE flags for representation of Python ABIs
in EAPI >=4. Appropriate USE flags will be automatically added to IUSE when SUPPORT_PYTHON_ABIS
variable has been set before inheriting python.eclass. python_add_abi_dependencies() function
will be used inside DEPEND/RDEPEND/PDEPEND to get appropriate dependency atoms.

Example usage:
  RDEPEND="net-libs/gnutls
      $(python_add_abi_dependencies ">=dev-python/PyQt4-4.7.7[svg]")
      $(python_add_abi_dependencies -e "2.7 3.[2-9]" dev-python/argparse)"
  DEPEND="${RDEPEND}
      $(python_add_abi_dependencies dev-python/setuptools)
      $(python_add_abi_dependencies -i "3.*" net-zope/zope-fixers)
      test? ( $(python_add_abi_dependencies dev-python/py) )"

argparse module is included in Python 2.7 and >=3.2, so dev-python/argparse is needed only with
older Python versions. net-zope/zope-fixers is needed only with Python 3.

Subpatch #5 improves some code used in older EAPIs.

Subpatch #6 bans python_mod_compile() function (in older EAPIs), which has been deprecated for
almost 5 months (since 2010-05-25). This function isn't used in the tree.

Subpatch #7 fixes a typo in python_mod_optimize().

Subpatch #8 bans NEED_PYTHON variable (in older EAPIs), which has been deprecated for over
3 months (since 2010-07-17). This variable isn't used in the tree.

Subpatch #9 disallows not passing of paths to Python modules to python_mod_optimize() and
python_mod_cleanup(). Not passing of paths to Python modules to these functions has been
deprecated for almost 5 months (since 2010-05-25). Paths to Python modules are passed to these
functions in all ebuilds in the tree. The change in python_mod_cleanup() results in some
reindentation.

Subpatch #10 fixes exporting of python_pkg_setup() in EAPI >=4.

There will be other changes in API of python.eclass in EAPI >=4, so python.eclass still doesn't
support EAPI="4".

I'm planning to commit this patch in 1 week.

-- 
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #1.2: python.eclass.patch --]
[-- Type: text/x-patch, Size: 23073 bytes --]

--- python.eclass
+++ python.eclass
@@ -18,6 +18,36 @@
 _CPYTHON2_SUPPORTED_ABIS=(2.4 2.5 2.6 2.7)
 _CPYTHON3_SUPPORTED_ABIS=(3.0 3.1 3.2)
 _JYTHON_SUPPORTED_ABIS=(2.5-jython)
+_PYTHON_SUPPORTED_ABIS=(${_CPYTHON2_SUPPORTED_ABIS[@]} ${_CPYTHON3_SUPPORTED_ABIS[@]} ${_JYTHON_SUPPORTED_ABIS[@]})
+
+# ================================================================================================
+# ===================================== HANDLING OF METADATA =====================================
+# ================================================================================================
+
+_python_set_IUSE() {
+	local PYTHON_ABI restricted_ABI restricted_ABIs support_ABI
+
+	_PYTHON_ABIS_USE_FLAGS=""
+	restricted_ABIs="${RESTRICT_PYTHON_ABIS// /$'\n'}"
+
+	for PYTHON_ABI in "${_PYTHON_SUPPORTED_ABIS[@]}"; do
+		support_ABI="1"
+		while read restricted_ABI; do
+			if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then
+				support_ABI="0"
+				break
+			fi
+		done <<< "${restricted_ABIs}"
+		[[ "${support_ABI}" == "1" ]] && _PYTHON_ABIS_USE_FLAGS+="${_PYTHON_ABIS_USE_FLAGS:+ }python_abis_${PYTHON_ABI}"
+	done
+
+	IUSE="${_PYTHON_ABIS_USE_FLAGS}"
+}
+
+if ! has "${EAPI:-0}" 0 1 2 3 && [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+	_python_set_IUSE
+fi
+unset -f _python_set_IUSE
 
 # @ECLASS-VARIABLE: PYTHON_DEPEND
 # @DESCRIPTION:
@@ -29,7 +59,7 @@
 #   minimal_version:           <minimal_major_version.minimal_minor_version>
 #   maximal_version:           <maximal_major_version.maximal_minor_version>
 
-_parse_PYTHON_DEPEND() {
+_python_parse_PYTHON_DEPEND() {
 	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
 
 	version_components_group_regex="(2|3|\*)(:([[:digit:]]+\.[[:digit:]]+)?(:([[:digit:]]+\.[[:digit:]]+)?)?)?"
@@ -155,31 +185,17 @@
 DEPEND=">=app-admin/eselect-python-20091230"
 RDEPEND="${DEPEND}"
 
-if [[ -n "${PYTHON_DEPEND}" && -n "${NEED_PYTHON}" ]]; then
-	die "PYTHON_DEPEND and NEED_PYTHON cannot be set simultaneously"
-elif [[ -n "${PYTHON_DEPEND}" ]]; then
-	_parse_PYTHON_DEPEND
-elif [[ -n "${NEED_PYTHON}" ]]; then
-	if ! has "${EAPI:-0}" 0 1 2; then
-		eerror "Use PYTHON_DEPEND variable instead of NEED_PYTHON variable."
-		die "NEED_PYTHON variable cannot be used in this EAPI"
-	fi
-
-	ewarn
-	ewarn "\"${EBUILD}\":"
-	ewarn "Deprecation Warning: NEED_PYTHON variable is deprecated and will be banned on 2010-10-01."
-	ewarn "Use PYTHON_DEPEND variable instead of NEED_PYTHON variable."
-	ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
-	ewarn
-
-	unset _BOLD _NORMAL
-
-	_PYTHON_ATOMS=(">=dev-lang/python-${NEED_PYTHON}")
-	DEPEND+="${DEPEND:+ }${_PYTHON_ATOMS[@]}"
-	RDEPEND+="${RDEPEND:+ }${_PYTHON_ATOMS[@]}"
+if [[ -n "${PYTHON_DEPEND}" ]]; then
+	_python_parse_PYTHON_DEPEND
 else
 	_PYTHON_ATOMS=("dev-lang/python")
 fi
+unset -f _python_parse_PYTHON_DEPEND
+
+if [[ -n "${NEED_PYTHON}" ]]; then
+	eerror "Use PYTHON_DEPEND variable instead of NEED_PYTHON variable."
+	die "NEED_PYTHON variable is banned"
+fi
 
 # @ECLASS-VARIABLE: PYTHON_USE_WITH
 # @DESCRIPTION:
@@ -223,6 +239,135 @@
 
 unset _PYTHON_ATOMS
 
+# @FUNCTION: python_add_abi_dependencies
+# @USAGE: [-e|--exclude-ABIs Python_ABIs] [-i|--include-ABIs Python_ABIs] [--] <dependency_atom> [dependency_atoms]
+# @DESCRIPTION:
+# Print dependency atoms with USE dependencies for Python ABIs added.
+# If --exclude-ABIs option is specified, then Python ABIs matching its argument are not used.
+# If --include-ABIs option is specified, then only Python ABIs matching its argument are used.
+# --exclude-ABIs and --include-ABIs options cannot be specified simultaneously.
+python_add_abi_dependencies() {
+	local atom atom_index atoms=() exclude_ABIs="0" excluded_ABI excluded_ABIs include_ABIs="0" included_ABI included_ABIs support_ABI USE_dependencies USE_flag USE_flag_index USE_flags=()
+
+	if has "${EAPI:-0}" 0 1 2 3; then
+		die "${FUNCNAME}() cannot be used in this EAPI"
+	fi
+
+	if [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
+		die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+	fi
+
+	while (($#)); do
+		case "$1" in
+			-e|--exclude-ABIs)
+				exclude_ABIs="1"
+				excluded_ABIs="${2// /$'\n'}"
+				shift
+				;;
+			-i|--include-ABIs)
+				include_ABIs="1"
+				included_ABIs="${2// /$'\n'}"
+				shift
+				;;
+			--)
+				shift
+				break
+				;;
+			-*)
+				die "${FUNCNAME}(): Unrecognized option '$1'"
+				;;
+			*)
+				break
+				;;
+		esac
+		shift
+	done
+
+	if [[ "${exclude_ABIs}" == "1" && "${include_ABIs}" == "1" ]]; then
+		die "${FUNCNAME}(): '--exclude-ABIs' and '--include-ABIs' options cannot be specified simultaneously"
+	fi
+
+	if [[ "$#" -eq 0 ]]; then
+		die "${FUNCNAME}(): Missing dependency atoms"
+	fi
+
+	atoms=("$@")
+
+	if [[ "${exclude_ABIs}" == "0" && "${include_ABIs}" == "0" ]]; then
+		USE_dependencies="$(printf ",%s?" ${_PYTHON_ABIS_USE_FLAGS})"
+		USE_dependencies="${USE_dependencies#,}"
+
+		for atom_index in "${!atoms[@]}"; do
+			atom="${atoms[${atom_index}]}"
+
+			if [[ "${atom}" == *"["*"]" ]]; then
+				echo -n "${atom%]},"
+			else
+				echo -n "${atom}["
+			fi
+			echo -n "${USE_dependencies}]"
+
+			if [[ "${atom_index}" -ne $((${#atoms[@]} - 1)) ]]; then
+				echo -n " "
+			fi
+		done
+	else
+		if [[ "${exclude_ABIs}" == "1" ]]; then
+			for USE_flag in ${_PYTHON_ABIS_USE_FLAGS}; do
+				while read excluded_ABI; do
+				support_ABI="1"
+					if [[ "${USE_flag}" == python_abis_${excluded_ABI} ]]; then
+						support_ABI="0"
+						break
+					fi
+				done <<< "${excluded_ABIs}"
+			[[ "${support_ABI}" == "1" ]] && USE_flags+=("${USE_flag}")
+			done
+		elif [[ "${include_ABIs}" == "1" ]]; then
+			for USE_flag in ${_PYTHON_ABIS_USE_FLAGS}; do
+				while read included_ABI; do
+				support_ABI="0"
+					if [[ "${USE_flag}" == python_abis_${included_ABI} ]]; then
+						support_ABI="1"
+						break
+					fi
+				done <<< "${included_ABIs}"
+			[[ "${support_ABI}" == "1" ]] && USE_flags+=("${USE_flag}")
+			done
+		else
+			die "${FUNCNAME}(): Internal error"
+		fi
+
+		for USE_flag_index in "${!USE_flags[@]}"; do
+			USE_flag="${USE_flags[${USE_flag_index}]}"
+			USE_dependencies="${USE_flag}"
+
+			echo -n "${USE_flag}? ( "
+
+			for atom_index in "${!atoms[@]}"; do
+				atom="${atoms[${atom_index}]}"
+
+				if [[ "${atom}" == *"["*"]" ]]; then
+					echo -n "${atom%]},"
+				else
+					echo -n "${atom}["
+				fi
+				echo -n "${USE_dependencies}]"
+
+				if [[ "${atom_index}" -ne $((${#atoms[@]} - 1)) ]]; then
+					echo -n " "
+				fi
+			done
+
+			echo -n " )"
+
+			if [[ "${USE_flag_index}" -ne $((${#USE_flags[@]} - 1)) ]]; then
+				echo -n " "
+			fi
+		done
+	fi
+}
+
 # ================================================================================================
 # =================================== MISCELLANEOUS FUNCTIONS ====================================
 # ================================================================================================
@@ -410,7 +555,7 @@
 	PYTHON_PKG_SETUP_EXECUTED="1"
 }
 
-if ! has "${EAPI:-0}" 0 1 2 3 || has "${EAPI:-0}" 2 3 && [[ -n "${PYTHON_USE_WITH}" || -n "${PYTHON_USE_WITH_OR}" ]]; then
+if ! has "${EAPI:-0}" 0 1 2 3 || { has "${EAPI:-0}" 2 3 && [[ -n "${PYTHON_USE_WITH}" || -n "${PYTHON_USE_WITH_OR}" ]]; }; then
 	EXPORT_FUNCTIONS pkg_setup
 fi
 
@@ -603,7 +748,9 @@
 	fi
 fi
 
-unset PYTHON_ABIS
+if has "${EAPI:-0}" 0 1 2 3; then
+	unset PYTHON_ABIS
+fi
 
 _python_calculate_PYTHON_ABIS() {
 	if ! _python_package_supporting_installation_for_multiple_python_abis; then
@@ -612,10 +759,10 @@
 
 	_python_initial_sanity_checks
 
-	# USE_${ABI_TYPE^^} and RESTRICT_${ABI_TYPE^^}_ABIS variables hopefully will be included in EAPI >= 5.
-	if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3 4; then
-		local PYTHON_ABI restricted_ABI support_ABI supported_PYTHON_ABIS=
-		PYTHON_ABI_SUPPORTED_VALUES="${_CPYTHON2_SUPPORTED_ABIS[@]} ${_CPYTHON3_SUPPORTED_ABIS[@]} ${_JYTHON_SUPPORTED_ABIS[@]}"
+	if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3; then
+		local PYTHON_ABI restricted_ABI restricted_ABIs support_ABI supported_PYTHON_ABIS
+
+		restricted_ABIs="${RESTRICT_PYTHON_ABIS// /$'\n'}"
 
 		if [[ "$(declare -p USE_PYTHON 2> /dev/null)" == "declare -x USE_PYTHON="* ]]; then
 			local cpython_enabled="0"
@@ -625,7 +772,7 @@
 			fi
 
 			for PYTHON_ABI in ${USE_PYTHON}; do
-				if ! has "${PYTHON_ABI}" ${PYTHON_ABI_SUPPORTED_VALUES}; then
+				if ! has "${PYTHON_ABI}" ${_PYTHON_SUPPORTED_ABIS[@]}; then
 					die "USE_PYTHON variable contains invalid value '${PYTHON_ABI}'"
 				fi
 
@@ -634,12 +781,12 @@
 				fi
 
 				support_ABI="1"
-				for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
+				while read restricted_ABI; do
 					if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then
 						support_ABI="0"
 						break
 					fi
-				done
+				done <<< "${restricted_ABIs}"
 				[[ "${support_ABI}" == "1" ]] && export PYTHON_ABIS+="${PYTHON_ABIS:+ }${PYTHON_ABI}"
 			done
 
@@ -668,19 +815,19 @@
 
 				for PYTHON_ABI in "${_CPYTHON2_SUPPORTED_ABIS[@]}"; do
 					support_python_major_version="1"
-					for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
+					while read restricted_ABI; do
 						if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then
 							support_python_major_version="0"
 						fi
-					done
+					done <<< "${restricted_ABIs}"
 					[[ "${support_python_major_version}" == "1" ]] && break
 				done
 				if [[ "${support_python_major_version}" == "1" ]]; then
-					for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
+					while read restricted_ABI; do
 						if [[ "${python2_version}" == ${restricted_ABI} ]]; then
 							die "Active version of Python 2 is not supported by ${CATEGORY}/${PF}"
 						fi
-					done
+					done <<< "${restricted_ABIs}"
 				else
 					python2_version=""
 				fi
@@ -695,19 +842,19 @@
 
 				for PYTHON_ABI in "${_CPYTHON3_SUPPORTED_ABIS[@]}"; do
 					support_python_major_version="1"
-					for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
+					while read restricted_ABI; do
 						if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then
 							support_python_major_version="0"
 						fi
-					done
+					done <<< "${restricted_ABIs}"
 					[[ "${support_python_major_version}" == "1" ]] && break
 				done
 				if [[ "${support_python_major_version}" == "1" ]]; then
-					for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
+					while read restricted_ABI; do
 						if [[ "${python3_version}" == ${restricted_ABI} ]]; then
 							die "Active version of Python 3 is not supported by ${CATEGORY}/${PF}"
 						fi
-					done
+					done <<< "${restricted_ABIs}"
 				else
 					python3_version=""
 				fi
@@ -2116,7 +2263,7 @@
 	_python_initialize_prefix_variables
 	_python_set_color_variables
 
-	[[ "${FUNCNAME[1]}" =~ ^(python_mod_optimize|python_mod_compile|python_mod_cleanup)$ ]] || die "${FUNCNAME}(): Invalid usage"
+	[[ "${FUNCNAME[1]}" =~ ^(python_mod_optimize|python_mod_cleanup)$ ]] || die "${FUNCNAME}(): Invalid usage"
 
 	local base_module_name compiled_file compiled_files=() dir path py_file root
 
@@ -2203,15 +2350,10 @@
 }
 
 # @FUNCTION: python_mod_optimize
-# @USAGE: [options] [directory|file]
+# @USAGE: [--allow-evaluated-non-sitedir-paths] [-d directory] [-f] [-l] [-q] [-x regular_expression] [--] <file|directory> [files|directories]
 # @DESCRIPTION:
-# If no arguments supplied, it will recompile not recursively all modules
-# under sys.path (eg. /usr/lib/python2.6, /usr/lib/python2.6/site-packages).
-#
-# If supplied with arguments, it will recompile all modules recursively
-# in the supplied directory.
-#
-# Options passed to this function are passed to compileall.py.
+# Byte-compile specified Python modules.
+# -d, -f, -l, -q and -x options passed to this function are passed to compileall.py.
 #
 # This function can be used only in pkg_postinst() phase.
 python_mod_optimize() {
@@ -2221,7 +2363,7 @@
 	# Check if phase is pkg_postinst().
 	[[ "${EBUILD_PHASE}" != "postinst" ]] && die "${FUNCNAME}() can be used only in pkg_postinst() phase"
 
-	if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
+	if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then
 		# PYTHON_ABI variable cannot be local in packages not supporting installation for multiple Python ABIs.
 		local allow_evaluated_non_sitedir_paths="0" dir dirs=() evaluated_dirs=() evaluated_files=() file files=() iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_dirs=() site_packages_files=()
 
@@ -2272,11 +2414,7 @@
 		fi
 
 		if [[ "$#" -eq 0 ]]; then
-			ewarn
-			ewarn "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be"
-			ewarn "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules."
-			ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
-			ewarn
+			die "${FUNCNAME}(): Missing files or directories"
 		fi
 
 		while (($#)); do
@@ -2388,12 +2526,18 @@
 				if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
 					"$(PYTHON ${PYTHON_ABI})" -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" &> /dev/null || return_code="1"
 				fi
-				_python_clean_compiled_modules "${other_dirs[@]}"
+				_python_clean_compiled_modules "${other_files[@]}"
 			fi
 			eend "${return_code}"
 		fi
 	else
 		# Deprecated part of python_mod_optimize()
+		# ewarn
+		# ewarn "Deprecation Warning: Usage of ${FUNCNAME}() in packages not supporting installation"
+		# ewarn "for multiple Python ABIs in EAPI <=2 is deprecated and will be disallowed on 2011-06-01."
+		# ewarn "Use EAPI >=3 and call ${FUNCNAME}() with paths having appropriate syntax."
+		# ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
+		# ewarn
 
 		local myroot mydirs=() myfiles=() myopts=() return_code="0"
 
@@ -2425,11 +2569,7 @@
 		done
 
 		if [[ "$#" -eq 0 ]]; then
-			ewarn
-			ewarn "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be"
-			ewarn "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules."
-			ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
-			ewarn
+			die "${FUNCNAME}(): Missing files or directories"
 		fi
 
 		while (($#)); do
@@ -2438,8 +2578,7 @@
 			elif [[ -d "${myroot}/${1#/}" ]]; then
 				mydirs+=("${myroot}/${1#/}")
 			elif [[ -f "${myroot}/${1#/}" ]]; then
-				# Files are passed to python_mod_compile which is EROOT-aware
-				myfiles+=("$1")
+				myfiles+=("${myroot}/${1#/}")
 			elif [[ -e "${myroot}/${1#/}" ]]; then
 				eerror "${FUNCNAME}(): ${myroot}/${1#/} is not a regular file or directory"
 			else
@@ -2461,7 +2600,9 @@
 		fi
 
 		if ((${#myfiles[@]})); then
-			python_mod_compile "${myfiles[@]}"
+			"$(PYTHON ${PYTHON_ABI})" "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" || return_code="1"
+			"$(PYTHON ${PYTHON_ABI})" -O "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" &> /dev/null || return_code="1"
+			_python_clean_compiled_modules "${myfiles[@]}"
 		fi
 
 		eend "${return_code}"
@@ -2469,14 +2610,9 @@
 }
 
 # @FUNCTION: python_mod_cleanup
-# @USAGE: [directory|file]
+# @USAGE: [--allow-evaluated-non-sitedir-paths] [--] <file|directory> [files|directories]
 # @DESCRIPTION:
-# Run with optional arguments, where arguments are Python modules. If none given,
-# it will look in /usr/lib/python[0-9].[0-9].
-#
-# It will recursively scan all compiled Python modules in the directories and
-# determine if they are orphaned (i.e. their corresponding .py files are missing.)
-# If they are, then it will remove their corresponding .pyc and .pyo files.
+# Delete orphaned byte-compiled Python modules corresponding to specified Python modules.
 #
 # This function can be used only in pkg_postrm() phase.
 python_mod_cleanup() {
@@ -2527,61 +2663,48 @@
 		die "${FUNCNAME}(): '--allow-evaluated-non-sitedir-paths' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
 	fi
 
-	if [[ "$#" -gt 0 ]]; then
-		if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
-			while (($#)); do
-				if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then
-					die "${FUNCNAME}(): Invalid argument '$1'"
-				elif ! _python_implementation && [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then
-					die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories"
-				elif [[ "$1" =~ ^/ ]]; then
-					if _python_package_supporting_installation_for_multiple_python_abis; then
-						if [[ "${allow_evaluated_non_sitedir_paths}" != "1" ]]; then
-							die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
-						fi
-						if [[ "$1" != *\$* ]]; then
-							die "${FUNCNAME}(): '$1' has invalid syntax"
-						fi
-						for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
-							eval "search_paths+=(\"\${root}$1\")"
-						done
-					else
-						search_paths+=("${root}$1")
+	if [[ "$#" -eq 0 ]]; then
+		die "${FUNCNAME}(): Missing files or directories"
+	fi
+
+	if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then
+		while (($#)); do
+			if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then
+				die "${FUNCNAME}(): Invalid argument '$1'"
+			elif ! _python_implementation && [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then
+				die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories"
+			elif [[ "$1" =~ ^/ ]]; then
+				if _python_package_supporting_installation_for_multiple_python_abis; then
+					if [[ "${allow_evaluated_non_sitedir_paths}" != "1" ]]; then
+						die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
+					fi
+					if [[ "$1" != *\$* ]]; then
+						die "${FUNCNAME}(): '$1' has invalid syntax"
 					fi
-				else
 					for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
-						search_paths+=("${root}$(python_get_sitedir)/$1")
+						eval "search_paths+=(\"\${root}$1\")"
 					done
+				else
+					search_paths+=("${root}$1")
 				fi
-				shift
-			done
-		else
-			# Deprecated part of python_mod_cleanup()
-
-			search_paths=("${@#/}")
-			search_paths=("${search_paths[@]/#/${root}/}")
-		fi
-	else
-		ewarn
-		ewarn "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be"
-		ewarn "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules."
-		ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
-		ewarn
-
-		for dir in "${root}"/usr/lib*; do
-			if [[ -d "${dir}" && ! -L "${dir}" ]]; then
-				for sitedir in "${dir}"/python*/site-packages; do
-					if [[ -d "${sitedir}" ]]; then
-						search_paths+=("${sitedir}")
-					fi
+			else
+				for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
+					search_paths+=("${root}$(python_get_sitedir)/$1")
 				done
 			fi
+			shift
 		done
-		for sitedir in "${root}"/usr/share/jython-*/Lib/site-packages; do
-			if [[ -d "${sitedir}" ]]; then
-				search_paths+=("${sitedir}")
-			fi
-		done
+	else
+		# Deprecated part of python_mod_cleanup()
+		# ewarn
+		# ewarn "Deprecation Warning: Usage of ${FUNCNAME}() in packages not supporting installation"
+		# ewarn "for multiple Python ABIs in EAPI <=2 is deprecated and will be disallowed on 2011-06-01."
+		# ewarn "Use EAPI >=3 and call ${FUNCNAME}() with paths having appropriate syntax."
+		# ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
+		# ewarn
+
+		search_paths=("${@#/}")
+		search_paths=("${search_paths[@]/#/${root}/}")
 	fi
 
 	_python_clean_compiled_modules "${search_paths[@]}"
@@ -2609,52 +2732,8 @@
 	die "${FUNCNAME}() is banned"
 }
 
-# @FUNCTION: python_mod_compile
-# @USAGE: <file> [more files ...]
-# @DESCRIPTION:
-# Given filenames, it will pre-compile the module's .pyc and .pyo.
-# This function can be used only in pkg_postinst() phase.
-#
-# Example:
-#         python_mod_compile /usr/lib/python2.3/site-packages/pygoogle.py
-#
+# Scheduled for deletion on 2011-04-01.
 python_mod_compile() {
-	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
-
-	_python_initialize_prefix_variables
-	_python_set_color_variables
-
-	if [[ "${FUNCNAME[1]}" != "python_mod_optimize" ]]; then
-		ewarn
-		ewarn "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-09-01."
-		ewarn "Use python_mod_optimize() instead of ${FUNCNAME}()."
-		ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
-		ewarn
-	fi
-
-	local f myroot myfiles=()
-
-	# Check if phase is pkg_postinst()
-	[[ "${EBUILD_PHASE}" != "postinst" ]] && die "${FUNCNAME}() can be used only in pkg_postinst() phase"
-
-	# strip trailing slash
-	myroot="${EROOT%/}"
-
-	# respect EROOT
-	for f in "$@"; do
-		[[ -f "${myroot}/${f}" ]] && myfiles+=("${myroot}/${f}")
-	done
-
-	PYTHON_ABI="$(PYTHON --ABI)"
-
-	if ((${#myfiles[@]})); then
-		"$(PYTHON ${PYTHON_ABI})" "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}"
-		"$(PYTHON ${PYTHON_ABI})" -O "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" &> /dev/null
-		_python_clean_compiled_modules "${myfiles[@]}"
-	else
-		ewarn "No files to compile!"
-	fi
+	eerror "Use python_mod_optimize() instead of ${FUNCNAME}()."
+	die "${FUNCNAME}() is banned"
 }

[-- Attachment #1.3: python.eclass.patch.1 --]
[-- Type: text/x-patch, Size: 1818 bytes --]

--- python.eclass
+++ python.eclass
@@ -19,6 +19,10 @@
 _CPYTHON3_SUPPORTED_ABIS=(3.0 3.1 3.2)
 _JYTHON_SUPPORTED_ABIS=(2.5-jython)
 
+# ================================================================================================
+# ===================================== HANDLING OF METADATA =====================================
+# ================================================================================================
+
 # @ECLASS-VARIABLE: PYTHON_DEPEND
 # @DESCRIPTION:
 # Specification of dependency on dev-lang/python.
@@ -29,7 +33,7 @@
 #   minimal_version:           <minimal_major_version.minimal_minor_version>
 #   maximal_version:           <maximal_major_version.maximal_minor_version>
 
-_parse_PYTHON_DEPEND() {
+_python_parse_PYTHON_DEPEND() {
 	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
 
 	version_components_group_regex="(2|3|\*)(:([[:digit:]]+\.[[:digit:]]+)?(:([[:digit:]]+\.[[:digit:]]+)?)?)?"
@@ -158,7 +162,7 @@
 if [[ -n "${PYTHON_DEPEND}" && -n "${NEED_PYTHON}" ]]; then
 	die "PYTHON_DEPEND and NEED_PYTHON cannot be set simultaneously"
 elif [[ -n "${PYTHON_DEPEND}" ]]; then
-	_parse_PYTHON_DEPEND
+	_python_parse_PYTHON_DEPEND
 elif [[ -n "${NEED_PYTHON}" ]]; then
 	if ! has "${EAPI:-0}" 0 1 2; then
 		eerror "Use PYTHON_DEPEND variable instead of NEED_PYTHON variable."
@@ -180,6 +184,7 @@
 else
 	_PYTHON_ATOMS=("dev-lang/python")
 fi
+unset -f _python_parse_PYTHON_DEPEND
 
 # @ECLASS-VARIABLE: PYTHON_USE_WITH
 # @DESCRIPTION:

[-- Attachment #1.4: python.eclass.patch.2 --]
[-- Type: text/x-patch, Size: 1349 bytes --]

--- python.eclass
+++ python.eclass
@@ -2226,7 +2226,7 @@
 	# Check if phase is pkg_postinst().
 	[[ "${EBUILD_PHASE}" != "postinst" ]] && die "${FUNCNAME}() can be used only in pkg_postinst() phase"
 
-	if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
+	if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then
 		# PYTHON_ABI variable cannot be local in packages not supporting installation for multiple Python ABIs.
 		local allow_evaluated_non_sitedir_paths="0" dir dirs=() evaluated_dirs=() evaluated_files=() file files=() iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_dirs=() site_packages_files=()
 
@@ -2533,7 +2533,7 @@
 	fi
 
 	if [[ "$#" -gt 0 ]]; then
-		if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
+		if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then
 			while (($#)); do
 				if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then
 					die "${FUNCNAME}(): Invalid argument '$1'"

[-- Attachment #1.5: python.eclass.patch.3 --]
[-- Type: text/x-patch, Size: 1204 bytes --]

--- python.eclass
+++ python.eclass
@@ -2399,6 +2399,12 @@
 		fi
 	else
 		# Deprecated part of python_mod_optimize()
+		# ewarn
+		# ewarn "Deprecation Warning: Usage of ${FUNCNAME}() in packages not supporting installation"
+		# ewarn "for multiple Python ABIs in EAPI <=2 is deprecated and will be disallowed on 2011-06-01."
+		# ewarn "Use EAPI >=3 and call ${FUNCNAME}() with paths having appropriate syntax."
+		# ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
+		# ewarn
 
 		local myroot mydirs=() myfiles=() myopts=() return_code="0"
 
@@ -2562,6 +2568,12 @@
 			done
 		else
 			# Deprecated part of python_mod_cleanup()
+			# ewarn
+			# ewarn "Deprecation Warning: Usage of ${FUNCNAME}() in packages not supporting installation"
+			# ewarn "for multiple Python ABIs in EAPI <=2 is deprecated and will be disallowed on 2011-06-01."
+			# ewarn "Use EAPI >=3 and call ${FUNCNAME}() with paths having appropriate syntax."
+			# ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
+			# ewarn
 
 			search_paths=("${@#/}")
 			search_paths=("${search_paths[@]/#/${root}/}")

[-- Attachment #1.6: python.eclass.patch.4 --]
[-- Type: text/x-patch, Size: 6339 bytes --]

--- python.eclass
+++ python.eclass
@@ -18,11 +18,37 @@
 _CPYTHON2_SUPPORTED_ABIS=(2.4 2.5 2.6 2.7)
 _CPYTHON3_SUPPORTED_ABIS=(3.0 3.1 3.2)
 _JYTHON_SUPPORTED_ABIS=(2.5-jython)
+_PYTHON_SUPPORTED_ABIS=(${_CPYTHON2_SUPPORTED_ABIS[@]} ${_CPYTHON3_SUPPORTED_ABIS[@]} ${_JYTHON_SUPPORTED_ABIS[@]})
 
 # ================================================================================================
 # ===================================== HANDLING OF METADATA =====================================
 # ================================================================================================
 
+_python_set_IUSE() {
+	local PYTHON_ABI restricted_ABI restricted_ABIs support_ABI
+
+	_PYTHON_ABIS_USE_FLAGS=""
+	restricted_ABIs="${RESTRICT_PYTHON_ABIS// /$'\n'}"
+
+	for PYTHON_ABI in "${_PYTHON_SUPPORTED_ABIS[@]}"; do
+		support_ABI="1"
+		while read restricted_ABI; do
+			if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then
+				support_ABI="0"
+				break
+			fi
+		done <<< "${restricted_ABIs}"
+		[[ "${support_ABI}" == "1" ]] && _PYTHON_ABIS_USE_FLAGS+="${_PYTHON_ABIS_USE_FLAGS:+ }python_abis_${PYTHON_ABI}"
+	done
+
+	IUSE="${_PYTHON_ABIS_USE_FLAGS}"
+}
+
+if ! has "${EAPI:-0}" 0 1 2 3 && [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+	_python_set_IUSE
+fi
+unset -f _python_set_IUSE
+
 # @ECLASS-VARIABLE: PYTHON_DEPEND
 # @DESCRIPTION:
 # Specification of dependency on dev-lang/python.
@@ -228,6 +254,135 @@
 
 unset _PYTHON_ATOMS
 
+# @FUNCTION: python_add_abi_dependencies
+# @USAGE: [-e|--exclude-ABIs Python_ABIs] [-i|--include-ABIs Python_ABIs] [--] <dependency_atom> [dependency_atoms]
+# @DESCRIPTION:
+# Print dependency atoms with USE dependencies for Python ABIs added.
+# If --exclude-ABIs option is specified, then Python ABIs matching its argument are not used.
+# If --include-ABIs option is specified, then only Python ABIs matching its argument are used.
+# --exclude-ABIs and --include-ABIs options cannot be specified simultaneously.
+python_add_abi_dependencies() {
+	local atom atom_index atoms=() exclude_ABIs="0" excluded_ABI excluded_ABIs include_ABIs="0" included_ABI included_ABIs support_ABI USE_dependencies USE_flag USE_flag_index USE_flags=()
+
+	if has "${EAPI:-0}" 0 1 2 3; then
+		die "${FUNCNAME}() cannot be used in this EAPI"
+	fi
+
+	if [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
+		die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+	fi
+
+	while (($#)); do
+		case "$1" in
+			-e|--exclude-ABIs)
+				exclude_ABIs="1"
+				excluded_ABIs="${2// /$'\n'}"
+				shift
+				;;
+			-i|--include-ABIs)
+				include_ABIs="1"
+				included_ABIs="${2// /$'\n'}"
+				shift
+				;;
+			--)
+				shift
+				break
+				;;
+			-*)
+				die "${FUNCNAME}(): Unrecognized option '$1'"
+				;;
+			*)
+				break
+				;;
+		esac
+		shift
+	done
+
+	if [[ "${exclude_ABIs}" == "1" && "${include_ABIs}" == "1" ]]; then
+		die "${FUNCNAME}(): '--exclude-ABIs' and '--include-ABIs' options cannot be specified simultaneously"
+	fi
+
+	if [[ "$#" -eq 0 ]]; then
+		die "${FUNCNAME}(): Missing dependency atoms"
+	fi
+
+	atoms=("$@")
+
+	if [[ "${exclude_ABIs}" == "0" && "${include_ABIs}" == "0" ]]; then
+		USE_dependencies="$(printf ",%s?" ${_PYTHON_ABIS_USE_FLAGS})"
+		USE_dependencies="${USE_dependencies#,}"
+
+		for atom_index in "${!atoms[@]}"; do
+			atom="${atoms[${atom_index}]}"
+
+			if [[ "${atom}" == *"["*"]" ]]; then
+				echo -n "${atom%]},"
+			else
+				echo -n "${atom}["
+			fi
+			echo -n "${USE_dependencies}]"
+
+			if [[ "${atom_index}" -ne $((${#atoms[@]} - 1)) ]]; then
+				echo -n " "
+			fi
+		done
+	else
+		if [[ "${exclude_ABIs}" == "1" ]]; then
+			for USE_flag in ${_PYTHON_ABIS_USE_FLAGS}; do
+				while read excluded_ABI; do
+				support_ABI="1"
+					if [[ "${USE_flag}" == python_abis_${excluded_ABI} ]]; then
+						support_ABI="0"
+						break
+					fi
+				done <<< "${excluded_ABIs}"
+			[[ "${support_ABI}" == "1" ]] && USE_flags+=("${USE_flag}")
+			done
+		elif [[ "${include_ABIs}" == "1" ]]; then
+			for USE_flag in ${_PYTHON_ABIS_USE_FLAGS}; do
+				while read included_ABI; do
+				support_ABI="0"
+					if [[ "${USE_flag}" == python_abis_${included_ABI} ]]; then
+						support_ABI="1"
+						break
+					fi
+				done <<< "${included_ABIs}"
+			[[ "${support_ABI}" == "1" ]] && USE_flags+=("${USE_flag}")
+			done
+		else
+			die "${FUNCNAME}(): Internal error"
+		fi
+
+		for USE_flag_index in "${!USE_flags[@]}"; do
+			USE_flag="${USE_flags[${USE_flag_index}]}"
+			USE_dependencies="${USE_flag}"
+
+			echo -n "${USE_flag}? ( "
+
+			for atom_index in "${!atoms[@]}"; do
+				atom="${atoms[${atom_index}]}"
+
+				if [[ "${atom}" == *"["*"]" ]]; then
+					echo -n "${atom%]},"
+				else
+					echo -n "${atom}["
+				fi
+				echo -n "${USE_dependencies}]"
+
+				if [[ "${atom_index}" -ne $((${#atoms[@]} - 1)) ]]; then
+					echo -n " "
+				fi
+			done
+
+			echo -n " )"
+
+			if [[ "${USE_flag_index}" -ne $((${#USE_flags[@]} - 1)) ]]; then
+				echo -n " "
+			fi
+		done
+	fi
+}
+
 # ================================================================================================
 # =================================== MISCELLANEOUS FUNCTIONS ====================================
 # ================================================================================================
@@ -608,7 +763,9 @@
 	fi
 fi
 
-unset PYTHON_ABIS
+if has "${EAPI:-0}" 0 1 2 3; then
+	unset PYTHON_ABIS
+fi
 
 _python_calculate_PYTHON_ABIS() {
 	if ! _python_package_supporting_installation_for_multiple_python_abis; then
@@ -617,8 +774,7 @@
 
 	_python_initial_sanity_checks
 
-	# USE_${ABI_TYPE^^} and RESTRICT_${ABI_TYPE^^}_ABIS variables hopefully will be included in EAPI >= 5.
-	if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3 4; then
+	if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3; then
 		local PYTHON_ABI restricted_ABI support_ABI supported_PYTHON_ABIS=
 		PYTHON_ABI_SUPPORTED_VALUES="${_CPYTHON2_SUPPORTED_ABIS[@]} ${_CPYTHON3_SUPPORTED_ABIS[@]} ${_JYTHON_SUPPORTED_ABIS[@]}"
 

[-- Attachment #1.7: python.eclass.patch.5 --]
[-- Type: text/x-patch, Size: 3101 bytes --]

--- python.eclass
+++ python.eclass
@@ -775,8 +775,9 @@
 	_python_initial_sanity_checks
 
 	if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3; then
-		local PYTHON_ABI restricted_ABI support_ABI supported_PYTHON_ABIS=
-		PYTHON_ABI_SUPPORTED_VALUES="${_CPYTHON2_SUPPORTED_ABIS[@]} ${_CPYTHON3_SUPPORTED_ABIS[@]} ${_JYTHON_SUPPORTED_ABIS[@]}"
+		local PYTHON_ABI restricted_ABI restricted_ABIs support_ABI supported_PYTHON_ABIS
+
+		restricted_ABIs="${RESTRICT_PYTHON_ABIS// /$'\n'}"
 
 		if [[ "$(declare -p USE_PYTHON 2> /dev/null)" == "declare -x USE_PYTHON="* ]]; then
 			local cpython_enabled="0"
@@ -786,7 +787,7 @@
 			fi
 
 			for PYTHON_ABI in ${USE_PYTHON}; do
-				if ! has "${PYTHON_ABI}" ${PYTHON_ABI_SUPPORTED_VALUES}; then
+				if ! has "${PYTHON_ABI}" ${_PYTHON_SUPPORTED_ABIS[@]}; then
 					die "USE_PYTHON variable contains invalid value '${PYTHON_ABI}'"
 				fi
 
@@ -795,12 +796,12 @@
 				fi
 
 				support_ABI="1"
-				for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
+				while read restricted_ABI; do
 					if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then
 						support_ABI="0"
 						break
 					fi
-				done
+				done <<< "${restricted_ABIs}"
 				[[ "${support_ABI}" == "1" ]] && export PYTHON_ABIS+="${PYTHON_ABIS:+ }${PYTHON_ABI}"
 			done
 
@@ -829,19 +830,19 @@
 
 				for PYTHON_ABI in "${_CPYTHON2_SUPPORTED_ABIS[@]}"; do
 					support_python_major_version="1"
-					for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
+					while read restricted_ABI; do
 						if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then
 							support_python_major_version="0"
 						fi
-					done
+					done <<< "${restricted_ABIs}"
 					[[ "${support_python_major_version}" == "1" ]] && break
 				done
 				if [[ "${support_python_major_version}" == "1" ]]; then
-					for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
+					while read restricted_ABI; do
 						if [[ "${python2_version}" == ${restricted_ABI} ]]; then
 							die "Active version of Python 2 is not supported by ${CATEGORY}/${PF}"
 						fi
-					done
+					done <<< "${restricted_ABIs}"
 				else
 					python2_version=""
 				fi
@@ -856,19 +857,19 @@
 
 				for PYTHON_ABI in "${_CPYTHON3_SUPPORTED_ABIS[@]}"; do
 					support_python_major_version="1"
-					for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
+					while read restricted_ABI; do
 						if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then
 							support_python_major_version="0"
 						fi
-					done
+					done <<< "${restricted_ABIs}"
 					[[ "${support_python_major_version}" == "1" ]] && break
 				done
 				if [[ "${support_python_major_version}" == "1" ]]; then
-					for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
+					while read restricted_ABI; do
 						if [[ "${python3_version}" == ${restricted_ABI} ]]; then
 							die "Active version of Python 3 is not supported by ${CATEGORY}/${PF}"
 						fi
-					done
+					done <<< "${restricted_ABIs}"
 				else
 					python3_version=""
 				fi

[-- Attachment #1.8: python.eclass.patch.6 --]
[-- Type: text/x-patch, Size: 3204 bytes --]

--- python.eclass
+++ python.eclass
@@ -2278,7 +2278,7 @@
 	_python_initialize_prefix_variables
 	_python_set_color_variables
 
-	[[ "${FUNCNAME[1]}" =~ ^(python_mod_optimize|python_mod_compile|python_mod_cleanup)$ ]] || die "${FUNCNAME}(): Invalid usage"
+	[[ "${FUNCNAME[1]}" =~ ^(python_mod_optimize|python_mod_cleanup)$ ]] || die "${FUNCNAME}(): Invalid usage"
 
 	local base_module_name compiled_file compiled_files=() dir path py_file root
 
@@ -2606,8 +2606,7 @@
 			elif [[ -d "${myroot}/${1#/}" ]]; then
 				mydirs+=("${myroot}/${1#/}")
 			elif [[ -f "${myroot}/${1#/}" ]]; then
-				# Files are passed to python_mod_compile which is EROOT-aware
-				myfiles+=("$1")
+				myfiles+=("${myroot}/${1#/}")
 			elif [[ -e "${myroot}/${1#/}" ]]; then
 				eerror "${FUNCNAME}(): ${myroot}/${1#/} is not a regular file or directory"
 			else
@@ -2629,7 +2628,9 @@
 		fi
 
 		if ((${#myfiles[@]})); then
-			python_mod_compile "${myfiles[@]}"
+			"$(PYTHON ${PYTHON_ABI})" "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" || return_code="1"
+			"$(PYTHON ${PYTHON_ABI})" -O "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" &> /dev/null || return_code="1"
+			_python_clean_compiled_modules "${myfiles[@]}"
 		fi
 
 		eend "${return_code}"
@@ -2783,52 +2784,8 @@
 	die "${FUNCNAME}() is banned"
 }
 
-# @FUNCTION: python_mod_compile
-# @USAGE: <file> [more files ...]
-# @DESCRIPTION:
-# Given filenames, it will pre-compile the module's .pyc and .pyo.
-# This function can be used only in pkg_postinst() phase.
-#
-# Example:
-#         python_mod_compile /usr/lib/python2.3/site-packages/pygoogle.py
-#
+# Scheduled for deletion on 2011-04-01.
 python_mod_compile() {
-	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
-
-	_python_initialize_prefix_variables
-	_python_set_color_variables
-
-	if [[ "${FUNCNAME[1]}" != "python_mod_optimize" ]]; then
-		ewarn
-		ewarn "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-09-01."
-		ewarn "Use python_mod_optimize() instead of ${FUNCNAME}()."
-		ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
-		ewarn
-	fi
-
-	local f myroot myfiles=()
-
-	# Check if phase is pkg_postinst()
-	[[ "${EBUILD_PHASE}" != "postinst" ]] && die "${FUNCNAME}() can be used only in pkg_postinst() phase"
-
-	# strip trailing slash
-	myroot="${EROOT%/}"
-
-	# respect EROOT
-	for f in "$@"; do
-		[[ -f "${myroot}/${f}" ]] && myfiles+=("${myroot}/${f}")
-	done
-
-	PYTHON_ABI="$(PYTHON --ABI)"
-
-	if ((${#myfiles[@]})); then
-		"$(PYTHON ${PYTHON_ABI})" "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}"
-		"$(PYTHON ${PYTHON_ABI})" -O "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" &> /dev/null
-		_python_clean_compiled_modules "${myfiles[@]}"
-	else
-		ewarn "No files to compile!"
-	fi
+	eerror "Use python_mod_optimize() instead of ${FUNCNAME}()."
+	die "${FUNCNAME}() is banned"
 }

[-- Attachment #1.9: python.eclass.patch.7 --]
[-- Type: text/x-patch, Size: 427 bytes --]

--- python.eclass
+++ python.eclass
@@ -2550,7 +2550,7 @@
 				if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
 					"$(PYTHON ${PYTHON_ABI})" -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" &> /dev/null || return_code="1"
 				fi
-				_python_clean_compiled_modules "${other_dirs[@]}"
+				_python_clean_compiled_modules "${other_files[@]}"
 			fi
 			eend "${return_code}"
 		fi

[-- Attachment #1.10: python.eclass.patch.8 --]
[-- Type: text/x-patch, Size: 1480 bytes --]

--- python.eclass
+++ python.eclass
@@ -185,33 +185,18 @@
 DEPEND=">=app-admin/eselect-python-20091230"
 RDEPEND="${DEPEND}"
 
-if [[ -n "${PYTHON_DEPEND}" && -n "${NEED_PYTHON}" ]]; then
-	die "PYTHON_DEPEND and NEED_PYTHON cannot be set simultaneously"
-elif [[ -n "${PYTHON_DEPEND}" ]]; then
+if [[ -n "${PYTHON_DEPEND}" ]]; then
 	_python_parse_PYTHON_DEPEND
-elif [[ -n "${NEED_PYTHON}" ]]; then
-	if ! has "${EAPI:-0}" 0 1 2; then
-		eerror "Use PYTHON_DEPEND variable instead of NEED_PYTHON variable."
-		die "NEED_PYTHON variable cannot be used in this EAPI"
-	fi
-
-	ewarn
-	ewarn "\"${EBUILD}\":"
-	ewarn "Deprecation Warning: NEED_PYTHON variable is deprecated and will be banned on 2010-10-01."
-	ewarn "Use PYTHON_DEPEND variable instead of NEED_PYTHON variable."
-	ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
-	ewarn
-
-	unset _BOLD _NORMAL
-
-	_PYTHON_ATOMS=(">=dev-lang/python-${NEED_PYTHON}")
-	DEPEND+="${DEPEND:+ }${_PYTHON_ATOMS[@]}"
-	RDEPEND+="${RDEPEND:+ }${_PYTHON_ATOMS[@]}"
 else
 	_PYTHON_ATOMS=("dev-lang/python")
 fi
 unset -f _python_parse_PYTHON_DEPEND
 
+if [[ -n "${NEED_PYTHON}" ]]; then
+	eerror "Use PYTHON_DEPEND variable instead of NEED_PYTHON variable."
+	die "NEED_PYTHON variable is banned"
+fi
+
 # @ECLASS-VARIABLE: PYTHON_USE_WITH
 # @DESCRIPTION:
 # Set this to a space separated list of USE flags the Python slot in use must be built with.

[-- Attachment #1.11: python.eclass.patch.9 --]
[-- Type: text/x-patch, Size: 7258 bytes --]

--- python.eclass
+++ python.eclass
@@ -2350,15 +2350,10 @@
 }
 
 # @FUNCTION: python_mod_optimize
-# @USAGE: [options] [directory|file]
+# @USAGE: [--allow-evaluated-non-sitedir-paths] [-d directory] [-f] [-l] [-q] [-x regular_expression] [--] <file|directory> [files|directories]
 # @DESCRIPTION:
-# If no arguments supplied, it will recompile not recursively all modules
-# under sys.path (eg. /usr/lib/python2.6, /usr/lib/python2.6/site-packages).
-#
-# If supplied with arguments, it will recompile all modules recursively
-# in the supplied directory.
-#
-# Options passed to this function are passed to compileall.py.
+# Byte-compile specified Python modules.
+# -d, -f, -l, -q and -x options passed to this function are passed to compileall.py.
 #
 # This function can be used only in pkg_postinst() phase.
 python_mod_optimize() {
@@ -2419,11 +2414,7 @@
 		fi
 
 		if [[ "$#" -eq 0 ]]; then
-			ewarn
-			ewarn "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be"
-			ewarn "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules."
-			ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
-			ewarn
+			die "${FUNCNAME}(): Missing files or directories"
 		fi
 
 		while (($#)); do
@@ -2578,11 +2569,7 @@
 		done
 
 		if [[ "$#" -eq 0 ]]; then
-			ewarn
-			ewarn "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be"
-			ewarn "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules."
-			ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
-			ewarn
+			die "${FUNCNAME}(): Missing files or directories"
 		fi
 
 		while (($#)); do
@@ -2623,14 +2610,9 @@
 }
 
 # @FUNCTION: python_mod_cleanup
-# @USAGE: [directory|file]
+# @USAGE: [--allow-evaluated-non-sitedir-paths] [--] <file|directory> [files|directories]
 # @DESCRIPTION:
-# Run with optional arguments, where arguments are Python modules. If none given,
-# it will look in /usr/lib/python[0-9].[0-9].
-#
-# It will recursively scan all compiled Python modules in the directories and
-# determine if they are orphaned (i.e. their corresponding .py files are missing.)
-# If they are, then it will remove their corresponding .pyc and .pyo files.
+# Delete orphaned byte-compiled Python modules corresponding to specified Python modules.
 #
 # This function can be used only in pkg_postrm() phase.
 python_mod_cleanup() {
@@ -2681,67 +2663,48 @@
 		die "${FUNCNAME}(): '--allow-evaluated-non-sitedir-paths' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
 	fi
 
-	if [[ "$#" -gt 0 ]]; then
-		if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then
-			while (($#)); do
-				if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then
-					die "${FUNCNAME}(): Invalid argument '$1'"
-				elif ! _python_implementation && [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then
-					die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories"
-				elif [[ "$1" =~ ^/ ]]; then
-					if _python_package_supporting_installation_for_multiple_python_abis; then
-						if [[ "${allow_evaluated_non_sitedir_paths}" != "1" ]]; then
-							die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
-						fi
-						if [[ "$1" != *\$* ]]; then
-							die "${FUNCNAME}(): '$1' has invalid syntax"
-						fi
-						for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
-							eval "search_paths+=(\"\${root}$1\")"
-						done
-					else
-						search_paths+=("${root}$1")
+	if [[ "$#" -eq 0 ]]; then
+		die "${FUNCNAME}(): Missing files or directories"
+	fi
+
+	if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then
+		while (($#)); do
+			if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then
+				die "${FUNCNAME}(): Invalid argument '$1'"
+			elif ! _python_implementation && [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then
+				die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories"
+			elif [[ "$1" =~ ^/ ]]; then
+				if _python_package_supporting_installation_for_multiple_python_abis; then
+					if [[ "${allow_evaluated_non_sitedir_paths}" != "1" ]]; then
+						die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
+					fi
+					if [[ "$1" != *\$* ]]; then
+						die "${FUNCNAME}(): '$1' has invalid syntax"
 					fi
-				else
 					for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
-						search_paths+=("${root}$(python_get_sitedir)/$1")
+						eval "search_paths+=(\"\${root}$1\")"
 					done
+				else
+					search_paths+=("${root}$1")
 				fi
-				shift
-			done
-		else
-			# Deprecated part of python_mod_cleanup()
-			# ewarn
-			# ewarn "Deprecation Warning: Usage of ${FUNCNAME}() in packages not supporting installation"
-			# ewarn "for multiple Python ABIs in EAPI <=2 is deprecated and will be disallowed on 2011-06-01."
-			# ewarn "Use EAPI >=3 and call ${FUNCNAME}() with paths having appropriate syntax."
-			# ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
-			# ewarn
-
-			search_paths=("${@#/}")
-			search_paths=("${search_paths[@]/#/${root}/}")
-		fi
-	else
-		ewarn
-		ewarn "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be"
-		ewarn "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules."
-		ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
-		ewarn
-
-		for dir in "${root}"/usr/lib*; do
-			if [[ -d "${dir}" && ! -L "${dir}" ]]; then
-				for sitedir in "${dir}"/python*/site-packages; do
-					if [[ -d "${sitedir}" ]]; then
-						search_paths+=("${sitedir}")
-					fi
+			else
+				for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
+					search_paths+=("${root}$(python_get_sitedir)/$1")
 				done
 			fi
+			shift
 		done
-		for sitedir in "${root}"/usr/share/jython-*/Lib/site-packages; do
-			if [[ -d "${sitedir}" ]]; then
-				search_paths+=("${sitedir}")
-			fi
-		done
+	else
+		# Deprecated part of python_mod_cleanup()
+		# ewarn
+		# ewarn "Deprecation Warning: Usage of ${FUNCNAME}() in packages not supporting installation"
+		# ewarn "for multiple Python ABIs in EAPI <=2 is deprecated and will be disallowed on 2011-06-01."
+		# ewarn "Use EAPI >=3 and call ${FUNCNAME}() with paths having appropriate syntax."
+		# ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
+		# ewarn
+
+		search_paths=("${@#/}")
+		search_paths=("${search_paths[@]/#/${root}/}")
 	fi
 
 	_python_clean_compiled_modules "${search_paths[@]}"

[-- Attachment #1.12: python.eclass.patch.10 --]
[-- Type: text/x-patch, Size: 392 bytes --]

--- python.eclass
+++ python.eclass
@@ -555,7 +555,7 @@
 	PYTHON_PKG_SETUP_EXECUTED="1"
 }
 
-if ! has "${EAPI:-0}" 0 1 2 3 || has "${EAPI:-0}" 2 3 && [[ -n "${PYTHON_USE_WITH}" || -n "${PYTHON_USE_WITH_OR}" ]]; then
+if ! has "${EAPI:-0}" 0 1 2 3 || { has "${EAPI:-0}" 2 3 && [[ -n "${PYTHON_USE_WITH}" || -n "${PYTHON_USE_WITH_OR}" ]]; }; then
 	EXPORT_FUNCTIONS pkg_setup
 fi
 

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [gentoo-dev] Re: Patch for python.eclass
  2010-10-18  1:33 [gentoo-dev] Patch for python.eclass Arfrever Frehtes Taifersar Arahesis
@ 2010-10-18  7:06 ` Mike Frysinger
  2010-10-18 15:10   ` Arfrever Frehtes Taifersar Arahesis
  2010-10-18 15:26 ` [gentoo-dev] " Petteri Räty
  2010-10-23 20:54 ` [gentoo-dev] Patch for python.eclass Arfrever Frehtes Taifersar Arahesis
  2 siblings, 1 reply; 18+ messages in thread
From: Mike Frysinger @ 2010-10-18  7:06 UTC (permalink / raw
  To: Arfrever Frehtes Taifersar Arahesis; +Cc: Gentoo Development, qa

[-- Attachment #1: Type: Text/Plain, Size: 840 bytes --]

On October 17, 2010 21:33:20 Arfrever Frehtes Taifersar Arahesis wrote:
> Example usage:
>   RDEPEND="net-libs/gnutls
>       $(python_add_abi_dependencies ">=dev-python/PyQt4-4.7.7[svg]")
>       $(python_add_abi_dependencies -e "2.7 3.[2-9]" dev-python/argparse)"
>   DEPEND="${RDEPEND}
>       $(python_add_abi_dependencies dev-python/setuptools)
>       $(python_add_abi_dependencies -i "3.*" net-zope/zope-fixers)
>       test? ( $(python_add_abi_dependencies dev-python/py) )"

"dependencies" is overly verbose imo.  why not just use "depend" ?  plus, 
"add" usually means the func is the one doing the addition when this is not 
the case -- the user is the one doing the addition.  "python_abi_depend" 
should be sufficient.

> Subpatch #5 improves some code used in older EAPIs.

does this fix Bug 340395 ?
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [gentoo-dev] Re: Patch for python.eclass
  2010-10-18  7:06 ` [gentoo-dev] " Mike Frysinger
@ 2010-10-18 15:10   ` Arfrever Frehtes Taifersar Arahesis
  2010-10-18 15:15     ` Diego Elio Pettenò
  0 siblings, 1 reply; 18+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2010-10-18 15:10 UTC (permalink / raw
  To: Gentoo Development; +Cc: qa

[-- Attachment #1: Type: Text/Plain, Size: 296 bytes --]

2010-10-18 09:06:06 Mike Frysinger napisał(a):
> On October 17, 2010 21:33:20 Arfrever Frehtes Taifersar Arahesis wrote:
> > Subpatch #5 improves some code used in older EAPIs.
> 
> does this fix Bug 340395 ?

No. It's not related to that bug.

-- 
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [gentoo-dev] Re: Patch for python.eclass
  2010-10-18 15:10   ` Arfrever Frehtes Taifersar Arahesis
@ 2010-10-18 15:15     ` Diego Elio Pettenò
  2010-10-22  7:56       ` Mike Frysinger
  0 siblings, 1 reply; 18+ messages in thread
From: Diego Elio Pettenò @ 2010-10-18 15:15 UTC (permalink / raw
  To: Arfrever Frehtes Taifersar Arahesis; +Cc: Gentoo Development, qa

Il giorno lun, 18/10/2010 alle 17.10 +0200, Arfrever Frehtes Taifersar
Arahesis ha scritto:
> 
> No. It's not related to that bug.

So I guess Mike's next reply is going to be "and what are you waiting
for, before fixing it?". Seriously.

-- 
Diego Elio Pettenò — Flameeyes
http://blog.flameeyes.eu/





^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [gentoo-dev] Patch for python.eclass
  2010-10-18  1:33 [gentoo-dev] Patch for python.eclass Arfrever Frehtes Taifersar Arahesis
  2010-10-18  7:06 ` [gentoo-dev] " Mike Frysinger
@ 2010-10-18 15:26 ` Petteri Räty
  2010-10-24 18:49   ` Arfrever Frehtes Taifersar Arahesis
  2010-10-23 20:54 ` [gentoo-dev] Patch for python.eclass Arfrever Frehtes Taifersar Arahesis
  2 siblings, 1 reply; 18+ messages in thread
From: Petteri Räty @ 2010-10-18 15:26 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 416 bytes --]

On 10/18/2010 04:33 AM, Arfrever Frehtes Taifersar Arahesis wrote:

> Subpatch #10 fixes exporting of python_pkg_setup() in EAPI >=4.
> 
> There will be other changes in API of python.eclass in EAPI >=4, so python.eclass still doesn't
> support EAPI="4".
> 

EAPI 4 is not approved yet. Ebuilds can't use it yet so I don't think we
should start migrating eclasses before it's final.

Regards,
Petteri


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 900 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [gentoo-dev] Re: Patch for python.eclass
  2010-10-18 15:15     ` Diego Elio Pettenò
@ 2010-10-22  7:56       ` Mike Frysinger
  2010-10-23 19:21         ` Arfrever Frehtes Taifersar Arahesis
  0 siblings, 1 reply; 18+ messages in thread
From: Mike Frysinger @ 2010-10-22  7:56 UTC (permalink / raw
  To: Diego Elio Pettenò
  Cc: Arfrever Frehtes Taifersar Arahesis, Gentoo Development, qa

[-- Attachment #1: Type: Text/Plain, Size: 377 bytes --]

On Monday, October 18, 2010 11:15:45 Diego Elio Pettenò wrote:
> Il giorno lun, 18/10/2010 alle 17.10 +0200, Arfrever ha scritto:
> > No. It's not related to that bug.
> 
> So I guess Mike's next reply is going to be "and what are you waiting
> for, before fixing it?". Seriously.

i guess the answer is that you need someone on the QA team to fix it for you ?
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [gentoo-dev] Re: Patch for python.eclass
  2010-10-22  7:56       ` Mike Frysinger
@ 2010-10-23 19:21         ` Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 18+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2010-10-23 19:21 UTC (permalink / raw
  To: Gentoo Development; +Cc: qa

[-- Attachment #1: Type: Text/Plain, Size: 569 bytes --]

2010-10-22 09:56:56 Mike Frysinger napisał(a):
> On Monday, October 18, 2010 11:15:45 Diego Elio Pettenò wrote:
> > Il giorno lun, 18/10/2010 alle 17.10 +0200, Arfrever ha scritto:
> > > No. It's not related to that bug.
> > 
> > So I guess Mike's next reply is going to be "and what are you waiting
> > for, before fixing it?". Seriously.
> 
> i guess the answer is that you need someone on the QA team to fix it for you ?

You shouldn't assume, that I can write answers when I'm away.
I will work on a patch.

-- 
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [gentoo-dev] Patch for python.eclass
  2010-10-18  1:33 [gentoo-dev] Patch for python.eclass Arfrever Frehtes Taifersar Arahesis
  2010-10-18  7:06 ` [gentoo-dev] " Mike Frysinger
  2010-10-18 15:26 ` [gentoo-dev] " Petteri Räty
@ 2010-10-23 20:54 ` Arfrever Frehtes Taifersar Arahesis
  2010-10-23 20:57   ` Markos Chandras
  2010-10-24 18:29   ` Petteri Räty
  2 siblings, 2 replies; 18+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2010-10-23 20:54 UTC (permalink / raw
  To: Gentoo Development; +Cc: qa


[-- Attachment #1.1: Type: Text/Plain, Size: 262 bytes --]

Subpatch #11 adds temporary support for EAPI="0" in python_get_implementational_package() to work
around a part of bug #340395.
This subpatch is very small, so I'm planning to commit it with the rest of subpatches.

-- 
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #1.2: python.eclass.patch.11 --]
[-- Type: text/x-patch, Size: 911 bytes --]

--- python.eclass
+++ python.eclass
@@ -1711,10 +1711,18 @@
 		fi
 	fi
 
-	if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
-		echo "dev-lang/python:${PYTHON_ABI}"
-	elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
-		echo "dev-java/jython:${PYTHON_ABI%-jython}"
+	if [[ "${EAPI:-0}" == "0" ]]; then
+		if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
+			echo "=dev-lang/python-${PYTHON_ABI}*"
+		elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
+			echo "=dev-java/jython-${PYTHON_ABI%-jython}*"
+		fi
+	else
+		if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
+			echo "dev-lang/python:${PYTHON_ABI}"
+		elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
+			echo "dev-java/jython:${PYTHON_ABI%-jython}"
+		fi
 	fi
 }
 

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [gentoo-dev] Patch for python.eclass
  2010-10-23 20:54 ` [gentoo-dev] Patch for python.eclass Arfrever Frehtes Taifersar Arahesis
@ 2010-10-23 20:57   ` Markos Chandras
  2010-10-24 18:29   ` Petteri Räty
  1 sibling, 0 replies; 18+ messages in thread
From: Markos Chandras @ 2010-10-23 20:57 UTC (permalink / raw
  To: Arfrever Frehtes Taifersar Arahesis; +Cc: Gentoo Development, qa

[-- Attachment #1: Type: text/plain, Size: 1699 bytes --]

On Sat, Oct 23, 2010 at 10:54:52PM +0200, Arfrever Frehtes Taifersar Arahesis wrote:
> Subpatch #11 adds temporary support for EAPI="0" in python_get_implementational_package() to work
> around a part of bug #340395.
> This subpatch is very small, so I'm planning to commit it with the rest of subpatches.
> 
> -- 
> Arfrever Frehtes Taifersar Arahesis

> --- python.eclass
> +++ python.eclass
> @@ -1711,10 +1711,18 @@
>  		fi
>  	fi
>  
> -	if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
> -		echo "dev-lang/python:${PYTHON_ABI}"
> -	elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
> -		echo "dev-java/jython:${PYTHON_ABI%-jython}"
> +	if [[ "${EAPI:-0}" == "0" ]]; then
> +		if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
> +			echo "=dev-lang/python-${PYTHON_ABI}*"
> +		elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
> +			echo "=dev-java/jython-${PYTHON_ABI%-jython}*"
> +		fi
> +	else
> +		if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
> +			echo "dev-lang/python:${PYTHON_ABI}"
> +		elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
> +			echo "dev-java/jython:${PYTHON_ABI%-jython}"
> +		fi
>  	fi
>  }
>  
Well, I found sometime today and looked at your patches. Even thought I
find it quite hard to familiarize myself with the *rather complex* python.eclass,
I think your patches are fine if I may say.

-- 
Markos Chandras (hwoarang)
Gentoo Linux Developer
Web: http://hwoarang.silverarrow.org
Key ID: 441AC410
Key FP: AAD0 8591 E3CD 445D 6411  3477 F7F7 1E8E 441A C410

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [gentoo-dev] Patch for python.eclass
  2010-10-23 20:54 ` [gentoo-dev] Patch for python.eclass Arfrever Frehtes Taifersar Arahesis
  2010-10-23 20:57   ` Markos Chandras
@ 2010-10-24 18:29   ` Petteri Räty
  1 sibling, 0 replies; 18+ messages in thread
From: Petteri Räty @ 2010-10-24 18:29 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 383 bytes --]

On 10/23/2010 11:54 PM, Arfrever Frehtes Taifersar Arahesis wrote:
> Subpatch #11 adds temporary support for EAPI="0" in python_get_implementational_package() to work
> around a part of bug #340395.
> This subpatch is very small, so I'm planning to commit it with the rest of subpatches.
> 

Please respond to my comment about EAPI 4 before committing.

Regards,
Petteri


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 900 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [gentoo-dev] Patch for python.eclass
  2010-10-18 15:26 ` [gentoo-dev] " Petteri Räty
@ 2010-10-24 18:49   ` Arfrever Frehtes Taifersar Arahesis
  2010-10-24 18:54     ` Petteri Räty
  0 siblings, 1 reply; 18+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2010-10-24 18:49 UTC (permalink / raw
  To: Gentoo Development

[-- Attachment #1: Type: Text/Plain, Size: 655 bytes --]

2010-10-18 17:26:13 Petteri Räty napisał(a):
> On 10/18/2010 04:33 AM, Arfrever Frehtes Taifersar Arahesis wrote:
> 
> > Subpatch #10 fixes exporting of python_pkg_setup() in EAPI >=4.
> > 
> > There will be other changes in API of python.eclass in EAPI >=4, so python.eclass still doesn't
> > support EAPI="4".
> > 
> 
> EAPI 4 is not approved yet. Ebuilds can't use it yet so I don't think we
> should start migrating eclasses before it's final.

Porting of python.eclass to EAPI="4" has started some months ago and will take at least
1 additional month, so it's better to perform it earlier.

-- 
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [gentoo-dev] Patch for python.eclass
  2010-10-24 18:49   ` Arfrever Frehtes Taifersar Arahesis
@ 2010-10-24 18:54     ` Petteri Räty
  2010-10-24 19:22       ` Arfrever Frehtes Taifersar Arahesis
  0 siblings, 1 reply; 18+ messages in thread
From: Petteri Räty @ 2010-10-24 18:54 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 789 bytes --]

On 10/24/2010 09:49 PM, Arfrever Frehtes Taifersar Arahesis wrote:
> 2010-10-18 17:26:13 Petteri Räty napisał(a):
>> On 10/18/2010 04:33 AM, Arfrever Frehtes Taifersar Arahesis wrote:
>>
>>> Subpatch #10 fixes exporting of python_pkg_setup() in EAPI >=4.
>>>
>>> There will be other changes in API of python.eclass in EAPI >=4, so python.eclass still doesn't
>>> support EAPI="4".
>>>
>>
>> EAPI 4 is not approved yet. Ebuilds can't use it yet so I don't think we
>> should start migrating eclasses before it's final.
> 
> Porting of python.eclass to EAPI="4" has started some months ago and will take at least
> 1 additional month, so it's better to perform it earlier.
> 

Usage of new EAPIs in the tree is not allowed before council approval.

Regards,
Petteri


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 900 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [gentoo-dev] Patch for python.eclass
  2010-10-24 18:54     ` Petteri Räty
@ 2010-10-24 19:22       ` Arfrever Frehtes Taifersar Arahesis
  2010-10-24 21:47         ` Arfrever Frehtes Taifersar Arahesis
  0 siblings, 1 reply; 18+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2010-10-24 19:22 UTC (permalink / raw
  To: Gentoo Development

[-- Attachment #1: Type: Text/Plain, Size: 1015 bytes --]

2010-10-24 20:54:56 Petteri Räty napisał(a):
> On 10/24/2010 09:49 PM, Arfrever Frehtes Taifersar Arahesis wrote:
> > 2010-10-18 17:26:13 Petteri Räty napisał(a):
> >> On 10/18/2010 04:33 AM, Arfrever Frehtes Taifersar Arahesis wrote:
> >>
> >>> Subpatch #10 fixes exporting of python_pkg_setup() in EAPI >=4.
> >>>
> >>> There will be other changes in API of python.eclass in EAPI >=4, so python.eclass still doesn't
> >>> support EAPI="4".
> >>>
> >>
> >> EAPI 4 is not approved yet. Ebuilds can't use it yet so I don't think we
> >> should start migrating eclasses before it's final.
> > 
> > Porting of python.eclass to EAPI="4" has started some months ago and will take at least
> > 1 additional month, so it's better to perform it earlier.
> > 
> 
> Usage of new EAPIs in the tree is not allowed before council approval.

python.eclass doesn't use any EAPIs, it only provides support for ebuilds, which use given EAPIs
(without EAPI="4").

-- 
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [gentoo-dev] Patch for python.eclass
  2010-10-24 19:22       ` Arfrever Frehtes Taifersar Arahesis
@ 2010-10-24 21:47         ` Arfrever Frehtes Taifersar Arahesis
  2010-10-25  6:17           ` Ciaran McCreesh
  0 siblings, 1 reply; 18+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2010-10-24 21:47 UTC (permalink / raw
  To: Gentoo Development

[-- Attachment #1: Type: Text/Plain, Size: 1312 bytes --]

Arfrever Frehtes Taifersar Arahesis 2010-10-24 21:22:24  napisał(a):
> 2010-10-24 20:54:56 Petteri Räty napisał(a):
> > On 10/24/2010 09:49 PM, Arfrever Frehtes Taifersar Arahesis wrote:
> > > 2010-10-18 17:26:13 Petteri Räty napisał(a):
> > >> On 10/18/2010 04:33 AM, Arfrever Frehtes Taifersar Arahesis wrote:
> > >>
> > >>> Subpatch #10 fixes exporting of python_pkg_setup() in EAPI >=4.
> > >>>
> > >>> There will be other changes in API of python.eclass in EAPI >=4, so python.eclass still doesn't
> > >>> support EAPI="4".
> > >>>
> > >>
> > >> EAPI 4 is not approved yet. Ebuilds can't use it yet so I don't think we
> > >> should start migrating eclasses before it's final.
> > > 
> > > Porting of python.eclass to EAPI="4" has started some months ago and will take at least
> > > 1 additional month, so it's better to perform it earlier.
> > > 
> > 
> > Usage of new EAPIs in the tree is not allowed before council approval.
> 
> python.eclass doesn't use any EAPIs, it only provides support for ebuilds, which use given EAPIs
> (without EAPI="4").

I forgot to say that this patch doesn't introduce usage of any feature absent in EAPI="3" and
present in current draft of EAPI="4", but changes API of python.eclass in EAPI="4".

-- 
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [gentoo-dev] Patch for python.eclass
  2010-10-24 21:47         ` Arfrever Frehtes Taifersar Arahesis
@ 2010-10-25  6:17           ` Ciaran McCreesh
  2010-10-26 19:46             ` [gentoo-dev] EAPI 4 features not yet in PMS (was: Patch for python.eclass) Ulrich Mueller
  0 siblings, 1 reply; 18+ messages in thread
From: Ciaran McCreesh @ 2010-10-25  6:17 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]

On Sun, 24 Oct 2010 23:47:56 +0200
Arfrever Frehtes Taifersar Arahesis <Arfrever@gentoo.org> wrote:
> > > Usage of new EAPIs in the tree is not allowed before council
> > > approval.
> > 
> > python.eclass doesn't use any EAPIs, it only provides support for
> > ebuilds, which use given EAPIs (without EAPI="4").
> 
> I forgot to say that this patch doesn't introduce usage of any
> feature absent in EAPI="3" and present in current draft of EAPI="4",
> but changes API of python.eclass in EAPI="4".

For all we know, EAPI 4 may be completely changed next week and then
allowed in the tree the week after. Then people looking at your eclass
will incorrectly assume that it supports the approved EAPI 4.

EAPI 4's current state used to be "closed, and approved subject to
Portage implementation", but due to the huge delays in that there have
been a number of things since then that the Council has voted on that
no-one has provided PMS patches or even approximate wording for. Unless
you've been keeping very close track of that, you don't even know what
EAPI 4 is likely to contain, let alone what it eventually will
contain...

-- 
Ciaran McCreesh

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [gentoo-dev] EAPI 4 features not yet in PMS (was: Patch for python.eclass)
  2010-10-25  6:17           ` Ciaran McCreesh
@ 2010-10-26 19:46             ` Ulrich Mueller
  0 siblings, 0 replies; 18+ messages in thread
From: Ulrich Mueller @ 2010-10-26 19:46 UTC (permalink / raw
  To: gentoo-dev

>>>>> On Mon, 25 Oct 2010, Ciaran McCreesh wrote:

> EAPI 4's current state used to be "closed, and approved subject to
> Portage implementation", but due to the huge delays in that there have
> been a number of things since then that the Council has voted on that
> no-one has provided PMS patches or even approximate wording for.

What EAPI 4 features are missing in PMS? I'm only aware of
REQUIRED_USE: <http://dev.gentoo.org/~ferringb/required-use.html>

Is there anything else that is missing?

Ulrich



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2010-10-26 19:46 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-18  1:33 [gentoo-dev] Patch for python.eclass Arfrever Frehtes Taifersar Arahesis
2010-10-18  7:06 ` [gentoo-dev] " Mike Frysinger
2010-10-18 15:10   ` Arfrever Frehtes Taifersar Arahesis
2010-10-18 15:15     ` Diego Elio Pettenò
2010-10-22  7:56       ` Mike Frysinger
2010-10-23 19:21         ` Arfrever Frehtes Taifersar Arahesis
2010-10-18 15:26 ` [gentoo-dev] " Petteri Räty
2010-10-24 18:49   ` Arfrever Frehtes Taifersar Arahesis
2010-10-24 18:54     ` Petteri Räty
2010-10-24 19:22       ` Arfrever Frehtes Taifersar Arahesis
2010-10-24 21:47         ` Arfrever Frehtes Taifersar Arahesis
2010-10-25  6:17           ` Ciaran McCreesh
2010-10-26 19:46             ` [gentoo-dev] EAPI 4 features not yet in PMS (was: Patch for python.eclass) Ulrich Mueller
2010-10-23 20:54 ` [gentoo-dev] Patch for python.eclass Arfrever Frehtes Taifersar Arahesis
2010-10-23 20:57   ` Markos Chandras
2010-10-24 18:29   ` Petteri Räty
  -- strict thread matches above, loose matches on Subject: below --
2010-09-20  1:18 Arfrever Frehtes Taifersar Arahesis
2010-09-24 17:39 ` Arfrever Frehtes Taifersar Arahesis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox