stage: check if dir exists before calling makedirs

Fixes #448

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2018-02-02 17:50:16 +02:00
parent 24f8c4ca9f
commit 39f1ba8c58
+4 -1
View File
@@ -284,6 +284,7 @@ class Output(Dependency):
md5 = file_md5(path)[0]
cache = self.project.cache.get(md5)
cache_info = os.path.join(self.cache, relpath)
cache_dir = os.path.dirname(cache_info)
if os.path.exists(cache):
self._remove(path, None)
@@ -291,7 +292,9 @@ class Output(Dependency):
else:
self.hardlink(path, cache)
os.makedirs(os.path.dirname(cache_info))
if not os.path.exists(cache_dir):
os.makedirs(cache_dir)
with open(cache_info, 'w') as fd:
yaml.safe_dump({self.PARAM_MD5: md5}, fd, default_flow_style=False)