Skip to content

Commit

Permalink
Merge pull request #71 from RADAR-base/minor_bugs_2
Browse files Browse the repository at this point in the history
Minor changes in updated mock data
  • Loading branch information
afolarin authored Jul 19, 2023
2 parents 9b131c0 + 0069a24 commit f70f931
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion mockdata
Submodule mockdata updated 2 files
+0 −0 __init__.py
+0 −20 setup.py
26 changes: 15 additions & 11 deletions radarpipeline/project/validations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down

0 comments on commit f70f931

Please sign in to comment.