Commit ac702c5f authored by Jim Fulton's avatar Jim Fulton

Feature Changes

---------------

- A new command-line argument, -U, suppresses reading user defaults.

- You can now suppress use of an installed-part database
  (e.g. .installed.cfg) by sprifying an empty value for the buildout
  installed option.
parent 12f261a8
......@@ -23,6 +23,15 @@ Change History
1.0.0b15 (2006-12-07)
=====================
Feature Changes
---------------
- A new command-line argument, -U, suppresses reading user defaults.
- You can now suppress use of an installed-part database
(e.g. .installed.cfg) by sprifying an empty value for the buildout
installed option.
Bugs Fixed
----------
......
......@@ -56,7 +56,8 @@ class MissingSection(zc.buildout.UserError, KeyError):
class Buildout(UserDict.DictMixin):
def __init__(self, config_file, cloptions, windows_restart=False):
def __init__(self, config_file, cloptions,
user_defaults=True, windows_restart=False):
config_file = os.path.abspath(config_file)
self._config_file = config_file
self.__windows_restart = windows_restart
......@@ -79,7 +80,7 @@ class Buildout(UserDict.DictMixin):
})
# load user defaults, which override defaults
if 'HOME' in os.environ:
if user_defaults and 'HOME' in os.environ:
user_config = os.path.join(os.environ['HOME'],
'.buildout', 'default.cfg')
if os.path.exists(user_config):
......@@ -112,8 +113,9 @@ class Buildout(UserDict.DictMixin):
d = self._buildout_path(options[name+'-directory'])
options[name+'-directory'] = d
options['installed'] = os.path.join(options['directory'],
options['installed'])
if options['installed']:
options['installed'] = os.path.join(options['directory'],
options['installed'])
self._setup_logging()
......@@ -394,8 +396,8 @@ class Buildout(UserDict.DictMixin):
options['__buildout_signature__'] = ' '.join(sig)
def _read_installed_part_options(self):
old = self._installed_path()
if os.path.isfile(old):
old = self['buildout']['installed']
if old and os.path.isfile(old):
parser = ConfigParser.RawConfigParser()
parser.optionxform = lambda s: s
parser.read(old)
......@@ -413,9 +415,6 @@ class Buildout(UserDict.DictMixin):
else:
return {'buildout': Options(self, 'buildout', {'parts': ''})}
def _installed_path(self):
return self._buildout_path(self['buildout']['installed'])
def _uninstall(self, installed):
for f in installed.split('\n'):
if not f:
......@@ -443,7 +442,10 @@ class Buildout(UserDict.DictMixin):
def _save_installed_options(self, installed_options):
f = open(self._installed_path(), 'w')
installed = self['buildout']['installed']
if not installed:
return
f = open(installed, 'w')
_save_options('buildout', installed_options['buildout'], f)
for part in installed_options['buildout']['parts'].split():
print >>f
......@@ -919,6 +921,10 @@ Options:
This defaults to the file named "buildout.cfg" in the current
working directory.
-U
Don't read user defaults.
Assignments are of the form: section:option=value and are used to
provide configuration options that override those given in the
configuration file. For example, to run the buildout in offline mode,
......@@ -953,17 +959,20 @@ def main(args=None):
verbosity = 0
options = []
windows_restart = False
user_defaults = True
while args:
if args[0][0] == '-':
op = orig_op = args.pop(0)
op = op[1:]
while op and op[0] in 'vqhW':
while op and op[0] in 'vqhWU':
if op[0] == 'v':
verbosity += 10
elif op[0] == 'q':
verbosity -= 10
elif op[0] == 'W':
windows_restart = True
elif op[0] == 'U':
user_defaults = False
else:
_help()
op = op[1:]
......@@ -1004,7 +1013,8 @@ def main(args=None):
try:
try:
buildout = Buildout(config_file, options, windows_restart)
buildout = Buildout(config_file, options,
user_defaults, windows_restart)
getattr(buildout, command)(args)
except zc.buildout.UserError, v:
_error(str(v))
......
......@@ -773,6 +773,22 @@ delimiter.)
op7 7
recipe recipes:debug
A buildout command-line argument, -U, can be used to suppress reading
user defaults:
>>> print system(buildout + ' -U'),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling debug
buildout: Installing debug
name base
op buildout
op1 b1 1
op2 b2 2
op3 b2 3
op4 b3 4
op5 b3base 5
recipe recipes:debug
>>> del os.environ['HOME']
Log level
......@@ -1051,7 +1067,7 @@ Command-line usage
A number of arguments can be given on the buildout command line. The
command usage is::
buildout [-h] [-c file] [-q] [-v] [assignments] [command [command arguments]]
buildout [-h] [-c file] [-q] [-v] [-U] [assignments] [command [command arguments]]
The -h (or --help) option causes basic usage information to be
printed. If this option is used, then all other options are ignored.
......@@ -1064,6 +1080,8 @@ verbosity is used to adjust the logging level. The verbosity is
subtracted from the numeric value of the log-level option specified in
the configuration file.
The -U option suppresses reading user defaults.
Assignments are of the form::
section_name:option_name=value
......@@ -1593,6 +1611,48 @@ connected to the internet. It also makes buildouts run much
faster. This option is typically given as a command-line option
``buildout:offline=true``.
Controlling the installation database
-------------------------------------
The buildout installed uption is used to specify the file used to save
information on installed parts. This option is initialized to
".installed.cfg", but it can be overridded in the configuration file
or on the command line:
>>> os.remove('.installed.cfg')
>>> print system(buildout+' buildout:installed=inst.cfg'),
>>> ls(sample_buildout)
- b1.cfg
- b2.cfg
- base.cfg
d bin
- buildout.cfg
d develop-eggs
d eggs
- inst.cfg
d parts
d recipes
The installation database can be disabled by supplying an empty
buildout installed opttion:
>>> os.remove('inst.cfg')
>>> print system(buildout+' buildout:installed='),
>>> ls(sample_buildout)
- b1.cfg
- b2.cfg
- base.cfg
d bin
- buildout.cfg
d develop-eggs
d eggs
d parts
d recipes
Extensions
----------
......
......@@ -398,6 +398,10 @@ Options:
Specify the path to the buildout configuration file to be used.
This defaults to the file named "buildout.cfg" in the current
working directory.
<BLANKLINE>
-U
<BLANKLINE>
Don't read user defaults.
<BLANKLINE>
Assignments are of the form: section:option=value and are used to
provide configuration options that override those given in the
......@@ -445,6 +449,10 @@ Options:
Specify the path to the buildout configuration file to be used.
This defaults to the file named "buildout.cfg" in the current
working directory.
<BLANKLINE>
-U
<BLANKLINE>
Don't read user defaults.
<BLANKLINE>
Assignments are of the form: section:option=value and are used to
provide configuration options that override those given in the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment