updated downloading of repository
This commit is contained in:
+4
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user