Merge lp:~salgado/launchpad/python2.5-and-2.6 into lp:launchpad

Proposed by Guilherme Salgado
Status: Merged
Merged at revision: not available
Proposed branch: lp:~salgado/launchpad/python2.5-and-2.6
Merge into: lp:launchpad
Diff against target: 716 lines (+205/-77)
27 files modified
buildout-templates/_pythonpath.py.in (+6/-0)
buildout-templates/bin/test.in (+14/-3)
ez_setup.py (+11/-3)
lib/canonical/buildd/tests/test_generate_translation_templates.py (+1/-1)
lib/canonical/database/ftests/script_isolation.py (+8/-0)
lib/canonical/launchpad/daemons/tachandler.py (+7/-1)
lib/canonical/launchpad/doc/gpghandler.txt (+1/-1)
lib/canonical/launchpad/doc/incomingmail.txt (+1/-1)
lib/canonical/launchpad/testing/googletestservice.py (+1/-1)
lib/canonical/launchpad/tests/test_helpers.py (+4/-2)
lib/canonical/launchpad/utilities/gpghandler.py (+16/-2)
lib/canonical/launchpad/validators/url.py (+7/-1)
lib/canonical/lazr/doc/timeout.txt (+1/-1)
lib/lp/bugs/tests/bugs-emailinterface.txt (+3/-5)
lib/lp/codehosting/puller/tests/test_acceptance.py (+36/-1)
lib/lp/poppy/daemon.py (+7/-0)
lib/lp/services/mailman/doc/deactivate-lists.txt (+4/-2)
lib/lp/soyuz/doc/buildd-dispatching.txt (+2/-2)
lib/lp/soyuz/doc/buildd-slave.txt.disabled (+1/-1)
lib/lp/soyuz/doc/manage-chroot.txt (+1/-1)
lib/lp/translations/doc/poexport-language-pack.txt (+38/-29)
lib/lp/translations/doc/poexport-request-productseries.txt (+5/-3)
lib/lp/translations/doc/poexport-request.txt (+4/-2)
lib/lp/translations/doc/potemplate.txt (+6/-3)
lib/lp/translations/stories/importqueue/xx-translation-import-queue.txt (+7/-3)
lib/lp/translations/utilities/doc/gettext_mo_exporter.txt (+7/-5)
lib/lp/translations/utilities/doc/launchpad_write_tarfile.txt (+6/-3)
To merge this branch: bzr merge lp:~salgado/launchpad/python2.5-and-2.6
Reviewer Review Type Date Requested Status
Gary Poster (community) Approve
Review via email: mp+24121@code.launchpad.net

Description of the change

Make sure the test suite passes on both python2.5 and python2.6.

To post a comment you must log in.
Revision history for this message
Gary Poster (gary) wrote :

merge-conditional

Woohoo!

Edited IRC transcript.

