diff --git a/tools/__init__.py b/tools/__init__.py new file mode 100644 index 0000000000..b2501688f7 --- /dev/null +++ b/tools/__init__.py @@ -0,0 +1 @@ +# tools package: en cours de restructuration diff --git a/tools/postupgrade-db.py b/tools/postupgrade-db.py index bec3038ee0..e4a4f50bbb 100755 --- a/tools/postupgrade-db.py +++ b/tools/postupgrade-db.py @@ -1,4 +1,4 @@ -#!/opt/zope213/bin/python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ @@ -15,7 +15,7 @@ existing scodoc instances). E. Viennet, june 2008, sept 2013 """ -from scodocutils import * +from tools.scodocutils import * for dept in get_depts(): log("\nChecking database for dept %s" % dept) @@ -30,6 +30,8 @@ for dept in get_depts(): continue cnx.set_session(autocommit=False) cursor = cnx.cursor() + print "passing !" + continue # Apply upgrades: # SVN 564 -> 565 diff --git a/tools/scodocutils.py b/tools/scodocutils.py index f5cb036d6b..9c378992a0 100755 --- a/tools/scodocutils.py +++ b/tools/scodocutils.py @@ -10,7 +10,7 @@ import os import sys import traceback -sys.path.append("..") +from config import Config def log(msg): @@ -20,21 +20,9 @@ def log(msg): sys.stderr.flush() -SCODOC_DIR = os.environ.get("SCODOC_DIR", "") -if not SCODOC_DIR: - log("Error: environment variable SCODOC_DIR is not defined") - sys.exit(1) -SCODOC_VAR_DIR = os.environ.get("SCODOC_VAR_DIR", "") -if not SCODOC_VAR_DIR: - log("Error: environment variable SCODOC_VAR_DIR is not defined") - sys.exit(1) -SCO_TMPDIR = os.path.join(SCODOC_VAR_DIR, "tmp") -SCODOC_LOGOS_DIR = os.environ.get("SCODOC_LOGOS_DIR", "") - - def get_dept_cnx_str(dept): "db cnx string for dept" - f = os.path.join(SCODOC_VAR_DIR, "config", "depts", dept + ".cfg") + f = os.path.join(Config.SCODOC_VAR_DIR, "config", "depts", dept + ".cfg") try: return open(f).readline().strip() except: @@ -43,18 +31,9 @@ def get_dept_cnx_str(dept): raise -def get_users_cnx_str(): - "db cnx string for users database (used only during upgrades to modify db schema)" - # uses default in sco_utils - # For customized installs, define the value here (used only during upgrades) - from app.scodoc import sco_utils - - return sco_utils.SCO_DEFAULT_SQL_USERS_CNX - - def get_depts(): "list of defined depts" - files = glob.glob(SCODOC_VAR_DIR + "/config/depts/*.cfg") + files = glob.glob(Config.SCODOC_VAR_DIR + "/config/depts/*.cfg") return [os.path.splitext(os.path.split(f)[1])[0] for f in files]