1
0
forked from ScoDoc/ScoDoc

debut restructuration scripts upgrade

This commit is contained in:
Emmanuel Viennet 2021-08-02 09:41:11 +03:00
parent 6cd868b7a3
commit 2c4ff46a3a
3 changed files with 8 additions and 26 deletions

1
tools/__init__.py Normal file
View File

@ -0,0 +1 @@
# tools package: en cours de restructuration

View File

@ -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

View File

@ -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]