[Checkins] SVN: zc.buildout/trunk/ Feature Changes
Jim Fulton
jim at zope.com
Thu Dec 7 13:54:32 EST 2006
Log message for revision 71488:
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.
Changed:
U zc.buildout/trunk/CHANGES.txt
U zc.buildout/trunk/src/zc/buildout/buildout.py
U zc.buildout/trunk/src/zc/buildout/buildout.txt
U zc.buildout/trunk/src/zc/buildout/tests.py
-=-
Modified: zc.buildout/trunk/CHANGES.txt
===================================================================
--- zc.buildout/trunk/CHANGES.txt 2006-12-07 18:46:06 UTC (rev 71487)
+++ zc.buildout/trunk/CHANGES.txt 2006-12-07 18:54:31 UTC (rev 71488)
@@ -23,6 +23,15 @@
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
----------
Modified: zc.buildout/trunk/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/buildout.py 2006-12-07 18:46:06 UTC (rev 71487)
+++ zc.buildout/trunk/src/zc/buildout/buildout.py 2006-12-07 18:54:31 UTC (rev 71488)
@@ -56,7 +56,8 @@
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 @@
})
# 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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))
Modified: zc.buildout/trunk/src/zc/buildout/buildout.txt
===================================================================
--- zc.buildout/trunk/src/zc/buildout/buildout.txt 2006-12-07 18:46:06 UTC (rev 71487)
+++ zc.buildout/trunk/src/zc/buildout/buildout.txt 2006-12-07 18:54:31 UTC (rev 71488)
@@ -773,6 +773,22 @@
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 @@
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 @@
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 @@
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
----------
Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py 2006-12-07 18:46:06 UTC (rev 71487)
+++ zc.buildout/trunk/src/zc/buildout/tests.py 2006-12-07 18:54:31 UTC (rev 71488)
@@ -399,6 +399,10 @@
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
configuration file. For example, to run the buildout in offline mode,
@@ -446,6 +450,10 @@
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
configuration file. For example, to run the buildout in offline mode,
More information about the Checkins
mailing list