Skip to content
Snippets Groups Projects
Commit 5a4963d5 authored by Raphaël Gomès's avatar Raphaël Gomès
Browse files

swh: add minimal data-env setup script

This is very basic, but is enough for our first step of creating an entire
separate suite.
parent 05db75ac
No related branches found
No related tags found
No related merge requests found
#!/bin/env python
from pathlib import Path
import click
import poulpe
@click.command()
@click.argument("env-name")
@click.argument(
"data-env-path",
type=click.Path(exists=True, file_okay=False, path_type=Path)
)
@click.argument("repo-path")
def setup_minimal(env_name, data_env_path: Path, repo_path):
"""Record a directory containing a Git clone as a data environment.
You still have to build the env by hand.
\b
ARGS:
<ENV_NAME>: display name of the data-env to setup
<DATA_ENV_PATH>: path to the data environment to setup
<REPO_PATH>: path to the Git repository relative to DATA-ENV-PATH
"""
repo = data_env_path / repo_path
if not (repo / '.git').is_dir():
raise click.BadParameter(
f"Repository path '{repo}' is not a git repository"
)
description_file = data_env_path / "data-env.poulpe"
description = {}
poulpe.set_one_value(
description, "poulpe-environment.environment-type", "data"
)
poulpe.set_one_value(description, "poulpe-environment.format-version", "0")
poulpe.set_one_value(
description, "poulpe-environment.setup-method", "manual"
)
poulpe.set_one_value(description, "data-env-vars.name", env_name)
poulpe.set_one_value(
description,
"bench-input-vars.swh.swh-loader-git.target-repo-path",
repo_path,
)
poulpe.write_data(description_file, description)
if __name__ == '__main__':
setup_minimal()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment