[dev-lang/python] drop old ebuild

This commit is contained in:
Fabio Erculiani
2011-06-29 15:57:17 +02:00
parent 4d3202ebb8
commit 6340c69c24
11 changed files with 0 additions and 735 deletions
-12
View File
@@ -1,12 +0,0 @@
AUX pydoc.conf 330 RMD160 0cd619ec251597e0fcadc05bfd249915e73baa17 SHA1 a56100d45378c554b9822f6ed512a6cb7841ef50 SHA256 a45ebba2de5f2b0e963db4101507203d095c5ff667ae5002c4897a9c87786fa1
AUX pydoc.init 666 RMD160 11caf3a78bce4cdaebacaf21eaf26cc1ce30282e SHA1 88c5cb6d5bf737c74e1be93118cf157630af9ad7 SHA256 0d25c71232b74adb87dc709cc7cd8f8b13c452c0fe82fa33808f907f7a96d628
AUX python-2.4.4-test-cross.patch 977 RMD160 8fdcd45dc202993988f7a1c2b3d918068883b99e SHA1 96f25777150ba05765282a43f08da6b6fab3cb73 SHA256 ff2a131776d560d188ec5069e17fea3eb09c26fdd02124ae5ff34d791c9fd9f6
AUX python-2.5-cross-printf.patch 903 RMD160 8dc0ee148120aaf7667624bdb5574bb6af5d2a00 SHA1 596e05be8cde43e4cdd87c8ed06ebb40828f7cea SHA256 1e91e5123d74d89aa8fc9dc60d98516b785f851e43da9b634ae535130e24e780
AUX python-2.6-chflags-cross.patch 1716 RMD160 b0ec772a41a24d51f4c7430b19bcc6251cd6be87 SHA1 4745cd53cef503c41c50573ad97f40eb89fd4bcd SHA256 7c36689db47720052069725036983c2fb6959f425e3777aae55976b2788d463f
AUX python-2.6-test-cross.patch 914 RMD160 1f421b5565d39a24b887e85cbecaf3857741f756 SHA1 9c05fbe28aac6373f24317db5c277bc4549dde0c SHA256 8264f6ffe5aedcce67bea00b0346e5416a5486da2229bf82fe748d87ec65c4de
AUX python-2.6.4-snooze-thread-exit-warnings.patch 5355 RMD160 0a9974a2991e94d1e0af7d1e45651748b9a0a2f2 SHA1 acc870014662869583ef919fb3cffc2108896dbc SHA256 d5f6656152a89b550dcdddf2d00f207e8bca178a329e3594169b910a614fe0ce
AUX python-config-2.4-r1 1624 RMD160 e4e6893c9e8414289c0c70c0f4be58835911e376 SHA1 addf9a6eb81e636364264a6abb3d96f01ea0cf90 SHA256 923a9e896f99cca5aa4ccbb02f981c6e26a2b1aa42326de2359d3c884bde2a9f
DIST Python-2.6.4.tar.bz2 11249486 RMD160 fd33853842110fa3636dd296f2f27646fd2b151a SHA1 bee572680d1966501247cb2b26e0e51f94d1cd13 SHA256 dad8d5575144a210d5cc4fdbc40b8a26386e9cdb1ef58941bec0be02c7cb9d89
DIST python-gentoo-patches-2.6.4-r1.tar.bz2 12570 RMD160 2a58eb651ce5adc68c4667fb0ddc42cc215ea342 SHA1 c5de0442890bc0753c445a88390d932e629c8648 SHA256 2fe6c8838df2c07d3232ebb26c128dab2787c43a76ddb0b55acec1bed657f9f2
EBUILD python-2.6.4-r1.ebuild 9796 RMD160 abdaf87e6eba7ec1a2f01ece6c941939a271e95e SHA1 87018c1f429415b9b9b1a52c79acb09215ca0a0d SHA256 3fac3de442417293d47739ea446bdc568c7886a570798c51d7e1c1b5cd559c94
MISC Reasons 183 RMD160 14e9147180c352b7f86b2d9087a5a8b9b9a334e6 SHA1 96710bd1723d3f15d2ac185fe71d80a81cf33368 SHA256 33de32e64198539ce868a71e3a3c031896f31aedabdeb48ecf9b936ae49d94f4
-4
View File
@@ -1,4 +0,0 @@
# Fabio Erculiani <lxnay@sabayon.org>
- apply a patch to 2.6.4 (2.6.5 has it already) to snooze bogus
"exception on exit" warnings coming from threads during interpreter
shutdown
-8
View File
@@ -1,8 +0,0 @@
# /etc/init.d/pydoc.conf
# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/files/pydoc.conf,v 1.2 2008/06/30 15:10:28 hawking Exp $
# This file contains the configuration information for pydoc's internal
# webserver. The variables should be rather self explanatory :-)
# Default port for Python's pydoc server
PYDOC_PORT=7464
-26
View File
@@ -1,26 +0,0 @@
#!/sbin/runscript
# Copyright 1999-2008 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public Licence v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/files/pydoc.init,v 1.2 2008/06/30 15:10:28 hawking Exp $
depend() {
need net
}
start() {
if [ -z $PYDOC_PORT ] ; then
eerror "Port not set"
return 1
fi
ebegin "Starting pydoc server on port $PYDOC_PORT"
start-stop-daemon --start --background --make-pidfile \
--pidfile /var/run/pydoc.pid \
--startas /usr/bin/pydoc -- -p $PYDOC_PORT
eend $?
}
stop() {
ebegin "Stopping pydoc server"
start-stop-daemon --stop --quiet --pidfile /var/run/pydoc.pid
eend $?
}
@@ -1,19 +0,0 @@
--- Python-2.4.4/Lib/test/test_multibytecodec.py.orig 2007-09-10 14:52:34.424592960 -0400
+++ Python-2.4.4/Lib/test/test_multibytecodec.py 2007-09-10 14:53:30.646201491 -0400
@@ -81,11 +81,11 @@ class Test_ISO2022(unittest.TestCase):
uni = u':hu4:unit\xe9 de famille'
self.assertEqual(iso2022jp2.decode('iso2022-jp-2'), uni)
- def test_iso2022_jp_g0(self):
- self.failIf('\x0e' in u'\N{SOFT HYPHEN}'.encode('iso-2022-jp-2'))
- for encoding in ('iso-2022-jp-2004', 'iso-2022-jp-3'):
- e = u'\u3406'.encode(encoding)
- self.failIf(filter(lambda x: x >= '\x80', e))
+# def test_iso2022_jp_g0(self):
+# self.failIf('\x0e' in u'\N{SOFT HYPHEN}'.encode('iso-2022-jp-2'))
+# for encoding in ('iso-2022-jp-2004', 'iso-2022-jp-3'):
+# e = u'\u3406'.encode(encoding)
+# self.failIf(filter(lambda x: x >= '\x80', e))
def test_bug1572832(self):
if sys.maxunicode >= 0x10000:
@@ -1,34 +0,0 @@
http://bugs.gentoo.org/239110
assume %zd is supported when cross-compiling. any target we care about
supports it, so ...
--- configure.in
+++ configure.in
@@ -3417,7 +3417,7 @@
-AC_MSG_CHECKING(for %zd printf() format support)
+AC_CACHE_CHECK([for %zd printf() format support], [py_cv_has_zd_printf], [dnl
AC_TRY_RUN([#include <stdio.h>
#include <stddef.h>
#include <string.h>
@@ -3451,10 +3451,13 @@
return 1;
return 0;
-}],
-[AC_MSG_RESULT(yes)
- AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
- AC_MSG_RESULT(no))
+}], [py_cv_has_zd_printf="yes"],
+ [py_cv_has_zd_printf="no"],
+ [py_cv_has_zd_printf="cross -- assuming yes"]
+)])
+if test "$py_cv_has_zd_printf" != "no" ; then
+ AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])
+fi
AC_CHECK_TYPE(socklen_t,,
AC_DEFINE(socklen_t,int,
@@ -1,59 +0,0 @@
if we're cross-compiling, fall back to a link-only test rather than trying
to run a program for the chflags functions
--- python-2.6/configure.in
+++ python-2.6/configure.in
@@ -2565,7 +2565,7 @@
# On Tru64, chflags seems to be present, but calling it will
# exit Python
-AC_MSG_CHECKING(for chflags)
+AC_CACHE_CHECK([for chflags], [py_cv_has_chflags], [dnl
AC_TRY_RUN([
#include <sys/stat.h>
#include <unistd.h>
@@ -2575,12 +2575,18 @@
return 1;
return 0;
}
-],AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.)
- AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no)
-)
+], [py_cv_has_chflags="yes"],
+ [py_cv_has_chflags="no"],
+ [py_cv_has_chflags="cross"])
+])
+if test "$py_cv_has_chflags" = "cross" ; then
+ AC_CHECK_FUNC([chflags], [py_cv_has_chflags="yes"], [py_cv_has_chflags="no"])
+fi
+if test "$py_cv_has_chflags" = "yes" ; then
+ AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.)
+fi
-AC_MSG_CHECKING(for lchflags)
+AC_CACHE_CHECK([for lchflags], [py_cv_has_lchflags], [dnl
AC_TRY_RUN([
#include <sys/stat.h>
#include <unistd.h>
@@ -2590,10 +2596,16 @@
return 1;
return 0;
}
-],AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.)
- AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no)
-)
+], [py_cv_has_lchflags="yes"],
+ [py_cv_has_lchflags="no"],
+ [py_cv_has_lchflags="cross"])
+])
+if test "$py_cv_has_lchflags" = "cross" ; then
+ AC_CHECK_FUNC([lchflags], [py_cv_has_lchflags="yes"], [py_cv_has_lchflags="no"])
+fi
+if test "$py_cv_has_lchflags" = "yes" ; then
+ AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.)
+fi
dnl Check if system zlib has *Copy() functions
dnl
@@ -1,19 +0,0 @@
--- Lib/test/test_multibytecodec.py.orig 2008-04-19 18:48:59.000000000 +0300
+++ Lib/test/test_multibytecodec.py 2008-04-19 18:49:44.000000000 +0300
@@ -212,11 +212,11 @@
uni = u':hu4:unit\xe9 de famille'
self.assertEqual(iso2022jp2.decode('iso2022-jp-2'), uni)
- def test_iso2022_jp_g0(self):
- self.failIf('\x0e' in u'\N{SOFT HYPHEN}'.encode('iso-2022-jp-2'))
- for encoding in ('iso-2022-jp-2004', 'iso-2022-jp-3'):
- e = u'\u3406'.encode(encoding)
- self.failIf(filter(lambda x: x >= '\x80', e))
+ #def test_iso2022_jp_g0(self):
+ # self.failIf('\x0e' in u'\N{SOFT HYPHEN}'.encode('iso-2022-jp-2'))
+ # for encoding in ('iso-2022-jp-2004', 'iso-2022-jp-3'):
+ # e = u'\u3406'.encode(encoding)
+ # self.failIf(filter(lambda x: x >= '\x80', e))
def test_bug1572832(self):
if sys.maxunicode >= 0x10000:
@@ -1,184 +0,0 @@
Index: Python/pythonrun.c
===================================================================
--- Python/pythonrun.c (revisione 75748)
+++ Python/pythonrun.c (revisione 75749)
@@ -17,6 +17,7 @@
#include "ast.h"
#include "eval.h"
#include "marshal.h"
+#include "abstract.h"
#ifdef HAVE_SIGNAL_H
#include <signal.h>
@@ -61,6 +62,7 @@
PyCompilerFlags *);
static void err_input(perrdetail *);
static void initsigs(void);
+static void wait_for_thread_shutdown(void);
static void call_sys_exitfunc(void);
static void call_ll_exitfuncs(void);
extern void _PyUnicode_Init(void);
@@ -387,6 +389,8 @@
if (!initialized)
return;
+ wait_for_thread_shutdown();
+
/* The interpreter is still entirely intact at this point, and the
* exit funcs may be relying on that. In particular, if some thread
* or exit func is still waiting to do an import, the import machinery
@@ -1663,6 +1667,32 @@
#include "pythread.h"
#endif
+/* Wait until threading._shutdown completes, provided
+ the threading module was imported in the first place.
+ The shutdown routine will wait until all non-daemon
+ "threading" threads have completed. */
+static void
+wait_for_thread_shutdown(void)
+{
+#ifdef WITH_THREAD
+ PyObject *result;
+ PyThreadState *tstate = PyThreadState_GET();
+ PyObject *threading = PyMapping_GetItemString(tstate->interp->modules,
+ "threading");
+ if (threading == NULL) {
+ /* threading not imported */
+ PyErr_Clear();
+ return;
+ }
+ result = PyObject_CallMethod(threading, "_shutdown", "");
+ if (result == NULL)
+ PyErr_WriteUnraisable(threading);
+ else
+ Py_DECREF(result);
+ Py_DECREF(threading);
+#endif
+}
+
#define NEXITFUNCS 32
static void (*exitfuncs[NEXITFUNCS])(void);
static int nexitfuncs = 0;
Index: Misc/NEWS
===================================================================
--- Misc/NEWS (revisione 75748)
+++ Misc/NEWS (revisione 75749)
@@ -4,6 +4,22 @@
(editors: check NEWS.help for information about editing NEWS using ReST.)
+What's New in Python 2.6.5
+==========================
+
+*Release date: XX-XXX-20XX*
+
+Core and Builtins
+-----------------
+
+- Issue #1722344: threading._shutdown() is now called in Py_Finalize(), which
+ fixes the problem of some exceptions being thrown at shutdown when the
+ interpreter is killed. Patch by Adam Olsen.
+
+Library
+-------
+
+
What's New in Python 2.6.4 final?
=================================
Index: Misc/ACKS
===================================================================
--- Misc/ACKS (revisione 75748)
+++ Misc/ACKS (revisione 75749)
@@ -517,6 +517,7 @@
Tim O'Malley
Pascal Oberndoerfer
Jeffrey Ollie
+Adam Olsen
Grant Olson
Piet van Oostrum
Jason Orendorff
Index: Lib/test/test_threading.py
===================================================================
--- Lib/test/test_threading.py (revisione 75748)
+++ Lib/test/test_threading.py (revisione 75749)
@@ -284,7 +284,31 @@
self.failIf(rc == 2, "interpreted was blocked")
self.failUnless(rc == 0, "Unexpected error")
+ def test_join_nondaemon_on_shutdown(self):
+ # Issue 1722344
+ # Raising SystemExit skipped threading._shutdown
+ import subprocess
+ p = subprocess.Popen([sys.executable, "-c", """if 1:
+ import threading
+ from time import sleep
+ def child():
+ sleep(1)
+ # As a non-daemon thread we SHOULD wake up and nothing
+ # should be torn down yet
+ print "Woke up, sleep function is:", sleep
+
+ threading.Thread(target=child).start()
+ raise SystemExit
+ """],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ stdout, stderr = p.communicate()
+ self.assertEqual(stdout.strip(),
+ "Woke up, sleep function is: <built-in function sleep>")
+ stderr = re.sub(r"^\[\d+ refs\]", "", stderr, re.MULTILINE).strip()
+ self.assertEqual(stderr, "")
+
def test_enumerate_after_join(self):
# Try hard to trigger #1703448: a thread is still returned in
# threading.enumerate() after it has been join()ed.
Index: Modules/main.c
===================================================================
--- Modules/main.c (revisione 75748)
+++ Modules/main.c (revisione 75749)
@@ -222,33 +222,6 @@
}
-/* Wait until threading._shutdown completes, provided
- the threading module was imported in the first place.
- The shutdown routine will wait until all non-daemon
- "threading" threads have completed. */
-#include "abstract.h"
-static void
-WaitForThreadShutdown(void)
-{
-#ifdef WITH_THREAD
- PyObject *result;
- PyThreadState *tstate = PyThreadState_GET();
- PyObject *threading = PyMapping_GetItemString(tstate->interp->modules,
- "threading");
- if (threading == NULL) {
- /* threading not imported */
- PyErr_Clear();
- return;
- }
- result = PyObject_CallMethod(threading, "_shutdown", "");
- if (result == NULL)
- PyErr_WriteUnraisable(threading);
- else
- Py_DECREF(result);
- Py_DECREF(threading);
-#endif
-}
-
/* Main program */
int
@@ -620,8 +593,6 @@
sts = PyRun_AnyFileFlags(stdin, "<stdin>", &cf) != 0;
}
- WaitForThreadShutdown();
-
Py_Finalize();
#ifdef RISCOS
if (Py_RISCOSWimpFlag)
@@ -1,58 +0,0 @@
#! /usr/bin/python2.4
import sys
import os
import getopt
from distutils import sysconfig
valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
'ldflags', 'help']
def exit_with_usage(code=1):
print >>sys.stderr, "Usage: %s [%s]" % (sys.argv[0],
'|'.join('--'+opt for opt in valid_opts))
sys.exit(code)
try:
opts, args = getopt.getopt(sys.argv[1:], '', valid_opts)
except getopt.error:
exit_with_usage()
if not opts:
#exit_with_usage()
#be compatible with our old python-config-2.4
import string
print "-lpython2.4 -lm -L/usr/lib/python2.4/config",string.join(string.split(sysconfig.get_config_var("MODLIBS")))
sys.exit(0)
opt = opts[0][0]
pyver = sysconfig.get_config_var('VERSION')
getvar = sysconfig.get_config_var
if opt == '--help':
exit_with_usage(0)
elif opt == '--prefix':
print sysconfig.PREFIX
elif opt == '--exec-prefix':
print sysconfig.EXEC_PREFIX
elif opt in ('--includes', '--cflags'):
flags = ['-I' + sysconfig.get_python_inc(),
'-I' + sysconfig.get_python_inc(plat_specific=True)]
if opt == '--cflags':
flags.extend(getvar('CFLAGS').split())
print ' '.join(flags)
elif opt in ('--libs', '--ldflags'):
libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
libs.append('-lpython'+pyver)
# add the prefix/lib/pythonX.Y/config dir, but only if there is no
# shared library in prefix/lib/.
if opt == '--ldflags' and not getvar('Py_ENABLE_SHARED'):
libs.insert(0, '-L' + getvar('LIBPL'))
print ' '.join(libs)
-312
View File
@@ -1,312 +0,0 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.6.4-r1.ebuild,v 1.4 2010/02/26 18:16:09 jer Exp $
EAPI="2"
inherit autotools eutils flag-o-matic multilib pax-utils python toolchain-funcs
MY_P="Python-${PV}"
S="${WORKDIR}/${MY_P}"
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
mirror://gentoo/python-gentoo-patches-${PV}$([[ "${PATCHSET_REVISION}" != "0" ]] && echo "-r${PATCHSET_REVISION}").tar.bz2"
LICENSE="PSF-2.2"
SLOT="2.6"
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"
# NOTE: dev-python/{elementtree,celementtree,pysqlite,ctypes}
# do not conflict with the ones in python proper. - liquidx
RDEPEND=">=app-admin/eselect-python-20091230
>=sys-libs/zlib-1.1.3
virtual/libffi
virtual/libintl
!build? (
berkdb? ( || (
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
) )
doc? ( dev-python/python-docs:${SLOT} )
gdbm? ( sys-libs/gdbm )
ncurses? (
>=sys-libs/ncurses-5.2
readline? ( >=sys-libs/readline-4.1 )
)
sqlite? ( >=dev-db/sqlite-3 )
ssl? ( dev-libs/openssl )
tk? ( >=dev-lang/tk-8.0 )
xml? ( >=dev-libs/expat-2 )
)"
DEPEND="${RDEPEND}
dev-util/pkgconfig
!sys-devel/gcc[libffi]"
RDEPEND+=" !build? ( app-misc/mime-types )"
PDEPEND="app-admin/python-updater"
PROVIDE="virtual/python"
pkg_setup() {
if use berkdb; then
ewarn "\"bsddb\" module is out-of-date and no longer maintained inside dev-lang/python. It has"
ewarn "been additionally removed in Python 3. You should use external, still maintained \"bsddb3\""
ewarn "module provided by dev-python/bsddb3 which supports both Python 2 and Python 3."
fi
if ! has_version "=dev-lang/python-3*"; then
elog "It is highly recommended to additionally install Python 3, but without configuring Python wrapper to use Python 3."
fi
}
src_prepare() {
# Upstream bug: http://bugs.python.org/issue1722344
epatch "${FILESDIR}/"python-2.6.4-snooze-thread-exit-warnings.patch
# Ensure that internal copies of expat and libffi aren't used.
rm -fr Modules/expat
rm -fr Modules/_ctypes/libffi*
if tc-is-cross-compiler; then
epatch "${FILESDIR}/python-2.5-cross-printf.patch"
epatch "${FILESDIR}/python-2.6-chflags-cross.patch"
epatch "${FILESDIR}/python-2.6-test-cross.patch"
else
rm "${WORKDIR}/${PV}"/*_all_crosscompile.patch
fi
EPATCH_SUFFIX="patch" epatch "${WORKDIR}/${PV}"
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@@"
# Fix os.utime() on hppa. utimes it not supported but unfortunately reported as working - gmsoft (22 May 04)
# PLEASE LEAVE THIS FIX FOR NEXT VERSIONS AS IT'S A CRITICAL FIX !!!
[[ "${ARCH}" == "hppa" ]] && sed -e "s/utimes //" -i "${S}/configure"
if ! use wininst; then
# Remove Microsoft Windows executables.
rm Lib/distutils/command/wininst-*.exe
fi
# Fix OtherFileTests.testStdin() not to assume
# that stdin is a tty for bug #248081.
sed -e "s:'osf1V5':'osf1V5' and sys.stdin.isatty():" -i Lib/test/test_file.py || die "sed failed"
eautoreconf
}
src_configure() {
# Disable extraneous modules with extra dependencies.
if use build; then
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
export OPT="${CFLAGS}"
filter-flags -malign-double
[[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
# https://bugs.gentoo.org/show_bug.cgi?id=50309
if is-flag -O3; then
is-flag -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.6 correctly.
# Needed on FreeBSD unless Python 2.6 is already installed.
# Please query BSD team before removing this!
append-ldflags "-L."
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-libc="" \
--with-system-ffi
}
src_test() {
# Tests won't 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 all tests that fail during emerge but pass without emerge:
# (See bug #67970)
local skip_tests="distutils httpservers minidom pyexpat sax tcl"
# test_ctypes fails with PAX kernel (bug #234498).
host-is-pax && skip_tests+=" ctypes"
for test in ${skip_tests}; do
mv "${S}/Lib/test/test_${test}.py" "${T}"
done
# Rerun failed tests in verbose mode (regrtest -w).
EXTRATESTOPTS="-w" make test || die "make test failed"
for test in ${skip_tests}; do
mv "${T}/test_${test}.py" "${S}/Lib/test/test_${test}.py"
done
elog "The following tests have been skipped:"
for test in ${skip_tests}; do
elog "test_${test}.py"
done
elog "If you'd like to run them, you may:"
elog "cd $(python_get_libdir)/test"
elog "and run the tests separately."
python_disable_pyc
}
src_install() {
emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed"
mv "${D}usr/bin/python${SLOT}-config" "${D}usr/bin/python-config-${SLOT}"
# Fix collisions between different slots of Python.
mv "${D}usr/bin/2to3" "${D}usr/bin/2to3-${SLOT}"
mv "${D}usr/bin/pydoc" "${D}usr/bin/pydoc${SLOT}"
mv "${D}usr/bin/idle" "${D}usr/bin/idle${SLOT}"
mv "${D}usr/share/man/man1/python.1" "${D}usr/share/man/man1/python${SLOT}.1"
rm -f "${D}usr/bin/smtpd.py"
# Fix the OPT variable so that it doesn't have any flags listed in it.
# Prevents the problem with compiling things with conflicting flags later.
sed -e "s:^OPT=.*:OPT=\t\t-DNDEBUG:" -i "${D}$(python_get_libdir)/config/Makefile"
if use build; then
rm -fr "${D}usr/bin/idle${SLOT}" "${D}$(python_get_libdir)/"{bsddb,email,idlelib,lib-tk,sqlite3,test}
else
use elibc_uclibc && rm -fr "${D}$(python_get_libdir)/"{bsddb/test,test}
use berkdb || rm -fr "${D}$(python_get_libdir)/"{bsddb,test/test_bsddb*}
use sqlite || rm -fr "${D}$(python_get_libdir)/"{sqlite3,test/test_sqlite*}
use tk || rm -fr "${D}usr/bin/idle${SLOT}" "${D}$(python_get_libdir)/"{idlelib,lib-tk}
fi
use threads || rm -fr "${D}$(python_get_libdir)/multiprocessing"
prep_ml_includes $(python_get_includedir)
if use examples; then
insinto /usr/share/doc/${PF}/examples
doins -r "${S}/Tools" || die "doins failed"
fi
newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
# Don't install empty directory.
rmdir "${D}$(python_get_libdir)/lib-old"
}
pkg_preinst() {
if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version ">=${CATEGORY}/${PN}-${SLOT}_alpha"; then
python_updater_warning="1"
fi
}
eselect_python_update() {
local eselect_python_options=
[[ "$(eselect python show)" == "python2."* ]] && eselect_python_options="--python2"
# Create python2 symlink.
eselect python update --python2 > /dev/null
eselect python update ${eselect_python_options}
}
pkg_postinst() {
eselect_python_update
python_mod_optimize -x "(site-packages|test)" $(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 run 'python-updater \${options}' to rebuild Python modules."
ewarn
ewarn "\e[1;31m************************************************************************\e[0m"
ewarn
ebeep 12
fi
}
pkg_postrm() {
eselect_python_update
python_mod_cleanup $(python_get_libdir)
}