@@ -232,24 +232,22 @@ def ls_recipe():
232232def install_recipe (recipe_path : Union [str , pathlib .Path ],
233233 verbose : bool = False ):
234234 """
235- Installs a recipe from a local directory into the system. The recipe will be
235+ Installs a recipe from a local directory into the system.
236236
237237 :param recipe_path: Path to the recipe directory (containing setup.py or pyproject.toml)
238238 :param verbose: If True, show detailed pip output
239239 """
240240 recipe_path = pathlib .Path (recipe_path ).resolve ()
241241
242242 if not recipe_path .exists ():
243- print (f"Error: Recipe path does not exist: { recipe_path } " )
244- return False
243+ raise FileNotFoundError (f"Recipe path does not exist: { recipe_path } " )
245244
246245 # Check for setup.py or pyproject.toml
247246 has_setup = recipe_path .joinpath ("setup.py" ).exists ()
248247 has_pyproject = recipe_path .joinpath ("pyproject.toml" ).exists ()
249248
250249 if not (has_setup or has_pyproject ):
251- print (f"Error: No setup.py or pyproject.toml found in { recipe_path } " )
252- return False
250+ raise FileNotFoundError (f"No setup.py or pyproject.toml found in { recipe_path } " )
253251
254252 try :
255253 cmd = [sys .executable , "-m" , "pip" , "install" ]
@@ -266,18 +264,15 @@ def install_recipe(recipe_path: Union[str, pathlib.Path],
266264 result = subprocess .run (cmd , capture_output = True , text = True )
267265
268266 if result .returncode != 0 :
269- print (f"Installation failed: { result .stderr } " )
270- return False
267+ raise RuntimeError (f"Installation failed: { result .stderr } " )
271268 else :
272269 print (f"Successfully installed recipe from { recipe_path } " )
273270 if verbose :
274271 print (result .stdout )
275- return True
276272
277273 except Exception as e :
278- print (f"Could not install recipe from { recipe_path } : { e } " )
279274 traceback .print_exc ()
280- return False
275+ raise RuntimeError ( f"Could not install recipe from { recipe_path } : { e } " )
281276
282277
283278def uninstall_recipe (recipe_name : str ):
@@ -294,21 +289,16 @@ def uninstall_recipe(recipe_name: str):
294289
295290 try :
296291 cmd = [sys .executable , "-m" , "pip" , "uninstall" , "-y" , package_name ]
297- print (f"Uninstalling: { package_name } " )
298- print (f"Command: { ' ' .join (cmd )} " )
292+ # print(f"Uninstalling: {package_name}")
293+ # print(f"Command: {' '.join(cmd)}")
299294 result = subprocess .run (cmd , capture_output = True , text = True )
300295
301296 if result .returncode != 0 :
302- print (f"Uninstall failed: { result .stderr } " )
303- return False
304- else :
305- print (f"Successfully uninstalled { package_name } " )
306- return True
297+ raise RuntimeError (f"Uninstall failed: { result .stderr } " )
307298
308299 except Exception as e :
309- print (f"Could not uninstall recipe for { recipe_name } : { e } " )
310300 traceback .print_exc ()
311- return False
301+ raise RuntimeError ( f"Could not uninstall recipe for { recipe_name } : { e } " )
312302
313303
314304def create_recipe (path_to_instances : Union [str , pathlib .Path ],
0 commit comments