From 09e5755c88305da7ef5fcd163320ddb9be7ca2f0 Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Fri, 23 Jan 2015 10:53:10 +0000 Subject: 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. --- morphlib/plugins/build_plugin.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'morphlib/plugins/build_plugin.py') 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'] -- cgit v1.2.1