added test printing of var
This commit is contained in:
+16
-3
@@ -4,15 +4,28 @@ from git import Repo
|
||||
import logging
|
||||
import shutil
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from configparser import ConfigParser
|
||||
from runner_script import RunnerScript
|
||||
|
||||
|
||||
def clone_repository(repo_url: AnyHttpUrl) -> Path:
|
||||
# load default values
|
||||
load_dotenv()
|
||||
config = ConfigParser()
|
||||
config.read(Path(__file__).parent / 'defaults.ini')
|
||||
REPO_DIR = config.get('fastapi', 'listen_ip')
|
||||
if 'DEV' in os.environ:
|
||||
REPO_DIR = os.getenv('REPO_DIR', default=REPO_DIR)
|
||||
|
||||
|
||||
def clone_repository(
|
||||
repo_url: AnyHttpUrl,
|
||||
repo_dir: str = REPO_DIR
|
||||
) -> Path:
|
||||
# extract repo name
|
||||
repo_name = repo_url.split('/')[-1].replace('.git', '')
|
||||
repo_dir = os.getenv('REPO_DIR', default=None)
|
||||
assert repo_dir is not None
|
||||
dst_dir = Path(repo_dir) / repo_name
|
||||
logging.warning(dst_dir)
|
||||
# prepare repo download dir
|
||||
if dst_dir.exists():
|
||||
shutil.rmtree(dst_dir)
|
||||
|
||||
Reference in New Issue
Block a user