Merge remote-tracking branch 'MayeulC/python3' into proton_3.7

This commit is contained in:
Andrew Eikum 2018-08-24 11:14:38 -05:00
commit 088c88b745
4 changed files with 29 additions and 15 deletions

View File

@ -1,8 +1,10 @@
#!/usr/bin/env python2 #!/usr/bin/env python
#NOTE: If you make modifications here, consider whether they should #NOTE: If you make modifications here, consider whether they should
#be duplicated in ../vrclient/gen_wrapper.py #be duplicated in ../vrclient/gen_wrapper.py
from __future__ import print_function
import pprint import pprint
import sys import sys
import clang.cindex import clang.cindex
@ -502,7 +504,7 @@ for sdkver in sdk_versions:
diagnostics = list(tu.diagnostics) diagnostics = list(tu.diagnostics)
if len(diagnostics) > 0: if len(diagnostics) > 0:
print 'There were parse errors' print('There were parse errors')
pprint.pprint(diagnostics) pprint.pprint(diagnostics)
else: else:
children = list(tu.cursor.get_children()) children = list(tu.cursor.get_children())

28
proton
View File

@ -1,7 +1,9 @@
#!/usr/bin/env python2.7 #!/usr/bin/env python
#script to launch Wine with the correct environment #script to launch Wine with the correct environment
from __future__ import print_function
import filecmp import filecmp
import json import json
import os import os
@ -324,7 +326,8 @@ if "nod3d11" in config_opts:
del dlloverrides["dxgi"] del dlloverrides["dxgi"]
s = "" s = ""
for dll, setting in dlloverrides.iteritems(): for dll in dlloverrides:
setting = dlloverrides[dll]
if len(s) > 0: if len(s) > 0:
s = s + ";" + dll + "=" + setting s = s + ";" + dll + "=" + setting
else: else:
@ -394,7 +397,7 @@ def dump_dbg_scripts():
f.write("cd \"" + os.getcwd() + "\"\n") f.write("cd \"" + os.getcwd() + "\"\n")
dump_dbg_env(f) dump_dbg_env(f)
f.write("\t\"" + wine_path + "\" winedbg \"$@\"\n") f.write("\t\"" + wine_path + "\" winedbg \"$@\"\n")
os.chmod(dir + "winedbg", 0755) os.chmod(dir + "winedbg", 0o755)
with open(dir + "winedbg_run", "w") as f: with open(dir + "winedbg_run", "w") as f:
f.write("#!/bin/bash\n") f.write("#!/bin/bash\n")
@ -411,7 +414,7 @@ def dump_dbg_scripts():
f.write(")\n") f.write(")\n")
dump_dbg_env(f) dump_dbg_env(f)
f.write("\t\"" + wine_path + "\" winedbg \"${@:-${DEF_CMD[@]}}\"\n") f.write("\t\"" + wine_path + "\" winedbg \"${@:-${DEF_CMD[@]}}\"\n")
os.chmod(dir + "winedbg_run", 0755) os.chmod(dir + "winedbg_run", 0o755)
with open(dir + "gdb_attach", "w") as f: with open(dir + "gdb_attach", "w") as f:
f.write("#!/bin/bash\n") f.write("#!/bin/bash\n")
@ -426,7 +429,7 @@ def dump_dbg_scripts():
f.write("WPID_DEC=$(printf %d 0x$WPID_HEX)\n") f.write("WPID_DEC=$(printf %d 0x$WPID_HEX)\n")
dump_dbg_env(f) dump_dbg_env(f)
f.write("\t\"" + wine_path + "\" winedbg --gdb $WPID_DEC\n") f.write("\t\"" + wine_path + "\" winedbg --gdb $WPID_DEC\n")
os.chmod(dir + "gdb_attach", 0755) os.chmod(dir + "gdb_attach", 0o755)
with open(dir + "gdb_run", "w") as f: with open(dir + "gdb_run", "w") as f:
f.write("#!/bin/bash\n") f.write("#!/bin/bash\n")
@ -443,7 +446,7 @@ def dump_dbg_scripts():
f.write(")\n") f.write(")\n")
dump_dbg_env(f) dump_dbg_env(f)
f.write("\t\"" + wine_path + "\" winedbg --gdb \"${@:-${DEF_CMD[@]}}\"\n") f.write("\t\"" + wine_path + "\" winedbg --gdb \"${@:-${DEF_CMD[@]}}\"\n")
os.chmod(dir + "gdb_run", 0755) os.chmod(dir + "gdb_run", 0o755)
with open(dir + "run", "w") as f: with open(dir + "run", "w") as f:
f.write("#!/bin/bash\n") f.write("#!/bin/bash\n")
@ -463,7 +466,7 @@ def dump_dbg_scripts():
f.write("\t\"" + wine_path + "\" start \"${@:-${DEF_CMD[@]}}\"\n") f.write("\t\"" + wine_path + "\" start \"${@:-${DEF_CMD[@]}}\"\n")
else: else:
f.write("\t\"" + wine_path + "\" \"${@:-${DEF_CMD[@]}}\"\n") f.write("\t\"" + wine_path + "\" \"${@:-${DEF_CMD[@]}}\"\n")
os.chmod(dir + "run", 0755) os.chmod(dir + "run", 0o755)
def run(): def run():
if "PROTON_DUMP_DEBUG_COMMANDS" in os.environ: if "PROTON_DUMP_DEBUG_COMMANDS" in os.environ:
@ -477,6 +480,13 @@ def run():
else: else:
run_wine([wine_path] + sys.argv[2:]) run_wine([wine_path] + sys.argv[2:])
if sys.version_info[0] == 2:
binary_stdout = sys.stdout
elif sys.version_info[0] == 3:
binary_stdout = sys.stdout.buffer
else:
raise Exception("Unsuported python version")
#determine mode #determine mode
if sys.argv[1] == "run": if sys.argv[1] == "run":
#start target app #start target app
@ -489,11 +499,11 @@ elif sys.argv[1] == "waitforexitandrun":
elif sys.argv[1] == "getcompatpath": elif sys.argv[1] == "getcompatpath":
#linux -> windows path #linux -> windows path
path = subprocess.check_output([wine_path, "winepath", "-w", sys.argv[2]], env=env, stderr=lfile) path = subprocess.check_output([wine_path, "winepath", "-w", sys.argv[2]], env=env, stderr=lfile)
sys.stdout.write(path) binary_stdout.write(path)
elif sys.argv[1] == "getnativepath": elif sys.argv[1] == "getnativepath":
#windows -> linux path #windows -> linux path
path = subprocess.check_output([wine_path, "winepath", sys.argv[2]], env=env, stderr=lfile) path = subprocess.check_output([wine_path, "winepath", sys.argv[2]], env=env, stderr=lfile)
sys.stdout.write(path) binary_stdout.write(path)
else: else:
log("Need a verb.") log("Need a verb.")
sys.exit(1) sys.exit(1)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2.7 #!/usr/bin/env python
#to enable these settings, name this file "user_settings.py" #to enable these settings, name this file "user_settings.py"

