public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-python@lists.gentoo.org
Subject: [gentoo-python] Patches to drop support for python-exec:0
Date: Mon, 15 Dec 2014 23:53:58 +0100	[thread overview]
Message-ID: <20141215235358.72bb3550@pomiot.lan> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 895 bytes --]

Hello,

pykde4 is the last package in the tree using python-exec:0, and a new
version supporting :2 is being stabilized right now. For this reason, I
think we should start preparing ourselves to remove python-exec:0. I'm
thinking of 30-day p.mask followed by eclass update.

I'm attaching a patch for review. The patch removes bi-python-exec
support in favor of supporting only :2. Specifically:

1. ebuilds forcing python-exec:0 via the internal variable call 'die'
now,

2. PYTHON_DEPS is updated to require >=python-exec-2:=. This way we
still provide support for potential python-exec-3 while requiring at
least 2 ;).

3. all conditionals are inlined to support only :2, also some code has
been simplified.

Please review and possibly test. I haven't tested it yet but
there's still some time before the patch can be committed ;).

-- 
Best regards,
Michał Górny

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: remove-python-exec-0.diff --]
[-- Type: text/x-patch, Size: 7640 bytes --]

Index: distutils-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v
retrieving revision 1.106
diff -u -B -r1.106 distutils-r1.eclass
--- distutils-r1.eclass	11 Dec 2014 18:32:30 -0000	1.106
+++ distutils-r1.eclass	15 Dec 2014 22:50:28 -0000
@@ -368,7 +368,7 @@
 			root = ${D}
 		_EOF_
 
-		if [[ ! ${DISTUTILS_SINGLE_IMPL} ]] && _python_want_python_exec2; then
+		if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
 			cat >> "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
 				install-scripts = $(python_get_scriptdir)
 			_EOF_
@@ -419,11 +419,7 @@
 	local bindir=${2}
 
 	local PYTHON_SCRIPTDIR
-	if _python_want_python_exec2; then
-		python_export PYTHON_SCRIPTDIR
-	else
-		PYTHON_SCRIPTDIR=${bindir}
-	fi
+	python_export PYTHON_SCRIPTDIR
 
 	local f python_files=() non_python_files=()
 
@@ -437,7 +433,7 @@
 			if [[ ${shebang} == '#!'*${EPYTHON}* ]]; then
 				debug-print "${FUNCNAME}: matching shebang: ${shebang}"
 				python_files+=( "${f}" )
-			elif _python_want_python_exec2; then
+			else
 				debug-print "${FUNCNAME}: non-matching shebang: ${shebang}"
 				non_python_files+=( "${f}" )
 			fi
@@ -448,18 +444,11 @@
 		for f in "${python_files[@]}"; do
 			local basename=${f##*/}
 
-			if ! _python_want_python_exec2; then
-				local newf=${f%/*}/${basename}-${EPYTHON}
-				debug-print "${FUNCNAME}: renaming ${f#${path}/} to ${newf#${path}/}"
-				mv "${f}" "${newf}" || die
-			fi
-
 			debug-print "${FUNCNAME}: installing wrapper at ${bindir}/${basename}"
-			_python_ln_rel "${path}${EPREFIX}"$(_python_get_wrapper_path) \
+			_python_ln_rel "${path}${EPREFIX}"/usr/lib/python-exec/python-exec2 \
 				"${path}${bindir}/${basename}" || die
 		done
 
-		# (non-empty only with python-exec:2)
 		for f in "${non_python_files[@]}"; do
 			local basename=${f##*/}
 
@@ -519,15 +508,11 @@
 			case "${a}" in
 				--install-scripts=*)
 					scriptdir=${a#--install-scripts=}
-					if _python_want_python_exec2; then
-						unset "${arg_var}"
-					fi
+					unset "${arg_var}"
 					;;
 				--install-scripts)
 					scriptdir=${!1}
-					if _python_want_python_exec2; then
-						unset "${arg_var}" "${1}"
-					fi
+					unset "${arg_var}" "${1}"
 					shift
 					;;
 			esac
Index: python-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v
retrieving revision 1.80
diff -u -B -r1.80 python-r1.eclass
--- python-r1.eclass	7 Dec 2014 19:15:19 -0000	1.80
+++ python-r1.eclass	15 Dec 2014 22:50:28 -0000
@@ -208,9 +208,9 @@
 	# 3) use whichever python-exec slot installed in EAPI 5. For EAPI 4,
 	# just fix :2 since := deps are not supported.
 	if [[ ${_PYTHON_WANT_PYTHON_EXEC2} == 0 ]]; then
-		PYTHON_DEPS+="dev-lang/python-exec:0[${PYTHON_USEDEP}]"
+		die "python-exec:0 is no longer supported, please fix your ebuild to work with python-exec:2"
 	elif [[ ${EAPI} != 4 ]]; then
-		PYTHON_DEPS+="dev-lang/python-exec:=[${PYTHON_USEDEP}]"
+		PYTHON_DEPS+=">=dev-lang/python-exec-2:=[${PYTHON_USEDEP}]"
 	else
 		PYTHON_DEPS+="dev-lang/python-exec:2[${PYTHON_USEDEP}]"
 	fi
