Code review comment for lp:~bjornt/lazr-js/buildoutification

Revision history for this message
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://dev.launchpad.net/HackingLazrLibraries#Global%20Cache). This
> 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.filetemplate dependency (and the
> 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.filetemplate
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 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.

> - 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).

I think we need to support this to have the tests run in a buildbot
(which doesn't have net access), right?

> 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.

I've applied parts of the diff. I'm attaching the changes I've done so
far. Changing the Makefile using -S sounds reasonable, but I'd like to
understand why before doing it.

I propose pushing the decision of whether to force the use a
download-cache for later, after this branch has landed, so that we can
get something landed now, and worry about the details (which don't
matter for LP's use) later.

--
Björn Tillenius | https://launchpad.net/~bjornt

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 )

« Back to merge proposal