Skip to content

Commit

Permalink
manage dependencies to other repos by 'git_deps_py' tool
Browse files Browse the repository at this point in the history
EsGeh authored and EsGeh committed Nov 27, 2019
1 parent 5a2847c commit a1bc48a
Showing 3 changed files with 9 additions and 58 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 5 additions & 0 deletions dependencies.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[webdesign_platform]

uri = https://github.molgen.mpg.de/EditionOpenAccess/webdesign_platform.git
hash = 7a6c3f7c0db224fdcbb046df3f7edad8fefded3f
init = ./scripts/init.sh
57 changes: 1 addition & 56 deletions scripts/init.py
Original file line number Diff line number Diff line change
@@ -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:

0 comments on commit a1bc48a

Please sign in to comment.