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
8
Merge Requests
8
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
slapos.buildout
Commits
75b2b450
Commit
75b2b450
authored
May 01, 2013
by
TomasM
Browse files
Options
Browse Files
Download
Plain Diff
pull from upstream
parents
7869eed9
284e2470
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
233 additions
and
93 deletions
+233
-93
CHANGES.rst
CHANGES.rst
+30
-6
setup.py
setup.py
+1
-1
specifications/repeatable.txt
specifications/repeatable.txt
+2
-2
src/zc/buildout/allowhosts.txt
src/zc/buildout/allowhosts.txt
+1
-1
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+10
-24
src/zc/buildout/buildout.txt
src/zc/buildout/buildout.txt
+142
-12
src/zc/buildout/configparser.py
src/zc/buildout/configparser.py
+3
-3
src/zc/buildout/configparser.test
src/zc/buildout/configparser.test
+1
-1
src/zc/buildout/debugging.txt
src/zc/buildout/debugging.txt
+1
-1
src/zc/buildout/easy_install.py
src/zc/buildout/easy_install.py
+4
-4
src/zc/buildout/extends-cache.txt
src/zc/buildout/extends-cache.txt
+5
-5
src/zc/buildout/repeatable.txt
src/zc/buildout/repeatable.txt
+3
-3
src/zc/buildout/testing.txt
src/zc/buildout/testing.txt
+2
-2
src/zc/buildout/tests.py
src/zc/buildout/tests.py
+11
-11
src/zc/buildout/update.txt
src/zc/buildout/update.txt
+1
-1
zc.recipe.egg_/CHANGES.txt
zc.recipe.egg_/CHANGES.txt
+3
-3
zc.recipe.egg_/setup.py
zc.recipe.egg_/setup.py
+1
-1
zc.recipe.egg_/src/zc/recipe/egg/README.txt
zc.recipe.egg_/src/zc/recipe/egg/README.txt
+3
-3
zc.recipe.egg_/src/zc/recipe/egg/api.txt
zc.recipe.egg_/src/zc/recipe/egg/api.txt
+1
-1
zc.recipe.egg_/src/zc/recipe/egg/custom.txt
zc.recipe.egg_/src/zc/recipe/egg/custom.txt
+8
-8
No files found.
CHANGES.rst
View file @
75b2b450
Change History
Change History
**************
**************
2.1.0 (2013-??-??)
2.1.1dev (unreleased)
=====================
2.1.0 (2013-03-23)
==================
==================
- Removed `data_files` from `setup.py`, which was installing README.rst
- `Meta-recipe support`_
in current directory during installation
- `Conditional sections`_
- Buildout now accepts a ``--version`` command-line option to print
its version.
Fixed: Builout didn't exit with a non-zero exit status if there was a
failure in combination with an upgrade.
Fixed: We now fail with an informative error when an old bootstrap
script causes buildout 2 to be used with setuptools.
Fixed: An error incorrectly suggested that buildout 2 implemented all
of the functionality of dumppickedversions.
Fixed: Buildout generated bad scripts when no eggs needed to be added
to ``sys.path``.
Fixed: Buildout didn't honour Unix umask when generating scripts.
https://bugs.launchpad.net/zc.buildout/+bug/180705
- Added `meta-recipe support`_.
Fixed: ``update-versions-file`` didn't work unless
``show-picked-versions`` was also set.
https://github.com/buildout/buildout/issues/71
2.0.1 (2013-02-16)
2.0.1 (2013-02-16)
==================
==================
...
@@ -688,7 +712,7 @@ Feature Changes
...
@@ -688,7 +712,7 @@ Feature Changes
this option.
this option.
- Adjusted the output for verbosity levels. Using a single -v option
- Adjusted the output for verbosity levels. Using a single -v option
no longer causes voluminous setuptools output. U
is
ng -vv and -vvv
no longer causes voluminous setuptools output. U
si
ng -vv and -vvv
now triggers extra setuptools output.
now triggers extra setuptools output.
- Added a remove testing helper function that removes files or directories.
- Added a remove testing helper function that removes files or directories.
...
@@ -707,7 +731,7 @@ Feature Changes
...
@@ -707,7 +731,7 @@ Feature Changes
- Added a *newest* keyword parameter to the
- Added a *newest* keyword parameter to the
zc.buildout.easy_install.install and zc.buildout.easy_install.build
zc.buildout.easy_install.install and zc.buildout.easy_install.build
functions to control whether the newest distributions that
m
eed
functions to control whether the newest distributions that
n
eed
given requirements should be sought. If a false value is provided
given requirements should be sought. If a false value is provided
for this parameter and already installed eggs meet the given
for this parameter and already installed eggs meet the given
requirements, then no attempt will be made to search for newer
requirements, then no attempt will be made to search for newer
...
...
setup.py
View file @
75b2b450
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
#
#
##############################################################################
##############################################################################
name
=
"zc.buildout"
name
=
"zc.buildout"
version
=
"2.1.0
dev
"
version
=
"2.1.0"
import
os
import
os
from
setuptools
import
setup
from
setuptools
import
setup
...
...
specifications/repeatable.txt
View file @
75b2b450
...
@@ -73,7 +73,7 @@ itself added an entry for the recipe that fixes the recipe version
...
@@ -73,7 +73,7 @@ itself added an entry for the recipe that fixes the recipe version
at the version used by the buildout.
at the version used by the buildout.
The zc.recipe.eggs recipe added the eggs option that lists the
The zc.recipe.eggs recipe added the eggs option that lists the
specif
o
c releases that were assembled.
specif
i
c releases that were assembled.
Finally the buildout.cfg file can be modified to use the
Finally the buildout.cfg file can be modified to use the
repeatable.cfg file::
repeatable.cfg file::
...
@@ -88,7 +88,7 @@ repeatable.cfg file::
...
@@ -88,7 +88,7 @@ repeatable.cfg file::
eek
eek
When the buildout is run, the options in repeatable.cfg will override
When the buildout is run, the options in repeatable.cfg will override
the on
c
es in buildout.cfg, providing a repeatable buildout
the ones in buildout.cfg, providing a repeatable buildout
Python API
Python API
----------
----------
...
...
src/zc/buildout/allowhosts.txt
View file @
75b2b450
...
@@ -37,7 +37,7 @@ Let's create a develop egg in our buildout that specifies
...
@@ -37,7 +37,7 @@ Let's create a develop egg in our buildout that specifies
... ''')
... ''')
Now let's configure the buildout to use the develop egg,
Now let's configure the buildout to use the develop egg,
together with some rules that disallow any website but PyPI and
together with some rules that disallow any web
site but PyPI and
local files::
local files::
>>> write(sample_buildout, 'buildout.cfg',
>>> write(sample_buildout, 'buildout.cfg',
...
...
src/zc/buildout/buildout.py
View file @
75b2b450
...
@@ -146,13 +146,11 @@ _buildout_default_options = _annotate_section({
...
@@ -146,13 +146,11 @@ _buildout_default_options = _annotate_section({
class
Buildout
(
DictMixin
):
class
Buildout
(
DictMixin
):
def
__init__
(
self
,
config_file
,
cloptions
,
def
__init__
(
self
,
config_file
,
cloptions
,
user_defaults
=
True
,
windows_restart
=
False
,
user_defaults
=
True
,
command
=
None
,
args
=
()):
command
=
None
,
args
=
()):
__doing__
=
'Initializing.'
__doing__
=
'Initializing.'
self
.
__windows_restart
=
windows_restart
# default options
# default options
data
=
dict
(
buildout
=
_buildout_default_options
.
copy
())
data
=
dict
(
buildout
=
_buildout_default_options
.
copy
())
self
.
_buildout_dir
=
os
.
getcwd
()
self
.
_buildout_dir
=
os
.
getcwd
()
...
@@ -347,7 +345,7 @@ class Buildout(DictMixin):
...
@@ -347,7 +345,7 @@ class Buildout(DictMixin):
if
self
.
offline
:
if
self
.
offline
:
raise
zc
.
buildout
.
UserError
(
raise
zc
.
buildout
.
UserError
(
"install-from-cache can't be used with offline mode.
\
n
"
"install-from-cache can't be used with offline mode.
\
n
"
"Nothing is installed, even from
n
cache, in offline
\
n
"
"Nothing is installed, even from cache, in offline
\
n
"
"mode, which might better be called 'no-install mode'.
\
n
"
"mode, which might better be called 'no-install mode'.
\
n
"
)
)
zc
.
buildout
.
easy_install
.
install_from_cache
(
True
)
zc
.
buildout
.
easy_install
.
install_from_cache
(
True
)
...
@@ -451,7 +449,7 @@ class Buildout(DictMixin):
...
@@ -451,7 +449,7 @@ class Buildout(DictMixin):
# for eggs:
# for eggs:
sys
.
path
.
insert
(
0
,
self
[
'buildout'
][
'develop-eggs-directory'
])
sys
.
path
.
insert
(
0
,
self
[
'buildout'
][
'develop-eggs-directory'
])
# Check for updates. This could cause the process to be rstarted
# Check for updates. This could cause the process to be r
e
started
self
.
_maybe_upgrade
()
self
.
_maybe_upgrade
()
# load installed data
# load installed data
...
@@ -651,11 +649,11 @@ class Buildout(DictMixin):
...
@@ -651,11 +649,11 @@ class Buildout(DictMixin):
f
.
close
()
f
.
close
()
def
_uninstall_part
(
self
,
part
,
installed_part_options
):
def
_uninstall_part
(
self
,
part
,
installed_part_options
):
# un
u
nstall part
# un
i
nstall part
__doing__
=
'Uninstalling %s.'
,
part
__doing__
=
'Uninstalling %s.'
,
part
self
.
_logger
.
info
(
*
__doing__
)
self
.
_logger
.
info
(
*
__doing__
)
# run uinstall recipe
# run u
u
install recipe
recipe
,
entry
=
_recipe
(
installed_part_options
[
part
])
recipe
,
entry
=
_recipe
(
installed_part_options
[
part
])
try
:
try
:
uninstaller
=
_install_and_load
(
uninstaller
=
_install_and_load
(
...
@@ -788,7 +786,7 @@ class Buildout(DictMixin):
...
@@ -788,7 +786,7 @@ class Buildout(DictMixin):
==
==
realpath
(
f
)
realpath
(
f
)
)
)
# Sigh. This is the exectable used to run the buildout
# Sigh. This is the exec
u
table used to run the buildout
# and, of course, it's in use. Leave it.
# and, of course, it's in use. Leave it.
):
):
raise
raise
...
@@ -915,14 +913,6 @@ class Buildout(DictMixin):
...
@@ -915,14 +913,6 @@ class Buildout(DictMixin):
"buildout command."
)
"buildout command."
)
return
return
if
sys
.
platform
==
'win32'
and
not
self
.
__windows_restart
:
args
=
list
(
map
(
zc
.
buildout
.
easy_install
.
_safe_arg
,
sys
.
argv
))
args
.
insert
(
1
,
'-W'
)
if
not
__debug__
:
args
.
insert
(
0
,
'-O'
)
args
.
insert
(
0
,
zc
.
buildout
.
easy_install
.
_safe_arg
(
sys
.
executable
))
os
.
execv
(
sys
.
executable
,
args
)
self
.
_logger
.
info
(
"Upgraded:
\
n
%s;
\
n
restarting."
,
self
.
_logger
.
info
(
"Upgraded:
\
n
%s;
\
n
restarting."
,
",
\
n
"
.
join
([(
"%s version %s"
",
\
n
"
.
join
([(
"%s version %s"
%
(
dist
.
project_name
,
dist
.
version
)
%
(
dist
.
project_name
,
dist
.
version
)
...
@@ -1475,7 +1465,7 @@ def _default_globals():
...
@@ -1475,7 +1465,7 @@ def _default_globals():
globals_defs
=
{
'sys'
:
sys
,
'os'
:
os
,
'platform'
:
platform
,
're'
:
re
,}
globals_defs
=
{
'sys'
:
sys
,
'os'
:
os
,
'platform'
:
platform
,
're'
:
re
,}
# major python major_python_versions as python2 and python3
# major python major_python_versions as python2 and python3
major_python_versions
=
platform
.
python_version_tuple
(
)
major_python_versions
=
tuple
(
map
(
str
,
platform
.
python_version_tuple
())
)
globals_defs
.
update
({
'python2'
:
major_python_versions
[
0
]
==
'2'
,
globals_defs
.
update
({
'python2'
:
major_python_versions
[
0
]
==
'2'
,
'python3'
:
major_python_versions
[
0
]
==
'3'
})
'python3'
:
major_python_versions
[
0
]
==
'3'
})
...
@@ -1695,7 +1685,7 @@ def _error(*message):
...
@@ -1695,7 +1685,7 @@ def _error(*message):
sys
.
exit
(
1
)
sys
.
exit
(
1
)
_internal_error_template
=
"""
_internal_error_template
=
"""
An internal error occured due to a bug in either zc.buildout or in a
An internal error occur
r
ed due to a bug in either zc.buildout or in a
recipe being used:
recipe being used:
"""
"""
...
@@ -1844,7 +1834,6 @@ def main(args=None):
...
@@ -1844,7 +1834,6 @@ def main(args=None):
config_file
=
'buildout.cfg'
config_file
=
'buildout.cfg'
verbosity
=
0
verbosity
=
0
options
=
[]
options
=
[]
windows_restart
=
False
user_defaults
=
True
user_defaults
=
True
debug
=
False
debug
=
False
while
args
:
while
args
:
...
@@ -1856,8 +1845,6 @@ def main(args=None):
...
@@ -1856,8 +1845,6 @@ def main(args=None):
verbosity
+=
10
verbosity
+=
10
elif
op
[
0
]
==
'q'
:
elif
op
[
0
]
==
'q'
:
verbosity
-=
10
verbosity
-=
10
elif
op
[
0
]
==
'W'
:
windows_restart
=
True
elif
op
[
0
]
==
'U'
:
elif
op
[
0
]
==
'U'
:
user_defaults
=
False
user_defaults
=
False
elif
op
[
0
]
==
'o'
:
elif
op
[
0
]
==
'o'
:
...
@@ -1912,7 +1899,7 @@ def main(args=None):
...
@@ -1912,7 +1899,7 @@ def main(args=None):
section
,
option
=
option
section
,
option
=
option
options
.
append
((
section
.
strip
(),
option
.
strip
(),
value
.
strip
()))
options
.
append
((
section
.
strip
(),
option
.
strip
(),
value
.
strip
()))
else
:
else
:
# We've run out of command-line options and option assign
nem
nts
# We've run out of command-line options and option assign
me
nts
# The rest should be commands, so we'll stop here
# The rest should be commands, so we'll stop here
break
break
...
@@ -1932,8 +1919,7 @@ def main(args=None):
...
@@ -1932,8 +1919,7 @@ def main(args=None):
try
:
try
:
try
:
try
:
buildout
=
Buildout
(
config_file
,
options
,
buildout
=
Buildout
(
config_file
,
options
,
user_defaults
,
windows_restart
,
user_defaults
,
command
,
args
)
command
,
args
)
getattr
(
buildout
,
command
)(
args
)
getattr
(
buildout
,
command
)(
args
)
except
SystemExit
:
except
SystemExit
:
logging
.
shutdown
()
logging
.
shutdown
()
...
...
src/zc/buildout/buildout.txt
View file @
75b2b450
...
@@ -462,7 +462,7 @@ leave previously created paths in place:
...
@@ -462,7 +462,7 @@ leave previously created paths in place:
While:
While:
Installing data-dir.
Installing data-dir.
<BLANKLINE>
<BLANKLINE>
An internal error occured due to a bug in either zc.buildout or in a
An internal error occur
r
ed due to a bug in either zc.buildout or in a
recipe being used:
recipe being used:
Traceback (most recent call last):
Traceback (most recent call last):
... exists...
... exists...
...
@@ -493,7 +493,7 @@ If we fix the typo:
...
@@ -493,7 +493,7 @@ If we fix the typo:
While:
While:
Installing data-dir.
Installing data-dir.
<BLANKLINE>
<BLANKLINE>
An internal error occured due to a bug in either zc.buildout or in a
An internal error occur
r
ed due to a bug in either zc.buildout or in a
recipe being used:
recipe being used:
Traceback (most recent call last):
Traceback (most recent call last):
... exists...
... exists...
...
@@ -580,7 +580,7 @@ When we rerun the buildout:
...
@@ -580,7 +580,7 @@ When we rerun the buildout:
While:
While:
Installing data-dir.
Installing data-dir.
<BLANKLINE>
<BLANKLINE>
An internal error occured due to a bug in either zc.buildout or in a
An internal error occur
r
ed due to a bug in either zc.buildout or in a
recipe being used:
recipe being used:
Traceback (most recent call last):
Traceback (most recent call last):
... exists...
... exists...
...
@@ -655,7 +655,7 @@ directories will be created:
...
@@ -655,7 +655,7 @@ directories will be created:
While:
While:
Installing data-dir.
Installing data-dir.
<BLANKLINE>
<BLANKLINE>
An internal error occured due to a bug in either zc.buildout or in a
An internal error occur
r
ed due to a bug in either zc.buildout or in a
recipe being used:
recipe being used:
Traceback (most recent call last):
Traceback (most recent call last):
... exists...
... exists...
...
@@ -696,9 +696,12 @@ section has a section header followed by 0 or more section options.
...
@@ -696,9 +696,12 @@ section has a section header followed by 0 or more section options.
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
A section name consists of one or more non-whitespace characters other
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
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 signs and
characters, an optional plus or minus sign and an equal signs and
...
@@ -714,7 +717,7 @@ Option values have extra whitespace stripped. How this is done
...
@@ -714,7 +717,7 @@ Option values have extra whitespace stripped. How this is done
depends on whether the value has non-whitespace characterts on the
depends on whether the value has non-whitespace characterts 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 exampe, in::
For examp
l
e, in::
[foo]
[foo]
bar = 1
bar = 1
...
@@ -765,7 +768,7 @@ Buildout configuration data are Python strings, which are bytes in
...
@@ -765,7 +768,7 @@ 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 conca
nti
nated.
occurrences of of a section are treated as if they were conca
te
nated.
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.
...
@@ -968,7 +971,7 @@ Section and option names in variable substitutions are only allowed to
...
@@ -968,7 +971,7 @@ Section and option names in variable substitutions are only allowed to
contain alphanumeric characters, hyphens, periods and spaces. This
contain alphanumeric characters, hyphens, periods and spaces. This
restriction might be relaxed in future releases.
restriction might be relaxed in future releases.
We can om
m
it the section name in a variable substitution to refer to
We can omit the section name in a variable substitution to refer to
the current section. We can also use the special option,
the current section. We can also use the special option,
_buildout_section_name_ to get the current section name.
_buildout_section_name_ to get the current section name.
...
@@ -1131,6 +1134,133 @@ In this example, the debug, with_file1 and with_file2 sections act as
...
@@ -1131,6 +1134,133 @@ In this example, the debug, with_file1 and with_file2 sections act as
macros. In particular, the variable substitutions are performed
macros. In particular, the variable substitutions are performed
relative to the myfiles section.
relative to the myfiles section.
Conditional sections
--------------------
Sometimes, you need different configuration in different environments
(different operating systems, or different versions of Python). To
make this easier, you can define environment-specific options by
providing conditional sections::
[ctl]
suffix =
[ctl:windows]
suffix = .bat
.. -> conf
>>> import zc.buildout.configparser
>>> zc.buildout.configparser.parse(
... StringIO.StringIO(conf), 'test', lambda : dict(windows=True))
{'ctl': {'suffix': '.bat'}}
>>> zc.buildout.configparser.parse(
... StringIO.StringIO(conf), 'test', lambda : dict(windows=False))
{'ctl': {'suffix': ''}}
In this tiny example, we've defined a ``ctl:suffix`` option that's
``.bat`` on Windows and an empty string elsewhere.
A conditional section has a colon and then a Python expression after
the name. If the Python expression result is true, the section
options from the section are included. If the value is false, the
section is ignored.
Some things to note:
- If there is no exception, then options from the section are
included.
- Sections and options can be repeated. If an option is repeated, the
last value is used. In the example above, on Windows, the second
``suffix`` option overrides the first. If the order of the sections
was reversed, the conditional section would have no effect.
In addition to the normal built-ins, the expression has access to
global variable that make common cases short and description as shown
above:
sys
the ``sys`` module
os
the ``os`` module
platform
the ``platform`` module
re
The ``re`` module
python2
We're running Python 2
python3
We're running Python 3
python26
We're running Python 2.6
python27
We're running Python 2.7
python32
We're running Python 3.2
python33
We're running Python 3.3
sys_version
``sys.version.lower()``
pypy
We're running PyPy
jython
We're running Jython
iron
We're running Iron Python
cpython
We're not running PyPy, Jython, or Iron Python
sys_platform
``str(sys.platform).lower()``
linux
We're running on linux
windows
We're running on Windows
cygwin
We're running on cygwin
solaris
We're running on solaris
macos
We're running on Mac OS
posix
We're running on a POSIX-compatible system
bits32
We're running on a 32-bit system.
bits64
We're running on a 64-bit system.
little_endian
We're running on a little-endian system
big_endian
We're running on a little-endian system
Expressions must not contain either the ``#`` or the ``;`` character.
Adding and removing options
Adding and removing options
---------------------------
---------------------------
...
@@ -2703,12 +2833,12 @@ interpreter with the given requirements or paths:
...
@@ -2703,12 +2833,12 @@ interpreter with the given requirements or paths:
extra-paths =
extra-paths =
./src
./src
Passing requirements or paths causes the the builout to be run as part
Passing requirements or paths causes the the buil
d
out to be run as part
of initialization. In the example above, we got a number of
of initialization. In the example above, we got a number of
distributions installed and 2 scripts generated. The first, ``demo``,
distributions installed and 2 scripts generated. The first, ``demo``,
was defined by the ``demo`` project. The second, ``py`` was defined by
was defined by the ``demo`` project. The second, ``py`` was defined by
the generated configuration. It's a "custom interpreter" that behaves
the generated configuration. It's a "custom interpreter" that behaves
like a standard Python interpeter, except that includes the specified
like a standard Python interp
r
eter, except that includes the specified
eggs and extra paths in it's Python path.
eggs and extra paths in it's Python path.
We specified a source directory that didn't exist. Buildout created it
We specified a source directory that didn't exist. Buildout created it
...
...
src/zc/buildout/configparser.py
View file @
75b2b450
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
# The following copied from Python 2 config parser because:
# The following copied from Python 2 config parser because:
# - The py3 configparser isn't backward compatible
# - The py3 configparser isn't backward compatible
# - Both strip option values in undesir
e
able ways
# - Both strip option values in undesirable ways
# - dict of dicts is a much simpler api
# - dict of dicts is a much simpler api
import
re
import
re
...
@@ -82,7 +82,7 @@ class MissingSectionHeaderError(ParsingError):
...
@@ -82,7 +82,7 @@ class MissingSectionHeaderError(ParsingError):
# [section_name: some Python expression] #; some comment
# [section_name: some Python expression] #; some comment
# This regex leverages the fact that the following is a valid Python expression:
# This regex leverages the fact that the following is a valid Python expression:
# [some Python expression] # some comment
# [some Python expression] # some comment
# and that section headers are also delimited by [brackets] t
ah
t are also [list]
# and that section headers are also delimited by [brackets] t
ha
t are also [list]
# delimiters.
# delimiters.
# So instead of doing complex parsing to balance brackets in an expression, we
# So instead of doing complex parsing to balance brackets in an expression, we
# capture just enough from a header line to collect then remove the section_name
# capture just enough from a header line to collect then remove the section_name
...
@@ -127,7 +127,7 @@ def parse(fp, fpname, exp_globals=dict):
...
@@ -127,7 +127,7 @@ def parse(fp, fpname, exp_globals=dict):
Optionally
the
title
line
can
have
the
form
`
[
name
:
expression
]
' where
Optionally
the
title
line
can
have
the
form
`
[
name
:
expression
]
' where
expression is an arbitrary Python expression. Sections with an expression
expression is an arbitrary Python expression. Sections with an expression
that evaluates to False are ignored. Semicolon `;'
an
hash
`
#' characters
that evaluates to False are ignored. Semicolon `;'
an
hash
`
#' characters
must
r
be
string
-
escaped
in
expression
literals
.
must
be
string
-
escaped
in
expression
literals
.
exp_globals
is
a
callable
returning
a
mapping
of
defaults
used
as
globals
exp_globals
is
a
callable
returning
a
mapping
of
defaults
used
as
globals
during
the
evaluation
of
a
section
conditional
expression
.
during
the
evaluation
of
a
section
conditional
expression
.
...
...
src/zc/buildout/configparser.test
View file @
75b2b450
...
@@ -285,7 +285,7 @@ objects made available to the evaluation context of the expression. Here we add
...
@@ -285,7 +285,7 @@ objects made available to the evaluation context of the expression. Here we add
the
platform
and
sys
modules
to
the
evaluation
context
,
so
we
can
access
the
platform
and
sys
modules
to
the
evaluation
context
,
so
we
can
access
platform
and
sys
modules
functions
and
objects
in
our
expressions
::
platform
and
sys
modules
functions
and
objects
in
our
expressions
::
[
s1
:
platform
.
python_version_tuple
()[
0
]
in
(
'2'
,
'3'
,)]
# this expression is true, the major versions of python are either 2 or 3
[
s1
:
str
(
platform
.
python_version_tuple
()[
0
])
in
(
'2'
,
'3'
,)]
# this expression is true, the major versions of python are either 2 or 3
a
=
1
a
=
1
[
s2
:
sys
.
version
[
0
]
==
'0'
]
# comment: this expression "is false", there no major version 0 of Python so this section will be ignored
[
s2
:
sys
.
version
[
0
]
==
'0'
]
# comment: this expression "is false", there no major version 0 of Python so this section will be ignored
...
...
src/zc/buildout/debugging.txt
View file @
75b2b450
...
@@ -5,7 +5,7 @@ Buildouts can be pretty complex. When things go wrong, it isn't
...
@@ -5,7 +5,7 @@ Buildouts can be pretty complex. When things go wrong, it isn't
always obvious why. Errors can occur due to problems in user input or
always obvious why. Errors can occur due to problems in user input or
due to bugs in zc.buildout or recipes. When an error occurs, Python's
due to bugs in zc.buildout or recipes. When an error occurs, Python's
post-mortem debugger can be used to inspect the state of the buildout
post-mortem debugger can be used to inspect the state of the buildout
or recipe code were there error occured. To enable this, use the -D
or recipe code were there error occur
r
ed. To enable this, use the -D
option to the buildout. Let's create a recipe that has a bug:
option to the buildout. Let's create a recipe that has a bug:
>>> mkdir(sample_buildout, 'recipes')
>>> mkdir(sample_buildout, 'recipes')
...
...
src/zc/buildout/easy_install.py
View file @
75b2b450
...
@@ -318,7 +318,7 @@ class Installer:
...
@@ -318,7 +318,7 @@ class Installer:
if
exit_code
:
if
exit_code
:
logger
.
error
(
logger
.
error
(
"An error occured when trying to install %s. "
"An error occur
r
ed when trying to install %s. "
"Look above this message for any errors that "
"Look above this message for any errors that "
"were output by easy_install."
,
"were output by easy_install."
,
dist
)
dist
)
...
@@ -1384,7 +1384,7 @@ def _constrained_requirement_constraint(constraint, requirement):
...
@@ -1384,7 +1384,7 @@ def _constrained_requirement_constraint(constraint, requirement):
# Simple cases:
# Simple cases:
# No specs t
p
merge with:
# No specs t
o
merge with:
if
not
requirement
.
specs
:
if
not
requirement
.
specs
:
if
not
constraint
[
0
]
in
'<=>'
:
if
not
constraint
[
0
]
in
'<=>'
:
constraint
=
'=='
+
constraint
constraint
=
'=='
+
constraint
...
@@ -1422,8 +1422,8 @@ def _constrained_requirement_constraint(constraint, requirement):
...
@@ -1422,8 +1422,8 @@ def _constrained_requirement_constraint(constraint, requirement):
cop0
=
cop
[
0
]
cop0
=
cop
[
0
]
# Normalize specs by splitting >= and <= specs. We
meed tp
do this
# Normalize specs by splitting >= and <= specs. We
need to
do this
# beca
i
se these have really weird semantics. Also cache parsed
# beca
u
se these have really weird semantics. Also cache parsed
# versions, which we'll need for comparisons:
# versions, which we'll need for comparisons:
specs
=
[]
specs
=
[]
for
op
,
v
in
requirement
.
specs
:
for
op
,
v
in
requirement
.
specs
:
...
...
src/zc/buildout/extends-cache.txt
View file @
75b2b450
...
@@ -153,7 +153,7 @@ under any particular circumstances.
...
@@ -153,7 +153,7 @@ under any particular circumstances.
been specified by the user's default configuration, the project's root
been specified by the user's default configuration, the project's root
config file must be available, be it from disk or from the net.
config file must be available, be it from disk or from the net.
- Offline mode turned on by the ``-o`` command line option is hono
u
red from
- Offline mode turned on by the ``-o`` command line option is honored from
the beginning even though command line options are applied to the
the beginning even though command line options are applied to the
configuration last. If offline mode is not requested by the command line, it
configuration last. If offline mode is not requested by the command line, it
may be switched on by either the user's or the project's config root.
may be switched on by either the user's or the project's config root.
...
@@ -383,12 +383,12 @@ Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
...
@@ -383,12 +383,12 @@ Error: Couldn't download 'http://localhost/base.cfg' in offline mode.
While:
While:
Installing.
Installing.
Checking for upgrades.
Checking for upgrades.
An internal error occured ...
An internal error occur
r
ed ...
ValueError: install_from_cache set to true with no download cache
ValueError: install_from_cache set to true with no download cache
>>> rmdir('home', '.buildout')
>>> rmdir('home', '.buildout')
Newest and non-newest behavio
u
r for extends cache
Newest and non-newest behavior for extends cache
-------------------------------------------------
-------------------------------------------------
While offline mode forbids network access completely, 'newest' mode determines
While offline mode forbids network access completely, 'newest' mode determines
...
@@ -467,7 +467,7 @@ used:
...
@@ -467,7 +467,7 @@ used:
Unused options for buildout: 'bar' 'foo'.
Unused options for buildout: 'bar' 'foo'.
(XXX We patch download utility's API to produce readable output for the test;
(XXX We patch download utility's API to produce readable output for the test;
a better solution would
utili
se the logging already done by the utility.)
a better solution would
re-u
se the logging already done by the utility.)
>>> import zc.buildout
>>> import zc.buildout
>>> old_download = zc.buildout.download.Download.download
>>> old_download = zc.buildout.download.Download.download
...
@@ -489,7 +489,7 @@ Unused options for buildout: 'bar' 'foo'.
...
@@ -489,7 +489,7 @@ Unused options for buildout: 'bar' 'foo'.
The deprecated ``extended-by`` option
The deprecated ``extended-by`` option
-------------------------------------
-------------------------------------
The ``buildout`` section used to recogni
s
e an option named ``extended-by``
The ``buildout`` section used to recogni
z
e an option named ``extended-by``
that was deprecated at some point and removed in the 1.5 line. Since ignoring
that was deprecated at some point and removed in the 1.5 line. Since ignoring
this option silently was considered harmful as a matter of principle, a
this option silently was considered harmful as a matter of principle, a
UserError is raised if that option is encountered now:
UserError is raised if that option is encountered now:
...
...
src/zc/buildout/repeatable.txt
View file @
75b2b450
...
@@ -7,13 +7,13 @@ configuration files for a project into a version control system and
...
@@ -7,13 +7,13 @@ configuration files for a project into a version control system and
later use the checked in files to get the same buildout, subject to
later use the checked in files to get the same buildout, subject to
changes in the environment outside the buildout.
changes in the environment outside the buildout.
An advantage of using Python eggs is that depenencies of eggs used are
An advantage of using Python eggs is that depen
d
encies of eggs used are
automatically determined and used. The automatic inclusion of
automatically determined and used. The automatic inclusion of
depenent distributions is at odds with the goal of repeatable
depen
d
ent distributions is at odds with the goal of repeatable
buildouts.
buildouts.
To support repeatable buildouts, a versions section can be created
To support repeatable buildouts, a versions section can be created
with options for each distribution name whos version is to be fixed.
with options for each distribution name who
'
s version is to be fixed.
The section can then be specified via the buildout versions option.
The section can then be specified via the buildout versions option.
To see how this works, we'll create two versions of a recipe egg:
To see how this works, we'll create two versions of a recipe egg:
...
...
src/zc/buildout/testing.txt
View file @
75b2b450
...
@@ -49,7 +49,7 @@ number of names to the test namespace:
...
@@ -49,7 +49,7 @@ number of names to the test namespace:
will be automatically removed at the end of the test. The path of
will be automatically removed at the end of the test. The path of
the created directory is returned.
the created directory is returned.
Further, if the the normalize_path norm
la
izing substitution (see
Further, if the the normalize_path norm
al
izing substitution (see
below) is used, then any paths starting with this path will be
below) is used, then any paths starting with this path will be
normalized to::
normalized to::
...
@@ -111,7 +111,7 @@ number of names to the test namespace:
...
@@ -111,7 +111,7 @@ number of names to the test namespace:
``sdist(setup, dest)``
``sdist(setup, dest)``
Create a source distribution by running the given setup file and
Create a source distribution by running the given setup file and
placing the result in the given destination directory. If the
placing the result in the given destination directory. If the
setup argument is a directory, the
thge
setup.py file in that
setup argument is a directory, the setup.py file in that
directory is used.
directory is used.
``bdist_egg(setup, dest)``
``bdist_egg(setup, dest)``
...
...
src/zc/buildout/tests.py
View file @
75b2b450
...
@@ -146,7 +146,7 @@ It is an error to create a variable-reference cycle:
...
@@ -146,7 +146,7 @@ It is an error to create a variable-reference cycle:
Getting option buildout:x.
Getting option buildout:x.
Error: Circular reference in substitutions.
Error: Circular reference in substitutions.
It is an error to use funny characters in variable refereces:
It is an error to use funny characters in variable refere
n
ces:
>>> write(sample_buildout, 'buildout.cfg',
>>> write(sample_buildout, 'buildout.cfg',
... '''
... '''
...
@@ -222,7 +222,7 @@ and too have too many or too few colons:
...
@@ -222,7 +222,7 @@ and too have too many or too few colons:
Error: The substitution, ${buildout:y:z},
Error: The substitution, ${buildout:y:z},
has too many colons.
has too many colons.
Al parts have to have a section:
Al
l
parts have to have a section:
>>> write(sample_buildout, 'buildout.cfg',
>>> write(sample_buildout, 'buildout.cfg',
... '''
... '''
...
@@ -745,13 +745,13 @@ All gone
...
@@ -745,13 +745,13 @@ All gone
def
add_distribute_to_dependencies_when_namespace_packages
():
def
add_distribute_to_dependencies_when_namespace_packages
():
'''
'''
Often, a package depends on distribute soley by virtue of using
Often, a package depends on distribute sole
l
y by virtue of using
namespace packages. In this situation, package authors often forget to
namespace packages. In this situation, package authors often forget to
declare distribute as a dependency. This is a mistake, but,
declare distribute as a dependency. This is a mistake, but,
unfortunately, a common one that we need to work around. If an egg
unfortunately, a common one that we need to work around. If an egg
uses namespace packages and does not include distribute as a depenency,
uses namespace packages and does not include distribute as a depen
d
ency,
we will still include distribute in the working set. If we see this for
we will still include distribute in the working set. If we see this for
a devlop egg, we will also generate a warning.
a dev
e
lop egg, we will also generate a warning.
>>> mkdir('foo')
>>> mkdir('foo')
>>> mkdir('foo', 'src')
>>> mkdir('foo', 'src')
...
@@ -832,7 +832,7 @@ We do not get a warning, but we do get distribute included in the working set:
...
@@ -832,7 +832,7 @@ We do not get a warning, but we do get distribute included in the working set:
>>> print_(handler, end='')
>>> print_(handler, end='')
We get the same behavior if the it is a depedency that uses a
We get the same behavior if the it is a depe
n
dency that uses a
namespace package.
namespace package.
...
@@ -1392,7 +1392,7 @@ def internal_errors():
...
@@ -1392,7 +1392,7 @@ def internal_errors():
Getting section data-dir.
Getting section data-dir.
Initializing section data-dir.
Initializing section data-dir.
<BLANKLINE>
<BLANKLINE>
An internal error occured due to a bug in either zc.buildout or in a
An internal error occur
r
ed due to a bug in either zc.buildout or in a
recipe being used:
recipe being used:
Traceback (most recent call last):
Traceback (most recent call last):
...
...
...
@@ -1844,7 +1844,7 @@ if sys.version_info > (2, 4):
...
@@ -1844,7 +1844,7 @@ if sys.version_info > (2, 4):
Initializing section x.
Initializing section x.
Loading zc.buildout recipe entry zc.buildout.testexit:default.
Loading zc.buildout recipe entry zc.buildout.testexit:default.
<BLANKLINE>
<BLANKLINE>
An internal error occured due to a bug in either zc.buildout or in a
An internal error occur
r
ed due to a bug in either zc.buildout or in a
recipe being used:
recipe being used:
Traceback (most recent call last):
Traceback (most recent call last):
...
...
...
@@ -2084,7 +2084,7 @@ directory and then use the wacky extension to load the demo package
...
@@ -2084,7 +2084,7 @@ directory and then use the wacky extension to load the demo package
def
distributions_from_local_find_links_make_it_to_download_cache
():
def
distributions_from_local_find_links_make_it_to_download_cache
():
"""
"""
If we specify a local directory in find links, dist
or
s found there
If we specify a local directory in find links, dist
ro
s found there
need to make it to the download cache.
need to make it to the download cache.
>>> mkdir('test')
>>> mkdir('test')
...
@@ -2699,7 +2699,7 @@ def increment_on_command_line():
...
@@ -2699,7 +2699,7 @@ def increment_on_command_line():
def
test_constrained_requirement
():
def
test_constrained_requirement
():
"""
"""
zc.buildout.easy_install._constrained_requirement(constraint, requi
t
ement)
zc.buildout.easy_install._constrained_requirement(constraint, requi
r
ement)
Transforms an environment by applying a constraint.
Transforms an environment by applying a constraint.
...
@@ -2845,7 +2845,7 @@ def cant_use_install_from_cache_and_offline_together():
...
@@ -2845,7 +2845,7 @@ def cant_use_install_from_cache_and_offline_together():
While:
While:
Initializing.
Initializing.
Error: install-from-cache can't be used with offline mode.
Error: install-from-cache can't be used with offline mode.
Nothing is installed, even from
n
cache, in offline
Nothing is installed, even from cache, in offline
mode, which might better be called 'no-install mode'.
mode, which might better be called 'no-install mode'.
<BLANKLINE>
<BLANKLINE>
"""
"""
...
...
src/zc/buildout/update.txt
View file @
75b2b450
...
@@ -237,7 +237,7 @@ directory:
...
@@ -237,7 +237,7 @@ directory:
When buildout restarts and the restarted buildout exits with an error code,
When buildout restarts and the restarted buildout exits with an error code,
the original buildout that called the second buildout also exits with that
the original buildout that called the second buildout also exits with that
error code. Otherwise build scripts can erroneously detect a succesful
error code. Otherwise build scripts can erroneously detect a succes
s
ful
buildout run even if it failed.
buildout run even if it failed.
Make a recipe that fails:
Make a recipe that fails:
...
...
zc.recipe.egg_/CHANGES.txt
View file @
75b2b450
...
@@ -56,7 +56,7 @@ Feature Changes
...
@@ -56,7 +56,7 @@ Feature Changes
- Added initialization and arguments options to the scripts recipe.
- Added initialization and arguments options to the scripts recipe.
- Added an eggs recipe that *just* install
e
s eggs.
- Added an eggs recipe that *just* installs eggs.
- Advertized the scripts recipe for creating scripts.
- Advertized the scripts recipe for creating scripts.
...
@@ -97,7 +97,7 @@ Updated to work with zc.buildout 1.0.0b3.
...
@@ -97,7 +97,7 @@ Updated to work with zc.buildout 1.0.0b3.
- Extra path elements to be included in generated scripts can now be
- Extra path elements to be included in generated scripts can now be
set via the extra-paths option.
set via the extra-paths option.
- No longer implicitly generate
py\_ scripts fo r
each egg. There is
- No longer implicitly generate
"py\_" scripts for
each egg. There is
now an interpreter option to generate a script that, when run
now an interpreter option to generate a script that, when run
without arguments, launches the Python interactive interpreter with
without arguments, launches the Python interactive interpreter with
the path set based on a parts eggs and extra paths. If this script
the path set based on a parts eggs and extra paths. If this script
...
@@ -122,7 +122,7 @@ Updated to work with zc.buildout 1.0.0b3.
...
@@ -122,7 +122,7 @@ Updated to work with zc.buildout 1.0.0b3.
1.0.0a2
1.0.0a2
=======
=======
Added a custom recipe for building custom eggs using custom dist
r
utils
Added a custom recipe for building custom eggs using custom distutils
build_ext arguments.
build_ext arguments.
1.0.0a1
1.0.0a1
...
...
zc.recipe.egg_/setup.py
View file @
75b2b450
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
"""Setup for zc.recipe.egg package
"""Setup for zc.recipe.egg package
"""
"""
version
=
'2.0.
0a3
'
version
=
'2.0.
1dev
'
import
os
import
os
from
setuptools
import
setup
,
find_packages
from
setuptools
import
setup
,
find_packages
...
...
zc.recipe.egg_/src/zc/recipe/egg/README.txt
View file @
75b2b450
...
@@ -182,7 +182,7 @@ Let's add an interpreter option:
...
@@ -182,7 +182,7 @@ Let's add an interpreter option:
... interpreter = py-demo
... interpreter = py-demo
... """ % dict(server=link_server))
... """ % dict(server=link_server))
Note that we om
m
itted the entry point name from the recipe
Note that we omitted the entry point name from the recipe
specification. We were able to do this because the scripts recipe is
specification. We were able to do this because the scripts recipe is
the default entry point for the zc.recipe.egg egg.
the default entry point for the zc.recipe.egg egg.
...
@@ -483,11 +483,11 @@ each individual script section:
...
@@ -483,11 +483,11 @@ each individual script section:
if __name__ == '__main__':
if __name__ == '__main__':
sys.exit(eggrecipedemo.main())
sys.exit(eggrecipedemo.main())
Specifying initiali
ali
zation code and arguments
Specifying initialization code and arguments
-----------------------------------------------
-----------------------------------------------
Sometimes, we need to do more than just calling entry points. We can
Sometimes, we need to do more than just calling entry points. We can
use the initiali
ali
zation and arguments options to specify extra code
use the initialization and arguments options to specify extra code
to be included in generated scripts:
to be included in generated scripts:
...
...
zc.recipe.egg_/src/zc/recipe/egg/api.txt
View file @
75b2b450
...
@@ -7,7 +7,7 @@ recipe provides an API that other recipes can use.
...
@@ -7,7 +7,7 @@ recipe provides an API that other recipes can use.
A recipe can reuse the egg recipe, supporting the eggs, find-links,
A recipe can reuse the egg recipe, supporting the eggs, find-links,
index, and extra-paths options. This is done by creating an
index, and extra-paths options. This is done by creating an
egg recipe instance in a recipes's contructor. In the recipe's
egg recipe instance in a recipes's con
s
tructor. In the recipe's
install script, the egg-recipe instance's working_set method is used
install script, the egg-recipe instance's working_set method is used
to collect the requested eggs and working set.
to collect the requested eggs and working set.
...
...
zc.recipe.egg_/src/zc/recipe/egg/custom.txt
View file @
75b2b450
...
@@ -25,17 +25,17 @@ define
...
@@ -25,17 +25,17 @@ define
define.
define.
undef
undef
A comma
n
separated list of names of C preprocessor variables to
A comma
-
separated list of names of C preprocessor variables to
undefine.
undefine.
libraries
libraries
The name of an additional library to link with. Due to limitations
The name of an additional library to link with. Due to limitations
in distutils and desp
r
ite the option name, only a single library
in distutils and despite the option name, only a single library
can be specified.
can be specified.
link-objects
link-objects
The name of an link object to link against. Due to limitations
The name of an link object to link against. Due to limitations
in distutils and desp
r
ite the option name, only a single link object
in distutils and despite the option name, only a single link object
can be specified.
can be specified.
debug
debug
...
@@ -286,7 +286,7 @@ Controlling environment variables
...
@@ -286,7 +286,7 @@ Controlling environment variables
To set additional environment variables, the `environment` option is used.
To set additional environment variables, the `environment` option is used.
Let's create a recipe which prints out environment variables. We need this to
Let's create a recipe which prints out environment variables. We need this to
make sure the set envir
i
onment variables are removed after the egg:custom
make sure the set environment variables are removed after the egg:custom
recipe was run.
recipe was run.
>>> mkdir(sample_buildout, 'recipes')
>>> mkdir(sample_buildout, 'recipes')
...
@@ -372,7 +372,7 @@ the original value will be restored:
...
@@ -372,7 +372,7 @@ the original value will be restored:
Sometimes it is required to prepend or append to an existing environment
Sometimes it is required to prepend or append to an existing environment
variable, for instance for adding something to the PATH. Therefor all variables
variable, for instance for adding something to the PATH. Therefor
e
all variables
are interpolated with os.environ before the're set:
are interpolated with os.environ before the're set:
>>> write(sample_buildout, 'buildout.cfg',
>>> write(sample_buildout, 'buildout.cfg',
...
@@ -460,17 +460,17 @@ define
...
@@ -460,17 +460,17 @@ define
define.
define.
undef
undef
A comma
n
separated list of names of C preprocessor variables to
A comma
-
separated list of names of C preprocessor variables to
undefine.
undefine.
libraries
libraries
The name of an additional library to link with. Due to limitations
The name of an additional library to link with. Due to limitations
in distutils and desp
r
ite the option name, only a single library
in distutils and despite the option name, only a single library
can be specified.
can be specified.
link-objects
link-objects
The name of an link object to link against. Due to limitations
The name of an link object to link against. Due to limitations
in distutils and desp
r
ite the option name, only a single link object
in distutils and despite the option name, only a single link object
can be specified.
can be specified.
debug
debug
...
...
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