public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH python-r1 1/8] python_export: support obtaining site-packages directory.
@ 2012-10-27 11:02 Michał Górny
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 2/8] Add getter-style wrappers for python_export() Michał Górny
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Michał Górny @ 2012-10-27 11:02 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

---
 gx86/eclass/python-r1.eclass | 34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 9ca0791..45ed0cb 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -36,6 +36,8 @@ case "${EAPI}" in
 		;;
 esac
 
+inherit multilib
+
 # @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
 # @INTERNAL
 # @DESCRIPTION:
@@ -198,6 +200,16 @@ _python_set_globals
 # python2.6
 # @CODE
 
+# @ECLASS-VARIABLE: PYTHON_SITEDIR
+# @DESCRIPTION:
+# The path to Python site-packages directory.
+#
+# Set and exported on request using python_export().
+#
+# Example value:
+# @CODE
+# @CODE
+
 # @FUNCTION: python_export
 # @USAGE: [<impl>] <variables>...
 # @DESCRIPTION:
@@ -209,8 +221,9 @@ _python_set_globals
 # or an EPYTHON one, e.g. python2.7). If no implementation passed,
 # the current one will be obtained from ${EPYTHON}.
 #
-# The variables which can be exported are: PYTHON, EPYTHON. They are
-# described more completely in the eclass variable documentation.
+# The variables which can be exported are: PYTHON, EPYTHON,
+# PYTHON_SITEDIR. They are described more completely in the eclass
+# variable documentation.
 python_export() {
 	debug-print-function ${FUNCNAME} "${@}"
 
@@ -247,6 +260,23 @@ python_export() {
 				export PYTHON=${EPREFIX}/usr/bin/${impl}
 				debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
 				;;
+			PYTHON_SITEDIR)
+				local dir
+				case "${impl}" in
+					python*)
+						dir=/usr/$(get_libdir)/${impl}
+						;;
+					jython*)
+						dir=/usr/share/${impl}/Lib
+						;;
+					pypy*)
+						dir=/usr/$(get_libdir)/${impl/-c/}
+						;;
+				esac
+
+				export PYTHON_SITEDIR=${EPREFIX}${dir}/site-packages
+				debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
+				;;
 			*)
 				die "python_export: unknown variable ${var}"
 		esac
-- 
1.7.12.4



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

* [gentoo-dev] [PATCH python-r1 2/8] Add getter-style wrappers for python_export().
  2012-10-27 11:02 [gentoo-dev] [PATCH python-r1 1/8] python_export: support obtaining site-packages directory Michał Górny
@ 2012-10-27 11:02 ` Michał Górny
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 3/8] Add python_export_best() to obtain best impl info Michał Górny
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Michał Górny @ 2012-10-27 11:02 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

---
 gx86/eclass/python-r1.eclass | 46 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 45ed0cb..b059a3b 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -283,6 +283,52 @@ python_export() {
 	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.7.12.4



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

* [gentoo-dev] [PATCH python-r1 3/8] Add python_export_best() to obtain best impl info.
  2012-10-27 11:02 [gentoo-dev] [PATCH python-r1 1/8] python_export: support obtaining site-packages directory Michał Górny
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 2/8] Add getter-style wrappers for python_export() Michał Górny
@ 2012-10-27 11:02 ` Michał Górny
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 4/8] Introduce functions to replicate Python scripts Michał Górny
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Michał Górny @ 2012-10-27 11:02 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

---
 gx86/eclass/python-r1.eclass | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index b059a3b..d7cdfa8 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -387,3 +387,28 @@ python_foreach_impl() {
 		fi
 	done
 }
+
+# @FUNCTION: python_export_best
+# @USAGE: [<variable>...]
+# @DESCRIPTION:
+# Find the best (most preferred) Python implementation enabled
+# and export given variables for it. If no variables are provided,
+# EPYTHON & PYTHON will be exported.
+python_export_best() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	[[ ${#} -gt 0 ]] || set -- EPYTHON PYTHON
+
+	local impl best
+	for impl in "${_PYTHON_ALL_IMPLS[@]}"; do
+		if has "${impl}" "${PYTHON_COMPAT[@]}" && use "python_targets_${impl}"
+		then
+			best=${impl}
+		fi
+	done
+
+	[[ ${best+1} ]] || die "python_export_best(): no implementation found!"
+
+	debug-print "${FUNCNAME}: Best implementation is: ${impl}"
+	python_export "${impl}" "${@}"
+}
-- 
1.7.12.4



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

* [gentoo-dev] [PATCH python-r1 4/8] Introduce functions to replicate Python scripts.
  2012-10-27 11:02 [gentoo-dev] [PATCH python-r1 1/8] python_export: support obtaining site-packages directory Michał Górny
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 2/8] Add getter-style wrappers for python_export() Michał Górny
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 3/8] Add python_export_best() to obtain best impl info Michał Górny
@ 2012-10-27 11:02 ` Michał Górny
  2012-10-27 13:27   ` Reinis Danne
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 5/8] Convert x11-misc/redshift to python-r1 (example) Michał Górny
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Michał Górny @ 2012-10-27 11:02 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

