# HG changeset patch # User Raphaël Gomès <rgomes@octobus.net> # Date 1740407690 18000 # Mon Feb 24 09:34:50 2025 -0500 # Node ID 2c1c0d7f7816debbf1e050fd12ef6dfaf7c04571 # Parent 204b5dab9065b79725e5f4f9e3ad02960950270d setup-poulpe-den: add the ability to select suites you want to install diff --git a/bin/setup-poulpe-den b/bin/setup-poulpe-den --- a/bin/setup-poulpe-den +++ b/bin/setup-poulpe-den @@ -6,9 +6,10 @@ import subprocess import glob from pathlib import Path - +from typing import List -USAGE = "USAGE: %s ROOTPATH" % os.path.basename(sys.argv[0]) +import click + POULPE_DIR = Path(__file__).resolve().parent.parent @@ -164,7 +165,16 @@ subprocess.run(command, check=True, env=environ) -def setup_base_dir(path): +@click.command(no_args_is_help=True) +@click.argument("path") +@click.option( + "--suite", + "-s", + "suites", + multiple=True, + help="Suites to set up, defaults to all", +) +def setup_base_dir(path: str, suites: List[str]): base_path = Path(path).resolve() print("Creating folders") base_path.mkdir(parents=True, exist_ok=True) @@ -197,7 +207,10 @@ print("Cloning repositories to benchmark") repos = base_path / REPOSITORIES_DIR for listing in glob.glob(str(base_path / 'suites' / '*' / 'repositories')): - suite_name = Path(listing).parent.parent.name + suite_name = Path(listing).parent.name + if suites and suite_name not in suites: + print(f"Skipping suite {suite_name} as requested") + continue with open(listing) as f: for line in f: line = line.strip() @@ -224,9 +237,4 @@ if __name__ == "__main__": - if len(sys.argv) != 2 or sys.argv[1].startswith('-'): - print(USAGE, file=sys.stderr) - sys.exit(128) - else: - ret = setup_base_dir(sys.argv[1]) - sys.exit(ret) + setup_base_dir()