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
93f94401
Commit
93f94401
authored
Jan 25, 2013
by
Reinout van Rees
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Got printing of picked versions to file working.
An 'update-versions-file' option points at a file you want updated.
parent
19165bc0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
12 deletions
+82
-12
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+16
-12
src/zc/buildout/repeatable.txt
src/zc/buildout/repeatable.txt
+66
-0
No files found.
src/zc/buildout/buildout.py
View file @
93f94401
...
...
@@ -29,6 +29,7 @@ except ImportError:
import
zc.buildout.configparser
import
copy
import
datetime
import
distutils.errors
import
glob
import
itertools
...
...
@@ -138,6 +139,7 @@ _buildout_default_options = _annotate_section({
'python'
:
'buildout'
,
'show-picked-versions'
:
'false'
,
'socket-timeout'
:
''
,
'update-versions-file'
:
''
,
'use-dependency-links'
:
'true'
,
},
'DEFAULT_VALUE'
)
...
...
@@ -336,6 +338,7 @@ class Buildout(DictMixin):
bool_option
(
options
,
'allow-picked-versions'
))
self
.
show_picked_versions
=
bool_option
(
options
,
'show-picked-versions'
)
self
.
update_versions_file
=
options
[
'update-versions-file'
]
zc
.
buildout
.
easy_install
.
show_picked_versions
(
self
.
show_picked_versions
)
...
...
@@ -1022,18 +1025,19 @@ class Buildout(DictMixin):
print_
(
"Versions had to be automatically picked."
)
print_
(
"The following part definition lists the versions picked:"
)
print_
(
'
\
n
'
.
join
(
output
))
# REINOUT Print to file
# if file_name:
# if os.path.exists(file_name):
# output[:1] = [
# '',
# '# Added by Buildout Versions at %s' % datetime.now(),
# ]
# output.append('')
# f = open(file_name,'a')
# f.write('\n'.join(output))
# f.close()
# print("This information has been written to %r" % file_name)
if
self
.
update_versions_file
:
# Also write to the versions file.
if
os
.
path
.
exists
(
self
.
update_versions_file
):
output
[:
1
]
=
[
''
,
'# Added by buildout at %s'
%
datetime
.
datetime
.
now
(),
]
output
.
append
(
''
)
f
=
open
(
self
.
update_versions_file
,
'a'
)
f
.
write
(
'
\
n
'
.
join
(
output
))
f
.
close
()
print_
(
"This information has been written to "
+
self
.
update_versions_file
)
def
setup
(
self
,
args
):
if
not
args
:
...
...
src/zc/buildout/repeatable.txt
View file @
93f94401
...
...
@@ -304,6 +304,72 @@ and case differences won't impact the pinning:
Updating foo.
recipe v2
Sometimes it is handy to have a separate file with versions. This is a regular
buildout file with a single ``[versions]`` section. You include it by
extending from that versions file:
>>> write('my_versions.cfg',
... '''
... [versions]
... distribute = 0.6.34
... spam = 2
... ''')
>>> write('buildout.cfg',
... '''
... [buildout]
... parts = foo
... extends = my_versions.cfg
... find-links = %s
... show-picked-versions = true
...
... [foo]
... recipe = spam
... ''' % join('recipe', 'dist'))
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Updating foo.
recipe v2
If not everything is pinned and buildout has to pick versions, you can tell
buildout to append the versions to your versions file. It simply appends them
at the end.
>>> write('my_versions.cfg',
... '''
... [versions]
... distribute = 0.6.34
... ''')
>>> write('buildout.cfg',
... '''
... [buildout]
... parts = foo
... extends = my_versions.cfg
... update-versions-file = my_versions.cfg
... find-links = %s
... show-picked-versions = true
...
... [foo]
... recipe = spam
... ''' % join('recipe', 'dist'))
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Updating foo.
recipe v2
Versions had to be automatically picked.
The following part definition lists the versions picked:
[versions]
spam = 2
This information has been written to my_versions.cfg
The versions file now contains the extra pin:
>>> 'spam = 2' in open('my_versions.cfg').read()
True
And re-running buildout doesn't report any picked versions anymore:
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Updating foo.
recipe v2
Controlling the python version
-------------------------------
...
...
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