Skip to content

Commit

Permalink
new ver. of psycopg2 fixes install problems, improve init script
Browse files Browse the repository at this point in the history
  • Loading branch information
EsGeh authored and EsGeh committed Nov 25, 2019
1 parent e2495d2 commit 20fc598
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Django==2.1.11
psycopg2-binary == 2.7.7
psycopg2-binary==2.8.4
dj-database-url==0.5.0
django-auth-ldap==2.0.0
django-classy-tags==0.9.0
Expand Down
40 changes: 27 additions & 13 deletions scripts/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from utils.settings import BASE_DIR, load_config, create_docker_env_file
from utils.functions import exec_in_container, run
from stop import stop

from pathlib import Path
import shlex
Expand Down Expand Up @@ -54,23 +55,26 @@ def install_git_dep(
repo_name,
repo_uri,
repo_hash,
force = False,
init_script = None
):
if (DEP_DIR / repo_name).exists():
# remove repo, if necessary:
if force and (DEP_DIR / repo_name).exists():
shutil.rmtree( DEP_DIR / repo_name )

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:
if not((DEP_DIR / repo_name).exists()):
subprocess.check_call(
["git", "clone", repo_uri, DEP_DIR / repo_name]
)
subprocess.check_call(
shlex.split( init_script ),
["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:" )
Expand Down Expand Up @@ -117,6 +121,10 @@ def init_sqldb( config ):
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"
)
parser.add_argument(
"--build",
action = "store_true"
Expand All @@ -132,18 +140,21 @@ def init_sqldb( config ):
install_git_dep(
repo_name = "eoa-publication-model",
repo_uri = "https://github.molgen.mpg.de/EditionOpenAccess/eoa-publication-model.git",
repo_hash = "d76a81feef1ebb708a90376d3f5a7eccb51807b0"
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"
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"
init_script = "./scripts/init.sh",
force = args.force_deps,
)

create_dirs( config )
Expand All @@ -154,5 +165,8 @@ def init_sqldb( config ):
env = config,
build = True,
)
stop(
env = config,
)

init_sqldb( config )

0 comments on commit 20fc598

Please sign in to comment.