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 /Swift/QtUI/SConscript
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 'Swift/QtUI/SConscript')
-rw-r--r--Swift/QtUI/SConscript12
1 files changed, 9 insertions, 3 deletions
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index 584cfea..96979c0 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -1,5 +1,6 @@
import os, datetime, re, time
import Version
+import SCons.Util
def generateQRCTheme(dir, prefix) :
sourceDir = dir.abspath
@@ -475,11 +476,16 @@ if env["PLATFORM"] == "win32" :
#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