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/util.py | |
parent | ee01dea68ecd0822785ef574f7c2ddcb44d0cafa (diff) | |
download | morph-5c114ea31f38fc6505f4217c06a35520c677acbb.tar.gz |
Tidy up create_cachedir()
Diffstat (limited to 'morphlib/util.py')
-rw-r--r-- | morphlib/util.py | 23 |
1 files changed, 10 insertions, 13 deletions
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'] |