diff options
author | Bob Mottram <bob.mottram@codethink.co.uk> | 2015-03-25 14:40:32 +0000 |
---|---|---|
committer | Baserock Gerrit <gerrit@baserock.org> | 2015-04-14 08:48:10 +0000 |
commit | 6fa273953645808be9fc81f52eb9093d8d76f15d (patch) | |
tree | 91865569431e6adb8d4c3f6b9957fbc0ac2840c5 /morphlib/app.py | |
parent | f0a31086d816d0a90fdcfaaa4ea58e122a6d99b3 (diff) | |
download | morph-6fa273953645808be9fc81f52eb9093d8d76f15d.tar.gz |
More robust parsing of plugin paths
Previously it was possible to have some strange values for
pluginmgr.locations if the same path was appeared twice
Change-Id: I3ec257e48e85c3fd30759c3dcc2064f0b151ec45
Diffstat (limited to 'morphlib/app.py')
-rw-r--r-- | morphlib/app.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/morphlib/app.py b/morphlib/app.py index 42a346a1..1017ce9a 100644 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -60,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') @@ -282,11 +282,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()) @@ -321,7 +323,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. |