mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-03 21:24:11 +03:00
add try-except to git commands to get an informative warning
This commit is contained in:
parent
e7aff9c5fc
commit
8eca7e995e
|
@ -240,12 +240,16 @@ def project_clone(
|
||||||
try:
|
try:
|
||||||
run_command(cmd)
|
run_command(cmd)
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
err = f"Could not clone the repo '{repo}' into the temp dir '{tmp_dir}'"
|
err = f"Could not clone the repo '{repo}' into the temp dir '{tmp_dir}'."
|
||||||
msg.fail(err)
|
msg.fail(err)
|
||||||
with (tmp_dir / ".git" / "info" / "sparse-checkout").open("w") as f:
|
with (tmp_dir / ".git" / "info" / "sparse-checkout").open("w") as f:
|
||||||
f.write(name)
|
f.write(name)
|
||||||
run_command(["git", "-C", str(tmp_dir), "fetch"])
|
try:
|
||||||
run_command(["git", "-C", str(tmp_dir), "checkout"])
|
run_command(["git", "-C", str(tmp_dir), "fetch"])
|
||||||
|
run_command(["git", "-C", str(tmp_dir), "checkout"])
|
||||||
|
except SystemExit:
|
||||||
|
err = f"Could not clone {name} in the repo '{repo}'."
|
||||||
|
msg.fail(err)
|
||||||
shutil.move(str(tmp_dir / Path(name).name), str(project_dir))
|
shutil.move(str(tmp_dir / Path(name).name), str(project_dir))
|
||||||
msg.good(f"Cloned project '{name}' from {repo} into {project_dir}")
|
msg.good(f"Cloned project '{name}' from {repo} into {project_dir}")
|
||||||
for sub_dir in DIRS:
|
for sub_dir in DIRS:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user