diff --git a/scripts/post-render.py b/scripts/post-render.py index 05693edc..6e7cbd97 100755 --- a/scripts/post-render.py +++ b/scripts/post-render.py @@ -5,6 +5,16 @@ import shutil +def safe_mkdir(dirname): + logging.debug(f"Making directory {dirname}") + if not os.path.exists(dirname): + try: + os.mkdir(dirname) + except FileNotFoundError as e: + print(e) + raise + + def safe_copy(src, dst): logging.debug(f"Copy {dst} -> {src}") if not os.path.exists(src): @@ -38,4 +48,6 @@ def safe_copy(src, dst): for fn in files: src = os.path.join(qpd, fn) dst = os.path.join(SITE_DIR, fn) + dirname = os.path.dirname(dst) + safe_mkdir(dirname) safe_copy(src, dst)