public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in eclass: python-r1.eclass ChangeLog
@ 2012-10-29  9:23 Michal Gorny (mgorny)
  0 siblings, 0 replies; 7+ messages in thread
From: Michal Gorny (mgorny) @ 2012-10-29  9:23 UTC (permalink / raw
  To: gentoo-commits

mgorny      12/10/29 09:23:59

  Modified:             python-r1.eclass ChangeLog
  Log:
  Add getters for common Python variables.

Revision  Changes    Path
1.9                  eclass/python-r1.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.9&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.9&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?r1=1.8&r2=1.9

Index: python-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- python-r1.eclass	29 Oct 2012 09:22:13 -0000	1.8
+++ python-r1.eclass	29 Oct 2012 09:23:58 -0000	1.9
@@ -1,6 +1,6 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.8 2012/10/29 09:22:13 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.9 2012/10/29 09:23:58 mgorny Exp $
 
 # @ECLASS: python-r1
 # @MAINTAINER:
@@ -283,6 +283,52 @@
 	done
 }
 
+# @FUNCTION: python_get_PYTHON
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the path to the Python interpreter for the given
+# implementation. If no implementation is provided, ${EPYTHON} will
+# be used.
+#
+# If you just need to have PYTHON set (and exported), then it is better
+# to use python_export() directly instead.
+python_get_PYTHON() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	python_export "${@}" PYTHON
+	echo "${PYTHON}"
+}
+
+# @FUNCTION: python_get_EPYTHON
+# @USAGE: <impl>
+# @DESCRIPTION:
+# Obtain and print the EPYTHON value for the given implementation.
+#
+# If you just need to have EPYTHON set (and exported), then it is better
+# to use python_export() directly instead.
+python_get_EPYTHON() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	python_export "${@}" EPYTHON
+	echo "${EPYTHON}"
+}
+
+# @FUNCTION: python_get_sitedir
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the 'site-packages' path for the given
+# implementation. If no implementation is provided, ${EPYTHON} will
+# be used.
+#
+# If you just need to have PYTHON_SITEDIR set (and exported), then it is
+# better to use python_export() directly instead.
+python_get_sitedir() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	python_export "${@}" PYTHON_SITEDIR
+	echo "${PYTHON_SITEDIR}"
+}
+
 # @FUNCTION: python_copy_sources
 # @DESCRIPTION:
 # Create a single copy of the package sources (${S}) for each enabled



1.475                eclass/ChangeLog

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.475&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.475&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.474&r2=1.475

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.474
retrieving revision 1.475
diff -u -r1.474 -r1.475
--- ChangeLog	29 Oct 2012 09:22:13 -0000	1.474
+++ ChangeLog	29 Oct 2012 09:23:58 -0000	1.475
@@ -1,6 +1,9 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.474 2012/10/29 09:22:13 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.475 2012/10/29 09:23:58 mgorny Exp $
+
+  29 Oct 2012; Michał Górny <mgorny@gentoo.org> python-r1.eclass:
+  Add getters for common Python variables.
 
   29 Oct 2012; Michał Górny <mgorny@gentoo.org> python-r1.eclass:
   Add support for obtaining Python site-packages directory.





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

* [gentoo-commits] gentoo-x86 commit in eclass: python-r1.eclass ChangeLog
@ 2012-10-29  9:46 Michal Gorny (mgorny)
  0 siblings, 0 replies; 7+ messages in thread
From: Michal Gorny (mgorny) @ 2012-10-29  9:46 UTC (permalink / raw
  To: gentoo-commits

mgorny      12/10/29 09:46:03

  Modified:             python-r1.eclass ChangeLog
  Log:
  Introduce python_replicate_script(), to create copies of a Python script for all installed implementations.

Revision  Changes    Path
1.11                 eclass/python-r1.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.11&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.11&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?r1=1.10&r2=1.11

Index: python-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- python-r1.eclass	29 Oct 2012 09:25:04 -0000	1.10
+++ python-r1.eclass	29 Oct 2012 09:46:03 -0000	1.11
@@ -1,6 +1,6 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.10 2012/10/29 09:25:04 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.11 2012/10/29 09:46:03 mgorny Exp $
 
 # @ECLASS: python-r1
 # @MAINTAINER:
@@ -412,3 +412,129 @@
 	debug-print "${FUNCNAME}: Best implementation is: ${impl}"
 	python_export "${impl}" "${@}"
 }
