diff --git a/build.py b/build.py index 18a89489b3339b65a5d8aa71c8388a18634a5286..50f271b56d74cdfb7f69be9ea36282ab59f5a372 100755 --- a/build.py +++ b/build.py @@ -392,15 +392,18 @@ def run_init(): subprocess.run(["git", "submodule", "update", "--init"], check=True) subprocess.run(["git", "submodule", "foreach", "git checkout master && git pull"], check=True) + for name in module_names: - copy_file("./scripts/commit-msg", ".git/modules/"+name+"/hooks") + hooks_dir = ".git/modules/" + name + "/hooks" + if not os.path.exists(hooks_dir): + os.makedirs(hooks_dir) + copy_file("./scripts/commit-msg", hooks_dir + "/commit-msg") module_names_to_format = ['daemon', 'client-qt', 'plugins'] for name in module_names_to_format: - execute_script( - ['./scripts/format.sh --install %(path)s'], - {"path": ".git/modules/" + name + "/hooks"} - ) + hooks_dir = ".git/modules/" + name + "/hooks" + execute_script(['./scripts/format.sh --install %(path)s'], + {"path": hooks_dir}) def copy_file(src, dest):