Permalink
Browse files

dev-lang/python-2.7.3-r2: stackless Python

  • Loading branch information...
1 parent 3cef354 commit ed0abe076df34f83207c9b5cb5857d3802550298 @wmark committed Jun 9, 2012
Showing with 333 additions and 0 deletions.
  1. +4 −0 dev-lang/python/Manifest
  2. +329 −0 dev-lang/python/python-2.7.3-r2.ebuild
View
@@ -3,13 +3,17 @@ AUX pydoc.init 666 RMD160 11caf3a78bce4cdaebacaf21eaf26cc1ce30282e SHA1 88c5cb6d
DIST Python-2.6.5.tar.bz2 11095581 RMD160 909c6a13749396f2b19fed51821d3e2577b2833b SHA1 24c94f5428a8c94c9d0b316e3019fee721fdb5d1 SHA256 62da62eb685621ede2be1275f11b89fa0e0be578db8daa5320d0a7855c0a9ebc
DIST Python-2.6.6.tar.bz2 11080872 RMD160 2d63f4f0ad3c124a8e62215ca94bd0231350e912 SHA1 a1daf2c2c7cffe0939c015260447572fe75c7e50 SHA256 134c5e0736bae2e5570d0b915693374f11108ded63c35a23a35d282737d2ce83
DIST Python-2.7.1.tar.bz2 11722546 RMD160 3ce59305f6cd3fb320a53771d0ea01ec0687005f SHA1 fbe1894322ff91b80726e269c97454f4129fc2a3 SHA256 80e387bcf57eae8ce26726753584fd63e060ec11682d1145af921e85fd612292
+DIST Python-2.7.3.tar.bz2 11793433 RMD160 bfc511d54080898d7008d4b84d49f957859d66c3 SHA1 842c4e2aff3f016feea3c6e992c7fa96e49c9aa0 SHA256 726457e11cb153adc3f428aaf1901fc561a374c30e5e7da6742c0742a338663c
DIST python-2.6.5-to-stackless.diff.bz2 219210 RMD160 cd04c5e6e6b2813926598077a6c3f732b92ce27a SHA1 354134b72984fae6ae0a131c953536a5d85d1368 SHA256 7633910003b0c835eb0d979a499fd2e87eda060fd8661908100284550bd0b982
DIST python-2.6.6-to-stackless.diff.lzma 172301 RMD160 d0582de62d5e054bd0c263c3698288ee08b701a5 SHA1 0e4cd2f93bd52e9cd113784a15c479c117fafa02 SHA256 d08999d46504fe9c5b7abb778cf5bfe69e86d7926ff51a1909a8c146426160be
DIST python-2.7.1-to-stackless.diff.lzma 942011 RMD160 d26033ced83c7dba8d7756292ce7d06594f19ce6 SHA1 ae78dedb99a85ddf79c1581f59c66e2181b9e7e6 SHA256 c3d1e812e74e7183b39cbd3b7b594cfff14be1db82f9d34c4884b61a86dc7ef2
+DIST python-2.7.3-to-stackless.patch.lzma 170548 RMD160 14258cf299ba83cd917cfebf7737d6a516f685b7 SHA1 a835cc92e8b4aaad0e75613b8ea58d554fa4a405 SHA256 3d1ac205412a67e3ca9c4b7c88ab5fdf2de5de45efc10d251bcc95cbda1d35c0
DIST python-gentoo-patches-2.6.5-r5.tar.bz2 1482491 RMD160 a7978912b8598a589a82746642fa5b676369c599 SHA1 26c983e79ac32b63a3bc6e411d96b9233524733b SHA256 6cb8cf0e1418cad035a243c08dfeee2e9395397dda74ada49667b3eba63bb76c
DIST python-gentoo-patches-2.6.6-r1.tar.bz2 15729 RMD160 9f0e1f5ead8b1ff1a3a3aedf2fb70d10fe4c6c3b SHA1 2a1fd29501c0f5a424e670e5d6a60c67007f23e7 SHA256 17d7fd6c4de686d41403322bc26bd306607f03843c4f9ab6365a985ded4f4ebb
DIST python-gentoo-patches-2.7.1.tar.bz2 12322 RMD160 1599db60aae9ba58c43371d241f98cb876f2a25b SHA1 f9bedb43dd687f3a2078cb6325b04f56303d54ce SHA256 7937071d083a06c1196b794ed03c76c0448de2e16d975dec7c25b36cf9162784
+DIST python-gentoo-patches-2.7.3-1.tar.bz2 13858 RMD160 beeef5c66d9641f1f06153efcf386c4a6fa19beb SHA1 d1fca7b5903b415bde0f00271ee57077e3c63231 SHA256 51f6981ba02064998dfb020725c33233641b3743c4f5cf04091657313a49b8fd
DIST python-stackless-patches-2.6.5-r5.tar.lzma 2068069 RMD160 2ab9cc388fe192720fd365bcef4ef297eb98e50e SHA1 ad76c362daf7810d1024ef47bea2a14526ebec84 SHA256 724abd43963ae2210b37fbdba7d0057ed28f204df13289df52272da9fe49571f
EBUILD python-2.6.5-r3.ebuild 9797 RMD160 408fe70f6576024f690ae4a3a49bfb26bf779e3d SHA1 83ead533aab5b343363429ef01d89d17b42962e9 SHA256 4788e06c3ca4393f7a9f6b0c29ea75d3319bbc5b26246584bf8977af190546ea
EBUILD python-2.6.6-r1.ebuild 9684 RMD160 dad77892491925f0ffa3dd8a65520e1017303812 SHA1 ecded94ca6ecf43615594c74025046510874f17c SHA256 e61cc6cef34d877c5ca0e24e91e383dbd387d25cb4bd00ebe5927e44af517d55
EBUILD python-2.7.1.ebuild 11374 RMD160 0735fa12f59467960ea79e7d728bb2cf557ebe5b SHA1 78b6b76bbbbe24b62b33d93af0e5cb6b334051ee SHA256 69d9bb490a09d99c1e521869baaccdbb00782612ec6929bc64cda630535cfdd0
+EBUILD python-2.7.3-r2.ebuild 9748 RMD160 88e3bdf76805082d7ffc13811b0a327c22158703 SHA1 910364a5177182103d8483cb53f91cf9960aa53d SHA256 44c54017f70bd35c1ab2532a2428edf2c013c71a65f423d2c064796629ce23e4
@@ -0,0 +1,329 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Copyright 2012 W-Mark Kubacki
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+WANT_AUTOMAKE="none"
+WANT_LIBTOOL="none"
+
+inherit autotools eutils flag-o-matic multilib pax-utils python toolchain-funcs
+
+MY_P="Python-${PV}"
+PATCHSET_REVISION="1"
+
+DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language."
+HOMEPAGE="http://www.python.org/"
+SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.bz2
+ stackless? ( http://binhost.ossdl.de/distfiles/python-${PV%_p*}-to-stackless.patch.lzma )
+ mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.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"
+IUSE="-berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml stackless"
+
+RDEPEND="app-arch/bzip2
+ >=sys-libs/zlib-1.1.3
+ virtual/libffi
+ virtual/libintl
+ !build? (
+ berkdb? ( || (
+ sys-libs/db:4.8
+ sys-libs/db:4.7
+ sys-libs/db:4.6
+ sys-libs/db:4.5
+ sys-libs/db:4.4
+ sys-libs/db:4.3
+ sys-libs/db:4.2
+ ) )
+ gdbm? ( sys-libs/gdbm[berkdb] )
+ ncurses? (
+ >=sys-libs/ncurses-5.2
+ readline? ( >=sys-libs/readline-4.1 )
+ )
+ sqlite? ( >=dev-db/sqlite-3.3.8:3[extensions] )
+ ssl? ( dev-libs/openssl )
+ tk? (
+ >=dev-lang/tk-8.0
+ dev-tcltk/blt
+ )
+ xml? ( >=dev-libs/expat-2.1 )
+ )
+ !!<sys-apps/portage-2.1.9"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ >=sys-devel/autoconf-2.65
+ !sys-devel/gcc[libffi]"
+RDEPEND+=" !build? ( app-misc/mime-types )
+ doc? ( dev-python/python-docs:${SLOT} )"
+
+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."
+ 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 might need to migrate your databases."
+ fi
+ fi
+}
+
+src_prepare() {
+ # Stackless
+ if use stackless; then
+ epatch "${WORKDIR}/python-${PV}-to-stackless.patch"
+ fi
+
+ # Ensure that internal copies of expat, libffi and zlib are not used.
+ rm -fr Modules/expat
+ rm -fr Modules/_ctypes/libffi*
+ rm -fr Modules/zlib
+
+ local excluded_patches
+ if ! tc-is-cross-compiler; then
+ excluded_patches="*_all_crosscompile.patch"
+ fi
+
+ EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
+ epatch "${WORKDIR}/${PV}-${PATCHSET_REVISION}"
+
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
+ Lib/distutils/command/install.py \
+ Lib/distutils/sysconfig.py \
+ Lib/site.py \
+ Lib/sysconfig.py \
+ Lib/test/test_site.py \
+ Makefile.pre.in \
+ Modules/Setup.dist \
+ Modules/getpath.c \
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
+
+ eautoconf
+ eautoheader
+}
+
+src_configure() {
+ if use build; then
+ # Disable extraneous modules with extra dependencies.
+ export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
+ export PYTHON_DISABLE_SSL="1"
+ else
+ # dbm module can be linked against berkdb or gdbm.
+ # Defaults to gdbm when both are enabled, #204343.
+ local disable
+ use berkdb || use gdbm || disable+=" dbm"
+ use berkdb || disable+=" _bsddb"
+ use gdbm || disable+=" gdbm"
+ use ncurses || disable+=" _curses _curses_panel"
+ use readline || disable+=" readline"
+ use sqlite || disable+=" _sqlite3"
+ use ssl || export PYTHON_DISABLE_SSL="1"
+ use tk || disable+=" _tkinter"
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
+ export PYTHON_DISABLE_MODULES="${disable}"
+
+ if ! use xml; then
+ ewarn "You have configured Python without XML support."
+ ewarn "This is NOT a recommended configuration as you"
+ ewarn "may face problems parsing any XML documents."
+ fi
+ fi
+
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
+ fi
+
+ if [[ "$(gcc-major-version)" -ge 4 ]]; then
+ append-flags -fwrapv
+ fi
+
+ filter-flags -malign-double
+
+ [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
+
+ # https://bugs.gentoo.org/show_bug.cgi?id=50309
+ if is-flagq -O3; then
+ is-flagq -fstack-protector-all && replace-flags -O3 -O2
+ use hardened && replace-flags -O3 -O2
+ fi
+
+ 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"
+ mv python hostpython
+ mv Parser/pgen Parser/hostpgen
+ make distclean
+ sed -i \
+ -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \
+ -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \
+ Makefile.pre.in || die "sed failed"
+ fi
+
+ # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
+ tc-export CXX
+
+ # Set LDFLAGS so we link modules with -lpython2.7 correctly.
+ # Needed on FreeBSD unless Python 2.7 is already installed.
+ # Please query BSD team before removing this!
+ append-ldflags "-L."
+
+ local dbmliborder
+ if use gdbm; then
+ dbmliborder+="${dbmliborder:+:}gdbm"
+ fi
+ if use berkdb; then
+ dbmliborder+="${dbmliborder:+:}bdb"
+ fi
+
+ OPT="" econf \
+ --with-fpectl \
+ --enable-shared \
+ $(use_enable ipv6) \
+ $(use_with threads) \
+ $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
+ --infodir='${prefix}/share/info' \
+ --mandir='${prefix}/share/man' \
+ --with-dbmliborder="${dbmliborder}" \
+ --with-libc="" \
+ --enable-loadable-sqlite-extensions \
+ --with-system-expat \
+ --with-system-ffi
+}
+
+src_compile() {
+ emake EPYTHON="python${PV%%.*}" || die "emake failed"
+
+ # Work around bug 329499. See also bug 413751.
+ pax-mark m python
+}
+
+src_test() {
+ # Tests will not work when cross compiling.
+ if tc-is-cross-compiler; then
+ elog "Disabling tests due to crosscompiling."
+ 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}"
+ 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
+ done
+
+ elog "The following tests have been skipped:"
+ for test in ${skipped_tests}; do
+ elog "test_${test}.py"
+ done
+
+ elog "If you would like to run them, you may:"
+ elog "cd '${EPREFIX}$(python_get_libdir)/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}/"
+
+ emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed"
+ python_clean_installation_image -q
+
+ sed -e "s/\(LDFLAGS=\).*/\1/" -i "${ED}$(python_get_libdir)/config/Makefile" || die "sed failed"
+
+ mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
+
+ # 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}"
+ 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}
+ 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}
+ fi
+
+ use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing"
+ use wininst || rm -f "${ED}$(python_get_libdir)/distutils/command/"wininst-*.exe
+
+ dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
+
+ if use examples; then
+ insinto /usr/share/doc/${PF}/examples
+ doins -r Tools || die "doins failed"
+ fi
+
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
+ 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"
+}
+
+pkg_preinst() {
+ if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then
+ python_updater_warning="1"
+ fi
+}
+
+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
+ eselect python update
+ fi
+
+ if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
+ eselect python update --python${PV%%.*}
+ fi
+}
+
+pkg_postinst() {
+ eselect_python_update
+
+ python_mod_optimize -f -x "/(site-packages|test|tests)/" $(python_get_libdir)
+
+ if [[ "${python_updater_warning}" == "1" ]]; 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."
+ fi
+}
+
+pkg_postrm() {
+ eselect_python_update
+
+ python_mod_cleanup $(python_get_libdir)
+}

0 comments on commit ed0abe0

Please sign in to comment.