-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
debug.py
103 lines (95 loc) · 3.13 KB
/
debug.py
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import glob
import locale
import os
import platform
import sys
import time
from datetime import datetime
try:
from os import path
except:
pass
try:
from os import uname
except:
pass
def printValue(object, attribute):
if hasattr(object, attribute):
print("{0}.{1}={2}".format(object.__name__, attribute, getattr(object, attribute)))
else:
print("{0}.{1} is undefined".format(object.__name__, attribute))
print("==============================================================")
print("Debugging Information")
print("==============================================================")
try:
print(datetime.now())
except:
pass
print("")
print("# Platform")
try:
print("Python={0}".format(sys.version.split('\n')))
(sysname, nodename, release, version, machine) = uname()
print("sysname={0}".format(sysname))
print("release={0}".format(release))
print("version={0}".format(version))
print("machine={0}".format(machine))
except:
print("Could not get uname")
try:
print("platform={0}".format(platform.platform()))
print("platform={0}".format(os.name))
print("platform={0}".format(platform.release()))
except:
print("Could not get platform")
print("")
print("# Locale")
try:
print("timezone={0}".format(time.strftime('%Z%z')))
print("defaultlocale={0}".format(locale.getdefaultlocale()))
locale.setlocale(locale.LC_ALL, "")
print("getlocale={0}".format(locale.getlocale(locale.LC_MESSAGES)[0]))
except:
print("Could not get locale")
print("")
print("# Version")
if path.exists("UniqueBibleAppVersion.txt"):
with open("UniqueBibleAppVersion.txt") as f:
print("UBA Version: {}".format(f.read().strip()))
else:
print("UniqueBibleAppVersion.txt does not exist")
print("")
print("# Config")
if path.exists("config.py"):
try:
import config
printValue(config, "developer")
printValue(config, "enableCmd")
printValue(config, "theme")
printValue(config, "userLanguage")
printValue(config, "userLanguageInterface")
printValue(config, "menuLayout")
printValue(config, "theme")
printValue(config, "menuShortcuts")
printValue(config, "marvelData")
printValue(config, "qtMaterial")
printValue(config, "qtMaterialTheme")
printValue(config, "useLiteVerseParsing")
printValue(config, "startupMacro")
printValue(config, "enableMacros")
printValue(config, "useLiteVerseParsing")
printValue(config, "disableModulesUpdateCheck")
except Exception as e:
print("Error: {0}".format(e))
else:
print("config.py does not exist")
print("")
print("# Marvel data")
try:
print("Bibles: {0}".format(len(glob.glob(config.marvelData+"/bibles/*.bible"))))
print("Books: {0}".format(len(glob.glob(config.marvelData+"/books/*.book"))))
print("Data: {0}".format(len(glob.glob(config.marvelData+"/data/*.data"))))
print("Commentaries: {0}".format(len(glob.glob(config.marvelData+"/commentaries/*.commentary"))))
print("Lexicons: {0}".format(len(glob.glob(config.marvelData+"/lexicons/*.lexicon"))))
except:
print("Could not get marvel data")