@@ -782,26 +782,16 @@
 	_python_replicate_script() {
 		local _PYTHON_FIX_SHEBANG_QUIET=1
 
-		if _python_want_python_exec2; then
-			local PYTHON_SCRIPTDIR
-			python_export PYTHON_SCRIPTDIR
-
-			(
-				exeinto "${PYTHON_SCRIPTDIR#${EPREFIX}}"
-				doexe "${files[@]}"
-			)
-
-			python_fix_shebang -q \
-				"${files[@]/*\//${D%/}/${PYTHON_SCRIPTDIR}/}"
-		else
-			local f
-			for f in "${files[@]}"; do
-				cp -p "${f}" "${f}-${EPYTHON}" || die
-			done
+		local PYTHON_SCRIPTDIR
+		python_export PYTHON_SCRIPTDIR
 
-			python_fix_shebang -q \
-				"${files[@]/%/-${EPYTHON}}"
-		fi
+		(
+			exeinto "${PYTHON_SCRIPTDIR#${EPREFIX}}"
+			doexe "${files[@]}"
+		)
+
+		python_fix_shebang -q \
+			"${files[@]/*\//${D%/}/${PYTHON_SCRIPTDIR}/}"
 	}
 
 	local files=( "${@}" )
@@ -810,7 +800,7 @@
 	# install the wrappers
 	local f
 	for f; do
-		_python_ln_rel "${ED%/}$(_python_get_wrapper_path)" "${f}" || die
+		_python_ln_rel "${ED%/}/usr/lib/python-exec/python-exec2" "${f}" || die
 	done
 }
 
Index: python-single-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/python-single-r1.eclass,v
retrieving revision 1.29
diff -u -B -r1.29 python-single-r1.eclass
--- python-single-r1.eclass	7 Nov 2014 18:11:58 -0000	1.29
+++ python-single-r1.eclass	15 Dec 2014 22:50:28 -0000
@@ -219,9 +219,9 @@
 	# 3) use whichever python-exec slot installed in EAPI 5. For EAPI 4,
 	# just fix :2 since := deps are not supported.
 	if [[ ${_PYTHON_WANT_PYTHON_EXEC2} == 0 ]]; then
-		PYTHON_DEPS+="dev-lang/python-exec:0[${PYTHON_USEDEP}]"
+		die "python-exec:0 is no longer supported, please fix your ebuild to work with python-exec:2"
 	elif [[ ${EAPI} != 4 ]]; then
-		PYTHON_DEPS+="dev-lang/python-exec:=[${PYTHON_USEDEP}]"
+		PYTHON_DEPS+=">=dev-lang/python-exec-2:=[${PYTHON_USEDEP}]"
 	else
 		PYTHON_DEPS+="dev-lang/python-exec:2[${PYTHON_USEDEP}]"
 	fi
Index: python-utils-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v
retrieving revision 1.67
diff -u -B -r1.67 python-utils-r1.eclass
--- python-utils-r1.eclass	29 Nov 2014 23:03:42 -0000	1.67
+++ python-utils-r1.eclass	15 Dec 2014 22:50:28 -0000
@@ -635,21 +635,14 @@
 	[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
 	[[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>"
 
-	local d=${python_scriptroot:-${DESTTREE}/bin}
-	local wrapd=${d}
+	local wrapd=${python_scriptroot:-${DESTTREE}/bin}
 
 	local f=${1}
-	local barefn=${2}
-	local newfn
+	local newfn=${2}
 
-	if _python_want_python_exec2; then
-		local PYTHON_SCRIPTDIR
-		python_export PYTHON_SCRIPTDIR
-		d=${PYTHON_SCRIPTDIR#${EPREFIX}}
-		newfn=${barefn}
-	else
-		newfn=${barefn}-${EPYTHON}
-	fi
+	local PYTHON_SCRIPTDIR d
+	python_export PYTHON_SCRIPTDIR
+	d=${PYTHON_SCRIPTDIR#${EPREFIX}}
 
 	(
 		dodir "${wrapd}"
@@ -658,7 +651,7 @@
 	)
 
 	# install the wrapper
-	_python_ln_rel "${ED%/}"$(_python_get_wrapper_path) \
+	_python_ln_rel "${ED%/}"/usr/lib/python-exec/python-exec2 \
 		"${ED%/}/${wrapd}/${barefn}" || die
 
 	# don't use this at home, just call python_doscript() instead
@@ -1097,40 +1090,6 @@
 	done
 }
 
-# @FUNCTION: _python_want_python_exec2
-# @INTERNAL
-# @DESCRIPTION:
-# Check whether we should be using python-exec:2.
-_python_want_python_exec2() {
-	debug-print-function ${FUNCNAME} "${@}"
-
-	# EAPI 4 lacks slot operators, so just fix it on python-exec:2.
-	[[ ${EAPI} == 4 ]] && return 0
-
-	# Check if we cached the result, or someone put an override.
-	if [[ ! ${_PYTHON_WANT_PYTHON_EXEC2+1} ]]; then
-		has_version 'dev-lang/python-exec:2'
-		_PYTHON_WANT_PYTHON_EXEC2=$(( ! ${?} ))
-	fi
-
-	# Non-zero means 'yes', zero means 'no'.
-	[[ ${_PYTHON_WANT_PYTHON_EXEC2} != 0 ]]
-}
-
-# @FUNCTION: _python_get_wrapper_path
-# @INTERNAL
-# @DESCRIPTION:
-# Output path to proper python-exec slot.
-_python_get_wrapper_path() {
-	debug-print-function ${FUNCNAME} "${@}"
-
-	if _python_want_python_exec2; then
-		echo /usr/lib/python-exec/python-exec2
-	else
-		echo /usr/bin/python-exec
-	fi
-}
-
 # @FUNCTION: python_export_utf8_locale
 # @RETURN: 0 on success, 1 on failure.
 # @DESCRIPTION:

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

                 reply	other threads:[~2014-12-15 22:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20141215235358.72bb3550@pomiot.lan \
    --to=mgorny@gentoo.org \
    --cc=gentoo-python@lists.gentoo.org \
    /path/to/YOUR_REPLY

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

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