mirror of https://github.com/explosion/spaCy.git
Merge pull request #6049 from svlandeg/feature/project-fixes
This commit is contained in:
commit
2247d62655
|
@ -360,5 +360,7 @@ def _from_http_to_git(repo):
|
|||
repo = repo.replace(r"http://", r"https://")
|
||||
if repo.startswith(r"https://"):
|
||||
repo = repo.replace("https://", "git@").replace("/", ":", 1)
|
||||
if repo.endswith("/"):
|
||||
repo = repo[:-1]
|
||||
repo = f"{repo}.git"
|
||||
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.info(f"Fetching {len(assets)} asset(s)")
|
||||
for asset in assets:
|
||||
dest = Path(asset["dest"])
|
||||
dest = (project_dir / asset["dest"]).resolve()
|
||||
checksum = asset.get("checksum")
|
||||
if "git" in asset:
|
||||
if dest.exists():
|
||||
# If there's already a file, check for checksum
|
||||
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
|
||||
else:
|
||||
shutil.rmtree(dest)
|
||||
if dest.is_dir():
|
||||
shutil.rmtree(dest)
|
||||
else:
|
||||
dest.unlink()
|
||||
git_sparse_checkout(
|
||||
asset["git"]["repo"],
|
||||
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
|
||||
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.
|
||||
"""
|
||||
if not Path(dest).exists():
|
||||
|
|
Loading…
Reference in New Issue