Skip to content

Commit

Permalink
Fix existing repo logic
Browse files Browse the repository at this point in the history
  • Loading branch information
agahkarakuzu committed Nov 25, 2024
1 parent c8aa357 commit 3e6403b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 7 additions & 5 deletions myst_libre/tools/build_source_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def create_build_dir_host(self):
bool: True if directory created, else False.
"""
if not os.path.exists(self.build_dir):
os.makedirs(self.build_dir)
os.makedirs(self.build_dir, exist_ok=True)
return True
return False

Expand All @@ -52,12 +52,14 @@ def git_clone_repo(self,clone_parent_directory):
"""
self.host_build_source_parent_dir = clone_parent_directory
self.build_dir = os.path.join(self.host_build_source_parent_dir, self.username, self.repo_name, self.gh_repo_commit_hash)
if self.create_build_dir_host():
self.cprint(f'Cloning into {self.build_dir}', "green")
self.repo_object = Repo.clone_from(f'{self.provider}/{self.gh_user_repo_name}', self.build_dir)
else:

if os.path.exists(self.build_dir):
self.cprint(f'Source {self.build_dir} already exists.', "yellow")
self.repo_object = Repo(self.build_dir)
else:
os.makedirs(os.path.dirname(self.build_dir), exist_ok=True)
self.cprint(f'Cloning into {self.build_dir}', "green")
self.repo_object = Repo.clone_from(f'{self.provider}/{self.gh_user_repo_name}', self.build_dir)

self.set_commit_info()
self.validate_commits()
Expand Down
5 changes: 4 additions & 1 deletion myst_libre/tools/jupyter_hub_local_spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ def spawn_jupyter_hub(self,jb_build_command=None):
self.cprint(f' ├───────── ✸ {self.rees.pull_image_name}','light_blue')
self.cprint(f' ├───────── ⎌ {self.rees.binder_image_tag}','light_blue')
self.cprint(f" ├───────── ⏲ {self.rees.binder_commit_info['datetime']}: {self.rees.binder_commit_info['message']}".replace('\n', ''),'light_blue')
self.cprint(f' └───────── ℹ This image was built from REES-compliant {self.rees.gh_user_repo_name} repository at the commit above','yellow')
if self.rees.binder_image_name:
self.cprint(f' └───────── ℹ Using NeuroLibre base image {self.rees.binder_image_name}','yellow')
else:
self.cprint(f' └───────── ℹ This image was built from REES-compliant {self.rees.gh_user_repo_name} repository at the commit above','yellow')
except Exception as e:
logging.error(f'Could not spawn a JH: \n {e}')

Expand Down

0 comments on commit 3e6403b

Please sign in to comment.