forked from Open-Wine-Components/umu-protonfixes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.py
executable file
·64 lines (52 loc) · 1.53 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
""" Prints debug info if the environment variable DEBUG is 1
"""
import os
import sys
import shutil
# pylint: disable=E0611
from __main__ import CURRENT_PREFIX_VERSION, g_proton
from .logger import log
os.environ['DEBUG'] = '1'
def show_debug_info() -> None:
""" Show various debug info """
check_args = [
'iscriptevaluator.exe' in sys.argv[2],
'getcompatpath' in sys.argv[1],
'getnativepath' in sys.argv[1],
]
if any(check_args):
log.debug(str(sys.argv))
return
line = '---------------------------------------'
log.debug('---- begin protontricks debug info ----')
log.debug('Proton Python Version:')
log.debug(sys.executable)
log.debug(sys.version)
log.debug(line)
log.debug('System Python Version:')
try:
log.debug(shutil.which(os.readlink(shutil.which('python'))))
except: #pylint: disable=W0702
log.debug(shutil.which('python'))
log.debug(line)
log.debug('Proton Version:')
log.debug(CURRENT_PREFIX_VERSION)
log.debug(line)
log.debug('Proton Directory:')
log.debug(g_proton.base_dir)
log.debug(line)
ignorevars = [
'SteamUser',
'OLDPWD',
'SteamAppUser',
'LS_COLORS',
]
log.debug('Environment Variables:')
for key, value in os.environ.items():
if key not in ignorevars:
log.debug(key + '=' + value)
log.debug(line)
log.debug('Command Line:')
log.debug(sys.argv)
log.debug('----- end protontricks debug info -----')
show_debug_info()