Merge lp:~gary/launchpad/buildout-py into lp:launchpad
- buildout-py
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Barry Warsaw |
Approved revision: | no longer in the source branch. |
Merged at revision: | not available |
Proposed branch: | lp:~gary/launchpad/buildout-py |
Merge into: | lp:launchpad |
Diff against target: |
889 lines 36 files modified
Makefile (+1/-1) buildmailman.py (+28/-1) buildout-templates/_pythonpath.py.in (+70/-12) buildout-templates/bin/py.in (+0/-2) buildout-templates/bin/test.in (+11/-7) buildout.cfg (+1/-1) cronscripts/check-teamparticipation.py (+2/-2) cronscripts/create-debwatches.py (+1/-1) cronscripts/update-debwatches.py (+1/-1) cronscripts/update-remote-product.py (+1/-1) cronscripts/update-sourceforge-remote-products.py (+1/-1) lib/canonical/launchpad/rest/configuration.py (+1/-0) lib/lp/codehosting/tests/test_lpserve.py (+30/-1) lib/lp/services/scripts/tests/test_all_scripts.py (+4/-2) lib/site.py (+20/-0) scripts/bug-export.py (+2/-2) scripts/bug-import.py (+2/-2) scripts/cache-country-mirrors.py (+3/-3) scripts/entitlements-to-lp.py (+3/-4) scripts/find-email-clusters.py (+1/-2) scripts/ftpmaster-tools/remove-package.py (+6/-6) scripts/ftpmaster-tools/sync-source.py (+1/-1) scripts/import-packagenames.py (+1/-1) scripts/merge-email-clusters.py (+1/-2) scripts/mlist-import.py (+3/-3) scripts/mlist-sync.py (+3/-3) scripts/rosetta/remove-upstream-translations.py (+1/-2) scripts/sourceforge-import.py (+3/-3) scripts/update-bzr-version-info.sh (+1/-1) scripts/upload2librarian.py (+2/-1) utilities/check-scripts.py (+2/-1) utilities/ec2 (+3/-7) utilities/lsconf.py (+3/-3) utilities/paste (+2/-4) utilities/windmill.py (+0/-15) versions.cfg (+4/-4) |
To merge this branch: | bzr merge lp:~gary/launchpad/buildout-py |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Barry Warsaw (community) | Approve | ||
Review via email: mp+13474@code.launchpad.net |
Commit message
Fix build and tests for Karmic (primarily, but not exclusively, handling namespace packages like lazr being in site-packages)
Description of the change
Gary Poster (gary) wrote : | # |
Barry Warsaw (barry) wrote : | # |
On Oct 16, 2009, at 02:30 PM, Gary Poster wrote:
>Gary Poster has proposed merging lp:~gary/launchpad/buildout-py into lp:launchpad/devel.
>
> Requested reviews:
> Barry Warsaw (barry)
>
>
>The main goal of this branch was to get the build working when lazr packages were installed into the system. When you have the same namespace ("lazr," for instance) in site-packages and in eggs, the site-package namespace package would mask all of the eggs in the same namespace.
Hi Gary,
Thanks so much for working on this branch. From all the discussions we had about it, I'm sure it was "fun". :)
>When reviewing, in addition to looking at the diff in Launchpad, you should probably also look at the changes in the scripts that buildout is producing. The ``bin/py`` script, for instance, is wildly different now: it used to use PYTHONPATH, and now it uses the faux-interpreter that buildout produces.
I'm going to try the branch out as part of the review, though I might do that in two separate responses.
>The ``bin/py`` script is worth calling out for another reason. Codehosting noticed a marked increase in slowness when 3.0 launched, and investigated to find that at least some of the problem may be put on setuptools' door. Michael Hudson reported that the speed to start a Python interpreter increased quadratically based on the length of sys.path. One of the codehosting tools relies on starting an Python process for every operation, so this start-up time is noticeable. I was a bit worried that my changes in this branch would exacerbate the problem, because ``bin/py`` has moved from a bash script relying on PYTHONPATH to pass its configuration to a buildout-generated faux interpreter. According to tests of ``time bin/py -c ''`` in the old and new versions, the speed is about the same (between .2 and .3 seconds on my machine, about a factor of ten slower than ``time python2.4 -c ''``). Therefore, at least I have not made the problem worse.
That's good. I'm fairly concerned about the quadratic impact of long sys.path entries. This is something we should pursue in upstream, especially if super long sys.paths are going to be a common occurrence with buildout (or virtualenv or pip) based development.
>Since bin/py is now a faux-interpreter, it does not support the -t option ("issue warnings about inconsistent tab usage"). We use that option a few times in the Makefile, so I call the faux Python interpreter with the actual Python executable, and give the -t flag to the real executable.
Does it make sense to try to extend bin/py to understand -t? That's probably an upstream change, and if so, out of scope right now for this branch. IWBNI bin/py understood all the command line options that `python` understood.
>buildmailman.py:
>
>Thanks to Barry Warsaw's inspiration, I was able to have Mailman use the correct paths (and get the fix for namespace packages described at the start of this comment) by simply telling it to configure using bin/py rather than the actual Python executable.
And you trusted that Barry guy? You're brave and gullible. But okay, I'll let this one slide.
:)
>We now use a buildout-generated faux-interpreter for bin/py,...
Francis J. Lacoste (flacoste) wrote : | # |
On October 16, 2009, Gary Poster wrote:
> lib/site.py:
>
> This is the hack--forking the Python standard library site.py--that I am
> saddest about in this branch. I talked about it with Francis Lacoste and
> he blessed the approach, under the circumstances. I also have described
> it to Barry Warsaw and Björn Tillenius, so they are at least aware, if not
> necessarily accepting.
>
> The comment at the top describes the rationale, and highlights the
> change. If PEP 382 (namespace packages,
> http://
> then hopefully we can get rid of this fork, as well as some of the other
> more unpleasant bits in this branch. That won't be till Python 2.7 at the
> soonest, though.
>
> You should not have to review the file after this block, near the very top:
>
> +try:
> + __import_
> namespace. +except ImportError:
> + pass
>
> Everything else is from the Python (2.5) standard library.
>
Instead of copying the file content couldn't we simply use execfile
"/usr/lib/
"/usr/lib/
--
Francis J. Lacoste
<email address hidden>
Barry Warsaw (barry) wrote : | # |
On Oct 16, 2009, at 3:15 PM, Francis J. Lacoste wrote:
> Instead of copying the file content couldn't we simply use execfile
> "/usr/lib/
> "/usr/lib/
We're way ahead of ya Francis! :)
-Barry
Francis J. Lacoste (flacoste) wrote : | # |
On October 16, 2009, Barry Warsaw wrote:
> On Oct 16, 2009, at 3:15 PM, Francis J. Lacoste wrote:
> > Instead of copying the file content couldn't we simply use execfile
> > "/usr/lib/
> > "/usr/lib/
>
> We're way ahead of ya Francis! :)
>
> -Barry
>
Yeah, I noticed :-)
--
Francis J. Lacoste
<email address hidden>
Gary Poster (gary) wrote : | # |
On Oct 16, 2009, at 1:08 PM, Barry Warsaw wrote:
> On Oct 16, 2009, at 02:30 PM, Gary Poster wrote:
>
>> Gary Poster has proposed merging lp:~gary/launchpad/buildout-py
>> into lp:launchpad/devel.
>>
>> Requested reviews:
>> Barry Warsaw (barry)
>>
>>
>> The main goal of this branch was to get the build working when lazr
>> packages were installed into the system. When you have the same
>> namespace ("lazr," for instance) in site-packages and in eggs, the
>> site-package namespace package would mask all of the eggs in the
>> same namespace.
>
> Hi Gary,
>
> Thanks so much for working on this branch. From all the discussions
> we had about it, I'm sure it was "fun". :)
:-) yup.
>> When reviewing, in addition to looking at the diff in Launchpad,
>> you should probably also look at the changes in the scripts that
>> buildout is producing. The ``bin/py`` script, for instance, is
>> wildly different now: it used to use PYTHONPATH, and now it uses
>> the faux-interpreter that buildout produces.
>
> I'm going to try the branch out as part of the review, though I
> might do that in two separate responses.
>
>> The ``bin/py`` script is worth calling out for another reason.
>> Codehosting noticed a marked increase in slowness when 3.0
>> launched, and investigated to find that at least some of the
>> problem may be put on setuptools' door. Michael Hudson reported
>> that the speed to start a Python interpreter increased
>> quadratically based on the length of sys.path. One of the
>> codehosting tools relies on starting an Python process for every
>> operation, so this start-up time is noticeable. I was a bit
>> worried that my changes in this branch would exacerbate the
>> problem, because ``bin/py`` has moved from a bash script relying on
>> PYTHONPATH to pass its configuration to a buildout-generated faux
>> interpreter. According to tests of ``time bin/py -c ''`` in the
>> old and new versions, the speed is about the same (between .2 and .
>> 3 seconds on my machine, about a factor of ten slower than ``time
>> python2.4 -c ''``). Therefore, at least I have not made the
>> problem worse.
>
> That's good. I'm fairly concerned about the quadratic impact of
> long sys.path entries. This is something we should pursue in
> upstream, especially if super long sys.paths are going to be a
> common occurrence with buildout (or virtualenv or pip) based
> development.
Agreed. Francis has already mentioned maybe pursuing Distribute.
Maybe we should be working with them and trying to fix this there,
>> Since bin/py is now a faux-interpreter, it does not support the -t
>> option ("issue warnings about inconsistent tab usage"). We use
>> that option a few times in the Makefile, so I call the faux Python
>> interpreter with the actual Python executable, and give the -t flag
>> to the real executable.
>
> Does it make sense to try to extend bin/py to understand -t? That's
> probably an upstream change, and if so, out of scope right now for
> this branch. IWBNI bin/py understood all the command line options
> that `python` understood.
It would be nice if it understood ...
Gary Poster (gary) wrote : | # |
Barry, we've got problems. Mailman problems, specifically.
Karmic accepts interpreters that themselves are interpreted scripts in the shebang line. Hardy, not so much, it seems.
This means that the nice Mailman build hack of ``'--with-python=' + os.path.
I'm not quite sure what to do about this yet, but it definitely means I can't land the branch as is.
Barry Warsaw (barry) wrote : | # |
/me cries. Okay, will think about this over the weekend.
Gary Poster (gary) wrote : | # |
Here's an idea: use ``#! /usr/bin/env {path-to-bin/py}`` instead of ``#! {path-to-bin/py}``. Make that modification after Mailman's ``make`` and before ``make install`` (because Mailman's ``make install`` tries to run ``bin/update``). It seemed to work as a technique when I experimented yesterday on the ec2 instance. I don't see a downside yet (other than the small amount of code to do the hack). It should work. I'll push and give it a try on ec2.
The incremental diff below also switches bin/py back to a shell script. This seemed to make the Mailman pofile creation happier on hardy than the zc.buildout Python version that I had switched to for this branch. It also meant that I could go back to using -t normally in the Makefile. (I had switched from the shell version primarily because I didn't know I would have to get a shell version working; now that we have the site.py hack, it works fine.)
=== modified file 'Makefile'
--- Makefile 2009-10-13 18:50:35 +0000
+++ Makefile 2009-10-17 17:46:38 +0000
@@ -82,7 +82,7 @@
check: clean build
# Run all tests. test_on_merge.py takes care of setting up the
# database.
- ${PYTHON} -t ${PY} ./test_on_merge.py $(VERBOSITY)
+ ${PY} -t ./test_on_merge.py $(VERBOSITY)
jscheck: build
# Run all JavaScript integration tests. The test runner takes care of
@@ -103,7 +103,7 @@
check_mailman: build
# Run all tests, including the Mailman integration
# tests. test_on_merge.py takes care of setting up the database.
- ${PYTHON} -t ${PY} ./test_on_merge.py $(VERBOSITY) --layer=
+ ${PY} -t ./test_on_merge.py $(VERBOSITY) --layer=
lint: ${PY}
@bash ./bin/lint.sh
@@ -112,7 +112,7 @@
@bash ./bin/lint.sh -v
xxxreport: $(PY)
- ${PYTHON} -t ${PY} ./utilities/
+ ${PY} -t ./utilities/
check-configs: $(PY)
${PY} utilities/
@@ -149,7 +149,7 @@
compile: $(PY)
${SHHH} $(MAKE) -C sourcecode build PYTHON=${PYTHON} \
PYTHON_
- ${SHHH} LPCONFIG=
+ ${SHHH} LPCONFIG=
${SHHH} $(PY) sourcecode/
-n launchpad -s lib/canonical/
-b lib/canonical/
=== modified file 'buildmailman.py'
--- buildmailman.py 2009-10-15 04:19:54 +0000
+++ buildmailman.py 2009-10-18 00:59:56 +0000
@@ -84,25 +84,52 @@
# Build and install the Mailman software. Note that we don't care about
# --with-cgi-gid because we're not going to use that Mailman subsystem.
+ executable = os.path.
configure_args = (
- '--with-python=' + os.path.
+ '--with-python=' + executable,
)
+ # Configure.
retcode = subprocess.call(...
Gary Poster (gary) wrote : | # |
That builds!
It turns out you also need this to start the tests, as you might expect:
=== modified file 'buildout-
--- buildout-
+++ buildout-
@@ -1,4 +1,4 @@
-#!${buildout:
+#! /usr/bin/env ${buildout:
######
#
# Copyright (c) 2004 Zope Corporation and Contributors.
Gary Poster (gary) wrote : | # |
The tests pass on ec2.
I think the changes in the last two incremental diffs are substantive enough that I should wait for a mini-review; but once I have a blessing, I'll submit directly to PQM.
Gary
Barry Warsaw (barry) wrote : | # |
Nice hack! If it works, JFDI.
Preview Diff
1 | === modified file 'Makefile' |
2 | --- Makefile 2009-10-13 11:08:30 +0000 |
3 | +++ Makefile 2009-10-18 01:33:15 +0000 |
4 | @@ -149,7 +149,7 @@ |
5 | compile: $(PY) |
6 | ${SHHH} $(MAKE) -C sourcecode build PYTHON=${PYTHON} \ |
7 | PYTHON_VERSION=${PYTHON_VERSION} LPCONFIG=${LPCONFIG} |
8 | - ${SHHH} LPCONFIG=${LPCONFIG} $(PY) -t buildmailman.py |
9 | + ${SHHH} LPCONFIG=${LPCONFIG} ${PY} -t buildmailman.py |
10 | ${SHHH} $(PY) sourcecode/lazr-js/tools/build.py \ |
11 | -n launchpad -s lib/canonical/launchpad/javascript \ |
12 | -b lib/canonical/launchpad/icing/build $(EXTRA_JS_FILES) |
13 | |
14 | === modified file 'buildmailman.py' |
15 | --- buildmailman.py 2009-09-11 02:17:29 +0000 |
16 | +++ buildmailman.py 2009-10-18 01:33:15 +0000 |
17 | @@ -84,25 +84,52 @@ |
18 | |
19 | # Build and install the Mailman software. Note that we don't care about |
20 | # --with-cgi-gid because we're not going to use that Mailman subsystem. |
21 | + executable = os.path.abspath('bin/py') |
22 | configure_args = ( |
23 | './configure', |
24 | '--prefix', mailman_path, |
25 | '--with-var-prefix=' + var_dir, |
26 | - '--with-python=' + sys.executable, |
27 | + '--with-python=' + executable, |
28 | '--with-username=' + user, |
29 | '--with-groupname=' + group, |
30 | '--with-mail-gid=' + group, |
31 | '--with-mailhost=' + build_host_name, |
32 | '--with-urlhost=' + build_host_name, |
33 | ) |
34 | + # Configure. |
35 | retcode = subprocess.call(configure_args, cwd=mailman_source) |
36 | if retcode: |
37 | print >> sys.stderr, 'Could not configure Mailman:' |
38 | sys.exit(retcode) |
39 | + # Make. |
40 | retcode = subprocess.call(('make',), cwd=mailman_source) |
41 | if retcode: |
42 | print >> sys.stderr, 'Could not make Mailman.' |
43 | sys.exit(retcode) |
44 | + # We have a brief interlude before we install. Hardy will not |
45 | + # accept a script as the executable for the shebang line--it will |
46 | + # treat the file as a shell script instead. The ``bin/by`` |
47 | + # executable that we specified in '--with-python' above is a script |
48 | + # so this behavior causes problems for us. Our work around is to |
49 | + # prefix the ``bin/py`` script with ``/usr/bin/env``, which makes |
50 | + # Hardy happy. We need to do this before we install because the |
51 | + # installation will call Mailman's ``bin/update``, which is a script |
52 | + # that needs this fix. |
53 | + build_dir = os.path.join(mailman_source, 'build') |
54 | + original = '#! %s\n' % (executable,) |
55 | + modified = '#! /usr/bin/env %s\n' % (executable,) |
56 | + for (dirpath, dirnames, filenames) in os.walk(build_dir): |
57 | + for filename in filenames: |
58 | + filename = os.path.join(dirpath, filename) |
59 | + f = open(filename, 'r') |
60 | + if f.readline() == original: |
61 | + rest = f.read() |
62 | + f.close() |
63 | + f = open(filename, 'w') |
64 | + f.write(modified) |
65 | + f.write(rest) |
66 | + f.close() |
67 | + # Now we actually install. |
68 | retcode = subprocess.call(('make', 'install'), cwd=mailman_source) |
69 | if retcode: |
70 | print >> sys.stderr, 'Could not install Mailman.' |
71 | |
72 | === modified file 'buildout-templates/_pythonpath.py.in' |
73 | --- buildout-templates/_pythonpath.py.in 2009-08-21 19:13:05 +0000 |
74 | +++ buildout-templates/_pythonpath.py.in 2009-10-18 01:33:15 +0000 |
75 | @@ -6,15 +6,73 @@ |
76 | |
77 | __metaclass__ = type |
78 | |
79 | -import sys, os |
80 | - |
81 | -sys.path[0:0] = [${string-paths}] |
82 | -# Enable Storm's C extensions |
83 | -os.environ['STORM_CEXTENSIONS'] = '1' |
84 | - |
85 | -# We don't want to bother tests or logs with these. |
86 | -import warnings |
87 | -warnings.filterwarnings( |
88 | - 'ignore', |
89 | - 'Module .+ was already imported from .+, but .+ is being added.*', |
90 | - UserWarning) |
91 | +import os |
92 | +import site |
93 | +import sys |
94 | + |
95 | +stdlib_paths = [ |
96 | + ${indented-stdlib-paths} |
97 | + ] |
98 | +egg_paths = [ |
99 | + ${indented-egg-paths} |
100 | + ] |
101 | +site_dirs = [ |
102 | + ${indented-dir-paths} |
103 | + ] |
104 | +clean_modules = [ |
105 | + 'os', |
106 | + '_pythonpath', |
107 | + 'site', |
108 | + 'sitecustomize', |
109 | + 'sys', |
110 | + ${clean-sys-modules} |
111 | + ] |
112 | + |
113 | +def set_path(): |
114 | + previously_imported = {} |
115 | + # We get a copy of the keys rather than simply iterating because we will |
116 | + # be mutating the dictionary. |
117 | + for k in sys.modules.keys(): |
118 | + if k not in clean_modules: |
119 | + previously_imported[k] = sys.modules.pop(k) |
120 | + |
121 | + # We keep the very first path because that is typically the directory |
122 | + # of the file that imported us, which should continue to have precedence. |
123 | + sys.path[1:] = egg_paths |
124 | + sys.path.extend(stdlib_paths) |
125 | + # Add the site_dirs before `addsitedir` in case it has setuptools. |
126 | + sys.path.extend(site_dirs) |
127 | + # Process all buildout-controlled eggs before site-packages by importing |
128 | + # pkg_resources. This is only important for namespace packages, so it may |
129 | + # not have been added, so ignore import errors. |
130 | + try: |
131 | + import pkg_resources |
132 | + except ImportError: |
133 | + pass |
134 | + # Process .pth files. |
135 | + for p in site_dirs: |
136 | + site.addsitedir(p) |
137 | + |
138 | + # We don't want to have dropped any packages that weren't already added |
139 | + # back by what we just did. If we did, there's a good chance that the |
140 | + # world will now be insane. Quit now, and let's fix it. |
141 | + unexpected = set(previously_imported).difference(sys.modules) |
142 | + if unexpected: |
143 | + raise RuntimeError( |
144 | + 'Found unexpected module(s): %s\n\nImport _pythonpath earlier!' % |
145 | + (', '.join(sorted(unexpected)),)) |
146 | + |
147 | + # Enable Storm's C extensions |
148 | + os.environ['STORM_CEXTENSIONS'] = '1' |
149 | + |
150 | + # We don't want to bother tests or logs with these. |
151 | + import warnings |
152 | + warnings.filterwarnings( |
153 | + 'ignore', |
154 | + 'Module .+ was already imported from .+, but .+ is being added.*', |
155 | + UserWarning) |
156 | + |
157 | +try: |
158 | + import canonical |
159 | +except ImportError: |
160 | + set_path() |
161 | |
162 | === added file 'buildout-templates/bin/py.in' |
163 | --- buildout-templates/bin/py.in 1970-01-01 00:00:00 +0000 |
164 | +++ buildout-templates/bin/py.in 2009-10-18 01:33:15 +0000 |
165 | @@ -0,0 +1,2 @@ |
166 | +#!/bin/sh |
167 | +PYTHONPATH=${os-paths} exec ${buildout:executable} "$@" |
168 | |
169 | === removed file 'buildout-templates/bin/py.in' |
170 | --- buildout-templates/bin/py.in 2009-06-12 16:36:02 +0000 |
171 | +++ buildout-templates/bin/py.in 1970-01-01 00:00:00 +0000 |
172 | @@ -1,2 +0,0 @@ |
173 | -#!/bin/sh |
174 | -PYTHONPATH=${os-paths} exec ${buildout:executable} "$@" |
175 | |
176 | === modified file 'buildout-templates/bin/test.in' |
177 | --- buildout-templates/bin/test.in 2009-09-17 17:42:25 +0000 |
178 | +++ buildout-templates/bin/test.in 2009-10-18 01:33:15 +0000 |
179 | @@ -1,4 +1,4 @@ |
180 | -#!${buildout:executable} |
181 | +#! /usr/bin/env ${buildout:directory}/bin/py |
182 | ############################################################################## |
183 | # |
184 | # Copyright (c) 2004 Zope Corporation and Contributors. |
185 | @@ -14,7 +14,11 @@ |
186 | ############################################################################## |
187 | """Test script |
188 | """ |
189 | -import sys, os, time, logging, warnings, re |
190 | + |
191 | +# NOTE: This is a generated file. The original is in |
192 | +# buildout-templates/bin/test.in |
193 | + |
194 | +import logging, os, re, sys, time, warnings |
195 | |
196 | BUILD_DIR = '${buildout:directory}' |
197 | |
198 | @@ -30,16 +34,16 @@ |
199 | |
200 | # Make tests run in a timezone no launchpad developers live in. |
201 | # Our tests need to run in any timezone. |
202 | -# (No longer actually required, as PQM does this) |
203 | +# (This is no longer actually required, as PQM does this.) |
204 | os.environ['TZ'] = 'Asia/Calcutta' |
205 | time.tzset() |
206 | |
207 | -# Enable Storm's C extensions |
208 | +# Enable Storm's C extensions. |
209 | os.environ['STORM_CEXTENSIONS'] = '1' |
210 | |
211 | -sys.path[0:0] = [${string-paths}] |
212 | - |
213 | -# Set PYTHONPATH environment variable for spawned processes |
214 | +# Set PYTHONPATH environment variable for spawned processes. |
215 | +# This is the kind of use case for the site.py fork we have in lib (see the |
216 | +# comment in that file). :-( |
217 | os.environ['PYTHONPATH'] = ':'.join(sys.path) |
218 | |
219 | # Set a flag if this is the main testrunner process |
220 | |
221 | === modified file 'buildout.cfg' |
222 | --- buildout.cfg 2009-10-08 10:56:00 +0000 |
223 | +++ buildout.cfg 2009-10-18 01:33:15 +0000 |
224 | @@ -52,7 +52,7 @@ |
225 | # XXX gary 2009-5-12 bug 375751: |
226 | # Make mailman built and installed in a more normal way. |
227 | extra-paths = ${buildout:directory}/lib/mailman |
228 | -# note that any indentation is lost in initialization blocks |
229 | +# Note that any indentation is lost in initialization blocks. |
230 | initialization = import os |
231 | os.environ['STORM_CEXTENSIONS'] = '1' |
232 | os.environ.setdefault('LPCONFIG', '${configuration:instance_name}') |
233 | |
234 | === modified file 'cronscripts/check-teamparticipation.py' |
235 | --- cronscripts/check-teamparticipation.py 2009-07-29 01:14:50 +0000 |
236 | +++ cronscripts/check-teamparticipation.py 2009-10-18 01:33:15 +0000 |
237 | @@ -18,11 +18,11 @@ |
238 | situation, but that's not a simple thing and this should do for now. |
239 | """ |
240 | |
241 | +import _pythonpath |
242 | + |
243 | import optparse |
244 | import sys |
245 | |
246 | -import _pythonpath |
247 | - |
248 | from canonical.database.sqlbase import cursor |
249 | from canonical.launchpad.scripts import ( |
250 | execute_zcml_for_scripts, logger_options, logger) |
251 | |
252 | === modified file 'cronscripts/create-debwatches.py' |
253 | --- cronscripts/create-debwatches.py 2009-06-24 20:52:01 +0000 |
254 | +++ cronscripts/create-debwatches.py 2009-10-18 01:33:15 +0000 |
255 | @@ -11,9 +11,9 @@ |
256 | |
257 | __metaclass__ = type |
258 | |
259 | +import _pythonpath |
260 | import os |
261 | import logging |
262 | -import _pythonpath |
263 | |
264 | # zope bits |
265 | from zope.component import getUtility |
266 | |
267 | === modified file 'cronscripts/update-debwatches.py' |
268 | --- cronscripts/update-debwatches.py 2009-06-24 20:52:01 +0000 |
269 | +++ cronscripts/update-debwatches.py 2009-10-18 01:33:15 +0000 |
270 | @@ -6,11 +6,11 @@ |
271 | # This script runs through the set of Debbugs watches, and tries to |
272 | # syncronise each of those to the malone bug which is watching it. |
273 | |
274 | +import _pythonpath |
275 | import os |
276 | import sys |
277 | import email |
278 | import logging |
279 | -import _pythonpath |
280 | |
281 | # zope bits |
282 | from zope.component import getUtility |
283 | |
284 | === modified file 'cronscripts/update-remote-product.py' |
285 | --- cronscripts/update-remote-product.py 2009-06-24 20:52:01 +0000 |
286 | +++ cronscripts/update-remote-product.py 2009-10-18 01:33:15 +0000 |
287 | @@ -7,8 +7,8 @@ |
288 | |
289 | """Cron job to update Product.remote_product using bug watch information. """ |
290 | |
291 | +import _pythonpath |
292 | import time |
293 | -import _pythonpath |
294 | |
295 | from canonical.config import config |
296 | from lp.services.scripts.base import LaunchpadCronScript |
297 | |
298 | === modified file 'cronscripts/update-sourceforge-remote-products.py' |
299 | --- cronscripts/update-sourceforge-remote-products.py 2009-06-24 20:52:01 +0000 |
300 | +++ cronscripts/update-sourceforge-remote-products.py 2009-10-18 01:33:15 +0000 |
301 | @@ -7,8 +7,8 @@ |
302 | |
303 | """Cron job to update remote_products using SourceForge project data.""" |
304 | |
305 | +import _pythonpath |
306 | import time |
307 | -import _pythonpath |
308 | |
309 | from canonical.config import config |
310 | from lp.services.scripts.base import LaunchpadCronScript |
311 | |
312 | === modified file 'lib/canonical/launchpad/rest/configuration.py' |
313 | --- lib/canonical/launchpad/rest/configuration.py 2009-06-25 05:30:52 +0000 |
314 | +++ lib/canonical/launchpad/rest/configuration.py 2009-10-18 01:33:15 +0000 |
315 | @@ -26,6 +26,7 @@ |
316 | path_override = "api" |
317 | service_version_uri_prefix = "beta" |
318 | view_permission = "launchpad.View" |
319 | + set_hop_by_hop_headers = True |
320 | |
321 | @property |
322 | def use_https(self): |
323 | |
324 | === modified file 'lib/lp/codehosting/tests/test_lpserve.py' |
325 | --- lib/lp/codehosting/tests/test_lpserve.py 2009-07-17 02:25:09 +0000 |
326 | +++ lib/lp/codehosting/tests/test_lpserve.py 2009-10-18 01:33:15 +0000 |
327 | @@ -6,6 +6,7 @@ |
328 | __metaclass__ = type |
329 | |
330 | import os |
331 | +import re |
332 | from subprocess import PIPE |
333 | import unittest |
334 | |
335 | @@ -30,7 +31,35 @@ |
336 | |
337 | def assertFinishedCleanly(self, result): |
338 | """Assert that a server process finished cleanly.""" |
339 | - self.assertEqual((0, '', ''), tuple(result)) |
340 | + # XXX gary 2009-10-15 bug 316192 |
341 | + # Ideally, this method would only be this single line: |
342 | + # |
343 | + # self.assertEqual((0, '', ''), tuple(result)) |
344 | + # |
345 | + # However, because of the bug above, stderr (the last value) can |
346 | + # include complaints that bzr tried to import certain plugins but |
347 | + # was unable to. This can make the last value into something like |
348 | + # this (concatenate the strings): |
349 | + # |
350 | + # "No module named dbus.bus\n" |
351 | + # "Unable to load plugin 'dbus' from " |
352 | + # "'/usr/lib/python2.4/site-packages/bzrlib/plugins'\n" |
353 | + # "No module named dbus.bus\n" |
354 | + # "Unable to load plugin 'avahi' from " |
355 | + # "'/usr/lib/python2.4/site-packages/bzrlib/plugins'\n" |
356 | + # |
357 | + # Therefore, for now, we allow stderr to have messages like |
358 | + # that, with a regex. A fix for the bzr bug mentioned above has |
359 | + # already been released, so hopefully soon this method can |
360 | + # return to the single assert above, this module will no longer |
361 | + # have to import re, and this comment can be consigned to |
362 | + # history. |
363 | + self.assertEqual(0, result[0]) # the return code |
364 | + self.assertEqual('', result[1]) # stdout |
365 | + self.failUnless(re.match( |
366 | + r"(No module named \S+\n|" |
367 | + "Unable to load plugin \S+ from '/usr/lib/python[^']+'\n)*$", |
368 | + result[2])) |
369 | |
370 | def get_python_path(self): |
371 | """Return the path to the Python interpreter.""" |
372 | |
373 | === modified file 'lib/lp/services/scripts/tests/test_all_scripts.py' |
374 | --- lib/lp/services/scripts/tests/test_all_scripts.py 2009-07-23 15:36:06 +0000 |
375 | +++ lib/lp/services/scripts/tests/test_all_scripts.py 2009-10-18 01:33:15 +0000 |
376 | @@ -19,11 +19,13 @@ |
377 | # Walk through all scripts and check if they can run successfully |
378 | # if passed '-h' (optparser help). We run the scripts in a clean |
379 | # shell environment, i.e not PYTHONPATH set. |
380 | + bad = [] |
381 | for script_path in find_lp_scripts(): |
382 | cmd_line = script_path + " -h" |
383 | out, err, returncode = run_script(cmd_line) |
384 | - self.assertEquals( |
385 | - os.EX_OK, returncode, "%s failed\n%s" % (script_path, err)) |
386 | + if returncode != os.EX_OK: |
387 | + bad.append("%s failed\n%s" % (script_path, err)) |
388 | + self.failIf(bad, '\n\n'.join(bad)) |
389 | |
390 | |
391 | def test_suite(): |
392 | |
393 | === added file 'lib/site.py' |
394 | --- lib/site.py 1970-01-01 00:00:00 +0000 |
395 | +++ lib/site.py 2009-10-18 01:33:15 +0000 |
396 | @@ -0,0 +1,20 @@ |
397 | +# LAUNCHPAD HACK OF STDLIB SITE.PY |
398 | +# Why are we hacking site.py? |
399 | +# The short answer is that namespace packages in setuptools have problems. |
400 | +# A longer answer is that we have to import pkg_resources before namespace |
401 | +# package .pth files are processed or else the distribution's namespace |
402 | +# packages will mask all of the egg-based packages in the same namespace |
403 | +# package. Normally, we handle that in bin/py or _pythonpath. but sometimes |
404 | +# we do subprocess calls, relying on the PYTHONPATH to set the eggs |
405 | +# correctly. It is for this situation that we have hacked site.py. Here |
406 | +# is the important part: |
407 | +try: |
408 | + __import__('pkg_resources') # Use __import__ to not pollute the namespace. |
409 | +except ImportError: |
410 | + pass |
411 | + |
412 | +# Now, we want to get the usual site.py behavior. |
413 | +import os |
414 | +import sys |
415 | +execfile( |
416 | + os.path.join(sys.prefix, 'lib', 'python' + sys.version[:3], 'site.py')) |
417 | |
418 | === modified file 'scripts/bug-export.py' |
419 | --- scripts/bug-export.py 2009-07-23 03:20:18 +0000 |
420 | +++ scripts/bug-export.py 2009-10-18 01:33:15 +0000 |
421 | @@ -4,11 +4,11 @@ |
422 | # GNU Affero General Public License version 3 (see the file LICENSE). |
423 | # pylint: disable-msg=W0403 |
424 | |
425 | +import _pythonpath |
426 | + |
427 | import sys |
428 | import optparse |
429 | |
430 | -import _pythonpath |
431 | - |
432 | from zope.component import getUtility |
433 | from canonical.lp import initZopeless |
434 | from canonical.launchpad.interfaces import IProductSet |
435 | |
436 | === modified file 'scripts/bug-import.py' |
437 | --- scripts/bug-import.py 2009-06-30 16:56:07 +0000 |
438 | +++ scripts/bug-import.py 2009-10-18 01:33:15 +0000 |
439 | @@ -3,11 +3,11 @@ |
440 | # Copyright 2009 Canonical Ltd. This software is licensed under the |
441 | # GNU Affero General Public License version 3 (see the file LICENSE). |
442 | |
443 | -import logging |
444 | - |
445 | # pylint: disable-msg=W0403 |
446 | import _pythonpath |
447 | |
448 | +import logging |
449 | + |
450 | from zope.component import getUtility |
451 | from canonical.config import config |
452 | from canonical.launchpad.interfaces import IProductSet |
453 | |
454 | === modified file 'scripts/cache-country-mirrors.py' |
455 | --- scripts/cache-country-mirrors.py 2009-06-30 16:56:07 +0000 |
456 | +++ scripts/cache-country-mirrors.py 2009-10-18 01:33:15 +0000 |
457 | @@ -10,12 +10,12 @@ |
458 | containing the archive mirrors for that country. |
459 | """ |
460 | |
461 | +# pylint: disable-msg=W0403 |
462 | +import _pythonpath |
463 | + |
464 | import os |
465 | import tempfile |
466 | |
467 | -# pylint: disable-msg=W0403 |
468 | -import _pythonpath |
469 | - |
470 | from zope.component import getUtility |
471 | |
472 | from lp.services.scripts.base import ( |
473 | |
474 | === modified file 'scripts/entitlements-to-lp.py' |
475 | --- scripts/entitlements-to-lp.py 2009-06-30 16:56:07 +0000 |
476 | +++ scripts/entitlements-to-lp.py 2009-10-18 01:33:15 +0000 |
477 | @@ -3,15 +3,14 @@ |
478 | # Copyright 2009 Canonical Ltd. This software is licensed under the |
479 | # GNU Affero General Public License version 3 (see the file LICENSE). |
480 | |
481 | +__metaclass__ = type |
482 | + |
483 | # pylint: disable-msg=W0403 |
484 | - |
485 | -__metaclass__ = type |
486 | +import _pythonpath |
487 | |
488 | import logging |
489 | import sys |
490 | |
491 | -import _pythonpath |
492 | - |
493 | from lp.services.scripts.base import LaunchpadScript |
494 | from lp.registry.scripts.entitlement import ( |
495 | EntitlementExchange, EntitlementImporter) |
496 | |
497 | === modified file 'scripts/find-email-clusters.py' |
498 | --- scripts/find-email-clusters.py 2009-06-30 16:56:07 +0000 |
499 | +++ scripts/find-email-clusters.py 2009-10-18 01:33:15 +0000 |
500 | @@ -4,13 +4,12 @@ |
501 | # GNU Affero General Public License version 3 (see the file LICENSE). |
502 | |
503 | # pylint: disable-msg=W0403 |
504 | +import _pythonpath |
505 | |
506 | import sys |
507 | import logging |
508 | import optparse |
509 | |
510 | -import _pythonpath |
511 | - |
512 | import gpgme |
513 | |
514 | from canonical.launchpad.scripts import ( |
515 | |
516 | === modified file 'scripts/ftpmaster-tools/remove-package.py' |
517 | --- scripts/ftpmaster-tools/remove-package.py 2009-06-30 16:56:07 +0000 |
518 | +++ scripts/ftpmaster-tools/remove-package.py 2009-10-18 01:33:15 +0000 |
519 | @@ -7,6 +7,8 @@ |
520 | |
521 | ################################################################################ |
522 | |
523 | +import _pythonpath |
524 | + |
525 | import commands |
526 | import optparse |
527 | import os |
528 | @@ -17,8 +19,6 @@ |
529 | |
530 | import apt_pkg |
531 | |
532 | -import _pythonpath |
533 | - |
534 | from zope.component import getUtility |
535 | |
536 | from canonical.config import config |
537 | @@ -187,12 +187,12 @@ |
538 | # else: |
539 | # print "No dependency problem found." |
540 | |
541 | - |
542 | + |
543 | ################################################################################ |
544 | |
545 | def options_init(): |
546 | global Options |
547 | - |
548 | + |
549 | parser = optparse.OptionParser() |
550 | logger_options(parser) |
551 | parser.add_option("-a", "--architecture", dest="architecture", |
552 | @@ -275,7 +275,7 @@ |
553 | |
554 | return arguments |
555 | |
556 | -################################################################################ |
557 | +################################################################################ |
558 | |
559 | def summary_to_remove(to_remove): |
560 | # Generate the summary of what's to be removed |
561 | @@ -314,7 +314,7 @@ |
562 | |
563 | return summary |
564 | |
565 | -################################################################################ |
566 | +################################################################################ |
567 | |
568 | def what_to_remove(packages): |
569 | to_remove = [] |
570 | |
571 | === modified file 'scripts/ftpmaster-tools/sync-source.py' |
572 | --- scripts/ftpmaster-tools/sync-source.py 2009-08-28 07:34:44 +0000 |
573 | +++ scripts/ftpmaster-tools/sync-source.py 2009-10-18 01:33:15 +0000 |
574 | @@ -14,6 +14,7 @@ |
575 | will become a matter of simply 'publishing' source from Debian unstable |
576 | wherever) into Ubuntu dapper and the whole fake upload trick can go away. |
577 | """ |
578 | +import _pythonpath |
579 | |
580 | import apt_pkg |
581 | import commands |
582 | @@ -29,7 +30,6 @@ |
583 | import time |
584 | import urllib |
585 | |
586 | -import _pythonpath |
587 | import dak_utils |
588 | from _syncorigins import origins |
589 | |
590 | |
591 | === modified file 'scripts/import-packagenames.py' |
592 | --- scripts/import-packagenames.py 2009-07-31 13:13:26 +0000 |
593 | +++ scripts/import-packagenames.py 2009-10-18 01:33:15 +0000 |
594 | @@ -4,12 +4,12 @@ |
595 | # GNU Affero General Public License version 3 (see the file LICENSE). |
596 | |
597 | # pylint: disable-msg=W0403 |
598 | +import _pythonpath |
599 | |
600 | import sys |
601 | import re |
602 | from optparse import OptionParser |
603 | |
604 | -import _pythonpath |
605 | from canonical.lp import initZopeless |
606 | from canonical.launchpad.database import BinaryPackageName |
607 | |
608 | |
609 | === modified file 'scripts/merge-email-clusters.py' |
610 | --- scripts/merge-email-clusters.py 2009-06-30 16:56:07 +0000 |
611 | +++ scripts/merge-email-clusters.py 2009-10-18 01:33:15 +0000 |
612 | @@ -4,13 +4,12 @@ |
613 | # GNU Affero General Public License version 3 (see the file LICENSE). |
614 | |
615 | # pylint: disable-msg=W0403 |
616 | +import _pythonpath |
617 | |
618 | import sys |
619 | import logging |
620 | import optparse |
621 | |
622 | -import _pythonpath |
623 | - |
624 | from canonical.lp import initZopeless |
625 | from canonical.launchpad.scripts import ( |
626 | execute_zcml_for_scripts, logger_options, logger as logger_from_options) |
627 | |
628 | === modified file 'scripts/mlist-import.py' |
629 | --- scripts/mlist-import.py 2009-06-30 16:56:07 +0000 |
630 | +++ scripts/mlist-import.py 2009-10-18 01:33:15 +0000 |
631 | @@ -16,13 +16,13 @@ |
632 | ] |
633 | |
634 | |
635 | +# pylint: disable-msg=W0403 |
636 | +import _pythonpath |
637 | + |
638 | import sys |
639 | import logging |
640 | import textwrap |
641 | |
642 | -# pylint: disable-msg=W0403 |
643 | -import _pythonpath |
644 | - |
645 | from canonical.config import config |
646 | from lp.services.scripts.base import LaunchpadScript |
647 | from canonical.launchpad.scripts.mlistimport import Importer |
648 | |
649 | === modified file 'scripts/mlist-sync.py' |
650 | --- scripts/mlist-sync.py 2009-06-30 16:56:07 +0000 |
651 | +++ scripts/mlist-sync.py 2009-10-18 01:33:15 +0000 |
652 | @@ -24,15 +24,15 @@ |
653 | # Not doing this means that some of the links in staging's MHonArc archive |
654 | # will point to production archives. |
655 | |
656 | +# pylint: disable-msg=W0403 |
657 | +import _pythonpath |
658 | + |
659 | import os |
660 | import sys |
661 | import logging |
662 | import textwrap |
663 | import subprocess |
664 | |
665 | -# pylint: disable-msg=W0403 |
666 | -import _pythonpath |
667 | - |
668 | from zope.component import getUtility |
669 | from zope.security.proxy import removeSecurityProxy |
670 | |
671 | |
672 | === modified file 'scripts/rosetta/remove-upstream-translations.py' |
673 | --- scripts/rosetta/remove-upstream-translations.py 2009-07-23 02:33:14 +0000 |
674 | +++ scripts/rosetta/remove-upstream-translations.py 2009-10-18 01:33:15 +0000 |
675 | @@ -10,13 +10,12 @@ |
676 | .po files like the one reported at #32610. |
677 | """ |
678 | |
679 | +import _pythonpath |
680 | |
681 | import sys |
682 | import logging |
683 | from optparse import OptionParser |
684 | |
685 | -import _pythonpath |
686 | - |
687 | from zope.component import getUtility |
688 | |
689 | from canonical.config import config |
690 | |
691 | === modified file 'scripts/sourceforge-import.py' |
692 | --- scripts/sourceforge-import.py 2009-06-30 16:56:07 +0000 |
693 | +++ scripts/sourceforge-import.py 2009-10-18 01:33:15 +0000 |
694 | @@ -3,13 +3,13 @@ |
695 | # Copyright 2009 Canonical Ltd. This software is licensed under the |
696 | # GNU Affero General Public License version 3 (see the file LICENSE). |
697 | |
698 | +# pylint: disable-msg=W0403 |
699 | +import _pythonpath |
700 | + |
701 | import logging |
702 | import optparse |
703 | import sys |
704 | |
705 | -# pylint: disable-msg=W0403 |
706 | -import _pythonpath |
707 | - |
708 | from zope.component import getUtility |
709 | from canonical.config import config |
710 | from canonical.lp import initZopeless |
711 | |
712 | === modified file 'scripts/update-bzr-version-info.sh' |
713 | --- scripts/update-bzr-version-info.sh 2009-07-17 00:26:05 +0000 |
714 | +++ scripts/update-bzr-version-info.sh 2009-10-18 01:33:15 +0000 |
715 | @@ -13,7 +13,7 @@ |
716 | fi |
717 | |
718 | newfile=bzr-version-info-${RANDOM}.py |
719 | -PYTHONPATH=lib bzr version-info --format=python > $newfile 2>/dev/null; |
720 | +bzr version-info --format=python > $newfile 2>/dev/null; |
721 | # There's a leading space here that I don't care to trim.. |
722 | revno=$(python $newfile | grep revision: | cut -d: -f2) |
723 | if ! [ -f bzr-version-info.py ]; then |
724 | |
725 | === modified file 'scripts/upload2librarian.py' |
726 | --- scripts/upload2librarian.py 2009-06-30 16:56:07 +0000 |
727 | +++ scripts/upload2librarian.py 2009-10-18 01:33:15 +0000 |
728 | @@ -6,10 +6,11 @@ |
729 | # pylint: disable-msg=W0403 |
730 | """Simple tool to upload arbitrary files into Librarian.""" |
731 | |
732 | +import _pythonpath |
733 | + |
734 | import logging |
735 | import os |
736 | |
737 | -import _pythonpath |
738 | from zope.component import getUtility |
739 | |
740 | from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet |
741 | |
742 | === modified file 'utilities/check-scripts.py' |
743 | --- utilities/check-scripts.py 2009-07-23 02:33:14 +0000 |
744 | +++ utilities/check-scripts.py 2009-10-18 01:33:15 +0000 |
745 | @@ -10,10 +10,11 @@ |
746 | % utilities/check-scripts.py |
747 | """ |
748 | # pylint: disable-msg=W0403 |
749 | +import _pythonpath |
750 | + |
751 | import os |
752 | import sys |
753 | |
754 | -import _pythonpath |
755 | from lp.services.scripts.tests import find_lp_scripts |
756 | from lp.testing import run_script |
757 | |
758 | |
759 | === modified file 'utilities/ec2' |
760 | --- utilities/ec2 2009-09-16 01:34:30 +0000 |
761 | +++ utilities/ec2 2009-10-18 01:33:15 +0000 |
762 | @@ -1,17 +1,13 @@ |
763 | -#!/usr/bin/python |
764 | +#!/usr/bin/python2.4 |
765 | |
766 | # Copyright 2009 Canonical Ltd. This software is licensed under the |
767 | # GNU Affero General Public License version 3 (see the file LICENSE). |
768 | |
769 | """Executable for the ec2 scripts.""" |
770 | |
771 | +import _pythonpath |
772 | + |
773 | __metaclass__ = type |
774 | |
775 | -import os |
776 | -import sys |
777 | - |
778 | -sys.path.append( |
779 | - os.path.join(os.path.dirname(os.path.dirname(__file__)), 'lib')) |
780 | - |
781 | from devscripts.ec2test.entrypoint import main |
782 | main() |
783 | |
784 | === modified file 'utilities/lsconf.py' |
785 | --- utilities/lsconf.py 2009-06-24 20:15:50 +0000 |
786 | +++ utilities/lsconf.py 2009-10-18 01:33:15 +0000 |
787 | @@ -7,6 +7,9 @@ |
788 | |
789 | __metatype__ = type |
790 | |
791 | +# Scripts may have relative imports. |
792 | +# pylint: disable-msg=W0403 |
793 | +import _pythonpath |
794 | |
795 | import os |
796 | import sys |
797 | @@ -14,9 +17,6 @@ |
798 | from operator import attrgetter |
799 | from textwrap import dedent |
800 | |
801 | -# Scripts may have relative imports. |
802 | -# pylint: disable-msg=W0403 |
803 | -import _pythonpath |
804 | import canonical.config |
805 | from lazr.config import ImplicitTypeSchema |
806 | |
807 | |
808 | === modified file 'utilities/paste' |
809 | --- utilities/paste 2009-08-13 09:25:01 +0000 |
810 | +++ utilities/paste 2009-10-18 01:33:15 +0000 |
811 | @@ -3,6 +3,8 @@ |
812 | # Copyright 2009 Canonical Ltd. This software is licensed under the |
813 | # GNU Affero General Public License version 3 (see the file LICENSE). |
814 | |
815 | +import _pythonpath |
816 | + |
817 | import base64 |
818 | import httplib |
819 | import os |
820 | @@ -10,12 +12,8 @@ |
821 | import sys |
822 | import urllib |
823 | import webbrowser |
824 | - |
825 | from optparse import OptionParser |
826 | from urlparse import urljoin |
827 | - |
828 | -import _pythonpath |
829 | - |
830 | from ClientCookie import Cookie, CookieJar |
831 | from mechanize import HTTPRobotRulesProcessor |
832 | |
833 | |
834 | === removed file 'utilities/windmill.py' |
835 | --- utilities/windmill.py 2009-06-24 20:22:29 +0000 |
836 | +++ utilities/windmill.py 1970-01-01 00:00:00 +0000 |
837 | @@ -1,15 +0,0 @@ |
838 | -#!/usr/bin/python2.5 |
839 | -# |
840 | -# Copyright 2009 Canonical Ltd. This software is licensed under the |
841 | -# GNU Affero General Public License version 3 (see the file LICENSE). |
842 | - |
843 | -"""Windmill command line. |
844 | - |
845 | -A separate script is used because windmill uses Python 2.5 features. |
846 | -So it must be run separately. |
847 | -""" |
848 | -import _pythonpath |
849 | -from windmill.bin.windmill_bin import main |
850 | - |
851 | -if __name__ == '__main__': |
852 | - main() |
853 | |
854 | === modified file 'versions.cfg' |
855 | --- versions.cfg 2009-10-13 12:18:48 +0000 |
856 | +++ versions.cfg 2009-10-18 01:33:15 +0000 |
857 | @@ -28,7 +28,7 @@ |
858 | lazr.delegates = 1.1.0 |
859 | lazr.enum = 1.1.2 |
860 | lazr.lifecycle = 1.0 |
861 | -lazr.restful = 0.9.11 |
862 | +lazr.restful = 0.9.13 |
863 | lazr.restfulclient = 0.9.5 |
864 | lazr.smtptest = 1.1 |
865 | lazr.uri = 1.0.2 |
866 | @@ -82,7 +82,7 @@ |
867 | z3c.pagelet = 1.0.2 |
868 | z3c.pt = 1.0b16 |
869 | z3c.ptcompat = 0.5.3 |
870 | -z3c.recipe.filetemplate = 2.1dev-gary-r103545 |
871 | +z3c.recipe.filetemplate = 2.1dev-gary-r105075 |
872 | z3c.recipe.i18n = 0.5.3 |
873 | z3c.recipe.tag = 0.2.0 |
874 | z3c.rml = 0.7.3 |
875 | @@ -93,12 +93,12 @@ |
876 | z3c.viewlet = 1.0.0 |
877 | z3c.viewtemplate = 0.3.2 |
878 | z3c.zrtresource = 1.0.1 |
879 | -zc.buildout = 1.5.0dev-gary-r103553 |
880 | +zc.buildout = 1.5.0dev-gary-r105072 |
881 | zc.catalog = 1.2.0 |
882 | zc.datetimewidget = 0.5.2 |
883 | zc.i18n = 0.5.2 |
884 | zc.lockfile = 1.0.0 |
885 | -zc.recipe.egg = 1.3.0dev-gary-r103515 |
886 | +zc.recipe.egg = 1.3.0dev-gary-r105072 |
887 | zc.zservertracelog = 1.1.5 |
888 | ZConfig = 2.6.1 |
889 | zdaemon = 2.0.2 |
The main goal of this branch was to get the build working when lazr packages were installed into the system. When you have the same namespace ("lazr," for instance) in site-packages and in eggs, the site-package namespace package would mask all of the eggs in the same namespace.
Fixing this happened first in our upstream zc.buildout branch. Then we also have the same kind of problem when we start subprocesses; and when we start standalone scripts in the "scripts," "utilities," and "cron" directories. For those, we use PYTHONPATH and _pythonpath.py, respectively. The branch needed to make these approaches also work around the namespace package problem.
This work happened on Karmic, because that's where the problem was first discovered, because that's what we are supposed to be dogfooding, and because some lazr packages are installed by default in Karmic because of apport (and maybe other things) so the problem happens consistently there. Trying to get tests to pass in Karmic discovered a few other issues, which I addressed here. I should have been using a pipeline and then put this work in an earlier branch, but I did not. If you want me to divide this work up after the fact, that will take some time, but I will completely understand the request. For now, though, we have a diff that is almost 1300 lines long.
When reviewing, in addition to looking at the diff in Launchpad, you should probably also look at the changes in the scripts that buildout is producing. The ``bin/py`` script, for instance, is wildly different now: it used to use PYTHONPATH, and now it uses the faux-interpreter that buildout produces.
The ``bin/py`` script is worth calling out for another reason. Codehosting noticed a marked increase in slowness when 3.0 launched, and investigated to find that at least some of the problem may be put on setuptools' door. Michael Hudson reported that the speed to start a Python interpreter increased quadratically based on the length of sys.path. One of the codehosting tools relies on starting an Python process for every operation, so this start-up time is noticeable. I was a bit worried that my changes in this branch would exacerbate the problem, because ``bin/py`` has moved from a bash script relying on PYTHONPATH to pass its configuration to a buildout-generated faux interpreter. According to tests of ``time bin/py -c ''`` in the old and new versions, the speed is about the same (between .2 and .3 seconds on my machine, about a factor of ten slower than ``time python2.4 -c ''``). Therefore, at least I have not made the problem worse.
Now I'll start describing the changes to this branch in more detail.
Makefile:
Since bin/py is now a faux-interpreter, it does not support the -t option ("issue warnings about inconsistent tab usage"). We use that option a few times in the Makefile, so I call the faux Python interpreter with the actual Python executable, and give the -t flag to the real executable.
buildmailman.py:
Thanks to Barry Warsaw's inspiration, I was able to have Mailman use the correct paths (and get the fix for namespace packages described at the start of this comment) by simply telling it to configure usin...