python-2.6.5-r3: the bug #329499 has been fixed in the current stable version

This commit is contained in:
Anton Bolshakov 2011-04-15 05:39:35 +00:00
parent 4c16e834be
commit cbef65c207
12 changed files with 0 additions and 3039 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,13 +0,0 @@
AUX paxteam-2.6.5.patch 6167 RMD160 9912bbf0b7c0d7bb60df6b53cbd1e78f8c330d15 SHA1 0c3d7ef80783843c924054813df564daa7482341 SHA256 23ee01a814be490572982498549916c559c44113da713a13ee260de0b3127f51
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-config-2.4-r1 1624 RMD160 e4e6893c9e8414289c0c70c0f4be58835911e376 SHA1 addf9a6eb81e636364264a6abb3d96f01ea0cf90 SHA256 923a9e896f99cca5aa4ccbb02f981c6e26a2b1aa42326de2359d3c884bde2a9f
DIST Python-2.6.5.tar.bz2 11095581 RMD160 909c6a13749396f2b19fed51821d3e2577b2833b SHA1 24c94f5428a8c94c9d0b316e3019fee721fdb5d1 SHA256 62da62eb685621ede2be1275f11b89fa0e0be578db8daa5320d0a7855c0a9ebc
DIST python-gentoo-patches-2.6.5-r5.tar.bz2 1482491 RMD160 a7978912b8598a589a82746642fa5b676369c599 SHA1 26c983e79ac32b63a3bc6e411d96b9233524733b SHA256 6cb8cf0e1418cad035a243c08dfeee2e9395397dda74ada49667b3eba63bb76c
EBUILD python-2.6.5-r3.ebuild 9527 RMD160 4e1c74d22a589a458fbdd7304616f8b4f5157f5f SHA1 1505be7103553f24e4bcac59cf0fe725a8a28801 SHA256 5c3ff4e2339a7554ae24e78f03055fefdf1afa13eca5f1976715db78d39b73b8
MISC ChangeLog 88094 RMD160 d55181d965db39af2297e030cb79bf4f9c4ffd7e SHA1 3c34c4b78b5491cbf11f7a9e1ca28398355a13a4 SHA256 7d2cca063016e95ff0b4f26bb7a24438c9a294510bdadff8a8be74ebf3c1eacd
MISC metadata.xml 661 RMD160 54831d16b8807086bfabdbb3df9d33336b5d42a0 SHA1 9867c337fe9e6f4e967004fc9409763e0fedf43b SHA256 2c6c3407251f7ccd6501dee49494e539a9544f2fbae99a4373eefdf4e83e8908

View file

