source: WAeUP_SRP/buildout/README.txt @ 12878

Last change on this file since 12878 was 3674, checked in by jens, 16 years ago
  • first cut at a repeatable buildout
  • Property svn:eol-style set to native
File size: 10.6 KB
RevLine 
[3674]1=======================
2Using a custom buildout
3=======================
4
5Note: If you are using Windows, if you do not have PIL installed, or you are
6not using Python 2.4 as your main system Python, please see the relevant
7sections below.
8
9You probably got here by running something like:
10
11 $ paster create -t plone3_buildout
12
13Now, you need to run:
14
15 $ python bootstrap.py
16
17This will install zc.buildout for you.
18
19To create an instance immediately, run:
20
21 $ bin/buildout
22
23This will download Plone's eggs and products for you, as well as other
24dependencies, create a new Zope 2 installation (unless you specified
25an existing one when you ran "paster create"), and create a new Zope instance
26configured with these products.
27
28You can start your Zope instance by running:
29
30 $ bin/instance start
31
32or, to run in foreground mode:
33
34 $ bin/instance fg
35
36To run unit tests, you can use:
37
38 $ bin/instance test -s my.package
39
40Installing PIL
41--------------
42
43To use Plone, you need PIL, the Python Imaging Library. If you don't already
44have this, download and install it from http://www.pythonware.com/products/pil.
45
46Using a different Python installation
47--------------------------------------
48
49Buildout will use your system Python installation by default. However, Zope
502.10 (and by extension, Plone) will only work with Python 2.4. You can verify
51which version of Python you have, by running:
52
53 $ python -V
54
55If that is not a 2.4 version, you need to install Python 2.4 from
56http://python.org. If you wish to keep another version as your main system
57Python, edit buildout.cfg and add an 'executable' option to the "[buildout]"
58section, pointing to a python interpreter binary:
59
60 [buildout]
61 ...
62 executable = /path/to/python
63
64Working with buildout.cfg
65-------------------------
66
67You can change any option in buildout.cfg and re-run bin/buildout to reflect
68the changes. This may delete things inside the 'parts' directory, but should
69keep your Data.fs and source files intact.
70
71To save time, you can run buildout in "offline" (-o) and non-updating (-N)
72mode, which will prevent it from downloading things and checking for new
73versions online:
74
75 $ bin/buildout -Nov
76
77Creating new eggs
78-----------------
79
80New packages you are working on (but which are not yet released as eggs and
81uploaded to the Python Package Index, aka PYPI) should be placed in src. You can do:
82
83 $ cd src/
84 $ paster create -t plone my.package
85
86Use "paster create --list-templates" to see all available templates. Answer
87the questions and you will get a new egg. Then tell buildout about your egg
88by editing buildout.cfg and adding your source directory to 'develop':
89
90 [buildout]
91 ...
92 develop =
93    src/my.package
94
95You can list multiple packages here, separated by whitespace or indented
96newlines.
97
98You probably also want the Zope instance to know about the package. Add its
99package name to the list of eggs in the "[instance]" section, or under the
100main "[buildout]" section:
101
102 [instance]
103 ...
104 eggs =
105    ${buildout:eggs}
106    ${plone:eggs}
107    my.package
108
109Leave the ${buildout:eggs} part in place - it tells the instance to use the
110eggs that buildout will have downloaded from the Python Package Index
111previously.
112
113If you also require a ZCML slug for your package, buildout can create one
114automatically. Just add the package to the 'zcml' option:
115
116 [instance]
117 ...
118 zcml =
119    my.package
120
121When you are finished, re-run buildout. Offline, non-updating mode should
122suffice:
123
124 $ bin/buildout -Nov
125
126Developing old-style products
127-----------------------------
128
129If you are developing old-style Zope 2 products (not eggs) then you can do so
130by placing the product code in the top-level 'products' directory. This is
131analogous to the 'Products/' directory inside a normal Zope 2 instance and is
132scanned on start-up for new products.
133
134Depending on a new egg
135----------------------
136
137If you want to use a new egg that is in the Python Package Index, all you need
138to do is to add it to the "eggs" option under the main "[buildout]" section:
139
140 [buildout]
141 ...
142 eggs =
143    my.package
144
145If it's listed somewhere else than the Python Package Index, you can add a link
146telling buildout where to find it in the 'find-links' option:
147
148 [buildout]
149 ...
150 find-links =
151    http://dist.plone.org
152    http://download.zope.org/distribution/
153    http://effbot.org/downloads
154    http://some.host.com/packages
155
156Using existing old-style products
157---------------------------------
158
159If you are using an old-style (non-egg) product, you can either add it as an
160automatically downloaded archive or put it in the top-level "products" folder.
161The former is probably better, because it means you can redistribute your
162buildout.cfg more easily:
163
164 [productdistros]
165 recipe = plone.recipe.distros
166 urls =
167    http://plone.org/products/someproduct/releases/1.3/someproduct-1.3.tar.gz
168
169If someproduct-1.3.tar.gz extracts into several products inside a top-level
170directory, e.g. SomeProduct-1.3/PartOne and SomeProduct-1.3/PartTwo, then
171add it as a "nested package":
172
173 [productdistros]
174 recipe = plone.recipe.distros
175 urls =
176    http://plone.org/products/someproduct/releases/1.3/someproduct-1.3.tar.gz
177 nested-packages =
178    someproduct-1.3.tar.gz
179
180Alternatively, if it extracts to a directory which contains the version
181number, add it as a "version suffix package":
182
183 [productdistros]
184 recipe = plone.recipe.distros
185 urls =
186    http://plone.org/products/someproduct/releases/1.3/someproduct-1.3.tar.gz
187 version-suffix-packages =
188    someproduct-1.3.tar.gz
189
190You can also track products by adding a new bundle checkout part. It
191doesn't strictly have to be an svn bundle at all, any svn location will do,
192and cvs is also supported:
193
194 [buildout]
195 ...
196 parts =
197    plone
198    zope2
199    productdistros
200    myproduct
201    instance
202    zopepy
203
204Note that "myproduct" comes before the "instance" part. You then
205need to add a new section to buildout.cfg:
206
207 [myproduct]
208 recipe = plone.recipe.bundlecheckout
209 url = http://svn.plone.org/svn/collective/myproduct/trunk
210
211Finally, you need to tell Zope to find this new checkout and add it to its
212list of directories that are scanned for products:
213
214 [instance]
215 ...
216 products =
217    ${buildout:directory}/products
218    ${productdistros:location}
219    ${plonebundle:location}
220    ${myproduct:location}
221
222Without this last step, the "myproduct" part is simply managing an svn
223checkout and could potentially be used for something else instead.
224
225=============
226Using Windows
227=============
228
229To use buildout on Windows, you will need to install a few dependencies which
230other platforms manage on their own.
231
232Here are the steps you need to follow (thanks to Hanno Schlichting for these):
233
234Python (http://python.org)
235--------------------------
236
237  - Download and install Python 2.4.4 using the Windows installer from
238    http://www.python.org/ftp/python/2.4.4/python-2.4.4.msi
239    Select 'Install for all users' and it will put Python into the
240    "C:\Python24" folder by default.
241
242  - You also want the pywin32 extensions available from
243    http://downloads.sourceforge.net/pywin32/pywin32-210.win32-py2.4.exe?modtime=1159009237&big_mirror=0
244
245  - And as a last step you want to download the Python imaging library available
246    from http://effbot.org/downloads/PIL-1.1.6.win32-py2.4.exe
247
248  - If you develop Zope based applications you will usually only need Python 2.4
249    at the moment, so it's easiest to put the Python binary on the systems PATH,
250    so you don't need to specify its location manually each time you call it.
251
252    Thus, put "C:\Python24" and "C:\Python24\Scripts" onto the PATH. You can
253    find the PATH definition in the control panel under system preferences on
254    the advanced tab at the bottom. The button is called environment variables.
255    You want to add it at the end of the already existing PATH in the system
256    section. Paths are separated by a semicolons.
257
258  - You can test if this was successful by opening a new shell (cmd) and type
259    in 'python -V'. It should report version 2.4.4 (or whichever version you
260    installed).
261
262    Opening a new shell can be done quickly by using the key combination
263    'Windows-r' or if you are using Parallels on a Mac 'Apple-r'. Type in 'cmd'
264    into the popup box that opens up and hit enter.
265
266
267Subversion (http://subversion.tigris.org)
268-----------------------------------------
269
270  - Download the nice installer from
271    http://subversion.tigris.org/files/documents/15/35379/svn-1.4.2-setup.exe
272
273  - Run the installer. It defaults to installing into
274    "C:\Program Files\Subversion".
275
276  - Now put the install locations bin subfolder (for example
277    "C:\Program Files\Subversion\bin") on your system PATH in the same way you
278    put Python on it.
279
280  - Open a new shell again and type in: 'svn --version' it should report
281    version 1.4.2 or newer.
282
283
284MinGW (http://www.mingw.org/)
285-----------------------------
286
287  This is a native port of the gcc compiler and its dependencies for Windows.
288  There are other approaches enabling you to compile Python C extensions on
289  Windows including Cygwin and using the official Microsoft C compiler, but this
290  is a lightweight approach that uses only freely available tools. As
291  it's used by a lot of people chances are high it will work for you and there's
292  plenty of documentation out there to help you in troubleshooting problems.
293
294  - Download the MinGW installer from
295    http://downloads.sourceforge.net/mingw/MinGW-5.1.3.exe?modtime=1168794334&big_mirror=1
296
297  - The installer will ask you which options you would like to install. Choose
298    base and make here. It will install into "C:\MinGW" by default. The install
299    might take some time as it's getting files from sourceforge.net and you
300    might need to hit 'retry' a couple of times.
301
302  - Now put the install location's bin subfolder (for example "C:\MinGW\bin") on
303    your system PATH in the same way you put Python on it.
304
305  - Test this again by typing in: 'gcc --version' on a newly opened shell and
306    it should report version 3.4.2 or newer.
307
308
309Configure Distutils to use MinGW
310--------------------------------
311
312  Some general information are available from
313  http://www.mingw.org/MinGWiki/index.php/Python%20extensions for example but
314  you don't need to read them all.
315
316  - Create a file called 'distutils.cfg' in "C:\Python24\Lib\distutils". Open it
317    with a text editor ('notepad distutils.cfg') and fill in the following lines:
318
319    [build]
320    compiler=mingw32
321
322    This will tell distutils to use MinGW as the default compiler, so you don't
323    need to specify it manually using "--compiler=mingw32" while calling a
324    package's setup.py with a command that involves building C extensions. This
325    is extremely useful if the build command is written down in a buildout
326    recipe where you cannot change the options without hacking the recipe
327    itself. The z2c.recipe.zope2install used in ploneout is one such example.
Note: See TracBrowser for help on using the repository browser.