Ticket #9958: python-2.7.2.p0.diff

File python-2.7.2.p0.diff, 17.4 KB (added by jdemeyer, 9 years ago)

Diff for the Python spkg (without deleted files), for review only

  • SPKG.txt

    # HG changeset patch
    # User Francois Bissey <francois.bissey@canterbury.ac.nz>
    # Date 1324416319 -46800
    # Node ID 5ab64687af3f6c6b280163b0ec18a505c3fbb145
    # Parent  b884f61f646907f9aa3ee7bbbee7401a20a25de4
    trac 9958: upgrade to python-2.7.2, move everything to patch.
    
    diff --git a/SPKG.txt b/SPKG.txt
    a b  
    4747 * We used to block parallel MAKE, but extensive testing [make -j64]
    4848   showed that there is no longer any problem. The problem is with
    4949   parallel 'make install', which remains disabled.
    50  * There are two fixes that can be removed once we update to a
    51    Python newer than 2.6.4: the readline-spacebug.patch below, and
    52    the 'unset DISTUTILS_DEBUG' in spkg-install.
    5350 * Spaces in SAGE_ROOT aren't yet fully supported by this package,
    5451   since we put $SAGE_LOCAL/... into CPPFLAGS and LDFLAGS, which
    5552   wouldn't work then.
    56  * TODO: Most "patches" are still applied by *copying* patched versions
    57    of the files; this should be fixed.
    5853
    5954=== Patches ===
    6055
    6156 * cPickle.c.patch, pickle.py.patch: These add support for pickling
    6257   classes with a metaclass via copy_reg. These have been submitted
    6358   upstream: http://bugs.python.org/issue7689
    64  * locale.py: Work around import failures for locales
    65  * readline-spacebug.patch: Fix issue where a space is inserted
    66    after tab completing at the command line. This is merged upstream
    67    and can be removed as soon as a Python newer than 2.6.4 is used.
    68  * readline-Itanium-fix.patch: Fix Itanium specific readline
    69    extension problem.
     59   This is fixed in python-2.7.3 and can be removed at the next upgrade.
    7060 * sdist.py.patch: Make sure that sdist copies over the .hg directory.
    7161 * socket.py.patch: Work around an SSL issue.
    72  * Makefile.pre.in.patch: Fixes http://bugs.python.org/issue1628484
    73    This was merged upstream for Python 2.6.6 and 2.7.  Also changes
    74    permission of installed libraries to 0755 (like any other library)
    75    instead of 0555.
    76  * socketmodule.c: Makes sure some things are defined before trying to compile
    77    them. This was to work around a failure of _socket to build on OpenSolaris.
    78    see  http://bugs.python.org/issue8852 and Sage trac #9041 and #9022
    79  * setup.py.multiarch.patch: Library search dir is expanded on Debian
    80    and derivatives with multiarch (see #11243, #11447).
    81    This requires 'dpkg-architecture' to be installed on the affected systems.
    82    (Since the patch origins from Python 2.7, it can certainly be removed
    83    when we upgrade to that. But the patch then won't apply anymore anyway.)
     62 * Makefile.pre.in.patch: Changes the permission of installed libraries
     63   to 0755 (like any other library) instead of 0555.
    8464
    8565== Changelog ==
    8666
     67=== python-2.7.2.p0 (François Bissey, December 21st, 2011) ===
     68 * #9958 Upgrade to python-2.7.2.
     69 * Converted the spkg to use patch exclusively.
     70 * A number of patches have been dropped because the fix are in this release
     71   or they don't apply cleanly anymore. The list of dropped patches is as follow:
     72   - locale.py doesn't apply to this release
     73   - readline-spacebug.patch fixed in this release
     74   - readline-Itanium-fix.patch cannot be applied as is in this release
     75   - socketmodule.c fixed in this release
     76   - setup.py.multiarch.patch fixed in this release
     77
    8778=== python-2.6.4.p13 (Simon King, 10 December 2011) ===
    8879 * #12131: use --libdir, to make the package work on openSUSE.
    8980
  • new file patches/Lib.distutils.command.sdist.patch

    diff --git a/patches/Lib.distutils.command.sdist.patch b/patches/Lib.distutils.command.sdist.patch
    new file mode 100644
    - +  
     1--- src/Lib/distutils/command/sdist.py.orig     2011-05-20 15:24:44.936515549 +1200
     2+++ src/Lib/distutils/command/sdist.py  2011-05-20 15:25:54.920519189 +1200
     3@@ -324,7 +324,7 @@
     4           * the build tree (typically "build")
     5           * the release tree itself (only an issue if we ran "sdist"
     6             previously with --keep-temp, or it aborted)
     7-          * any RCS, CVS, .svn, .hg, .git, .bzr, _darcs directories
     8+          * any RCS, CVS, .svn, .git, .bzr, _darcs directories
     9         """
     10         build = self.get_finalized_command('build')
     11         base_dir = self.distribution.get_fullname()
     12@@ -339,7 +339,7 @@
     13         else:
     14             seps = '/'
     15 
     16-        vcs_dirs = ['RCS', 'CVS', r'\.svn', r'\.hg', r'\.git', r'\.bzr',
     17+        vcs_dirs = ['RCS', 'CVS', r'\.svn', r'\.git', r'\.bzr',
     18                     '_darcs']
     19         vcs_ptrn = r'(^|%s)(%s)(%s).*' % (seps, '|'.join(vcs_dirs), seps)
     20         self.filelist.exclude_pattern(vcs_ptrn, is_regex=1)
  • new file patches/Lib.socket.patch

    diff --git a/patches/Lib.socket.patch b/patches/Lib.socket.patch
    new file mode 100644
    - +  
     1--- src/Lib/socket.py.orig      2011-05-20 15:28:49.980525832 +1200
     2+++ src/Lib/socket.py   2011-05-20 15:28:53.943299694 +1200
     3@@ -51,6 +51,9 @@
     4 
     5 try:
     6     import _ssl
     7+    from _ssl import SSLError as sslerror
     8+    # we try this second line since sometimes the first
     9+    # passes even though the module isn't there
     10 except ImportError:
     11     # no SSL support
     12     pass
     13@@ -64,7 +67,6 @@
     14         return _realssl.sslwrap_simple(sock, keyfile, certfile)
     15 
     16     # we need to import the same constants we used to...
     17-    from _ssl import SSLError as sslerror
     18     from _ssl import \
     19          RAND_add, \
     20          RAND_egd, \
  • patches/Makefile.pre.in.patch

    diff --git a/patches/Makefile.pre.in.patch b/patches/Makefile.pre.in.patch
    a b  
    1 diff -r -u src/Makefile.pre.in src.patched/Makefile.pre.in
    2 --- src/Makefile.pre.in 2010-05-26 00:40:33.000000000 +0200
    3 +++ src.patched/Makefile.pre.in 2011-11-30 13:55:40.000000000 +0100
    4 @@ -49,15 +49,14 @@
    5  INSTALL_DATA=  @INSTALL_DATA@
     1--- src/Makefile.pre.in.orig    2011-12-06 16:00:20.000000000 +1300
     2+++ src/Makefile.pre.in 2011-12-06 16:00:44.000000000 +1300
     3@@ -55,7 +55,7 @@
    64 # Shared libraries must be installed with executable mode on some systems;
    75 # rather than figuring out exactly which, we always give them executable mode.
    8 -# Also, making them read-only seems to be a good idea...
     6 # Also, making them read-only seems to be a good idea...
    97-INSTALL_SHARED= ${INSTALL} -m 555
    108+INSTALL_SHARED= ${INSTALL} -m 755
    119 
    1210 MAKESETUP=      $(srcdir)/Modules/makesetup
    1311 
    14  # Compiler options
    15  OPT=           @OPT@
    16  BASECFLAGS=    @BASECFLAGS@
    17 -CFLAGS=                $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS)
    18 +CFLAGS=                $(BASECFLAGS) @CFLAGS@ $(OPT) $(EXTRA_CFLAGS)
    19  # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
    20  # be able to build extension modules using the directories specified in the
    21  # environment variables
    22 @@ -86,8 +85,8 @@
    23  datarootdir=    @datarootdir@
    24  
    25  # Expanded directories
    26 -BINDIR=                $(exec_prefix)/bin
    27 -LIBDIR=                $(exec_prefix)/lib
    28 +BINDIR=                @bindir@
    29 +LIBDIR=                @libdir@
    30  MANDIR=                @mandir@
    31  INCLUDEDIR=    @includedir@
    32  CONFINCLUDEDIR=        $(exec_prefix)/include
    33 @@ -394,8 +393,8 @@
    34  # Build the shared modules
    35  sharedmods: $(BUILDPYTHON)
    36         @case $$MAKEFLAGS in \
    37 -       *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
    38 -       *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
    39 +       *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
    40 +       *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
    41         esac
    42  
    43  # Build static library
    44 @@ -1051,6 +1050,7 @@
    45  # install (which includes python-config) happy.
    46  frameworkinstallmaclib:
    47         ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
    48 +       ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).dylib"
    49         cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
    50  
    51  # This installs the IDE, the Launcher and other apps into /Applications
  • new file patches/Modules.Setup.dist.patch

    diff --git a/patches/Modules.Setup.dist.patch b/patches/Modules.Setup.dist.patch
    new file mode 100644
    - +  
     1diff -Naur src/Modules/Setup.dist src.new/Modules/Setup.dist
     2--- src/Modules/Setup.dist      2010-05-25 23:40:38.000000000 +0100
     3+++ src.new/Modules/Setup.dist  2011-04-24 09:21:56.521446467 +0100
     4@@ -221,7 +221,7 @@
     5 #
     6 # First, look at Setup.config; configure may have set this for you.
     7 
     8-#crypt cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems
     9+crypt cryptmodule.c -lcrypt    # crypt(3); needs -lcrypt on some systems like Ubuntu 11.04
     10 
     11 
     12 # Some more UNIX dependent modules -- off by default, since these
  • new file patches/dynamic_class_copyreg_c.patch

    diff --git a/patches/dynamic_class_copyreg_c.patch b/patches/dynamic_class_copyreg_c.patch
    new file mode 100644
    - +  
     1--- src/Modules/cPickle.c.orig  2010-05-10 02:46:46.000000000 +1200
     2+++ src/Modules/cPickle.c       2011-05-21 08:26:22.244500967 +1200
     3@@ -2697,11 +2697,6 @@
     4         }
     5     }
     6 
     7-    if (PyType_IsSubtype(type, &PyType_Type)) {
     8-        res = save_global(self, args, NULL);
     9-        goto finally;
     10-    }
     11-
     12     /* Get a reduction callable, and call it.  This may come from
     13      * copy_reg.dispatch_table, the object's __reduce_ex__ method,
     14      * or the object's __reduce__ method.
     15@@ -2717,6 +2712,11 @@
     16         }
     17     }
     18     else {
     19+        if (PyType_IsSubtype(type, &PyType_Type)) {
     20+                res = save_global(self, args, NULL);
     21+                goto finally;
     22+        }
     23+
     24         /* Check for a __reduce_ex__ method. */
     25         __reduce__ = PyObject_GetAttr(args, __reduce_ex___str);
     26         if (__reduce__ != NULL) {
  • new file patches/dynamic_class_copyreg_py.patch

    diff --git a/patches/dynamic_class_copyreg_py.patch b/patches/dynamic_class_copyreg_py.patch
    new file mode 100644
    - +  
     1Index: Lib/test/pickletester.py
     2===================================================================
     3--- src/Lib/test/pickletester.py        (revision 77421)
     4+++ src/Lib/test/pickletester.py        (working copy)
     5@@ -124,6 +124,21 @@
     6 class use_metaclass(object):
     7     __metaclass__ = metaclass
     8 
     9+class pickling_metaclass(type):
     10+    def __cmp__(self, other):
     11+        r = cmp(type(self), type(other))
     12+        if r:
     13+            return r
     14+        return cmp(self.reduce_args, other.reduce_args)
     15+
     16+    def __reduce__(self):
     17+        return (create_dynamic_class, self.reduce_args)
     18+
     19+def create_dynamic_class(name, bases):
     20+    result = pickling_metaclass(name, bases, dict())
     21+    result.reduce_args = (name, bases)
     22+    return result
     23+
     24 # DATA0 .. DATA2 are the pickles we expect under the various protocols, for
     25 # the object returned by create_data().
     26 
     27@@ -609,6 +624,14 @@
     28             b = self.loads(s)
     29             self.assertEqual(a.__class__, b.__class__)
     30 
     31+    def test_dynamicclass(self):
     32+        a = create_dynamic_class("my_dynamic_class", (object,))
     33+        copy_reg.pickle(pickling_metaclass, pickling_metaclass.__reduce__)
     34+        for proto in protocols:
     35+            s = self.dumps(a, proto)
     36+            b = self.loads(s)
     37+            self.assertEqual(a, b)
     38+
     39     def test_structseq(self):
     40         import time
     41         import os
     42Index: Lib/pickle.py
     43===================================================================
     44--- src/Lib/pickle.py   (revision 77421)
     45+++ src/Lib/pickle.py   (working copy)
     46@@ -286,20 +286,20 @@
     47             f(self, obj) # Call unbound method with explicit self
     48             return
     49 
     50-        # Check for a class with a custom metaclass; treat as regular class
     51-        try:
     52-            issc = issubclass(t, TypeType)
     53-        except TypeError: # t is not a class (old Boost; see SF #502085)
     54-            issc = 0
     55-        if issc:
     56-            self.save_global(obj)
     57-            return
     58-
     59         # Check copy_reg.dispatch_table
     60         reduce = dispatch_table.get(t)
     61         if reduce:
     62             rv = reduce(obj)
     63         else:
     64+            # Check for a class with a custom metaclass; treat as regular class
     65+            try:
     66+                issc = issubclass(t, TypeType)
     67+            except TypeError: # t is not a class (old Boost; see SF #502085)
     68+                issc = 0
     69+            if issc:
     70+                self.save_global(obj)
     71+                return
     72+
     73             # Check for a __reduce_ex__ method, fall back to __reduce__
     74             reduce = getattr(obj, "__reduce_ex__", None)
     75             if reduce:
  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b  
    1313
    1414# PATCH
    1515
    16 # When building Python 2.6 on Debian and derivatives with multiarch,
    17 # system library directories are not correctly setup.  This patch
    18 # fixes this, with no-op on other systems.
    19 # The fix requires 'dpkg-architecture' to be installed there though
    20 # (see below).
    21 echo "Patching src/setup.py for multiarch."
    22 patch -p0 < patches/setup.py.multiarch.patch
     16patch -p0 < patches/Lib.distutils.command.sdist.patch
    2317if [ $? -ne 0 ]; then
    24     echo >&2 "Error patching src/setup.py"
     18    echo "Error copying patched sdist.py"
    2519    exit 1
    2620fi
    2721
    28 # Due to a python bug with Solaris
    29 # see http://bugs.python.org/issue1759169
    30 # it is necessary to apply a patch to configure.in
    31 # then run autoconf. This not only generates a
    32 # new 'configure' script, but some subdirectories too
    33 # so these will be copied.
    34 
    35 if [ "x`uname`" = xSunOS ] ; then
    36    echo "Applying a revised 'configure' script for Solaris"
    37    echo "See http://bugs.python.org/issue1759169"
    38    echo "http://trac.sagemath.org/sage_trac/ticket/7867"
    39    cp -r patches/autom4te.cache patches/configure patches/configure.in src
    40    if [ $? -ne 0 ]; then
    41       echo >&2 "Failed to apply the Solaris patches needed for"
    42       echo >&2 "http://bugs.python.org/issue1759169"
    43       echo >&2 "http://trac.sagemath.org/sage_trac/ticket/7867"
    44       exit 1
    45    fi
    46    echo "Setting  HAVE_FD_TRANSFER=0 for Solaris to allow"
    47    echo "the python module '_multiprocessing' to build"
    48    echo "See: http://trac.sagemath.org/sage_trac/ticket/8440"
    49    cp patches/setup.py src
    50    if [ $? -ne 0 ]; then
    51       echo >&2 "Failed to apply the Solaris patch needed for"
    52       echo >&2 "http://trac.sagemath.org/sage_trac/ticket/8440"
    53       exit 1
    54    fi
    55 fi
    56 
    57 
    58 cp patches/locale.py src/Lib/locale.py
     22patch -p0 < patches/Lib.socket.patch
    5923if [ $? -ne 0 ]; then
    60     echo >&2 "Error copying patched locale.py"
     24    echo "Error copying patched socket.py"
    6125    exit 1
    6226fi
    6327
    64 ( cd src && patch -p1 <../patches/Makefile.pre.in.patch )
     28patch -p0 < patches/dynamic_class_copyreg_py.patch
     29if [ $? -ne 0 ]; then
     30    echo "Error copying patched pickle.py"
     31    exit 1
     32fi
     33
     34patch -p0 < patches/dynamic_class_copyreg_c.patch
     35if [ $? -ne 0 ]; then
     36    echo "Error copying patched cPickle.c"
     37    exit 1
     38fi
     39
     40patch -p0 < patches/Makefile.pre.in.patch
    6541if [ $? -ne 0 ]; then
    6642    echo >&2 "Error patching Makefile.pre.in"
    6743    exit 1
    6844fi
    6945
    70 cp patches/sdist.py src/Lib/distutils/command/sdist.py
    71 if [ $? -ne 0 ]; then
    72     echo >&2 "Error copying patched sdist.py"
    73     exit 1
    74 fi
    75 
    76 cp patches/socket.py src/Lib/socket.py
    77 if [ $? -ne 0 ]; then
    78     echo >&2 "Error copying patched socket.py"
    79     exit 1
    80 fi
    81 
    82 cp patches/pickle.py src/Lib/pickle.py
    83 if [ $? -ne 0 ]; then
    84     echo >&2 "Error copying patched pickle.py"
    85     exit 1
    86 fi
    87 
    88 cp patches/cPickle.c src/Modules/cPickle.c
    89 if [ $? -ne 0 ]; then
    90     echo >&2 "Error copying patched cPickle.c"
    91     exit 1
    92 fi
    93 
    94 # Due to a problem with _socket not building on OpenSolaris on x64
    95 # see http://bugs.python.org/issue8852
    96 # http://trac.sagemath.org/sage_trac/ticket/9041
    97 # http://trac.sagemath.org/sage_trac/ticket/9022
    98 # Modules/socketmodule.c needs patching. The patch consists of
    99 # only checking if things are defined before trying to build with them
    100 # so it is safe (and desirable) on any platform.
    101 
    102 cp patches/Modules.socketmodule.c src/Modules/socketmodule.c
    103 if [ $? -ne 0 ]; then
    104     echo >&2 "Error copying patched socketmodule.c"
    105     exit 1
    106 fi
    107 
    108 # The following patch for fixing broken readline behavior on Itanium
    109 # Linux definitely does *not* work on anything else.
    110 if [ "`uname -m`" = "ia64" -a "`uname`" = "Linux" ]; then
    111     echo "Updating readline.c for Linux/Itanium"
    112     cp patches/readline.c-Itanium-fix src/Modules/readline.c
    113 else
    114     # Readline patch: http://bugs.python.org/file14599/python-2.6-readline.patch
    115     # Associated bug: http://bugs.python.org/issue5833
    116     #
    117     # Committed to Python as r75747 in the py26-maint branch, but not
    118     # in time for 2.6.4 -- so we can remove this patch the next time
    119     # we update Python in Sage.
    120     cp patches/readline.c-spacebug src/Modules/readline.c
    121 fi
    122 
    123 if [ $? -ne 0 ]; then
    124     echo >&2 "Error copying patched readline.c"
    125     exit 1
    126 fi
    127 
    128 
    12946# We are setting LDFLAGS and CPPFLAGS so that we pick up Sage's readline
    13047LDFLAGS="-L$SAGE_LOCAL/lib $LDFLAGS"
    13148export LDFLAGS
     
    226143
    227144# move the python directory if we're upgrading from a version
    228145# of sage with python 2.5
    229 if [ -d python2.5/site-packages ]; then
    230    mv python2.5/site-packages python2.6/site-packages-old
     146if [ -d python2.6/site-packages ]; then
     147   mv python2.6/site-packages python2.7/site-packages-old
    231148fi
    232149
    233 rm -rf python/python2.6 python/python2.5 python/python python python2.4 python2.5
    234 ln -s python2.6 python
     150rm -rf python/python2.7 python/python2.6 python/python2.5 python/python python python2.4 python2.5
     151ln -s python2.7 python
    235152if [ $? -ne 0 ]; then
    236153    echo >&2 "Error creating symbolic link"
    237154    exit 1