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
Boxiang Sun
slapos.buildout
Commits
27174f36
Commit
27174f36
authored
Aug 29, 2006
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
continue factoring
parent
27d77625
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
2140 deletions
+0
-2140
zc.buildoutsupport/zc/buildoutsupport/buildout.py
zc.buildoutsupport/zc/buildoutsupport/buildout.py
+0
-711
zc.buildoutsupport/zc/buildoutsupport/buildout.txt
zc.buildoutsupport/zc/buildoutsupport/buildout.txt
+0
-1201
zc.buildoutsupport/zc/buildoutsupport/tests.py
zc.buildoutsupport/zc/buildoutsupport/tests.py
+0
-228
No files found.
zc.buildoutsupport/zc/buildoutsupport/buildout.py
deleted
100644 → 0
View file @
27d77625
This diff is collapsed.
Click to expand it.
zc.buildoutsupport/zc/buildoutsupport/buildout.txt
deleted
100644 → 0
View file @
27d77625
This diff is collapsed.
Click to expand it.
zc.buildoutsupport/zc/buildoutsupport/tests.py
View file @
27174f36
...
...
@@ -24,203 +24,6 @@ os_path_sep = os.path.sep
if
os_path_sep
==
'
\
\
'
:
os_path_sep
*=
2
def
buildout_error_handling
():
r"""Buildout error handling
Asking for a section that doesn't exist, yields a key error:
>>> import os
>>> os.chdir(sample_buildout)
>>> import zc.buildout.buildout
>>> buildout = zc.buildout.buildout.Buildout('buildout.cfg', [])
>>> buildout['eek']
Traceback (most recent call last):
...
KeyError: 'eek'
Asking for an option that doesn't exist, a MissingOption error is raised:
>>> buildout['buildout']['eek']
Traceback (most recent call last):
...
MissingOption: Missing option: buildout:eek
It is an error to create a variable-reference cycle:
>>> write(sample_buildout, 'buildout.cfg',
... '''
... [buildout]
... develop = recipes
... parts = data_dir debug
... x = ${buildout:y}
... y = ${buildout:z}
... z = ${buildout:x}
... ''')
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
Error: Circular reference in substitutions.
We're evaluating buildout:y, buildout:z, buildout:x
and are referencing: buildout:y.
It is an error to use funny characters in variable refereces:
>>> write(sample_buildout, 'buildout.cfg',
... '''
... [buildout]
... develop = recipes
... parts = data_dir debug
... x = ${bui$ldout:y}
... ''')
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
Error: The section name in substitution, ${bui$ldout:y},
has invalid characters.
>>> write(sample_buildout, 'buildout.cfg',
... '''
... [buildout]
... develop = recipes
... parts = data_dir debug
... x = ${buildout:y{z}
... ''')
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
Error: The option name in substitution, ${buildout:y{z},
has invalid characters.
and too have too many or too few colons:
>>> write(sample_buildout, 'buildout.cfg',
... '''
... [buildout]
... develop = recipes
... parts = data_dir debug
... x = ${parts}
... ''')
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
Error: The substitution, ${parts},
doesn't contain a colon.
>>> write(sample_buildout, 'buildout.cfg',
... '''
... [buildout]
... develop = recipes
... parts = data_dir debug
... x = ${buildout:y:z}
... ''')
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
Error: The substitution, ${buildout:y:z},
has too many colons.
Al parts have to have a section:
>>> write(sample_buildout, 'buildout.cfg',
... '''
... [buildout]
... parts = x
... ''')
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
Error: No section was specified for part x
and all parts have to have a specified recipe:
>>> write(sample_buildout, 'buildout.cfg',
... '''
... [buildout]
... parts = x
...
... [x]
... foo = 1
... ''')
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')),
Error: Missing option: x:recipe
"""
def
test_comparing_saved_options_with_funny_characters
():
"""
If an option has newlines, extra/odd spaces or a %, we need to make
sure the comparison with the saved value works correctly.
>>> mkdir(sample_buildout, 'recipes')
>>> write(sample_buildout, 'recipes', 'debug.py',
... '''
... class Debug:
... def __init__(self, buildout, name, options):
... options['debug'] =
\
"
\
"
\
"
<zodb>
...
... <filestorage>
... path foo
... </filestorage>
...
... </zodb>
...
\
"
\
"
\
"
... options['debug1'] =
\
"
\
"
\
"
... <zodb>
...
... <filestorage>
... path foo
... </filestorage>
...
... </zodb>
...
\
"
\
"
\
"
... options['debug2'] = ' x '
... options['debug3'] = '42'
... options['format'] = '%3d'
...
... def install(self):
... open('t', 'w').write('t')
... return 't'
... ''')
>>> write(sample_buildout, 'recipes', 'setup.py',
... '''
... from setuptools import setup
... setup(
... name = "recipes",
... entry_points = {'zc.buildout': ['default = debug:Debug']},
... )
... ''')
>>> write(sample_buildout, 'recipes', 'README.txt', " ")
>>> write(sample_buildout, 'buildout.cfg',
... '''
... [buildout]
... develop = recipes
... parts = debug
...
... [debug]
... recipe = recipes
... ''')
>>> os.chdir(sample_buildout)
>>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')
>>> print system(buildout+' -v'), # doctest: +ELLIPSIS
buildout: Running ...setup.py -q develop ...
buildout: Installing debug
If we run the buildout again, we shoudn't get a message about
uninstalling anything because the configuration hasn't changed.
>>> print system(buildout+' -v'),
buildout: Running setup.py -q develop ...
buildout: Installing debug
"""
def
linkerSetUp
(
test
):
zc
.
buildout
.
testing
.
buildoutSetUp
(
test
,
clear_home
=
False
)
zc
.
buildout
.
testing
.
multi_python
(
test
)
zc
.
buildout
.
testing
.
setUpServer
(
test
,
zc
.
buildout
.
testing
.
make_tree
(
test
))
def
easy_install_SetUp
(
test
):
zc
.
buildout
.
testing
.
buildoutSetUp
(
test
)
zc
.
buildout
.
testing
.
multi_python
(
test
)
...
...
@@ -283,28 +86,6 @@ class PythonNormalizing(renormalizing.RENormalizing):
def
test_suite
():
return
unittest
.
TestSuite
((
doctest
.
DocFileSuite
(
'buildout.txt'
,
setUp
=
zc
.
buildout
.
testing
.
buildoutSetUp
,
tearDown
=
zc
.
buildout
.
testing
.
buildoutTearDown
,
checker
=
renormalizing
.
RENormalizing
([
(
re
.
compile
(
'__buildout_signature__ = recipes-
\
S+
'
),
'
__buildout_signature__
=
recipes
-
SSSSSSSSSSS
'),
(re.compile('
\
S
+
sample
-
(
\
w
+
)
%
s
(
\
S
+
)
' % os_path_sep),
r'
/
sample
-
\
1
/
\
2
'),
(re.compile('
\
S
+
sample
-
(
\
w
+
)
'), r'
/
sample
-
\
1
'),
(re.compile('
executable
=
\
S
+
python
\
S
*
'),
'
executable
=
python
'),
(re.compile('
setuptools
-
\
S
+
[.]
egg
'), '
setuptools
.
egg
'),
(re.compile('
zc
.
buildout
(
-
\
S
+
)
?
[.]
egg
(
-
link
)
?
'),
'
zc
.
buildout
.
egg
'),
(re.compile('
creating
\
S
*
setup
.
cfg
'), '
creating
setup
.
cfg
'),
(re.compile('
(
\
n
?
)
-
([
a
-
zA
-
Z_
.
-
]
+
)
-
script
.
py
\
n
-
\\
2.
exe
\
n
'),
'
\\
1
-
\\
2
\
n
'),
(re.compile("(
\
w)%s(
\
w)" % os_path_sep), r"
\
1
/
\
2
"),
])
),
doctest
.
DocFileSuite
(
'easy_install.txt'
,
setUp
=
easy_install_SetUp
,
...
...
@@ -327,15 +108,6 @@ def test_suite():
(re.compile('#!
\
S+py
t
hon
\
S+
'
), '#!python'),
]),
),
doctest.DocTestSuite(
setUp=zc.buildout.testing.buildoutSetUp,
tearDown=zc.buildout.testing.buildoutTearDown,
checker=PythonNormalizing([
(re.compile("
buildout
:
Running
\
S
*
setup
.
py
"),
'buildout: Running setup.py'),
]),
)
))
if __name__ == '__main__':
...
...
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