This can be used to create copies of Python scripts for various
implementation when build system doesn't do that.
---
 gx86/eclass/python-r1.eclass | 126 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 126 insertions(+)

diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index d7cdfa8..6178969 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -412,3 +412,129 @@ python_export_best() {
 	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_scripts
+# @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_scripts() {
+	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.7.12.4



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

* [gentoo-dev] [PATCH python-r1 5/8] Convert x11-misc/redshift to python-r1 (example).
  2012-10-27 11:02 [gentoo-dev] [PATCH python-r1 1/8] python_export: support obtaining site-packages directory Michał Górny
                   ` (2 preceding siblings ...)
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 4/8] Introduce functions to replicate Python scripts Michał Górny
@ 2012-10-27 11:02 ` Michał Górny
  2012-10-29 15:25   ` Ian Stakenvicius
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 6/8] Reuse _python_ln_rel in distutils-r1 Michał Górny
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Michał Górny @ 2012-10-27 11:02 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

This serves as an example how the new functions can be used.
---
 gx86/x11-misc/redshift/redshift-1.7-r1.ebuild | 33 ++++++++++++---------------
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild b/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild
index f3bd210..589e571 100644
--- a/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild
+++ b/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild
@@ -3,12 +3,9 @@
 # $Header: /var/cvsroot/gentoo-x86/x11-misc/redshift/redshift-1.7-r1.ebuild,v 1.5 2012/08/16 20:40:38 hasufell Exp $
 
 EAPI=4
+PYTHON_COMPAT=( python{2_6,2_7} )
 
-PYTHON_DEPEND="gtk? 2:2.6"
-SUPPORT_PYTHON_ABIS="1"
-RESTRICT_PYTHON_ABIS="2.[45] 3.*"
-
-inherit autotools eutils gnome2-utils python
+inherit autotools eutils gnome2-utils python-r1
 
 DESCRIPTION="A screen color temperature adjusting software"
 HOMEPAGE="http://jonls.dk/redshift/"
@@ -24,7 +21,8 @@ COMMON_DEPEND=">=x11-libs/libX11-1.4
 	x11-libs/libxcb
 	geoclue? ( app-misc/geoclue )
 	gnome? ( dev-libs/glib:2
-		>=gnome-base/gconf-2 )"
+		>=gnome-base/gconf-2 )
+	gtk? ( ${PYTHON_DEPS} )"
 RDEPEND="${COMMON_DEPEND}
 	gtk? ( >=dev-python/pygtk-2
 		dev-python/pyxdg )"
@@ -32,12 +30,14 @@ DEPEND="${COMMON_DEPEND}
 	nls? ( sys-devel/gettext )"
 
 src_prepare() {
-	>py-compile
 	epatch "${FILESDIR}"/${P}-make-conditionals.patch
+	epatch_user
 	eautoreconf
 }
 
 src_configure() {
+	python_export_best
+
 	econf \
 		--disable-silent-rules \
 		$(use_enable nls) \
@@ -53,17 +53,12 @@ src_configure() {
 src_install() {
 	default
 
-	# handle multiple python abi support
-	per_abi_install() {
-		cp "${D}"/usr/bin/gtk-redshift "${D}"/usr/bin/gtk-redshift-${PYTHON_ABI} || die
-	 	python_convert_shebangs ${PYTHON_ABI} "${D}"/usr/bin/gtk-redshift-${PYTHON_ABI}
-		emake DESTDIR="${D}" pythondir="$(python_get_sitedir)" -C src/gtk-redshift install
-	}
+	if use gtk; then
+		python_foreach_impl \
+			emake DESTDIR="${D}" pythondir="$(python_get_sitedir)" \
+			-C src/gtk-redshift install
 
-	if use gtk ; then
-		rm -R "${D}"/usr/$(get_libdir)/python* || die
-		python_execute_function per_abi_install
-		python_generate_wrapper_scripts -f "${D}"/usr/bin/gtk-redshift
+		python_replicate_scripts "${D}"/usr/bin/gtk-redshift
 	fi
 }
 
@@ -72,9 +67,9 @@ pkg_preinst() {
 }
 
 pkg_postinst() {
-	use gtk && { gnome2_icon_cache_update; python_mod_optimize gtk_${PN}; }
+	use gtk && gnome2_icon_cache_update
 }
 
 pkg_postrm() {
-	use gtk && { gnome2_icon_cache_update; python_mod_cleanup gtk_${PN}; }
+	use gtk && gnome2_icon_cache_update
 }
-- 
1.7.12.4



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

* [gentoo-dev] [PATCH python-r1 6/8] Reuse _python_ln_rel in distutils-r1.
  2012-10-27 11:02 [gentoo-dev] [PATCH python-r1 1/8] python_export: support obtaining site-packages directory Michał Górny
                   ` (3 preceding siblings ...)
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 5/8] Convert x11-misc/redshift to python-r1 (example) Michał Górny
@ 2012-10-27 11:02 ` Michał Górny
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 7/8] Use python_export_best() " Michał Górny
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Michał Górny @ 2012-10-27 11:02 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

---
 gx86/eclass/distutils-r1.eclass | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
index ce1b6f4..e83a85a 100644
--- a/gx86/eclass/distutils-r1.eclass
+++ b/gx86/eclass/distutils-r1.eclass
@@ -266,22 +266,8 @@ distutils-r1_python_install_all() {
 			debug-print "${FUNCNAME}: found executable at ${f#${D}/}"
 
 			local wrapf=${f%-${EPYTHON}}
-			debug-print "${FUNCNAME}: will link wrapper to ${wrapf#${D}/}"
-			local wrapfrom
-			case "${f#${D}/}" in
-				usr/bin*)
-					wrapfrom=
-					;;
-				usr/sbin*)
-					wrapfrom=../bin/
-					;;
-				*)
-					wrapfrom=../usr/bin/
-					;;
-			esac
-			debug-print "${FUNCNAME}: (from ${wrapfrom}python-exec)"
-
-			ln -s ${wrapfrom}python-exec "${wrapf}" || die
+
+			_python_ln_rel "${ED}"/usr/bin/python-exec "${wrapf}" || die
 		fi
 	done
 }
-- 
1.7.12.4



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

* [gentoo-dev] [PATCH python-r1 7/8] Use python_export_best() in distutils-r1.
  2012-10-27 11:02 [gentoo-dev] [PATCH python-r1 1/8] python_export: support obtaining site-packages directory Michał Górny
                   ` (4 preceding siblings ...)
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 6/8] Reuse _python_ln_rel in distutils-r1 Michał Górny
@ 2012-10-27 11:02 ` Michał Górny
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 8/8] Use find instead of hard-coded path list when looking for scripts Michał Górny
  2012-10-27 14:16 ` [gentoo-dev] [PATCH python-r1] Depend on python-exec in python-r1 Michał Górny
  7 siblings, 0 replies; 16+ messages in thread
