diff options
| -rw-r--r-- | BuildTools/SCons/Tools/WindowsBundle.py | 8 | ||||
| -rw-r--r-- | BuildTools/SCons/Tools/wix.py | 5 | ||||
| -rw-r--r-- | Swift/QtUI/SConscript | 12 |
3 files changed, 19 insertions, 6 deletions
diff --git a/BuildTools/SCons/Tools/WindowsBundle.py b/BuildTools/SCons/Tools/WindowsBundle.py index 4d73fa3..9781deb 100644 --- a/BuildTools/SCons/Tools/WindowsBundle.py +++ b/BuildTools/SCons/Tools/WindowsBundle.py @@ -27,21 +27,25 @@ def generate(env) : p = subprocess.Popen(['windeployqt', '--release', '--dry-run', '--list', 'mapping', 'Swift.exe'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=environ) else: p = subprocess.Popen(['windeployqt', '--debug', '--dry-run', '--list', 'mapping', 'Swift.exe'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=environ) if p: stdout, stderr = p.communicate() mappings = [] - p = re.compile(r'"([^\"]*)" "([^\"]*)"') + regex = re.compile(r'"([^\"]*)" "([^\"]*)"') + + if SCons.Util.PY3: + matches = re.findall(regex, stdout.decode('utf8')) + else: + matches = re.findall(regex, stdout) - matches = re.findall(p, stdout) for match in matches: mappings.append(match) return mappings else: return False def createWindowsBundleManual(env, bundle, resources = {}, qtplugins = {}, qtlibs = [], qtversion = '4') : all_files = [] all_files += env.Install(bundle, bundle + ".exe") diff --git a/BuildTools/SCons/Tools/wix.py b/BuildTools/SCons/Tools/wix.py index 889afe4..986ea23 100644 --- a/BuildTools/SCons/Tools/wix.py +++ b/BuildTools/SCons/Tools/wix.py @@ -9,19 +9,22 @@ def generate(env) : env['WIX_HEAT'] = wixPath + 'heat.exe' env['WIX_HEAT_OPTIONS'] = '-nologo -ag -sfrag -suid -template fragment -dr ProgramFilesFolder' env['WIX_CANDLE'] = wixPath + 'candle.exe' env['WIX_CANDLE_OPTIONS'] = '-nologo' env['WIX_LIGHT'] = wixPath + 'light.exe' env['WIX_LIGHT_OPTIONS'] = '-nologo -ext WixUIExtension' def WiX_IncludeScanner(source, env, path, arg): wixIncludeRegexp = re.compile(r'^\s*\<\?include (\S+.wxs)\s*\?\>\S*', re.M) - contents = source.get_contents() + if SCons.Util.PY3: + contents = source.get_contents().decode("utf8") + else: + contents = source.get_contents() includes = wixIncludeRegexp.findall(contents) return [ "" + include for include in includes ] heat_builder = SCons.Builder.Builder( action = '"$WIX_HEAT" dir "$WIX_SOURCE_OBJECT_DIR" -cg Files $WIX_HEAT_OPTIONS -o ${TARGET} -t Swift\\Packaging\\WiX\\include.xslt', suffix = '.wxi') candle_scanner = env.Scanner(name = 'wixincludefile', diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index 584cfea..96979c0 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -1,11 +1,12 @@ import os, datetime, re, time import Version +import SCons.Util def generateQRCTheme(dir, prefix) : sourceDir = dir.abspath result = "<!-- WARNING: This file is automatically generated. Any changes will be overwritten. -->\n" result += "<RCC version =\"1.0\">" result += "<qresource prefix=\"/themes/" + prefix + "\">" for (path, dirs, files) in os.walk(sourceDir) : #skip the Noto emoji fonts in Windows. No need to package them since they aren't used if "Noto" in path and not env["PLATFORM"] == "linux" : @@ -469,23 +470,28 @@ if env["PLATFORM"] == "win32" : if env["DIST"] : #myenv.Append(NSIS_OPTIONS = [ # "/DmsvccRedistributableDir=\"" + env["vcredist"] + "\"", # "/DbuildVersion=" + myenv["SWIFT_VERSION"] # ]) #myenv.Nsis("../Packaging/nsis/swift.nsi") if env["SCONS_STAGE"] == "build" and env.get("wix_bindir", None): def convertToRTF(env, target, source) : - infile = open(source[0].abspath, 'r') - outfile = open(target[0].abspath, 'w') + if SCons.Util.PY3: + infile = open(source[0].abspath, 'r', encoding="utf8") + outfile = open(target[0].abspath, 'w', encoding="utf8") + else: + infile = open(source[0].abspath, 'r') + outfile = open(target[0].abspath, 'w') outfile.write('{\\rtf1\\ansi{\\fonttbl\\f0\\fswiss Helvetica;}\\fs16\\f0\\pard\n') for line in infile: - for char in line.decode("utf-8") : + line = line if SCons.Util.PY3 else line.decode("utf-8") + for char in line : if ord(char) > 127 : # FIXME: This is incorrect, because it only works for latin1. # The correct way is \u<decimal utf16 point>? , but this is more # work outfile.write("\\'%X" % ord(char)) else : outfile.write(char) outfile.write('\\par ') outfile.write('}') |
Swift