diff options
Diffstat (limited to 'morphlib/app.py')
-rw-r--r-- | morphlib/app.py | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/morphlib/app.py b/morphlib/app.py index c367cafb..f5823dd3 100644 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -20,6 +20,7 @@ import pipes import sys import time import urlparse +import warnings import extensions import morphlib @@ -59,7 +60,7 @@ class Morph(cliapp.Application): 'show no output unless there is an error') self.settings.boolean(['help', 'h'], - 'show this help message and exit') + 'show this help message and exit') self.settings.boolean(['help-all'], 'show help message including hidden subcommands') @@ -154,6 +155,10 @@ class Morph(cliapp.Application): 'always push temporary build branches to the ' 'remote repository', group=group_build) + self.settings.boolean(['partial'], + 'only build up to a given chunk', + default=False, + group=group_build) self.settings.choice (['local-changes'], ['include', 'ignore'], 'the `build` and `deploy` commands detect ' @@ -229,6 +234,12 @@ class Morph(cliapp.Application): with morphlib.util.hide_password_environment_variables(os.environ): cliapp.Application.log_config(self) + def pretty_warnings(message, category, filename, lineno, + file=None, line=None): + return 'WARNING: %s' % (message) + + warnings.formatwarning = pretty_warnings + def process_args(self, args): self.check_time() @@ -278,8 +289,7 @@ class Morph(cliapp.Application): sys.exit(0) tmpdir = self.settings['tempdir'] - for required_dir in (os.path.join(tmpdir, 'chunks'), - os.path.join(tmpdir, 'staging'), + for required_dir in (os.path.join(tmpdir, 'staging'), os.path.join(tmpdir, 'failed'), os.path.join(tmpdir, 'deployments'), self.settings['cachedir']): @@ -291,11 +301,13 @@ class Morph(cliapp.Application): def setup_plugin_manager(self): cliapp.Application.setup_plugin_manager(self) - self.pluginmgr.locations += os.path.join( - os.path.dirname(morphlib.__file__), 'plugins') + s = os.path.join(os.path.dirname(morphlib.__file__), 'plugins') + if not s in self.pluginmgr.locations: + self.pluginmgr.locations.append(s) - s = os.environ.get('MORPH_PLUGIN_PATH', '') - self.pluginmgr.locations += s.split(':') + s = os.environ.get('MORPH_PLUGIN_PATH', '').split(':') + for path in s: + self.pluginmgr.locations.append(path) self.hookmgr = cliapp.HookManager() self.hookmgr.new('new-build-command', cliapp.FilterHook()) @@ -330,7 +342,7 @@ class Morph(cliapp.Application): * ``error`` should be true when it is an error message All other keywords are ignored unless embedded in ``msg``. - + The ``self.status_prefix`` string is prepended to the output. It is set to the empty string by default. @@ -385,7 +397,7 @@ class Morph(cliapp.Application): self._write_status(self._commandline_as_message(argv, args)) # Log the environment. - prev = getattr(self, 'prev_env', {}) + prev = getattr(self, 'prev_env', os.environ) morphlib.util.log_environment_changes(self, kwargs['env'], prev) self.prev_env = kwargs['env'] |