From: Michał Górny @ 2012-10-27 11:02 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

---
 gx86/eclass/distutils-r1.eclass | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
index e83a85a..bab7dbc 100644
--- a/gx86/eclass/distutils-r1.eclass
+++ b/gx86/eclass/distutils-r1.eclass
@@ -253,13 +253,8 @@ distutils-r1_python_install_all() {
 
 	# note: keep in sync with ...rename_scripts()
 	# also, we assume that each script is installed for all impls
-	local impl EPYTHON PYTHON
-	for impl in "${PYTHON_COMPAT[@]}"; do
-		if use "python_targets_${impl}"; then
-			python_export "${impl}" EPYTHON
-			break
-		fi
-	done
+	local EPYTHON
+	python_export_best EPYTHON
 
 	for f in "${D}"/{bin,sbin,usr/bin,usr/sbin,games/bin}/*-"${EPYTHON}"; do
 		if [[ -x ${f} ]]; then
-- 
1.7.12.4



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

* [gentoo-dev] [PATCH python-r1 8/8] Use find instead of hard-coded path list when looking for scripts.
  2012-10-27 11:02 [gentoo-dev] [PATCH python-r1 1/8] python_export: support obtaining site-packages directory Michał Górny
                   ` (5 preceding siblings ...)
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 7/8] Use python_export_best() " Michał Górny
@ 2012-10-27 11:02 ` Michał Górny
  2012-10-27 14:16 ` [gentoo-dev] [PATCH python-r1] Depend on python-exec in python-r1 Michał Górny
  7 siblings, 0 replies; 16+ messages in thread
From: Michał Górny @ 2012-10-27 11:02 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

---
 gx86/eclass/distutils-r1.eclass | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
index bab7dbc..e0df9f6 100644
--- a/gx86/eclass/distutils-r1.eclass
+++ b/gx86/eclass/distutils-r1.eclass
@@ -256,15 +256,14 @@ distutils-r1_python_install_all() {
 	local EPYTHON
 	python_export_best EPYTHON
 
-	for f in "${D}"/{bin,sbin,usr/bin,usr/sbin,games/bin}/*-"${EPYTHON}"; do
-		if [[ -x ${f} ]]; then
-			debug-print "${FUNCNAME}: found executable at ${f#${D}/}"
+	local f
+	while IFS= read -r -d '' f; do
+		debug-print "${FUNCNAME}: found executable at ${f#${D}/}"
 
-			local wrapf=${f%-${EPYTHON}}
+		local wrapf=${f%-${EPYTHON}}
 
-			_python_ln_rel "${ED}"/usr/bin/python-exec "${wrapf}" || die
-		fi
-	done
+		_python_ln_rel "${ED}"/usr/bin/python-exec "${wrapf}" || die
+	done < <(find "${D}" -type f -executable -name "*-${EPYTHON}" -print0)
 }
 
 # @FUNCTION: distutils-r1_run_phase
-- 
1.7.12.4



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

* Re: [gentoo-dev] [PATCH python-r1 4/8] Introduce functions to replicate Python scripts.
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 4/8] Introduce functions to replicate Python scripts Michał Górny
@ 2012-10-27 13:27   ` Reinis Danne
  2012-10-27 14:08     ` Michał Górny
  0 siblings, 1 reply; 16+ messages in thread
From: Reinis Danne @ 2012-10-27 13:27 UTC (permalink / raw
  To: gentoo-dev

On Sat, Oct 27, 2012 at 01:02:47PM +0200, Michał Górny wrote:
> This can be used to create copies of Python scripts for various
> implementation when build system doesn't do that.
> ---
>  gx86/eclass/python-r1.eclass | 126 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 126 insertions(+)
> 
> diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
> index d7cdfa8..6178969 100644
> --- a/gx86/eclass/python-r1.eclass
> +++ b/gx86/eclass/python-r1.eclass
> @@ -412,3 +412,129 @@ python_export_best() {
>  	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
> +}

Better would be also to check if the shebang already has
specific python version and in such a case probably an error
message would be appropriate, so ebuild should explicitly change
it to bare "python" if replication for versions is desired.


Reinis

> +
> +# @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_scripts
> +# @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_scripts() {
> +	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.7.12.4
> 
> 


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

* Re: [gentoo-dev] [PATCH python-r1 4/8] Introduce functions to replicate Python scripts.
  2012-10-27 13:27   ` Reinis Danne
@ 2012-10-27 14:08     ` Michał Górny
  2012-10-27 14:31       ` Reinis Danne
  0 siblings, 1 reply; 16+ messages in thread
From: Michał Górny @ 2012-10-27 14:08 UTC (permalink / raw
  To: gentoo-dev; +Cc: rei4dan

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

On Sat, 27 Oct 2012 16:27:27 +0300
Reinis Danne <rei4dan@gmail.com> wrote:

> On Sat, Oct 27, 2012 at 01:02:47PM +0200, Michał Górny wrote:
> > This can be used to create copies of Python scripts for various
> > implementation when build system doesn't do that.
> > ---
> >  gx86/eclass/python-r1.eclass | 126 +++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 126 insertions(+)
> > 
> > diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
> > index d7cdfa8..6178969 100644
> > --- a/gx86/eclass/python-r1.eclass
> > +++ b/gx86/eclass/python-r1.eclass
> > @@ -412,3 +412,129 @@ python_export_best() {
> >  	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
> > +}
> 
> Better would be also to check if the shebang already has
> specific python version and in such a case probably an error
> message would be appropriate, so ebuild should explicitly change
> it to bare "python" if replication for versions is desired.

To be honest, I think I lack a good, simple way of guessing that. But I
guess a hack like [[ "${shebang} " != *'python '* ]] could work.

On the other hand, I'm not sure if it shouldn't work on things like
'python2' as well. But then, if someone ever needs that working, he can
ping me/report a bug.

-- 
Best regards,
Michał Górny

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

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

* [gentoo-dev] [PATCH python-r1] Depend on python-exec in python-r1.
  2012-10-27 11:02 [gentoo-dev] [PATCH python-r1 1/8] python_export: support obtaining site-packages directory Michał Górny
                   ` (6 preceding siblings ...)
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 8/8] Use find instead of hard-coded path list when looking for scripts Michał Górny
@ 2012-10-27 14:16 ` Michał Górny
  7 siblings, 0 replies; 16+ messages in thread
From: Michał Górny @ 2012-10-27 14:16 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Due to python_replicate_scripts(), now python-r1 ebuilds can rely on
python-exec as well. It shouldn't hurt much, so let's just put it
in the PYTHON_DEPS.
---
 gx86/eclass/distutils-r1.eclass |  3 +--
 gx86/eclass/python-r1.eclass    | 14 +++++++++-----
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
index e0df9f6..8dfe6bb 100644
--- a/gx86/eclass/distutils-r1.eclass
+++ b/gx86/eclass/distutils-r1.eclass
@@ -56,8 +56,7 @@ inherit eutils python-r1
 
 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
 
-RDEPEND="${PYTHON_DEPS}
-	dev-python/python-exec"
+RDEPEND=${PYTHON_DEPS}
 DEPEND=${PYTHON_DEPS}
 
 # @ECLASS-VARIABLE: PATCHES
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 6178969..45dfcee 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -137,7 +137,14 @@ _python_set_globals() {
 	REQUIRED_USE="|| ( ${flags[*]} )"
 	PYTHON_USEDEP=${optflags// /,}
 
-	PYTHON_DEPS=
+	local usestr
+	[[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
+
+	# 1) well, python-exec would suffice as an RDEP
+	# but no point in making this overcomplex, BDEP doesn't hurt anyone
+	# 2) python-exec should be built with all targets forced anyway
+	# but if new targets were added, we may need to force a rebuild
+	PYTHON_DEPS="dev-python/python-exec[${PYTHON_USEDEP}]"
 	local i
 	for i in "${PYTHON_COMPAT[@]}"; do
 		local d
@@ -153,10 +160,7 @@ _python_set_globals() {
 		esac
 
 		local v=${i##*[a-z]}
-		local usestr
-		[[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
-		PYTHON_DEPS+=" python_targets_${i}? (
-			${d}:${v/_/.}${usestr} )"
+		PYTHON_DEPS+=" python_targets_${i}? ( ${d}:${v/_/.}${usestr} )"
 	done
 }
 _python_set_globals
-- 
1.7.12.4



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

* Re: [gentoo-dev] [PATCH python-r1 4/8] Introduce functions to replicate Python scripts.
  2012-10-27 14:08     ` Michał Górny
@ 2012-10-27 14:31       ` Reinis Danne
  0 siblings, 0 replies; 16+ messages in thread
From: Reinis Danne @ 2012-10-27 14:31 UTC (permalink / raw
  To: gentoo-dev

On Sat, Oct 27, 2012 at 04:08:31PM +0200, Michał Górny wrote:
> On Sat, 27 Oct 2012 16:27:27 +0300
> Reinis Danne <rei4dan@gmail.com> wrote:
> 
> > On Sat, Oct 27, 2012 at 01:02:47PM +0200, Michał Górny wrote:
> > > This can be used to create copies of Python scripts for various
> > > implementation when build system doesn't do that.
> > > ---
> > >  gx86/eclass/python-r1.eclass | 126 +++++++++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 126 insertions(+)
> > > 
> > > diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
> > > index d7cdfa8..6178969 100644
> > > --- a/gx86/eclass/python-r1.eclass
> > > +++ b/gx86/eclass/python-r1.eclass
> > > @@ -412,3 +412,129 @@ python_export_best() {
> > >  	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
> > > +}
> > 
> > Better would be also to check if the shebang already has
> > specific python version and in such a case probably an error
> > message would be appropriate, so ebuild should explicitly change
> > it to bare "python" if replication for versions is desired.
> 
> To be honest, I think I lack a good, simple way of guessing that. But I
> guess a hack like [[ "${shebang} " != *'python '* ]] could work.
> 
> On the other hand, I'm not sure if it shouldn't work on things like
> 'python2' as well. But then, if someone ever needs that working, he can
> ping me/report a bug.

I think if there is anything else than "*\bpython[23]?\ *" it
becomes really error prone. I'm not sure how useful would be to
handle [23] though.


Reinis


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

* Re: [gentoo-dev] [PATCH python-r1 5/8] Convert x11-misc/redshift to python-r1 (example).
  2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 5/8] Convert x11-misc/redshift to python-r1 (example) Michał Górny
@ 2012-10-29 15:25   ` Ian Stakenvicius
  2012-10-29 15:42     ` Michał Górny
  0 siblings, 1 reply; 16+ messages in thread
From: Ian Stakenvicius @ 2012-10-29 15:25 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 27/10/12 07:02 AM, Micha? Górny wrote:
> This serves as an example how the new functions can be used. --- 
> gx86/x11-misc/redshift/redshift-1.7-r1.ebuild | 33
> ++++++++++++--------------- 1 file changed, 14 insertions(+), 19
> deletions(-)
> 
> diff --git a/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild
> b/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild index
> f3bd210..589e571 100644 ---
> a/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild +++
> b/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild @@ -24,7 +21,8 @@
> COMMON_DEPEND=">=x11-libs/libX11-1.4 x11-libs/libxcb geoclue? (
> app-misc/geoclue ) gnome? ( dev-libs/glib:2 -		>=gnome-base/gconf-2
> )" +		>=gnome-base/gconf-2 ) +	gtk? ( ${PYTHON_DEPS} )" 
> RDEPEND="${COMMON_DEPEND} gtk? ( >=dev-python/pygtk-2 
> dev-python/pyxdg )"


..should we not also ensure that the PYTHON_TARGETS for pygtk-2 and
pyxdg match (or at least include) the PYTHON_TARGETS being used for
this package?  IE:

> RDEPEND="${COMMON_DEPEND} - 	gtk? ( >=dev-python/pygtk-2 -
> dev-python/pyxdg )" + 	gtk? ( >=dev-python/pygtk-2[$PYTHON_USEDEP] 
> + 		dev-python/pyxdg[$PYTHON_USEDEP] )"


I don't know if this is actually needed by the package but I would
assume so as it seems to be building and installing for multiple pythons..
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iF4EAREIAAYFAlCOn+wACgkQ2ugaI38ACPBumgD9FDoSOvYTftLxQuo6Hix6ud9l
eZ0f5iLnD2SfzaaWcxwA/022wryA/f+f0ebg9WmS+C4AuzNvCQMQe7El3ERuAw23
=KDxM
-----END PGP SIGNATURE-----


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

* Re: [gentoo-dev] [PATCH python-r1 5/8] Convert x11-misc/redshift to python-r1 (example).
  2012-10-29 15:25   ` Ian Stakenvicius
@ 2012-10-29 15:42     ` Michał Górny
  2012-10-29 15:47       ` Ian Stakenvicius
  0 siblings, 1 reply; 16+ messages in thread
From: Michał Górny @ 2012-10-29 15:42 UTC (permalink / raw
  To: gentoo-dev; +Cc: axs

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

On Mon, 29 Oct 2012 11:25:33 -0400
Ian Stakenvicius <axs@gentoo.org> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> On 27/10/12 07:02 AM, Micha? Górny wrote:
> > This serves as an example how the new functions can be used. --- 
> > gx86/x11-misc/redshift/redshift-1.7-r1.ebuild | 33
> > ++++++++++++--------------- 1 file changed, 14 insertions(+), 19
> > deletions(-)
> > 
> > diff --git a/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild
> > b/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild index
> > f3bd210..589e571 100644 ---
> > a/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild +++
> > b/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild @@ -24,7 +21,8 @@
> > COMMON_DEPEND=">=x11-libs/libX11-1.4 x11-libs/libxcb geoclue? (
> > app-misc/geoclue ) gnome? ( dev-libs/glib:2 -		>=gnome-base/gconf-2
> > )" +		>=gnome-base/gconf-2 ) +	gtk? ( ${PYTHON_DEPS} )" 
> > RDEPEND="${COMMON_DEPEND} gtk? ( >=dev-python/pygtk-2 
> > dev-python/pyxdg )"
> 
> 
> ..should we not also ensure that the PYTHON_TARGETS for pygtk-2 and
> pyxdg match (or at least include) the PYTHON_TARGETS being used for
> this package?  IE:
> 
> > RDEPEND="${COMMON_DEPEND} - 	gtk? ( >=dev-python/pygtk-2 -
> > dev-python/pyxdg )" + 	gtk? ( >=dev-python/pygtk-2[$PYTHON_USEDEP] 
> > + 		dev-python/pyxdg[$PYTHON_USEDEP] )"
> 
> 
> I don't know if this is actually needed by the package but I would
> assume so as it seems to be building and installing for multiple pythons..

Yes, of course that'd need to be done if and when pygtk and pyxdg start
using PYTHON_TARGETS ;).

-- 
Best regards,
Michał Górny

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

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

* Re: [gentoo-dev] [PATCH python-r1 5/8] Convert x11-misc/redshift to python-r1 (example).
  2012-10-29 15:42     ` Michał Górny
@ 2012-10-29 15:47       ` Ian Stakenvicius
  2012-10-29 16:14         ` Michał Górny
  0 siblings, 1 reply; 16+ messages in thread
From: Ian Stakenvicius @ 2012-10-29 15:47 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 29/10/12 11:42 AM, Michał Górny wrote:
> On Mon, 29 Oct 2012 11:25:33 -0400 Ian Stakenvicius
> <axs@gentoo.org> wrote:
> 
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>> 
>> On 27/10/12 07:02 AM, Micha? Górny wrote:
>>> This serves as an example how the new functions can be used.
>>> --- gx86/x11-misc/redshift/redshift-1.7-r1.ebuild | 33 
>>> ++++++++++++--------------- 1 file changed, 14 insertions(+),
>>> 19 deletions(-)
>>> 
>>> diff --git a/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild 
>>> b/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild index 
>>> f3bd210..589e571 100644 --- 
>>> a/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild +++ 
>>> b/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild @@ -24,7 +21,8
>>> @@ COMMON_DEPEND=">=x11-libs/libX11-1.4 x11-libs/libxcb
>>> geoclue? ( app-misc/geoclue ) gnome? ( dev-libs/glib:2 -
>>> >=gnome-base/gconf-2 )" +		>=gnome-base/gconf-2 ) +	gtk? (
>>> ${PYTHON_DEPS} )" RDEPEND="${COMMON_DEPEND} gtk? (
>>> >=dev-python/pygtk-2 dev-python/pyxdg )"
>> 
>> 
>> ..should we not also ensure that the PYTHON_TARGETS for pygtk-2
>> and pyxdg match (or at least include) the PYTHON_TARGETS being
>> used for this package?  IE:
>> 
>>> RDEPEND="${COMMON_DEPEND} - 	gtk? ( >=dev-python/pygtk-2 - 
>>> dev-python/pyxdg )" + 	gtk? (
>>> >=dev-python/pygtk-2[$PYTHON_USEDEP] +
>>> dev-python/pyxdg[$PYTHON_USEDEP] )"
>> 
>> 
>> I don't know if this is actually needed by the package but I
>> would assume so as it seems to be building and installing for
>> multiple pythons..
> 
> Yes, of course that'd need to be done if and when pygtk and pyxdg
> start using PYTHON_TARGETS ;).
> 

I guess it wouldn't work to make $PYTHON_USEDEP contain
"python_target_whatever(+)" strings so that the targets being missing
would still allow the use deps to exist, huh...

I'm thinking this wouldn't catch issues where the PYTHON_COMPAT of a
dep is not as complete as the PYTHON_COMPAT of the consumer (and i
assume we would want to error on that)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iF4EAREIAAYFAlCOpRgACgkQ2ugaI38ACPBsaAD/R6Sqq2VGcmmUg6hqyWsWUG4v
aiV1vKdLGj+rpayOX8MA/A5iNmR0DYQ/ebTiQ+lzXqjbEmoc9o6yUxPbJ2OgeR66
=wtJu
-----END PGP SIGNATURE-----


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

* Re: [gentoo-dev] [PATCH python-r1 5/8] Convert x11-misc/redshift to python-r1 (example).
  2012-10-29 15:47       ` Ian Stakenvicius
@ 2012-10-29 16:14         ` Michał Górny
  0 siblings, 0 replies; 16+ messages in thread
From: Michał Górny @ 2012-10-29 16:14 UTC (permalink / raw
  To: gentoo-dev; +Cc: axs

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

On Mon, 29 Oct 2012 11:47:36 -0400
Ian Stakenvicius <axs@gentoo.org> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> On 29/10/12 11:42 AM, Michał Górny wrote:
> > On Mon, 29 Oct 2012 11:25:33 -0400 Ian Stakenvicius
> > <axs@gentoo.org> wrote:
> > 
> >> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
> >> 
> >> On 27/10/12 07:02 AM, Micha? Górny wrote:
> >>> This serves as an example how the new functions can be used.
> >>> --- gx86/x11-misc/redshift/redshift-1.7-r1.ebuild | 33 
> >>> ++++++++++++--------------- 1 file changed, 14 insertions(+),
> >>> 19 deletions(-)
> >>> 
> >>> diff --git a/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild 
> >>> b/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild index 
> >>> f3bd210..589e571 100644 --- 
> >>> a/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild +++ 
> >>> b/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild @@ -24,7 +21,8
> >>> @@ COMMON_DEPEND=">=x11-libs/libX11-1.4 x11-libs/libxcb
> >>> geoclue? ( app-misc/geoclue ) gnome? ( dev-libs/glib:2 -
> >>> >=gnome-base/gconf-2 )" +		>=gnome-base/gconf-2 ) +	gtk? (
> >>> ${PYTHON_DEPS} )" RDEPEND="${COMMON_DEPEND} gtk? (
> >>> >=dev-python/pygtk-2 dev-python/pyxdg )"
> >> 
> >> 
> >> ..should we not also ensure that the PYTHON_TARGETS for pygtk-2
> >> and pyxdg match (or at least include) the PYTHON_TARGETS being
> >> used for this package?  IE:
> >> 
> >>> RDEPEND="${COMMON_DEPEND} - 	gtk? ( >=dev-python/pygtk-2 - 
> >>> dev-python/pyxdg )" + 	gtk? (
> >>> >=dev-python/pygtk-2[$PYTHON_USEDEP] +
> >>> dev-python/pyxdg[$PYTHON_USEDEP] )"
> >> 
> >> 
> >> I don't know if this is actually needed by the package but I
> >> would assume so as it seems to be building and installing for
> >> multiple pythons..
> > 
> > Yes, of course that'd need to be done if and when pygtk and pyxdg
> > start using PYTHON_TARGETS ;).
> > 
> 
> I guess it wouldn't work to make $PYTHON_USEDEP contain
> "python_target_whatever(+)" strings so that the targets being missing
> would still allow the use deps to exist, huh...

...that sounded like a good idea...

> I'm thinking this wouldn't catch issues where the PYTHON_COMPAT of a
> dep is not as complete as the PYTHON_COMPAT of the consumer (and i
> assume we would want to error on that)

...before this part ;). So I guess it's safer to just keep it like it
is, and assume that when converting a package to p-r1, you are supposed
to check its revdeps to add $PYTHON_USEDEP whenever necessary.

-- 
Best regards,
Michał Górny

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

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

end of thread, other threads:[~2012-10-29 16:14 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-27 11:02 [gentoo-dev] [PATCH python-r1 1/8] python_export: support obtaining site-packages directory Michał Górny
2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 2/8] Add getter-style wrappers for python_export() Michał Górny
2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 3/8] Add python_export_best() to obtain best impl info Michał Górny
2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 4/8] Introduce functions to replicate Python scripts Michał Górny
2012-10-27 13:27   ` Reinis Danne
2012-10-27 14:08     ` Michał Górny
2012-10-27 14:31       ` Reinis Danne
2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 5/8] Convert x11-misc/redshift to python-r1 (example) Michał Górny
2012-10-29 15:25   ` Ian Stakenvicius
2012-10-29 15:42     ` Michał Górny
2012-10-29 15:47       ` Ian Stakenvicius
2012-10-29 16:14         ` Michał Górny
2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 6/8] Reuse _python_ln_rel in distutils-r1 Michał Górny
2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 7/8] Use python_export_best() " Michał Górny
2012-10-27 11:02 ` [gentoo-dev] [PATCH python-r1 8/8] Use find instead of hard-coded path list when looking for scripts Michał Górny
2012-10-27 14:16 ` [gentoo-dev] [PATCH python-r1] Depend on python-exec in python-r1 Michał Górny

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