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
b626aca1
Commit
b626aca1
authored
Sep 10, 2013
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for BUILDOUT_HOME as an alternate way to locate the default.cfg file
parent
ad9d58b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
3 deletions
+55
-3
CHANGES.rst
CHANGES.rst
+2
-1
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+6
-2
src/zc/buildout/buildout.txt
src/zc/buildout/buildout.txt
+47
-0
No files found.
CHANGES.rst
View file @
b626aca1
...
@@ -4,7 +4,8 @@ Change History
...
@@ -4,7 +4,8 @@ Change History
Unreleased
Unreleased
==========
==========
- TBD
- Add BUILDOUT_HOME as an alternate way to control how the user default
configuration is found.
2.2.1 (2013-09-05)
2.2.1 (2013-09-05)
==================
==================
...
...
src/zc/buildout/buildout.py
View file @
b626aca1
...
@@ -208,8 +208,12 @@ class Buildout(DictMixin):
...
@@ -208,8 +208,12 @@ class Buildout(DictMixin):
# load user defaults, which override defaults
# load user defaults, which override defaults
if
user_defaults
:
if
user_defaults
:
user_config
=
os
.
path
.
join
(
os
.
path
.
expanduser
(
'~'
),
if
os
.
environ
.
get
(
'BUILDOUT_HOME'
):
'.buildout'
,
'default.cfg'
)
buildout_home
=
os
.
environ
[
'BUILDOUT_HOME'
]
else
:
buildout_home
=
os
.
path
.
join
(
os
.
path
.
expanduser
(
'~'
),
'.buildout'
)
user_config
=
os
.
path
.
join
(
buildout_home
,
'default.cfg'
)
if
os
.
path
.
exists
(
user_config
):
if
os
.
path
.
exists
(
user_config
):
_update
(
data
,
_open
(
os
.
path
.
dirname
(
user_config
),
user_config
,
_update
(
data
,
_open
(
os
.
path
.
dirname
(
user_config
),
user_config
,
[],
data
[
'buildout'
].
copy
(),
override
,
[],
data
[
'buildout'
].
copy
(),
override
,
...
...
src/zc/buildout/buildout.txt
View file @
b626aca1
...
@@ -1725,7 +1725,54 @@ user defaults:
...
@@ -1725,7 +1725,54 @@ user defaults:
op5 b3base 5
op5 b3base 5
recipe recipes:debug
recipe recipes:debug
If the environment variable BUILDOUT_HOME is non-empty, that is used to
locate default.cfg instead of looking in ~/.buildout/. Let's set up a
configuration file in an alternate directory and verify that we get the
appropriate set of defaults:
>>> alterhome = tmpdir('alterhome')
>>> write(alterhome, 'default.cfg',
... """
... [debug]
... op1 = 1'
... op7 = 7'
... op8 = eight!
... """)
>>> os.environ['BUILDOUT_HOME'] = alterhome
>>> print_(system(buildout), end='')
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
name base
op buildout
op1 b1 1
op2 b2 2
op3 b2 3
op4 b3 4
op5 b3base 5
op7 7'
op8 eight!
recipe recipes:debug
The -U argument still suppresses reading of the default.cfg file from
BUILDOUT_HOME:
>>> print_(system(buildout + ' -U'), end='')
Develop: '/sample-buildout/recipes'
Uninstalling debug.
Installing debug.
name base
op buildout
op1 b1 1
op2 b2 2
op3 b2 3
op4 b3 4
op5 b3base 5
recipe recipes:debug
>>> os.environ['HOME'] = old_home
>>> os.environ['HOME'] = old_home
>>> del os.environ['BUILDOUT_HOME']
Log level
Log level
---------
---------
...
...
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