View File

@ -1,8 +1,10 @@
#!/usr/bin/env python2 #!/usr/bin/env python
#NOTE: If you make modifications here, consider whether they should #NOTE: If you make modifications here, consider whether they should
#be duplicated in ../lsteamclient/gen_wrapper.py #be duplicated in ../lsteamclient/gen_wrapper.py
from __future__ import print_function
import pprint import pprint
import sys import sys
import clang.cindex import clang.cindex
@ -403,7 +405,7 @@ def get_capi_thunk_params(method):
def toBOOL(x): def toBOOL(x):
return "TRUE" if x else "FALSE" return "TRUE" if x else "FALSE"
returns_record = method.result_type.get_canonical().kind == clang.cindex.TypeKind.RECORD returns_record = method.result_type.get_canonical().kind == clang.cindex.TypeKind.RECORD
param_types = map(lambda x: x.type, get_params(method)) param_types = [x.type for x in get_params(method)]
if returns_record: if returns_record:
param_types.insert(0, method.result_type) param_types.insert(0, method.result_type)
param_count = len(param_types) param_count = len(param_types)
@ -970,7 +972,7 @@ for sdkver in sdk_versions:
diagnostics = list(tu.diagnostics) diagnostics = list(tu.diagnostics)
if len(diagnostics) > 0: if len(diagnostics) > 0:
print 'There were parse errors' print('There were parse errors')
pprint.pprint(diagnostics) pprint.pprint(diagnostics)
else: else:
children = list(tu.cursor.get_children()) children = list(tu.cursor.get_children())