Some fixes for running the build script with Python3
This commit is contained in:
@@ -16,6 +16,8 @@ import shutil
|
|||||||
import types
|
import types
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
PY3 = sys.version_info[0] == 3
|
||||||
|
|
||||||
# builder object
|
# builder object
|
||||||
wxBuilder = None
|
wxBuilder = None
|
||||||
|
|
||||||
@@ -406,7 +408,10 @@ def main(scriptName, args):
|
|||||||
|
|
||||||
mswIncludeDir = os.path.join(wxRootDir, "include", "wx", "msw")
|
mswIncludeDir = os.path.join(wxRootDir, "include", "wx", "msw")
|
||||||
setup0File = os.path.join(mswIncludeDir, "setup0.h")
|
setup0File = os.path.join(mswIncludeDir, "setup0.h")
|
||||||
setupText = open(setup0File, "rb").read()
|
with open(setup0File, "rb") as f:
|
||||||
|
setupText = f.read()
|
||||||
|
if PY3:
|
||||||
|
setupText = setupText.decode('utf-8')
|
||||||
|
|
||||||
for flag in flags:
|
for flag in flags:
|
||||||
setupText, subsMade = re.subn(flag + "\s+?\d", "%s %s" % (flag, flags[flag]), setupText)
|
setupText, subsMade = re.subn(flag + "\s+?\d", "%s %s" % (flag, flags[flag]), setupText)
|
||||||
@@ -414,9 +419,11 @@ def main(scriptName, args):
|
|||||||
print("Flag %s wasn't found in setup0.h!" % flag)
|
print("Flag %s wasn't found in setup0.h!" % flag)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
setupFile = open(os.path.join(mswIncludeDir, "setup.h"), "wb")
|
with open(os.path.join(mswIncludeDir, "setup.h"), "wb") as f:
|
||||||
setupFile.write(setupText)
|
if PY3:
|
||||||
setupFile.close()
|
setupText = setupText.encode('utf-8')
|
||||||
|
f.write(setupText)
|
||||||
|
|
||||||
args = []
|
args = []
|
||||||
if toolkit == "msvc":
|
if toolkit == "msvc":
|
||||||
print("setting build options...")
|
print("setting build options...")
|
||||||
|
Reference in New Issue
Block a user