Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
agahkarakuzu committed Dec 19, 2024
1 parent 321739e commit ae29606
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions myst_libre/tools/build_source_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,19 @@ def git_checkout_commit(self):
def get_project_name(self):
"""
Get the project name from the data requirement file.
If the file doesn't exist, use the repository name.
Returns:
str: Project name.
str: Project name or repository name.
"""
data_config_dir = os.path.join(self.build_dir, 'binder', 'data_requirement.json')
with open(data_config_dir, 'r') as file:
data = json.load(file)
self.dataset_name = data['projectName']
if os.path.isfile(data_config_dir):
with open(data_config_dir, 'r') as file:
data = json.load(file)
self.dataset_name = data.get('projectName', self.repo_name)
else:
self.cprint(f'Data requirement file not found at {data_config_dir}, using repository name', "yellow")
self.dataset_name = None

def repo2data_download(self,target_directory):
data_req_path = os.path.join(self.build_dir, 'binder', 'data_requirement.json')
Expand Down

0 comments on commit ae29606

Please sign in to comment.