From 5c114ea31f38fc6505f4217c06a35520c677acbb Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Mon, 28 Jan 2013 15:18:31 +0000 Subject: Tidy up create_cachedir() --- morphlib/util.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'morphlib/util.py') 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'] -- cgit v1.2.1