mirror of https://github.com/explosion/spaCy.git
Merge branch 'develop' into fix/clone-compat
This commit is contained in:
commit
5acd4fbcd8
|
@ -381,5 +381,7 @@ def _from_http_to_git(repo: str) -> str:
|
||||||
repo = repo.replace(r"http://", r"https://")
|
repo = repo.replace(r"http://", r"https://")
|
||||||
if repo.startswith(r"https://"):
|
if repo.startswith(r"https://"):
|
||||||
repo = repo.replace("https://", "git@").replace("/", ":", 1)
|
repo = repo.replace("https://", "git@").replace("/", ":", 1)
|
||||||
|
if repo.endswith("/"):
|
||||||
|
repo = repo[:-1]
|
||||||
repo = f"{repo}.git"
|
repo = f"{repo}.git"
|
||||||
return repo
|
return repo
|
||||||
|
|
|
@ -38,16 +38,21 @@ def project_assets(project_dir: Path) -> None:
|
||||||
msg.warn(f"No assets specified in {PROJECT_FILE}", exits=0)
|
msg.warn(f"No assets specified in {PROJECT_FILE}", exits=0)
|
||||||
msg.info(f"Fetching {len(assets)} asset(s)")
|
msg.info(f"Fetching {len(assets)} asset(s)")
|
||||||
for asset in assets:
|
for asset in assets:
|
||||||
dest = Path(asset["dest"])
|
dest = (project_dir / asset["dest"]).resolve()
|
||||||
checksum = asset.get("checksum")
|
checksum = asset.get("checksum")
|
||||||
if "git" in asset:
|
if "git" in asset:
|
||||||
if dest.exists():
|
if dest.exists():
|
||||||
# If there's already a file, check for checksum
|
# If there's already a file, check for checksum
|
||||||
if checksum and checksum == get_checksum(dest):
|
if checksum and checksum == get_checksum(dest):
|
||||||
msg.good(f"Skipping download with matching checksum: {dest}")
|
msg.good(
|
||||||
|
f"Skipping download with matching checksum: {asset['dest']}"
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
shutil.rmtree(dest)
|
if dest.is_dir():
|
||||||
|
shutil.rmtree(dest)
|
||||||
|
else:
|
||||||
|
dest.unlink()
|
||||||
git_sparse_checkout(
|
git_sparse_checkout(
|
||||||
asset["git"]["repo"],
|
asset["git"]["repo"],
|
||||||
asset["git"]["path"],
|
asset["git"]["path"],
|
||||||
|
@ -67,7 +72,7 @@ def check_private_asset(dest: Path, checksum: Optional[str] = None) -> None:
|
||||||
"""Check and validate assets without a URL (private assets that the user
|
"""Check and validate assets without a URL (private assets that the user
|
||||||
has to provide themselves) and give feedback about the checksum.
|
has to provide themselves) and give feedback about the checksum.
|
||||||
|
|
||||||
dest (Path): Desintation path of the asset.
|
dest (Path): Destination path of the asset.
|
||||||
checksum (Optional[str]): Optional checksum of the expected file.
|
checksum (Optional[str]): Optional checksum of the expected file.
|
||||||
"""
|
"""
|
||||||
if not Path(dest).exists():
|
if not Path(dest).exists():
|
||||||
|
|
Loading…
Reference in New Issue