def recipe_show(recipe: str, version: str, verbose: bool, all: bool): """ Show details about a specific recipe. """ my_mussels = Mussels(load_all_recipes=all) my_mussels.show_recipe(recipe, version, verbose)
def cookbook_remove(cookbook): """ Remove a cookbook from the list of known cookbooks. """ my_mussels = Mussels(load_all_recipes=True) my_mussels.config_remove_cookbook(cookbook)
def recipe_clone(recipe: str, version: str, cookbook: str, dest: str): """ Copy a recipe to the current directory or to a specific directory. """ my_mussels = Mussels(load_all_recipes=True) my_mussels.clone_recipe(recipe, version, cookbook, dest)
def cookbook_add(cookbook, author, url, trust): """ Add a cookbook to the list of known cookbooks. """ my_mussels = Mussels(load_all_recipes=True) my_mussels.config_add_cookbook(cookbook, author, url, trust=trust)
def tool_clone(tool: str, version: str, cookbook: str, dest: str): """ Copy a tool to the current directory or to a specific directory. """ my_mussels = Mussels(load_all_recipes=True) my_mussels.clone_tool(tool, version, cookbook, dest)
def execute_build(stdout, stderr): sys.stdout = stdout.fileno() sys.stderr = stderr.fileno() my_mussels = Mussels( install_dir=os.getcwd(), work_dir=os.getcwd(), log_dir=os.getcwd(), download_dir=os.getcwd(), ) results = [] success = my_mussels.build_recipe(recipe="foobar", version="", cookbook="", target="host", results=results, dry_run=False, rebuild=False) stdout.send("The End") stdout.close() stderr.close() if success == False: sys.exit(1) sys.exit(0)
def cookbook_update(): """ Update the cookbooks from the internet. """ my_mussels = Mussels(load_all_recipes=True) my_mussels.update_cookbooks()
def cookbook_show(cookbook: str, verbose: bool): """ Show details about a specific cookbook. """ my_mussels = Mussels(load_all_recipes=True) my_mussels.show_cookbook(cookbook, verbose)
def clean_all(): """ Clear the all files. """ my_mussels = Mussels(load_all_recipes=True) my_mussels.clean_all()
def cookbook_list(verbose: bool): """ Print the list of all known cookbooks. """ my_mussels = Mussels(load_all_recipes=True) my_mussels.list_cookbooks(verbose)
def clean_cache(): """ Clear the cache files. """ my_mussels = Mussels(load_all_recipes=True) my_mussels.clean_cache()
def clean_logs(): """ Clear the logs files. """ my_mussels = Mussels(load_all_recipes=True) my_mussels.clean_logs()
def tool_show(tool: str, version: str, verbose: bool, all: bool): """ Show details about a specific tool. """ my_mussels = Mussels(load_all_recipes=all) my_mussels.show_tool(tool, version, verbose)
def tool_list(verbose: bool, all: bool): """ Print the list of all known tools. An asterisk indicates default (highest) version. """ my_mussels = Mussels(load_all_recipes=all) my_mussels.list_tools(verbose)
def test_0_basic_variable(self): (TC.path_tmp / "foobar.yaml").write_text(''' name: foobar version: "1.2.3" url: https://www.example.com/foo.tar.gz mussels_version: "0.3" type: recipe platforms: Posix: host: build_script: make: | echo "{python.foo}" dependencies: [] required_tools: - python Windows: host: build_script: make: | echo "{python.foo}" dependencies: [] required_tools: - python ''') my_mussels = Mussels(install_dir=os.getcwd(), work_dir=os.getcwd(), log_dir=os.getcwd(), download_dir=os.getcwd(), log_level="DEBUG") results = [] success = my_mussels.build_recipe(recipe="foobar", version="", cookbook="", target="host", results=results, dry_run=False, rebuild=False) logging.shutdown() # Find the foobar log for i in os.listdir(str(TC.path_tmp)): if (TC.path_tmp / i).is_file() and i.startswith('foobar-1.2.3'): text = (TC.path_tmp / i).read_text() break print(f"Checking for 'Hello World!' in:\n\n{text}") assert "Hello World!" in text
def tool_check(tool: str, version: str, cookbook: str): """ Check if a tool is installed. """ my_mussels = Mussels() results = [] success = my_mussels.check_tool(tool, version, cookbook, results) if success == False: sys.exit(1) sys.exit(0)
def cookbook_trust(cookbook, yes): """ Trust a cookbook. """ my_mussels = Mussels(load_all_recipes=True) if yes != True: print( f"\nDisclaimer: There is a non-zero risk when running code downloaded from the internet.\n" ) response = input( f"Are you sure you would like to trust recipes from cookbook '{cookbook}'? [N/y] " ) response = response.strip().lower() if response != "y" and response != "yes": return my_mussels.config_trust_cookbook(cookbook)
def recipe_build( recipe: str, version: str, cookbook: str, target: str, dry_run: bool, clean: bool, install: str, ): """ Download, extract, build, and install a recipe. """ my_mussels = Mussels(install_dir=install) results = [] success = my_mussels.build_recipe(recipe, version, cookbook, target, results, dry_run, clean) if success == False: sys.exit(1) sys.exit(0)