feat: add replication again

feat: non existent config folder
This commit is contained in:
Swann
2019-09-30 22:04:54 +02:00
parent 207199adc9
commit 11eb31af98
3 changed files with 10 additions and 2 deletions

4
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "libs/replication"] [submodule "multi_user/libs/replication"]
path = libs/replication path = multi_user/libs/replication
url = git@gitlab.com:slumber/replication.git url = git@gitlab.com:slumber/replication.git

View File

@ -35,6 +35,7 @@ def save_config(config):
import yaml import yaml
logger.info("saving config") logger.info("saving config")
with open(CONFIG, 'w') as outfile: with open(CONFIG, 'w') as outfile:
yaml.dump(config, outfile, default_flow_style=False) yaml.dump(config, outfile, default_flow_style=False)
@ -65,6 +66,9 @@ def install_package(name):
subprocess.run([str(PYTHON_PATH), "-m", "pip", "install", subprocess.run([str(PYTHON_PATH), "-m", "pip", "install",
name, '--target', target], cwd=SUBPROCESS_DIR) name, '--target', target], cwd=SUBPROCESS_DIR)
def check_dir(dir):
if not os.path.exists(dir):
os.makedirs(dir)
def setup(dependencies, python_path): def setup(dependencies, python_path):
global PYTHON_PATH, SUBPROCESS_DIR global PYTHON_PATH, SUBPROCESS_DIR
@ -72,6 +76,9 @@ def setup(dependencies, python_path):
PYTHON_PATH = Path(python_path) PYTHON_PATH = Path(python_path)
SUBPROCESS_DIR = PYTHON_PATH.parent SUBPROCESS_DIR = PYTHON_PATH.parent
check_dir(CACHE_DIR)
check_dir(CONFIG_DIR)
if not module_can_be_imported("pip"): if not module_can_be_imported("pip"):
install_pip() install_pip()