INNER CODE UNIT · Python
resolve_source
PKU-EMBL/BASALT · BASALT_setup_China_mainland.py:118
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
candidates = [Path(__file__).resolve().parent, Path.cwd().resolve()]
for candidate in candidates:
if is_basalt_source(candidate):
print("Using existing BASALT source: {}".format(candidate))
return candidate
destination = Path(args.install_root).expanduser().resolve() / "BASALT"
if destination.exists():