Merge lp:~cjwatson/launchpad/simplify-buildout-bin-python-easy into lp:launchpad
- simplify-buildout-bin-python-easy
- Merge into devel
Proposed by
Colin Watson
Status: | Merged |
---|---|
Merged at revision: | 18314 |
Proposed branch: | lp:~cjwatson/launchpad/simplify-buildout-bin-python-easy |
Merge into: | lp:launchpad |
Diff against target: |
453 lines (+149/-140) 9 files modified
Makefile (+1/-1) lib/lp/app/templates/base-layout-macros.pt (+1/-1) lib/lp/scripts/utilities/bzr.py (+10/-12) lib/lp/scripts/utilities/js/combinecss.py (+32/-35) lib/lp/scripts/utilities/js/watchjsbuild.py (+10/-2) lib/lp/scripts/utilities/killtestservices.py (+19/-26) lib/lp/scripts/utilities/spriteutil.py (+53/-47) lib/lp/testing/utilities/retest.py (+13/-10) setup.py (+10/-6) |
To merge this branch: | bzr merge lp:~cjwatson/launchpad/simplify-buildout-bin-python-easy |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Grant | code | Approve | |
Review via email: mp+314976@code.launchpad.net |
Commit message
Turn most Python scripts in buildout-
Description of the change
buildout-
To post a comment you must log in.
Revision history for this message
William Grant (wgrant) : | # |
review:
Approve
(code)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Makefile' | |||
2 | --- Makefile 2016-09-21 02:51:58 +0000 | |||
3 | +++ Makefile 2017-01-18 08:50:25 +0000 | |||
4 | @@ -47,7 +47,7 @@ | |||
5 | 47 | # NB: It's important BUILDOUT_BIN only mentions things genuinely produced by | 47 | # NB: It's important BUILDOUT_BIN only mentions things genuinely produced by |
6 | 48 | # buildout. | 48 | # buildout. |
7 | 49 | BUILDOUT_BIN = \ | 49 | BUILDOUT_BIN = \ |
9 | 50 | $(PY) bin/apiindex bin/combine-css bin/fl-build-report \ | 50 | $(PY) bin/apiindex bin/bzr bin/combine-css bin/fl-build-report \ |
10 | 51 | bin/fl-credential-ctl bin/fl-install-demo bin/fl-monitor-ctl \ | 51 | bin/fl-credential-ctl bin/fl-install-demo bin/fl-monitor-ctl \ |
11 | 52 | bin/fl-record bin/fl-run-bench bin/fl-run-test bin/googletestservice \ | 52 | bin/fl-record bin/fl-run-bench bin/fl-run-test bin/googletestservice \ |
12 | 53 | bin/i18ncompile bin/i18nextract bin/i18nmergeall bin/i18nstats \ | 53 | bin/i18ncompile bin/i18nextract bin/i18nmergeall bin/i18nstats \ |
13 | 54 | 54 | ||
14 | === modified file 'lib/lp/app/templates/base-layout-macros.pt' | |||
15 | --- lib/lp/app/templates/base-layout-macros.pt 2016-09-14 11:13:06 +0000 | |||
16 | +++ lib/lp/app/templates/base-layout-macros.pt 2017-01-18 08:50:25 +0000 | |||
17 | @@ -198,7 +198,7 @@ | |||
18 | 198 | <tal:comment replace="nothing"> | 198 | <tal:comment replace="nothing"> |
19 | 199 | This macro loads a single css file containing all our stylesheets. | 199 | This macro loads a single css file containing all our stylesheets. |
20 | 200 | If you need to include a new css file here, add it to | 200 | If you need to include a new css file here, add it to |
22 | 201 | buildout-templates/bin/combine-css.in instead. | 201 | lib/lp/scripts/utilities/js/combinecss.py instead. |
23 | 202 | 202 | ||
24 | 203 | We load the CSS from the same host that served the HTML in order to optimize | 203 | We load the CSS from the same host that served the HTML in order to optimize |
25 | 204 | IE caching over SSL. This is inefficient when you cross subdomains (from | 204 | IE caching over SSL. This is inefficient when you cross subdomains (from |
26 | 205 | 205 | ||
27 | === renamed file 'buildout-templates/bin/bzr.in' => 'lib/lp/scripts/utilities/bzr.py' | |||
28 | --- buildout-templates/bin/bzr.in 2010-11-24 17:27:46 +0000 | |||
29 | +++ lib/lp/scripts/utilities/bzr.py 2017-01-18 08:50:25 +0000 | |||
30 | @@ -1,15 +1,13 @@ | |||
40 | 1 | #!${buildout:executable} -S | 1 | # Copyright 2010-2017 Canonical Ltd. This software is licensed under the |
41 | 2 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | |
42 | 3 | # Initialize our paths. | 3 | |
34 | 4 | ${python-relative-path-setup} | ||
35 | 5 | import sys | ||
36 | 6 | sys.path.insert(0, ${scripts:parts-directory|path-repr}) | ||
37 | 7 | import site | ||
38 | 8 | |||
39 | 9 | # Run the script. | ||
43 | 10 | import pkg_resources | 4 | import pkg_resources |
44 | 11 | 5 | ||
45 | 12 | bzr_distribution = pkg_resources.get_distribution( | ||
46 | 13 | pkg_resources.Requirement.parse('bzr')) | ||
47 | 14 | 6 | ||
49 | 15 | bzr_distribution.run_script('bzr', globals().copy()) | 7 | def main(): |
50 | 8 | # Run the script. | ||
51 | 9 | bzr_distribution = pkg_resources.get_distribution( | ||
52 | 10 | pkg_resources.Requirement.parse('bzr')) | ||
53 | 11 | namespace = globals().copy() | ||
54 | 12 | namespace['__name__'] = '__main__' | ||
55 | 13 | bzr_distribution.run_script('bzr', namespace) | ||
56 | 16 | 14 | ||
57 | === renamed file 'buildout-templates/bin/combine-css.in' => 'lib/lp/scripts/utilities/js/combinecss.py' | |||
58 | --- buildout-templates/bin/combine-css.in 2013-07-04 01:04:50 +0000 | |||
59 | +++ lib/lp/scripts/utilities/js/combinecss.py 2017-01-18 08:50:25 +0000 | |||
60 | @@ -1,20 +1,13 @@ | |||
68 | 1 | #!${buildout:executable} -S | 1 | # Copyright 2009-2017 Canonical Ltd. This software is licensed under the |
69 | 2 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | |
63 | 3 | # Initialize our paths. | ||
64 | 4 | ${python-relative-path-setup} | ||
65 | 5 | import sys | ||
66 | 6 | sys.path.insert(0, ${scripts:parts-directory|path-repr}) | ||
67 | 7 | import site | ||
70 | 8 | 3 | ||
71 | 9 | import os | 4 | import os |
72 | 10 | 5 | ||
73 | 11 | from lp.scripts.utilities.js.jsbuild import ComboFile | 6 | from lp.scripts.utilities.js.jsbuild import ComboFile |
74 | 12 | from lp.scripts.utilities.js.combo import combine_files | 7 | from lp.scripts.utilities.js.combo import combine_files |
80 | 13 | 8 | from lp.services.config import config | |
81 | 14 | root = os.path.abspath('.') | 9 | |
82 | 15 | root = os.path.normpath(${buildout:directory|path-repr}) | 10 | |
78 | 16 | icing = os.path.join(root, 'lib/canonical/launchpad/icing') | ||
79 | 17 | target = os.path.join(icing, 'combo.css') | ||
83 | 18 | # It'd probably be nice to have this script find all the CSS files we might | 11 | # It'd probably be nice to have this script find all the CSS files we might |
84 | 19 | # need and combine them together, but if we do that we'd certainly end up | 12 | # need and combine them together, but if we do that we'd certainly end up |
85 | 20 | # including lots of styles that we don't need/want, so keeping this hard-coded | 13 | # including lots of styles that we don't need/want, so keeping this hard-coded |
86 | @@ -58,26 +51,30 @@ | |||
87 | 58 | 'css/layout.css', | 51 | 'css/layout.css', |
88 | 59 | 'css/modifiers.css'] | 52 | 'css/modifiers.css'] |
89 | 60 | 53 | ||
113 | 61 | # Get all the component css files so we don't have to edit this file every | 54 | |
114 | 62 | # time a new component is added | 55 | def main(): |
115 | 63 | component_dir = 'css/components' | 56 | icing = os.path.join(config.root, 'lib/canonical/launchpad/icing') |
116 | 64 | component_path = os.path.abspath(os.path.join(icing, component_dir)) | 57 | target = os.path.join(icing, 'combo.css') |
117 | 65 | for root, dirs, files in os.walk(component_path): | 58 | |
118 | 66 | for file in files: | 59 | # Get all the component css files so we don't have to edit this file |
119 | 67 | if file.endswith('.css'): | 60 | # every time a new component is added. |
120 | 68 | names.append('%s/%s' % (component_dir, file)) | 61 | component_dir = 'css/components' |
121 | 69 | 62 | component_path = os.path.abspath(os.path.join(icing, component_dir)) | |
122 | 70 | absolute_names = [] | 63 | for root, dirs, files in os.walk(component_path): |
123 | 71 | for name in names: | 64 | for file in files: |
124 | 72 | full_path_name = os.path.abspath(os.path.join(icing, name)) | 65 | if file.endswith('.css'): |
125 | 73 | absolute_names.append(full_path_name) | 66 | names.append('%s/%s' % (component_dir, file)) |
126 | 74 | 67 | ||
127 | 75 | combo = ComboFile(absolute_names, target) | 68 | absolute_names = [] |
128 | 76 | if combo.needs_update(): | 69 | for name in names: |
129 | 77 | result = '' | 70 | full_path_name = os.path.abspath(os.path.join(icing, name)) |
130 | 78 | for content in combine_files(names, icing): | 71 | absolute_names.append(full_path_name) |
131 | 79 | result += content | 72 | |
132 | 80 | 73 | combo = ComboFile(absolute_names, target) | |
133 | 81 | f = open(target, 'w') | 74 | if combo.needs_update(): |
134 | 82 | f.write(result) | 75 | result = '' |
135 | 83 | f.close() | 76 | for content in combine_files(names, icing): |
136 | 77 | result += content | ||
137 | 78 | |||
138 | 79 | with open(target, 'w') as f: | ||
139 | 80 | f.write(result) | ||
140 | 84 | 81 | ||
141 | === renamed file 'buildout-templates/bin/watch_jsbuild.in' => 'lib/lp/scripts/utilities/js/watchjsbuild.py' | |||
142 | --- buildout-templates/bin/watch_jsbuild.in 2012-02-28 19:40:50 +0000 | |||
143 | +++ lib/lp/scripts/utilities/js/watchjsbuild.py 2017-01-18 08:50:25 +0000 | |||
144 | @@ -1,8 +1,16 @@ | |||
146 | 1 | #!/usr/bin/env python | 1 | # Copyright 2016 Canonical Ltd. This software is licensed under the |
147 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
148 | 3 | |||
149 | 4 | """Automatically rebuild the JavaScript bundle when source files change.""" | ||
150 | 5 | |||
151 | 6 | from __future__ import absolute_import, print_function | ||
152 | 7 | |||
153 | 2 | import os | 8 | import os |
154 | 3 | import re | 9 | import re |
155 | 10 | |||
156 | 4 | from jsautobuild import YUIBuilder | 11 | from jsautobuild import YUIBuilder |
157 | 5 | 12 | ||
158 | 13 | |||
159 | 6 | # Using ionotify we watch our sources of JavaScript in order to know we should | 14 | # Using ionotify we watch our sources of JavaScript in order to know we should |
160 | 7 | # build when the files change. | 15 | # build when the files change. |
161 | 8 | 16 | ||
162 | @@ -18,7 +26,7 @@ | |||
163 | 18 | return os.path.join(JSDIR, RENAME.sub(js_dir, changed_path)) | 26 | return os.path.join(JSDIR, RENAME.sub(js_dir, changed_path)) |
164 | 19 | 27 | ||
165 | 20 | 28 | ||
167 | 21 | if __name__ == "__main__": | 29 | def main(): |
168 | 22 | build_dir = 'build/js/lp' | 30 | build_dir = 'build/js/lp' |
169 | 23 | meta_name = 'LP_MODULES' | 31 | meta_name = 'LP_MODULES' |
170 | 24 | watch_dir = 'lib' | 32 | watch_dir = 'lib' |
171 | 25 | 33 | ||
172 | === renamed file 'buildout-templates/bin/kill-test-services.in' => 'lib/lp/scripts/utilities/killtestservices.py' | |||
173 | --- buildout-templates/bin/kill-test-services.in 2011-12-30 01:48:17 +0000 | |||
174 | +++ lib/lp/scripts/utilities/killtestservices.py 2017-01-18 08:50:25 +0000 | |||
175 | @@ -1,40 +1,33 @@ | |||
179 | 1 | #!${buildout:executable} -S | 1 | # Copyright 2009-2017 Canonical Ltd. This software is licensed under the |
177 | 2 | # | ||
178 | 3 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
180 | 4 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
181 | 3 | |||
182 | 5 | """Kill all the test services that may persist between test runs.""" | 4 | """Kill all the test services that may persist between test runs.""" |
183 | 6 | 5 | ||
186 | 7 | # Initialize our paths. | 6 | from __future__ import print_function |
187 | 8 | ${python-relative-path-setup} | 7 | |
188 | 9 | import sys | 8 | import sys |
189 | 10 | sys.path.insert(0, ${scripts:parts-directory|path-repr}) | ||
190 | 11 | import site | ||
191 | 12 | 9 | ||
192 | 13 | # Tell lp.services.config to use the testrunner config instance, so that | ||
193 | 14 | # we don't kill the real services. | ||
194 | 15 | from lp.services.config import config | 10 | from lp.services.config import config |
201 | 16 | config.setInstance('testrunner') | 11 | from lp.services.librarianserver.testing.server import LibrarianServerFixture |
196 | 17 | config.generate_overrides() | ||
197 | 18 | |||
198 | 19 | import sys | ||
199 | 20 | |||
200 | 21 | from lp.services.librarianserver.testing.server import LibrarianTestSetup | ||
202 | 22 | from lp.services.osutils import kill_by_pidfile | 12 | from lp.services.osutils import kill_by_pidfile |
203 | 23 | from lp.testing.layers import MemcachedLayer | 13 | from lp.testing.layers import MemcachedLayer |
204 | 24 | 14 | ||
205 | 25 | 15 | ||
207 | 26 | def main(args): | 16 | def main(): |
208 | 17 | args = sys.argv[1:] | ||
209 | 27 | if '-h' in args or '--help' in args: | 18 | if '-h' in args or '--help' in args: |
211 | 28 | print __doc__ | 19 | print(__doc__) |
212 | 29 | return 0 | 20 | return 0 |
214 | 30 | print "Killing Memcached....", | 21 | # Tell lp.services.config to use the testrunner config instance, so that |
215 | 22 | # we don't kill the real services. | ||
216 | 23 | config.setInstance('testrunner') | ||
217 | 24 | config.generate_overrides() | ||
218 | 25 | print("Killing Memcached....", end="") | ||
219 | 31 | kill_by_pidfile(MemcachedLayer.getPidFile()) | 26 | kill_by_pidfile(MemcachedLayer.getPidFile()) |
224 | 32 | print "done." | 27 | print("done.") |
225 | 33 | print "Killing Librarian....", | 28 | print("Killing Librarian....", end="") |
226 | 34 | LibrarianTestSetup().tearDownRoot() | 29 | librarian_fixture = LibrarianServerFixture(None) |
227 | 35 | print "done." | 30 | kill_by_pidfile(librarian_fixture.pidfile) |
228 | 31 | librarian_fixture.tearDownRoot() | ||
229 | 32 | print("done.") | ||
230 | 36 | return 0 | 33 | return 0 |
231 | 37 | |||
232 | 38 | |||
233 | 39 | if __name__ == '__main__': | ||
234 | 40 | sys.exit(main(sys.argv[1:])) | ||
235 | 41 | 34 | ||
236 | === renamed file 'buildout-templates/bin/sprite-util.in' => 'lib/lp/scripts/utilities/spriteutil.py' | |||
237 | --- buildout-templates/bin/sprite-util.in 2012-06-02 12:08:17 +0000 | |||
238 | +++ lib/lp/scripts/utilities/spriteutil.py 2017-01-18 08:50:25 +0000 | |||
239 | @@ -1,59 +1,65 @@ | |||
241 | 1 | #!${buildout:executable} -S | 1 | # Copyright 2010-2017 Canonical Ltd. This software is licensed under the |
242 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
243 | 3 | |||
244 | 4 | """Create sprites.""" | ||
245 | 5 | |||
246 | 6 | from __future__ import absolute_import, print_function | ||
247 | 2 | 7 | ||
248 | 3 | import os | 8 | import os |
249 | 4 | import sys | 9 | import sys |
250 | 5 | 10 | ||
256 | 6 | # Initialize our paths. | 11 | from lp.services.config import config |
252 | 7 | ${python-relative-path-setup} | ||
253 | 8 | sys.path.insert(0, ${scripts:parts-directory|path-repr}) | ||
254 | 9 | import site | ||
255 | 10 | |||
257 | 11 | from lp.services.spriteutils import SpriteUtil | 12 | from lp.services.spriteutils import SpriteUtil |
258 | 12 | 13 | ||
259 | 14 | |||
260 | 13 | command_options = ('create-image', 'create-css') | 15 | command_options = ('create-image', 'create-css') |
261 | 14 | 16 | ||
262 | 17 | |||
263 | 15 | def usage(): | 18 | def usage(): |
264 | 16 | return " Usage: %s %s" % (sys.argv[0], '|'.join(command_options)) | 19 | return " Usage: %s %s" % (sys.argv[0], '|'.join(command_options)) |
265 | 17 | 20 | ||
290 | 18 | if len(sys.argv) != 2: | 21 | |
291 | 19 | print >> sys.stderr, "Expected a single argument." | 22 | def main(): |
292 | 20 | print >> sys.stderr, usage() | 23 | if len(sys.argv) != 2: |
293 | 21 | sys.exit(1) | 24 | print("Expected a single argument.", file=sys.stderr) |
294 | 22 | else: | 25 | print(usage(), file=sys.stderr) |
295 | 23 | command = sys.argv[1] | 26 | sys.exit(1) |
272 | 24 | if command not in command_options: | ||
273 | 25 | print >> sys.stderr, "Unknown argument: %s" % command | ||
274 | 26 | print >> sys.stderr, usage() | ||
275 | 27 | sys.exit(2) | ||
276 | 28 | |||
277 | 29 | icing = ${buildout:directory/lib/canonical/launchpad/icing|path-repr} | ||
278 | 30 | sprite_groups = [ | ||
279 | 31 | file_name.replace('.css.in', '') | ||
280 | 32 | for file_name in os.listdir(icing) if file_name.endswith('.css.in')] | ||
281 | 33 | |||
282 | 34 | for group_name in sprite_groups: | ||
283 | 35 | css_template_file = os.path.join(icing, '%s.css.in' % group_name) | ||
284 | 36 | combined_image_file = os.path.join(icing, '%s.png' % group_name) | ||
285 | 37 | positioning_file = os.path.join(icing, '%s.positioning' % group_name) | ||
286 | 38 | css_file = os.path.join(icing, 'build/%s.css' % group_name) | ||
287 | 39 | if group_name.startswith('block-'): | ||
288 | 40 | # 3 times the size of inline. | ||
289 | 41 | margin = 300 | ||
296 | 42 | else: | 27 | else: |
314 | 43 | # Inline is 2 lines to h1 text + %50 for zooming. 40px + 40px + 20px, | 28 | command = sys.argv[1] |
315 | 44 | margin = 100 | 29 | if command not in command_options: |
316 | 45 | 30 | print("Unknown argument: %s" % command, file=sys.stderr) | |
317 | 46 | sprite_util = SpriteUtil( | 31 | print(usage(), file=sys.stderr) |
318 | 47 | css_template_file, 'icon-sprites', | 32 | sys.exit(2) |
319 | 48 | url_prefix_substitutions={'/@@/': '../images/'}, | 33 | |
320 | 49 | margin=margin) | 34 | icing = os.path.join(config.root, 'lib/canonical/launchpad/icing') |
321 | 50 | 35 | sprite_groups = [ | |
322 | 51 | if command == 'create-image': | 36 | file_name.replace('.css.in', '') |
323 | 52 | sprite_util.combineImages(icing) | 37 | for file_name in os.listdir(icing) if file_name.endswith('.css.in')] |
324 | 53 | sprite_util.savePNG(combined_image_file) | 38 | |
325 | 54 | sprite_util.savePositioning(positioning_file) | 39 | for group_name in sprite_groups: |
326 | 55 | elif command == 'create-css': | 40 | css_template_file = os.path.join(icing, '%s.css.in' % group_name) |
327 | 56 | sprite_util.loadPositioning(positioning_file) | 41 | combined_image_file = os.path.join(icing, '%s.png' % group_name) |
328 | 57 | # The icing/icon-sprites.png file is relative to the css file | 42 | positioning_file = os.path.join(icing, '%s.positioning' % group_name) |
329 | 58 | # in the icing/build/ directory. | 43 | css_file = os.path.join(icing, 'build/%s.css' % group_name) |
330 | 59 | sprite_util.saveConvertedCSS(css_file, '../%s.png' % group_name) | 44 | if group_name.startswith('block-'): |
331 | 45 | # 3 times the size of inline. | ||
332 | 46 | margin = 300 | ||
333 | 47 | else: | ||
334 | 48 | # Inline is 2 lines to h1 text + %50 for zooming. | ||
335 | 49 | # 40px + 40px + 20px | ||
336 | 50 | margin = 100 | ||
337 | 51 | |||
338 | 52 | sprite_util = SpriteUtil( | ||
339 | 53 | css_template_file, 'icon-sprites', | ||
340 | 54 | url_prefix_substitutions={'/@@/': '../images/'}, | ||
341 | 55 | margin=margin) | ||
342 | 56 | |||
343 | 57 | if command == 'create-image': | ||
344 | 58 | sprite_util.combineImages(icing) | ||
345 | 59 | sprite_util.savePNG(combined_image_file) | ||
346 | 60 | sprite_util.savePositioning(positioning_file) | ||
347 | 61 | elif command == 'create-css': | ||
348 | 62 | sprite_util.loadPositioning(positioning_file) | ||
349 | 63 | # The icing/icon-sprites.png file is relative to the css file | ||
350 | 64 | # in the icing/build/ directory. | ||
351 | 65 | sprite_util.saveConvertedCSS(css_file, '../%s.png' % group_name) | ||
352 | 60 | 66 | ||
353 | === added directory 'lib/lp/testing/utilities' | |||
354 | === added file 'lib/lp/testing/utilities/__init__.py' | |||
355 | === renamed file 'buildout-templates/bin/retest.in' => 'lib/lp/testing/utilities/retest.py' | |||
356 | --- buildout-templates/bin/retest.in 2012-01-05 16:22:45 +0000 | |||
357 | +++ lib/lp/testing/utilities/retest.py 2017-01-18 08:50:25 +0000 | |||
358 | @@ -1,6 +1,4 @@ | |||
362 | 1 | #!${buildout:executable} | 1 | # Copyright 2009-2017 Canonical Ltd. This software is licensed under the |
360 | 2 | # | ||
361 | 3 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
363 | 4 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
364 | 5 | 3 | ||
365 | 6 | """ | 4 | """ |
366 | @@ -24,16 +22,19 @@ | |||
367 | 24 | 22 | ||
368 | 25 | """ | 23 | """ |
369 | 26 | 24 | ||
370 | 25 | from __future__ import print_function | ||
371 | 26 | |||
372 | 27 | import fileinput | 27 | import fileinput |
373 | 28 | from itertools import takewhile, imap | ||
374 | 28 | import os | 29 | import os |
375 | 29 | import re | 30 | import re |
376 | 30 | import sys | 31 | import sys |
380 | 31 | from itertools import takewhile, imap | 32 | |
381 | 32 | 33 | from lp.services.config import config | |
382 | 33 | ${python-relative-path-setup} | 34 | |
383 | 34 | 35 | ||
384 | 35 | # The test script for this branch. | 36 | # The test script for this branch. |
386 | 36 | TEST = "${buildout:directory/bin/test}" | 37 | TEST = os.path.join(config.root, "bin/test") |
387 | 37 | 38 | ||
388 | 38 | # Regular expression to match numbered stories. | 39 | # Regular expression to match numbered stories. |
389 | 39 | STORY_RE = re.compile("(.*)/\d{2}-.*") | 40 | STORY_RE = re.compile("(.*)/\d{2}-.*") |
390 | @@ -66,10 +67,12 @@ | |||
391 | 66 | return ( | 67 | return ( |
392 | 67 | line.startswith('Tests with failures:') or | 68 | line.startswith('Tests with failures:') or |
393 | 68 | line.startswith('Tests with errors:')) | 69 | line.startswith('Tests with errors:')) |
394 | 70 | |||
395 | 69 | def p_take(line): | 71 | def p_take(line): |
396 | 70 | return not ( | 72 | return not ( |
397 | 71 | line.isspace() or | 73 | line.isspace() or |
398 | 72 | line.startswith('Total:')) | 74 | line.startswith('Total:')) |
399 | 75 | |||
400 | 73 | lines = iter(lines) | 76 | lines = iter(lines) |
401 | 74 | for line in lines: | 77 | for line in lines: |
402 | 75 | if p_start(line): | 78 | if p_start(line): |
403 | @@ -88,9 +91,9 @@ | |||
404 | 88 | 91 | ||
405 | 89 | def run_tests(tests): | 92 | def run_tests(tests): |
406 | 90 | """Given a set of tests, run them as one group.""" | 93 | """Given a set of tests, run them as one group.""" |
408 | 91 | print "Running tests:" | 94 | print("Running tests:") |
409 | 92 | for test in tests: | 95 | for test in tests: |
411 | 93 | print " %s" % test | 96 | print(" %s" % test) |
412 | 94 | args = ['-vvc'] if sys.stdout.isatty() else ['-vv'] | 97 | args = ['-vvc'] if sys.stdout.isatty() else ['-vv'] |
413 | 95 | for test in tests: | 98 | for test in tests: |
414 | 96 | args.append('-t') | 99 | args.append('-t') |
415 | @@ -98,7 +101,7 @@ | |||
416 | 98 | os.execl(TEST, TEST, *args) | 101 | os.execl(TEST, TEST, *args) |
417 | 99 | 102 | ||
418 | 100 | 103 | ||
420 | 101 | if __name__ == '__main__': | 104 | def main(): |
421 | 102 | lines = imap(decolorize, fileinput.input()) | 105 | lines = imap(decolorize, fileinput.input()) |
422 | 103 | tests = extract_tests(lines) | 106 | tests = extract_tests(lines) |
423 | 104 | if len(tests) >= 1: | 107 | if len(tests) >= 1: |
424 | 105 | 108 | ||
425 | === modified file 'setup.py' | |||
426 | --- setup.py 2016-11-03 15:19:01 +0000 | |||
427 | +++ setup.py 2017-01-18 08:50:25 +0000 | |||
428 | @@ -164,15 +164,19 @@ | |||
429 | 164 | entry_points=dict( | 164 | entry_points=dict( |
430 | 165 | console_scripts=[ # `console_scripts` is a magic name to setuptools | 165 | console_scripts=[ # `console_scripts` is a magic name to setuptools |
431 | 166 | 'apiindex = lp.scripts.utilities.apiindex:main', | 166 | 'apiindex = lp.scripts.utilities.apiindex:main', |
432 | 167 | 'bzr = lp.scripts.utilities.bzr:main', | ||
433 | 168 | 'combine-css = lp.scripts.utilities.js.combinecss:main', | ||
434 | 169 | 'harness = lp.scripts.harness:python', | ||
435 | 170 | 'jsbuild = lp.scripts.utilities.js.jsbuild:main', | ||
436 | 171 | 'kill-test-services = lp.scripts.utilities.killtestservices:main', | ||
437 | 167 | 'killservice = lp.scripts.utilities.killservice:main', | 172 | 'killservice = lp.scripts.utilities.killservice:main', |
439 | 168 | 'jsbuild = lp.scripts.utilities.js.jsbuild:main', | 173 | 'retest = lp.testing.utilities.retest:main', |
440 | 169 | 'run = lp.scripts.runlaunchpad:start_launchpad', | 174 | 'run = lp.scripts.runlaunchpad:start_launchpad', |
444 | 170 | 'run-testapp = ' | 175 | 'run-testapp = lp.scripts.runlaunchpad:start_testapp', |
445 | 171 | 'lp.scripts.runlaunchpad:start_testapp', | 176 | 'sprite-util = lp.scripts.utilities.spriteutil:main', |
446 | 172 | 'harness = lp.scripts.harness:python', | 177 | 'start_librarian = lp.scripts.runlaunchpad:start_librarian', |
447 | 173 | 'twistd = twisted.scripts.twistd:run', | 178 | 'twistd = twisted.scripts.twistd:run', |
450 | 174 | 'start_librarian = ' | 179 | 'watch_jsbuild = lp.scripts.utilities.js.watchjsbuild:main', |
449 | 175 | 'lp.scripts.runlaunchpad:start_librarian', | ||
451 | 176 | ] | 180 | ] |
452 | 177 | ), | 181 | ), |
453 | 178 | ) | 182 | ) |