summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirkjan Ochtman <djc@gentoo.org>2011-09-16 13:34:12 +0000
committerDirkjan Ochtman <djc@gentoo.org>2011-09-16 13:34:12 +0000
commit34c8d28d0b93331c872e3d4fc3d433c7d7f3cd1e (patch)
tree86531eead24f2c038b6944fe98764f08b6455174 /dev-lang
parentMarked stable on AMD64 based on arch testing by Agostino "ago" Sarubbo & Elij... (diff)
downloadhistorical-34c8d28d0b93331c872e3d4fc3d433c7d7f3cd1e.tar.gz
historical-34c8d28d0b93331c872e3d4fc3d433c7d7f3cd1e.tar.bz2
historical-34c8d28d0b93331c872e3d4fc3d433c7d7f3cd1e.zip
Set sys.platform to linux2 even on linux3 (bug 375257).
Package-Manager: portage-2.1.10.15/cvs/Linux x86_64
Diffstat (limited to 'dev-lang')
-rw-r--r--dev-lang/python/ChangeLog9
-rw-r--r--dev-lang/python/Manifest11
-rw-r--r--dev-lang/python/files/linux2.patch24
-rw-r--r--dev-lang/python/python-2.7.2-r3.ebuild402
-rw-r--r--dev-lang/python/python-3.1.4-r3.ebuild367
5 files changed, 808 insertions, 5 deletions
diff --git a/dev-lang/python/ChangeLog b/dev-lang/python/ChangeLog
index 6ab28a62d97c..e6b052f9b0f0 100644
--- a/dev-lang/python/ChangeLog
+++ b/dev-lang/python/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for dev-lang/python
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.545 2011/09/16 13:26:26 djc Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.546 2011/09/16 13:34:12 djc Exp $
+
+*python-3.1.4-r3 (16 Sep 2011)
+*python-2.7.2-r3 (16 Sep 2011)
+
+ 16 Sep 2011; Dirkjan Ochtman <djc@gentoo.org> +files/linux2.patch,
+ +python-2.7.2-r3.ebuild, +python-3.1.4-r3.ebuild:
+ Set sys.platform to linux2 even on linux3 (bug 375257).
16 Sep 2011; Dirkjan Ochtman <djc@gentoo.org> -python-2.6.5-r3.ebuild,
-python-2.7.1-r2.ebuild:
diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
index a7119586ce0c..7c542812abeb 100644
--- a/dev-lang/python/Manifest
+++ b/dev-lang/python/Manifest
@@ -1,6 +1,7 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
+AUX linux2.patch 606 RMD160 0cca6f619a98e6090d01f4a80c2178c323416a47 SHA1 8fc817c8da2f74d3ccc93d84a1bc713ed26c00e2 SHA256 a178120a3022ecb14044c82eff7e828f6d060b6885acacd4a4d8569fde372fd7
AUX pydoc.conf 330 RMD160 0cd619ec251597e0fcadc05bfd249915e73baa17 SHA1 a56100d45378c554b9822f6ed512a6cb7841ef50 SHA256 a45ebba2de5f2b0e963db4101507203d095c5ff667ae5002c4897a9c87786fa1
AUX pydoc.init 679 RMD160 79ccfb6179974f4a4f35238c122b9640753e7e43 SHA1 e7bb706ae4ef94d28874677c4f92b82d08d7999a SHA256 8f6c1753a28462fa61d22a927debed7ec3994b3617d728932357e739ede6516f
AUX python-2.4.4-test-cross.patch 977 RMD160 8fdcd45dc202993988f7a1c2b3d918068883b99e SHA1 96f25777150ba05765282a43f08da6b6fab3cb73 SHA256 ff2a131776d560d188ec5069e17fea3eb09c26fdd02124ae5ff34d791c9fd9f6
@@ -33,15 +34,17 @@ EBUILD python-2.6.6-r2.ebuild 10546 RMD160 48acd2266821d2475a87e60ceb327910f55c3
EBUILD python-2.6.7-r2.ebuild 11956 RMD160 d0182a06afa3529f2b4cfd11046e81bf9389424c SHA1 099e0b39cdf64dade2bea8e08fdc7d139726abde SHA256 845828a12e4da9a2f987162de8afd7082710fcd9d5cf34adfac41c43293d6e5c
EBUILD python-2.7.1-r1.ebuild 11120 RMD160 31a17a4a78201fc4991453d4790acb90e0ffe7b2 SHA1 83aeceed035031758547a668ca9543e94d1cc2f5 SHA256 097372f26e0410438e1f511b6c13678ed16ae68b3d0779a1f848630813ca2dcf
EBUILD python-2.7.2-r2.ebuild 12212 RMD160 3b8f961343f3be5819ad6b1c1c0843b30db9ecb7 SHA1 72b99db11f81f9249b9d46229f4d630efd16f107 SHA256 ded0327f1a22a2b9b72cb3c8f954bb4f51ba62ffc04eb6ab5f6a7091dd22008f
+EBUILD python-2.7.2-r3.ebuild 12241 RMD160 121185c67f75ef391a75b044f62b65984c3d8789 SHA1 6e13c9a2e4189727c983fff1d67bc997a5e48710 SHA256 3254f83f5e6a4311e8b195241f990ae88e65d7c3a0093dd451901b99392446c7
EBUILD python-3.1.3-r1.ebuild 9797 RMD160 64b5953182ffe6a47dee1d7e3cb5bcec0d7b13bb SHA1 63a8e3bddfd6d75954658ed728f5cafbf30ebdb1 SHA256 8ef9175479be2368d6dae555a5af651707da8d369baa7eef199cc31596764e83
EBUILD python-3.1.4-r2.ebuild 10705 RMD160 2f5657114d086c4546da85f344b322322bbb80c6 SHA1 c74f64d33d14d7db0fc9bada4107e98a6b73e6a8 SHA256 5e1bdf76fa395d8e96e3df13e2f7abc662afa4443ddbdcba3ba8c452a0312009
+EBUILD python-3.1.4-r3.ebuild 10734 RMD160 19b9ee818794d50396db8018a2ec1173bdec6946 SHA1 462587b269b8f2d3cbdbc3ac25a0c6507c381017 SHA256 73cf8008779f8211a3281b2b31b2857bbba7f8f0b170e5b10b3f2ecd6fc36ebb
EBUILD python-3.2-r2.ebuild 10773 RMD160 c9382c6da7738936c57461909a3eb16c74f171a4 SHA1 27d961b9fe9676d68bac0603e63d4f4b6d35ca99 SHA256 f98e550068b32d2526b3d8e487da74e4b2572bf388587f03a3b36942a9657c1d
-MISC ChangeLog 97750 RMD160 a1c0995c2e9436e9275dba05574fcb6a62cb4581 SHA1 0c8c4ed7cdda938f1e7f61b9333e2a129cbbc4ed SHA256 3915a4c4e8e43e87f3c0516b70514ba6b20e3126629b6ea107ebe7079eaa7d31
+MISC ChangeLog 97993 RMD160 f63e61e8d6b05f516c27bec36f93aaf4de7b130e SHA1 e292ed0bb6e83e68a5c2452ac9f7ab43f799a9e3 SHA256 ecc6c3e9ba289962f970ca7b8acf0c78f7ffb0c9979bf3c112801250ea8e74be
MISC metadata.xml 661 RMD160 54831d16b8807086bfabdbb3df9d33336b5d42a0 SHA1 9867c337fe9e6f4e967004fc9409763e0fedf43b SHA256 2c6c3407251f7ccd6501dee49494e539a9544f2fbae99a4373eefdf4e83e8908
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
-iEYEAREKAAYFAk5zTosACgkQxeMuLWsGW/sOigCgiJa4V3EJdMVWbkHUARg2t3dW
-UIcAoK/yEloy9T29zn6raD6/mSDpMmrG
-=9JM7
+iEYEAREKAAYFAk5zUF8ACgkQxeMuLWsGW/ufKgCfZE0vCrBfm5DpzVx+XP7+n/NS
+gzQAnRX3ocZEtXuLJp8Qo5npqjwwr47W
+=fCKN
-----END PGP SIGNATURE-----
diff --git a/dev-lang/python/files/linux2.patch b/dev-lang/python/files/linux2.patch
new file mode 100644
index 000000000000..c34142381878
--- /dev/null
+++ b/dev-lang/python/files/linux2.patch
@@ -0,0 +1,24 @@
+http://hg.python.org/cpython/rev/c816479f6aaf/
+diff --git a/configure b/configure
+--- a/configure
++++ b/configure
+@@ -2995,6 +2995,7 @@ then
+ MACHDEP="$ac_md_system$ac_md_release"
+
+ case $MACHDEP in
++ linux*) MACHDEP="linux2";;
+ cygwin*) MACHDEP="cygwin";;
+ darwin*) MACHDEP="darwin";;
+ atheos*) MACHDEP="atheos";;
+diff --git a/configure.in b/configure.in
+--- a/configure.in
++++ b/configure.in
+@@ -293,6 +293,7 @@ then
+ MACHDEP="$ac_md_system$ac_md_release"
+
+ case $MACHDEP in
++ linux*) MACHDEP="linux2";;
+ cygwin*) MACHDEP="cygwin";;
+ darwin*) MACHDEP="darwin";;
+ atheos*) MACHDEP="atheos";;
+
diff --git a/dev-lang/python/python-2.7.2-r3.ebuild b/dev-lang/python/python-2.7.2-r3.ebuild
new file mode 100644
index 000000000000..b2286f87c461
--- /dev/null
+++ b/dev-lang/python/python-2.7.2-r3.ebuild
@@ -0,0 +1,402 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.2-r3.ebuild,v 1.1 2011/09/16 13:34:12 djc Exp $
+
+EAPI="2"
+WANT_AUTOMAKE="none"
+
+inherit autotools eutils flag-o-matic multilib python toolchain-funcs
+
+if [[ "${PV}" == *_pre* ]]; then
+ inherit mercurial
+
+ EHG_REPO_URI="http://hg.python.org/cpython"
+ EHG_REVISION=""
+else
+ MY_PV="${PV%_p*}"
+ MY_P="Python-${MY_PV}"
+fi
+
+PATCHSET_REVISION="0"
+
+DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language."
+HOMEPAGE="http://www.python.org/"
+if [[ "${PV}" == *_pre* ]]; then
+ SRC_URI=""
+else
+ SRC_URI="http://www.python.org/ftp/python/${MY_PV}/${MY_P}.tar.bz2
+ mirror://gentoo/python-gentoo-patches-${MY_PV}$([[ "${PATCHSET_REVISION}" != "0" ]] && echo "-r${PATCHSET_REVISION}").tar.bz2"
+fi
+
+LICENSE="PSF-2"
+SLOT="2.7"
+PYTHON_ABI="${SLOT}"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~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-admin/eselect-python-20091230
+ 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 )
+ 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 )
+ )
+ !!<sys-apps/portage-2.1.9"
+DEPEND=">=sys-devel/autoconf-2.65
+ ${RDEPEND}
+ $([[ "${PV}" == *_pre* ]] && echo "=${CATEGORY}/${PN}-${PV%%.*}*")
+ dev-util/pkgconfig
+ $([[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]] && echo "doc? ( dev-python/sphinx )")
+ !sys-devel/gcc[libffi]"
+RDEPEND+=" !build? ( app-misc/mime-types )
+ $([[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]] || echo "doc? ( dev-python/python-docs:${SLOT} )")"
+PDEPEND="app-admin/python-updater"
+
+if [[ "${PV}" != *_pre* ]]; then
+ S="${WORKDIR}/${MY_P}"
+fi
+
+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() {
+ # 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
+
+ if [[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]]; then
+ if [[ "$(hg branch)" != "default" ]]; then
+ die "Invalid EHG_REVISION"
+ fi
+ fi
+
+ if [[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+_pre ]]; then
+ if [[ "$(hg branch)" != "${SLOT}" ]]; then
+ die "Invalid EHG_REVISION"
+ fi
+
+ if grep -Eq '#define PY_RELEASE_LEVEL[[:space:]]+PY_RELEASE_LEVEL_FINAL' Include/patchlevel.h; then
+ # Update micro version, release level and version string.
+ local micro_version="${PV%_pre*}"
+ micro_version="${micro_version##*.}"
+ local version_string="${PV%.*}.$((${micro_version} - 1))+"
+ sed \
+ -e "s/\(#define PY_MICRO_VERSION[[:space:]]\+\)[^[:space:]]\+/\1${micro_version}/" \
+ -e "s/\(#define PY_RELEASE_LEVEL[[:space:]]\+\)[^[:space:]]\+/\1PY_RELEASE_LEVEL_ALPHA/" \
+ -e "s/\(#define PY_VERSION[[:space:]]\+\"\)[^\"]\+\(\"\)/\1${version_string}\2/" \
+ -i Include/patchlevel.h || die "sed failed"
+ fi
+ fi
+
+ local excluded_patches
+ if ! tc-is-cross-compiler; then
+ excluded_patches="*_all_crosscompile.patch"
+ fi
+
+ local patchset_dir
+ if [[ "${PV}" == *_pre* ]]; then
+ patchset_dir="${FILESDIR}/${SLOT}-${PATCHSET_REVISION}"
+ else
+ patchset_dir="${WORKDIR}/${MY_PV}"
+ fi
+
+ EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" epatch "${patchset_dir}"
+ epatch "${FILESDIR}/linux2.patch"
+
+ 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@@"
+
+ #Linux-3 compat. Bug #374579 (upstream issue12571)
+ if use kernel_linux; then
+ cp -r "${S}/Lib/plat-linux2" "${S}/Lib/plat-linux3" || die "copy plat-linux failed"
+ fi
+
+ eautoreconf
+}
+
+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"
+}
+
+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 "${S}/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" "${S}/Lib/test/test_${test}.py"
+ 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 "${S}/Tools" || die "doins failed"
+ fi
+
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
+
+ if use kernel_linux; then
+ if [ -d "${ED}$(python_get_libdir)/plat-linux2" ];then
+ cp -r "${ED}$(python_get_libdir)/plat-linux2" \
+ "${ED}$(python_get_libdir)/plat-linux3" || die "copy plat-linux failed"
+ else
+ cp -r "${ED}$(python_get_libdir)/plat-linux3" \
+ "${ED}$(python_get_libdir)/plat-linux2" || die "copy plat-linux failed"
+ fi
+ fi
+
+ 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
+ ewarn "\e[1;31m************************************************************************\e[0m"
+ ewarn
+ 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."
+ ewarn
+ ewarn "\e[1;31m************************************************************************\e[0m"
+ ewarn
+
+ local n
+ for ((n = 0; n < 12; n++)); do
+ echo -ne "\a"
+ sleep 1
+ done
+ fi
+
+ if [[ "${PV}" != *_pre* ]]; then
+ elog
+ elog "If you want to help in testing of recent changes in Python, then you can use"
+ elog "snapshots of Python from python overlay."
+ elog
+ fi
+}
+
+pkg_postrm() {
+ eselect_python_update
+
+ python_mod_cleanup $(python_get_libdir)
+}
diff --git a/dev-lang/python/python-3.1.4-r3.ebuild b/dev-lang/python/python-3.1.4-r3.ebuild
new file mode 100644
index 000000000000..59eec12dfed7
--- /dev/null
+++ b/dev-lang/python/python-3.1.4-r3.ebuild
@@ -0,0 +1,367 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-3.1.4-r3.ebuild,v 1.1 2011/09/16 13:34:12 djc Exp $
+
+EAPI="3"
+WANT_AUTOMAKE="none"
+
+inherit autotools eutils flag-o-matic multilib python toolchain-funcs
+
+if [[ "${PV}" == *_pre* ]]; then
+ inherit mercurial
+
+ EHG_REPO_URI="http://hg.python.org/cpython"
+ EHG_REVISION=""
+else
+ MY_PV="${PV%_p*}"
+ MY_P="Python-${MY_PV}"
+fi
+
+PATCHSET_REVISION="0"
+
+DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language."
+HOMEPAGE="http://www.python.org/"
+if [[ "${PV}" == *_pre* ]]; then
+ SRC_URI=""
+else
+ SRC_URI="http://www.python.org/ftp/python/${MY_PV}/${MY_P}.tar.xz
+ mirror://gentoo/python-gentoo-patches-${MY_PV}$([[ "${PATCHSET_REVISION}" != "0" ]] && echo "-r${PATCHSET_REVISION}").tar.bz2"
+fi
+
+LICENSE="PSF-2"
+SLOT="3.1"
+PYTHON_ABI="${SLOT}"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
+
+RDEPEND=">=app-admin/eselect-python-20091230
+ app-arch/bzip2
+ >=sys-libs/zlib-1.1.3
+ virtual/libffi
+ virtual/libintl
+ !build? (
+ gdbm? ( sys-libs/gdbm )
+ ncurses? (
+ >=sys-libs/ncurses-5.2
+ readline? ( >=sys-libs/readline-4.1 )
+ )
+ sqlite? ( >=dev-db/sqlite-3.3.3:3 )
+ ssl? ( dev-libs/openssl )
+ tk? (
+ >=dev-lang/tk-8.0
+ dev-tcltk/blt
+ )
+ xml? ( >=dev-libs/expat-2 )
+ )"
+DEPEND="${RDEPEND}
+ $([[ "${PV}" == *_pre* ]] && echo "=${CATEGORY}/${PN}-${PV%%.*}*")
+ dev-util/pkgconfig
+ $([[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]] && echo "doc? ( dev-python/sphinx )")
+ !sys-devel/gcc[libffi]"
+RDEPEND+=" !build? ( app-misc/mime-types )
+ $([[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]] || echo "doc? ( dev-python/python-docs:${SLOT} )")"
+PDEPEND="app-admin/python-updater"
+
+if [[ "${PV}" != *_pre* ]]; then
+ S="${WORKDIR}/${MY_P}"
+fi
+
+pkg_setup() {
+ python_pkg_setup
+}
+
+src_prepare() {
+ # 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
+
+ if [[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]]; then
+ if [[ "$(hg branch)" != "default" ]]; then
+ die "Invalid EHG_REVISION"
+ fi
+ fi
+
+ if [[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+_pre ]]; then
+ if [[ "$(hg branch)" != "${SLOT}" ]]; then
+ die "Invalid EHG_REVISION"
+ fi
+
+ if grep -Eq '#define PY_RELEASE_LEVEL[[:space:]]+PY_RELEASE_LEVEL_FINAL' Include/patchlevel.h; then
+ # Update micro version, release level and version string.
+ local micro_version="${PV%_pre*}"
+ micro_version="${micro_version##*.}"
+ local version_string="${PV%.*}.$((${micro_version} - 1))+"
+ sed \
+ -e "s/\(#define PY_MICRO_VERSION[[:space:]]\+\)[^[:space:]]\+/\1${micro_version}/" \
+ -e "s/\(#define PY_RELEASE_LEVEL[[:space:]]\+\)[^[:space:]]\+/\1PY_RELEASE_LEVEL_ALPHA/" \
+ -e "s/\(#define PY_VERSION[[:space:]]\+\"\)[^\"]\+\(\"\)/\1${version_string}\2/" \
+ -i Include/patchlevel.h || die "sed failed"
+ fi
+ fi
+
+ local excluded_patches
+ if ! tc-is-cross-compiler; then
+ excluded_patches="*_all_crosscompile.patch"
+ fi
+
+ local patchset_dir
+ if [[ "${PV}" == *_pre* ]]; then
+ patchset_dir="${FILESDIR}/${SLOT}-${PATCHSET_REVISION}"
+ else
+ patchset_dir="${WORKDIR}/${MY_PV}"
+ fi
+
+ EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" epatch "${patchset_dir}"
+ epatch "${FILESDIR}/linux2.patch"
+
+ #Linux-3 compat. Bug #374579 (upstream issue12571)
+ if use kernel_linux; then
+ cp -r "${S}/Lib/plat-linux2" "${S}/Lib/plat-linux3" || die "copy plat-linux failed"
+ fi
+
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
+ Lib/distutils/command/install.py \
+ Lib/distutils/sysconfig.py \
+ Lib/site.py \
+ Makefile.pre.in \
+ Modules/Setup.dist \
+ Modules/getpath.c \
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
+
+ eautoreconf
+}
+
+src_configure() {
+ if use build; then
+ # Disable extraneous modules with extra dependencies.
+ export PYTHON_DISABLE_MODULES="gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
+ export PYTHON_DISABLE_SSL="1"
+ else
+ local disable
+ 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/python3.X/config/Makefile.
+ tc-export CXX
+
+ # Set LDFLAGS so we link modules with -lpython3.1 correctly.
+ # Needed on FreeBSD unless Python 3.1 is already installed.
+ # Please query BSD team before removing this!
+ append-ldflags "-L."
+
+ local dbmliborder
+ if use gdbm; then
+ dbmliborder+="${dbmliborder:+:}gdbm"
+ fi
+
+ OPT="" econf \
+ --with-fpectl \
+ --enable-shared \
+ $(use_enable ipv6) \
+ $(use_with threads) \
+ $(use_with wide-unicode) \
+ --infodir='${prefix}/share/info' \
+ --mandir='${prefix}/share/man' \
+ --with-computed-gotos \
+ --with-dbmliborder="${dbmliborder}" \
+ --with-libc="" \
+ --with-system-ffi
+}
+
+src_compile() {
+ emake EPYTHON="python${PV%%.*}" || die "emake failed"
+}
+
+src_test() {
+ # Tests will not work when cross compiling.
+ if tc-is-cross-compiler; then
+ elog "Disabling tests due to crosscompiling."
+ return
+ fi
+
+ if ! use threads; then
+ ewarn "Disabling tests due to USE=\"-threads\""
+ return
+ fi
+
+ # Byte compiling should be enabled here.
+ # Otherwise test_import fails.
+ python_enable_pyc
+
+ # Skip failing tests.
+ local skipped_tests="distutils"
+
+ for test in ${skipped_tests}; do
+ mv "${S}/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" "${S}/Lib/test/test_${test}.py"
+ 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() {
+ emake DESTDIR="${D}" altinstall || die "emake altinstall failed"
+ python_clean_installation_image -q
+
+ 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/pydoc3" "${ED}usr/bin/pydoc${SLOT}"
+ mv "${ED}usr/bin/idle3" "${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)/"{idlelib,sqlite3,test,tkinter}
+ else
+ use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/test"
+ 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,tkinter,test/test_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 "${S}/Tools" || die "doins failed"
+ fi
+
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
+
+ if use kernel_linux; then
+ if [ -d "${ED}$(python_get_libdir)/plat-linux2" ];then
+ cp -r "${ED}$(python_get_libdir)/plat-linux2" \
+ "${ED}$(python_get_libdir)/plat-linux3" || die "copy plat-linux failed"
+ else
+ cp -r "${ED}$(python_get_libdir)/plat-linux3" \
+ "${ED}$(python_get_libdir)/plat-linux2" || die "copy plat-linux failed"
+ fi
+ fi
+
+ 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}-${SLOT}_alpha"; then
+ python_updater_warning="1"
+ fi
+}
+
+eselect_python_update() {
+ 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
+ ewarn "\e[1;31m************************************************************************\e[0m"
+ ewarn
+ 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."
+ ewarn
+ ewarn "\e[1;31m************************************************************************\e[0m"
+ ewarn
+
+ local n
+ for ((n = 0; n < 12; n++)); do
+ echo -ne "\a"
+ sleep 1
+ done
+ fi
+
+ if [[ "${PV}" != *_pre* ]]; then
+ elog
+ elog "If you want to help in testing of recent changes in Python, then you can use"
+ elog "snapshots of Python from python overlay."
+ elog
+ fi
+}
+
+pkg_postrm() {
+ eselect_python_update
+
+ python_mod_cleanup $(python_get_libdir)
+}