summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2019-02-19 15:34:59 (GMT)
committerTobias Markmann <tm@ayena.de>2019-02-20 07:40:35 (GMT)
commit7062839cd21ba32a73ce01c920294d0f7575780b (patch)
treed44770d343476f55d258f25bf13919c79a5a105c /BuildTools/SCons/Tools
parentfafcdd573702e188873c608153900e764672648d (diff)
downloadswift-7062839cd21ba32a73ce01c920294d0f7575780b.zip
swift-7062839cd21ba32a73ce01c920294d0f7575780b.tar.bz2
Fix Python 3 Unicode issues related to Windows packaging
Test-Information: Without these fixes, the build of a Windows MSI package is not possible on Windows Server 2012. This is due to the fact that on Windows you must force UTF8 coding on file open as it defaults to Windows specific codec for everything. Tested by building a Windows MSI package on Windows Server 2012. Change-Id: I32664824188775f5ba27d9644fbbf33bf7094dfa
Diffstat (limited to 'BuildTools/SCons/Tools')
-rw-r--r--BuildTools/SCons/Tools/WindowsBundle.py8
-rw-r--r--BuildTools/SCons/Tools/wix.py5
2 files changed, 10 insertions, 3 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
@@ -33,9 +33,13 @@ def generate(env) :
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
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
@@ -15,7 +15,10 @@ def generate(env) :
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 ]