From a1bc48a57eca2329a82fea34df562c130822acff Mon Sep 17 00:00:00 2001 From: EsGeh Date: Wed, 27 Nov 2019 15:09:12 +0100 Subject: [PATCH] manage dependencies to other repos by 'git_deps_py' tool --- README.md | 5 +++-- dependencies.conf | 5 +++++ scripts/init.py | 57 +---------------------------------------------- 3 files changed, 9 insertions(+), 58 deletions(-) create mode 100644 dependencies.conf diff --git a/README.md b/README.md index f89abcd..ddaeea4 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,7 @@ Publications are provided in a number of different formats: In order to provide a consistent environment we are using docker. A set of python scripts is used for automatisation. Installing and running the project work without Docker or the scripts is possible, but not recommended. In this case you are on your own. -A bunch of other repositories are needed in order to run this project. -They are automatically pulled by the init script. +Dependencies to other git repositories are handled using [git_deps_py](https://github.molgen.mpg.de/EditionOpenAccess/git_deps_py). ## Configuration @@ -30,9 +29,11 @@ They are automatically pulled by the init script. - Python 3 - Docker, Docker Compose +- [git_deps_py](https://github.molgen.mpg.de/EditionOpenAccess/git_deps_py) ## Initialise the Repository + $ git_deps_py $ ./scripts/init.py [--build] This will pull remote repositories and resources, initialize the database, etc. diff --git a/dependencies.conf b/dependencies.conf new file mode 100644 index 0000000..4165742 --- /dev/null +++ b/dependencies.conf @@ -0,0 +1,5 @@ +[webdesign_platform] + +uri = https://github.molgen.mpg.de/EditionOpenAccess/webdesign_platform.git +hash = 7a6c3f7c0db224fdcbb046df3f7edad8fefded3f +init = ./scripts/init.sh diff --git a/scripts/init.py b/scripts/init.py index ee9c5cf..25794fa 100755 --- a/scripts/init.py +++ b/scripts/init.py @@ -49,37 +49,6 @@ def create_dirs( config ): dst=config['RES_DIR_RUNTIME'] ) -def install_git_dep( - repo_name, - repo_uri, - repo_hash, - force = False, - init_script = None -): - DEP_DIR = BASE_DIR / config['DEPENDENCIES_DIR'] - - create_dir( - BASE_DIR / config['DEPENDENCIES_DIR'] - ) - - # remove repo, if necessary: - if force and (DEP_DIR / repo_name).exists(): - shutil.rmtree( DEP_DIR / repo_name ) - - if not((DEP_DIR / repo_name).exists()): - subprocess.check_call( - ["git", "clone", repo_uri, DEP_DIR / repo_name] - ) - subprocess.check_call( - ["git", "checkout", repo_hash], - cwd = DEP_DIR / repo_name - ) - if init_script is not None: - subprocess.check_call( - shlex.split( init_script ), - cwd = DEP_DIR / repo_name - ) - def init_sqldb( config ): # print( "env in config:" ) # subprocess.check_call( @@ -123,11 +92,7 @@ def init_sqldb( config ): from argparse import ArgumentParser parser = ArgumentParser( - description="initialize the repository: download git deps, create directories, initialize xml database, initialize sql database" - ) - parser.add_argument( - "--force-deps", - action = "store_true" + description="initialize the repository: create directories, initialize xml database, initialize sql database" ) parser.add_argument( "--build", @@ -141,26 +106,6 @@ def init_sqldb( config ): # load env_file: config = load_config() - install_git_dep( - repo_name = "eoa-publication-model", - repo_uri = "https://github.molgen.mpg.de/EditionOpenAccess/eoa-publication-model.git", - repo_hash = "d76a81feef1ebb708a90376d3f5a7eccb51807b0", - force = args.force_deps, - ) - install_git_dep( - repo_name = "EOASkripts", - repo_uri = "https://github.molgen.mpg.de/EditionOpenAccess/EOASkripts.git", - repo_hash = "bb0d7bfc6b77bdec391886b90f3f9ad9f2025423", - force = args.force_deps, - ) - install_git_dep( - repo_name = "webdesign_platform", - repo_uri = "https://github.molgen.mpg.de/EditionOpenAccess/webdesign_platform.git", - repo_hash = "7a6c3f7c0db224fdcbb046df3f7edad8fefded3f", - init_script = "./scripts/init.sh", - force = args.force_deps, - ) - create_dirs( config ) # rebuild docker image: