55from rich .panel import Panel
66from rich .progress import Progress , SpinnerColumn , TextColumn
77
8+ def _find_mkconcore_path ():
9+ for parent in Path (__file__ ).resolve ().parents :
10+ candidate = parent / "mkconcore.py"
11+ if candidate .exists ():
12+ return candidate
13+ return None
14+
815def run_workflow (workflow_file , source , output , exec_type , auto_build , console ):
916 workflow_path = Path (workflow_file ).resolve ()
1017 source_path = Path (source ).resolve ()
11- output_path = Path (output )
18+ output_path = Path (output ). resolve ()
1219
1320 if not source_path .exists ():
1421 raise FileNotFoundError (f"Source directory '{ source } ' not found" )
@@ -24,6 +31,10 @@ def run_workflow(workflow_file, source, output, exec_type, auto_build, console):
2431 console .print (f"[cyan]Type:[/cyan] { exec_type } " )
2532 console .print ()
2633
34+ mkconcore_path = _find_mkconcore_path ()
35+ if mkconcore_path is None :
36+ raise FileNotFoundError ("mkconcore.py not found. Please install concore from source." )
37+
2738 with Progress (
2839 SpinnerColumn (),
2940 TextColumn ("[progress.description]{task.description}" ),
@@ -33,7 +44,8 @@ def run_workflow(workflow_file, source, output, exec_type, auto_build, console):
3344
3445 try :
3546 result = subprocess .run (
36- [sys .executable , 'mkconcore.py' , str (workflow_path ), str (source_path ), str (output_path ), exec_type ],
47+ [sys .executable , str (mkconcore_path ), str (workflow_path ), str (source_path ), str (output_path ), exec_type ],
48+ cwd = mkconcore_path .parent ,
3749 capture_output = True ,
3850 text = True ,
3951 check = True
0 commit comments