@ -1,208 +0,0 @@
Index: setup.py
===================================================================
--- setup.py (revision 83356)
+++ setup.py (working copy)
@@ -1861,8 +1861,7 @@
'_ctypes/callbacks.c',
'_ctypes/callproc.c',
'_ctypes/stgdict.c',
- '_ctypes/cfield.c',
- '_ctypes/malloc_closure.c']
+ '_ctypes/cfield.c']
depends = ['_ctypes/ctypes.h']
if sys.platform == 'darwin':
Index: Modules/_ctypes/callbacks.c
===================================================================
--- Modules/_ctypes/callbacks.c (revision 83356)
+++ Modules/_ctypes/callbacks.c (working copy)
@@ -21,8 +21,8 @@
Py_XDECREF(self->converters);
Py_XDECREF(self->callable);
Py_XDECREF(self->restype);
- if (self->pcl)
- FreeClosure(self->pcl);
+ if (self->pcl_write)
+ ffi_closure_free(self->pcl_write);
PyObject_GC_Del(self);
}
@@ -373,7 +373,8 @@
return NULL;
}
- p->pcl = NULL;
+ p->pcl_exec = NULL;
+ p->pcl_write = NULL;
memset(&p->cif, 0, sizeof(p->cif));
p->converters = NULL;
p->callable = NULL;
@@ -403,8 +404,9 @@
assert(CThunk_CheckExact(p));
- p->pcl = MallocClosure();
- if (p->pcl == NULL) {
+ p->pcl_write = ffi_closure_alloc(sizeof(ffi_closure),
+ &p->pcl_exec);
+ if (p->pcl_write == NULL) {
PyErr_NoMemory();
goto error;
}
@@ -449,7 +451,9 @@
"ffi_prep_cif failed with %d", result);
goto error;
}
- result = ffi_prep_closure(p->pcl, &p->cif, closure_fcn, p);
+ result = ffi_prep_closure_loc(p->pcl_write, &p->cif, closure_fcn,
+ p,
+ p->pcl_exec);
if (result != FFI_OK) {
PyErr_Format(PyExc_RuntimeError,
"ffi_prep_closure failed with %d", result);
Index: Modules/_ctypes/malloc_closure.c
===================================================================
--- Modules/_ctypes/malloc_closure.c (revision 83356)
+++ Modules/_ctypes/malloc_closure.c (working copy)
@@ -1,114 +0,0 @@
-/*****************************************************************
- This file should be kept compatible with Python 2.3, see PEP 291.
- *****************************************************************/
-
-#include <Python.h>
-#include <ffi.h>
-#ifdef MS_WIN32
-#include <windows.h>
-#else
-#include <sys/mman.h>
-#include <unistd.h>
-# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
-# define MAP_ANONYMOUS MAP_ANON
-# endif
-#endif
-#include "ctypes.h"
-
-/* BLOCKSIZE can be adjusted. Larger blocksize will take a larger memory
- overhead, but allocate less blocks from the system. It may be that some
- systems have a limit of how many mmap'd blocks can be open.
-*/
-
-#define BLOCKSIZE _pagesize
-
-/* #define MALLOC_CLOSURE_DEBUG */ /* enable for some debugging output */
-
-/******************************************************************/
-
-typedef union _tagITEM {
- ffi_closure closure;
- union _tagITEM *next;
-} ITEM;
-
-static ITEM *free_list;
-static int _pagesize;
-
-static void more_core(void)
-{
- ITEM *item;
- int count, i;
-
-/* determine the pagesize */
-#ifdef MS_WIN32
- if (!_pagesize) {
- SYSTEM_INFO systeminfo;
- GetSystemInfo(&systeminfo);
- _pagesize = systeminfo.dwPageSize;
- }
-#else
- if (!_pagesize) {
-#ifdef _SC_PAGESIZE
- _pagesize = sysconf(_SC_PAGESIZE);
-#else
- _pagesize = getpagesize();
-#endif
- }
-#endif
-
- /* calculate the number of nodes to allocate */
- count = BLOCKSIZE / sizeof(ITEM);
-
- /* allocate a memory block */
-#ifdef MS_WIN32
- item = (ITEM *)VirtualAlloc(NULL,
- count * sizeof(ITEM),
- MEM_COMMIT,
- PAGE_EXECUTE_READWRITE);
- if (item == NULL)
- return;
-#else
- item = (ITEM *)mmap(NULL,
- count * sizeof(ITEM),
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS,
- -1,
- 0);
- if (item == (void *)MAP_FAILED)
- return;
-#endif
-
-#ifdef MALLOC_CLOSURE_DEBUG
- printf("block at %p allocated (%d bytes), %d ITEMs\n",
- item, count * sizeof(ITEM), count);
-#endif
- /* put them into the free list */
- for (i = 0; i < count; ++i) {
- item->next = free_list;
- free_list = item;
- ++item;
- }
-}
-
-/******************************************************************/
-
-/* put the item back into the free list */
-void FreeClosure(void *p)
-{
- ITEM *item = (ITEM *)p;
- item->next = free_list;
- free_list = item;
-}
-
-/* return one item from the free list, allocating more if needed */
-void *MallocClosure(void)
-{
- ITEM *item;
- if (!free_list)
- more_core();
- if (!free_list)
- return NULL;
- item = free_list;
- free_list = item->next;
- return item;
-}
Index: Modules/_ctypes/_ctypes.c
===================================================================
--- Modules/_ctypes/_ctypes.c (revision 83356)
+++ Modules/_ctypes/_ctypes.c (working copy)
@@ -3443,7 +3443,7 @@
self->callable = callable;
self->thunk = thunk;
- *(void **)self->b_ptr = (void *)thunk->pcl;
+ *(void **)self->b_ptr = (void *)thunk->pcl_exec;
Py_INCREF((PyObject *)thunk); /* for KeepRef */
if (-1 == KeepRef((CDataObject *)self, 0, (PyObject *)thunk)) {
Index: Modules/_ctypes/ctypes.h
===================================================================
--- Modules/_ctypes/ctypes.h (revision 83356)
+++ Modules/_ctypes/ctypes.h (working copy)
@@ -95,7 +95,8 @@
typedef struct {
PyObject_VAR_HEAD
- ffi_closure *pcl; /* the C callable */
+ ffi_closure *pcl_write; /* the C callable, writeable */
+ void *pcl_exec; /* the C callable, executable */
ffi_cif cif;
int flags;
PyObject *converters;

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

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 $?
}

View file

@ -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:

View file

@ -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,

View file

@ -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

View file

@ -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:

View file

@ -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)

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>python</herd>
<use>
<flag name="threads">Enable threading support. (DON'T DISABLE THIS UNLESS YOU KNOW WHAT YOU'RE DOING)</flag>
<flag name="wide-unicode">Enable wide Unicode implementation which uses 4-byte Unicode characters. Switching of this USE flag changes ABI of Python and requires reinstallation of many Python modules. (DON'T DISABLE THIS UNLESS YOU KNOW WHAT YOU'RE DOING)</flag>
<flag name="wininst">Install Windows executables required to create an executable installer for MS Windows.</flag>
</use>
</pkgmetadata>

View file

@ -1,314 +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.5-r3.ebuild,v 1.8 2010/08/11 22:32:00 josejx Exp $
EAPI="2"
inherit autotools eutils flag-o-matic multilib pax-utils python toolchain-funcs
MY_P="Python-${PV}"
PATCHSET_REVISION="5"
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 hardened ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
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
) )
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 )
)
doc? ( dev-python/python-docs:${SLOT} )"
DEPEND="${RDEPEND}
dev-util/pkgconfig
!sys-devel/gcc[libffi]"
RDEPEND+=" !build? ( app-misc/mime-types )"
PDEPEND="app-admin/python-updater"
PROVIDE="virtual/python"
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. 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
}
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 ! tc-is-cross-compiler; then
rm "${WORKDIR}/${PV}"/*_all_crosscompile.patch
fi
EPATCH_SUFFIX="patch" epatch "${WORKDIR}/${PV}"
# Avoid regeneration, which would not change contents of files.
touch Include/Python-ast.h Python/Python-ast.c
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
#gentoo bug #329499
use hardened && epatch "${FILESDIR}"/paxteam-${PV}.patch
# 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
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.6 correctly.
# Needed on FreeBSD unless Python 2.6 is already installed.
# Please query BSD team before removing this!
append-ldflags "-L."
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-libc="" \
--with-system-ffi
}
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 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" emake test
local result="$?"
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 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
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}"
mv "${ED}usr/share/man/man1/python.1" "${ED}usr/share/man/man1/python${SLOT}.1"
rm -f "${ED}usr/bin/smtpd.py"
if use build; then
rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{bsddb,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,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"
prep_ml_includes $(python_get_includedir)
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
newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
# Do not install empty directory.
rmdir "${ED}$(python_get_libdir)/lib-old"
}
pkg_preinst() {
if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.6" && ! has_version "${CATEGORY}/${PN}:2.7"; 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 -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 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)
}