From 98f7ab9a93b35fe7c6797a7f2f6842b06a735773 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Tue, 1 Dec 2020 13:36:42 +0100 Subject: [PATCH] helper: Make sure directories are created before they are passed to container engine (podman) --- infra/helper.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/infra/helper.py b/infra/helper.py index d91239df712a..52e48cd23b0e 100755 --- a/infra/helper.py +++ b/infra/helper.py @@ -277,18 +277,27 @@ def get_dockerfile_path(project_name): def _get_corpus_dir(project_name=''): - """Returns path to /corpus directory for the given project (if specified).""" - return os.path.join(BUILD_DIR, 'corpus', project_name) + """Creates and returns path to /corpus directory for the given project (if specified).""" + directory = os.path.join(BUILD_DIR, 'corpus', project_name) + os.makedirs(directory, exist_ok=True) + + return directory def _get_output_dir(project_name=''): - """Returns path to /out directory for the given project (if specified).""" - return os.path.join(BUILD_DIR, 'out', project_name) + """Creates and returns path to /out directory for the given project (if specified).""" + directory = os.path.join(BUILD_DIR, 'out', project_name) + os.makedirs(directory, exist_ok=True) + + return directory def _get_work_dir(project_name=''): - """Returns path to /work directory for the given project (if specified).""" - return os.path.join(BUILD_DIR, 'work', project_name) + """Creates and returns path to /work directory for the given project (if specified).""" + directory = os.path.join(BUILD_DIR, 'work', project_name) + os.makedirs(directory, exist_ok=True) + + return directory def _get_project_language(project_name):