diff options
author | Zac Medico <zmedico@gentoo.org> | 2013-04-28 18:39:20 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2013-04-28 18:39:20 +0000 |
commit | 00aff0fce0b2a4a53a059be9bfea969fb8733a18 (patch) | |
tree | b207fdcc55abaa927153c1d89273aba8a0e39ec4 /sys-apps | |
parent | rebump to EAPI5 to use subslot deps (diff) | |
download | gentoo-2-00aff0fce0b2a4a53a059be9bfea969fb8733a18.tar.gz gentoo-2-00aff0fce0b2a4a53a059be9bfea969fb8733a18.tar.bz2 gentoo-2-00aff0fce0b2a4a53a059be9bfea969fb8733a18.zip |
Migrate off of python.eclass.
(Portage version: 2.2.0_alpha173/cvs/Linux i686, signed Manifest commit with key 0xFDE8EF85AE5719A3)
Diffstat (limited to 'sys-apps')
-rw-r--r-- | sys-apps/portage/ChangeLog | 6 | ||||
-rw-r--r-- | sys-apps/portage/portage-2.1.11.55.ebuild | 75 | ||||
-rw-r--r-- | sys-apps/portage/portage-2.1.6.7_p1.ebuild | 15 |
3 files changed, 64 insertions, 32 deletions
diff --git a/sys-apps/portage/ChangeLog b/sys-apps/portage/ChangeLog index 5d37da49b3f8..dc71d3d5ffa8 100644 --- a/sys-apps/portage/ChangeLog +++ b/sys-apps/portage/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for sys-apps/portage # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v 1.1259 2013/04/27 21:57:26 zmedico Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v 1.1260 2013/04/28 18:39:20 zmedico Exp $ + + 28 Apr 2013; Zac Medico <zmedico@gentoo.org> portage-2.1.11.55.ebuild, + portage-2.1.6.7_p1.ebuild: + Migrate off of python.eclass. 27 Apr 2013; Zac Medico <zmedico@gentoo.org> -portage-2.1.11.52.ebuild, -portage-2.2.0_alpha166.ebuild: diff --git a/sys-apps/portage/portage-2.1.11.55.ebuild b/sys-apps/portage/portage-2.1.11.55.ebuild index ae16302b107a..6d0cd9bbbe31 100644 --- a/sys-apps/portage/portage-2.1.11.55.ebuild +++ b/sys-apps/portage/portage-2.1.11.55.ebuild @@ -1,11 +1,11 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.11.55.ebuild,v 1.6 2013/03/28 13:30:58 josejx Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.11.55.ebuild,v 1.7 2013/04/28 18:39:20 zmedico Exp $ # Require EAPI 2 since we now require at least python-2.6 (for python 3 # syntax support) which also requires EAPI 2. EAPI=2 -inherit eutils python +inherit eutils DESCRIPTION="Portage is the package management and distribution system for Gentoo" HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml" @@ -100,6 +100,31 @@ current_python_has_xattr() { /usr/bin/python -c 'import xattr' 2>/dev/null } +call_with_python_impl() { + [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' + env EPYTHON=${EPYTHON} "$@" +} + +python_compileall() { + [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' + local d=$1 PYTHON=/usr/bin/${EPYTHON} + local d_image=${D}${d#/} + [[ -d ${d_image} ]] || die "directory does not exist: ${d_image}" + case "${EPYTHON}" in + python*) + "${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die + # Note: Using -OO breaks emaint, since it requires __doc__, + # and __doc__ is None when -OO is used. + "${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die + ;; + pypy*) + "${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die + ;; + *) + die "Unrecognized EPYTHON value: ${EPYTHON}" + esac +} + pkg_setup() { if use python2 && use python3 ; then ewarn "Both python2 and python3 USE flags are enabled, but only one" @@ -134,12 +159,16 @@ pkg_setup() { fi fi + # We use EPYTHON to designate the active python interpreter, + # but we only export when needed, via call_with_python_impl. + EPYTHON=python + export -n EPYTHON if use python3; then - python_set_active_version 3 + EPYTHON=python3 elif use python2; then - python_set_active_version 2 + EPYTHON=python2 elif use pypy2_0; then - python_set_active_version 2.7-pypy-2.0 + EPYTHON=pypy-c2.0 fi } @@ -172,15 +201,23 @@ src_prepare() { || die "failed to append to make.globals" fi + local set_shebang= if use python3; then - einfo "Converting shebangs for python3..." - python_convert_shebangs -r 3 . + set_shebang=python3 elif use python2; then - einfo "Converting shebangs for python2..." - python_convert_shebangs -r 2 . + set_shebang=python2 elif use pypy2_0; then - einfo "Converting shebangs for pypy-c2.0..." - python_convert_shebangs -r 2.7-pypy-2.0 . + set_shebang=pypy-c2.0 + fi + if [[ -n ${set_shebang} ]] ; then + einfo "Converting shebangs for ${set_shebang}..." + while read -r -d $'\0' ; do + local shebang=$(head -n1 "$REPLY") + if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then + sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \ + die "sed failed" + fi + done < <(find . -type f -print0) fi cd "${S}/cnf" || die @@ -197,20 +234,24 @@ src_prepare() { src_compile() { if use doc; then + call_with_python_impl \ emake docbook || die fi if use epydoc; then einfo "Generating api docs" + call_with_python_impl \ emake epydoc || die fi } src_test() { + call_with_python_impl \ emake test || die } src_install() { + call_with_python_impl \ emake DESTDIR="${D}" \ sysconfdir="/etc" \ prefix="/usr" \ @@ -233,6 +274,8 @@ src_install() { echo "PYTHONPATH=\"/usr/lib/portage/pym\"" > \ "${T}/05portage" || die doenvd "${T}/05portage" || die + + python_compileall /usr/lib/portage/pym } pkg_preinst() { @@ -268,13 +311,3 @@ pkg_preinst() { ewarn "files that have not been modified since they were installed." fi } - -pkg_postinst() { - # Compile all source files recursively. Any orphans - # will be identified and removed in postrm. - python_mod_optimize /usr/lib/portage/pym -} - -pkg_postrm() { - python_mod_cleanup /usr/lib/portage/pym -} diff --git a/sys-apps/portage/portage-2.1.6.7_p1.ebuild b/sys-apps/portage/portage-2.1.6.7_p1.ebuild index 9191b9974e11..8dc8c7c3448e 100644 --- a/sys-apps/portage/portage-2.1.6.7_p1.ebuild +++ b/sys-apps/portage/portage-2.1.6.7_p1.ebuild @@ -1,8 +1,8 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.6.7_p1.ebuild,v 1.6 2013/03/22 20:15:28 zmedico Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.6.7_p1.ebuild,v 1.7 2013/04/28 18:39:20 zmedico Exp $ -inherit eutils multilib python +inherit eutils multilib DESCRIPTION="Portage is the package management and distribution system for Gentoo" HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml" @@ -205,6 +205,9 @@ src_install() { dodir /etc/portage keepdir /etc/portage + + /usr/bin/python -m compileall -q -f -d "${portage_base}/pym" "${D%/}${portage_base}/pym" || die + /usr/bin/python -O -m compileall -q -f -d "${portage_base}/pym" "${D%/}${portage_base}/pym" || die } pkg_preinst() { @@ -218,10 +221,6 @@ pkg_preinst() { } pkg_postinst() { - # Compile all source files recursively. Any orphans - # will be identified and removed in postrm. - python_mod_optimize /usr/$(get_libdir)/portage/pym - local warning_shown=0 if [ $DOWNGRADE_FROM_2_2 = 0 ] ; then ewarn @@ -257,7 +256,3 @@ pkg_postinst() { ewarn # for symmetry fi } - -pkg_postrm() { - python_mod_cleanup /usr/$(get_libdir)/portage/pym -} |