Merge lp:~bjornt/lazr-js/buildoutification into lp:lazr-js
- buildoutification
- Merge into toolchain
Status: | Merged |
---|---|
Approved by: | Gary Poster |
Approved revision: | 123 |
Merged at revision: | not available |
Proposed branch: | lp:~bjornt/lazr-js/buildoutification |
Merge into: | lp:lazr-js |
Diff against target: |
808 lines 12 files modified
.bzrignore (+9/-0) MANIFEST.in (+5/-0) Makefile (+27/-4) README.txt (+14/-0) bootstrap.py (+170/-0) buildout.cfg (+32/-0) ez_setup.py (+275/-0) setup.py (+47/-0) src-py/lazr/__init__.py (+8/-0) src-py/lazr/js/build.py (+23/-11) src-py/lazr/js/jslint.py (+2/-3) src-py/lazr/js/scaffold.py (+2/-3) |
To merge this branch: | bzr merge lp:~bjornt/lazr-js/buildoutification |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gary Poster (community) | Approve | ||
Canonical Launchpad Engineering | Pending | ||
Review via email: mp+13003@code.launchpad.net |
Commit message
Description of the change
Björn Tillenius (bjornt) wrote : | # |
Björn Tillenius (bjornt) wrote : | # |
Gary Poster (gary) wrote : | # |
Hi Bjorn. This is great to see.
I think we can simplify the setup. I don't know if we need as many of the tricks that Launchpad uses. Here's a diff that removes a lot of them. This should be regarded as a conversation starter, rather than as a concrete suggestion. I'll call out the ideas here, and then you can see them concretely in the diff. I've marked the items that I strongly think are valid with three stars (***).
- Launchpad keeps a separate, shared download-cache and eggs. That makes sense if the build is happening on a machine that does not allow network access, or if we want to prevent being exposed to PyPI service interruptions, or if we want to use custom distributions. On the other hand, if we remove that, we can have a simpler build. If developers want shared eggs, they can set up a global cache (https:/
- I don't see any reason to specify the BUILDOUT_CFG in the Makefile. There's only one.
- ``make clean`` might as well just trash the bin directory. ***
- We can just use the interpreter option for zc.recipe.egg to produce the py file, and remove the z3c.recipe.
- The entry points maybe ought to be in the setup.py file, so someone can use it without buildout. Maybe. Anyway, might as well put it in the expected place. ***
- No need to specify extra-paths in buildout.cfg. You are already doing the right thing in setup.py. ***
- If we change the Makefile to use -S whenever it calls Python, we don't need my custom releases of buildout that handle a system Python (which Jim still has on his queue to review), so we can just use released versions of the various packages. (On the other hand, if Jim approves my changes, we could arguably just get rid of the Makefile entirely and instruct people to run ``python bootstrap.py && bin/buildout && bin/build`` or something to get the build.)
- Including ez_setup.py was another artifact of wanting to be able to build on a machine that had no outside net access. If we don't need to support that, we can remove it (and the reference in setup.py).
If you agree with all of these thoughts, you can take the diff as is. Otherwise, hopefully it will still give us something to talk about it. If you just change the starred items, and push back convincingly on the rest, that will probably be fine.
Thanks!
Gary
=== modified file '.bzrignore'
--- .bzrignore 2009-09-23 13:25:32 +0000
+++ .bzrignore 2009-10-07 19:34:10 +0000
@@ -7,6 +7,4 @@
parts
src/inlineedit
src/lazr/
-./download-cache
-./eggs
./MANIFEST
=== modified file 'Makefile'
--- Makefile 2009-10-07 15:42:30 +0000
+++ Makefile 2009-10-07 19:58:20 +0000
@@ -5,35 +5,21 @@
PYTHON=
WD:=$(shell pwd)
PY=$(WD)/bin/py
-BUILDOUT_CFG=bu...
- 119. By Björn Tillenius
-
Don't specify BUILDOUT_CFG in the Makefile, since we have only one config.
- 120. By Björn Tillenius
-
Trash the whole bin/ directory in 'make clean'.
- 121. By Björn Tillenius
-
Get rid of buildout-templates.
- 122. By Björn Tillenius
-
Specify which scripts should be generated in setup.py instead of in buildout.cfg.
- 123. By Björn Tillenius
-
No need to depend on z.recipe.
filetemplate anymore.
Björn Tillenius (bjornt) wrote : | # |
On Wed, Oct 07, 2009 at 08:11:57PM -0000, Gary Poster wrote:
> Review: Needs Fixing
> Hi Bjorn. This is great to see.
>
> I think we can simplify the setup. I don't know if we need as many of
> the tricks that Launchpad uses. Here's a diff that removes a lot of
> them. This should be regarded as a conversation starter, rather than as
> a concrete suggestion. I'll call out the ideas here, and then you can
> see them concretely in the diff. I've marked the items that I strongly
> think are valid with three stars (***).
Right, I was meaning for this MP to be the start of a conversation, so
that we had a diff we could look at. Many of the things I simply took
from LP.
> - Launchpad keeps a separate, shared download-cache and eggs. That
> makes sense if the build is happening on a machine that does not allow
> network access, or if we want to prevent being exposed to PyPI service
> interruptions, or if we want to use custom distributions. On the other
> hand, if we remove that, we can have a simpler build. If developers
> want shared eggs, they can set up a global cache
> (https:/
> change affects .bzrignore, and the Makefile (including the bin/buildout
> target).
There is some value in always using a download-cache. The main reason is
would be to help people remember adding things to the download-cache
branch, whenever they add a new dependencies. We do have want to run
tests using PQM or buildbot, and those machines won't have net access.
Although, I said I wanted to worry about this after landing this branch
(since for LP to use it it doesn't matter), so I guess I could remove it
for now, and we can decide what to do later.
> - I don't see any reason to specify the BUILDOUT_CFG in the Makefile.
> There's only one.
Right, this was copied from LP; removed.
> - ``make clean`` might as well just trash the bin directory. ***
Right, makes sense; done.
> - We can just use the interpreter option for zc.recipe.egg to produce
> the py file, and remove the z3c.recipe.
> buildout-templates directory). We made the py file in Launchpad like
> that because Launchpad's Makefile wanted to use the -t option. (I have
> a branch I'm working on for Launchpad that switches it to using the
> interpreter option also.) ***
Indeed, this is simpler, this was another copy from LP. I've changed it
to use the interpreter option and removed the z3c.recipe.
dependency.
> - The entry points maybe ought to be in the setup.py file, so someone
> can use it without buildout. Maybe. Anyway, might as well put it in
> the expected place. ***
Yep, having them in setup.py is better, I didn't know that it was
enough. Fixed.
> - No need to specify extra-paths in buildout.cfg. You are already
> doing the right thing in setup.py. ***
Yes. It was necessary at one point, but now it's not needed anymore, so
I've removed it.
> - If we change the Makefile to use -S whenever it calls Python, we
> don't need my custom releases of buildout that handle a system Python
> (which Jim still has on his queue to review), so we can just use
> released versions of the...
1 | === modified file 'Makefile' |
2 | --- Makefile 2009-10-07 15:42:30 +0000 |
3 | +++ Makefile 2009-10-08 13:20:27 +0000 |
4 | @@ -5,7 +5,6 @@ |
5 | PYTHON=python${PYTHON_VERSION} |
6 | WD:=$(shell pwd) |
7 | PY=$(WD)/bin/py |
8 | -BUILDOUT_CFG=buildout.cfg |
9 | |
10 | # Update the build directory |
11 | build: $(PY) |
12 | @@ -29,11 +28,11 @@ |
13 | --ez_setup-source=ez_setup.py \ |
14 | --download-base=download-cache/dist --eggs=eggs |
15 | |
16 | -$(PY): bin/buildout $(BUILDOUT_CFG) setup.py |
17 | - PYTHONPATH= ./bin/buildout -c $(BUILDOUT_CFG) |
18 | +$(PY): bin/buildout buildout.cfg setup.py |
19 | + PYTHONPATH= ./bin/buildout -c buildout.cfg |
20 | |
21 | |
22 | clean: |
23 | - rm -fr build/* bin/buildout |
24 | + rm -fr build/* bin |
25 | |
26 | .PHONY: build lint clean |
27 | |
28 | === removed directory 'buildout-templates' |
29 | === removed directory 'buildout-templates/bin' |
30 | === removed file 'buildout-templates/bin/py.in' |
31 | --- buildout-templates/bin/py.in 2009-09-23 12:17:15 +0000 |
32 | +++ buildout-templates/bin/py.in 1970-01-01 00:00:00 +0000 |
33 | @@ -1,2 +0,0 @@ |
34 | -#!/bin/sh |
35 | -PYTHONPATH=${os-paths} exec ${buildout:executable} "$@" |
36 | |
37 | === modified file 'buildout.cfg' |
38 | --- buildout.cfg 2009-10-07 15:42:57 +0000 |
39 | +++ buildout.cfg 2009-10-08 12:58:21 +0000 |
40 | @@ -1,7 +1,6 @@ |
41 | [buildout] |
42 | develop = . |
43 | parts = |
44 | - filetemplates |
45 | scripts |
46 | |
47 | unzip = true |
48 | @@ -23,19 +22,10 @@ |
49 | |
50 | versions = versions |
51 | |
52 | -[filetemplates] |
53 | -recipe = z3c.recipe.filetemplate |
54 | -eggs = lazr-js |
55 | -source-directory = buildout-templates |
56 | - |
57 | [scripts] |
58 | recipe = zc.recipe.egg |
59 | +interpreter = py |
60 | eggs = lazr-js |
61 | -entry-points = |
62 | - build=lazr.js.build:main |
63 | - jslint=lazr.js.jslint:main |
64 | - scaffold=lazr.js.scaffold:main |
65 | -extra-paths = ${buildout:directory}/src-py |
66 | |
67 | [versions] |
68 | # Alphabetical, case-insensitive, please! :-) |
69 | @@ -43,4 +33,3 @@ |
70 | setuptools = 0.6c9 |
71 | zc.buildout = 1.5.0dev-gary-r103553 |
72 | zc.recipe.egg = 1.3.0dev-gary-r103515 |
73 | -z3c.recipe.filetemplate = 2.1dev-gary-r103545 |
74 | |
75 | === modified file 'setup.py' |
76 | --- setup.py 2009-10-07 15:43:55 +0000 |
77 | +++ setup.py 2009-10-08 12:57:02 +0000 |
78 | @@ -39,6 +39,9 @@ |
79 | ), |
80 | entry_points=dict( |
81 | console_scripts=[ |
82 | + 'build=lazr.js.build:main', |
83 | + 'jslint=lazr.js.jslint:main', |
84 | + 'scaffold=lazr.js.scaffold:main', |
85 | ] |
86 | ), |
87 | ) |
Gary Poster (gary) wrote : | # |
On Oct 8, 2009, at 9:24 AM, Björn Tillenius wrote:
> On Wed, Oct 07, 2009 at 08:11:57PM -0000, Gary Poster wrote:
>> Review: Needs Fixing
>> Hi Bjorn. This is great to see.
>>
>> I think we can simplify the setup. I don't know if we need as many
>> of
>> the tricks that Launchpad uses. Here's a diff that removes a lot of
>> them. This should be regarded as a conversation starter, rather
>> than as
>> a concrete suggestion. I'll call out the ideas here, and then you
>> can
>> see them concretely in the diff. I've marked the items that I
>> strongly
>> think are valid with three stars (***).
>
> Right, I was meaning for this MP to be the start of a conversation, so
> that we had a diff we could look at. Many of the things I simply took
> from LP.
Cool.
>> - Launchpad keeps a separate, shared download-cache and eggs. That
>> makes sense if the build is happening on a machine that does not
>> allow
>> network access, or if we want to prevent being exposed to PyPI
>> service
>> interruptions, or if we want to use custom distributions. On the
>> other
>> hand, if we remove that, we can have a simpler build. If developers
>> want shared eggs, they can set up a global cache
>> (https:/
>> This
>> change affects .bzrignore, and the Makefile (including the bin/
>> buildout
>> target).
>
> There is some value in always using a download-cache.
Agreed. There are other ways to get some of the same value (a repo
managed by Canonical/Launchpad would give us the benefit of protection
from PyPI outages, for instance). But still agreed.
> The main reason is
> would be to help people remember adding things to the download-cache
> branch, whenever they add a new dependencies. We do have want to run
> tests using PQM or buildbot, and those machines won't have net access.
buildbot has net access, but PQM doesn't. Sometimes developers don't
have net access, also, and a download-cache lets them be productive
then.
> Although, I said I wanted to worry about this after landing this
> branch
> (since for LP to use it it doesn't matter), so I guess I could
> remove it
> for now, and we can decide what to do later.
I don't have a strong opinion about it. I just want to point out some
possible simplifications for your consideration.
...
>> - If we change the Makefile to use -S whenever it calls Python, we
>> don't need my custom releases of buildout that handle a system Python
>> (which Jim still has on his queue to review), so we can just use
>> released versions of the various packages. (On the other hand, if
>> Jim
>> approves my changes, we could arguably just get rid of the Makefile
>> entirely and instruct people to run ``python bootstrap.py &&
>> bin/buildout && bin/build`` or something to get the build.)
>
> So, I think this change sounds good, but could you expand a bit more
> on
> that the difference between 'python -S bin/build' and 'bin/build'
> is? I
> don't quite understand why the former is better.
Because not running site.py (python -S) means that site-packages are
not included, which means that we don't get complications from using a
...
- 124. By Björn Tillenius
-
Use python -S.
- 125. By Björn Tillenius
-
Remove unused config options.
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2009-01-07 19:57:04 +0000 |
3 | +++ .bzrignore 2009-10-27 09:01:09 +0000 |
4 | @@ -1,3 +1,12 @@ |
5 | +.installed.cfg |
6 | +./bin |
7 | build/* |
8 | +develop-eggs |
9 | +dist |
10 | +lib/*.egg-info |
11 | +parts |
12 | src/inlineedit/assets/skins/sam/inlineedit.css |
13 | src/lazr/assets/skins/sam/lazr.css |
14 | +./download-cache |
15 | +./eggs |
16 | +./MANIFEST |
17 | |
18 | === added file 'MANIFEST.in' |
19 | --- MANIFEST.in 1970-01-01 00:00:00 +0000 |
20 | +++ MANIFEST.in 2009-10-27 09:01:09 +0000 |
21 | @@ -0,0 +1,5 @@ |
22 | +include *.txt Makefile |
23 | +recursive-include examples/ * |
24 | +recursive-include src-py * |
25 | +recursive-include src-js * |
26 | +include ez_setup.py |
27 | |
28 | === modified file 'Makefile' |
29 | --- Makefile 2009-03-13 19:23:08 +0000 |
30 | +++ Makefile 2009-10-27 09:01:09 +0000 |
31 | @@ -1,15 +1,38 @@ |
32 | # Simple makefile for lazr-js. |
33 | # |
34 | # |
35 | +PYTHON_VERSION= |
36 | +PYTHON=python${PYTHON_VERSION} |
37 | +WD:=$(shell pwd) |
38 | +PY=$(WD)/bin/py |
39 | |
40 | # Update the build directory |
41 | -build: |
42 | - $(PYTHON) tools/build.py |
43 | +build: $(PY) |
44 | + $(PYTHON) -S bin/build |
45 | |
46 | lint: |
47 | - $(PYTHON) tools/jslint.py |
48 | + $(PYTHON) -S bin/jslint |
49 | + |
50 | +eggs: |
51 | + mkdir eggs |
52 | + |
53 | +download-cache: |
54 | + @$echo "Missing ./download-cache." |
55 | + @exit 1 |
56 | + |
57 | +# The download-cache dependency comes *before* eggs so that developers get the |
58 | +# warning before the eggs directory is made. The target for the eggs directory |
59 | +# is only there for deployment convenience. |
60 | +bin/buildout: download-cache eggs |
61 | + $(SHHH) $(PYTHON) -S bootstrap.py\ |
62 | + --ez_setup-source=ez_setup.py \ |
63 | + --download-base=download-cache/dist --eggs=eggs |
64 | + |
65 | +$(PY): bin/buildout buildout.cfg setup.py |
66 | + $(PYTHON) -S ./bin/buildout |
67 | + |
68 | |
69 | clean: |
70 | - rm -fr build/* |
71 | + rm -fr build/* bin |
72 | |
73 | .PHONY: build lint clean |
74 | |
75 | === added file 'README.txt' |
76 | --- README.txt 1970-01-01 00:00:00 +0000 |
77 | +++ README.txt 2009-10-27 09:01:09 +0000 |
78 | @@ -0,0 +1,14 @@ |
79 | +Lazr-JS: Sleek and sexy AJAX widgets for the new web |
80 | +==================================================== |
81 | + |
82 | +This is a collection of AJAX-ready widgets building on YUI3. |
83 | + |
84 | + * anim:: useful animations. |
85 | + * choiceedit:: picker for a small list of choices |
86 | + * formoverlay:: AJAXIFY a regular web form |
87 | + * inlineedit:: inline text editor |
88 | + * lazr:: utility modules |
89 | + * overlay:: a popup window |
90 | + * picker:: searchable vocabulary picker |
91 | + * testing:: test framework |
92 | + |
93 | |
94 | === added file 'bootstrap.py' |
95 | --- bootstrap.py 1970-01-01 00:00:00 +0000 |
96 | +++ bootstrap.py 2009-10-27 09:01:09 +0000 |
97 | @@ -0,0 +1,170 @@ |
98 | +############################################################################## |
99 | +# |
100 | +# Copyright (c) 2006 Zope Corporation and Contributors. |
101 | +# All Rights Reserved. |
102 | +# |
103 | +# This software is subject to the provisions of the Zope Public License, |
104 | +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. |
105 | +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
106 | +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
107 | +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
108 | +# FOR A PARTICULAR PURPOSE. |
109 | +# |
110 | +############################################################################## |
111 | +"""Bootstrap a buildout-based project |
112 | + |
113 | +Simply run this script in a directory containing a buildout.cfg. |
114 | +The script accepts buildout command-line options, so you can |
115 | +use the -c option to specify an alternate configuration file. |
116 | + |
117 | +$Id: bootstrap.py 101930 2009-07-15 18:34:35Z gary $ |
118 | +""" |
119 | + |
120 | +import os, re, shutil, sys, tempfile, textwrap, urllib, urllib2 |
121 | + |
122 | +# We have to manually parse our options rather than using one of the stdlib |
123 | +# tools because we want to pass the ones we don't recognize along to |
124 | +# zc.buildout.buildout.main. |
125 | + |
126 | +configuration = { |
127 | + '--ez_setup-source': 'http://peak.telecommunity.com/dist/ez_setup.py', |
128 | + '--version': '', |
129 | + '--download-base': None, |
130 | + '--eggs': None} |
131 | + |
132 | +helpstring = __doc__ + textwrap.dedent(''' |
133 | + This script recognizes the following options itself. The first option it |
134 | + encounters that is not one of these will cause the script to stop parsing |
135 | + options and pass the rest on to buildout. Therefore, if you want to use |
136 | + any of the following options *and* buildout command-line options like |
137 | + -c, first use the following options, and then use the buildout options. |
138 | + |
139 | + Options: |
140 | + --version=ZC_BUILDOUT_VERSION |
141 | + Specify a version number of the zc.buildout to use |
142 | + --ez_setup-source=URL_OR_FILE |
143 | + Specify a URL or file location for the ez_setup file. |
144 | + Defaults to |
145 | + %(--ez_setup-source)s |
146 | + --download-base=URL_OR_DIRECTORY |
147 | + Specify a URL or directory for downloading setuptools and |
148 | + zc.buildout. Defaults to PyPI. |
149 | + --eggs=DIRECTORY |
150 | + Specify a directory for storing eggs. Defaults to a temporary |
151 | + directory that is deleted when the bootstrap script completes. |
152 | + |
153 | + By using --ez_setup-source and --download-base to point to local resources, |
154 | + you can keep this script from going over the network. |
155 | + ''' % configuration) |
156 | +match_equals = re.compile(r'(%s)=(.*)' % ('|'.join(configuration),)).match |
157 | +args = sys.argv[1:] |
158 | +if args == ['--help']: |
159 | + print helpstring |
160 | + sys.exit(0) |
161 | + |
162 | +# If we end up using a temporary directory for storing our eggs, this will |
163 | +# hold the path of that directory. On the other hand, if an explicit directory |
164 | +# is specified in the argv, this will remain None. |
165 | +tmpeggs = None |
166 | + |
167 | +while args: |
168 | + val = args[0] |
169 | + if val in configuration: |
170 | + del args[0] |
171 | + if not args or args[0].startswith('-'): |
172 | + print "ERROR: %s requires an argument." |
173 | + print helpstring |
174 | + sys.exit(1) |
175 | + configuration[val] = args[0] |
176 | + else: |
177 | + match = match_equals(val) |
178 | + if match and match.group(1) in configuration: |
179 | + configuration[match.group(1)] = match.group(2) |
180 | + else: |
181 | + break |
182 | + del args[0] |
183 | + |
184 | +for name in ('--ez_setup-source', '--download-base'): |
185 | + val = configuration[name] |
186 | + if val is not None and '://' not in val: # We're being lazy. |
187 | + configuration[name] = 'file://%s' % ( |
188 | + urllib.pathname2url(os.path.abspath(os.path.expanduser(val))),) |
189 | + |
190 | +if (configuration['--download-base'] and |
191 | + not configuration['--download-base'].endswith('/')): |
192 | + # Download base needs a trailing slash to make the world happy. |
193 | + configuration['--download-base'] += '/' |
194 | + |
195 | +if not configuration['--eggs']: |
196 | + configuration['--eggs'] = tmpeggs = tempfile.mkdtemp() |
197 | +else: |
198 | + configuration['--eggs'] = os.path.abspath( |
199 | + os.path.expanduser(configuration['--eggs'])) |
200 | + |
201 | +# The requirement is what we will pass to setuptools to specify zc.buildout. |
202 | +requirement = 'zc.buildout' |
203 | +if configuration['--version']: |
204 | + requirement += '==' + configuration['--version'] |
205 | + |
206 | +try: |
207 | + import setuptools # A flag. Sometimes pkg_resources is installed alone. |
208 | + import pkg_resources |
209 | +except ImportError: |
210 | + ez = {} |
211 | + exec urllib2.urlopen(configuration['--ez_setup-source']).read() in ez |
212 | + setuptools_args = dict(to_dir=configuration['--eggs'], download_delay=0) |
213 | + if configuration['--download-base']: |
214 | + setuptools_args['download_base'] = configuration['--download-base'] |
215 | + ez['use_setuptools'](**setuptools_args) |
216 | + import pkg_resources |
217 | + # This does not (always?) update the default working set. We will |
218 | + # do it. |
219 | + for path in sys.path: |
220 | + if path not in pkg_resources.working_set.entries: |
221 | + pkg_resources.working_set.add_entry(path) |
222 | + |
223 | +if sys.platform == 'win32': |
224 | + def quote(c): |
225 | + if ' ' in c: |
226 | + return '"%s"' % c # work around spawn lamosity on windows |
227 | + else: |
228 | + return c |
229 | +else: |
230 | + def quote (c): |
231 | + return c |
232 | +cmd = [quote(sys.executable), |
233 | + '-c', |
234 | + quote('from setuptools.command.easy_install import main; main()'), |
235 | + '-mqNxd', |
236 | + quote(configuration['--eggs'])] |
237 | + |
238 | +if configuration['--download-base']: |
239 | + cmd.extend(['-f', quote(configuration['--download-base'])]) |
240 | + |
241 | +cmd.append(requirement) |
242 | + |
243 | +ws = pkg_resources.working_set |
244 | +env = dict( |
245 | + os.environ, |
246 | + PYTHONPATH=ws.find(pkg_resources.Requirement.parse('setuptools')).location) |
247 | + |
248 | +is_jython = sys.platform.startswith('java') |
249 | +if is_jython: |
250 | + import subprocess |
251 | + exitcode = subprocess.Popen(cmd, env=env).wait() |
252 | +else: # Windows needs this, apparently; otherwise we would prefer subprocess |
253 | + exitcode = os.spawnle(*([os.P_WAIT, sys.executable] + cmd + [env])) |
254 | +if exitcode != 0: |
255 | + sys.stdout.flush() |
256 | + print ("An error occured when trying to install zc.buildout. " |
257 | + "Look above this message for any errors that " |
258 | + "were output by easy_install.") |
259 | + sys.exit(exitcode) |
260 | + |
261 | +ws.add_entry(configuration['--eggs']) |
262 | +ws.require(requirement) |
263 | +import zc.buildout.buildout |
264 | +args.append('bootstrap') |
265 | +zc.buildout.buildout.main(args) |
266 | +if tmpeggs is not None: |
267 | + shutil.rmtree(tmpeggs) |
268 | |
269 | === added file 'buildout.cfg' |
270 | --- buildout.cfg 1970-01-01 00:00:00 +0000 |
271 | +++ buildout.cfg 2009-10-27 09:01:09 +0000 |
272 | @@ -0,0 +1,32 @@ |
273 | +[buildout] |
274 | +develop = . |
275 | +parts = |
276 | + scripts |
277 | + |
278 | +unzip = true |
279 | +eggs-directory = eggs |
280 | +download-cache = download-cache |
281 | + |
282 | +# Disable this option temporarily if you want buildout to find software |
283 | +# dependencies *other* than those in our download-cache. Once you have the |
284 | +# desired software, reenable this option (and check in the new software to |
285 | +# lp:lp-source-dependencies if this is going to be reviewed/merged/deployed.) |
286 | +install-from-cache = true |
287 | + |
288 | +allow-picked-versions = false |
289 | + |
290 | +prefer-final = true |
291 | + |
292 | +versions = versions |
293 | + |
294 | +[scripts] |
295 | +recipe = zc.recipe.egg |
296 | +interpreter = py |
297 | +eggs = lazr-js |
298 | + |
299 | +[versions] |
300 | +# Alphabetical, case-insensitive, please! :-) |
301 | +bzr = 2.0.0 |
302 | +setuptools = 0.6c9 |
303 | +zc.buildout = 1.4.1 |
304 | +zc.recipe.egg = 1.2.2 |
305 | |
306 | === added file 'ez_setup.py' |
307 | --- ez_setup.py 1970-01-01 00:00:00 +0000 |
308 | +++ ez_setup.py 2009-10-27 09:01:09 +0000 |
309 | @@ -0,0 +1,275 @@ |
310 | +#!python |
311 | +"""Bootstrap setuptools installation |
312 | + |
313 | +If you want to use setuptools in your package's setup.py, just include this |
314 | +file in the same directory with it, and add this to the top of your setup.py:: |
315 | + |
316 | + from ez_setup import use_setuptools |
317 | + use_setuptools() |
318 | + |
319 | +If you want to require a specific version of setuptools, set a download |
320 | +mirror, or use an alternate download directory, you can do so by supplying |
321 | +the appropriate options to ``use_setuptools()``. |
322 | + |
323 | +This file can also be run as a script to install or upgrade setuptools. |
324 | +""" |
325 | +import sys |
326 | +DEFAULT_VERSION = "0.6c9" |
327 | +DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3] |
328 | + |
329 | +md5_data = { |
330 | + 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca', |
331 | + 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb', |
332 | + 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b', |
333 | + 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a', |
334 | + 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618', |
335 | + 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac', |
336 | + 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5', |
337 | + 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4', |
338 | + 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c', |
339 | + 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b', |
340 | + 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27', |
341 | + 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277', |
342 | + 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa', |
343 | + 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e', |
344 | + 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e', |
345 | + 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f', |
346 | + 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2', |
347 | + 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc', |
348 | + 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167', |
349 | + 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64', |
350 | + 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d', |
351 | + 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20', |
352 | + 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab', |
353 | + 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53', |
354 | + 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2', |
355 | + 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e', |
356 | + 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372', |
357 | + 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902', |
358 | + 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de', |
359 | + 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b', |
360 | + 'setuptools-0.6c9-py2.3.egg': 'a83c4020414807b496e4cfbe08507c03', |
361 | + 'setuptools-0.6c9-py2.4.egg': '260a2be2e5388d66bdaee06abec6342a', |
362 | + 'setuptools-0.6c9-py2.5.egg': 'fe67c3e5a17b12c0e7c541b7ea43a8e6', |
363 | + 'setuptools-0.6c9-py2.6.egg': 'ca37b1ff16fa2ede6e19383e7b59245a', |
364 | +} |
365 | + |
366 | +import sys, os |
367 | +try: from hashlib import md5 |
368 | +except ImportError: from md5 import md5 |
369 | + |
370 | +def _validate_md5(egg_name, data): |
371 | + if egg_name in md5_data: |
372 | + digest = md5(data).hexdigest() |
373 | + if digest != md5_data[egg_name]: |
374 | + print >>sys.stderr, ( |
375 | + "md5 validation of %s failed! (Possible download problem?)" |
376 | + % egg_name |
377 | + ) |
378 | + sys.exit(2) |
379 | + return data |
380 | + |
381 | +def use_setuptools( |
382 | + version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, |
383 | + download_delay=15 |
384 | +): |
385 | + """Automatically find/download setuptools and make it available on sys.path |
386 | + |
387 | + `version` should be a valid setuptools version number that is available |
388 | + as an egg for download under the `download_base` URL (which should end with |
389 | + a '/'). `to_dir` is the directory where setuptools will be downloaded, if |
390 | + it is not already available. If `download_delay` is specified, it should |
391 | + be the number of seconds that will be paused before initiating a download, |
392 | + should one be required. If an older version of setuptools is installed, |
393 | + this routine will print a message to ``sys.stderr`` and raise SystemExit in |
394 | + an attempt to abort the calling script. |
395 | + """ |
396 | + was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules |
397 | + def do_download(): |
398 | + egg = download_setuptools(version, download_base, to_dir, download_delay) |
399 | + sys.path.insert(0, egg) |
400 | + import setuptools; setuptools.bootstrap_install_from = egg |
401 | + try: |
402 | + import pkg_resources |
403 | + except ImportError: |
404 | + return do_download() |
405 | + try: |
406 | + pkg_resources.require("setuptools>="+version); return |
407 | + except pkg_resources.VersionConflict, e: |
408 | + if was_imported: |
409 | + print >>sys.stderr, ( |
410 | + "The required version of setuptools (>=%s) is not available, and\n" |
411 | + "can't be installed while this script is running. Please install\n" |
412 | + " a more recent version first, using 'easy_install -U setuptools'." |
413 | + "\n\n(Currently using %r)" |
414 | + ) % (version, e.args[0]) |
415 | + sys.exit(2) |
416 | + else: |
417 | + del pkg_resources, sys.modules['pkg_resources'] # reload ok |
418 | + return do_download() |
419 | + except pkg_resources.DistributionNotFound: |
420 | + return do_download() |
421 | + |
422 | +def download_setuptools( |
423 | + version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, |
424 | + delay = 15 |
425 | +): |
426 | + """Download setuptools from a specified location and return its filename |
427 | + |
428 | + `version` should be a valid setuptools version number that is available |
429 | + as an egg for download under the `download_base` URL (which should end |
430 | + with a '/'). `to_dir` is the directory where the egg will be downloaded. |
431 | + `delay` is the number of seconds to pause before an actual download attempt. |
432 | + """ |
433 | + import urllib2, shutil |
434 | + egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3]) |
435 | + url = download_base + egg_name |
436 | + saveto = os.path.join(to_dir, egg_name) |
437 | + src = dst = None |
438 | + if not os.path.exists(saveto): # Avoid repeated downloads |
439 | + try: |
440 | + from distutils import log |
441 | + if delay: |
442 | + log.warn(""" |
443 | +--------------------------------------------------------------------------- |
444 | +This script requires setuptools version %s to run (even to display |
445 | +help). I will attempt to download it for you (from |
446 | +%s), but |
447 | +you may need to enable firewall access for this script first. |
448 | +I will start the download in %d seconds. |
449 | + |
450 | +(Note: if this machine does not have network access, please obtain the file |
451 | + |
452 | + %s |
453 | + |
454 | +and place it in this directory before rerunning this script.) |
455 | +---------------------------------------------------------------------------""", |
456 | + version, download_base, delay, url |
457 | + ); from time import sleep; sleep(delay) |
458 | + log.warn("Downloading %s", url) |
459 | + src = urllib2.urlopen(url) |
460 | + # Read/write all in one block, so we don't create a corrupt file |
461 | + # if the download is interrupted. |
462 | + data = _validate_md5(egg_name, src.read()) |
463 | + dst = open(saveto,"wb"); dst.write(data) |
464 | + finally: |
465 | + if src: src.close() |
466 | + if dst: dst.close() |
467 | + return os.path.realpath(saveto) |
468 | + |
469 | + |
470 | + |
471 | + |
472 | + |
473 | + |
474 | + |
475 | + |
476 | + |
477 | + |
478 | + |
479 | + |
480 | + |
481 | + |
482 | + |
483 | + |
484 | + |
485 | + |
486 | + |
487 | + |
488 | + |
489 | + |
490 | + |
491 | + |
492 | + |
493 | + |
494 | + |
495 | + |
496 | + |
497 | + |
498 | + |
499 | + |
500 | + |
501 | + |
502 | + |
503 | + |
504 | +def main(argv, version=DEFAULT_VERSION): |
505 | + """Install or upgrade setuptools and EasyInstall""" |
506 | + try: |
507 | + import setuptools |
508 | + except ImportError: |
509 | + egg = None |
510 | + try: |
511 | + egg = download_setuptools(version, delay=0) |
512 | + sys.path.insert(0,egg) |
513 | + from setuptools.command.easy_install import main |
514 | + return main(list(argv)+[egg]) # we're done here |
515 | + finally: |
516 | + if egg and os.path.exists(egg): |
517 | + os.unlink(egg) |
518 | + else: |
519 | + if setuptools.__version__ == '0.0.1': |
520 | + print >>sys.stderr, ( |
521 | + "You have an obsolete version of setuptools installed. Please\n" |
522 | + "remove it from your system entirely before rerunning this script." |
523 | + ) |
524 | + sys.exit(2) |
525 | + |
526 | + req = "setuptools>="+version |
527 | + import pkg_resources |
528 | + try: |
529 | + pkg_resources.require(req) |
530 | + except pkg_resources.VersionConflict: |
531 | + try: |
532 | + from setuptools.command.easy_install import main |
533 | + except ImportError: |
534 | + from easy_install import main |
535 | + main(list(argv)+[download_setuptools(delay=0)]) |
536 | + sys.exit(0) # try to force an exit |
537 | + else: |
538 | + if argv: |
539 | + from setuptools.command.easy_install import main |
540 | + main(argv) |
541 | + else: |
542 | + print "Setuptools version",version,"or greater has been installed." |
543 | + print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)' |
544 | + |
545 | +def update_md5(filenames): |
546 | + """Update our built-in md5 registry""" |
547 | + |
548 | + import re |
549 | + |
550 | + for name in filenames: |
551 | + base = os.path.basename(name) |
552 | + f = open(name,'rb') |
553 | + md5_data[base] = md5(f.read()).hexdigest() |
554 | + f.close() |
555 | + |
556 | + data = [" %r: %r,\n" % it for it in md5_data.items()] |
557 | + data.sort() |
558 | + repl = "".join(data) |
559 | + |
560 | + import inspect |
561 | + srcfile = inspect.getsourcefile(sys.modules[__name__]) |
562 | + f = open(srcfile, 'rb'); src = f.read(); f.close() |
563 | + |
564 | + match = re.search("\nmd5_data = {\n([^}]+)}", src) |
565 | + if not match: |
566 | + print >>sys.stderr, "Internal error!" |
567 | + sys.exit(2) |
568 | + |
569 | + src = src[:match.start(1)] + repl + src[match.end(1):] |
570 | + f = open(srcfile,'w') |
571 | + f.write(src) |
572 | + f.close() |
573 | + |
574 | + |
575 | +if __name__=='__main__': |
576 | + if len(sys.argv)>2 and sys.argv[1]=='--md5update': |
577 | + update_md5(sys.argv[2:]) |
578 | + else: |
579 | + main(sys.argv[1:]) |
580 | + |
581 | + |
582 | + |
583 | + |
584 | + |
585 | |
586 | === removed symlink 'lib/lazr/build' |
587 | === target was '../../build' |
588 | === added file 'setup.py' |
589 | --- setup.py 1970-01-01 00:00:00 +0000 |
590 | +++ setup.py 2009-10-27 09:01:09 +0000 |
591 | @@ -0,0 +1,47 @@ |
592 | +# Copyright 2009 Canonical Ltd. All rights reserved. |
593 | + |
594 | +import ez_setup |
595 | +ez_setup.use_setuptools() |
596 | + |
597 | +import sys |
598 | +from setuptools import setup, find_packages |
599 | + |
600 | +__version__ = '0.9' |
601 | + |
602 | + |
603 | +setup( |
604 | + name='lazr-js', |
605 | + namespace_packages=['lazr'], |
606 | + version=__version__, |
607 | + packages=['lazr', 'lazrjs'], |
608 | + py_modules=['jsmin', 'slimmer'], |
609 | + package_dir={ |
610 | + 'lazrjs': 'src-js/lazrjs', |
611 | + '': 'src-py'}, |
612 | + include_package_data=True, |
613 | + zip_safe=False, |
614 | + maintainer='Canonical JavaScripters', |
615 | + maintainer_email='lazr-dev@lists.launchpad.net', |
616 | + description=('Collection of JS widgets'), |
617 | + license='GPL v3', |
618 | + install_requires=[ |
619 | + 'bzr', |
620 | + 'setuptools', |
621 | + ], |
622 | + url='https://launchpad.net/lazr-js', |
623 | + classifiers=[ |
624 | + "Development Status :: 5 - Production/Stable", |
625 | + "Intended Audience :: Developers", |
626 | + "Programming Language :: JavaScript", |
627 | + "Programming Language :: Python", |
628 | + ], |
629 | + extras_require=dict( |
630 | + ), |
631 | + entry_points=dict( |
632 | + console_scripts=[ |
633 | + 'build=lazr.js.build:main', |
634 | + 'jslint=lazr.js.jslint:main', |
635 | + 'scaffold=lazr.js.scaffold:main', |
636 | + ] |
637 | + ), |
638 | +) |
639 | |
640 | === renamed directory 'src' => 'src-js' |
641 | === added directory 'src-js/lazrjs' |
642 | === added file 'src-js/lazrjs/__init__.py' |
643 | === renamed directory 'src/activator' => 'src-js/lazrjs/activator' |
644 | === renamed directory 'src/anim' => 'src-js/lazrjs/anim' |
645 | === renamed directory 'src/autocomplete' => 'src-js/lazrjs/autocomplete' |
646 | === renamed directory 'src/choiceedit' => 'src-js/lazrjs/choiceedit' |
647 | === renamed directory 'src/effects' => 'src-js/lazrjs/effects' |
648 | === renamed directory 'src/formoverlay' => 'src-js/lazrjs/formoverlay' |
649 | === renamed directory 'src/inlineedit' => 'src-js/lazrjs/inlineedit' |
650 | === renamed directory 'src/lazr' => 'src-js/lazrjs/lazr' |
651 | === renamed directory 'src/overlay' => 'src-js/lazrjs/overlay' |
652 | === renamed directory 'src/picker' => 'src-js/lazrjs/picker' |
653 | === renamed directory 'src/testing' => 'src-js/lazrjs/testing' |
654 | === renamed directory 'lib/yui' => 'src-js/lazrjs/yui' |
655 | === renamed directory 'lib' => 'src-py' |
656 | === added file 'src-py/lazr/__init__.py' |
657 | --- src-py/lazr/__init__.py 1970-01-01 00:00:00 +0000 |
658 | +++ src-py/lazr/__init__.py 2009-10-27 09:01:09 +0000 |
659 | @@ -0,0 +1,8 @@ |
660 | +# This is a namespace package. |
661 | +try: |
662 | + import pkg_resources |
663 | + pkg_resources.declare_namespace(__name__) |
664 | +except ImportError: |
665 | + import pkgutil |
666 | + __path__ = pkgutil.extend_path(__path__, __name__) |
667 | + |
668 | |
669 | === added directory 'src-py/lazr/js' |
670 | === added file 'src-py/lazr/js/__init__.py' |
671 | === renamed file 'tools/build.py' => 'src-py/lazr/js/build.py' |
672 | --- tools/build.py 2009-01-09 16:02:00 +0000 |
673 | +++ src-py/lazr/js/build.py 2009-10-27 09:01:09 +0000 |
674 | @@ -1,5 +1,3 @@ |
675 | -#!/usr/bin/python |
676 | - |
677 | """build.py - Minifies and creates the JS build directory.""" |
678 | |
679 | __metaclass__ = type |
680 | @@ -13,14 +11,14 @@ |
681 | |
682 | from glob import glob |
683 | |
684 | +import pkg_resources |
685 | + |
686 | HERE = os.path.dirname(__file__) |
687 | -BUILD_DIR = os.path.normpath(os.path.join(HERE, '..', 'build')) |
688 | -SRC_DIR = os.path.normpath(os.path.join(HERE, '..', 'src')) |
689 | -LIB_DIR = os.path.normpath(os.path.join(HERE, '../', 'lib')) |
690 | - |
691 | -# Add the ../lib directory to the python path |
692 | -sys.path.insert(0, LIB_DIR) |
693 | - |
694 | +BUILD_DIR = os.path.normpath(os.path.join(HERE, '..', '..', '..', 'build')) |
695 | +SRC_DIR = pkg_resources.resource_filename( |
696 | + pkg_resources.Requirement.parse("lazr-js"), "lazrjs") |
697 | + |
698 | +import lazrjs |
699 | from jsmin import JavascriptMinify |
700 | from slimmer import css_slimmer |
701 | |
702 | @@ -122,6 +120,9 @@ |
703 | self.extra_files = [] |
704 | else: |
705 | self.extra_files = extra_files |
706 | + # If we build the lazr-js widgets, make sure that YUI source is |
707 | + # included as well, since we depend on it being available. |
708 | + self.include_yui = (src_dir == SRC_DIR) |
709 | |
710 | def log(self, msg): |
711 | sys.stdout.write(msg + '\n') |
712 | @@ -314,15 +315,26 @@ |
713 | |
714 | def do_build(self): |
715 | for name, cpath in self.find_components(): |
716 | + files_to_link = glob(os.path.join(cpath, '*.js')) |
717 | + if len(files_to_link) == 0: |
718 | + continue |
719 | self.ensure_build_directory(name) |
720 | |
721 | - for js_file in glob(os.path.join(cpath, '*.js')): |
722 | + for js_file in files_to_link: |
723 | self.link_and_minify(name, js_file) |
724 | |
725 | self.build_assets(name) |
726 | |
727 | self.update_combined_js_file() |
728 | self.update_combined_css_skins() |
729 | + if self.include_yui: |
730 | + self.link_yui_directory() |
731 | + |
732 | + def link_yui_directory(self): |
733 | + """Link to the built yui source directory.""" |
734 | + yui_directory = os.path.join(os.path.dirname(lazrjs.__file__), 'yui') |
735 | + link_location = os.path.join(self.build_dir, 'yui') |
736 | + self.ensure_link(yui_directory, link_location) |
737 | |
738 | |
739 | def get_options(): |
740 | @@ -345,7 +357,7 @@ |
741 | return parser.parse_args() |
742 | |
743 | |
744 | -if __name__ == '__main__': |
745 | +def main(): |
746 | options, extra= get_options() |
747 | Builder( |
748 | name=options.name, |
749 | |
750 | === renamed file 'lib/fulljslint.js' => 'src-py/lazr/js/fulljslint.js' |
751 | === renamed file 'tools/jslint-wrapper.js' => 'src-py/lazr/js/jslint-wrapper.js' |
752 | === renamed file 'tools/jslint.py' => 'src-py/lazr/js/jslint.py' |
753 | --- tools/jslint.py 2009-01-05 23:05:43 +0000 |
754 | +++ src-py/lazr/js/jslint.py 2009-10-27 09:01:09 +0000 |
755 | @@ -1,4 +1,3 @@ |
756 | -#!/usr/bin/python |
757 | """jslint.py - run the JSLint linter .""" |
758 | |
759 | __metaclass__ = type |
760 | @@ -13,7 +12,7 @@ |
761 | from bzrlib.plugin import load_plugins |
762 | |
763 | HERE = os.path.join(os.path.dirname(__file__)) |
764 | -FULLJSLINT = os.path.join(HERE, os.path.pardir, 'lib', 'fulljslint.js') |
765 | +FULLJSLINT = os.path.join(HERE, 'fulljslint.js') |
766 | JSLINT_WRAPPER = os.path.join(HERE, 'jslint-wrapper.js') |
767 | |
768 | |
769 | @@ -159,7 +158,7 @@ |
770 | return options, args |
771 | |
772 | |
773 | -if __name__ == '__main__': |
774 | +def main(): |
775 | load_plugins() |
776 | options, args = get_options() |
777 | linter = JSLinter(options.options) |
778 | |
779 | === renamed file 'tools/scaffold.py' => 'src-py/lazr/js/scaffold.py' |
780 | --- tools/scaffold.py 2009-03-19 14:24:56 +0000 |
781 | +++ src-py/lazr/js/scaffold.py 2009-10-27 09:01:09 +0000 |
782 | @@ -1,4 +1,3 @@ |
783 | -#!/usr/bin/python |
784 | """ |
785 | A script to automatically create the files for a new widget. |
786 | |
787 | @@ -70,7 +69,7 @@ |
788 | test_js_template = find_path(skel_dir, 'template.test-js') |
789 | example_template = find_path(skel_dir, 'template.example') |
790 | css_template = find_path(skel_dir, 'template.css') |
791 | - src_dir = find_path('.', 'src') |
792 | + src_dir = find_path('.', 'src-js') |
793 | example_dir = find_path('.', 'examples') |
794 | |
795 | def write_file(template, dest): |
796 | @@ -100,7 +99,7 @@ |
797 | write_file(example_template, join(example, 'index.html')) |
798 | |
799 | |
800 | -if __name__ == '__main__': |
801 | +def main(): |
802 | if len(sys.argv) != 2: |
803 | print usage |
804 | sys.exit(1) |
805 | |
806 | === renamed directory 'tools/skel' => 'src-py/lazr/js/skel' |
807 | === added symlink 'src-py/lazrjs' |
808 | === target is u'../src-js/lazrjs' |
This branch makes lazr-js use buildout to handle dependencies, and makes
it possible for LP to use lazr-js as an egg (via an sdist of course).
There are quite a lot of changes in this branch, and there as still a
few unknowns. First of all, don't be fooled by the diff size. It's over
800 lines, but if you remove bootstrap.py and ez_setup.py (which are
simple copies from LP trun), it's down to a more managable 375 lines.
I've moved all the python code that was lying around into the src-py
directory (I used src-py, since we also have js files, which are in
src-js). All of our code is in a lazr.js package, and the form tools are
now in bin/. I modified them to have a main() function, so it's easy to
generate these scripts using buildout.
Please review the setup.py extra carefully. I wasn't quite sure how to
get the javascript files included, but at least it's working now. Maybe
there is some better way of doing it?
Another thing I'm not sure about is the versions specified in
buildout.cfg. I simply copied the versions from LP's buildout.cfg.
I also modified build.py to include the yui when building the javascript
files. It's only included when building the lazr-js widgets. If
bin/build is used to build other javascript files, it's not included.
Not that I haven't bother about explaining how to set up the
download-cache if it doesn't exist. I used LP's one when testing, but I
intend to make sure that we have a special one of lazr. There is
already a branch for it, but I wanted to get this one landed first,
since we don't need to for LP.
See also lp:~bjornt/launchpad/lazrjs-buildout, which is the branch that
makes use of lazr-js using buildout, and removes it from sourcecode/.
-- /launchpad. net/~bjornt
Björn Tillenius | https:/