diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2013-06-05 12:05:24 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2013-06-05 12:19:24 +0000 |
commit | 4fbce4c4119241f5bb7bcb8e39588262605bc619 (patch) | |
tree | 4d8537d321c870842337a1c84957095619f84d38 /morphlib/app.py | |
parent | e11b2f46217acf49b43d9d10817298cb6fdd90e0 (diff) | |
download | morph-4fbce4c4119241f5bb7bcb8e39588262605bc619.tar.gz |
Create cachedir and tempdir if they do not exist
This has been a thorn in my side for many a deployment.
A nascent cache directory will cause the size checks to fail.
We could get complicated and try the parent directories, or create
the directories in the size check, but the former is not worth the
complication and the latter is the wrong place to put it, so do it
during process_args, so the directories exist before subcommands
are run, so they don't have to bother with it themselves.
Diffstat (limited to 'morphlib/app.py')
-rw-r--r-- | morphlib/app.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/morphlib/app.py b/morphlib/app.py index 267dab1b..0d8b1047 100644 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -190,6 +190,12 @@ class Morph(cliapp.Application): if 'MORPH_DUMP_PROCESSED_CONFIG' in os.environ: self.settings.dump_config(sys.stdout) sys.exit(0) + + for dirconfig in ("cachedir", "tempdir"): + path = self.settings[dirconfig] + if not os.path.exists(path): + os.makedirs(path) + cliapp.Application.process_args(self, args) def setup_plugin_manager(self): |