diff options
author | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2015-01-23 10:53:10 +0000 |
---|---|---|
committer | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2015-01-23 10:54:17 +0000 |
commit | 09e5755c88305da7ef5fcd163320ddb9be7ca2f0 (patch) | |
tree | 1bf9199001490fadf4a2ebf356518726eee55c09 | |
parent | c6606b8b078957dd7d6d5d74b5e83f40561baf39 (diff) | |
download | morph-09e5755c88305da7ef5fcd163320ddb9be7ca2f0.tar.gz |
Treat path given to build cmd as relative to cwd
Currently the build commands treat the system argument
as a path relative to the root repo.
This means that regardless of your working directory you must run
morph build systems/foo-system.morph
This behaviour can be confusing, for example when your working
directory is $systembranch/definitions/systems you might expect
to be able to run
morph build foo-system.morph
especially since most shells would tab-complete the filename for you.
At the moment running the above command from $systembranch/definitions/systems
would result in an error, because morph would look for
$systembranch/definitions/foo-system.morph rather than
$systembranch/definitions/systems/foo-system.morph
This behaviour also means you can't give the morph build commands
an absolute path to a system morph.
This patch changes the treatment of the system arg so that it is interpreted
relative to the current working directory.
-rw-r--r-- | morphlib/plugins/build_plugin.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/morphlib/plugins/build_plugin.py b/morphlib/plugins/build_plugin.py index c5adffb7..e9290b8d 100644 --- a/morphlib/plugins/build_plugin.py +++ b/morphlib/plugins/build_plugin.py @@ -17,6 +17,7 @@ import cliapp import contextlib import uuid +import logging import morphlib @@ -160,11 +161,14 @@ class BuildPlugin(cliapp.Plugin): self.app.settings['cachedir'], self.app.settings['cachedir-min-space']) - system_filename = morphlib.util.sanitise_morphology_path(args[0]) - ws = morphlib.workspace.open('.') sb = morphlib.sysbranchdir.open_from_within('.') + system_filename = morphlib.util.sanitise_morphology_path(args[0]) + system_filename = sb.relative_to_root_repo(system_filename) + + logging.debug('System branch is %s' % sb.root_directory) + if self.use_distbuild: addr = self.app.settings['controller-initiator-address'] port = self.app.settings['controller-initiator-port'] |