INNER CODE UNIT · Python
is_basalt_source
PKU-EMBL/BASALT · BASALT_setup_China_mainland.py:109
def is_basalt_source(path: Path) -> bool:
"""Return whether *path* looks like the BASALT source repository."""
return (
(path / "basalt_environment.yml").is_file()
and (path / "install.sh").is_file()
and (path / "BASALT" / "BASALT.py").is_file()
)
def resolve_source(args: argparse.Namespace) -> Path:
"""Use an existing checkout when possible, otherwise clone BASALT."""
if args.source_dir:
source = Path(args.source_dir).expanduser().resolve()
if not is_basalt_source(source):
raise InstallationError(
"--source-dir is not a BASALT checkout: {}".format(source)
)
return source