Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Thomas Leymonerie
slapos.buildout
Commits
93d1d037
Commit
93d1d037
authored
Oct 18, 2015
by
Jean Jordaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidying, markup literals, fix typos and repeated words
parent
179a1676
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
77 deletions
+78
-77
src/zc/buildout/bootstrap.txt
src/zc/buildout/bootstrap.txt
+15
-15
src/zc/buildout/buildout.txt
src/zc/buildout/buildout.txt
+63
-62
No files found.
src/zc/buildout/bootstrap.txt
View file @
93d1d037
...
@@ -47,7 +47,7 @@ Make sure the bootstrap script actually works::
...
@@ -47,7 +47,7 @@ Make sure the bootstrap script actually works::
X...
X...
d zc.buildout-...egg
d zc.buildout-...egg
By default it gets the latest version:
By default it gets the latest version:
:
>>> buildout_script = join(sample_buildout, 'bin', 'buildout')
>>> buildout_script = join(sample_buildout, 'bin', 'buildout')
>>> if sys.platform.startswith('win'):
>>> if sys.platform.startswith('win'):
...
@@ -59,8 +59,8 @@ By default it gets the latest version:
...
@@ -59,8 +59,8 @@ By default it gets the latest version:
'/sample/eggs/zc.buildout-22.0.0...egg',
'/sample/eggs/zc.buildout-22.0.0...egg',
]...
]...
Now trying the `
--buildout-version` option, that let you define a version for
Now trying the `
`--buildout-version`` option, that let you define a version
`zc.buildout
`.
for ``zc.buildout`
`.
Let's try with an unknown version::
Let's try with an unknown version::
...
@@ -73,7 +73,7 @@ Let's try with an unknown version::
...
@@ -73,7 +73,7 @@ Let's try with an unknown version::
No local packages or download links found for zc.buildout==UNKNOWN
No local packages or download links found for zc.buildout==UNKNOWN
...
...
Now let's try with `
2.0.0
`, which happens to exist::
Now let's try with `
`2.0.0`
`, which happens to exist::
>>> print_('X'); print_(system(
>>> print_('X'); print_(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
...
@@ -81,7 +81,7 @@ Now let's try with `2.0.0`, which happens to exist::
...
@@ -81,7 +81,7 @@ Now let's try with `2.0.0`, which happens to exist::
... # doctest: +ELLIPSIS
... # doctest: +ELLIPSIS
X...Generated script '/sample/bin/buildout'...X
X...Generated script '/sample/bin/buildout'...X
Let's make sure the generated `
buildout
` script uses it::
Let's make sure the generated `
`buildout`
` script uses it::
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
#...
...
@@ -90,10 +90,10 @@ Let's make sure the generated `buildout` script uses it::
...
@@ -90,10 +90,10 @@ Let's make sure the generated `buildout` script uses it::
'/sample/eggs/zc.buildout-2.0.0...egg',
'/sample/eggs/zc.buildout-2.0.0...egg',
]...
]...
Now trying the `
--setuptools-version` option, that let you define a version for
Now trying the `
`--setuptools-version`` option, that lets you define a version
`setuptools
`.
for ``setuptools`
`.
Now let's try with `
8.0
`, which happens to exist::
Now let's try with `
`8.0`
`, which happens to exist::
>>> print_('X'); print_(system(
>>> print_('X'); print_(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
...
@@ -101,7 +101,7 @@ Now let's try with `8.0`, which happens to exist::
...
@@ -101,7 +101,7 @@ Now let's try with `8.0`, which happens to exist::
... # doctest: +ELLIPSIS
... # doctest: +ELLIPSIS
X...Generated script '/sample/bin/buildout'...X
X...Generated script '/sample/bin/buildout'...X
Let's make sure the generated `
buildout
` script uses it::
Let's make sure the generated `
`buildout`
` script uses it::
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
#...
...
@@ -110,7 +110,7 @@ Let's make sure the generated `buildout` script uses it::
...
@@ -110,7 +110,7 @@ Let's make sure the generated `buildout` script uses it::
'/sample/eggs/zc.buildout-...egg',
'/sample/eggs/zc.buildout-...egg',
]...
]...
Now let's try specifying both `
zc.buildout` and `setuptools
` to versions
Now let's try specifying both `
`zc.buildout`` and ``setuptools`
` to versions
which happens to exist::
which happens to exist::
>>> print_('X'); print_(system(
>>> print_('X'); print_(system(
...
@@ -119,7 +119,7 @@ which happens to exist::
...
@@ -119,7 +119,7 @@ which happens to exist::
... # doctest: +ELLIPSIS
... # doctest: +ELLIPSIS
X...Generated script '/sample/bin/buildout'...X
X...Generated script '/sample/bin/buildout'...X
Let's make sure the generated `
buildout
` script uses it::
Let's make sure the generated `
`buildout`
` script uses it::
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
#...
...
@@ -128,8 +128,8 @@ Let's make sure the generated `buildout` script uses it::
...
@@ -128,8 +128,8 @@ Let's make sure the generated `buildout` script uses it::
'/sample/eggs/zc.buildout-2.0.0...egg',
'/sample/eggs/zc.buildout-2.0.0...egg',
]...
]...
For a completely offline install we want to avoid downloading
ez_setup.py
,
For a completely offline install we want to avoid downloading
``ez_setup.py``
,
specify the setuptools version, and to reuse the setuptools zipfile
.
specify the setuptools version, and to reuse the setuptools zipfile
::
>>> try:
>>> try:
... from urllib.request import urlopen
... from urllib.request import urlopen
...
@@ -160,12 +160,12 @@ specify the setuptools version, and to reuse the setuptools zipfile.
...
@@ -160,12 +160,12 @@ specify the setuptools version, and to reuse the setuptools zipfile.
'/sample/eggs/zc.buildout-2.0.0...egg',
'/sample/eggs/zc.buildout-2.0.0...egg',
]...
]...
You can ask
bootstrap.py
for its version. This is really the day the last
You can ask
``bootstrap.py``
for its version. This is really the day the last
change was made. A date leads to less confusion than a version number separate
change was made. A date leads to less confusion than a version number separate
from buildout's own version number. Similarly, tracking buildout's version
from buildout's own version number. Similarly, tracking buildout's version
number leads to bootstraps with a new version number but without changes or to
number leads to bootstraps with a new version number but without changes or to
bootstraps with version number from an already-older buildout. So: a date is
bootstraps with version number from an already-older buildout. So: a date is
best
.
best
::
>>> print_('X'); print_(system(
>>> print_('X'); print_(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
...
...
src/zc/buildout/buildout.txt
View file @
93d1d037
...
@@ -14,17 +14,17 @@ This document describes how to define buildouts using buildout
...
@@ -14,17 +14,17 @@ This document describes how to define buildouts using buildout
configuration files and recipes. There are three ways to set up the
configuration files and recipes. There are three ways to set up the
buildout software and create a buildout instance:
buildout software and create a buildout instance:
1. Install the
zc.buildout egg with easy_install
and use the buildout
1. Install the
``zc.buildout`` egg with ``easy_install``
and use the buildout
script installed in a Python scripts area.
script installed in a Python scripts area.
2. Use the buildout bootstrap script to create a buildout that
2. Use the buildout bootstrap script to create a buildout that
includes both the
setuptools and zc.buildout
eggs. This allows you
includes both the
``setuptools`` and ``zc.buildout``
eggs. This allows you
to use the buildout software without modifying a Python install.
to use the buildout software without modifying a Python install.
The buildout script is installed into your buildout local scripts
The buildout script is installed into your buildout local scripts
area.
area.
3. Use a buildout command from an already installed buildout to
3. Use a buildout command from an already installed buildout to
bootstrap a new buildout. (See the section on bootstraping later
bootstrap a new buildout. (See the section on bootstrap
p
ing later
in this document.)
in this document.)
Often, a software project will be managed in a software repository,
Often, a software project will be managed in a software repository,
...
@@ -32,13 +32,13 @@ such as a subversion repository, that includes some software source
...
@@ -32,13 +32,13 @@ such as a subversion repository, that includes some software source
directories, buildout configuration files, and a copy of the buildout
directories, buildout configuration files, and a copy of the buildout
bootstrap script. To work on the project, one would check out the
bootstrap script. To work on the project, one would check out the
project from the repository and run the bootstrap script which
project from the repository and run the bootstrap script which
installs
setuptools and zc.buildout
into the checkout as well as any
installs
``setuptools`` and ``zc.buildout``
into the checkout as well as any
parts defined.
parts defined.
We have a sample buildout that we created using the bootstrap command
We have a sample buildout that we created using the bootstrap command
of an existing buildout (method 3 above). It has the absolute minimum
of an existing buildout (method 3 above). It has the absolute minimum
information. We have
bin, develop-eggs, eggs and parts directories,
information. We have
``bin``, ``develop-eggs``, ``eggs`` and ``parts``
and a configuration file::
directories,
and a configuration file::
>>> ls(sample_buildout)
>>> ls(sample_buildout)
d bin
d bin
...
@@ -47,7 +47,7 @@ and a configuration file::
...
@@ -47,7 +47,7 @@ and a configuration file::
d eggs
d eggs
d parts
d parts
The
bin
directory contains scripts::
The
``bin``
directory contains scripts::
>>> ls(sample_buildout, 'bin')
>>> ls(sample_buildout, 'bin')
- buildout
- buildout
...
@@ -56,31 +56,31 @@ The bin directory contains scripts::
...
@@ -56,31 +56,31 @@ The bin directory contains scripts::
- setuptools-0.7-py3.3.egg
- setuptools-0.7-py3.3.egg
- zc.buildout.egg-link
- zc.buildout.egg-link
The
develop-eggs and parts
directories are initially empty::
The
``develop-eggs`` and ``parts``
directories are initially empty::
>>> ls(sample_buildout, 'develop-eggs')
>>> ls(sample_buildout, 'develop-eggs')
>>> ls(sample_buildout, 'parts')
>>> ls(sample_buildout, 'parts')
The
develop-eggs
directory holds egg links for software being
The
``develop-eggs``
directory holds egg links for software being
developed in the buildout. We separate
develop-eggs
and other eggs to
developed in the buildout. We separate
``develop-eggs``
and other eggs to
allow eggs directories to be shared across multiple buildouts. For
allow eggs directories to be shared across multiple buildouts. For
example, a common developer technique is to define a common eggs
example, a common developer technique is to define a common eggs
directory in their home that all non-develop eggs are stored in. This
directory in their home that all non-develop eggs are stored in. This
allows larger buildouts to be set up much more quickly and saves disk
allows larger buildouts to be set up much more quickly and saves disk
space.
space.
The
parts
directory provides an area where recipes can install
The
``parts``
directory provides an area where recipes can install
part data. For example, if we built a custom Python, we would
part data. For example, if we built a custom Python, we would
install it in the
part
directory. Part data is stored in a
install it in the
``parts``
directory. Part data is stored in a
sub-directory of the parts directory with the same name as the part.
sub-directory of the parts directory with the same name as the part.
Buildouts are defined using configuration files. These are in the
Buildouts are defined using configuration files. These are in the
format defined by the Python
ConfigParser
module, with extensions
format defined by the Python
``ConfigParser``
module, with extensions
that we'll describe later. By default, when a buildout is run, it
that we'll describe later. By default, when a buildout is run, it
looks for the file
buildout.cfg
in the directory where the buildout is
looks for the file
``buildout.cfg``
in the directory where the buildout is
run.
run.
The minimal configuration file has a
buildout
section that defines no
The minimal configuration file has a
``buildout``
section that defines no
parts::
parts::
>>> cat(sample_buildout, 'buildout.cfg')
>>> cat(sample_buildout, 'buildout.cfg')
...
@@ -111,7 +111,7 @@ directory for our local recipes::
...
@@ -111,7 +111,7 @@ directory for our local recipes::
>>> mkdir(sample_buildout, 'recipes')
>>> mkdir(sample_buildout, 'recipes')
and then we'll create a source file for our
mkdir
recipe::
and then we'll create a source file for our
``mkdir``
recipe::
>>> write(sample_buildout, 'recipes', 'mkdir.py',
>>> write(sample_buildout, 'recipes', 'mkdir.py',
... """
... """
...
@@ -158,15 +158,15 @@ changed if it's options, after adjusting for data read from other
...
@@ -158,15 +158,15 @@ changed if it's options, after adjusting for data read from other
sections, has changed, or if the recipe has changed. Only the options
sections, has changed, or if the recipe has changed. Only the options
for the part are considered. If data are read from other sections,
for the part are considered. If data are read from other sections,
then that information has to be reflected in the parts options. In
then that information has to be reflected in the parts options. In
the
Mkdir
example, the given path is interpreted relative to the
the
``mkdir``
example, the given path is interpreted relative to the
buildout directory, and data from the buildout directory is read. The
buildout directory, and data from the buildout directory is read. The
path option is updated to reflect this. If the directory option was
path option is updated to reflect this. If the directory option was
changed in the buildout sections, we would know to update parts
changed in the buildout sections, we would know to update parts
created using the
mkdir
recipe using relative path names.
created using the
``mkdir``
recipe using relative path names.
When buildout is run, it saves configuration data for installed parts
When buildout is run, it saves configuration data for installed parts
in a file named
".installed.cfg"
. In subsequent runs, it compares
in a file named
``.installed.cfg``
. In subsequent runs, it compares
part-configuration data stored in the
.installed.cfg
file and the
part-configuration data stored in the
``.installed.cfg``
file and the
part-configuration data loaded from the configuration files as
part-configuration data loaded from the configuration files as
modified by recipe constructors to decide if the configuration of a
modified by recipe constructors to decide if the configuration of a
part has changed. If the configuration has changed, or if the recipe
part has changed. If the configuration has changed, or if the recipe
...
@@ -176,7 +176,7 @@ configure the part needs to be reflected in the part's options. It is
...
@@ -176,7 +176,7 @@ configure the part needs to be reflected in the part's options. It is
the job of a recipe constructor to make sure that the options include
the job of a recipe constructor to make sure that the options include
all relevant data.
all relevant data.
Of course, parts are also uninstalled if they are no
-
longer used.
Of course, parts are also uninstalled if they are no
longer used.
The recipe defines a constructor that takes a buildout object, a part
The recipe defines a constructor that takes a buildout object, a part
name, and an options dictionary. It saves them in instance attributes.
name, and an options dictionary. It saves them in instance attributes.
...
@@ -190,13 +190,13 @@ directory.
...
@@ -190,13 +190,13 @@ directory.
The install method is responsible for creating the part. In this
The install method is responsible for creating the part. In this
case, we need the path of the directory to create. We'll use a path
case, we need the path of the directory to create. We'll use a path
option from our options dictionary. The install method logs what it's
option from our options dictionary. The install method logs what it's
doing using the Python
logging
call. We return the path that we
doing using the Python
``logging``
call. We return the path that we
installed. If the part is uninstalled or reinstalled, then the path
installed. If the part is uninstalled or reinstalled, then the path
returned will be removed by the buildout machinery. A recipe install
returned will be removed by the buildout machinery. A recipe install
method is expected to return a string, or an iterable of strings
method is expected to return a string, or an iterable of strings
containing paths to be removed if a part is uninstalled. For most
containing paths to be removed if a part is uninstalled. For most
recipes, this is all of the uninstall support needed. For more complex
recipes, this is all of the uninstall support needed. For more complex
uninstallation scenarios use `Uninstall recipes`_.
uninstallation scenarios
,
use `Uninstall recipes`_.
The update method is responsible for updating an already installed
The update method is responsible for updating an already installed
part. An empty method is often provided, as in this example, if parts
part. An empty method is often provided, as in this example, if parts
...
@@ -209,7 +209,7 @@ We need to provide packaging information so that our recipe can be
...
@@ -209,7 +209,7 @@ We need to provide packaging information so that our recipe can be
installed as a develop egg. The minimum information we need to specify
installed as a develop egg. The minimum information we need to specify
is a name. For recipes, we also need to define the
is a name. For recipes, we also need to define the
names of the recipe classes as entry points. Packaging information is
names of the recipe classes as entry points. Packaging information is
provided via a
setup.py
script::
provided via a
``setup.py``
script::
>>> write(sample_buildout, 'recipes', 'setup.py',
>>> write(sample_buildout, 'recipes', 'setup.py',
... """
... """
...
@@ -221,18 +221,18 @@ provided via a setup.py script::
...
@@ -221,18 +221,18 @@ provided via a setup.py script::
... )
... )
... """)
... """)
Our setup script defines an
entry point
. Entry points provide
Our setup script defines an
*entry point*
. Entry points provide
a way for an egg to define the services it provides. Here we've said
a way for an egg to define the services it provides. Here we've said
that we define a
zc.buildout entry point named mkdir
. Recipe
that we define a
``zc.buildout`` entry point named ``mkdir``
. Recipe
classes must be exposed as entry points in the
zc.buildout group. w
e
classes must be exposed as entry points in the
``zc.buildout`` group. W
e
give entry points names within the group.
give entry points names within the group.
We also need a
README.txt
for our recipes to avoid an annoying warning
We also need a
``README.txt``
for our recipes to avoid an annoying warning
from
distutils, on which setuptools and zc.buildout are based
::
from
``distutils`` (which ``setuptools`` and ``zc.buildout`` are based on)
::
>>> write(sample_buildout, 'recipes', 'README.txt', " ")
>>> write(sample_buildout, 'recipes', 'README.txt', " ")
Now let's update our
buildout.cfg
::
Now let's update our
``buildout.cfg``
::
>>> write(sample_buildout, 'buildout.cfg',
>>> write(sample_buildout, 'buildout.cfg',
... """
... """
...
@@ -254,7 +254,7 @@ Any number of paths can be listed. The paths can be relative or
...
@@ -254,7 +254,7 @@ Any number of paths can be listed. The paths can be relative or
absolute. If relative, they are treated as relative to the buildout
absolute. If relative, they are treated as relative to the buildout
directory. They can be directory or file paths. If a file path is
directory. They can be directory or file paths. If a file path is
given, it should point to a Python setup script. If a directory path
given, it should point to a Python setup script. If a directory path
is given, it should point to a directory containing a
setup.py
file.
is given, it should point to a directory containing a
``setup.py``
file.
Development eggs are installed before building any parts, as they may
Development eggs are installed before building any parts, as they may
provide locally-defined recipes needed by the parts.
provide locally-defined recipes needed by the parts.
...
@@ -262,8 +262,8 @@ provide locally-defined recipes needed by the parts.
...
@@ -262,8 +262,8 @@ provide locally-defined recipes needed by the parts.
parts = data-dir
parts = data-dir
Here we've named a part to be "built". We can use any name we want
Here we've named a part to be "built". We can use any name we want
,
except that
different part names must
be unique and recipes will often
except that
part names have to
be unique and recipes will often
use the part name to decide what to do.
use the part name to decide what to do.
::
::
...
@@ -362,12 +362,13 @@ the part will be reinstalled::
...
@@ -362,12 +362,13 @@ the part will be reinstalled::
Error reporting
Error reporting
---------------
---------------
If a user makes an error
, an error needs to be printed
and work needs
If a user makes an error
the error needs to be reported,
and work needs
to stop. This is accomplished by logging a detailed error message and
to stop. This is accomplished by logging a detailed error message and
then raising a (or an instance of a subclass of a)
then raising a
zc.buildout.UserError exception. Raising an error other than a
``zc.buildout.UserError`` exception (or a subclass of this exception).
UserError still displays the error, but labels it as a bug in the
Raising an error other than a
buildout software or recipe. In the sample above, of someone gives a
``UserError`` still displays the error, but labels it as a bug in the
buildout software or recipe. In the sample above, if someone gives a
non-existent directory to create the directory in::
non-existent directory to create the directory in::
>>> write(sample_buildout, 'buildout.cfg',
>>> write(sample_buildout, 'buildout.cfg',
...
@@ -381,7 +382,7 @@ non-existent directory to create the directory in::
...
@@ -381,7 +382,7 @@ non-existent directory to create the directory in::
... path = /xxx/mydata
... path = /xxx/mydata
... """)
... """)
W
e'll get a user error, not a traceback::
w
e'll get a user error, not a traceback::
>>> print_(system(buildout), end='')
>>> print_(system(buildout), end='')
Develop: '/sample-buildout/recipes'
Develop: '/sample-buildout/recipes'
...
@@ -398,7 +399,7 @@ Recipe Error Handling
...
@@ -398,7 +399,7 @@ Recipe Error Handling
If an error occurs during installation, it is up to the recipe to
If an error occurs during installation, it is up to the recipe to
clean up any system side effects, such as files created. Let's update
clean up any system side effects, such as files created. Let's update
the
mkdir
recipe to support multiple paths::
the
``mkdir``
recipe to support multiple paths::
>>> write(sample_buildout, 'recipes', 'mkdir.py',
>>> write(sample_buildout, 'recipes', 'mkdir.py',
... """
... """
...
@@ -497,7 +498,7 @@ If we fix the typo::
...
@@ -497,7 +498,7 @@ If we fix the typo::
Traceback (most recent call last):
Traceback (most recent call last):
... exists...
... exists...
Now they fail because
foo
exists, because it was left behind::
Now they fail because
``foo``
exists, because it was left behind::
>>> remove('foo')
>>> remove('foo')
...
@@ -592,8 +593,8 @@ we get the same error, but we don't get the directory left behind::
...
@@ -592,8 +593,8 @@ we get the same error, but we don't get the directory left behind::
It's critical that recipes clean up partial effects when errors
It's critical that recipes clean up partial effects when errors
occur. Because recipes most commonly create files and directories,
occur. Because recipes most commonly create files and directories,
buildout provides a helper API for removing created files when an
buildout provides a helper API for removing created files when an
error occurs. Option objects have a
created
method that can be called
error occurs. Option objects have a
``created``
method that can be called
to record files as they are created. If the
install or update
method
to record files as they are created. If the
``install`` or ``update``
method
returns with an error, then any registered paths are removed
returns with an error, then any registered paths are removed
automatically. The method returns the files registered and can be
automatically. The method returns the files registered and can be
used to return the files created. Let's use this API to simplify the
used to return the files created. Let's use this API to simplify the
...
@@ -639,11 +640,11 @@ recipe::
...
@@ -639,11 +640,11 @@ recipe::
>>> clean_up_pyc(sample_buildout, 'recipes', 'mkdir.py')
>>> clean_up_pyc(sample_buildout, 'recipes', 'mkdir.py')
We returned by calling
created
, taking advantage of the fact that it
We returned by calling
``created``
, taking advantage of the fact that it
returns the registered paths. We did this for illustrative purposes.
returns the registered paths. We did this for illustrative purposes.
It would be simpler
just to
return the paths as before.
It would be simpler
to just
return the paths as before.
If we rerun the buildout
,
again, we'll get the error and no
If we rerun the buildout again, we'll get the error and no
directories will be created::
directories will be created::
>>> print_(system(buildout)) # doctest: +ELLIPSIS
>>> print_(system(buildout)) # doctest: +ELLIPSIS
...
@@ -690,30 +691,30 @@ Configuration file syntax
...
@@ -690,30 +691,30 @@ Configuration file syntax
-------------------------
-------------------------
A buildout configuration file consists of a sequence of sections. A
A buildout configuration file consists of a sequence of sections. A
section has a
section header followed by 0 or more section options
.
section has a
*section header* followed by 0 or more *section options*
.
(Buildout configuration files may be viewed as a variation on INI
(Buildout configuration files may be viewed as a variation on INI
files.)
files.)
A section header consists of a section name enclosed in square braces.
A section header consists of a section name enclosed in square braces.
A section name consists of one or more non-whitespace characters other
A section name consists of one or more non-whitespace characters other
than square braces (
'[', ']'), curly braces ('{', '}'), colons (':'
)
than square braces (
``[``, ``]``), curly braces (``{``, ``}``), colons (``:``
)
or equal signs (
'='
). Whitespace surrounding section names is ignored.
or equal signs (
``=``
). Whitespace surrounding section names is ignored.
A section header can optionally have a condition expression separated
A section header can optionally have a condition expression separated
by a colon. See `Conditional sections`_.
by a colon. See `Conditional sections`_.
Options consist of option names, followed by optional space or tab
Options consist of option names, followed by optional space or tab
characters, an optional plus or minus sign and an equal sign
s
and
characters, an optional plus or minus sign and an equal sign and
values. An option value may be spread over multiple lines as long as
values. An option value may be spread over multiple lines as long as
the lines after the first start with a whitespace character. An
the lines after the first start with a whitespace character. An
option name consists of one or more non-whitespace characters other
option name consists of one or more non-whitespace characters other
than equal signs, square braces (
"[", "]"), curly braces ("{", "}"
),
than equal signs, square braces (
``[``, ``]``), curly braces (``{``, ``}``
),
plus signs or colons (
":"). The option name '<'
is reserved. An
plus signs or colons (
``:``). The option name ``<``
is reserved. An
option's data consists of the characters following the equal sign on
option's data consists of the characters following the equal sign on
the start line, plus the continuation lines.
the start line, plus the continuation lines.
Option values have extra whitespace stripped. How this is done
Option values have extra whitespace stripped. How this is done
depends on whether the value has non-whitespace character
t
s on the
depends on whether the value has non-whitespace characters on the
first line. If an option value has non-whitespace characters on the
first line. If an option value has non-whitespace characters on the
first line, then each line is stripped and blank lines are removed.
first line, then each line is stripped and blank lines are removed.
For example, in::
For example, in::
...
@@ -737,7 +738,7 @@ For example, in::
...
@@ -737,7 +738,7 @@ For example, in::
The value of of ``bar`` is ``'1'`` and the value of ``baz`` is
The value of of ``bar`` is ``'1'`` and the value of ``baz`` is
``'a\nb\nc'``.
``'a\nb\nc'``.
If the first line of an option does
n't
contain whitespace, then the
If the first line of an option does
**not**
contain whitespace, then the
value is dedented (with ``textwrap.dedent``), trailing spaces in lines
value is dedented (with ``textwrap.dedent``), trailing spaces in lines
are removed, and leading and trailing blank lines are removed. For
are removed, and leading and trailing blank lines are removed. For
example, in::
example, in::
...
@@ -760,18 +761,18 @@ example, in::
...
@@ -760,18 +761,18 @@ example, in::
The value of bar is ``''``, and the value of baz is ``'a\n b\n\nc'``.
The value of bar is ``''``, and the value of baz is ``'a\n b\n\nc'``.
Lines starting with
'#' or ';'
characters are comments. Comments can
Lines starting with
``#`` or ``;``
characters are comments. Comments can
also be placed after the closing square bracket (
']'
) in a section header.
also be placed after the closing square bracket (
``]``
) in a section header.
Buildout configuration data are Python strings, which are bytes in
Buildout configuration data are Python strings, which are bytes in
Python 2 and unicode in Python 3.
Python 2 and unicode in Python 3.
Sections and options within sections may be repeated. Multiple
Sections and options within sections may be repeated. Multiple
occurrences of
of
a section are treated as if they were concatenated.
occurrences of a section are treated as if they were concatenated.
The last option value for a given name in a section overrides previous
The last option value for a given name in a section overrides previous
values.
values.
In addition to
p
the syntactic details above:
In addition to the syntactic details above:
- option names are case sensitive
- option names are case sensitive
...
@@ -903,7 +904,7 @@ We also have to update our setup script::
...
@@ -903,7 +904,7 @@ We also have to update our setup script::
... """)
... """)
We've rearranged the script a bit to make the entry points easier to
We've rearranged the script a bit to make the entry points easier to
edit.
In particular
, entry points are now defined as a configuration
edit.
Specifically
, entry points are now defined as a configuration
string, rather than a dictionary.
string, rather than a dictionary.
Let's update our configuration to provide variable substitution
Let's update our configuration to provide variable substitution
...
@@ -926,8 +927,8 @@ examples::
...
@@ -926,8 +927,8 @@ examples::
... path = mydata
... path = mydata
... """)
... """)
We used a string-template substitution for
File-1 and File-2
. This
We used a string-template substitution for
``File-1`` and ``File-2``
. This
type of substitution uses the
string.Template
syntax. Names
type of substitution uses the
``string.Template``
syntax. Names
substituted are qualified option names, consisting of a section name
substituted are qualified option names, consisting of a section name
and option name joined by a colon.
and option name joined by a colon.
...
@@ -948,7 +949,7 @@ Note that the substitution of the ``data-dir`` path option reflects the
...
@@ -948,7 +949,7 @@ Note that the substitution of the ``data-dir`` path option reflects the
update to the option performed by the ``mkdir`` recipe.
update to the option performed by the ``mkdir`` recipe.
It might seem surprising that ``mydata`` was created again. This is
It might seem surprising that ``mydata`` was created again. This is
because we changed our
recipes
package by adding the ``debug`` module.
because we changed our
``recipes``
package by adding the ``debug`` module.
The buildout system didn't know if this module could affect the ``mkdir``
The buildout system didn't know if this module could affect the ``mkdir``
recipe, so it assumed it could and reinstalled ``mydata``. If we rerun
recipe, so it assumed it could and reinstalled ``mydata``. If we rerun
the buildout::
the buildout::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment