← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/py26 into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/py26 into lp:launchpad.

Commit message:
Remove vestiges of Python 2.5 support.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #570244 in Launchpad itself: "Remove hacks to keep test-suite passing on python2.5"
  https://bugs.launchpad.net/launchpad/+bug/570244

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/py26/+merge/203908

I found a few vestiges of Python 2.5 support still in the codebase.  This cleans them up.
-- 
https://code.launchpad.net/~cjwatson/launchpad/py26/+merge/203908
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/py26 into lp:launchpad.
=== modified file 'bzrplugins/lpserve/test_lpserve.py'
--- bzrplugins/lpserve/test_lpserve.py	2012-11-05 05:34:16 +0000
+++ bzrplugins/lpserve/test_lpserve.py	2014-01-30 10:21:31 +0000
@@ -597,8 +597,7 @@
         self.assertEqual(None, self.service_process.poll())
         # Now when we send SIGTERM, it should wait for the child to exit,
         # before it tries to exit itself.
-        # In python2.6+ we could use self.service_process.terminate()
-        os.kill(self.service_process.pid, sig_id)
+        self.service_process.send_signal(sig_id)
         self.assertEqual(None, self.service_process.poll())
         # Now talk to the child, so the service can close
         stdout_content, stderr_content = self.communicate_with_fork(path)

=== modified file 'lib/lp/services/doc/tarfile_helpers.txt'
--- lib/lp/services/doc/tarfile_helpers.txt	2012-05-25 13:22:27 +0000
+++ lib/lp/services/doc/tarfile_helpers.txt	2014-01-30 10:21:31 +0000
@@ -22,13 +22,10 @@
     ...         if member.type == tarfile.REGTYPE:
     ...             file = tar.extractfile(member)
     ...
-    ...             # XXX: 2010-04-26, Salgado, bug=570244: This is to make
-    ...             # the test pass on python2.5 and 2.6.
-    ...             name = member.name.rstrip('/')
     ...             if file is not None:
-    ...                 print format % (name, file.read())
+    ...                 print format % (member.name, file.read())
     ...             else:
-    ...                 print format % (name, '')
+    ...                 print format % (member.name, '')
     ...         elif member.type == tarfile.SYMTYPE:
     ...             print format % (
     ...                 member.name, "<link to %s>" % member.linkname)

=== modified file 'lib/lp/services/tests/test_helpers.py'
--- lib/lp/services/tests/test_helpers.py	2012-05-25 13:23:11 +0000
+++ lib/lp/services/tests/test_helpers.py	2014-01-30 10:21:31 +0000
@@ -50,9 +50,7 @@
 
     Check the expected files are in the archive.
 
-    # XXX: 2010-04-26, Salgado, bug=570244: This rstrip('/') is to make the
-    # test pass on python2.5 and 2.6.
-    >>> [name.rstrip('/') for name in tarball.getnames()]
+    >>> tarball.getnames()
     ['test', 'test/cy.po', 'test/es.po', 'test/test.pot']
 
     Check the contents.

=== modified file 'lib/lp/translations/doc/poexport-language-pack.txt'
--- lib/lp/translations/doc/poexport-language-pack.txt	2011-12-30 06:14:56 +0000
+++ lib/lp/translations/doc/poexport-language-pack.txt	2014-01-30 10:21:31 +0000
@@ -38,9 +38,7 @@
     ...             size = 'bin'
     ...         else:
     ...             size = len(tarfile.extractfile(member).readlines())
-    ...         # XXX: 2010-04-26, Salgado, bug=570244: The .rstrip('/') is to
-    ...         # make this pass on python2.5 and 2.6.
-    ...         print "| %5s | %s" % (size, member.name.rstrip('/'))
+    ...         print "| %5s | %s" % (size, member.name)
 
 
 Base language pack export using Librarian
@@ -80,9 +78,7 @@
 The tarball has the right members.
 
     >>> for member in tarfile.getmembers():
-    ...     # XXX: 2010-04-26, Salgado, bug=570244: The .rstrip('/') is to
-    ...     # make this pass on python2.5 and 2.6.
-    ...     print member.name.rstrip('/')
+    ...     print member.name
     rosetta-hoary
     ...
     rosetta-hoary/es
@@ -94,13 +90,7 @@
 
 Directory permissions allow correct use of those directories:
 
-    # XXX: 2010-04-26, Salgado, bug=570244: This try/except is needed to make
-    # the test pass on python2.5 and 2.6.
-
-    >>> try:
-    ...     directory = tarfile.getmember('rosetta-hoary/')
-    ... except KeyError:
-    ...     directory = tarfile.getmember('rosetta-hoary')
+    >>> directory = tarfile.getmember('rosetta-hoary')
     >>> oct(directory.mode)
     '0755'
 

