Rev 5851: (jameinel) Finally break compatibility with python 2.4/5. bzr-2.4.0 will be in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed May 11 16:35:51 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5851 [merge]
revision-id: pqm at pqm.ubuntu.com-20110511163534-yz28ddqwa5cicukr
parent: pqm at pqm.ubuntu.com-20110511150423-tpm1ablukqalkvim
parent: john at arbash-meinel.com-20110511132635-lmqv0nwb5dxeua4m
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-05-11 16:35:34 +0000
message:
  (jameinel) Finally break compatibility with python 2.4/5. bzr-2.4.0 will be
   officially only compatible with python2.6/7 (John A Meinel)
modified:
  bzr                            bzr.py-20050313053754-5485f144c7006fa6
  bzrlib/_btree_serializer_pyx.pyx _parse_btree_c.pyx-20080703034413-3q25bklkenti3p8p-2
  bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
  bzrlib/tests/blackbox/test_exceptions.py test_exceptions.py-20060604211237-yi2cxg0ose3xk4id-1
  bzrlib/tests/ftp_server/__init__.py __init__.py-20090227130107-4gcpgvr00l7v3fsw-1
  bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
  bzrlib/tests/test_msgeditor.py test_msgeditor.py-20051202041359-920315ec6011ee51
  bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
  bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
  doc/en/whats-new/whats-new-in-2.4.txt whatsnewin2.4.txt-20110114044330-nipk1og7j729fy89-1
  profile_imports.py             profile_imports.py-20060618020306-k5uw80achysrokj9-1
  setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
=== modified file 'bzr'
--- a/bzr	2011-03-11 10:58:18 +0000
+++ b/bzr	2011-05-11 11:35:28 +0000
@@ -31,8 +31,8 @@
     version_info = 1, 5 # 1.5 or older
 
 REINVOKE = "__BZR_REINVOKE"
-NEED_VERS = (2, 4)
-KNOWN_PYTHONS = ('python2.4', 'python2.5', 'python2.6')
+NEED_VERS = (2, 6)
+KNOWN_PYTHONS = ('python2.6', 'python2.7')
 
 if version_info < NEED_VERS:
     if not os.environ.has_key(REINVOKE):

=== modified file 'bzrlib/_btree_serializer_pyx.pyx'
--- a/bzrlib/_btree_serializer_pyx.pyx	2011-02-25 18:52:53 +0000
+++ b/bzrlib/_btree_serializer_pyx.pyx	2011-05-11 11:35:28 +0000
@@ -496,16 +496,6 @@
     return val
 
 
-cdef _format_record_py24(gc_chk_sha1_record *record):
-    """Python2.4 PyString_FromFormat doesn't have %u.
-
-    It only has %d and %ld. We would really like to even have %llu, which
-    is only in python2.7. So we go back into casting to regular objects.
-    """
-    return "%s %s %s %s" % (record.block_offset, record.block_length,
-                            record.record_start, record.record_end)
-
-
 cdef _format_record(gc_chk_sha1_record *record):
     # This is inefficient to go from a logical state back to a
     # string, but it makes things work a bit better internally for now.
@@ -524,12 +514,6 @@
                                     record.record_start, record.record_end)
     return value
 
-ctypedef object (*formatproc)(gc_chk_sha1_record *)
-cdef formatproc _record_formatter
-_record_formatter = _format_record
-if sys.version_info[:2] == (2, 4):
-    _record_formatter = _format_record_py24
-
 
 cdef class GCCHKSHA1LeafNode:
     """Track all the entries for a given leaf node."""
@@ -593,7 +577,7 @@
         cdef StaticTuple value_and_refs
         cdef StaticTuple empty
         value_and_refs = StaticTuple_New(2)
-        value = _record_formatter(record)
+        value = _format_record(record)
         Py_INCREF(value)
         StaticTuple_SET_ITEM(value_and_refs, 0, value)
         # Always empty refs

=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2011-04-15 21:22:52 +0000
+++ b/bzrlib/osutils.py	2011-05-11 11:35:28 +0000
@@ -53,18 +53,10 @@
     deprecated_in,
     )
 
-# sha and md5 modules are deprecated in python2.6 but hashlib is available as
-# of 2.5
-if sys.version_info < (2, 5):
-    import md5 as _mod_md5
-    md5 = _mod_md5.new
-    import sha as _mod_sha
-    sha = _mod_sha.new
-else:
-    from hashlib import (
-        md5,
-        sha1 as sha,
-        )
+from hashlib import (
+    md5,
+    sha1 as sha,
+    )
 
 
 import bzrlib

=== modified file 'bzrlib/tests/blackbox/test_exceptions.py'
--- a/bzrlib/tests/blackbox/test_exceptions.py	2011-05-04 19:55:26 +0000
+++ b/bzrlib/tests/blackbox/test_exceptions.py	2011-05-11 11:35:28 +0000
@@ -67,10 +67,7 @@
 
     def test_nonascii_optparse(self):
         """Reasonable error raised when non-ascii in option name"""
