From b25e320a62cefca1bf45091788506f4d8bd65597 Mon Sep 17 00:00:00 2001 From: Matthias Mayer <matthias.mayer@tum.de> Date: Mon, 13 Feb 2023 09:06:15 +0100 Subject: [PATCH 1/3] Make cache dirs, etc --- src/timor/utilities/file_locations.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/timor/utilities/file_locations.py b/src/timor/utilities/file_locations.py index 679906f2..fccbb391 100644 --- a/src/timor/utilities/file_locations.py +++ b/src/timor/utilities/file_locations.py @@ -23,17 +23,21 @@ test_data = Path(log_conf.get('test_data', head.parent.joinpath('tests/data'))) default_robot_dir = head.joinpath('timor_sample_robots') cache_robot_dir = cache_dir.joinpath("robots") if not cache_robot_dir.exists(): - cache_robot_dir.mkdir() + cache_robot_dir.mkdir(parents=True) # Get schemas schema_dir = Path(log_conf.get('schema_dir', cache_dir.joinpath("schemata"))) if not schema_dir.exists(): - schema_dir.mkdir() + schema_dir.mkdir(parents=True) schemata = download_schemata(schema_dir) # Find local robots if 'robots' in log_conf: robots = dict() + for r_dir in json.loads(log_conf['robots']): + if not Path(r_dir).exists(): + raise ValueError(f"Configured robot directory {r_dir} does not exits.") + for __r in chain.from_iterable(Path(d).iterdir() for d in json.loads(log_conf['robots'])): if __r.name in robots: logging.warning(f"Robot {__r.name} already loaded from different location. Ignoring {__r}!") -- GitLab From 067ff84050aabca6f4ae7c3cb2b27683ea79680d Mon Sep 17 00:00:00 2001 From: Matthias Mayer <matthias.mayer@tum.de> Date: Mon, 13 Feb 2023 11:25:06 +0100 Subject: [PATCH 2/3] Typo --- src/timor/utilities/file_locations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/timor/utilities/file_locations.py b/src/timor/utilities/file_locations.py index fccbb391..bd950071 100644 --- a/src/timor/utilities/file_locations.py +++ b/src/timor/utilities/file_locations.py @@ -36,7 +36,7 @@ if 'robots' in log_conf: robots = dict() for r_dir in json.loads(log_conf['robots']): if not Path(r_dir).exists(): - raise ValueError(f"Configured robot directory {r_dir} does not exits.") + raise ValueError(f"Configured robot directory {r_dir} does not exist.") for __r in chain.from_iterable(Path(d).iterdir() for d in json.loads(log_conf['robots'])): if __r.name in robots: -- GitLab From 9c2cd3ca05a44702d58dfdde6ac52db2b1c12336 Mon Sep 17 00:00:00 2001 From: Matthias Mayer <matthias.mayer@tum.de> Date: Mon, 13 Feb 2023 15:04:01 +0100 Subject: [PATCH 3/3] Remove parents for robot cache dir --- src/timor/utilities/file_locations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/timor/utilities/file_locations.py b/src/timor/utilities/file_locations.py index bd950071..a105fc7a 100644 --- a/src/timor/utilities/file_locations.py +++ b/src/timor/utilities/file_locations.py @@ -23,7 +23,7 @@ test_data = Path(log_conf.get('test_data', head.parent.joinpath('tests/data'))) default_robot_dir = head.joinpath('timor_sample_robots') cache_robot_dir = cache_dir.joinpath("robots") if not cache_robot_dir.exists(): - cache_robot_dir.mkdir(parents=True) + cache_robot_dir.mkdir() # Get schemas schema_dir = Path(log_conf.get('schema_dir', cache_dir.joinpath("schemata"))) -- GitLab