updated downloading of repository

This commit is contained in:
brb
2023-07-06 11:09:28 +02:00
parent fdd968e3a3
commit 155a93456c
+4 -1
View File
@@ -2,11 +2,14 @@ from pydantic import AnyHttpUrl
from pathlib import Path
from git import Repo
import shutil
import os
def clone_repository(repo_url: AnyHttpUrl) -> Path:
# extract repo name
repo_name = repo_url.split('/')[-1].replace('.git', '')
dst_dir = Path(__file__).parent / repo_name
repo_dir = os.getenv('REPO_DIR', default=None)
assert repo_dir is not None
dst_dir = Path(repo_dir) / repo_name
# prepare repo download dir
if dst_dir.exists():
shutil.rmtree(dst_dir)