Skip to content

Commit ba99196

Browse files
create config for github repository name
1 parent 1289e20 commit ba99196

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

ted_sws/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ class GitHubArtefacts:
145145
def GITHUB_TED_SWS_ARTEFACTS_URL(self, config_value: str) -> str:
146146
return config_value
147147

148+
@env_property(config_resolver_class=AirflowAndEnvConfigResolver, default_value="ted-rdf-mapping")
149+
def GITHUB_TED_SWS_ARTEFACTS_REPOSITORY_NAME(self, config_value: str) -> str:
150+
return config_value
151+
148152

149153
class API:
150154
@env_property(default_value="localhost")

ted_sws/mapping_suite_processor/adapters/github_package_downloader.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import shutil
44
import subprocess
55
import 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

1111
class 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

Comments
 (0)