diff --git a/mockdata b/mockdata index 17e9ff9..c791236 160000 --- a/mockdata +++ b/mockdata @@ -1 +1 @@ -Subproject commit 17e9ff951ea125dea0c9e65a5695d707749fdc84 +Subproject commit c7912366b946edc8a7e51bbde6b41ae4a248c995 diff --git a/radarpipeline/project/validations.py b/radarpipeline/project/validations.py index 06f6a29..68b130b 100644 --- a/radarpipeline/project/validations.py +++ b/radarpipeline/project/validations.py @@ -36,19 +36,23 @@ def _update_mock_data(self) -> None: Updates the mock data submodule of the åproject """ - repo = Repo( - os.path.dirname(os.path.abspath(__file__)), - search_parent_directories=True, - ) - sms = repo.submodules try: - mock_data_submodule = sms["mockdata"] + MOCK_URL = "https://github.com/RADAR-base-Analytics/mockdata" + cache_dir = os.path.join( + os.path.expanduser("~"), ".cache", "radarpipeline", "mockdata") + if not os.path.exists(cache_dir): + logger.info("Mock data submodule not found. Cloning it...") + Repo.clone_from(MOCK_URL, cache_dir) + logger.info("Mock data input cloned") + else: + repo = Repo( + cache_dir, + search_parent_directories=True, + ) + repo.remotes.origin.pull() + except IndexError: - raise ValueError("mockdata submodule not found in the repository") - if not (mock_data_submodule.exists() and mock_data_submodule.module_exists()): - logger.info("Mock data submodule not found. Cloning it...") - repo.git.submodule("update", "--init", "--recursive") - logger.info("Mock data input cloned") + raise ValueError("mockdata submodule not found") def _validate_input(self) -> None: """