=== modified file 'lib/lp/translations/doc/poexport-request-productseries.txt'
--- lib/lp/translations/doc/poexport-request-productseries.txt	2011-12-23 23:44:59 +0000
+++ lib/lp/translations/doc/poexport-request-productseries.txt	2014-01-30 10:21:31 +0000
@@ -89,9 +89,7 @@
     >>> from lp.services.helpers import string_to_tarfile
     >>> tarball = string_to_tarfile(urllib2.urlopen(url).read())
     >>> for name in sorted(tarball.getnames()):
-    ...     # XXX: 2010-04-26, Salgado, bug=570244: The .rstrip('/') is to
-    ...     # make this pass on python2.5 and 2.6.
-    ...     print name.rstrip('/')
+    ...     print name
     evolution-2.2
     evolution-2.2/evolution-2.2-es.po
     po

=== modified file 'lib/lp/translations/doc/poexport-request.txt'
--- lib/lp/translations/doc/poexport-request.txt	2012-06-06 13:44:50 +0000
+++ lib/lp/translations/doc/poexport-request.txt	2014-01-30 10:21:31 +0000
@@ -91,9 +91,7 @@
     >>> from lp.services.helpers import string_to_tarfile
     >>> tarball = string_to_tarfile(urllib2.urlopen(url).read())
     >>> for name in sorted(tarball.getnames()):
-    ...     # XXX: 2010-04-26, Salgado, bug=570244: The .rstrip('/') is to
-    ...     # make this pass on python2.5 and 2.6.
-    ...     print name.rstrip('/')
+    ...     print name
     pmount
     pmount/pmount-ca.po
     pmount/pmount-cs.po

=== modified file 'lib/lp/translations/doc/potemplate.txt'
--- lib/lp/translations/doc/potemplate.txt	2012-12-26 01:32:19 +0000
+++ lib/lp/translations/doc/potemplate.txt	2014-01-30 10:21:31 +0000
@@ -589,10 +589,7 @@
     >>> tarfile_string = exported_translation_file.read()
     >>> tarfile = string_to_tarfile(tarfile_string)
 
-    # XXX: 2010-04-26, Salgado, bug=570244: The .rstrip('/') is to make this
-    # pass on python2.5 and 2.6.
-
-    >>> sorted(name.rstrip('/') for name in tarfile.getnames())
+    >>> sorted(tarfile.getnames())
     ['evolution-2.2', 'evolution-2.2/evolution-2.2-es.po',
      'evolution-2.2/evolution-2.2-ja.po', 'evolution-2.2/evolution-2.2-xh.po',
      'po', 'po/evolution-2.2-pt.po', 'po/evolution-2.2.pot']

=== modified file 'lib/lp/translations/stories/importqueue/xx-translation-import-queue.txt'
--- lib/lp/translations/stories/importqueue/xx-translation-import-queue.txt	2013-09-27 04:13:23 +0000
+++ lib/lp/translations/stories/importqueue/xx-translation-import-queue.txt	2014-01-30 10:21:31 +0000
@@ -79,13 +79,7 @@
     True
     >>> 'empty.po' in anon_browser.contents
     False
-
-    # XXX: 2010-04-26, Salgado, bug=570244: Need this hack to make it pass on
-    # python2.5 (where tarball.getnames() include a trailing slash on
-    # directory names) and python2.6 (where directory names don't get a
-    # trailing slash).
-    >>> ('directory.po' in tarball.getnames()
-    ...  or 'directory.po/' in tarball.getnames())
+    >>> 'directory.po' in tarball.getnames()
     True
     >>> 'directory.po' in anon_browser.contents
     False

=== modified file 'lib/lp/translations/utilities/doc/gettext_mo_exporter.txt'
--- lib/lp/translations/utilities/doc/gettext_mo_exporter.txt	2011-12-23 23:44:59 +0000
+++ lib/lp/translations/utilities/doc/gettext_mo_exporter.txt	2014-01-30 10:21:31 +0000
@@ -91,9 +91,7 @@
     ...         lines = len(tarfile.extractfile(member).readlines())
     ...     else:
     ...         lines = 0
-    ...     # XXX: 2010-04-26, Salgado, bug=570244: The .rstrip('/') is to
-    ...     # make this pass on python2.5 and 2.6.
-    ...     print "| %5d | %s" % (lines, member.name.rstrip('/'))
+    ...     print "| %5d | %s" % (lines, member.name)
     |     0 | es
     |     0 | es/LC_MESSAGES
     |    12 | es/LC_MESSAGES/foo.mo


Follow ups