[09:47am] maxb: salgado: Perhaps the DeprecationWarning suppressions that are stopgap measures should all be XXXed before being allowed into trunk?
[09:59am] salgado: maxb, yeah, definitely. I'll do that
[10:02am] gary_poster: maxb, salgado +1. I also wondered if importfascist (or landscape's reimplementation) could somehow not have the behavior you described, but my only interest right now is maybe mentioning this in a bug report as a way to better focus the deprecation warnings again. I don't want to spend time right now thinking about whether that's even possible. Of course, if you know already that it is not possible, nm
[10:06am] gary_poster: salgado, generally would like to see bugs for all of the new XXXs (the py 2.5 hacks in particular--I suggest that they could all be grouped together)
[10:11am] gary_poster: salgado: looking at lines 276-281 of the diff. In lib/lp/bugs/tests/bugs-emailinterface.txt you deleted the following:
[10:11am] gary_poster: -This does not affect the processing. Note though that the filename from
[10:11am] gary_poster: -the content-type header is ignored, even if the content-disposition
[10:11am] gary_poster: -header does not provide a filename.
[10:11am] gary_poster: Is that because in Python 2.6 we now honor the content-type filename?
[10:12am] salgado: gary_poster, yes, and since that doesn't seem to be important to us I've changed the test to not mention it and elide the thing
[10:12am] gary_poster: cool
[10:13am] salgado: gary_poster, I was thinking of having just one bug for the python2.5 hacks left behind
[10:14am] gary_poster: good, yes
[10:15am] gary_poster: salgado: you have this XXX on line 394 of the diff (in lib/lp/services/mailman/doc/deactivate-lists.txt) but not on line 196 (in lib/canonical/launchpad/tests/test_helpers.py). I don't have a strong feeling abot whether it is necessary, but we ought to be consistent. My inclination is to have it be another Python 2.5 XXX.
[10:15am] gary_poster: # XXX: The .rstrip('/') is to make this pass on python2.5 and 2.6.
[10:16am] gary_poster: Actually you are consistent in other places, so it just looks like an oversight that the one in test_helpers.py doesn't have an XXX
[10:16am] salgado: yeah, I missed that
[10:22am] gary_poster: salgado: last topic is that I was looking at mwhudson's bug/hack (https://bugs.edge.launchpad.net/launchpad-code/+bug/564375). The thing I don't see is the proper fix. Is the proper fix in Python's HttpServer? If so, have we made a bug in the Python bug tracker? If not...what do we need to change in the future? If you are not sure, I won't let this keep you from landing, but I would like you and/or mwhudson to follow up in that regard.
[10:25am] salgado: I'm not sure, but I'll comment on the bug asking what the proper fix would be, if that's ok with you
[10:27am] maxb: The proper fix would be for SocketServer to provide a documented way of breaking it out of its select loop
[10:28am] gary_poster: that makes sense, maxb--which would be a Python bug. thanks salgado, yes.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'buildout-templates/_pythonpath.py.in'
--- buildout-templates/_pythonpath.py.in 2010-04-20 19:10:35 +0000
+++ buildout-templates/_pythonpath.py.in 2010-04-27 20:46:29 +0000
@@ -12,7 +12,13 @@
1212
13import os13import os
14import sys14import sys
15import warnings
1516
17# XXX: 2010-04-26, Salgado, bug=570246: Silence python2.6 deprecation
18# warnings.
19warnings.filterwarnings(
20 'ignore', '.*(md5|sha|sets)', DeprecationWarning,
21 )
1622
17site_dir = ${scripts:parts-directory|path-repr}23site_dir = ${scripts:parts-directory|path-repr}
1824
1925
=== modified file 'buildout-templates/bin/test.in'
--- buildout-templates/bin/test.in 2010-04-20 19:10:35 +0000
+++ buildout-templates/bin/test.in 2010-04-27 20:46:29 +0000
@@ -98,7 +98,7 @@
98# need to be silenced should have an accompanied Bug reference.98# need to be silenced should have an accompanied Bug reference.
99#99#
100warnings.filterwarnings(100warnings.filterwarnings(
101 'ignore', 'PyCrypto', RuntimeWarning, 'twisted[.]conch[.]ssh'101 'ignore', 'PyCrypto', RuntimeWarning, 'twisted[.]conch[.]ssh',
102 )102 )
103warnings.filterwarnings(103warnings.filterwarnings(
104 'ignore', 'twisted.python.plugin', DeprecationWarning,104 'ignore', 'twisted.python.plugin', DeprecationWarning,
@@ -107,8 +107,19 @@
107 'ignore', 'zope.testing.doctest', DeprecationWarning,107 'ignore', 'zope.testing.doctest', DeprecationWarning,
108 )108 )
109warnings.filterwarnings(109warnings.filterwarnings(
110 'ignore', 'bzrlib.*was deprecated', DeprecationWarning110 'ignore', 'bzrlib.*was deprecated', DeprecationWarning,
111)111 )
112# XXX: 2010-04-26, Salgado, bug=570246: Silence python2.6 deprecation
113# warnings.
114# We cannot narrow this warnings filter to just twisted because
115# warnings.warn_explicit() sees this import as coming from importfascist, not
116# from twisted. It makes no sense to put module='importfascist' here though
117# because /everything/ gets imported through it. So, sad as it is, until
118# twisted doesn't produce warnings under Python 2.6, just ignore all these
119# deprecations.
120warnings.filterwarnings(
121 'ignore', '.*(md5|sha|sets)', DeprecationWarning,
122 )
112# The next one is caused by a lamosity in python-openid. The following change123# The next one is caused by a lamosity in python-openid. The following change
113# to openid/server/server.py would make the warning filter unnecessary:124# to openid/server/server.py would make the warning filter unnecessary:
114# 978c974,974125# 978c974,974
115126
=== modified file 'ez_setup.py'
--- ez_setup.py 2009-05-31 22:17:45 +0000
+++ ez_setup.py 2010-04-27 20:46:29 +0000
@@ -3,7 +3,6 @@
3# NOTE TO LAUNCHPAD DEVELOPERS: This is a bootstrapping file from the3# NOTE TO LAUNCHPAD DEVELOPERS: This is a bootstrapping file from the
4# setuptools project. It is imported by our setup.py.4# setuptools project. It is imported by our setup.py.
55
6#!python
7"""Bootstrap setuptools installation6"""Bootstrap setuptools installation
87
9If you want to use setuptools in your package's setup.py, just include this8If you want to use setuptools in your package's setup.py, just include this
@@ -19,7 +18,7 @@
19This file can also be run as a script to install or upgrade setuptools.18This file can also be run as a script to install or upgrade setuptools.
20"""19"""
21import sys20import sys
22DEFAULT_VERSION = "0.6c9"21DEFAULT_VERSION = "0.6c11"
23DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]22DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
2423
25md5_data = {24md5_data = {
@@ -33,6 +32,14 @@
33 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',32 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
34 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',33 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
35 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',34 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
35 'setuptools-0.6c10-py2.3.egg': 'ce1e2ab5d3a0256456d9fc13800a7090',
36 'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9b80772c59a53a8433a5dd4',
37 'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97c895572e5e8596aeb8c7',
38 'setuptools-0.6c10-py2.6.egg': '58ea40aef06da02ce641495523a0b7f5',
39 'setuptools-0.6c11-py2.3.egg': '2baeac6e13d414a9d28e7ba5b5a596de',
40 'setuptools-0.6c11-py2.4.egg': 'bd639f9b0eac4c42497034dec2ec0c2b',
41 'setuptools-0.6c11-py2.5.egg': '64c94f3bf7a72a13ec83e0b24f2749b2',
42 'setuptools-0.6c11-py2.6.egg': 'bfa92100bd772d5a213eedd356d64086',
36 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',43 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
37 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',44 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
38 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',45 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
@@ -97,7 +104,7 @@
97 try:104 try:
98 import pkg_resources105 import pkg_resources
99 except ImportError:106 except ImportError:
100 return do_download() 107 return do_download()
101 try:108 try:
102 pkg_resources.require("setuptools>="+version); return109 pkg_resources.require("setuptools>="+version); return
103 except pkg_resources.VersionConflict, e:110 except pkg_resources.VersionConflict, e:
@@ -278,3 +285,4 @@
278285
279286
280287
288
281289
=== modified file 'lib/canonical/buildd/tests/test_generate_translation_templates.py'
--- lib/canonical/buildd/tests/test_generate_translation_templates.py 2010-03-18 13:27:47 +0000
+++ lib/canonical/buildd/tests/test_generate_translation_templates.py 2010-04-27 20:46:29 +0000
@@ -92,7 +92,7 @@
92 os.path.dirname(__file__),'dummy_templates.tar.gz')92 os.path.dirname(__file__),'dummy_templates.tar.gz')
93 tar = tarfile.open(dummy_tar, 'r|*')93 tar = tarfile.open(dummy_tar, 'r|*')
94 tar.extractall(branchdir)94 tar.extractall(branchdir)
95 potnames = [name for name in tar.getnames() if not name.endswith('/')]95 potnames = [member.name for member in tar.getmembers() if not member.isdir()]
96 tar.close()96 tar.close()
9797
98 generator = GenerateTranslationTemplates(98 generator = GenerateTranslationTemplates(
9999
=== modified file 'lib/canonical/database/ftests/script_isolation.py'
--- lib/canonical/database/ftests/script_isolation.py 2009-08-13 15:12:16 +0000
+++ lib/canonical/database/ftests/script_isolation.py 2010-04-27 20:46:29 +0000
@@ -8,6 +8,14 @@
8__metaclass__ = type8__metaclass__ = type
9__all__ = []9__all__ = []
1010
11import warnings
12
13# XXX: 2010-04-26, Salgado, bug=570246: Silence python2.6 deprecation
14# warnings.
15warnings.filterwarnings(
16 'ignore', '.*(md5|sha|sets)', DeprecationWarning,
17 )
18
11from canonical.database.sqlbase import cursor, ISOLATION_LEVEL_SERIALIZABLE19from canonical.database.sqlbase import cursor, ISOLATION_LEVEL_SERIALIZABLE
12from canonical.launchpad.scripts import execute_zcml_for_scripts20from canonical.launchpad.scripts import execute_zcml_for_scripts
13from canonical.lp import initZopeless21from canonical.lp import initZopeless
1422
=== modified file 'lib/canonical/launchpad/daemons/tachandler.py'
--- lib/canonical/launchpad/daemons/tachandler.py 2010-04-05 09:22:54 +0000
+++ lib/canonical/launchpad/daemons/tachandler.py 2010-04-27 20:46:29 +0000
@@ -128,7 +128,13 @@
128 remove_if_exists(self.logfile)128 remove_if_exists(self.logfile)
129129
130 self.setUpRoot()130 self.setUpRoot()
131 args = [sys.executable, twistd_script, '-o', '-y', self.tacfile,131 args = [sys.executable,
132 # XXX: 2010-04-26, Salgado, bug=570246: Deprecation warnings
133 # in Twisted are not our problem. They also aren't easy to
134 # suppress, and cause test failures due to spurious stderr
135 # output. Just shut the whole bloody mess up.
136 '-Wignore::DeprecationWarning',
137 twistd_script, '-o', '-y', self.tacfile,
132 '--pidfile', self.pidfile, '--logfile', self.logfile]138 '--pidfile', self.pidfile, '--logfile', self.logfile]
133 if spew:139 if spew:
134 args.append('--spew')140 args.append('--spew')
135141
=== modified file 'lib/canonical/launchpad/doc/gpghandler.txt'
--- lib/canonical/launchpad/doc/gpghandler.txt 2010-04-20 21:20:43 +0000
+++ lib/canonical/launchpad/doc/gpghandler.txt 2010-04-27 20:46:29 +0000
@@ -332,7 +332,7 @@
332 Traceback (most recent call last):332 Traceback (most recent call last):
333 ...333 ...
334 GPGUploadFailure: Could not reach keyserver at334 GPGUploadFailure: Could not reach keyserver at
335 http://localhost:11371 (111, 'Connection refused')335 http://localhost:11371...Connection refused...
336336
337337
338== Fingerprint sanitizing ==338== Fingerprint sanitizing ==
339339
=== modified file 'lib/canonical/launchpad/doc/incomingmail.txt'
--- lib/canonical/launchpad/doc/incomingmail.txt 2010-03-02 14:37:56 +0000
+++ lib/canonical/launchpad/doc/incomingmail.txt 2010-04-27 20:46:29 +0000
@@ -360,7 +360,7 @@
360 >>> handleMail(transaction)360 >>> handleMail(transaction)
361 ERROR:...:Upload to Librarian failed...361 ERROR:...:Upload to Librarian failed...
362 ...362 ...
363 UploadFailed: [...]: (111, 'Connection refused')363 UploadFailed: ...Connection refused...
364364
365 >>> len(stub.test_emails)365 >>> len(stub.test_emails)
366 2366 2
367367
=== modified file 'lib/canonical/launchpad/testing/googletestservice.py'
--- lib/canonical/launchpad/testing/googletestservice.py 2009-10-17 14:06:03 +0000
+++ lib/canonical/launchpad/testing/googletestservice.py 2010-04-27 20:46:29 +0000
@@ -125,7 +125,7 @@
125 try:125 try:
126 sock.connect((host, port))126 sock.connect((host, port))
127 except socket.error, err:127 except socket.error, err:
128 if err.args[0] == errno.ECONNREFUSED:128 if err.args[0] in [errno.ECONNREFUSED, errno.ECONNABORTED]:
129 elapsed = (time.time() - start)129 elapsed = (time.time() - start)
130 if elapsed > timeout:130 if elapsed > timeout:
131 raise RuntimeError("Socket poll time exceeded.")131 raise RuntimeError("Socket poll time exceeded.")
132132
=== modified file 'lib/canonical/launchpad/tests/test_helpers.py'
--- lib/canonical/launchpad/tests/test_helpers.py 2009-07-17 00:26:05 +0000
+++ lib/canonical/launchpad/tests/test_helpers.py 2010-04-27 20:46:29 +0000
@@ -55,8 +55,10 @@
5555
56 Check the expected files are in the archive.56 Check the expected files are in the archive.
5757
58 >>> tarball.getnames()58 # XXX: 2010-04-26, Salgado, bug=570244: This rstrip('/') is to make the
59 ['test/', 'test/cy.po', 'test/es.po', 'test/test.pot']59 # test pass on python2.5 and 2.6.
60 >>> [name.rstrip('/') for name in tarball.getnames()]
61 ['test', 'test/cy.po', 'test/es.po', 'test/test.pot']
6062
61 Check the contents.63 Check the contents.
6264
6365
=== modified file 'lib/canonical/launchpad/utilities/gpghandler.py'
--- lib/canonical/launchpad/utilities/gpghandler.py 2010-04-20 18:55:06 +0000
+++ lib/canonical/launchpad/utilities/gpghandler.py 2010-04-27 20:46:29 +0000
@@ -160,7 +160,14 @@
160 try:160 try:
161 signatures = ctx.verify(sig, plain, None)161 signatures = ctx.verify(sig, plain, None)
162 except gpgme.GpgmeError, e:162 except gpgme.GpgmeError, e:
163 raise GPGVerificationError(e.message)163 # XXX: 2010-04-26, Salgado, bug=570244: This hack is needed
164 # for python2.5 compatibility. We should remove it when we no
165 # longer need to run on python2.5.
166 if hasattr(e, 'message'):
167 msg = e.message
168 else:
169 msg = e.strerror
170 raise GPGVerificationError(msg)
164 else:171 else:
165 # store clearsigned signature172 # store clearsigned signature
166 sig = StringIO(content)173 sig = StringIO(content)
@@ -170,7 +177,14 @@
170 try:177 try:
171 signatures = ctx.verify(sig, None, plain)178 signatures = ctx.verify(sig, None, plain)
172 except gpgme.GpgmeError, e:179 except gpgme.GpgmeError, e:
173 raise GPGVerificationError(e.message)180 # XXX: 2010-04-26, Salgado, bug=570244: This hack is needed
181 # for python2.5 compatibility. We should remove it when we no
182 # longer need to run on python2.5.
183 if hasattr(e, 'message'):
184 msg = e.message
185 else:
186 msg = e.strerror
187 raise GPGVerificationError(msg)
174188
175 # XXX jamesh 2006-01-31:189 # XXX jamesh 2006-01-31:
176 # We raise an exception if we don't get exactly one signature.190 # We raise an exception if we don't get exactly one signature.
177191
=== modified file 'lib/canonical/launchpad/validators/url.py'
--- lib/canonical/launchpad/validators/url.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/validators/url.py 2010-04-27 20:46:29 +0000
@@ -21,8 +21,14 @@
21 True21 True
22 >>> valid_absolute_url('http://www.example.com')22 >>> valid_absolute_url('http://www.example.com')
23 True23 True
24 >>> valid_absolute_url('whatever://example.com/blah')24 >>> valid_absolute_url('whatever:/uxample.com/blah')
25 False25 False
26
27 # XXX: 2010-04-26, Salgado, bug=570244: This test only works against
28 # python2.6 but we still need to run on python2.5, so we should uncomment
29 # it only when we no longer need to run on 2.5.
30 >>> #valid_absolute_url('whatever://example.com/blah')
31 True
26 """32 """
27 # Have to import urlparse locally since imports from helpers.py33 # Have to import urlparse locally since imports from helpers.py
28 # causes this module to be imported, and we can't import stuff from34 # causes this module to be imported, and we can't import stuff from
2935
=== modified file 'lib/canonical/lazr/doc/timeout.txt'
--- lib/canonical/lazr/doc/timeout.txt 2008-06-23 12:15:18 +0000
+++ lib/canonical/lazr/doc/timeout.txt 2010-04-27 20:46:29 +0000
@@ -173,7 +173,7 @@
173 >>> urlfetch(http_server_url)173 >>> urlfetch(http_server_url)
174 Traceback (most recent call last):174 Traceback (most recent call last):
175 ...175 ...
176 URLError: ...'Connection refused'...176 URLError: ...Connection refused...
177177
178After the listen() is called, connections will hang until accept() is178After the listen() is called, connections will hang until accept() is
179called, so a TimeoutError will be raised.179called, so a TimeoutError will be raised.
180180
=== modified file 'lib/lp/bugs/tests/bugs-emailinterface.txt'
--- lib/lp/bugs/tests/bugs-emailinterface.txt 2010-04-15 14:02:10 +0000
+++ lib/lp/bugs/tests/bugs-emailinterface.txt 2010-04-27 20:46:29 +0000
@@ -2776,10 +2776,8 @@
2776 this is not a real JPG file2776 this is not a real JPG file
27772777
2778Some mail clients append a filename to the content type of attachments.2778Some mail clients append a filename to the content type of attachments.
2779This does not affect the processing. Note though that the filename from2779The content type of the PGP signature is properly detected and thus no bug
2780the content-type header is ignored, even if the content-disposition 2780attachment is created.
2781header does not provide a filename. The content type of the PGP signature
2782is properly detected and thus no bug attchement created.
27832781
2784 >>> submit_mail = """From: Sample Person <test@canonical.com>2782 >>> submit_mail = """From: Sample Person <test@canonical.com>
2785 ... To: new@bugs.canonical.com2783 ... To: new@bugs.canonical.com
@@ -2824,7 +2822,7 @@
2824 >>>2822 >>>
2825 >>> process_email(submit_mail)2823 >>> process_email(submit_mail)
2826 >>> print_attachments(get_latest_added_bug().attachments)2824 >>> print_attachments(get_latest_added_bug().attachments)
2827 LibraryFileAlias unnamed image/jpeg; name="image.jpg" UNSPECIFIED2825 LibraryFileAlias ... image/jpeg; name="image.jpg" UNSPECIFIED
2828 this is not a real JPG file2826 this is not a real JPG file
2829 LibraryFileAlias sourcefile.diff text/x-diff; name="sourcefile1.diff" PATCH2827 LibraryFileAlias sourcefile.diff text/x-diff; name="sourcefile1.diff" PATCH
2830 this should be diff output.2828 this should be diff output.
28312829
=== modified file 'lib/lp/codehosting/puller/tests/test_acceptance.py'
--- lib/lp/codehosting/puller/tests/test_acceptance.py 2010-04-15 01:30:39 +0000
+++ lib/lp/codehosting/puller/tests/test_acceptance.py 2010-04-27 20:46:29 +0000
@@ -8,6 +8,7 @@
88
99
10import os10import os
11import socket
11from subprocess import PIPE, Popen12from subprocess import PIPE, Popen
12import unittest13import unittest
1314
@@ -18,6 +19,8 @@
18from bzrlib.config import TransportConfig19from bzrlib.config import TransportConfig
19from bzrlib import errors20from bzrlib import errors
20from bzrlib.tests import HttpServer21from bzrlib.tests import HttpServer
22from bzrlib.tests.http_server import (
23 TestingHTTPServer, TestingThreadingHTTPServer)
21from bzrlib.transport import get_transport24from bzrlib.transport import get_transport
22from bzrlib.upgrade import upgrade25from bzrlib.upgrade import upgrade
23from bzrlib.urlutils import join as urljoin, local_path_from_url26from bzrlib.urlutils import join as urljoin, local_path_from_url
@@ -33,6 +36,38 @@
33from canonical.testing import ZopelessAppServerLayer36from canonical.testing import ZopelessAppServerLayer
3437
3538
39# XXX MichaelHudson, bug=564375: With changes to the SocketServer module in
40# Python 2.6 the thread created in serveOverHTTP cannot be joined, because
41# HttpServer.stop_server doesn't do enough to get the thread out of the select
42# call in SocketServer.BaseServer.handle_request(). So what follows is
43# slightly horrible code to use the version of handle_request from Python 2.5.
44
45def fixed_handle_request(self):
46 """Handle one request, possibly blocking. """
47 try:
48 request, client_address = self.get_request()
49 except socket.error:
50 return
51 if self.verify_request(request, client_address):
52 try:
53 self.process_request(request, client_address)
54 except:
55 self.handle_error(request, client_address)
56 self.close_request(request)
57
58
59class FixedTHS(TestingHTTPServer):
60 handle_request = fixed_handle_request
61
62
63class FixedTTHS(TestingThreadingHTTPServer):
64 handle_request = fixed_handle_request
65
66
67class FixedHttpServer(HttpServer):
68 http_server_class = {'HTTP/1.0': FixedTHS, 'HTTP/1.1': FixedTTHS}
69
70
36class TestBranchPuller(PullerBranchTestCase):71class TestBranchPuller(PullerBranchTestCase):
37 """Integration tests for the branch puller.72 """Integration tests for the branch puller.
3873
@@ -135,7 +170,7 @@
135170
136 def serveOverHTTP(self):171 def serveOverHTTP(self):
137 """Serve the current directory over HTTP, returning the server URL."""172 """Serve the current directory over HTTP, returning the server URL."""
138 http_server = HttpServer()173 http_server = FixedHttpServer()
139 http_server.start_server()174 http_server.start_server()
140 # Join cleanup added before the tearDown so the tearDown is executed175 # Join cleanup added before the tearDown so the tearDown is executed
141 # first as this tells the thread to die. We then join explicitly as176 # first as this tells the thread to die. We then join explicitly as
142177
=== modified file 'lib/lp/poppy/daemon.py'
--- lib/lp/poppy/daemon.py 2010-03-17 12:26:14 +0000
+++ lib/lp/poppy/daemon.py 2010-04-27 20:46:29 +0000
@@ -9,11 +9,18 @@
9 ]9 ]
1010
11import optparse11import optparse
12import warnings
1213
13from canonical.launchpad.scripts import logger, logger_options14from canonical.launchpad.scripts import logger, logger_options
14from lp.poppy.hooks import Hooks15from lp.poppy.hooks import Hooks
15from lp.poppy.server import run_server16from lp.poppy.server import run_server
1617
18# XXX: 2010-04-26, Salgado, bug=570246: Silence python2.6 deprecation
19# warnings.
20warnings.filterwarnings(
21 'ignore', '.*(md5|sha|sets)', DeprecationWarning,
22 )
23
1724
18def main():25def main():
19 parser = optparse.OptionParser()26 parser = optparse.OptionParser()
2027
=== modified file 'lib/lp/services/mailman/doc/deactivate-lists.txt'
--- lib/lp/services/mailman/doc/deactivate-lists.txt 2009-06-23 19:33:57 +0000
+++ lib/lp/services/mailman/doc/deactivate-lists.txt 2010-04-27 20:46:29 +0000
@@ -42,7 +42,9 @@
42 >>> import tarfile42 >>> import tarfile
43 >>> tarball = tarfile.open(backup_file, 'r:gz')43 >>> tarball = tarfile.open(backup_file, 'r:gz')
44 >>> for name in sorted(tarball.getnames()):44 >>> for name in sorted(tarball.getnames()):
45 ... print name45 ... # XXX: 2010-04-26, Salgado, bug=570244: The .rstrip('/') is to
46 itest-one/46 ... # make this pass on python2.5 and 2.6.
47 ... print name.rstrip('/')
48 itest-one
47 itest-one/config.pck49 itest-one/config.pck
48 itest-one/config.pck.last50 itest-one/config.pck.last
4951
=== modified file 'lib/lp/soyuz/doc/buildd-dispatching.txt'
--- lib/lp/soyuz/doc/buildd-dispatching.txt 2010-04-09 15:46:09 +0000
+++ lib/lp/soyuz/doc/buildd-dispatching.txt 2010-04-27 20:46:29 +0000
@@ -67,10 +67,10 @@
67builder and was reset due to a communication time-out.67builder and was reset due to a communication time-out.
6868
69 >>> builder_set.checkBuilders(logger, transaction)69 >>> builder_set.checkBuilders(logger, transaction)
70 WARNING:root:Resetting builder: http://localhost:9221/ -- (111, 'Connection refused')70 WARNING:root:Resetting builder: http://localhost:9221/...Connection refused...
71 Traceback (most recent call last):71 Traceback (most recent call last):
72 ...72 ...
73 error: (111, 'Connection refused')73 error: ...Connection refused...
7474
75The 'frog' builder was not marked as failed.75The 'frog' builder was not marked as failed.
7676
7777
=== modified file 'lib/lp/soyuz/doc/buildd-slave.txt.disabled'
--- lib/lp/soyuz/doc/buildd-slave.txt.disabled 2010-04-03 03:38:55 +0000
+++ lib/lp/soyuz/doc/buildd-slave.txt.disabled 2010-04-27 20:46:29 +0000
@@ -94,4 +94,4 @@
94 >>> s.info()94 >>> s.info()
95 Traceback (most recent call last):95 Traceback (most recent call last):
96 ...96 ...
97 error: (111, 'Connection refused')97 error: ...Connection refused...
9898
=== modified file 'lib/lp/soyuz/doc/manage-chroot.txt'
--- lib/lp/soyuz/doc/manage-chroot.txt 2009-04-28 12:59:43 +0000
+++ lib/lp/soyuz/doc/manage-chroot.txt 2010-04-27 20:46:29 +0000
@@ -193,6 +193,6 @@
193 ... else:193 ... else:
194 ... print "Did not get expected exception"194 ... print "Did not get expected exception"
195 DEBUG Initialising ChrootManager for 'The Hoary Hedgehog Release for i386 (x86)'195 DEBUG Initialising ChrootManager for 'The Hoary Hedgehog Release for i386 (x86)'
196 Librarian upload failed: [...]: (111, 'Connection refused')196 Librarian upload failed: ...Connection refused...
197197
198 >>> LibrarianLayer.reveal()198 >>> LibrarianLayer.reveal()
199199
=== modified file 'lib/lp/translations/doc/poexport-language-pack.txt'
--- lib/lp/translations/doc/poexport-language-pack.txt 2009-11-17 09:50:33 +0000
+++ lib/lp/translations/doc/poexport-language-pack.txt 2010-04-27 20:46:29 +0000
@@ -55,7 +55,9 @@
55 ... size = 'bin'55 ... size = 'bin'
56 ... else:56 ... else:
57 ... size = len(tarfile.extractfile(member).readlines())57 ... size = len(tarfile.extractfile(member).readlines())
58 ... print "| %5s | %s" % (size, member.name)58 ... # XXX: 2010-04-26, Salgado, bug=570244: The .rstrip('/') is to
59 ... # make this pass on python2.5 and 2.6.
60 ... print "| %5s | %s" % (size, member.name.rstrip('/'))
5961
6062
61== Base language pack export using Librarian ==63== Base language pack export using Librarian ==
@@ -92,12 +94,14 @@
9294
93The tarball has the right members.95The tarball has the right members.
9496
95 >>> for name in tarfile.getnames():97 >>> for member in tarfile.getmembers():
96 ... print name98 ... # XXX: 2010-04-26, Salgado, bug=570244: The .rstrip('/') is to
97 rosetta-hoary/99 ... # make this pass on python2.5 and 2.6.
100 ... print member.name.rstrip('/')
101 rosetta-hoary
98 ...102 ...
99 rosetta-hoary/es/103 rosetta-hoary/es
100 rosetta-hoary/es/LC_MESSAGES/104 rosetta-hoary/es/LC_MESSAGES
101 rosetta-hoary/es/LC_MESSAGES/pmount.po105 rosetta-hoary/es/LC_MESSAGES/pmount.po
102 ...106 ...
103 rosetta-hoary/timestamp.txt107 rosetta-hoary/timestamp.txt
@@ -105,7 +109,12 @@
105109
106Directory permissions allow correct use of those directories:110Directory permissions allow correct use of those directories:
107111
108 >>> directory = tarfile.getmember('rosetta-hoary/')112 # XXX: 2010-04-26, Salgado, bug=570244: This try/except is needed to make
113 # the test pass on python2.5 and 2.6.
114 >>> try:
115 ... directory = tarfile.getmember('rosetta-hoary/')
116 ... except KeyError:
117 ... directory = tarfile.getmember('rosetta-hoary')
109 >>> oct(directory.mode)118 >>> oct(directory.mode)
110 '0755'119 '0755'
111120
@@ -223,11 +232,11 @@
223232
224 >>> tarfile = string_to_tarfile(language_pack.file.read())233 >>> tarfile = string_to_tarfile(language_pack.file.read())
225 >>> examine_tarfile(tarfile)234 >>> examine_tarfile(tarfile)
226 | - | rosetta-grumpy/235 | - | rosetta-grumpy
227 | 1 | rosetta-grumpy/mapping.txt236 | 1 | rosetta-grumpy/mapping.txt
228 | 1 | rosetta-grumpy/timestamp.txt237 | 1 | rosetta-grumpy/timestamp.txt
229 | - | rosetta-grumpy/xpi/238 | - | rosetta-grumpy/xpi
230 | - | rosetta-grumpy/xpi/firefox/239 | - | rosetta-grumpy/xpi/firefox
231 | bin | rosetta-grumpy/xpi/firefox/en-US.xpi240 | bin | rosetta-grumpy/xpi/firefox/en-US.xpi
232 | 94 | rosetta-grumpy/xpi/firefox/en.po241 | 94 | rosetta-grumpy/xpi/firefox/en.po
233 | 102 | rosetta-grumpy/xpi/firefox/es.po242 | 102 | rosetta-grumpy/xpi/firefox/es.po
@@ -345,17 +354,17 @@
345 # Get the generated tarball.354 # Get the generated tarball.
346 >>> tarfile = string_to_tarfile(language_pack.file.read())355 >>> tarfile = string_to_tarfile(language_pack.file.read())
347 >>> examine_tarfile(tarfile)356 >>> examine_tarfile(tarfile)
348 | - | rosetta-grumpy/357 | - | rosetta-grumpy
349 | - | rosetta-grumpy/cy/358 | - | rosetta-grumpy/cy
350 | - | rosetta-grumpy/cy/LC_MESSAGES/359 | - | rosetta-grumpy/cy/LC_MESSAGES
351 | 21 | rosetta-grumpy/cy/LC_MESSAGES/test.po360 | 21 | rosetta-grumpy/cy/LC_MESSAGES/test.po
352 | - | rosetta-grumpy/es/361 | - | rosetta-grumpy/es
353 | - | rosetta-grumpy/es/LC_MESSAGES/362 | - | rosetta-grumpy/es/LC_MESSAGES
354 | 21 | rosetta-grumpy/es/LC_MESSAGES/test.po363 | 21 | rosetta-grumpy/es/LC_MESSAGES/test.po
355 | 2 | rosetta-grumpy/mapping.txt364 | 2 | rosetta-grumpy/mapping.txt
356 | 1 | rosetta-grumpy/timestamp.txt365 | 1 | rosetta-grumpy/timestamp.txt
357 | - | rosetta-grumpy/xpi/366 | - | rosetta-grumpy/xpi
358 | - | rosetta-grumpy/xpi/firefox/367 | - | rosetta-grumpy/xpi/firefox
359 | bin | rosetta-grumpy/xpi/firefox/en-US.xpi368 | bin | rosetta-grumpy/xpi/firefox/en-US.xpi
360 | 94 | rosetta-grumpy/xpi/firefox/en.po369 | 94 | rosetta-grumpy/xpi/firefox/en.po
361 | 102 | rosetta-grumpy/xpi/firefox/es.po370 | 102 | rosetta-grumpy/xpi/firefox/es.po
@@ -444,14 +453,14 @@
444xpi entries because those are outside the scope of this test.453xpi entries because those are outside the scope of this test.
445454
446 >>> examine_tarfile(tarfile)455 >>> examine_tarfile(tarfile)
447 | - | rosetta-grumpy/456 | - | rosetta-grumpy
448 | - | rosetta-grumpy/cy/457 | - | rosetta-grumpy/cy
449 | - | rosetta-grumpy/cy/LC_MESSAGES/458 | - | rosetta-grumpy/cy/LC_MESSAGES
450 | 21 | rosetta-grumpy/cy/LC_MESSAGES/test.po459 | 21 | rosetta-grumpy/cy/LC_MESSAGES/test.po
451 | 2 | rosetta-grumpy/mapping.txt460 | 2 | rosetta-grumpy/mapping.txt
452 | 1 | rosetta-grumpy/timestamp.txt461 | 1 | rosetta-grumpy/timestamp.txt
453 | - | rosetta-grumpy/xpi/462 | - | rosetta-grumpy/xpi
454 | - | rosetta-grumpy/xpi/firefox/463 | - | rosetta-grumpy/xpi/firefox
455 | bin | rosetta-grumpy/xpi/firefox/en-US.xpi464 | bin | rosetta-grumpy/xpi/firefox/en-US.xpi
456 | 94 | rosetta-grumpy/xpi/firefox/en.po465 | 94 | rosetta-grumpy/xpi/firefox/en.po
457 | 102 | rosetta-grumpy/xpi/firefox/es.po466 | 102 | rosetta-grumpy/xpi/firefox/es.po
@@ -489,17 +498,17 @@
489498
490 >>> tarfile = string_to_tarfile(language_pack.file.read())499 >>> tarfile = string_to_tarfile(language_pack.file.read())
491 >>> examine_tarfile(tarfile)500 >>> examine_tarfile(tarfile)
492 | - | rosetta-grumpy/501 | - | rosetta-grumpy
493 | - | rosetta-grumpy/cy/502 | - | rosetta-grumpy/cy
494 | - | rosetta-grumpy/cy/LC_MESSAGES/503 | - | rosetta-grumpy/cy/LC_MESSAGES
495 | 21 | rosetta-grumpy/cy/LC_MESSAGES/test.po504 | 21 | rosetta-grumpy/cy/LC_MESSAGES/test.po
496 | - | rosetta-grumpy/es/505 | - | rosetta-grumpy/es
497 | - | rosetta-grumpy/es/LC_MESSAGES/506 | - | rosetta-grumpy/es/LC_MESSAGES
498 | 21 | rosetta-grumpy/es/LC_MESSAGES/test.po507 | 21 | rosetta-grumpy/es/LC_MESSAGES/test.po
499 | 2 | rosetta-grumpy/mapping.txt508 | 2 | rosetta-grumpy/mapping.txt
500 | 1 | rosetta-grumpy/timestamp.txt509 | 1 | rosetta-grumpy/timestamp.txt
501 | - | rosetta-grumpy/xpi/510 | - | rosetta-grumpy/xpi
502 | - | rosetta-grumpy/xpi/firefox/511 | - | rosetta-grumpy/xpi/firefox
503 | bin | rosetta-grumpy/xpi/firefox/en-US.xpi512 | bin | rosetta-grumpy/xpi/firefox/en-US.xpi
504 | 94 | rosetta-grumpy/xpi/firefox/en.po513 | 94 | rosetta-grumpy/xpi/firefox/en.po
505 | 102 | rosetta-grumpy/xpi/firefox/es.po514 | 102 | rosetta-grumpy/xpi/firefox/es.po
506515
=== modified file 'lib/lp/translations/doc/poexport-request-productseries.txt'
--- lib/lp/translations/doc/poexport-request-productseries.txt 2010-03-05 15:31:22 +0000
+++ lib/lp/translations/doc/poexport-request-productseries.txt 2010-04-27 20:46:29 +0000
@@ -90,10 +90,12 @@
90 >>> from canonical.launchpad.helpers import string_to_tarfile90 >>> from canonical.launchpad.helpers import string_to_tarfile
91 >>> tarball = string_to_tarfile(urllib2.urlopen(url).read())91 >>> tarball = string_to_tarfile(urllib2.urlopen(url).read())
92 >>> for name in sorted(tarball.getnames()):92 >>> for name in sorted(tarball.getnames()):
93 ... print name93 ... # XXX: 2010-04-26, Salgado, bug=570244: The .rstrip('/') is to
94 evolution-2.2/94 ... # make this pass on python2.5 and 2.6.
95 ... print name.rstrip('/')
96 evolution-2.2
95 evolution-2.2/evolution-2.2-es.po97 evolution-2.2/evolution-2.2-es.po
96 po/98 po
97 po/evolution-2.2-test-pt_BR.po99 po/evolution-2.2-test-pt_BR.po
98 po/evolution-2.2-test.pot100 po/evolution-2.2-test.pot
99 po/evolution-2.2.pot101 po/evolution-2.2.pot
100102
=== modified file 'lib/lp/translations/doc/poexport-request.txt'
--- lib/lp/translations/doc/poexport-request.txt 2010-03-05 20:40:40 +0000
+++ lib/lp/translations/doc/poexport-request.txt 2010-04-27 20:46:29 +0000
@@ -108,8 +108,10 @@
108 >>> from canonical.launchpad.helpers import string_to_tarfile108 >>> from canonical.launchpad.helpers import string_to_tarfile
109 >>> tarball = string_to_tarfile(urllib2.urlopen(url).read())109 >>> tarball = string_to_tarfile(urllib2.urlopen(url).read())
110 >>> for name in sorted(tarball.getnames()):110 >>> for name in sorted(tarball.getnames()):
111 ... print name111 ... # XXX: 2010-04-26, Salgado, bug=570244: The .rstrip('/') is to
112 pmount/112 ... # make this pass on python2.5 and 2.6.
113 ... print name.rstrip('/')
114 pmount
113 pmount/pmount-ca.po115 pmount/pmount-ca.po
114 pmount/pmount-cs.po116 pmount/pmount-cs.po
115117
116118
=== modified file 'lib/lp/translations/doc/potemplate.txt'
--- lib/lp/translations/doc/potemplate.txt 2009-11-01 22:50:17 +0000
+++ lib/lp/translations/doc/potemplate.txt 2010-04-27 20:46:29 +0000
@@ -619,10 +619,13 @@
619 >>> from canonical.launchpad.helpers import string_to_tarfile619 >>> from canonical.launchpad.helpers import string_to_tarfile
620 >>> tarfile_string = exported_translation_file.read()620 >>> tarfile_string = exported_translation_file.read()
621 >>> tarfile = string_to_tarfile(tarfile_string)621 >>> tarfile = string_to_tarfile(tarfile_string)
622 >>> sorted(tarfile.getnames())622
623 ['evolution-2.2/', 'evolution-2.2/evolution-2.2-es.po',623 # XXX: 2010-04-26, Salgado, bug=570244: The .rstrip('/') is to make this
624 # pass on python2.5 and 2.6.
625 >>> sorted(name.rstrip('/') for name in tarfile.getnames())
626 ['evolution-2.2', 'evolution-2.2/evolution-2.2-es.po',
624 'evolution-2.2/evolution-2.2-ja.po', 'evolution-2.2/evolution-2.2-xh.po',627 'evolution-2.2/evolution-2.2-ja.po', 'evolution-2.2/evolution-2.2-xh.po',
625 'po/', 'po/evolution-2.2.pot']628 'po', 'po/evolution-2.2.pot']
626629
627The *-es.po file is indeed the Spanish translation...630The *-es.po file is indeed the Spanish translation...
628631
629632
=== modified file 'lib/lp/translations/stories/importqueue/xx-translation-import-queue.txt'
--- lib/lp/translations/stories/importqueue/xx-translation-import-queue.txt 2010-01-19 12:35:33 +0000
+++ lib/lp/translations/stories/importqueue/xx-translation-import-queue.txt 2010-04-27 20:46:29 +0000
@@ -79,10 +79,14 @@
79 True79 True
80 >>> 'empty.po' in anon_browser.contents80 >>> 'empty.po' in anon_browser.contents
81 False81 False
82 >>> 'directory.po/' in tarball.getnames()82
83 # XXX: 2010-04-26, Salgado, bug=570244: Need this hack to make it pass on
84 # python2.5 (where tarball.getnames() include a trailing slash on
85 # directory names) and python2.6 (where directory names don't get a
86 # trailing slash).
87 >>> ('directory.po' in tarball.getnames()
88 ... or 'directory.po/' in tarball.getnames())
83 True89 True
84 >>> 'directory.po/' in anon_browser.contents
85 False
86 >>> 'directory.po' in anon_browser.contents90 >>> 'directory.po' in anon_browser.contents
87 False91 False
88 >>> 'directory.po/.another-dotfile.po' in tarball.getnames()92 >>> 'directory.po/.another-dotfile.po' in tarball.getnames()
8993
=== modified file 'lib/lp/translations/utilities/doc/gettext_mo_exporter.txt'
--- lib/lp/translations/utilities/doc/gettext_mo_exporter.txt 2009-07-02 17:16:50 +0000
+++ lib/lp/translations/utilities/doc/gettext_mo_exporter.txt 2010-04-27 20:46:29 +0000
@@ -79,12 +79,14 @@
79 ... lines = len(tarfile.extractfile(member).readlines())79 ... lines = len(tarfile.extractfile(member).readlines())
80 ... else:80 ... else:
81 ... lines = 081 ... lines = 0
82 ... print "| %5d | %s" % (lines, member.name)82 ... # XXX: 2010-04-26, Salgado, bug=570244: The .rstrip('/') is to
83 | 0 | es/83 ... # make this pass on python2.5 and 2.6.
84 | 0 | es/LC_MESSAGES/84 ... print "| %5d | %s" % (lines, member.name.rstrip('/'))
85 | 0 | es
86 | 0 | es/LC_MESSAGES
85 | 12 | es/LC_MESSAGES/foo.mo87 | 12 | es/LC_MESSAGES/foo.mo
86 | 0 | sr/88 | 0 | sr
87 | 0 | sr/LC_MESSAGES/89 | 0 | sr/LC_MESSAGES
88 | 12 | sr/LC_MESSAGES/foo.mo90 | 12 | sr/LC_MESSAGES/foo.mo
8991
9092
9193
=== modified file 'lib/lp/translations/utilities/doc/launchpad_write_tarfile.txt'
--- lib/lp/translations/utilities/doc/launchpad_write_tarfile.txt 2009-07-01 20:45:39 +0000
+++ lib/lp/translations/utilities/doc/launchpad_write_tarfile.txt 2010-04-27 20:46:29 +0000
@@ -20,6 +20,9 @@
20 ... for name in names:20 ... for name in names:
21 ... file = tarfile.extractfile(name)21 ... file = tarfile.extractfile(name)
22 ...22 ...
23 ... # XXX: 2010-04-26, Salgado, bug=570244: This is to make the
24 ... # test pass on python2.5 and 2.6.
25 ... name = name.rstrip('/')
23 ... if file is not None:26 ... if file is not None:
24 ... print format % (name, file.read())27 ... print format % (name, file.read())
25 ... else:28 ... else:
@@ -96,9 +99,9 @@
96 ... 'uno/dos/tres/cuatro': 'blah'99 ... 'uno/dos/tres/cuatro': 'blah'
97 ... })100 ... })
98 >>> examine_tarfile(archive)101 >>> examine_tarfile(archive)
99 uno/ | 102 uno |
100 uno/dos/ | 103 uno/dos |
101 uno/dos/tres/ | 104 uno/dos/tres |
102 uno/dos/tres/cuatro | blah105 uno/dos/tres/cuatro | blah
103106
104Also, if there is a duplicated file, last one is the one that remains there.107Also, if there is a duplicated file, last one is the one that remains there.