summaryrefslogtreecommitdiff
path: root/morphlib/app.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-06-11 17:17:36 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-06-11 17:17:36 +0100
commit74a9d060933ba75efd503117396ed6a38b67f8a4 (patch)
treec48e75d82629e4e570a452960d7e07a2f9bfb7ad /morphlib/app.py
parent8920f60cdd0f6436bd0a87928f284cacf702edaa (diff)
downloadmorph-74a9d060933ba75efd503117396ed6a38b67f8a4.tar.gz
Refactor
Diffstat (limited to 'morphlib/app.py')
-rwxr-xr-xmorphlib/app.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 20934dd7..a6ccd7cc 100755
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -170,6 +170,19 @@ class Morph(cliapp.Application):
visit=add_to_pool)
return pool
+ def create_cachedir(self):
+ cachedir = self.settings['cachedir']
+ if not os.path.exists(cachedir):
+ os.mkdir(cachedir)
+ return cachedir
+
+ def create_artifact_cachedir(self):
+ artifact_cachedir = os.path.join(
+ self.settings['cachedir'], 'artifacts')
+ if not os.path.exists(artifact_cachedir):
+ os.mkdir(artifact_cachedir)
+ return artifact_cachedir
+
def cmd_build(self, args):
'''Build a binary from a morphology.
@@ -183,17 +196,10 @@ class Morph(cliapp.Application):
'''
- logging.debug('cmd_build starting')
self.msg('Build starts')
- cachedir = self.settings['cachedir']
- if not os.path.exists(cachedir):
- os.mkdir(cachedir)
-
- artifact_cachedir = os.path.join(
- self.settings['cachedir'], 'artifacts')
- if not os.path.exists(artifact_cachedir):
- os.mkdir(artifact_cachedir)
+ cachedir = self.create_cachedir()
+ artifact_cachedir = self.create_artifact_cachedir()
build_env = morphlib.buildenvironment.BuildEnvironment(self.settings)
ckc = morphlib.cachekeycomputer.CacheKeyComputer(build_env)