-        if sys.version_info < (2,5):
-            error_re = 'no such option'
-        else:
-            error_re = 'Only ASCII permitted in option names'
+        error_re = 'Only ASCII permitted in option names'
         out = self.run_bzr_error([error_re], ['st',u'-\xe4'])
 
 

=== modified file 'bzrlib/tests/ftp_server/__init__.py'
--- a/bzrlib/tests/ftp_server/__init__.py	2010-02-17 17:11:16 +0000
+++ b/bzrlib/tests/ftp_server/__init__.py	2011-05-11 11:35:28 +0000
@@ -17,20 +17,10 @@
 Facilities to use ftp test servers.
 """
 
-import sys
-
 from bzrlib import tests
 
 
 try:
-    from bzrlib.tests.ftp_server import medusa_based
-    # medusa is bogus under python2.6
-    medusa_available = sys.version_info < (2, 6)
-except ImportError:
-    medusa_available = False
-
-
-try:
     from bzrlib.tests.ftp_server import pyftpdlib_based
     pyftpdlib_available = True
 except ImportError:
@@ -48,7 +38,7 @@
     """
 
     def _probe(self):
-        return medusa_available or pyftpdlib_available
+        return pyftpdlib_available
 
     def feature_name(self):
         return 'FTPServer'
@@ -79,9 +69,7 @@
         raise tests.UnavailableFeature(FTPServerFeature)
 
 
-if medusa_available:
-    FTPTestServer = medusa_based.FTPTestServer
-elif pyftpdlib_available:
+if pyftpdlib_available:
     FTPTestServer = pyftpdlib_based.FTPTestServer
 else:
     FTPTestServer = UnavailableFTPTestServer

=== modified file 'bzrlib/tests/test_knit.py'
--- a/bzrlib/tests/test_knit.py	2011-04-19 02:03:54 +0000
+++ b/bzrlib/tests/test_knit.py	2011-05-11 11:35:28 +0000
@@ -1192,8 +1192,7 @@
             self.assertRaises(errors.KnitCorrupt, index.keys)
         except TypeError, e:
             if (str(e) == ('exceptions must be strings, classes, or instances,'
-                           ' not exceptions.IndexError')
-                and sys.version_info[0:2] >= (2,5)):
+                           ' not exceptions.IndexError')):
                 self.knownFailure('Pyrex <0.9.5 fails with TypeError when'
                                   ' raising new style exceptions with python'
                                   ' >=2.5')
@@ -1212,8 +1211,7 @@
             self.assertRaises(errors.KnitCorrupt, index.keys)
         except TypeError, e:
             if (str(e) == ('exceptions must be strings, classes, or instances,'
-                           ' not exceptions.ValueError')
-                and sys.version_info[0:2] >= (2,5)):
+                           ' not exceptions.ValueError')):
                 self.knownFailure('Pyrex <0.9.5 fails with TypeError when'
                                   ' raising new style exceptions with python'
                                   ' >=2.5')
@@ -1232,8 +1230,7 @@
             self.assertRaises(errors.KnitCorrupt, index.keys)
         except TypeError, e:
             if (str(e) == ('exceptions must be strings, classes, or instances,'
-                           ' not exceptions.ValueError')
-                and sys.version_info[0:2] >= (2,5)):
+                           ' not exceptions.ValueError')):
                 self.knownFailure('Pyrex <0.9.5 fails with TypeError when'
                                   ' raising new style exceptions with python'
                                   ' >=2.5')
@@ -1250,8 +1247,7 @@
             self.assertRaises(errors.KnitCorrupt, index.keys)
         except TypeError, e:
             if (str(e) == ('exceptions must be strings, classes, or instances,'
-                           ' not exceptions.ValueError')
-                and sys.version_info[0:2] >= (2,5)):
+                           ' not exceptions.ValueError')):
                 self.knownFailure('Pyrex <0.9.5 fails with TypeError when'
                                   ' raising new style exceptions with python'
                                   ' >=2.5')
@@ -1268,8 +1264,7 @@
             self.assertRaises(errors.KnitCorrupt, index.keys)
         except TypeError, e:
             if (str(e) == ('exceptions must be strings, classes, or instances,'
-                           ' not exceptions.ValueError')
-                and sys.version_info[0:2] >= (2,5)):
+                           ' not exceptions.ValueError')):
                 self.knownFailure('Pyrex <0.9.5 fails with TypeError when'
                                   ' raising new style exceptions with python'
                                   ' >=2.5')

=== modified file 'bzrlib/tests/test_msgeditor.py'
--- a/bzrlib/tests/test_msgeditor.py	2011-02-07 01:30:38 +0000
+++ b/bzrlib/tests/test_msgeditor.py	2011-05-11 11:35:28 +0000
@@ -368,11 +368,5 @@
         ERROR_BAD_EXE_FORMAT = 193
         file("textfile.txt", "w").close()
         e = self.assertRaises(WindowsError, subprocess.call, "textfile.txt")
