From bf250edfc603cce220dcfae76974131c82b38f3f Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 2 Oct 2012 22:37:29 +0200 Subject: [PATCH] python3: New package. This is the initial python3 package. It comes with Python 3 (aka py3k), which can be additionally installed to Python 2. Both versions do co-exist for some time. --- .../00003-remove-mimeaudio-tests.patch | 51 ++ .../00104-lib64-fix-for-test_install.patch | 13 + python3/patches/00111-no-static-lib.patch | 59 ++ .../00113-more-configuration-flags.patch | 50 ++ .../00114-statvfs-f_flag-constants.patch | 39 + .../00125-less-verbose-COUNT_ALLOCS.patch | 20 + .../00131-disable-tests-in-test_io.patch | 11 + ...00132-add-rpmbuild-hooks-to-unittest.patch | 68 ++ ...fix-COUNT_ALLOCS-failure-in-test_sys.patch | 21 + ...t-within-test_weakref-in-debug-build.patch | 17 + ...istutils-tests-that-fail-in-rpmbuild.patch | 12 + ...skip-test_float-known-failure-on-arm.patch | 11 + .../00141-fix-test_gc_with_COUNT_ALLOCS.patch | 22 + ...2-skip-failing-pty-tests-in-rpmbuild.patch | 22 + .../patches/00153-fix-test_gdb-noise.patch | 37 + .../patches/00155-avoid-ctypes-thunks.patch | 15 + .../patches/00156-gdb-autoload-safepath.patch | 52 ++ python3/patches/00157-uid-gid-overflows.patch | 696 ++++++++++++++++++ ...0-disable-test_fs_holes-in-rpm-build.patch | 11 + ...le-parts-of-test_socket-in-rpm-build.patch | 11 + ...sable-interrupted_write-tests-on-ppc.patch | 52 ++ .../05000-autotool-intermediates.patch | 73 ++ python3/patches/Python-3.1.1-rpath.patch | 20 + ...subprocess-with-nonreadable-path-dir.patch | 12 + python3/python-3.3.0b1-lib64.patch | 200 +++++ python3/python3.nm | 224 ++++++ 26 files changed, 1819 insertions(+) create mode 100644 python3/patches/00003-remove-mimeaudio-tests.patch create mode 100644 python3/patches/00104-lib64-fix-for-test_install.patch create mode 100644 python3/patches/00111-no-static-lib.patch create mode 100644 python3/patches/00113-more-configuration-flags.patch create mode 100644 python3/patches/00114-statvfs-f_flag-constants.patch create mode 100644 python3/patches/00125-less-verbose-COUNT_ALLOCS.patch create mode 100644 python3/patches/00131-disable-tests-in-test_io.patch create mode 100644 python3/patches/00132-add-rpmbuild-hooks-to-unittest.patch create mode 100644 python3/patches/00134-fix-COUNT_ALLOCS-failure-in-test_sys.patch create mode 100644 python3/patches/00135-fix-test-within-test_weakref-in-debug-build.patch create mode 100644 python3/patches/00137-skip-distutils-tests-that-fail-in-rpmbuild.patch create mode 100644 python3/patches/00139-skip-test_float-known-failure-on-arm.patch create mode 100644 python3/patches/00141-fix-test_gc_with_COUNT_ALLOCS.patch create mode 100644 python3/patches/00142-skip-failing-pty-tests-in-rpmbuild.patch create mode 100644 python3/patches/00153-fix-test_gdb-noise.patch create mode 100644 python3/patches/00155-avoid-ctypes-thunks.patch create mode 100644 python3/patches/00156-gdb-autoload-safepath.patch create mode 100644 python3/patches/00157-uid-gid-overflows.patch create mode 100644 python3/patches/00160-disable-test_fs_holes-in-rpm-build.patch create mode 100644 python3/patches/00163-disable-parts-of-test_socket-in-rpm-build.patch create mode 100644 python3/patches/00164-disable-interrupted_write-tests-on-ppc.patch create mode 100644 python3/patches/05000-autotool-intermediates.patch create mode 100644 python3/patches/Python-3.1.1-rpath.patch create mode 100644 python3/patches/python-3.2.1-fix-test-subprocess-with-nonreadable-path-dir.patch create mode 100644 python3/python-3.3.0b1-lib64.patch create mode 100644 python3/python3.nm diff --git a/python3/patches/00003-remove-mimeaudio-tests.patch b/python3/patches/00003-remove-mimeaudio-tests.patch new file mode 100644 index 000000000..8341363a4 --- /dev/null +++ b/python3/patches/00003-remove-mimeaudio-tests.patch @@ -0,0 +1,51 @@ +diff -up Python-3.3.0rc1/Lib/test/test_email/test_email.py.remove-mimeaudio-tests Python-3.3.0rc1/Lib/test/test_email/test_email.py +--- Python-3.3.0rc1/Lib/test/test_email/test_email.py.remove-mimeaudio-tests 2012-08-25 15:22:10.000000000 -0400 ++++ Python-3.3.0rc1/Lib/test/test_email/test_email.py 2012-08-27 11:00:11.936964586 -0400 +@@ -1321,47 +1321,6 @@ Blah blah blah + self.assertEqual(b.getvalue(), source + b'>From R\xc3\xb6lli\n') + + +-# Test the basic MIMEAudio class +-class TestMIMEAudio(unittest.TestCase): +- def setUp(self): +- with openfile('audiotest.au', 'rb') as fp: +- self._audiodata = fp.read() +- self._au = MIMEAudio(self._audiodata) +- +- def test_guess_minor_type(self): +- self.assertEqual(self._au.get_content_type(), 'audio/basic') +- +- def test_encoding(self): +- payload = self._au.get_payload() +- self.assertEqual(base64.decodebytes(bytes(payload, 'ascii')), +- self._audiodata) +- +- def test_checkSetMinor(self): +- au = MIMEAudio(self._audiodata, 'fish') +- self.assertEqual(au.get_content_type(), 'audio/fish') +- +- def test_add_header(self): +- eq = self.assertEqual +- unless = self.assertTrue +- self._au.add_header('Content-Disposition', 'attachment', +- filename='audiotest.au') +- eq(self._au['content-disposition'], +- 'attachment; filename="audiotest.au"') +- eq(self._au.get_params(header='content-disposition'), +- [('attachment', ''), ('filename', 'audiotest.au')]) +- eq(self._au.get_param('filename', header='content-disposition'), +- 'audiotest.au') +- missing = [] +- eq(self._au.get_param('attachment', header='content-disposition'), '') +- unless(self._au.get_param('foo', failobj=missing, +- header='content-disposition') is missing) +- # Try some missing stuff +- unless(self._au.get_param('foobar', missing) is missing) +- unless(self._au.get_param('attachment', missing, +- header='foobar') is missing) +- +- +- + # Test the basic MIMEImage class + class TestMIMEImage(unittest.TestCase): + def setUp(self): diff --git a/python3/patches/00104-lib64-fix-for-test_install.patch b/python3/patches/00104-lib64-fix-for-test_install.patch new file mode 100644 index 000000000..7852bf694 --- /dev/null +++ b/python3/patches/00104-lib64-fix-for-test_install.patch @@ -0,0 +1,13 @@ +--- Python-2.7.2/Lib/distutils/tests/test_install.py.lib64 2011-09-08 17:51:57.851405376 -0400 ++++ Python-2.7.2/Lib/distutils/tests/test_install.py 2011-09-08 18:40:46.754205096 -0400 +@@ -41,8 +41,9 @@ class InstallTestCase(support.TempdirMan + self.assertEqual(got, expected) + + libdir = os.path.join(destination, "lib", "python") ++ platlibdir = os.path.join(destination, "lib64", "python") + check_path(cmd.install_lib, libdir) +- check_path(cmd.install_platlib, libdir) ++ check_path(cmd.install_platlib, platlibdir) + check_path(cmd.install_purelib, libdir) + check_path(cmd.install_headers, + os.path.join(destination, "include", "python", "foopkg")) diff --git a/python3/patches/00111-no-static-lib.patch b/python3/patches/00111-no-static-lib.patch new file mode 100644 index 000000000..91b24b827 --- /dev/null +++ b/python3/patches/00111-no-static-lib.patch @@ -0,0 +1,59 @@ +diff -up cpython-59223da36dec/Makefile.pre.in.no-static-lib cpython-59223da36dec/Makefile.pre.in +--- cpython-59223da36dec/Makefile.pre.in.no-static-lib 2012-08-07 16:43:43.296466422 -0400 ++++ cpython-59223da36dec/Makefile.pre.in 2012-08-07 16:44:13.299464371 -0400 +@@ -464,7 +464,7 @@ coverage: + + + # Build the interpreter +-$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) ++$(BUILDPYTHON): Modules/python.o $(LDLIBRARY) $(PY3LIBRARY) + $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) + + platform: $(BUILDPYTHON) $(SYSCONFIGDATA) +@@ -480,18 +480,6 @@ sharedmods: $(BUILDPYTHON) $(SYSCONFIGDA + $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build + +-# Build static library +-# avoid long command lines, same as LIBRARY_OBJS +-$(LIBRARY): $(LIBRARY_OBJS) +- -rm -f $@ +- $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o +- $(AR) $(ARFLAGS) $@ $(PARSER_OBJS) +- $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS) +- $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS) Python/frozen.o +- $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS) +- $(AR) $(ARFLAGS) $@ $(MODOBJS) +- $(RANLIB) $@ +- + libpython$(LDVERSION).so: $(LIBRARY_OBJS) + if test $(INSTSONAME) != $(LDLIBRARY); then \ + $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ +@@ -581,7 +569,7 @@ Modules/Setup: $(srcdir)/Modules/Setup.d + echo "-----------------------------------------------"; \ + fi + +-Modules/_testembed: Modules/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) ++Modules/_testembed: Modules/_testembed.o $(LDLIBRARY) $(PY3LIBRARY) + $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) + + ############################################################################ +@@ -1155,18 +1143,6 @@ libainstall: all python-config + else true; \ + fi; \ + done +- @if test -d $(LIBRARY); then :; else \ +- if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ +- if test "$(SO)" = .dll; then \ +- $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ +- else \ +- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ +- $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ +- fi; \ +- else \ +- echo Skip install of $(LIBRARY) - use make frameworkinstall; \ +- fi; \ +- fi + $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c + $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o + $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in diff --git a/python3/patches/00113-more-configuration-flags.patch b/python3/patches/00113-more-configuration-flags.patch new file mode 100644 index 000000000..1067af163 --- /dev/null +++ b/python3/patches/00113-more-configuration-flags.patch @@ -0,0 +1,50 @@ +diff -up Python-3.3.0b1/configure.ac.more-configuration-flags Python-3.3.0b1/configure.ac +--- Python-3.3.0b1/configure.ac.more-configuration-flags 2012-07-20 13:25:33.232864839 -0400 ++++ Python-3.3.0b1/configure.ac 2012-07-20 13:25:33.314863815 -0400 +@@ -2585,6 +2585,30 @@ else AC_MSG_RESULT(no) + fi], + [AC_MSG_RESULT(no)]) + ++AC_MSG_CHECKING(for --with-count-allocs) ++AC_ARG_WITH(count-allocs, ++[ --with(out)count-allocs enable/disable per-type instance accounting], [ ++if test "$withval" != no ++then ++ AC_DEFINE(COUNT_ALLOCS, 1, ++ [Define to keep records of the number of instances of each type]) ++ AC_MSG_RESULT(yes) ++else AC_MSG_RESULT(no) ++fi], ++[AC_MSG_RESULT(no)]) ++ ++AC_MSG_CHECKING(for --with-call-profile) ++AC_ARG_WITH(call-profile, ++[ --with(out)-call-profile enable/disable statistics on function call invocation], [ ++if test "$withval" != no ++then ++ AC_DEFINE(CALL_PROFILE, 1, ++ [Define to keep records on function call invocation]) ++ AC_MSG_RESULT(yes) ++else AC_MSG_RESULT(no) ++fi], ++[AC_MSG_RESULT(no)]) ++ + # Check for Python-specific malloc support + AC_MSG_CHECKING(for --with-pymalloc) + AC_ARG_WITH(pymalloc, +diff -up Python-3.3.0b1/pyconfig.h.in.more-configuration-flags Python-3.3.0b1/pyconfig.h.in +--- Python-3.3.0b1/pyconfig.h.in.more-configuration-flags 2012-07-20 13:25:33.000000000 -0400 ++++ Python-3.3.0b1/pyconfig.h.in 2012-07-20 13:26:02.826494869 -0400 +@@ -12,6 +12,12 @@ + support for AIX C++ shared extension modules. */ + #undef AIX_GENUINE_CPLUSPLUS + ++/* Define to keep records on function call invocation */ ++#undef CALL_PROFILE ++ ++/* Define to keep records of the number of instances of each type */ ++#undef COUNT_ALLOCS ++ + /* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM + mixed-endian order (byte order 45670123) */ + #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 diff --git a/python3/patches/00114-statvfs-f_flag-constants.patch b/python3/patches/00114-statvfs-f_flag-constants.patch new file mode 100644 index 000000000..af0d78073 --- /dev/null +++ b/python3/patches/00114-statvfs-f_flag-constants.patch @@ -0,0 +1,39 @@ +diff -up Python-3.3.0b1/Modules/posixmodule.c.statvfs-f_flag-constants Python-3.3.0b1/Modules/posixmodule.c +--- Python-3.3.0b1/Modules/posixmodule.c.statvfs-f_flag-constants 2012-06-26 16:19:54.000000000 -0400 ++++ Python-3.3.0b1/Modules/posixmodule.c 2012-07-20 13:39:18.595546387 -0400 +@@ -11665,6 +11665,35 @@ all_ins(PyObject *d) + if (ins(d, "ST_NOSUID", (long)ST_NOSUID)) return -1; + #endif /* ST_NOSUID */ + ++ /* GNU extensions */ ++#ifdef ST_NODEV ++ if (ins(d, "ST_NODEV", (long)ST_NODEV)) return -1; ++#endif /* ST_NODEV */ ++#ifdef ST_NOEXEC ++ if (ins(d, "ST_NOEXEC", (long)ST_NOEXEC)) return -1; ++#endif /* ST_NOEXEC */ ++#ifdef ST_SYNCHRONOUS ++ if (ins(d, "ST_SYNCHRONOUS", (long)ST_SYNCHRONOUS)) return -1; ++#endif /* ST_SYNCHRONOUS */ ++#ifdef ST_MANDLOCK ++ if (ins(d, "ST_MANDLOCK", (long)ST_MANDLOCK)) return -1; ++#endif /* ST_MANDLOCK */ ++#ifdef ST_WRITE ++ if (ins(d, "ST_WRITE", (long)ST_WRITE)) return -1; ++#endif /* ST_WRITE */ ++#ifdef ST_APPEND ++ if (ins(d, "ST_APPEND", (long)ST_APPEND)) return -1; ++#endif /* ST_APPEND */ ++#ifdef ST_NOATIME ++ if (ins(d, "ST_NOATIME", (long)ST_NOATIME)) return -1; ++#endif /* ST_NOATIME */ ++#ifdef ST_NODIRATIME ++ if (ins(d, "ST_NODIRATIME", (long)ST_NODIRATIME)) return -1; ++#endif /* ST_NODIRATIME */ ++#ifdef ST_RELATIME ++ if (ins(d, "ST_RELATIME", (long)ST_RELATIME)) return -1; ++#endif /* ST_RELATIME */ ++ + /* FreeBSD sendfile() constants */ + #ifdef SF_NODISKIO + if (ins(d, "SF_NODISKIO", (long)SF_NODISKIO)) return -1; diff --git a/python3/patches/00125-less-verbose-COUNT_ALLOCS.patch b/python3/patches/00125-less-verbose-COUNT_ALLOCS.patch new file mode 100644 index 000000000..8cef01553 --- /dev/null +++ b/python3/patches/00125-less-verbose-COUNT_ALLOCS.patch @@ -0,0 +1,20 @@ +diff -up Python-2.7/Python/pythonrun.c.less-verbose-COUNT_ALLOCS Python-2.7/Python/pythonrun.c +--- Python-2.7/Python/pythonrun.c.less-verbose-COUNT_ALLOCS 2010-08-17 14:49:33.321913909 -0400 ++++ Python-2.7/Python/pythonrun.c 2010-08-17 14:54:48.750910403 -0400 +@@ -470,7 +470,15 @@ Py_Finalize(void) + + /* Debugging stuff */ + #ifdef COUNT_ALLOCS +- dump_counts(stdout); ++ /* This is a downstream Fedora modification. ++ The upstream default with COUNT_ALLOCS is to always dump the counts to ++ stdout on exit. For our debug builds its useful to have the info from ++ COUNT_ALLOCS available, but the stdout info here gets in the way, so ++ we make it optional, wrapping it in an environment variable (modelled ++ on the other PYTHONDUMP* env variables): ++ */ ++ if (Py_GETENV("PYTHONDUMPCOUNTS")) ++ dump_counts(stdout); + #endif + + PRINT_TOTAL_REFS(); diff --git a/python3/patches/00131-disable-tests-in-test_io.patch b/python3/patches/00131-disable-tests-in-test_io.patch new file mode 100644 index 000000000..d81a2d0cd --- /dev/null +++ b/python3/patches/00131-disable-tests-in-test_io.patch @@ -0,0 +1,11 @@ +diff -up Python-2.7.2/Lib/test/test_io.py.disable-tests-in-test_io Python-2.7.2/Lib/test/test_io.py +--- Python-2.7.2/Lib/test/test_io.py.disable-tests-in-test_io 2011-09-01 14:18:45.963304089 -0400 ++++ Python-2.7.2/Lib/test/test_io.py 2011-09-01 15:08:53.796098413 -0400 +@@ -2669,6 +2669,7 @@ class SignalsTest(unittest.TestCase): + self.check_interrupted_read_retry(lambda x: x, + mode="r") + ++ @unittest.skip('rhbz#732998') + @unittest.skipUnless(threading, 'Threading required for this test.') + def check_interrupted_write_retry(self, item, **fdopen_kwargs): + """Check that a buffered write, when it gets interrupted (either diff --git a/python3/patches/00132-add-rpmbuild-hooks-to-unittest.patch b/python3/patches/00132-add-rpmbuild-hooks-to-unittest.patch new file mode 100644 index 000000000..fdfbab8cd --- /dev/null +++ b/python3/patches/00132-add-rpmbuild-hooks-to-unittest.patch @@ -0,0 +1,68 @@ +diff -up Python-3.2.2/Lib/unittest/case.py.add-rpmbuild-hooks-to-unittest Python-3.2.2/Lib/unittest/case.py +--- Python-3.2.2/Lib/unittest/case.py.add-rpmbuild-hooks-to-unittest 2011-09-03 12:16:44.000000000 -0400 ++++ Python-3.2.2/Lib/unittest/case.py 2011-09-09 06:35:16.365568382 -0400 +@@ -3,6 +3,7 @@ + import sys + import functools + import difflib ++import os + import pprint + import re + import warnings +@@ -101,6 +102,43 @@ def expectedFailure(func): + return wrapper + + ++# Non-standard/downstream-only hooks for handling issues with specific test ++# cases: ++ ++def _skipInRpmBuild(reason): ++ """ ++ Non-standard/downstream-only decorator for marking a specific unit test ++ to be skipped when run within the %check of an rpmbuild. ++ ++ Specifically, this takes effect when WITHIN_PYTHON_RPM_BUILD is set within ++ the environment, and has no effect otherwise. ++ """ ++ if 'WITHIN_PYTHON_RPM_BUILD' in os.environ: ++ return skip(reason) ++ else: ++ return _id ++ ++def _expectedFailureInRpmBuild(func): ++ """ ++ Non-standard/downstream-only decorator for marking a specific unit test ++ as expected to fail within the %check of an rpmbuild. ++ ++ Specifically, this takes effect when WITHIN_PYTHON_RPM_BUILD is set within ++ the environment, and has no effect otherwise. ++ """ ++ @functools.wraps(func) ++ def wrapper(*args, **kwargs): ++ if 'WITHIN_PYTHON_RPM_BUILD' in os.environ: ++ try: ++ func(*args, **kwargs) ++ except Exception: ++ raise _ExpectedFailure(sys.exc_info()) ++ raise _UnexpectedSuccess ++ else: ++ # Call directly: ++ func(*args, **kwargs) ++ return wrapper ++ + class _AssertRaisesBaseContext(object): + + def __init__(self, expected, test_case, callable_obj=None, +diff -up Python-3.2.2/Lib/unittest/__init__.py.add-rpmbuild-hooks-to-unittest Python-3.2.2/Lib/unittest/__init__.py +--- Python-3.2.2/Lib/unittest/__init__.py.add-rpmbuild-hooks-to-unittest 2011-09-03 12:16:44.000000000 -0400 ++++ Python-3.2.2/Lib/unittest/__init__.py 2011-09-09 06:35:16.366568382 -0400 +@@ -57,7 +57,8 @@ __unittest = True + + from .result import TestResult + from .case import (TestCase, FunctionTestCase, SkipTest, skip, skipIf, +- skipUnless, expectedFailure) ++ skipUnless, expectedFailure, ++ _skipInRpmBuild, _expectedFailureInRpmBuild) + from .suite import BaseTestSuite, TestSuite + from .loader import (TestLoader, defaultTestLoader, makeSuite, getTestCaseNames, + findTestCases) diff --git a/python3/patches/00134-fix-COUNT_ALLOCS-failure-in-test_sys.patch b/python3/patches/00134-fix-COUNT_ALLOCS-failure-in-test_sys.patch new file mode 100644 index 000000000..087705cee --- /dev/null +++ b/python3/patches/00134-fix-COUNT_ALLOCS-failure-in-test_sys.patch @@ -0,0 +1,21 @@ +diff -up Python-3.3.0b2/Lib/test/test_sys.py.fix-COUNT_ALLOCS-failure-in-test_sys Python-3.3.0b2/Lib/test/test_sys.py +--- Python-3.3.0b2/Lib/test/test_sys.py.fix-COUNT_ALLOCS-failure-in-test_sys 2012-08-11 02:54:16.000000000 -0400 ++++ Python-3.3.0b2/Lib/test/test_sys.py 2012-08-13 14:50:15.253720597 -0400 +@@ -835,12 +835,17 @@ class SizeofTest(unittest.TestCase): + # type + # static type: PyTypeObject + s = vsize('P2n15Pl4Pn9Pn11PI') ++ # COUNT_ALLOCS adds a further 3 Py_ssize_t and 2 pointers: ++ if hasattr(sys, 'getcounts'): ++ s += struct.calcsize('3P2P') + check(int, s) + # (PyTypeObject + PyNumberMethods + PyMappingMethods + + # PySequenceMethods + PyBufferProcs + 4P) + s = vsize('P2n15Pl4Pn9Pn11PI') + struct.calcsize('34P 3P 10P 2P 4P') + # Separate block for PyDictKeysObject with 4 entries + s += struct.calcsize("2nPn") + 4*struct.calcsize("n2P") ++ if hasattr(sys, 'getcounts'): ++ s += struct.calcsize('3P2P') + # class + class newstyleclass(object): pass + check(newstyleclass, s) diff --git a/python3/patches/00135-fix-test-within-test_weakref-in-debug-build.patch b/python3/patches/00135-fix-test-within-test_weakref-in-debug-build.patch new file mode 100644 index 000000000..6ed780187 --- /dev/null +++ b/python3/patches/00135-fix-test-within-test_weakref-in-debug-build.patch @@ -0,0 +1,17 @@ +diff -up Python-3.2b2/Lib/test/test_weakref.py.test-weakref-COUNT_ALLOCS_fix Python-3.2b2/Lib/test/test_weakref.py +--- Python-3.2b2/Lib/test/test_weakref.py.test-weakref-COUNT_ALLOCS_fix 2010-12-28 20:33:46.963364990 -0500 ++++ Python-3.2b2/Lib/test/test_weakref.py 2010-12-28 20:35:44.115935248 -0500 +@@ -583,9 +583,10 @@ class ReferencesTestCase(TestBase): + # been cleared without their callbacks executing. OTOH, the weakref + # to C is bound to a function local (wr), and wasn't trash, so that + # callback should have been invoked when C went away. +- self.assertEqual(alist, ["C went away"]) +- # The remaining weakref should be dead now (its callback ran). +- self.assertEqual(wr(), None) ++ if not hasattr(sys, 'getcounts'): ++ self.assertEqual(alist, ["C went away"]) ++ # The remaining weakref should be dead now (its callback ran). ++ self.assertEqual(wr(), None) + + del alist[:] + gc.collect() diff --git a/python3/patches/00137-skip-distutils-tests-that-fail-in-rpmbuild.patch b/python3/patches/00137-skip-distutils-tests-that-fail-in-rpmbuild.patch new file mode 100644 index 000000000..8a6bc4610 --- /dev/null +++ b/python3/patches/00137-skip-distutils-tests-that-fail-in-rpmbuild.patch @@ -0,0 +1,12 @@ +diff -up Python-3.2.2/Lib/distutils/tests/test_bdist_rpm.py.skip-distutils-tests-that-fail-in-rpmbuild Python-3.2.2/Lib/distutils/tests/test_bdist_rpm.py +--- Python-3.2.2/Lib/distutils/tests/test_bdist_rpm.py.skip-distutils-tests-that-fail-in-rpmbuild 2011-09-03 12:16:40.000000000 -0400 ++++ Python-3.2.2/Lib/distutils/tests/test_bdist_rpm.py 2011-09-10 05:04:56.328852558 -0400 +@@ -23,6 +23,7 @@ setup(name='foo', version='0.1', py_modu + + """ + ++@unittest._skipInRpmBuild("don't try to nest one rpm build inside another rpm build") + class BuildRpmTestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): +diff -up Python-3.2.2/Lib/distutils/tests/test_build_ext.py.skip-distutils-tests-that-fail-in-rpmbuild Python-3.2.2/Lib/distutils/tests/test_build_ext.py diff --git a/python3/patches/00139-skip-test_float-known-failure-on-arm.patch b/python3/patches/00139-skip-test_float-known-failure-on-arm.patch new file mode 100644 index 000000000..9d0bfad79 --- /dev/null +++ b/python3/patches/00139-skip-test_float-known-failure-on-arm.patch @@ -0,0 +1,11 @@ +diff -up Python-2.7.2/Lib/test/test_float.py.skip-test_float-known-failure-on-arm Python-2.7.2/Lib/test/test_float.py +--- Python-2.7.2/Lib/test/test_float.py.skip-test_float-known-failure-on-arm 2011-09-08 19:34:09.000986128 -0400 ++++ Python-2.7.2/Lib/test/test_float.py 2011-09-08 19:34:57.969982779 -0400 +@@ -1072,6 +1072,7 @@ class HexFloatTestCase(unittest.TestCase + self.identical(got, expected) + + ++ @unittest.skip('Known failure on ARM: http://bugs.python.org/issue8265') + def test_from_hex(self): + MIN = self.MIN; + MAX = self.MAX; diff --git a/python3/patches/00141-fix-test_gc_with_COUNT_ALLOCS.patch b/python3/patches/00141-fix-test_gc_with_COUNT_ALLOCS.patch new file mode 100644 index 000000000..337e39eb7 --- /dev/null +++ b/python3/patches/00141-fix-test_gc_with_COUNT_ALLOCS.patch @@ -0,0 +1,22 @@ +diff -up Python-3.2b2/Lib/test/test_gc.py.fix-test-gc-COUNT_ALLOCS Python-3.2b2/Lib/test/test_gc.py +--- Python-3.2b2/Lib/test/test_gc.py.fix-test-gc-COUNT_ALLOCS 2010-12-28 20:39:40.779059772 -0500 ++++ Python-3.2b2/Lib/test/test_gc.py 2010-12-28 20:41:15.890940017 -0500 +@@ -102,10 +102,16 @@ class GCTests(unittest.TestCase): + del a + self.assertNotEqual(gc.collect(), 0) + del B, C +- self.assertNotEqual(gc.collect(), 0) ++ if hasattr(sys, 'getcounts'): ++ self.assertEqual(gc.collect(), 0) ++ else: ++ self.assertNotEqual(gc.collect(), 0) + A.a = A() + del A +- self.assertNotEqual(gc.collect(), 0) ++ if hasattr(sys, 'getcounts'): ++ self.assertEqual(gc.collect(), 0) ++ else: ++ self.assertNotEqual(gc.collect(), 0) + self.assertEqual(gc.collect(), 0) + + def test_method(self): diff --git a/python3/patches/00142-skip-failing-pty-tests-in-rpmbuild.patch b/python3/patches/00142-skip-failing-pty-tests-in-rpmbuild.patch new file mode 100644 index 000000000..414ffcd9a --- /dev/null +++ b/python3/patches/00142-skip-failing-pty-tests-in-rpmbuild.patch @@ -0,0 +1,22 @@ +diff -up Python-2.7.2/Lib/test/test_openpty.py.skip-failing-pty-tests-in-rpmbuild Python-2.7.2/Lib/test/test_openpty.py +--- Python-2.7.2/Lib/test/test_openpty.py.skip-failing-pty-tests-in-rpmbuild 2011-09-09 05:09:28.698920379 -0400 ++++ Python-2.7.2/Lib/test/test_openpty.py 2011-09-09 05:10:54.805914490 -0400 +@@ -8,6 +8,7 @@ if not hasattr(os, "openpty"): + + + class OpenptyTest(unittest.TestCase): ++ @unittest._skipInRpmBuild('sometimes fails in Koji, possibly due to a mock issue (rhbz#714627)') + def test(self): + master, slave = os.openpty() + if not os.isatty(slave): +diff -up Python-2.7.2/Lib/test/test_pty.py.skip-failing-pty-tests-in-rpmbuild Python-2.7.2/Lib/test/test_pty.py +--- Python-2.7.2/Lib/test/test_pty.py.skip-failing-pty-tests-in-rpmbuild 2011-09-09 05:09:36.781919825 -0400 ++++ Python-2.7.2/Lib/test/test_pty.py 2011-09-09 05:11:14.741913127 -0400 +@@ -109,6 +109,7 @@ class PtyTest(unittest.TestCase): + os.close(master_fd) + + ++ @unittest._skipInRpmBuild('sometimes fails in Koji, possibly due to a mock issue (rhbz#714627)') + def test_fork(self): + debug("calling pty.fork()") + pid, master_fd = pty.fork() diff --git a/python3/patches/00153-fix-test_gdb-noise.patch b/python3/patches/00153-fix-test_gdb-noise.patch new file mode 100644 index 000000000..cc9ed8cd0 --- /dev/null +++ b/python3/patches/00153-fix-test_gdb-noise.patch @@ -0,0 +1,37 @@ +diff -up cpython-59223da36dec/Lib/test/test_gdb.py.fix-test_gdb-noise cpython-59223da36dec/Lib/test/test_gdb.py +--- cpython-59223da36dec/Lib/test/test_gdb.py.fix-test_gdb-noise 2012-08-07 06:10:57.000000000 -0400 ++++ cpython-59223da36dec/Lib/test/test_gdb.py 2012-08-07 17:13:46.592343113 -0400 +@@ -115,6 +115,15 @@ class DebuggerTests(unittest.TestCase): + # Generate a list of commands in gdb's language: + commands = ['set breakpoint pending yes', + 'break %s' % breakpoint, ++ ++ # GDB as of Fedora 17 onwards can distinguish between the ++ # value of a variable at entry vs current value: ++ # http://sourceware.org/gdb/onlinedocs/gdb/Variables.html ++ # which leads to the selftests failing with errors like this: ++ # AssertionError: 'v@entry=()' != '()' ++ # Disable this: ++ 'set print entry-values no', ++ + 'run'] + if cmds_after_breakpoint: + commands += cmds_after_breakpoint +@@ -154,8 +163,16 @@ class DebuggerTests(unittest.TestCase): + err = err.replace("warning: Cannot initialize thread debugging" + " library: Debugger service failed\n", + '') +- ++ err = '\n'.join([line ++ for line in err.splitlines() ++ if not line.startswith('warning: Unable to open') ++ if not line.startswith('Missing separate debuginfo for') ++ if not line.startswith('Try: yum --disablerepo=') ++ # In case 'set print entry-values no' failed: ++ if not line.startswith('Undefined set print command')]) ++ + # Ensure no unexpected error messages: ++ self.maxDiff = None + self.assertEqual(err, '') + return out + diff --git a/python3/patches/00155-avoid-ctypes-thunks.patch b/python3/patches/00155-avoid-ctypes-thunks.patch new file mode 100644 index 000000000..f03890ee5 --- /dev/null +++ b/python3/patches/00155-avoid-ctypes-thunks.patch @@ -0,0 +1,15 @@ +diff -up Python-3.2.3/Lib/ctypes/__init__.py.rhbz814391 Python-3.2.3/Lib/ctypes/__init__.py +--- Python-3.2.3/Lib/ctypes/__init__.py.rhbz814391 2012-04-20 15:12:49.017867692 -0400 ++++ Python-3.2.3/Lib/ctypes/__init__.py 2012-04-20 15:15:09.501111408 -0400 +@@ -275,11 +275,6 @@ def _reset_cache(): + # _SimpleCData.c_char_p_from_param + POINTER(c_char).from_param = c_char_p.from_param + _pointer_type_cache[None] = c_void_p +- # XXX for whatever reasons, creating the first instance of a callback +- # function is needed for the unittests on Win64 to succeed. This MAY +- # be a compiler bug, since the problem occurs only when _ctypes is +- # compiled with the MS SDK compiler. Or an uninitialized variable? +- CFUNCTYPE(c_int)(lambda: None) + + def create_unicode_buffer(init, size=None): + """create_unicode_buffer(aString) -> character array diff --git a/python3/patches/00156-gdb-autoload-safepath.patch b/python3/patches/00156-gdb-autoload-safepath.patch new file mode 100644 index 000000000..ac2aa40f4 --- /dev/null +++ b/python3/patches/00156-gdb-autoload-safepath.patch @@ -0,0 +1,52 @@ +diff -up Python-3.2.3/Lib/test/test_gdb.py.gdb-autoload-safepath Python-3.2.3/Lib/test/test_gdb.py +--- Python-3.2.3/Lib/test/test_gdb.py.gdb-autoload-safepath 2012-04-30 17:16:24.092706954 -0400 ++++ Python-3.2.3/Lib/test/test_gdb.py 2012-04-30 17:17:13.275703592 -0400 +@@ -46,6 +46,19 @@ def gdb_has_frame_select(): + + HAS_PYUP_PYDOWN = gdb_has_frame_select() + ++def gdb_has_autoload_safepath(): ++ # Recent GDBs will only auto-load scripts from certain safe ++ # locations, so we will need to turn off this protection. ++ # However, if the GDB doesn't have it, then the following ++ # command will generate noise on stderr (rhbz#817072): ++ cmd = "--eval-command=set auto-load safe-path /" ++ p = subprocess.Popen(["gdb", "--batch", cmd], ++ stderr=subprocess.PIPE) ++ _, stderr = p.communicate() ++ return b'"on" or "off" expected.' not in stderr ++ ++HAS_AUTOLOAD_SAFEPATH = gdb_has_autoload_safepath() ++ + BREAKPOINT_FN='builtin_id' + + class DebuggerTests(unittest.TestCase): +@@ -106,15 +119,28 @@ class DebuggerTests(unittest.TestCase): + 'set print entry-values no', + + 'run'] ++ ++ if HAS_AUTOLOAD_SAFEPATH: ++ # Recent GDBs will only auto-load scripts from certain safe ++ # locations. ++ # Where necessary, turn off this protection to ensure that ++ # our -gdb.py script can be loaded - but not on earlier gdb builds ++ # as this would generate noise on stderr (rhbz#817072): ++ init_commands = ['set auto-load safe-path /'] ++ else: ++ init_commands = [] ++ + if cmds_after_breakpoint: + commands += cmds_after_breakpoint + else: + commands += ['backtrace'] + ++ # print init_commands + # print commands + + # Use "commands" to generate the arguments with which to invoke "gdb": + args = ["gdb", "--batch"] ++ args += ['--init-eval-command=%s' % cmd for cmd in init_commands] + args += ['--eval-command=%s' % cmd for cmd in commands] + args += ["--args", + sys.executable] diff --git a/python3/patches/00157-uid-gid-overflows.patch b/python3/patches/00157-uid-gid-overflows.patch new file mode 100644 index 000000000..ab4cb0ca7 --- /dev/null +++ b/python3/patches/00157-uid-gid-overflows.patch @@ -0,0 +1,696 @@ +diff -up Python-3.3.0b1/Include/modsupport.h.uid-gid-overflows Python-3.3.0b1/Include/modsupport.h +--- Python-3.3.0b1/Include/modsupport.h.uid-gid-overflows 2012-06-26 16:19:40.000000000 -0400 ++++ Python-3.3.0b1/Include/modsupport.h 2012-07-20 14:21:46.854688763 -0400 +@@ -8,6 +8,7 @@ extern "C" { + /* Module support interface */ + + #include ++#include + + /* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier + to mean Py_ssize_t */ +@@ -125,6 +126,17 @@ PyAPI_FUNC(PyObject *) PyModule_Create2( + PyAPI_DATA(char *) _Py_PackageContext; + #endif + ++/* ++ Non-standard extension: support for dealing with uid_t and gid_t without ++ integer overflow ++ */ ++ ++PyAPI_FUNC(PyObject *) _PyObject_FromUid(uid_t uid); ++PyAPI_FUNC(PyObject *) _PyObject_FromGid(gid_t gid); ++ ++PyAPI_FUNC(int) _PyArg_ParseUid(PyObject *in_obj, uid_t *out_uid); ++PyAPI_FUNC(int) _PyArg_ParseGid(PyObject *in_obj, gid_t *out_gid); ++ + #ifdef __cplusplus + } + #endif +diff -up Python-3.3.0b1/Lib/test/test_os.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_os.py +--- Python-3.3.0b1/Lib/test/test_os.py.uid-gid-overflows 2012-06-26 16:19:48.000000000 -0400 ++++ Python-3.3.0b1/Lib/test/test_os.py 2012-07-20 14:21:46.856688739 -0400 +@@ -1174,30 +1174,36 @@ if sys.platform != 'win32': + def test_setuid(self): + if os.getuid() != 0: + self.assertRaises(os.error, os.setuid, 0) ++ self.assertRaises(TypeError, os.setuid, 'not an int') + self.assertRaises(OverflowError, os.setuid, 1<<32) + + if hasattr(os, 'setgid'): + def test_setgid(self): + if os.getuid() != 0: + self.assertRaises(os.error, os.setgid, 0) ++ self.assertRaises(TypeError, os.setgid, 'not an int') + self.assertRaises(OverflowError, os.setgid, 1<<32) + + if hasattr(os, 'seteuid'): + def test_seteuid(self): + if os.getuid() != 0: + self.assertRaises(os.error, os.seteuid, 0) ++ self.assertRaises(TypeError, os.seteuid, 'not an int') + self.assertRaises(OverflowError, os.seteuid, 1<<32) + + if hasattr(os, 'setegid'): + def test_setegid(self): + if os.getuid() != 0: + self.assertRaises(os.error, os.setegid, 0) ++ self.assertRaises(TypeError, os.setegid, 'not an int') + self.assertRaises(OverflowError, os.setegid, 1<<32) + + if hasattr(os, 'setreuid'): + def test_setreuid(self): + if os.getuid() != 0: + self.assertRaises(os.error, os.setreuid, 0, 0) ++ self.assertRaises(TypeError, os.setreuid, 'not an int', 0) ++ self.assertRaises(TypeError, os.setreuid, 0, 'not an int') + self.assertRaises(OverflowError, os.setreuid, 1<<32, 0) + self.assertRaises(OverflowError, os.setreuid, 0, 1<<32) + +@@ -1212,6 +1218,8 @@ if sys.platform != 'win32': + def test_setregid(self): + if os.getuid() != 0: + self.assertRaises(os.error, os.setregid, 0, 0) ++ self.assertRaises(TypeError, os.setregid, 'not an int', 0) ++ self.assertRaises(TypeError, os.setregid, 0, 'not an int') + self.assertRaises(OverflowError, os.setregid, 1<<32, 0) + self.assertRaises(OverflowError, os.setregid, 0, 1<<32) + +diff -up Python-3.3.0b1/Lib/test/test_posix.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_posix.py +--- Python-3.3.0b1/Lib/test/test_posix.py.uid-gid-overflows 2012-06-26 16:19:48.000000000 -0400 ++++ Python-3.3.0b1/Lib/test/test_posix.py 2012-07-20 14:21:46.857688726 -0400 +@@ -387,10 +387,17 @@ class PosixTester(unittest.TestCase): + else: + self.assertTrue(stat.S_ISFIFO(posix.stat(support.TESTFN).st_mode)) + +- def _test_all_chown_common(self, chown_func, first_param): ++ def _test_all_chown_common(self, chown_func, stat_func, first_param): + """Common code for chown, fchown and lchown tests.""" + # test a successful chown call + chown_func(first_param, os.getuid(), os.getgid()) ++ self.assertEqual(stat_func(first_param).st_uid, os.getuid()) ++ self.assertEqual(stat_func(first_param).st_gid, os.getgid()) ++ ++ # verify that -1 works as a "do-nothing" option: ++ chown_func(first_param, -1, -1) ++ self.assertEqual(stat_func(first_param).st_uid, os.getuid()) ++ self.assertEqual(stat_func(first_param).st_gid, os.getgid()) + + if os.getuid() == 0: + try: +@@ -421,7 +428,7 @@ class PosixTester(unittest.TestCase): + + # re-create the file + support.create_empty_file(support.TESTFN) +- self._test_all_chown_common(posix.chown, support.TESTFN) ++ self._test_all_chown_common(posix.chown, posix.stat, support.TESTFN) + + @unittest.skipUnless(hasattr(posix, 'fchown'), "test needs os.fchown()") + def test_fchown(self): +@@ -431,7 +438,7 @@ class PosixTester(unittest.TestCase): + test_file = open(support.TESTFN, 'w') + try: + fd = test_file.fileno() +- self._test_all_chown_common(posix.fchown, fd) ++ self._test_all_chown_common(posix.fchown, posix.fstat, fd) + finally: + test_file.close() + +@@ -440,7 +447,7 @@ class PosixTester(unittest.TestCase): + os.unlink(support.TESTFN) + # create a symlink + os.symlink(_DUMMY_SYMLINK, support.TESTFN) +- self._test_all_chown_common(posix.lchown, support.TESTFN) ++ self._test_all_chown_common(posix.lchown, posix.lstat, support.TESTFN) + + def test_chdir(self): + if hasattr(posix, 'chdir'): +diff -up Python-3.3.0b1/Lib/test/test_pwd.py.uid-gid-overflows Python-3.3.0b1/Lib/test/test_pwd.py +--- Python-3.3.0b1/Lib/test/test_pwd.py.uid-gid-overflows 2012-06-26 16:19:48.000000000 -0400 ++++ Python-3.3.0b1/Lib/test/test_pwd.py 2012-07-20 14:21:46.857688726 -0400 +@@ -87,9 +87,9 @@ class PwdTest(unittest.TestCase): + # In some cases, byuids isn't a complete list of all users in the + # system, so if we try to pick a value not in byuids (via a perturbing + # loop, say), pwd.getpwuid() might still be able to find data for that +- # uid. Using sys.maxint may provoke the same problems, but hopefully ++ # uid. Using 2**32 - 2 may provoke the same problems, but hopefully + # it will be a more repeatable failure. +- fakeuid = sys.maxsize ++ fakeuid = 2**32 - 2 + self.assertNotIn(fakeuid, byuids) + self.assertRaises(KeyError, pwd.getpwuid, fakeuid) + +diff -up Python-3.3.0b1/Modules/grpmodule.c.uid-gid-overflows Python-3.3.0b1/Modules/grpmodule.c +--- Python-3.3.0b1/Modules/grpmodule.c.uid-gid-overflows 2012-06-26 16:19:54.000000000 -0400 ++++ Python-3.3.0b1/Modules/grpmodule.c 2012-07-20 14:21:46.858688713 -0400 +@@ -69,7 +69,7 @@ mkgrent(struct group *p) + Py_INCREF(Py_None); + } + #endif +- SET(setIndex++, PyLong_FromLong((long) p->gr_gid)); ++ SET(setIndex++, _PyObject_FromGid(p->gr_gid)); + SET(setIndex++, w); + #undef SET + +@@ -84,18 +84,16 @@ mkgrent(struct group *p) + static PyObject * + grp_getgrgid(PyObject *self, PyObject *pyo_id) + { +- PyObject *py_int_id; +- unsigned int gid; ++ gid_t gid; + struct group *p; + +- py_int_id = PyNumber_Long(pyo_id); +- if (!py_int_id) +- return NULL; +- gid = PyLong_AS_LONG(py_int_id); +- Py_DECREF(py_int_id); ++ if (!_PyArg_ParseGid(pyo_id, &gid)) { ++ return NULL; ++ } + + if ((p = getgrgid(gid)) == NULL) { +- PyErr_Format(PyExc_KeyError, "getgrgid(): gid not found: %d", gid); ++ PyErr_Format(PyExc_KeyError, ++ "getgrgid(): gid not found: %lu", (unsigned long)gid); + return NULL; + } + return mkgrent(p); +diff -up Python-3.3.0b1/Modules/posixmodule.c.uid-gid-overflows Python-3.3.0b1/Modules/posixmodule.c +--- Python-3.3.0b1/Modules/posixmodule.c.uid-gid-overflows 2012-07-20 14:21:46.788689588 -0400 ++++ Python-3.3.0b1/Modules/posixmodule.c 2012-07-20 14:24:19.626778849 -0400 +@@ -2151,8 +2151,8 @@ _pystat_fromstructstat(STRUCT_STAT *st) + PyStructSequence_SET_ITEM(v, 2, PyLong_FromLong((long)st->st_dev)); + #endif + PyStructSequence_SET_ITEM(v, 3, PyLong_FromLong((long)st->st_nlink)); +- PyStructSequence_SET_ITEM(v, 4, PyLong_FromLong((long)st->st_uid)); +- PyStructSequence_SET_ITEM(v, 5, PyLong_FromLong((long)st->st_gid)); ++ PyStructSequence_SET_ITEM(v, 4, _PyObject_FromUid(st->st_uid)); ++ PyStructSequence_SET_ITEM(v, 5, _PyObject_FromGid(st->st_gid)); + #ifdef HAVE_LARGEFILE_SUPPORT + PyStructSequence_SET_ITEM(v, 6, + PyLong_FromLongLong((PY_LONG_LONG)st->st_size)); +@@ -2957,7 +2957,6 @@ static PyObject * + posix_chown(PyObject *self, PyObject *args, PyObject *kwargs) + { + path_t path; +- long uid_l, gid_l; + uid_t uid; + gid_t gid; + int dir_fd = DEFAULT_DIR_FD; +@@ -2971,9 +2970,10 @@ posix_chown(PyObject *self, PyObject *ar + #ifdef HAVE_FCHOWN + path.allow_fd = 1; + #endif +- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&ll|$O&p:chown", keywords, ++ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&O&|$O&p:chown", keywords, + path_converter, &path, +- &uid_l, &gid_l, ++ _PyArg_ParseUid, &uid, ++ _PyArg_ParseGid, &gid, + #ifdef HAVE_FCHOWNAT + dir_fd_converter, &dir_fd, + #else +@@ -3004,8 +3004,6 @@ posix_chown(PyObject *self, PyObject *ar + #endif + + Py_BEGIN_ALLOW_THREADS +- uid = (uid_t)uid_l; +- gid = (uid_t)gid_l; + #ifdef HAVE_FCHOWN + if (path.fd != -1) + result = fchown(path.fd, uid, gid); +@@ -3049,12 +3047,15 @@ static PyObject * + posix_fchown(PyObject *self, PyObject *args) + { + int fd; +- long uid, gid; ++ uid_t uid; ++ gid_t gid; + int res; +- if (!PyArg_ParseTuple(args, "ill:fchown", &fd, &uid, &gid)) ++ if (!PyArg_ParseTuple(args, "iO&O&:chown", &fd, ++ _PyArg_ParseUid, &uid, ++ _PyArg_ParseGid, &gid)) + return NULL; + Py_BEGIN_ALLOW_THREADS +- res = fchown(fd, (uid_t) uid, (gid_t) gid); ++ res = fchown(fd, uid, gid); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error(); +@@ -3074,15 +3075,17 @@ posix_lchown(PyObject *self, PyObject *a + { + PyObject *opath; + char *path; +- long uid, gid; ++ uid_t uid; ++ gid_t gid; + int res; +- if (!PyArg_ParseTuple(args, "O&ll:lchown", ++ if (!PyArg_ParseTuple(args, "O&O&O&:lchown", + PyUnicode_FSConverter, &opath, +- &uid, &gid)) ++ _PyArg_ParseUid, &uid, ++ _PyArg_ParseGid, &gid)) + return NULL; + path = PyBytes_AsString(opath); + Py_BEGIN_ALLOW_THREADS +- res = lchown(path, (uid_t) uid, (gid_t) gid); ++ res = lchown(path, uid, gid); + Py_END_ALLOW_THREADS + if (res < 0) + return posix_error_with_allocated_filename(opath); +@@ -6184,7 +6187,7 @@ Return the current process's effective g + static PyObject * + posix_getegid(PyObject *self, PyObject *noargs) + { +- return PyLong_FromLong((long)getegid()); ++ return _PyObject_FromGid(getegid()); + } + #endif + +@@ -6197,7 +6200,7 @@ Return the current process's effective u + static PyObject * + posix_geteuid(PyObject *self, PyObject *noargs) + { +- return PyLong_FromLong((long)geteuid()); ++ return _PyObject_FromUid(geteuid()); + } + #endif + +@@ -6210,7 +6213,7 @@ Return the current process's group id.") + static PyObject * + posix_getgid(PyObject *self, PyObject *noargs) + { +- return PyLong_FromLong((long)getgid()); ++ return _PyObject_FromGid(getgid()); + } + #endif + +@@ -6349,7 +6352,7 @@ posix_getgroups(PyObject *self, PyObject + if (result != NULL) { + int i; + for (i = 0; i < n; ++i) { +- PyObject *o = PyLong_FromLong((long)alt_grouplist[i]); ++ PyObject *o = _PyObject_FromGid(alt_grouplist[i]); + if (o == NULL) { + Py_DECREF(result); + result = NULL; +@@ -6380,14 +6383,15 @@ posix_initgroups(PyObject *self, PyObjec + PyObject *oname; + char *username; + int res; +- long gid; ++ gid_t gid; + +- if (!PyArg_ParseTuple(args, "O&l:initgroups", +- PyUnicode_FSConverter, &oname, &gid)) ++ if (!PyArg_ParseTuple(args, "O&O&:initgroups", ++ PyUnicode_FSConverter, &oname, ++ _PyArg_ParseGid, &gid)) + return NULL; + username = PyBytes_AS_STRING(oname); + +- res = initgroups(username, (gid_t) gid); ++ res = initgroups(username, gid); + Py_DECREF(oname); + if (res == -1) + return PyErr_SetFromErrno(PyExc_OSError); +@@ -6562,7 +6566,7 @@ Return the current process's user id."); + static PyObject * + posix_getuid(PyObject *self, PyObject *noargs) + { +- return PyLong_FromLong((long)getuid()); ++ return _PyObject_FromUid(getuid()); + } + #endif + +@@ -6702,15 +6706,9 @@ Set the current process's user id."); + static PyObject * + posix_setuid(PyObject *self, PyObject *args) + { +- long uid_arg; + uid_t uid; +- if (!PyArg_ParseTuple(args, "l:setuid", &uid_arg)) +- return NULL; +- uid = uid_arg; +- if (uid != uid_arg) { +- PyErr_SetString(PyExc_OverflowError, "user id too big"); ++ if (!PyArg_ParseTuple(args, "O&:setuid", _PyArg_ParseUid, &uid)) + return NULL; +- } + if (setuid(uid) < 0) + return posix_error(); + Py_INCREF(Py_None); +@@ -6727,15 +6725,9 @@ Set the current process's effective user + static PyObject * + posix_seteuid (PyObject *self, PyObject *args) + { +- long euid_arg; + uid_t euid; +- if (!PyArg_ParseTuple(args, "l", &euid_arg)) ++ if (!PyArg_ParseTuple(args, "O&:seteuid", _PyArg_ParseUid, &euid)) + return NULL; +- euid = euid_arg; +- if (euid != euid_arg) { +- PyErr_SetString(PyExc_OverflowError, "user id too big"); +- return NULL; +- } + if (seteuid(euid) < 0) { + return posix_error(); + } else { +@@ -6753,15 +6745,9 @@ Set the current process's effective grou + static PyObject * + posix_setegid (PyObject *self, PyObject *args) + { +- long egid_arg; + gid_t egid; +- if (!PyArg_ParseTuple(args, "l", &egid_arg)) +- return NULL; +- egid = egid_arg; +- if (egid != egid_arg) { +- PyErr_SetString(PyExc_OverflowError, "group id too big"); ++ if (!PyArg_ParseTuple(args, "O&:setegid", _PyArg_ParseGid, &egid)) + return NULL; +- } + if (setegid(egid) < 0) { + return posix_error(); + } else { +@@ -6779,23 +6765,11 @@ Set the current process's real and effec + static PyObject * + posix_setreuid (PyObject *self, PyObject *args) + { +- long ruid_arg, euid_arg; + uid_t ruid, euid; +- if (!PyArg_ParseTuple(args, "ll", &ruid_arg, &euid_arg)) +- return NULL; +- if (ruid_arg == -1) +- ruid = (uid_t)-1; /* let the compiler choose how -1 fits */ +- else +- ruid = ruid_arg; /* otherwise, assign from our long */ +- if (euid_arg == -1) +- euid = (uid_t)-1; +- else +- euid = euid_arg; +- if ((euid_arg != -1 && euid != euid_arg) || +- (ruid_arg != -1 && ruid != ruid_arg)) { +- PyErr_SetString(PyExc_OverflowError, "user id too big"); ++ if (!PyArg_ParseTuple(args, "O&O&", ++ _PyArg_ParseUid, &ruid, ++ _PyArg_ParseUid, &euid)) + return NULL; +- } + if (setreuid(ruid, euid) < 0) { + return posix_error(); + } else { +@@ -6813,23 +6787,11 @@ Set the current process's real and effec + static PyObject * + posix_setregid (PyObject *self, PyObject *args) + { +- long rgid_arg, egid_arg; + gid_t rgid, egid; +- if (!PyArg_ParseTuple(args, "ll", &rgid_arg, &egid_arg)) +- return NULL; +- if (rgid_arg == -1) +- rgid = (gid_t)-1; /* let the compiler choose how -1 fits */ +- else +- rgid = rgid_arg; /* otherwise, assign from our long */ +- if (egid_arg == -1) +- egid = (gid_t)-1; +- else +- egid = egid_arg; +- if ((egid_arg != -1 && egid != egid_arg) || +- (rgid_arg != -1 && rgid != rgid_arg)) { +- PyErr_SetString(PyExc_OverflowError, "group id too big"); ++ if (!PyArg_ParseTuple(args, "O&O&", ++ _PyArg_ParseGid, &rgid, ++ _PyArg_ParseGid, &egid)) + return NULL; +- } + if (setregid(rgid, egid) < 0) { + return posix_error(); + } else { +@@ -6847,15 +6809,9 @@ Set the current process's group id."); + static PyObject * + posix_setgid(PyObject *self, PyObject *args) + { +- long gid_arg; + gid_t gid; +- if (!PyArg_ParseTuple(args, "l:setgid", &gid_arg)) ++ if (!PyArg_ParseTuple(args, "O&:setgid", _PyArg_ParseGid, &gid)) + return NULL; +- gid = gid_arg; +- if (gid != gid_arg) { +- PyErr_SetString(PyExc_OverflowError, "group id too big"); +- return NULL; +- } + if (setgid(gid) < 0) + return posix_error(); + Py_INCREF(Py_None); +@@ -6888,27 +6844,9 @@ posix_setgroups(PyObject *self, PyObject + elem = PySequence_GetItem(groups, i); + if (!elem) + return NULL; +- if (!PyLong_Check(elem)) { +- PyErr_SetString(PyExc_TypeError, +- "groups must be integers"); ++ if (!_PyArg_ParseGid(elem, &grouplist[i])) { + Py_DECREF(elem); + return NULL; +- } else { +- unsigned long x = PyLong_AsUnsignedLong(elem); +- if (PyErr_Occurred()) { +- PyErr_SetString(PyExc_TypeError, +- "group id too big"); +- Py_DECREF(elem); +- return NULL; +- } +- grouplist[i] = x; +- /* read back the value to see if it fitted in gid_t */ +- if (grouplist[i] != x) { +- PyErr_SetString(PyExc_TypeError, +- "group id too big"); +- Py_DECREF(elem); +- return NULL; +- } + } + Py_DECREF(elem); + } +@@ -10388,9 +10326,11 @@ Set the current process's real, effectiv + static PyObject* + posix_setresuid (PyObject *self, PyObject *args) + { +- /* We assume uid_t is no larger than a long. */ +- long ruid, euid, suid; +- if (!PyArg_ParseTuple(args, "lll", &ruid, &euid, &suid)) ++ uid_t ruid, euid, suid; ++ if (!PyArg_ParseTuple(args, "O&O&O&", ++ _PyArg_ParseUid, &ruid, ++ _PyArg_ParseUid, &euid, ++ _PyArg_ParseUid, &suid)) + return NULL; + if (setresuid(ruid, euid, suid) < 0) + return posix_error(); +@@ -10406,9 +10346,11 @@ Set the current process's real, effectiv + static PyObject* + posix_setresgid (PyObject *self, PyObject *args) + { +- /* We assume uid_t is no larger than a long. */ +- long rgid, egid, sgid; +- if (!PyArg_ParseTuple(args, "lll", &rgid, &egid, &sgid)) ++ gid_t rgid, egid, sgid; ++ if (!PyArg_ParseTuple(args, "O&O&O&", ++ _PyArg_ParseGid, &rgid, ++ _PyArg_ParseGid, &egid, ++ _PyArg_ParseGid, &sgid)) + return NULL; + if (setresgid(rgid, egid, sgid) < 0) + return posix_error(); +@@ -10425,14 +10367,13 @@ static PyObject* + posix_getresuid (PyObject *self, PyObject *noargs) + { + uid_t ruid, euid, suid; +- long l_ruid, l_euid, l_suid; ++ PyObject *obj_ruid, *obj_euid, *obj_suid; + if (getresuid(&ruid, &euid, &suid) < 0) + return posix_error(); +- /* Force the values into long's as we don't know the size of uid_t. */ +- l_ruid = ruid; +- l_euid = euid; +- l_suid = suid; +- return Py_BuildValue("(lll)", l_ruid, l_euid, l_suid); ++ obj_ruid = _PyObject_FromUid(ruid); ++ obj_euid = _PyObject_FromUid(euid); ++ obj_suid = _PyObject_FromUid(suid); ++ return Py_BuildValue("(NNN)", obj_ruid, obj_euid, obj_suid); + } + #endif + +@@ -10445,14 +10386,13 @@ static PyObject* + posix_getresgid (PyObject *self, PyObject *noargs) + { + uid_t rgid, egid, sgid; +- long l_rgid, l_egid, l_sgid; ++ PyObject *obj_rgid, *obj_egid, *obj_sgid; + if (getresgid(&rgid, &egid, &sgid) < 0) + return posix_error(); +- /* Force the values into long's as we don't know the size of uid_t. */ +- l_rgid = rgid; +- l_egid = egid; +- l_sgid = sgid; +- return Py_BuildValue("(lll)", l_rgid, l_egid, l_sgid); ++ obj_rgid = _PyObject_FromGid(rgid); ++ obj_egid = _PyObject_FromGid(egid); ++ obj_sgid = _PyObject_FromGid(sgid); ++ return Py_BuildValue("(NNN)", obj_rgid, obj_egid, obj_sgid); + } + #endif + +diff -up Python-3.3.0b1/Modules/pwdmodule.c.uid-gid-overflows Python-3.3.0b1/Modules/pwdmodule.c +--- Python-3.3.0b1/Modules/pwdmodule.c.uid-gid-overflows 2012-06-26 16:19:54.000000000 -0400 ++++ Python-3.3.0b1/Modules/pwdmodule.c 2012-07-20 14:21:46.861688675 -0400 +@@ -74,8 +74,8 @@ mkpwent(struct passwd *p) + #else + SETS(setIndex++, p->pw_passwd); + #endif +- SETI(setIndex++, p->pw_uid); +- SETI(setIndex++, p->pw_gid); ++ PyStructSequence_SET_ITEM(v, setIndex++, _PyObject_FromUid(p->pw_uid)); ++ PyStructSequence_SET_ITEM(v, setIndex++, _PyObject_FromGid(p->pw_gid)); + #ifdef __VMS + SETS(setIndex++, ""); + #else +@@ -104,13 +104,14 @@ See help(pwd) for more on password datab + static PyObject * + pwd_getpwuid(PyObject *self, PyObject *args) + { +- unsigned int uid; ++ uid_t uid; + struct passwd *p; +- if (!PyArg_ParseTuple(args, "I:getpwuid", &uid)) ++ if (!PyArg_ParseTuple(args, "O&:getpwuid", ++ _PyArg_ParseUid, &uid)) + return NULL; + if ((p = getpwuid(uid)) == NULL) { + PyErr_Format(PyExc_KeyError, +- "getpwuid(): uid not found: %d", uid); ++ "getpwuid(): uid not found: %lu", (unsigned long)uid); + return NULL; + } + return mkpwent(p); +diff -up Python-3.3.0b1/Python/getargs.c.uid-gid-overflows Python-3.3.0b1/Python/getargs.c +--- Python-3.3.0b1/Python/getargs.c.uid-gid-overflows 2012-06-26 16:19:57.000000000 -0400 ++++ Python-3.3.0b1/Python/getargs.c 2012-07-20 14:21:46.861688675 -0400 +@@ -4,6 +4,7 @@ + #include "Python.h" + + #include ++#include + + + #ifdef __cplusplus +@@ -1807,6 +1808,102 @@ _PyArg_NoKeywords(const char *funcname, + funcname); + return 0; + } ++ ++PyObject * ++_PyObject_FromUid(uid_t uid) ++{ ++ return PyLong_FromUnsignedLong((uid_t)uid); ++} ++ ++PyObject * ++_PyObject_FromGid(gid_t gid) ++{ ++ return PyLong_FromUnsignedLong((gid_t)gid); ++} ++ ++int ++_PyArg_ParseUid(PyObject *in_obj, uid_t *out_uid) ++{ ++ PyObject *index, *number = NULL; ++ long sl; ++ unsigned long ul; ++ ++ assert(out_uid); ++ ++ index = PyNumber_Index(in_obj); ++ if (index != NULL) { ++ number = PyNumber_Long(index); ++ Py_DECREF(index); ++ } ++ if (number == NULL) { ++ PyErr_SetString(PyExc_TypeError, "user id must be integer"); ++ return 0; ++ } ++ ++ /* Special case: support -1 (e.g. for use by chown) */ ++ sl = PyLong_AsLong(number); ++ if (PyErr_Occurred()) { ++ PyErr_Clear(); ++ } else if (sl == -1) { ++ Py_DECREF(number); ++ *out_uid = (uid_t)-1; ++ return 1; ++ } ++ ++ /* Otherwise, it must be >= 0 */ ++ ul = PyLong_AsUnsignedLong(number); ++ Py_DECREF(number); ++ *out_uid = ul; ++ /* read back the value to see if it fitted in uid_t */ ++ if (PyErr_Occurred() || *out_uid != ul) { ++ PyErr_SetString(PyExc_OverflowError, ++ "user id is not in range(-1, 2^32-1)"); ++ return 0; ++ } ++ return 1; ++} ++ ++int ++_PyArg_ParseGid(PyObject *in_obj, gid_t *out_gid) ++{ ++ PyObject *index, *number = NULL; ++ long sl; ++ unsigned long ul; ++ ++ assert(out_gid); ++ ++ index = PyNumber_Index(in_obj); ++ if (index != NULL) { ++ number = PyNumber_Long(index); ++ Py_DECREF(index); ++ } ++ if (number == NULL) { ++ PyErr_SetString(PyExc_TypeError, "group id must be integer"); ++ return 0; ++ } ++ ++ /* Special case: support -1 (e.g. for use by chown) */ ++ sl = PyLong_AsLong(number); ++ if (PyErr_Occurred()) { ++ PyErr_Clear(); ++ } else if (sl == -1) { ++ Py_DECREF(number); ++ *out_gid = (gid_t)-1; ++ return 1; ++ } ++ ++ ul = PyLong_AsUnsignedLong(number); ++ Py_DECREF(number); ++ *out_gid = ul; ++ /* read back the value to see if it fitted in gid_t */ ++ if (PyErr_Occurred() || *out_gid != ul) { ++ PyErr_SetString(PyExc_OverflowError, ++ "group id is not in range(-1, 2^32-1)"); ++ return 0; ++ } ++ return 1; ++} ++ + #ifdef __cplusplus + }; + #endif diff --git a/python3/patches/00160-disable-test_fs_holes-in-rpm-build.patch b/python3/patches/00160-disable-test_fs_holes-in-rpm-build.patch new file mode 100644 index 000000000..9fa91d5e2 --- /dev/null +++ b/python3/patches/00160-disable-test_fs_holes-in-rpm-build.patch @@ -0,0 +1,11 @@ +diff -up cpython-59223da36dec/Lib/test/test_posix.py.disable-test_fs_holes-in-rpm-build cpython-59223da36dec/Lib/test/test_posix.py +--- cpython-59223da36dec/Lib/test/test_posix.py.disable-test_fs_holes-in-rpm-build 2012-08-07 17:15:59.000000000 -0400 ++++ cpython-59223da36dec/Lib/test/test_posix.py 2012-08-07 17:16:53.528330330 -0400 +@@ -973,6 +973,7 @@ class PosixTester(unittest.TestCase): + posix.RTLD_GLOBAL + posix.RTLD_LOCAL + ++ @unittest._skipInRpmBuild('running kernel may not match kernel in chroot') + @unittest.skipUnless(hasattr(os, 'SEEK_HOLE'), + "test needs an OS that reports file holes") + def test_fs_holes(self): diff --git a/python3/patches/00163-disable-parts-of-test_socket-in-rpm-build.patch b/python3/patches/00163-disable-parts-of-test_socket-in-rpm-build.patch new file mode 100644 index 000000000..0e2803609 --- /dev/null +++ b/python3/patches/00163-disable-parts-of-test_socket-in-rpm-build.patch @@ -0,0 +1,11 @@ +diff -up Python-3.3.0b1/Lib/test/test_socket.py.disable-test_socket-in-rpm-builds Python-3.3.0b1/Lib/test/test_socket.py +--- Python-3.3.0b1/Lib/test/test_socket.py.disable-test_socket-in-rpm-builds 2012-07-24 15:02:30.823355067 -0400 ++++ Python-3.3.0b1/Lib/test/test_socket.py 2012-07-24 15:08:13.021354999 -0400 +@@ -2188,6 +2188,7 @@ class RecvmsgGenericStreamTests(RecvmsgG + # Tests which require a stream socket and can use either recvmsg() + # or recvmsg_into(). + ++ @unittest._skipInRpmBuild('fails intermittently when run within Koji') + def testRecvmsgEOF(self): + # Receive end-of-stream indicator (b"", peer socket closed). + msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock, 1024) diff --git a/python3/patches/00164-disable-interrupted_write-tests-on-ppc.patch b/python3/patches/00164-disable-interrupted_write-tests-on-ppc.patch new file mode 100644 index 000000000..0db809209 --- /dev/null +++ b/python3/patches/00164-disable-interrupted_write-tests-on-ppc.patch @@ -0,0 +1,52 @@ +diff -up Python-3.3.0b1/Lib/test/test_exceptions.py.846849 Python-3.3.0b1/Lib/test/test_exceptions.py +--- Python-3.3.0b1/Lib/test/test_exceptions.py.846849 2012-06-26 22:19:47.000000000 +0200 ++++ Python-3.3.0b1/Lib/test/test_exceptions.py 2012-08-13 17:41:28.845403486 +0200 +@@ -401,6 +401,7 @@ class ExceptionTests(unittest.TestCase): + self.assertIsNone(e.__context__) + self.assertIsNone(e.__cause__) + ++ @unittest.skip('rhbz#846849') + def testChainingDescriptors(self): + try: + raise Exception() +diff -up Python-3.3.0b1/Lib/test/test_io.py.846849 Python-3.3.0b1/Lib/test/test_io.py +--- Python-3.3.0b1/Lib/test/test_io.py.846849 2012-06-26 22:19:48.000000000 +0200 ++++ Python-3.3.0b1/Lib/test/test_io.py 2012-08-13 17:41:28.846403451 +0200 +@@ -2938,12 +2938,15 @@ class SignalsTest(unittest.TestCase): + if e.errno != errno.EBADF: + raise + ++ @unittest.skip('rhbz#846849') + def test_interrupted_write_unbuffered(self): + self.check_interrupted_write(b"xy", b"xy", mode="wb", buffering=0) + ++ @unittest.skip('rhbz#846849') + def test_interrupted_write_buffered(self): + self.check_interrupted_write(b"xy", b"xy", mode="wb") + ++ @unittest.skip('rhbz#846849') + def test_interrupted_write_text(self): + self.check_interrupted_write("xy", b"xy", mode="w", encoding="ascii") + +diff -up Python-3.3.0b1/Lib/test/test_raise.py.846849 Python-3.3.0b1/Lib/test/test_raise.py +--- Python-3.3.0b1/Lib/test/test_raise.py.846849 2012-08-13 17:42:16.719714213 +0200 ++++ Python-3.3.0b1/Lib/test/test_raise.py 2012-08-13 17:43:02.544097272 +0200 +@@ -151,6 +151,7 @@ class TestRaise(unittest.TestCase): + + class TestCause(unittest.TestCase): + ++ @unittest.skip('rhbz#846849') + def testCauseSyntax(self): + try: + try: +diff -up Python-3.3.0b1/Lib/test/test_traceback.py.846849 Python-3.3.0b1/Lib/test/test_traceback.py +--- Python-3.3.0b1/Lib/test/test_traceback.py.846849 2012-08-13 17:44:19.714374275 +0200 ++++ Python-3.3.0b1/Lib/test/test_traceback.py 2012-08-13 17:44:43.515534435 +0200 +@@ -246,6 +246,7 @@ class BaseExceptionReportingTests: + self.check_zero_div(blocks[0]) + self.assertIn('inner_raise() # Marker', blocks[2]) + ++ @unittest.skip('rhbz#846849') + def test_context_suppression(self): + try: + try: diff --git a/python3/patches/05000-autotool-intermediates.patch b/python3/patches/05000-autotool-intermediates.patch new file mode 100644 index 000000000..bd9aeca58 --- /dev/null +++ b/python3/patches/05000-autotool-intermediates.patch @@ -0,0 +1,73 @@ +diff -up ./configure.autotool-intermediates ./configure +--- ./configure.autotool-intermediates 2012-08-07 17:21:25.249311751 -0400 ++++ ./configure 2012-08-07 17:21:35.503311049 -0400 +@@ -779,6 +779,8 @@ with_thread + enable_ipv6 + with_doc_strings + with_tsc ++with_count_allocs ++with_call_profile + with_pymalloc + with_valgrind + with_systemtap +@@ -1457,6 +1459,8 @@ Optional Packages: + deprecated; use --with(out)-threads + --with(out)-doc-strings disable/enable documentation strings + --with(out)-tsc enable/disable timestamp counter profile ++ --with(out)count-allocs enable/disable per-type instance accounting ++ --with(out)-call-profile enable/disable statistics on function call invocation + --with(out)-pymalloc disable/enable specialized mallocs + --with-valgrind Enable Valgrind support + --with(out)-systemtap disable/enable SystemTap support +@@ -10017,6 +10021,50 @@ $as_echo "no" >&6; } + fi + + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-count-allocs" >&5 ++$as_echo_n "checking for --with-count-allocs... " >&6; } ++ ++# Check whether --with-count-allocs was given. ++if test "${with_count_allocs+set}" = set; then : ++ withval=$with_count_allocs; ++if test "$withval" != no ++then ++ ++$as_echo "#define COUNT_ALLOCS 1" >>confdefs.h ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-call-profile" >&5 ++$as_echo_n "checking for --with-call-profile... " >&6; } ++ ++# Check whether --with-call-profile was given. ++if test "${with_call_profile+set}" = set; then : ++ withval=$with_call_profile; ++if test "$withval" != no ++then ++ ++$as_echo "#define CALL_PROFILE 1" >>confdefs.h ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ + # Check for Python-specific malloc support + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-pymalloc" >&5 + $as_echo_n "checking for --with-pymalloc... " >&6; } +diff -up ./pyconfig.h.in.autotool-intermediates ./pyconfig.h.in diff --git a/python3/patches/Python-3.1.1-rpath.patch b/python3/patches/Python-3.1.1-rpath.patch new file mode 100644 index 000000000..1493af295 --- /dev/null +++ b/python3/patches/Python-3.1.1-rpath.patch @@ -0,0 +1,20 @@ +diff -up Python-3.1.1/Lib/distutils/unixccompiler.py.rpath Python-3.1.1/Lib/distutils/unixccompiler.py +--- Python-3.1.1/Lib/distutils/unixccompiler.py.rpath 2009-09-04 17:29:34.000000000 -0400 ++++ Python-3.1.1/Lib/distutils/unixccompiler.py 2009-09-04 17:49:54.000000000 -0400 +@@ -141,6 +141,16 @@ class UnixCCompiler(CCompiler): + if sys.platform == "cygwin": + exe_extension = ".exe" + ++ def _fix_lib_args(self, libraries, library_dirs, runtime_library_dirs): ++ """Remove standard library path from rpath""" ++ libraries, library_dirs, runtime_library_dirs = super( ++ self.__class__, self)._fix_lib_args(libraries, library_dirs, ++ runtime_library_dirs) ++ libdir = sysconfig.get_config_var('LIBDIR') ++ if runtime_library_dirs and (libdir in runtime_library_dirs): ++ runtime_library_dirs.remove(libdir) ++ return libraries, library_dirs, runtime_library_dirs ++ + def preprocess(self, source, output_file=None, macros=None, + include_dirs=None, extra_preargs=None, extra_postargs=None): + fixed_args = self._fix_compile_args(None, macros, include_dirs) diff --git a/python3/patches/python-3.2.1-fix-test-subprocess-with-nonreadable-path-dir.patch b/python3/patches/python-3.2.1-fix-test-subprocess-with-nonreadable-path-dir.patch new file mode 100644 index 000000000..6f43c72b1 --- /dev/null +++ b/python3/patches/python-3.2.1-fix-test-subprocess-with-nonreadable-path-dir.patch @@ -0,0 +1,12 @@ +diff -up Python-3.2.1/Lib/test/test_subprocess.py.non-readable-path Python-3.2.1/Lib/test/test_subprocess.py +--- Python-3.2.1/Lib/test/test_subprocess.py.non-readable-path 2011-07-09 02:58:51.000000000 -0400 ++++ Python-3.2.1/Lib/test/test_subprocess.py 2011-07-11 11:34:16.284426005 -0400 +@@ -618,7 +618,7 @@ class ProcessTestCase(BaseTestCase): + for i in range(1024): + # Windows raises IOError. Others raise OSError. + with self.assertRaises(EnvironmentError) as c: +- subprocess.Popen(['nonexisting_i_hope'], ++ subprocess.Popen(['/usr/bin/nonexisting_i_hope'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + # ignore errors that indicate the command was not found diff --git a/python3/python-3.3.0b1-lib64.patch b/python3/python-3.3.0b1-lib64.patch new file mode 100644 index 000000000..5ae03aaec --- /dev/null +++ b/python3/python-3.3.0b1-lib64.patch @@ -0,0 +1,200 @@ +diff -up cpython-59223da36dec/Lib/distutils/command/install.py.lib64 cpython-59223da36dec/Lib/distutils/command/install.py +--- cpython-59223da36dec/Lib/distutils/command/install.py.lib64 2012-08-07 06:10:57.000000000 -0400 ++++ cpython-59223da36dec/Lib/distutils/command/install.py 2012-08-07 16:41:00.573477549 -0400 +@@ -45,14 +45,14 @@ else: + INSTALL_SCHEMES = { + 'unix_prefix': { + 'purelib': '$base/lib/python$py_version_short/site-packages', +- 'platlib': '$platbase/lib/python$py_version_short/site-packages', ++ 'platlib': '$platbase/lib64/python$py_version_short/site-packages', + 'headers': '$base/include/python$py_version_short$abiflags/$dist_name', + 'scripts': '$base/bin', + 'data' : '$base', + }, + 'unix_home': { + 'purelib': '$base/lib/python', +- 'platlib': '$base/lib/python', ++ 'platlib': '$base/lib64/python', + 'headers': '$base/include/python/$dist_name', + 'scripts': '$base/bin', + 'data' : '$base', +diff -up cpython-59223da36dec/Lib/distutils/sysconfig.py.lib64 cpython-59223da36dec/Lib/distutils/sysconfig.py +--- cpython-59223da36dec/Lib/distutils/sysconfig.py.lib64 2012-08-07 06:10:57.000000000 -0400 ++++ cpython-59223da36dec/Lib/distutils/sysconfig.py 2012-08-07 16:41:00.573477549 -0400 +@@ -139,8 +139,12 @@ def get_python_lib(plat_specific=0, stan + prefix = plat_specific and EXEC_PREFIX or PREFIX + + if os.name == "posix": ++ if plat_specific or standard_lib: ++ lib = "lib64" ++ else: ++ lib = "lib" + libpython = os.path.join(prefix, +- "lib", "python" + get_python_version()) ++ lib, "python" + get_python_version()) + if standard_lib: + return libpython + else: +diff -up cpython-59223da36dec/Lib/site.py.lib64 cpython-59223da36dec/Lib/site.py +--- cpython-59223da36dec/Lib/site.py.lib64 2012-08-07 06:10:57.000000000 -0400 ++++ cpython-59223da36dec/Lib/site.py 2012-08-07 16:41:00.573477549 -0400 +@@ -303,12 +303,16 @@ def getsitepackages(prefixes=None): + if sys.platform in ('os2emx', 'riscos'): + sitepackages.append(os.path.join(prefix, "Lib", "site-packages")) + elif os.sep == '/': ++ sitepackages.append(os.path.join(prefix, "lib64", ++ "python" + sys.version[:3], ++ "site-packages")) + sitepackages.append(os.path.join(prefix, "lib", + "python" + sys.version[:3], + "site-packages")) + sitepackages.append(os.path.join(prefix, "lib", "site-python")) + else: + sitepackages.append(prefix) ++ sitepackages.append(os.path.join(prefix, "lib64", "site-packages")) + sitepackages.append(os.path.join(prefix, "lib", "site-packages")) + if sys.platform == "darwin": + # for framework builds *only* we add the standard Apple +diff -up cpython-59223da36dec/Lib/sysconfig.py.lib64 cpython-59223da36dec/Lib/sysconfig.py +--- cpython-59223da36dec/Lib/sysconfig.py.lib64 2012-08-07 06:10:57.000000000 -0400 ++++ cpython-59223da36dec/Lib/sysconfig.py 2012-08-07 16:41:00.574477549 -0400 +@@ -21,10 +21,10 @@ __all__ = [ + + _INSTALL_SCHEMES = { + 'posix_prefix': { +- 'stdlib': '{installed_base}/lib/python{py_version_short}', +- 'platstdlib': '{platbase}/lib/python{py_version_short}', ++ 'stdlib': '{installed_base}/lib64/python{py_version_short}', ++ 'platstdlib': '{platbase}/lib64/python{py_version_short}', + 'purelib': '{base}/lib/python{py_version_short}/site-packages', +- 'platlib': '{platbase}/lib/python{py_version_short}/site-packages', ++ 'platlib': '{platbase}/lib64/python{py_version_short}/site-packages', + 'include': + '{installed_base}/include/python{py_version_short}{abiflags}', + 'platinclude': +@@ -81,10 +81,10 @@ _INSTALL_SCHEMES = { + 'data': '{userbase}', + }, + 'posix_user': { +- 'stdlib': '{userbase}/lib/python{py_version_short}', +- 'platstdlib': '{userbase}/lib/python{py_version_short}', ++ 'stdlib': '{userbase}/lib64/python{py_version_short}', ++ 'platstdlib': '{userbase}/lib64/python{py_version_short}', + 'purelib': '{userbase}/lib/python{py_version_short}/site-packages', +- 'platlib': '{userbase}/lib/python{py_version_short}/site-packages', ++ 'platlib': '{userbase}/lib64/python{py_version_short}/site-packages', + 'include': '{userbase}/include/python{py_version_short}', + 'scripts': '{userbase}/bin', + 'data': '{userbase}', +diff -up cpython-59223da36dec/Lib/test/test_site.py.lib64 cpython-59223da36dec/Lib/test/test_site.py +--- cpython-59223da36dec/Lib/test/test_site.py.lib64 2012-08-07 06:10:57.000000000 -0400 ++++ cpython-59223da36dec/Lib/test/test_site.py 2012-08-07 16:41:00.574477549 -0400 +@@ -239,12 +239,15 @@ class HelperFunctionsTests(unittest.Test + self.assertEqual(dirs[2], wanted) + elif os.sep == '/': + # OS X non-framwework builds, Linux, FreeBSD, etc +- self.assertEqual(len(dirs), 2) +- wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3], ++ self.assertEqual(len(dirs), 3) ++ wanted = os.path.join('xoxo', 'lib64', 'python' + sys.version[:3], + 'site-packages') + self.assertEqual(dirs[0], wanted) +- wanted = os.path.join('xoxo', 'lib', 'site-python') ++ wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3], ++ 'site-packages') + self.assertEqual(dirs[1], wanted) ++ wanted = os.path.join('xoxo', 'lib', 'site-python') ++ self.assertEqual(dirs[2], wanted) + else: + # other platforms + self.assertEqual(len(dirs), 2) +diff -up cpython-59223da36dec/Makefile.pre.in.lib64 cpython-59223da36dec/Makefile.pre.in +--- cpython-59223da36dec/Makefile.pre.in.lib64 2012-08-07 16:41:00.557477550 -0400 ++++ cpython-59223da36dec/Makefile.pre.in 2012-08-07 16:41:00.575477549 -0400 +@@ -108,7 +108,7 @@ LIBDIR= @libdir@ + MANDIR= @mandir@ + INCLUDEDIR= @includedir@ + CONFINCLUDEDIR= $(exec_prefix)/include +-SCRIPTDIR= $(prefix)/lib ++SCRIPTDIR= $(prefix)/lib64 + ABIFLAGS= @ABIFLAGS@ + + # Detailed destination directories +diff -up cpython-59223da36dec/Modules/getpath.c.lib64 cpython-59223da36dec/Modules/getpath.c +--- cpython-59223da36dec/Modules/getpath.c.lib64 2012-08-07 06:10:57.000000000 -0400 ++++ cpython-59223da36dec/Modules/getpath.c 2012-08-07 16:41:00.575477549 -0400 +@@ -122,8 +122,8 @@ + #endif + + #ifndef PYTHONPATH +-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \ +- EXEC_PREFIX "/lib/python" VERSION "/lib-dynload" ++#define PYTHONPATH PREFIX "/lib64/python" VERSION ":" \ ++ EXEC_PREFIX "/lib64/python" VERSION "/lib-dynload" + #endif + + #ifndef LANDMARK +@@ -135,7 +135,7 @@ static wchar_t exec_prefix[MAXPATHLEN+1] + static wchar_t progpath[MAXPATHLEN+1]; + static wchar_t *module_search_path = NULL; + static int module_search_path_malloced = 0; +-static wchar_t *lib_python = L"lib/python" VERSION; ++static wchar_t *lib_python = L"lib64/python" VERSION; + + static void + reduce(wchar_t *dir) +@@ -677,7 +677,7 @@ calculate_path(void) + } + else + wcsncpy(zip_path, _prefix, MAXPATHLEN); +- joinpath(zip_path, L"lib/python00.zip"); ++ joinpath(zip_path, L"lib64/python00.zip"); + bufsz = wcslen(zip_path); /* Replace "00" with version */ + zip_path[bufsz - 6] = VERSION[0]; + zip_path[bufsz - 5] = VERSION[2]; +@@ -687,7 +687,7 @@ calculate_path(void) + fprintf(stderr, + "Could not find platform dependent libraries \n"); + wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN); +- joinpath(exec_prefix, L"lib/lib-dynload"); ++ joinpath(exec_prefix, L"lib64/lib-dynload"); + } + /* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */ + +diff -up cpython-59223da36dec/setup.py.lib64 cpython-59223da36dec/setup.py +--- cpython-59223da36dec/setup.py.lib64 2012-08-07 06:10:57.000000000 -0400 ++++ cpython-59223da36dec/setup.py 2012-08-07 16:41:32.153475390 -0400 +@@ -438,7 +438,7 @@ class PyBuildExt(build_ext): + # directories (i.e. '.' and 'Include') must be first. See issue + # 10520. + if not cross_compiling: +- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') ++ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib64') + add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') + # only change this for cross builds for 3.3, issues on Mageia + if cross_compiling: +@@ -708,11 +708,11 @@ class PyBuildExt(build_ext): + elif curses_library: + readline_libs.append(curses_library) + elif self.compiler.find_library_file(lib_dirs + +- ['/usr/lib/termcap'], ++ ['/usr/lib64/termcap'], + 'termcap'): + readline_libs.append('termcap') + exts.append( Extension('readline', ['readline.c'], +- library_dirs=['/usr/lib/termcap'], ++ library_dirs=['/usr/lib64/termcap'], + extra_link_args=readline_extra_link_args, + libraries=readline_libs) ) + else: +@@ -749,8 +749,8 @@ class PyBuildExt(build_ext): + if krb5_h: + ssl_incs += krb5_h + ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, +- ['/usr/local/ssl/lib', +- '/usr/contrib/ssl/lib/' ++ ['/usr/local/ssl/lib64', ++ '/usr/contrib/ssl/lib64/' + ] ) + + if (ssl_incs is not None and diff --git a/python3/python3.nm b/python3/python3.nm new file mode 100644 index 000000000..51ddda9eb --- /dev/null +++ b/python3/python3.nm @@ -0,0 +1,224 @@ +############################################################################### +# IPFire.org - An Open Source Firewall Solution # +# Copyright (C) - IPFire Development Team # +############################################################################### + +name = python3 +major_ver = 3.3 +version = %{major_ver}.0 +release = 1 +thisapp = Python-%{version} + +groups = Development/Languages +url = http://www.python.org +license = Python +summary = Version 3 of the Python programming language. + +description + Python is an interpreted, interactive, object-oriented programming + language often compared to Tcl, Perl, Scheme or Java. Python includes + modules, classes, exceptions, very high level dynamic data types and + dynamic typing. Python supports interfaces to many system calls and + libraries, as well as to various windowing systems. +end + +source_dl = http://python.org/ftp/python/%{version}/ +sources = %{thisapp}.tar.xz + +pylibdir = %{libdir}/python%{major_ver} +dynload_dir= %{pylibdir}/lib-dynload + +build + requires + autoconf + automake + bzip2 + bzip2-devel + db4-devel >= 1:4.8 + expat-devel >= 2.1.0 + findutils + gdbm-devel >= 1.10 + gcc-c++ + glibc-devel + gmp-devel + libffi-devel + libGL-devel + libX11-devel + ncurses-devel + openssl-devel + pkg-config + readline-devel + sqlite-devel + tar + tcl-devel + util-linux + xz-devel + zlib-devel + end + + export CFLAGS += -D_GNU_SOURCE -fwrapv + export CXXFLAGS += -D_GNU_SOURCE -fwrapv + export OPT = %{CFLAGS} + export LINKCC = gcc + + prepare_cmds + # Apply patches for x86_64. + if [ "$(uname -m)" = "x86_64" ]; then + patch -Np1 -i %{DIR_SOURCE}/python-3.3.0b1-lib64.patch + fi + + # Remove embedded copies of expat and libffi + rm -rf Modules/{expat,zlib} + rm -rf Modules/_ctypes/{darwin,libffi,libffi_arm_wince,libffi_msvc,libffi_osx} + + # Make all source files owned by root. + chown root.root -R . + + autoreconf --force + end + + configure_options += \ + --enable-ipv6 \ + --with-computed-gotos=yes \ + --with-dbmliborder=gdbm:ndbm:bdb \ + --with-system-expat \ + --with-system-ffi \ + --enable-shared + + #test + # make test + #end + + install_cmds + install -d -m 0755 %{BUILDROOT}%{pylibdir}/site-packages/__pycache__ + install -d -m 0755 %{BUILDROOT}/usr/lib/python${major_ver}/site-packages/__pycache__ + + # Development tools + mv -v %{BUILDROOT}%{bindir}/{,python3-}2to3 + install -m 755 -d %{BUILDROOT}%{pylibdir}/Tools + install Tools/README %{BUILDROOT}%{pylibdir}/Tools/ + cp -avr Tools/{freeze,i18n,pynche,scripts} %{BUILDROOT}%{pylibdir}/Tools/ + + rm -vf %{BUILDROOT}%{pylibdir}/email/test/data/audiotest.au %{BUILDROOT}%{pylibdir}/test/audiotest.au + + # Switch all shebangs to refer to the specific Python version. + LD_LIBRARY_PATH=. ./python Tools/scripts/pathfix.py \ + -i "%{bindir}/python%{major_ver}" \ + %{BUILDROOT} + + # Remove shebang lines from .py files that aren't executable, and + # remove executability from .py files that don't have a shebang line: + find %{BUILDROOT} -name \*.py \ + \( \( \! -perm /u+x,g+x,o+x -exec sed -e '/^#!/Q 0' -e 'Q 1' {} \; \ + -print -exec sed -i '1d' {} \; \) -o \( \ + -perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \ + -exec chmod a-x {} \; \) \) + + # .xpm and .xbm files should not be executable: + find %{BUILDROOT} \ + \( -name \*.xbm -o -name \*.xpm -o -name \*.xpm.1 \) \ + -exec chmod a-x {} \; + + # Remove executable flag from files that shouldn't have it: + chmod a-x \ + %{BUILDROOT}%{pylibdir}/distutils/tests/Setup.sample \ + %{BUILDROOT}%{pylibdir}/Tools/README + + # Get rid of DOS batch files: + find %{BUILDROOT} -name \*.bat -exec rm {} \; + + # Get rid of backup files: + find %{BUILDROOT}/ -name "*~" -exec rm -f {} \; + rm -f %{BUILDROOT}%{pylibdir}/LICENSE.txt + + # Junk, no point in putting in -test sub-pkg + rm -f %{BUILDROOT}%{pylibdir}/idlelib/testcode.py* + + # Fix end-of-line encodings: + find %{BUILDROOT}/ -name \*.py -exec sed -i 's/\r//' {} \; + + # Do bytecompilation with the newly installed interpreter. + # compile *.pyo + find %{BUILDROOT} -type f -a -name "*.py" -print0 | \ + LD_LIBRARY_PATH="%{BUILDROOT}%{dynload_dir}:%{BUILDROOT}%{libdir}" \ + PYTHONPATH="%{BUILDROOT}%{libdir}python%{major_ver} %{BUILDROOT}/%{libdir}python%{major_ver}/site-packages" \ + xargs -0 %{BUILDROOT}%{bindir}/python%{major_ver} -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{BUILDROOT}")[2]) for f in sys.argv[1:]]' || : + # compile *.pyc + find %{BUILDROOT} -type f -a -name "*.py" -print0 | \ + LD_LIBRARY_PATH="%{BUILDROOT}%{dynload_dir}:%{BUILDROOT}%{libdir}" \ + PYTHONPATH="%{BUILDROOT}%{libdir}python%{major_ver} %{BUILDROOT}/%{libdir}python%{major_ver}/site-packages" \ + xargs -0 %{BUILDROOT}%{bindir}/python%{major_ver} -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{BUILDROOT}")[2], optimize=0) for f in sys.argv[1:]]' || : + + # Fixup permissions for shared libraries from non-standard 555 to standard 755: + find %{BUILDROOT} -perm 555 -exec chmod 755 {} \; + end +end + +packages + package %{name} + # Define python-abi manually. + provides + python-abi = %{major_ver} + end + + requires + %{name}-libs = %{thisver} + end + end + + package %{name}-libs + template LIBS + + requires + expat >= 2.1.0 + end + + files += %{dynload_dir} + end + + package %{name}-devel + template DEVEL + + requires += %{name}-libs = %{thisver} + + files += \ + !%{libdir}/python*/config*/Makefile \ + !%{includedir}/python*/pyconfig.h + end + + package %{name}-test + requires + %{name} = %{thisver} + end + + files + %{pylibdir}/ctypes/test + %{pylibdir}/distutils/testi + %{pylibdir}/lib2to3/test + %{pylibdir}/sqlite3/test + %{pylibdir}/test + %{pylibdir}/tkinter/test + %{pylibdir}/unittest/test + %{dynload_dir}/_ctypes_test* + %{dynload_dir}/_testbuffer* + %{dynload_dir}/_testcapi* + end + end + + package %{name}-tools + requires + %{name} = %{thisver} + end + + files + %{bindir}/python3-2to3 + %{bindir}/2to3* + %{bindir}/idle* + %{pylibdir}/Tools + end + end + + package %{name}-debuginfo + template DEBUGINFO + end +end -- 2.39.2