From 11eb31af9842ae3bd2cc8bf578a6f14142a6d1f1 Mon Sep 17 00:00:00 2001 From: Swann Date: Mon, 30 Sep 2019 22:04:54 +0200 Subject: [PATCH] feat: add replication again feat: non existent config folder --- .gitmodules | 4 ++-- multi_user/environment.py | 7 +++++++ multi_user/libs/replication | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) create mode 160000 multi_user/libs/replication diff --git a/.gitmodules b/.gitmodules index 1646364..7aba73a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "libs/replication"] - path = libs/replication +[submodule "multi_user/libs/replication"] + path = multi_user/libs/replication url = git@gitlab.com:slumber/replication.git diff --git a/multi_user/environment.py b/multi_user/environment.py index 115e47f..937c8c5 100644 --- a/multi_user/environment.py +++ b/multi_user/environment.py @@ -35,6 +35,7 @@ def save_config(config): import yaml logger.info("saving config") + with open(CONFIG, 'w') as outfile: yaml.dump(config, outfile, default_flow_style=False) @@ -65,6 +66,9 @@ def install_package(name): subprocess.run([str(PYTHON_PATH), "-m", "pip", "install", name, '--target', target], cwd=SUBPROCESS_DIR) +def check_dir(dir): + if not os.path.exists(dir): + os.makedirs(dir) def setup(dependencies, python_path): global PYTHON_PATH, SUBPROCESS_DIR @@ -72,6 +76,9 @@ def setup(dependencies, python_path): PYTHON_PATH = Path(python_path) SUBPROCESS_DIR = PYTHON_PATH.parent + check_dir(CACHE_DIR) + check_dir(CONFIG_DIR) + if not module_can_be_imported("pip"): install_pip() diff --git a/multi_user/libs/replication b/multi_user/libs/replication new file mode 160000 index 0000000..7eecb7f --- /dev/null +++ b/multi_user/libs/replication @@ -0,0 +1 @@ +Subproject commit 7eecb7fe4689649741aa69fff7ef6ec7c0a6ec52