forked from d101tm/tmstats
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexportsettings.py
More file actions
executable file
·41 lines (34 loc) · 1.05 KB
/
exportsettings.py
File metadata and controls
executable file
·41 lines (34 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python3
""" Output 'export' statements for significant configuration items found
in the configuration file or the database """
import sys
import tmglobals
import tmparms
import datetime
# Do the setup
myglobals = tmglobals.tmglobals()
# Establish parameters
parms = tmparms.tmparms()
# Do global setup
myglobals.setup(parms)
curs = myglobals.curs
conn = myglobals.conn
res = {}
# Information from the configuration file:
res['workdir'] = parms.workdir
res['archivedir'] = parms.archivedir
res['pindir'] = parms.pindir
res['cursordir'] = parms.cursordir
res['alignmentdir'] = parms.alignmentdir
res['reportdir'] = parms.reportdir
# Where this program lives
res['SCRIPTPATH'] = sys.path[0]
# Date-related information
res['dbtmyear'] = myglobals.tmyear
today = datetime.datetime.now()
res['caltmyear'] = today.year if today.month >= 7 else today.year - 1
res['hour'] = today.hour
res['today'] = today.strftime('%Y-%m-%d')
res['yday'] = (today - datetime.timedelta(1)).strftime('%Y-%m-%d')
for (k, v) in res.items():
print("export %s='%s'" % (k, v))