-        # Python2.4 used the 'winerror' as the errno, which confuses a lot of
-        # our error trapping code. Make sure that we understand the mapping
-        # correctly.
-        if sys.version_info >= (2, 5):
-            self.assertEqual(e.errno, errno.ENOEXEC)
-            self.assertEqual(e.winerror, ERROR_BAD_EXE_FORMAT)
-        else:
-            self.assertEqual(e.errno, ERROR_BAD_EXE_FORMAT)
+        self.assertEqual(e.errno, errno.ENOEXEC)
+        self.assertEqual(e.winerror, ERROR_BAD_EXE_FORMAT)

=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py	2011-04-15 07:01:22 +0000
+++ b/bzrlib/tests/test_osutils.py	2011-05-11 11:35:28 +0000
@@ -1897,10 +1897,7 @@
         os.symlink(self.target, self.link)
 
     def test_os_readlink_link_encoding(self):
-        if sys.version_info < (2, 6):
-            self.assertRaises(UnicodeEncodeError, os.readlink, self.link)
-        else:
-            self.assertEquals(self.target,  os.readlink(self.link))
+        self.assertEquals(self.target,  os.readlink(self.link))
 
     def test_os_readlink_link_decoding(self):
         self.assertEquals(self.target.encode(osutils._fs_enc),

=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- a/bzrlib/transport/http/_urllib2_wrappers.py	2011-02-03 09:07:25 +0000
+++ b/bzrlib/transport/http/_urllib2_wrappers.py	2011-05-11 11:35:28 +0000
@@ -110,19 +110,10 @@
         self.report_activity(len(s), 'read')
         return s
 
-    # httplib in python 2.4 and 2.5 defines a SSLFile wrapper whose readline
-    # method lacks the size parameter. python2.6 provides a proper ssl socket
-    # and added it. python2.7 uses it, forcing us to provide it.
-    if sys.version_info < (2, 6):
-        def readline(self):
-            s = self.filesock.readline()
-            self.report_activity(len(s), 'read')
-            return s
-    else:
-        def readline(self, size=-1):
-            s = self.filesock.readline(size)
-            self.report_activity(len(s), 'read')
-            return s
+    def readline(self, size=-1):
+        s = self.filesock.readline(size)
+        self.report_activity(len(s), 'read')
+        return s
 
     def __getattr__(self, name):
         return getattr(self.filesock, name)

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-05-10 18:49:54 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-05-11 16:35:34 +0000
@@ -15,6 +15,10 @@
 
 .. These may require users to change the way they use Bazaar.
 
+* ``bzr-2.4`` has officially dropped support for python2.4 and python2.5.
+  We will continue to maintain ``bzr-2.3`` for people who still need to
+  use those versions of python. (John Arbash Meinel)
+
 New Features
 ************
 

=== modified file 'doc/en/whats-new/whats-new-in-2.4.txt'
--- a/doc/en/whats-new/whats-new-in-2.4.txt	2011-05-10 18:49:54 +0000
+++ b/doc/en/whats-new/whats-new-in-2.4.txt	2011-05-11 16:35:34 +0000
@@ -16,6 +16,17 @@
 2.1, 2.2 and 2.3, and can read and write repositories generated by all
 previous versions.
 
+Dropping Python2.4 and Python2.5 support
+****************************************
+
+Bazaar 2.4.0 is the first version of bzr to drop support for python
+versions before 2.6. The 2.3 series will still be maintained in bugfix
+mode for people who need older versions of python. You can also use
+Launchpad to nominate fixes for 2.3. We can't fix everything, but that can
+help guide us to what people are running into. Upgrading to python2.6
+allows us to clean up the syntax in our files, and makes it easier to work
+on python3 compatibility.
+
 External merge tools
 ********************
 

=== modified file 'profile_imports.py'
--- a/profile_imports.py	2010-02-11 04:02:41 +0000
+++ b/profile_imports.py	2011-05-11 11:35:28 +0000
@@ -21,11 +21,7 @@
 import time
 
 
-if sys.version_info < (2, 5, 0):
-    import sre
-    re = sre
-else:
-    import re
+import re
 
 
 _parent_stack = []

=== modified file 'setup.py'
--- a/setup.py	2011-05-11 11:42:36 +0000
+++ b/setup.py	2011-05-11 16:35:34 +0000
@@ -11,8 +11,8 @@
 import sys
 import copy
 
-if sys.version_info < (2, 4):
-    sys.stderr.write("[ERROR] Not a supported Python version. Need 2.4+\n")
+if sys.version_info < (2, 6):
+    sys.stderr.write("[ERROR] Not a supported Python version. Need 2.6+\n")
     sys.exit(1)
 
 # NOTE: The directory containing setup.py, whether run by 'python setup.py' or




More information about the bazaar-commits mailing list