From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-python@lists.gentoo.org
Cc: python@gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-python] [PATCH python-ebuilds] python2.7: first ebuild converted to python-utils-r1.
Date: Wed, 21 Nov 2012 21:36:18 +0100 [thread overview]
Message-ID: <1353530178-2569-1-git-send-email-mgorny@gentoo.org> (raw)
Please review these changes. I will send a detailed note about
the particular changes I've made in a reply to this mail.
The general changes are:
- clean up, update, getting rid of python.eclass implicity,
- the compiled modules are now part of the package (as with other
python-r1 suite ebuilds),
- an additional 'epython' module is installed which could be used to
quickly get the correct 'EPYTHON' value for the current Python
implementation (it will be used in python-exec's .py support).
---
...thon-2.7.3-r2.ebuild => python-2.7.3-r3.ebuild} | 110 +++++++++------------
1 file changed, 49 insertions(+), 61 deletions(-)
copy gx86/dev-lang/python/{python-2.7.3-r2.ebuild => python-2.7.3-r3.ebuild} (68%)
diff --git a/gx86/dev-lang/python/python-2.7.3-r2.ebuild b/gx86/dev-lang/python/python-2.7.3-r3.ebuild
similarity index 68%
copy from gx86/dev-lang/python/python-2.7.3-r2.ebuild
copy to gx86/dev-lang/python/python-2.7.3-r3.ebuild
index e9112a4..0368c65 100644
--- a/gx86/dev-lang/python/python-2.7.3-r2.ebuild
+++ b/gx86/dev-lang/python/python-2.7.3-r3.ebuild
@@ -2,11 +2,11 @@
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.3-r2.ebuild,v 1.12 2012/07/30 18:09:26 vapier Exp $
-EAPI="2"
+EAPI=4
WANT_AUTOMAKE="none"
WANT_LIBTOOL="none"
-inherit autotools eutils flag-o-matic multilib pax-utils python toolchain-funcs
+inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs
MY_P="Python-${PV}"
PATCHSET_REVISION="1"
@@ -18,11 +18,11 @@ SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.bz2
LICENSE="PSF-2"
SLOT="2.7"
-PYTHON_ABI="${SLOT}"
-KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
IUSE="-berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
RDEPEND="app-arch/bzip2
+ app-admin/eselect-python
>=sys-libs/zlib-1.1.3
virtual/libffi
virtual/libintl
@@ -56,20 +56,20 @@ DEPEND="${RDEPEND}
!sys-devel/gcc[libffi]"
RDEPEND+=" !build? ( app-misc/mime-types )
doc? ( dev-python/python-docs:${SLOT} )"
+PDEPEND="app-admin/python-updater"
S="${WORKDIR}/${MY_P}"
pkg_setup() {
- python_pkg_setup
-
if use berkdb; then
- ewarn "\"bsddb\" module is out-of-date and no longer maintained inside dev-lang/python."
- ewarn "\"bsddb\" and \"dbhash\" modules have been additionally removed in Python 3."
- ewarn "You should use external, still maintained \"bsddb3\" module provided by dev-python/bsddb3,"
- ewarn "which supports both Python 2 and Python 3."
+ ewarn "'bsddb' module is out-of-date and no longer maintained inside"
+ ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
+ ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
+ ewarn "is provided by dev-python/bsddb3."
else
if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
- ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb] to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]."
+ ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
+ ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]."
ewarn "You might need to migrate your databases."
fi
fi
@@ -152,7 +152,7 @@ src_configure() {
if tc-is-cross-compiler; then
OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
./configure --{build,host}=${CBUILD} || die "cross-configure failed"
- emake python Parser/pgen || die "cross-make failed"
+ emake python Parser/pgen
mv python hostpython
mv Parser/pgen Parser/hostpgen
make distclean
@@ -197,7 +197,7 @@ src_configure() {
}
src_compile() {
- emake EPYTHON="python${PV%%.*}" || die "emake failed"
+ default
# Work around bug 329499. See also bug 413751.
pax-mark m python
@@ -210,23 +210,18 @@ src_test() {
return
fi
- # Byte compiling should be enabled here.
- # Otherwise test_import fails.
- python_enable_pyc
-
# Skip failing tests.
local skipped_tests="distutils gdb"
for test in ${skipped_tests}; do
- mv Lib/test/test_${test}.py "${T}"
+ mv Lib/test/test_${test}.py "${T}" || die
done
# Rerun failed tests in verbose mode (regrtest -w).
emake test EXTRATESTOPTS="-w" < /dev/tty
- local result="$?"
for test in ${skipped_tests}; do
- mv "${T}/test_${test}.py" Lib/test
+ mv "${T}/test_${test}.py" Lib/test || die
done
elog "The following tests have been skipped:"
@@ -235,73 +230,69 @@ src_test() {
done
elog "If you would like to run them, you may:"
- elog "cd '${EPREFIX}$(python_get_libdir)/test'"
+ elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
elog "and run the tests separately."
-
- python_disable_pyc
-
- if [[ "${result}" -ne 0 ]]; then
- die "emake test failed"
- fi
}
src_install() {
- [[ -z "${ED}" ]] && ED="${D%/}${EPREFIX}/"
+ local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
- emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed"
- python_clean_installation_image -q
+ emake DESTDIR="${D}" altinstall maninstall
- sed -e "s/\(LDFLAGS=\).*/\1/" -i "${ED}$(python_get_libdir)/config/Makefile" || die "sed failed"
+ sed -e "s/\(LDFLAGS=\).*/\1/" \
+ -i "${libdir}/config/Makefile" || die "sed failed"
- mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
+ mv "${ED}usr/bin/python${SLOT}-config" \
+ "${ED}usr/bin/python-config-${SLOT}" || die
# Fix collisions between different slots of Python.
- mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
- mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
- mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
+ mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}" || die
+ mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}" || die
+ mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}" || die
rm -f "${ED}usr/bin/smtpd.py"
if use build; then
- rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test}
+ rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test}
else
- use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/"{bsddb/test,test}
- use berkdb || rm -fr "${ED}$(python_get_libdir)/"{bsddb,dbhash.py,test/test_bsddb*}
- use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*}
- use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,lib-tk}
+ use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
+ use berkdb || rm -fr "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*}
+ use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
+ use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk}
fi
- use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing"
- use wininst || rm -f "${ED}$(python_get_libdir)/distutils/command/"wininst-*.exe
+ use threads || rm -fr "${libdir}/multiprocessing"
+ use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe
- dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
+ dodoc Misc/{ACKS,HISTORY,NEWS}
if use examples; then
insinto /usr/share/doc/${PF}/examples
- doins -r Tools || die "doins failed"
+ doins -r Tools
fi
- newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
- newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
sed \
-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
-e "s:@PYDOC@:pydoc${SLOT}:" \
- -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
-}
+ -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" \
+ || die "pydoc initscript sed failed"
-pkg_preinst() {
- if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then
- python_updater_warning="1"
- fi
+ # for python-exec
+ local EPYTHON=python${SLOT}
+ echo "EPYTHON='${EPYTHON}'" > epython.py
+ python_domodule epython.py
}
eselect_python_update() {
- [[ -z "${EROOT}" || (! -d "${EROOT}" && -d "${ROOT}") ]] && EROOT="${ROOT%/}${EPREFIX}/"
-
- if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
+ if [[ -z "$(eselect python show)"
+ || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
eselect python update
fi
- if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
+ if [[ -z "$(eselect python show --python${PV%%.*})"
+ || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]
+ then
eselect python update --python${PV%%.*}
fi
}
@@ -309,9 +300,8 @@ eselect_python_update() {
pkg_postinst() {
eselect_python_update
- python_mod_optimize -f -x "/(site-packages|test|tests)/" $(python_get_libdir)
-
- if [[ "${python_updater_warning}" == "1" ]]; then
+ if has_version "<${CATEGORY}/${PN}-${SLOT}" && [[ ! ${REPLACING_VERSIONS} ]]
+ then
ewarn "You have just upgraded from an older version of Python."
ewarn "You should switch active version of Python ${PV%%.*} and run"
ewarn "'python-updater [options]' to rebuild Python modules."
@@ -320,6 +310,4 @@ pkg_postinst() {
pkg_postrm() {
eselect_python_update
-
- python_mod_cleanup $(python_get_libdir)
}
--
1.8.0
next reply other threads:[~2012-11-21 20:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-21 20:36 Michał Górny [this message]
2012-11-21 20:50 ` [gentoo-python] [PATCH python-ebuilds] python2.7: first ebuild converted to python-utils-r1 Michał Górny
[not found] ` <CAKmKYaCJYfdx4wzFqALFkeHeDg3z0TEufNdSLELXPHfxxEtHpg@mail.gmail.com>
2012-11-26 16:23 ` [gentoo-python] " Mike Gilbert
2012-11-26 18:47 ` Michał Górny
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=1353530178-2569-1-git-send-email-mgorny@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-python@lists.gentoo.org \
--cc=python@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