Skip to content

Commit 13d9a36

Browse files
committed
Made changes for the loading of repos from the base Action class
1 parent d3710a9 commit 13d9a36

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

mlc/main.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -947,10 +947,8 @@ def __init__(self, parent=None):
947947

948948
def find(self, run_args):
949949
try:
950-
# Load repos.json file
951-
repos_file= os.path.join(self.repos_path, 'repos.json')
952-
with open(repos_file, "r") as f:
953-
repos_list = json.load(f)
950+
# Get repos_list using the existing method
951+
repos_list = self.load_repos_and_meta()
954952
if(run_args.get('item', run_args.get('artifact'))):
955953
repo = run_args.get('item', run_args.get('artifact'))
956954
else:
@@ -997,16 +995,10 @@ def find(self, run_args):
997995

998996
# Check if repo_name exists in repos.json
999997
matched_repo_path = None
1000-
repo_found = False # Flag to track if any repo is found
1001-
for repo_path in repos_list:
1002-
if repo_name and repo_name == os.path.basename(repo_path):
1003-
meta_yaml_path = os.path.join(repo_path, "meta.yaml")
1004-
if os.path.exists(meta_yaml_path):
1005-
matched_repo_path = repo_path
1006-
repo_found = True # Repo found
1007-
break # Stop searching if we find a match
1008-
else:
1009-
raise ValueError(f"Repository with alias: '{repo_name}' is missing meta.yaml file")
998+
for repo_obj in repos_list:
999+
if repo_name and repo_name == os.path.basename(repo_obj.path) :
1000+
matched_repo_path = repo_obj.path
1001+
break
10101002

10111003
# Search through self.repos for matching repos
10121004
lst = []

0 commit comments

Comments
 (0)