1 =======================
2 Using a custom buildout
3 =======================
5 Note: If you are using Windows, if you do not have PIL installed, or you are
6 not using Python 2.4 as your main system Python, please see the relevant
9 You probably got here by running something like:
11 $ paster create -t plone3_buildout
17 This will install zc.buildout for you.
19 To create an instance immediately, run:
23 This will download Plone's eggs and products for you, as well as other
24 dependencies, create a new Zope 2 installation (unless you specified
25 an existing one when you ran "paster create"), and create a new Zope instance
26 configured with these products.
28 You can start your Zope instance by running:
32 or, to run in foreground mode:
36 To run unit tests, you can use:
38 $ bin/instance test -s my.package
43 To use Plone, you need PIL, the Python Imaging Library. If you don't already
44 have this, download and install it from http://www.pythonware.com/products/pil.
46 Using a different Python installation
47 --------------------------------------
49 Buildout will use your system Python installation by default. However, Zope
50 2.10 (and by extension, Plone) will only work with Python 2.4. You can verify
51 which version of Python you have, by running:
55 If that is not a 2.4 version, you need to install Python 2.4 from
56 http://python.org. If you wish to keep another version as your main system
57 Python, edit buildout.cfg and add an 'executable' option to the "[buildout]"
58 section, pointing to a python interpreter binary:
62 executable = /path/to/python
64 Working with buildout.cfg
65 -------------------------
67 You can change any option in buildout.cfg and re-run bin/buildout to reflect
68 the changes. This may delete things inside the 'parts' directory, but should
69 keep your Data.fs and source files intact.
71 To save time, you can run buildout in "offline" (-o) and non-updating (-N)
72 mode, which will prevent it from downloading things and checking for new
80 New packages you are working on (but which are not yet released as eggs and
81 uploaded to the Python Package Index, aka PYPI) should be placed in src. You can do:
84 $ paster create -t plone my.package
86 Use "paster create --list-templates" to see all available templates. Answer
87 the questions and you will get a new egg. Then tell buildout about your egg
88 by editing buildout.cfg and adding your source directory to 'develop':
95 You can list multiple packages here, separated by whitespace or indented
98 You probably also want the Zope instance to know about the package. Add its
99 package name to the list of eggs in the "[instance]" section, or under the
100 main "[buildout]" section:
109 Leave the ${buildout:eggs} part in place - it tells the instance to use the
110 eggs that buildout will have downloaded from the Python Package Index
113 If you also require a ZCML slug for your package, buildout can create one
114 automatically. Just add the package to the 'zcml' option:
121 When you are finished, re-run buildout. Offline, non-updating mode should
126 Developing old-style products
127 -----------------------------
129 If you are developing old-style Zope 2 products (not eggs) then you can do so
130 by placing the product code in the top-level 'products' directory. This is
131 analogous to the 'Products/' directory inside a normal Zope 2 instance and is
132 scanned on start-up for new products.
134 Depending on a new egg
135 ----------------------
137 If you want to use a new egg that is in the Python Package Index, all you need
138 to do is to add it to the "eggs" option under the main "[buildout]" section:
145 If it's listed somewhere else than the Python Package Index, you can add a link
146 telling buildout where to find it in the 'find-links' option:
151 http://dist.plone.org
152 http://download.zope.org/distribution/
153 http://effbot.org/downloads
154 http://some.host.com/packages
156 Using existing old-style products
157 ---------------------------------
159 If you are using an old-style (non-egg) product, you can either add it as an
160 automatically downloaded archive or put it in the top-level "products" folder.
161 The former is probably better, because it means you can redistribute your
162 buildout.cfg more easily:
165 recipe = plone.recipe.distros
167 http://plone.org/products/someproduct/releases/1.3/someproduct-1.3.tar.gz
169 If someproduct-1.3.tar.gz extracts into several products inside a top-level
170 directory, e.g. SomeProduct-1.3/PartOne and SomeProduct-1.3/PartTwo, then
171 add it as a "nested package":
174 recipe = plone.recipe.distros
176 http://plone.org/products/someproduct/releases/1.3/someproduct-1.3.tar.gz
178 someproduct-1.3.tar.gz
180 Alternatively, if it extracts to a directory which contains the version
181 number, add it as a "version suffix package":
184 recipe = plone.recipe.distros
186 http://plone.org/products/someproduct/releases/1.3/someproduct-1.3.tar.gz
187 version-suffix-packages =
188 someproduct-1.3.tar.gz
190 You can also track products by adding a new bundle checkout part. It
191 doesn't strictly have to be an svn bundle at all, any svn location will do,
192 and cvs is also supported:
204 Note that "myproduct" comes before the "instance" part. You then
205 need to add a new section to buildout.cfg:
208 recipe = plone.recipe.bundlecheckout
209 url = http://svn.plone.org/svn/collective/myproduct/trunk
211 Finally, you need to tell Zope to find this new checkout and add it to its
212 list of directories that are scanned for products:
217 ${buildout:directory}/products
218 ${productdistros:location}
219 ${plonebundle:location}
220 ${myproduct:location}
222 Without this last step, the "myproduct" part is simply managing an svn
223 checkout and could potentially be used for something else instead.
229 To use buildout on Windows, you will need to install a few dependencies which
230 other platforms manage on their own.
232 Here are the steps you need to follow (thanks to Hanno Schlichting for these):
234 Python (http://python.org)
235 --------------------------
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.
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
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
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.
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.
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
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.
267 Subversion (http://subversion.tigris.org)
268 -----------------------------------------
270 - Download the nice installer from
271 http://subversion.tigris.org/files/documents/15/35379/svn-1.4.2-setup.exe
273 - Run the installer. It defaults to installing into
274 "C:\Program Files\Subversion".
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
280 - Open a new shell again and type in: 'svn --version' it should report
281 version 1.4.2 or newer.
284 MinGW (http://www.mingw.org/)
285 -----------------------------
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.
294 - Download the MinGW installer from
295 http://downloads.sourceforge.net/mingw/MinGW-5.1.3.exe?modtime=1168794334&big_mirror=1
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.
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.
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.
309 Configure Distutils to use MinGW
310 --------------------------------
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.
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:
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.