33import shutil
44import subprocess
55import tempfile
6+ from ted_sws import config
67
7- GITHUB_TED_SWS_ARTEFACTS_REPOSITORY_NAME = "ted-rdf-mapping"
8- GITHUB_TED_SWS_ARTEFACTS_MAPPINGS_PATH = f"{ GITHUB_TED_SWS_ARTEFACTS_REPOSITORY_NAME } /mappings"
8+ MAPPINGS_DIR_NAME = "mappings"
99
1010
1111class MappingSuitePackageDownloaderABC (abc .ABC ):
@@ -26,6 +26,7 @@ class GitHubMappingSuitePackageDownloader(MappingSuitePackageDownloaderABC):
2626 """
2727 This class downloads mapping_suite_package from GitHub.
2828 """
29+
2930 def __init__ (self , github_repository_url : str , branch_or_tag_name : str ):
3031 """
3132 Option can be branch or tag, not both
@@ -34,6 +35,7 @@ def __init__(self, github_repository_url: str, branch_or_tag_name: str):
3435 """
3536 self .github_repository_url = github_repository_url
3637 self .branch_or_tag_name = branch_or_tag_name
38+ self .repository_name = config .GITHUB_TED_SWS_ARTEFACTS_REPOSITORY_NAME
3739
3840 def download (self , output_mapping_suite_package_path : pathlib .Path ) -> str :
3941 """
@@ -62,7 +64,7 @@ def get_git_head_hash(git_repository_path: pathlib.Path) -> str:
6264 stdout = subprocess .DEVNULL ,
6365 stderr = subprocess .STDOUT )
6466 git_last_commit_hash = get_git_head_hash (
65- git_repository_path = temp_dir_path / GITHUB_TED_SWS_ARTEFACTS_REPOSITORY_NAME )
66- downloaded_tmp_mapping_suite_path = temp_dir_path / GITHUB_TED_SWS_ARTEFACTS_MAPPINGS_PATH
67+ git_repository_path = temp_dir_path / self . repository_name )
68+ downloaded_tmp_mapping_suite_path = temp_dir_path / self . repository_name / MAPPINGS_DIR_NAME
6769 shutil .copytree (downloaded_tmp_mapping_suite_path , output_mapping_suite_package_path , dirs_exist_ok = True )
6870 return git_last_commit_hash
0 commit comments