diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-01-28 15:18:31 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2013-02-06 11:08:19 +0000 |
commit | 5c114ea31f38fc6505f4217c06a35520c677acbb (patch) | |
tree | cca65238ad0c7702591b5449c2551bc3762f6c1c /morphlib | |
parent | ee01dea68ecd0822785ef574f7c2ddcb44d0cafa (diff) | |
download | morph-5c114ea31f38fc6505f4217c06a35520c677acbb.tar.gz |
Tidy up create_cachedir()
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/buildcommand.py | 11 | ||||
-rw-r--r-- | morphlib/util.py | 23 |
2 files changed, 15 insertions, 19 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index df9cc690..907676fa 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -62,17 +62,16 @@ class BuildCommand(object): return morphlib.cachekeycomputer.CacheKeyComputer(build_env) def new_artifact_caches(self): - return morphlib.util.new_artifact_caches(self.app.settings) + '''Create interfaces for the build artifact caches. - def create_artifact_cachedir(self): - return morphlib.util.create_artifact_cachedir(self.app.settings) + This includes creating the directories on disk if they are missing. + + ''' + return morphlib.util.new_artifact_caches(self.app.settings) def new_repo_caches(self): return morphlib.util.new_repo_caches(self.app) - def create_cachedir(self): - return morphlib.util.create_cachedir(self.app.settings) - def compute_build_order(self, repo_name, ref, filename): '''Compute build order for a triplet.''' self.app.status(msg='Figuring out the right build order') diff --git a/morphlib/util.py b/morphlib/util.py index e171714a..c832a141 100644 --- a/morphlib/util.py +++ b/morphlib/util.py @@ -76,7 +76,7 @@ def make_concurrency(cores=None): def create_cachedir(settings): # pragma: no cover - '''Create a new cache directory.''' + '''Return cache directory, creating it if necessary.''' cachedir = settings['cachedir'] if not os.path.exists(cachedir): @@ -84,21 +84,17 @@ def create_cachedir(settings): # pragma: no cover return cachedir -def create_artifact_cachedir(settings): # pragma: no cover - '''Create a new directory for the local artifact cache.''' - - artifact_cachedir = os.path.join( - settings['cachedir'], 'artifacts') - if not os.path.exists(artifact_cachedir): - os.mkdir(artifact_cachedir) - return artifact_cachedir +def new_artifact_caches(settings): # pragma: no cover + '''Create new objects for local and remote artifact caches. + This includes creating the directories on disk, if missing. -def new_artifact_caches(settings): # pragma: no cover - '''Create new objects for local, remote artifact caches.''' + ''' - create_cachedir(settings) - artifact_cachedir = create_artifact_cachedir(settings) + cachedir = create_cachedir(settings) + artifact_cachedir = os.path.join(cachedir, 'artifacts') + if not os.path.exists(artifact_cachedir): + os.mkdir(artifact_cachedir) lac = morphlib.localartifactcache.LocalArtifactCache(artifact_cachedir) @@ -109,6 +105,7 @@ def new_artifact_caches(settings): # pragma: no cover rac = None return lac, rac + def combine_aliases(app): # pragma: no cover '''Create a full repo-alias set from the app's settings.''' trove_host = app.settings['trove-host'] |