+
+# @FUNCTION: _python_rewrite_shebang
+# @INTERNAL
+# @USAGE: [<EPYTHON>] <path>...
+# @DESCRIPTION:
+# Replaces 'python' executable in the shebang with the executable name
+# of the specified interpreter. If no EPYTHON value (implementation) is
+# used, the current ${EPYTHON} will be used.
+#
+# All specified files must start with a 'python' shebang. A file not
+# having a matching shebang will be refused. The exact shebang style
+# will be preserved in order not to break anything.
+#
+# Example conversions:
+# @CODE
+# From: #!/usr/bin/python -R
+# To: #!/usr/bin/python2.7 -R
+#
+# From: #!/usr/bin/env FOO=bar python
+# To: #!/usr/bin/env FOO=bar python2.7
+# @CODE
+_python_rewrite_shebang() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	local impl
+	case "${1}" in
+		python*|jython*|pypy-c*)
+			impl=${1}
+			shift
+			;;
+		*)
+			impl=${EPYTHON}
+			[[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON"
+			;;
+	esac
+	debug-print "${FUNCNAME}: implementation: ${impl}"
+
+	local f
+	for f; do
+		local shebang=$(head -n 1 "${f}")
+		debug-print "${FUNCNAME}: path = ${f}"
+		debug-print "${FUNCNAME}: shebang = ${shebang}"
+
+		if [[ "${shebang} " != *'python '* ]]; then
+			eerror "A file does not seem to have a supported shebang:"
+			eerror "  file: ${f}"
+			eerror "  shebang: ${shebang}"
+			die "${FUNCNAME}: ${f} does not seem to have a valid shebang"
+		fi
+
+		sed -i -e "s:python:${impl}:" "${f}" || die
+	done
+}
+
+# @FUNCTION: _python_ln_rel
+# @USAGE: <from> <to>
+# @DESCRIPTION:
+# Create a relative symlink.
+_python_ln_rel() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	local from=${1}
+	local to=${2}
+
+	local frpath=${from%/*}/
+	local topath=${to%/*}/
+	local rel_path=
+
+	# remove double slashes
+	frpath=${frpath/\/\///}
+	topath=${topath/\/\///}
+
+	while [[ ${topath} ]]; do
+		local frseg=${frpath%%/*}
+		local toseg=${topath%%/*}
+
+		if [[ ${frseg} != ${toseg} ]]; then
+			rel_path=../${rel_path}${frseg:+${frseg}/}
+		fi
+
+		frpath=${frpath#${frseg}/}
+		topath=${topath#${toseg}/}
+	done
+	rel_path+=${frpath}${1##*/}
+
+	debug-print "${FUNCNAME}: ${from} -> ${to}"
+	debug-print "${FUNCNAME}: rel_path = ${rel_path}"
+
+	ln -fs "${rel_path}" "${to}"
+}
+
+# @FUNCTION: python_replicate_script
+# @USAGE: <path>...
+# @DESCRIPTION:
+# Copy the given script to variants for all enabled Python
+# implementations, then replace it with a symlink to the wrapper.
+#
+# All specified files must start with a 'python' shebang. A file not
+# having a matching shebang will be refused.
+python_replicate_script() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	local suffixes=()
+
+	_add_suffix() {
+		suffixes+=( "${EPYTHON}" )
+	}
+	python_foreach_impl _add_suffix
+	debug-print "${FUNCNAME}: suffixes = ( ${suffixes[@]} )"
+
+	local f suffix
+	for suffix in "${suffixes[@]}"; do
+		for f; do
+			local newf=${f}-${suffix}
+
+			debug-print "${FUNCNAME}: ${f} -> ${newf}"
+			cp "${f}" "${newf}" || die
+		done
+
+		_python_rewrite_shebang "${suffix}" "${@/%/-${suffix}}"
+	done
+
+	for f; do
+		_python_ln_rel "${ED}"/usr/bin/python-exec "${f}" || die
+	done
+}



1.477                eclass/ChangeLog

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.477&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.477&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.476&r2=1.477

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.476
retrieving revision 1.477
diff -u -r1.476 -r1.477
--- ChangeLog	29 Oct 2012 09:25:04 -0000	1.476
+++ ChangeLog	29 Oct 2012 09:46:03 -0000	1.477
@@ -1,6 +1,10 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.476 2012/10/29 09:25:04 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.477 2012/10/29 09:46:03 mgorny Exp $
+
+  29 Oct 2012; Michał Górny <mgorny@gentoo.org> python-r1.eclass:
+  Introduce python_replicate_script(), to create copies of a Python script for
+  all installed implementations.
 
   29 Oct 2012; Michał Górny <mgorny@gentoo.org> python-r1.eclass:
   Introduce python_export_best() to obtain variables for the most preferred





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

* [gentoo-commits] gentoo-x86 commit in eclass: python-r1.eclass ChangeLog
@ 2012-10-31 14:18 Michal Gorny (mgorny)
  0 siblings, 0 replies; 7+ messages in thread
From: Michal Gorny (mgorny) @ 2012-10-31 14:18 UTC (permalink / raw
  To: gentoo-commits

mgorny      12/10/31 14:18:41

  Modified:             python-r1.eclass ChangeLog
  Log:
  Fix the shebang correcting function to patch shebang only. Thanks to Enlik for the patch.

Revision  Changes    Path
1.14                 eclass/python-r1.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.14&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.14&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?r1=1.13&r2=1.14

Index: python-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- python-r1.eclass	29 Oct 2012 11:27:30 -0000	1.13
+++ python-r1.eclass	31 Oct 2012 14:18:41 -0000	1.14
@@ -1,6 +1,6 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.13 2012/10/29 11:27:30 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.14 2012/10/31 14:18:41 mgorny Exp $
 
 # @ECLASS: python-r1
 # @MAINTAINER:
@@ -466,7 +466,7 @@
 			die "${FUNCNAME}: ${f} does not seem to have a valid shebang"
 		fi
 
-		sed -i -e "s:python:${impl}:" "${f}" || die
+		sed -i -e "1s:python:${impl}:" "${f}" || die
 	done
 }
 



1.490                eclass/ChangeLog

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.490&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.490&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.489&r2=1.490

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.489
retrieving revision 1.490
diff -u -r1.489 -r1.490
--- ChangeLog	31 Oct 2012 01:51:52 -0000	1.489
+++ ChangeLog	31 Oct 2012 14:18:41 -0000	1.490
@@ -1,6 +1,10 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.489 2012/10/31 01:51:52 tetromino Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.490 2012/10/31 14:18:41 mgorny Exp $
+
+  31 Oct 2012; Michał Górny <mgorny@gentoo.org> python-r1.eclass:
+  Fix the shebang correcting function to patch shebang only. Thanks to Enlik
+  for the patch.
 
   31 Oct 2012; Alexandre Rostovtsev <tetromino@gentoo.org>
   gst-plugins10.eclass:





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

* [gentoo-commits] gentoo-x86 commit in eclass: python-r1.eclass ChangeLog
@ 2012-11-01 21:49 Michal Gorny (mgorny)
  0 siblings, 0 replies; 7+ messages in thread
