diff options
author | Giovanni Mascellani <giovanni@mascellani.eu> | 2020-11-04 14:56:12 +0300 |
---|---|---|
committer | Andrew Eikum <aeikum@codeweavers.com> | 2020-12-01 23:54:06 +0300 |
commit | 16992af05cfdf66c3cb4d00c573b2f3034b71fc1 (patch) | |
tree | 78e26969db6d237941f5273f2dc3817ec0ffdac3 | |
parent | 04af5e3d79ff27db568005291fd114b3598746a4 (diff) |
Port gen_wrapper.py to Python 3
Basically the only issue left out is that Python3 is much more picky
on file encoding, and some Valve headers are not UTF-8. Ignoring
errors is enough to get everything fixed.
-rwxr-xr-x | lsteamclient/gen_wrapper.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lsteamclient/gen_wrapper.py b/lsteamclient/gen_wrapper.py index d90d33c2..8fde253e 100755 --- a/lsteamclient/gen_wrapper.py +++ b/lsteamclient/gen_wrapper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 #NOTE: If you make modifications here, consider whether they should #be duplicated in ../vrclient/gen_wrapper.py @@ -1215,7 +1215,10 @@ prog = re.compile("^#define\s*(\w*)\s*\"(.*)\"") for sdkver in sdk_versions: iface_versions = {} for f in os.listdir("steamworks_sdk_%s" % sdkver): - x = open("steamworks_sdk_%s/%s" % (sdkver, f), "r") + # Some files from Valve have non-UTF-8 stuff in the comments + # (typically the copyright symbol); therefore we ignore UTF-8 + # encoding errors + x = open("steamworks_sdk_%s/%s" % (sdkver, f), "r", errors='replace') for l in x: if "define STEAM" in l and "_VERSION" in l: result = prog.match(l) |