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
Nicolas Wavrant
slapos.buildout
Commits
b0466bb4
Commit
b0466bb4
authored
Apr 29, 2009
by
Tarek Ziad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding the --version option into bootstrap.py
parent
b8abe5f0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
177 additions
and
60 deletions
+177
-60
CHANGES.txt
CHANGES.txt
+2
-1
README.txt
README.txt
+5
-0
bootstrap/bootstrap.py
bootstrap/bootstrap.py
+13
-6
src/zc/buildout/bootstrap.txt
src/zc/buildout/bootstrap.txt
+126
-0
src/zc/buildout/tests.py
src/zc/buildout/tests.py
+31
-53
No files found.
CHANGES.txt
View file @
b0466bb4
...
...
@@ -5,7 +5,8 @@ Change History
==================
- Better Windows compatibility in test infrastructure.
- Now the bootstrap.py has an optional --version argument,
that can be used to force zc.buildout version to use.
1.2.1 (2009-03-18)
==================
...
...
README.txt
View file @
b0466bb4
...
...
@@ -119,6 +119,11 @@ then use to run the tests.
This is probably the most common type of buildout.
If I need to run a previous version of zc.buildout, I use the
`--version` option of the buildout.py script::
$ python bootstrap.py --version 1.1.3
The `zc.buildout project <http://svn.zope.org/zc.buildout/trunk>`_
is a slightly more complex example of this type of buildout.
...
...
bootstrap/bootstrap.py
View file @
b0466bb4
...
...
@@ -49,11 +49,18 @@ else:
cmd
=
'from setuptools.command.easy_install import main; main()'
ws
=
pkg_resources
.
working_set
if
len
(
sys
.
argv
)
>
2
and
sys
.
argv
[
1
]
==
'--version'
:
VERSION
=
' == %s'
%
sys
.
argv
[
2
]
args
=
sys
.
argv
[
3
:]
+
[
'bootstrap'
]
else
:
VERSION
=
''
args
=
sys
.
argv
[
1
:]
+
[
'bootstrap'
]
if
is_jython
:
import
subprocess
assert
subprocess
.
Popen
([
sys
.
executable
]
+
[
'-c'
,
quote
(
cmd
),
'-mqNxd'
,
quote
(
tmpeggs
),
'zc.buildout'
],
assert
subprocess
.
Popen
([
sys
.
executable
]
+
[
'-c'
,
quote
(
cmd
),
'-mqNxd'
,
quote
(
tmpeggs
),
'zc.buildout'
+
VERSION
],
env
=
dict
(
os
.
environ
,
PYTHONPATH
=
ws
.
find
(
pkg_resources
.
Requirement
.
parse
(
'setuptools'
)).
location
...
...
@@ -63,7 +70,7 @@ if is_jython:
else
:
assert
os
.
spawnle
(
os
.
P_WAIT
,
sys
.
executable
,
quote
(
sys
.
executable
),
'-c'
,
quote
(
cmd
),
'-mqNxd'
,
quote
(
tmpeggs
),
'zc.buildout'
,
'-c'
,
quote
(
cmd
),
'-mqNxd'
,
quote
(
tmpeggs
),
'zc.buildout'
+
VERSION
,
dict
(
os
.
environ
,
PYTHONPATH
=
ws
.
find
(
pkg_resources
.
Requirement
.
parse
(
'setuptools'
)).
location
...
...
@@ -71,7 +78,7 @@ else:
)
==
0
ws
.
add_entry
(
tmpeggs
)
ws
.
require
(
'zc.buildout'
)
ws
.
require
(
'zc.buildout'
+
VERSION
)
import
zc.buildout.buildout
zc
.
buildout
.
buildout
.
main
(
sys
.
argv
[
1
:]
+
[
'bootstrap'
]
)
zc
.
buildout
.
buildout
.
main
(
args
)
shutil
.
rmtree
(
tmpeggs
)
src/zc/buildout/bootstrap.txt
0 → 100644
View file @
b0466bb4
Make sure the bootstrap script actually works::
>>> import os, sys
>>> from os.path import dirname, join
>>> import zc.buildout
>>> bootstrap_py = join(
... dirname(
... dirname(
... dirname(
... dirname(zc.buildout.__file__)
... )
... )
... ),
... 'bootstrap', 'bootstrap.py')
>>> sample_buildout = tmpdir('sample')
>>> os.chdir(sample_buildout)
>>> write('buildout.cfg',
... '''
... [buildout]
... parts =
... ''')
>>> write('bootstrap.py', open(bootstrap_py).read())
>>> print 'X'; print system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py'); print 'X' # doctest: +ELLIPSIS
X...
Creating directory '/sample/bin'.
Creating directory '/sample/parts'.
Creating directory '/sample/eggs'.
Creating directory '/sample/develop-eggs'.
Generated script '/sample/bin/buildout'.
...
>>> ls(sample_buildout)
d bin
- bootstrap.py
- buildout.cfg
d develop-eggs
d eggs
d parts
>>> ls(sample_buildout, 'bin')
- buildout
>>> print 'X'; ls(sample_buildout, 'eggs') # doctest: +ELLIPSIS
X...
d zc.buildout-...egg
Now trying the `--version` option, that let you define a version for
`zc.buildout`. If not provided, bootstrap will look for the latest one.
Let's try with an unknown version::
>>> print 'X'; print system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py --version UNKNOWN'); print 'X' # doctest: +ELLIPSIS
...
X
No local packages or download links found for zc.buildout==UNKNOWN
error: Could not find suitable distribution for Requirement.parse('zc.buildout==UNKNOWN')
Traceback (most recent call last):
File "bootstrap.py", line 78, in <module>
) == 0
AssertionError
<BLANKLINE>
X
Now let's try with `1.1.1`, which happens to exist::
>>> print 'X'; print system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py --version 1.1.1'); print 'X'
...
X
Generated script '/sample/bin/buildout'.
<BLANKLINE>
X
Let's make sure the generated `buildout` script uses it::
>>> buildout_script = join(sample_buildout, 'bin', 'buildout')
>>> print open(buildout_script).read() # doctest: +ELLIPSIS
#...
<BLANKLINE>
import sys
sys.path[0:0] = [
'/sample/eggs/setuptools-...egg',
'/sample/eggs/zc.buildout-1.1.1...egg',
]
<BLANKLINE>
import zc.buildout.buildout
<BLANKLINE>
if __name__ == '__main__':
zc.buildout.buildout.main()
<BLANKLINE>
Let's try with `1.2.1`::
>>> print 'X'; print system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py --version 1.2.1'); print 'X' # doctest: +ELLIPSIS
...
X
Generated script '/sample/bin/buildout'.
<BLANKLINE>
X
Let's make sure the generated `buildout` script uses it::
>>> print open(buildout_script).read() # doctest: +ELLIPSIS
#...
<BLANKLINE>
import sys
sys.path[0:0] = [
'/sample/eggs/setuptools-...egg',
'/sample/eggs/zc.buildout-1.2.1...egg',
]
<BLANKLINE>
import zc.buildout.buildout
<BLANKLINE>
if __name__ == '__main__':
zc.buildout.buildout.main()
<BLANKLINE>
src/zc/buildout/tests.py
View file @
b0466bb4
...
...
@@ -565,57 +565,6 @@ def create_sections_on_command_line():
"""
bootstrap_py
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
zc
.
buildout
.
__file__
)
)
)
),
'bootstrap'
,
'bootstrap.py'
)
if
os
.
path
.
exists
(
bootstrap_py
):
def
test_bootstrap_py
():
"""Make sure the bootstrap script actually works
>>> sample_buildout = tmpdir('sample')
>>> os.chdir(sample_buildout)
>>> write('buildout.cfg',
... '''
... [buildout]
... parts =
... ''')
>>> write('bootstrap.py', open(bootstrap_py).read())
>>> print 'X'; print system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py'); print 'X' # doctest: +ELLIPSIS
X...
Creating directory '/sample/bin'.
Creating directory '/sample/parts'.
Creating directory '/sample/eggs'.
Creating directory '/sample/develop-eggs'.
Generated script '/sample/bin/buildout'.
...
>>> ls(sample_buildout)
d bin
- bootstrap.py
- buildout.cfg
d develop-eggs
d eggs
d parts
>>> ls(sample_buildout, 'bin')
- buildout
>>> print 'X'; ls(sample_buildout, 'eggs') # doctest: +ELLIPSIS
X...
d zc.buildout-1.0-py2.4.egg
"""
def
test_help
():
"""
>>> print system(os.path.join(sample_buildout, 'bin', 'buildout')+' -h'),
...
...
@@ -2782,7 +2731,7 @@ normalize_bang = (
)
def
test_suite
():
return
unittest
.
TestSuite
((
test_suite
=
[
doctest
.
DocFileSuite
(
'buildout.txt'
,
'runsetup.txt'
,
'repeatable.txt'
,
'setup.txt'
,
setUp
=
zc
.
buildout
.
testing
.
buildoutSetUp
,
...
...
@@ -2913,4 +2862,33 @@ def test_suite():
),
])
),
))
]
# adding bootstrap.txt doctest to the suite
# only if bootstrap.py is present
bootstrap_py = os.path.join(
os.path.dirname(
os.path.dirname(
os.path.dirname(
os.path.dirname(zc.buildout.__file__)
)
)
),
'bootstrap', 'bootstrap.py')
if os.path.exists(bootstrap_py):
test_suite.append(doctest.DocFileSuite(
'bootstrap.txt',
setUp=easy_install_SetUp,
tearDown=zc.buildout.testing.buildoutTearDown,
checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_script,
normalize_bang,
]),
))
return unittest.TestSuite(test_suite)
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