From: Michal Gorny (mgorny) @ 2012-11-01 21:49 UTC (permalink / raw
  To: gentoo-commits

mgorny      12/11/01 21:49:34

  Modified:             python-r1.eclass ChangeLog
  Log:
  Minor documentation improvements.

Revision  Changes    Path
1.16                 eclass/python-r1.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.16&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.16&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?r1=1.15&r2=1.16

Index: python-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- python-r1.eclass	1 Nov 2012 21:43:22 -0000	1.15
+++ python-r1.eclass	1 Nov 2012 21:49:34 -0000	1.16
@@ -1,6 +1,6 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.15 2012/11/01 21:43:22 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.16 2012/11/01 21:49:34 mgorny Exp $
 
 # @ECLASS: python-r1
 # @MAINTAINER:
@@ -87,8 +87,7 @@
 #
 # It will cause the Python dependencies to look like:
 # @CODE
-# python_targets_pythonX_Y? (
-#   dev-lang/python:X_Y[gdbm,ncurses(-)?] )
+# python_targets_pythonX_Y? ( dev-lang/python:X.Y[gdbm,ncurses(-)?] )
 # @CODE
 
 # @ECLASS-VARIABLE: PYTHON_DEPS
@@ -99,14 +98,15 @@
 # Example use:
 # @CODE
 # RDEPEND="${PYTHON_DEPS}
-#   dev-foo/mydep"
+#	dev-foo/mydep"
 # DEPEND="${RDEPEND}"
 # @CODE
 #
 # Example value:
 # @CODE
-# python_targets2_6? ( dev-lang/python:2.6[gdbm] )
-# python_targets2_7? ( dev-lang/python:2.7[gdbm] )
+# dev-python/python-exec
+# python_targets_python2_6? ( dev-lang/python:2.6[gdbm] )
+# python_targets_python2_7? ( dev-lang/python:2.7[gdbm] )
 # @CODE
 
 # @ECLASS-VARIABLE: PYTHON_USEDEP
@@ -212,6 +212,7 @@
 #
 # Example value:
 # @CODE
+# /usr/lib64/python2.6/site-packages
 # @CODE
 
 # @FUNCTION: python_export



1.497                eclass/ChangeLog

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.497&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.497&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.496&r2=1.497

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.496
retrieving revision 1.497
diff -u -r1.496 -r1.497
--- ChangeLog	1 Nov 2012 21:43:22 -0000	1.496
+++ ChangeLog	1 Nov 2012 21:49:34 -0000	1.497
@@ -1,6 +1,9 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.496 2012/11/01 21:43:22 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.497 2012/11/01 21:49:34 mgorny Exp $
+
+  01 Nov 2012; Michał Górny <mgorny@gentoo.org> python-r1.eclass:
+  Minor documentation improvements.
 
   01 Nov 2012; Michał Górny <mgorny@gentoo.org> python-r1.eclass:
   Mark _python_ln_rel as @INTERNAL.





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

* [gentoo-commits] gentoo-x86 commit in eclass: python-r1.eclass ChangeLog
@ 2012-11-19 21:38 Michal Gorny (mgorny)
  0 siblings, 0 replies; 7+ messages in thread
From: Michal Gorny (mgorny) @ 2012-11-19 21:38 UTC (permalink / raw
  To: gentoo-commits

mgorny      12/11/19 21:38:33

  Modified:             python-r1.eclass ChangeLog
  Log:
  Introduce a check for USE_PYTHON & PYTHON_TARGETS compatibility.

Revision  Changes    Path
1.18                 eclass/python-r1.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.18&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.18&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?r1=1.17&r2=1.18

Index: python-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- python-r1.eclass	4 Nov 2012 15:16:34 -0000	1.17
+++ python-r1.eclass	19 Nov 2012 21:38:33 -0000	1.18
@@ -1,6 +1,6 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.17 2012/11/04 15:16:34 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.18 2012/11/19 21:38:33 mgorny Exp $
 
 # @ECLASS: python-r1
 # @MAINTAINER:
@@ -363,6 +363,202 @@
 	done
 }
 
+# @FUNCTION: _python_check_USE_PYTHON
+# @INTERNAL
+# @DESCRIPTION:
+# Check whether USE_PYTHON and PYTHON_TARGETS are in sync. Output
+# warnings if they are not.
+_python_check_USE_PYTHON() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	if [[ ! ${_PYTHON_USE_PYTHON_CHECKED} ]]; then
+		_PYTHON_USE_PYTHON_CHECKED=1
+
+		# python-exec has profile-forced flags.
+		if [[ ${CATEGORY}/${PN} == dev-python/python-exec ]]; then
+			return
+		fi
+
+		_try_eselect() {
+			# The eselect solution will work only with one py2 & py3.
+
+			local impl py2 py3 dis_py2 dis_py3
+			for impl in "${PYTHON_COMPAT[@]}"; do
+				if use "python_targets_${impl}"; then
+					case "${impl}" in
+						python2_*)
+							if [[ ${py2+1} ]]; then
+								debug-print "${FUNCNAME}: -> more than one py2: ${py2} ${impl}"
+								return 1
+							fi
+							py2=${impl/_/.}
+							;;
+						python3_*)
+							if [[ ${py3+1} ]]; then
+								debug-print "${FUNCNAME}: -> more than one py3: ${py3} ${impl}"
+								return 1
+							fi
+							py3=${impl/_/.}
+							;;
+						*)
+							return 1
+							;;
+					esac
+				else
+					case "${impl}" in
+						python2_*)
+							dis_py2=1
+							;;
+						python3_*)
+							dis_py3=1
+							;;
+					esac
+				fi
+			done
+
+			# The eselect solution won't work if the disabled Python version
+			# is installed.
+			if [[ ! ${py2+1} && ${dis_py2} ]]; then
+				debug-print "${FUNCNAME}: -> all py2 versions disabled"
+				if has_version '=dev-lang/python-2*'; then
+					debug-print "${FUNCNAME}: ---> but =python-2* installed!"
+					return 1
+				fi
+			fi
+			if [[ ! ${py3+1} && ${dis_py3} ]]; then
+				debug-print "${FUNCNAME}: -> all py3 versions disabled"
+				if has_version '=dev-lang/python-3*'; then
+					debug-print "${FUNCNAME}: ---> but =python-3* installed!"
+					return 1
+				fi
+			fi
+
+			local warned
+
+			# Now check whether the correct implementations are active.
+			if [[ ${py2+1} ]]; then
+				local sel_py2=$(eselect python show --python2)
+
+				debug-print "${FUNCNAME}: -> py2 built: ${py2}, active: ${sel_py2}"
+				if [[ ${py2} != ${sel_py2} ]]; then
+					ewarn "Building package for ${py2} only while ${sel_py2} is active."
+					ewarn "Please consider switching the active Python 2 interpreter:"
+					ewarn
+					ewarn "	eselect python set --python2 ${py2}"
+					warned=1
+				fi
+			fi
+
+			if [[ ${py3+1} ]]; then
+				local sel_py3=$(eselect python show --python3)
+
+				debug-print "${FUNCNAME}: -> py3 built: ${py3}, active: ${sel_py3}"
+				if [[ ${py3} != ${sel_py3} ]]; then
+					[[ ${warned} ]] && ewarn
+					ewarn "Building package for ${py3} only while ${sel_py3} is active."
+					ewarn "Please consider switching the active Python 3 interpreter:"
+					ewarn
+					ewarn "	eselect python set --python3 ${py3}"
+					warned=1
+				fi
+			fi
+
+			if [[ ${warned} ]]; then
+				ewarn
+				ewarn "Please note that after switching the active Python interpreter,"
+				ewarn "you may need to run 'python-updater' to rebuild affected packages."
+				ewarn
+				ewarn "For more information on python.eclass compatibility, please see"
+				ewarn "the appropriate python-r1 User's Guide chapter [1]."
+				ewarn
+				ewarn "[1] http://www.gentoo.org/proj/en/Python/python-r1/user-guide.xml#doc_chap2"
+			fi
+		}
+
+		# If user has no USE_PYTHON, try to avoid it.
+		if [[ ! ${USE_PYTHON} ]]; then
+			debug-print "${FUNCNAME}: trying eselect solution ..."
+			_try_eselect && return
+		fi
+
+		debug-print "${FUNCNAME}: trying USE_PYTHON solution ..."
+		debug-print "${FUNCNAME}: -> USE_PYTHON=${USE_PYTHON}"
+
+		local impl old=${USE_PYTHON} new=() removed=()
+
+		for impl in "${PYTHON_COMPAT[@]}"; do
+			local abi
+			case "${impl}" in
+				python*)
+					abi=${impl#python}
+					;;
+				jython*)
+					abi=${impl#jython}-jython
+					;;
+				pypy*)
+					abi=2.7-pypy-${impl#pypy}
+					;;
+				*)
+					die "Unexpected Python implementation: ${impl}"
+					;;
+			esac
+			abi=${abi/_/.}
+
+			has "${abi}" ${USE_PYTHON}
+			local has_abi=${?}
+			use "python_targets_${impl}"
+			local has_impl=${?}
+
+			# 0 = has, 1 = does not have
+			if [[ ${has_abi} == 0 && ${has_impl} == 1 ]]; then
+				debug-print "${FUNCNAME}: ---> remove ${abi}"
+				# remove from USE_PYTHON
+				old=${old/${abi}/}
+				removed+=( ${abi} )
+			elif [[ ${has_abi} == 1 && ${has_impl} == 0 ]]; then
+				debug-print "${FUNCNAME}: ---> add ${abi}"
+				# add to USE_PYTHON
+				new+=( ${abi} )
+			fi
+		done
+
+		if [[ ${removed[@]} || ${new[@]} ]]; then
+			old=( ${old} )
+
+			debug-print "${FUNCNAME}: -> old: ${old[@]}"
+			debug-print "${FUNCNAME}: -> new: ${new[@]}"
+			debug-print "${FUNCNAME}: -> removed: ${removed[@]}"
+
+			if [[ ${USE_PYTHON} ]]; then
+				ewarn "It seems that your USE_PYTHON setting lists different Python"
+				ewarn "implementations than your PYTHON_TARGETS variable. Please consider"
+				ewarn "using the following value instead:"
+				ewarn
+				ewarn "	USE_PYTHON='\033[35m${old[@]}${new[@]+ \033[1m${new[@]}}\033[0m'"
+
+				if [[ ${removed[@]} ]]; then
+					ewarn
+					ewarn "(removed \033[31m${removed[@]}\033[0m)"
+				fi
+			else
+				ewarn "It seems that you need to set USE_PYTHON to make sure that legacy"
+				ewarn "packages will be built with respect to PYTHON_TARGETS correctly:"
+				ewarn
+				ewarn "	USE_PYTHON='\033[35;1m${new[@]}\033[0m'"
+			fi
+
+			ewarn
+			ewarn "Please note that after changing the USE_PYTHON variable, you may need"
+			ewarn "to run 'python-updater' to rebuild affected packages."
+			ewarn
+			ewarn "For more information on python.eclass compatibility, please see"
+			ewarn "the appropriate python-r1 User's Guide chapter [1]."
+			ewarn
+			ewarn "[1] http://www.gentoo.org/proj/en/Python/python-r1/user-guide.xml#doc_chap2"
+		fi
+	fi
+}
+
 # @FUNCTION: python_foreach_impl
 # @USAGE: <command> [<args>...]
 # @DESCRIPTION:
@@ -376,6 +572,8 @@
 python_foreach_impl() {
 	debug-print-function ${FUNCNAME} "${@}"
 
+	_python_check_USE_PYTHON
+
 	local impl
 	local bdir=${BUILD_DIR:-${S}}
 



1.513                eclass/ChangeLog

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.513&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.513&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.512&r2=1.513

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.512
retrieving revision 1.513
diff -u -r1.512 -r1.513
--- ChangeLog	19 Nov 2012 20:35:16 -0000	1.512
+++ ChangeLog	19 Nov 2012 21:38:33 -0000	1.513
@@ -1,6 +1,9 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.512 2012/11/19 20:35:16 slyfox Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.513 2012/11/19 21:38:33 mgorny Exp $
+
+  19 Nov 2012; Michał Górny <mgorny@gentoo.org> python-r1.eclass:
+  Introduce a check for USE_PYTHON & PYTHON_TARGETS compatibility.
 
   19 Nov 2012; Sergei Trofimovich <slyfox@gentoo.org> haskell-cabal.eclass:
   Added new helper function 'cabal_chdeps' and and debug variable





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

* [gentoo-commits] gentoo-x86 commit in eclass: python-r1.eclass ChangeLog
@ 2012-12-16 21:42 Michal Gorny (mgorny)
  0 siblings, 0 replies; 7+ messages in thread
From: Michal Gorny (mgorny) @ 2012-12-16 21:42 UTC (permalink / raw
  To: gentoo-commits

mgorny      12/12/16 21:42:33

  Modified:             python-r1.eclass ChangeLog
  Log:
  Temporarily disable PYTHON_SINGLE_TARGET safety check because of issues with paludis, bug #447524.

Revision  Changes    Path
1.27                 eclass/python-r1.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.27&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.27&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?r1=1.26&r2=1.27

Index: python-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- python-r1.eclass	14 Dec 2012 08:41:59 -0000	1.26
+++ python-r1.eclass	16 Dec 2012 21:42:33 -0000	1.27
@@ -1,6 +1,6 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.26 2012/12/14 08:41:59 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.27 2012/12/16 21:42:33 mgorny Exp $
 
 # @ECLASS: python-r1
 # @MAINTAINER:
@@ -133,9 +133,12 @@
 
 _python_set_globals() {
 	local flags=( "${PYTHON_COMPAT[@]/#/python_targets_}" )
-	local flags_st=( "${PYTHON_COMPAT[@]/#/-python_single_target_}" )
+	#local flags_st=( "${PYTHON_COMPAT[@]/#/-python_single_target_}" )
 	local optflags=${flags[@]/%/?}
-	optflags+=,${flags_st[@]/%/(-)}
+	#optflags+=,${flags_st[@]/%/(-)}
+
+	# PYTHON_SINGLE_TARGET safety check temporarily disabled
+	# because of issues with paludis, bug #447524.
 
 	IUSE=${flags[*]}
 	REQUIRED_USE="|| ( ${flags[*]} )"



1.563                eclass/ChangeLog

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.563&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.563&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.562&r2=1.563

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.562
retrieving revision 1.563
diff -u -r1.562 -r1.563
--- ChangeLog	16 Dec 2012 14:11:58 -0000	1.562
+++ ChangeLog	16 Dec 2012 21:42:33 -0000	1.563
@@ -1,6 +1,10 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.562 2012/12/16 14:11:58 eva Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.563 2012/12/16 21:42:33 mgorny Exp $
+
+  16 Dec 2012; Michał Górny <mgorny@gentoo.org> python-r1.eclass:
+  Temporarily disable PYTHON_SINGLE_TARGET safety check because of issues with
+  paludis, bug #447524.
 
   16 Dec 2012; Gilles Dartiguelongue <eva@gentoo.org> gnome2.eclass:
   Pass --disable-schemas-compile from gsettings.m4 in gnome2_src_configure.





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

* [gentoo-commits] gentoo-x86 commit in eclass: python-r1.eclass ChangeLog
@ 2014-11-09 15:10 Sebastian Pipping (sping)
  0 siblings, 0 replies; 7+ messages in thread
From: Sebastian Pipping (sping) @ 2014-11-09 15:10 UTC (permalink / raw
  To: gentoo-commits

sping       14/11/09 15:10:32

  Modified:             python-r1.eclass ChangeLog
  Log:
  Use python 3.4 rather than dead 3.2 in python-r1 examples

Revision  Changes    Path
1.78                 eclass/python-r1.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.78&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.78&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?r1=1.77&r2=1.78

Index: python-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- python-r1.eclass	5 Nov 2014 23:03:01 -0000	1.77
+++ python-r1.eclass	9 Nov 2014 15:10:32 -0000	1.78
@@ -1,6 +1,6 @@
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.77 2014/11/05 23:03:01 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.78 2014/11/09 15:10:32 sping Exp $
 
 # @ECLASS: python-r1
 # @MAINTAINER:
@@ -262,7 +262,7 @@
 #
 # Example:
 # @CODE
-# PYTHON_COMPAT=( python{2_7,3_2} )
+# PYTHON_COMPAT=( python{2_7,3_4} )
 # DEPEND="doc? ( dev-python/epydoc[$(python_gen_usedep 'python2*')] )"
 # @CODE
 #
@@ -305,7 +305,7 @@
 #
 # Example:
 # @CODE
-# PYTHON_COMPAT=( python{2_7,3_2} )
+# PYTHON_COMPAT=( python{2_7,3_4} )
 # REQUIRED_USE="doc? ( || ( $(python_gen_useflags python2*) ) )"
 # @CODE
 #



1.1409               eclass/ChangeLog

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1409&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1409&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1408&r2=1.1409

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.1408
retrieving revision 1.1409
diff -u -r1.1408 -r1.1409
--- ChangeLog	7 Nov 2014 18:18:33 -0000	1.1408
+++ ChangeLog	9 Nov 2014 15:10:32 -0000	1.1409
@@ -1,6 +1,9 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1408 2014/11/07 18:18:33 axs Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1409 2014/11/09 15:10:32 sping Exp $
+
+  09 Nov 2014; Sebastian Pipping <sping@gentoo.org> python-r1.eclass:
+  Use python 3.4 rather than dead 3.2 in python-r1 examples
 
   07 Nov 2014; Ian Stakenvicius (_AxS_) <axs@gentoo.org>
   python-single-r1.eclass:





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

end of thread, other threads:[~2014-11-09 15:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-01 21:49 [gentoo-commits] gentoo-x86 commit in eclass: python-r1.eclass ChangeLog Michal Gorny (mgorny)
  -- strict thread matches above, loose matches on Subject: below --
2014-11-09 15:10 Sebastian Pipping (sping)
2012-12-16 21:42 Michal Gorny (mgorny)
2012-11-19 21:38 Michal Gorny (mgorny)
2012-10-31 14:18 Michal Gorny (mgorny)
2012-10-29  9:46 Michal Gorny (mgorny)
2012-10-29  9:23 Michal Gorny (mgorny)

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