summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'BuildTools')
-rwxr-xr-xBuildTools/CheckHeaders.py2
-rwxr-xr-xBuildTools/CheckTranslations.py8
-rwxr-xr-xBuildTools/Copyright/find-contribs.py6
-rwxr-xr-xBuildTools/Copyrighter.py16
-rw-r--r--BuildTools/CrashReportAnalysis/WindowsMinidumpAnalyse.py10
-rw-r--r--BuildTools/DocBook/SCons/XSLT.py2
-rwxr-xr-xBuildTools/FixIncludes.py4
-rwxr-xr-xBuildTools/GenerateAppCastFeeds.py2
-rwxr-xr-xBuildTools/GetBuildVersion.py2
-rwxr-xr-xBuildTools/Gource/GetGravatars.py14
-rwxr-xr-xBuildTools/ProjectCopyrightSummary.py2
-rw-r--r--BuildTools/SCons/SConscript.boot16
-rw-r--r--BuildTools/SCons/SConstruct62
-rw-r--r--BuildTools/SCons/Tools/AppBundle.py4
-rw-r--r--BuildTools/SCons/Tools/InstallWithSymLinks.py8
-rw-r--r--BuildTools/SCons/Tools/WindowsBundle.py20
-rw-r--r--BuildTools/SCons/Tools/qt4.py51
-rw-r--r--BuildTools/SCons/Tools/textfile.py8
-rw-r--r--BuildTools/SCons/Tools/wix.py3
-rw-r--r--BuildTools/SCons/Version.py2
-rw-r--r--BuildTools/TranslationCoverage.xslt50
-rwxr-xr-xBuildTools/UpdateDebianChangelog.py3
-rwxr-xr-xBuildTools/scons2ninja.py24
23 files changed, 211 insertions, 108 deletions
diff --git a/BuildTools/CheckHeaders.py b/BuildTools/CheckHeaders.py
index 79ff85c..752d257 100755
--- a/BuildTools/CheckHeaders.py
+++ b/BuildTools/CheckHeaders.py
@@ -38,3 +38,3 @@ for line in file.readlines() :
if forbiddenInclude in line and len([x for x in ignores if x in filename]) == 0 :
- print "Found " + forbiddenInclude + " include in " + filename
+ print("Found " + forbiddenInclude + " include in " + filename)
foundBadHeaders = True
diff --git a/BuildTools/CheckTranslations.py b/BuildTools/CheckTranslations.py
index 615f81f..0617fba 100755
--- a/BuildTools/CheckTranslations.py
+++ b/BuildTools/CheckTranslations.py
@@ -43,8 +43,8 @@ for filename in os.listdir("Swift/Translations") :
if translationPlaceholders != sourcePlaceholders :
- print "[Error] " + filename + ": Placeholder mismatch in translation '" + sourceText + "'"
+ print("[Error] " + filename + ": Placeholder mismatch in translation '" + sourceText + "'")
if not finished :
- print "[Warning] " + filename + ": Unfinished"
+ print("[Warning] " + filename + ": Unfinished")
if language not in desktop_generic_names and language != "en" :
- print "[Warning] GenericName field missing in desktop entry for " + language
+ print("[Warning] GenericName field missing in desktop entry for " + language)
if language not in desktop_comments and language != "en" :
- print "[Warning] Comment field missing in desktop entry for " + language
+ print("[Warning] Comment field missing in desktop entry for " + language)
diff --git a/BuildTools/Copyright/find-contribs.py b/BuildTools/Copyright/find-contribs.py
index ac30afb..799ae7b 100755
--- a/BuildTools/Copyright/find-contribs.py
+++ b/BuildTools/Copyright/find-contribs.py
@@ -48,3 +48,3 @@ full_swiften_log = subprocess.check_output(["git", "log", "--", "Swiften"])
-print "Contributors for Swiften/ subtree:\n"
+print("Contributors for Swiften/ subtree:\n")
print_log(full_swiften_log)
@@ -53,5 +53,5 @@ full_all_log = subprocess.check_output(["git", "log"])
-print "\n\n\n\n"
+print("\n\n\n\n")
-print "Contributors for full tree:\n"
+print("Contributors for full tree:\n")
print_log(full_all_log)
diff --git a/BuildTools/Copyrighter.py b/BuildTools/Copyrighter.py
index a16050c..4c7bfeb 100755
--- a/BuildTools/Copyrighter.py
+++ b/BuildTools/Copyrighter.py
@@ -10,3 +10,3 @@ LICENSE_DIR = "Documentation/Licenses"
# The following regex parses license comment blocks and its part out of a complete source file.
-reParseLicenseCommentBlocks = re.compile(ur'(\/\*\n\s\*\sCopyright \(c\) (?P<startYear>\d\d\d\d)(-(?P<endYear>\d\d\d\d))? (?P<author>[^\n\.]*)\.?\n.\* (?P<license>[^\n]*)\n \* (?P<seeMore>[^\n]+)\n *\*\/)')
+reParseLicenseCommentBlocks = re.compile(r'(\/\*\n\s\*\sCopyright \(c\) (?P<startYear>\d\d\d\d)(-(?P<endYear>\d\d\d\d))? (?P<author>[^\n\.]*)\.?\n.\* (?P<license>[^\n]*)\n \* (?P<seeMore>[^\n]+)\n *\*\/)')
@@ -124,6 +124,6 @@ def check_copyright(filename, hints) :
if hints :
- print "Copyright block for " + copyrightSetting.author + " does not cover current year in: " + filename
+ print("Copyright block for " + copyrightSetting.author + " does not cover current year in: " + filename)
return False
if hints :
- print "Missing copyright block for " + copyrightSetting.author + " in: " + filename
+ print("Missing copyright block for " + copyrightSetting.author + " in: " + filename)
return False
@@ -131,3 +131,3 @@ def check_copyright(filename, hints) :
if hints :
- print "No copyright found in: " + filename
+ print("No copyright found in: " + filename)
return False
@@ -142,3 +142,3 @@ def set_or_update_copyright(filename) :
if check_copyright(filename, False) :
- print "No update required for file: " + filename
+ print("No update required for file: " + filename)
else :
@@ -163,3 +163,3 @@ def set_or_update_copyright(filename) :
def print_help() :
- print """Usage:
+ print("""Usage:
Copyrighter.py check-copyright $filename
@@ -174,3 +174,3 @@ def print_help() :
$license are default, mit and gpl.
- """
+ """)
@@ -185,3 +185,3 @@ elif sys.argv[1] == "set-copyright" :
else :
- print "Unknown command: " + sys.argv[1]
+ print("Unknown command: " + sys.argv[1])
print_help()
diff --git a/BuildTools/CrashReportAnalysis/WindowsMinidumpAnalyse.py b/BuildTools/CrashReportAnalysis/WindowsMinidumpAnalyse.py
index dada920..19e5f87 100644
--- a/BuildTools/CrashReportAnalysis/WindowsMinidumpAnalyse.py
+++ b/BuildTools/CrashReportAnalysis/WindowsMinidumpAnalyse.py
@@ -5,3 +5,3 @@
# - cdb, the Windows command line debugger installed and available in PATH.
-# - the SWIFT_DIST environment variable set to a locatioon that contains msi and pdb.gz files.
+# - the SWIFT_DIST environment variable set to a location that contains msi and pdb.gz files.
@@ -21,3 +21,3 @@ swiftWindowBuildsPathPrefix = os.getenv("SWIFT_DIST")
if swiftWindowBuildsPathPrefix == None :
- print "Please set the SWIFT_DIST environment variable to a location containing msi and pdb.gz files."
+ print("Please set the SWIFT_DIST environment variable to a location containing msi and pdb.gz files.")
sys.exit(1)
@@ -25,3 +25,3 @@ if swiftWindowBuildsPathPrefix == None :
if len(sys.argv) != 3:
- print "Usage: python WindowsMinidumpAnalyse.py VERSION MINIDUMP_FILE"
+ print("Usage: python WindowsMinidumpAnalyse.py VERSION MINIDUMP_FILE")
sys.exit(1)
@@ -95,3 +95,3 @@ try:
except:
- print ""
+ print("")
@@ -122,3 +122,3 @@ if not os.path.exists(symbol_cache_path):
-#print "Checking out commit {0}.".format(commit)
+#print("Checking out commit {0}.".format(commit))
call(["git", "-C", working_folder, "checkout", commit])
diff --git a/BuildTools/DocBook/SCons/XSLT.py b/BuildTools/DocBook/SCons/XSLT.py
index 38e36c5..6a40b62 100644
--- a/BuildTools/DocBook/SCons/XSLT.py
+++ b/BuildTools/DocBook/SCons/XSLT.py
@@ -10,3 +10,3 @@ def generate(env) :
if not env.has_key("XSLTSTYLESHEET") :
- raise SCons.Errors.UserError, "The XSLTSTYLESHEET construction variable must be defined"
+ raise SCons.Errors.UserError("The XSLTSTYLESHEET construction variable must be defined")
diff --git a/BuildTools/FixIncludes.py b/BuildTools/FixIncludes.py
index 8984944..e532464 100755
--- a/BuildTools/FixIncludes.py
+++ b/BuildTools/FixIncludes.py
@@ -155,3 +155,3 @@ for line in content[headerStart:headerEnd]:
if containsComplexPreprocessorDirectives:
- print "Cannot format headers containing preprocessor #if, #pragma, #define or #undef statements!"
+ print("Cannot format headers containing preprocessor #if, #pragma, #define or #undef statements!")
exit(1)
@@ -160,3 +160,3 @@ if filename_base.endswith(".h"):
if not HeaderType.PRAGMA_ONCE in headerGroups:
- print "Missing #pragma once!"
+ print("Missing #pragma once!")
exit(2)
diff --git a/BuildTools/GenerateAppCastFeeds.py b/BuildTools/GenerateAppCastFeeds.py
index 8135134..e7493df 100755
--- a/BuildTools/GenerateAppCastFeeds.py
+++ b/BuildTools/GenerateAppCastFeeds.py
@@ -150,3 +150,3 @@ writeAppcastFile(filename=os.path.join(args.outputFolder, "swift-development-app
description="",
- regexPattern="^\d+(\.\d+)?(\.\d+)?(alpha)?(beta\d+)?(rc\d+)?(-dev\d+)?$",
+ regexPattern="^\d+(\.\d+)?(\.\d+)?(alpha\d*)?(beta\d+)?(rc\d+)?(-dev\d+)?$",
appcastURL=urlparse.urljoin(args.downloadsURL, "swift-development-appcast-mac.xml"),
diff --git a/BuildTools/GetBuildVersion.py b/BuildTools/GetBuildVersion.py
index 70fdc5c..be7cc03 100755
--- a/BuildTools/GetBuildVersion.py
+++ b/BuildTools/GetBuildVersion.py
@@ -18,3 +18,3 @@ if only_major :
else :
- print "0"
+ print("0")
else :
diff --git a/BuildTools/Gource/GetGravatars.py b/BuildTools/Gource/GetGravatars.py
index d1f40a4..17198aa 100755
--- a/BuildTools/Gource/GetGravatars.py
+++ b/BuildTools/Gource/GetGravatars.py
@@ -7,3 +7,3 @@ GRAVATAR_URL = "http://www.gravatar.com/avatar/%(id)s?d=404"
if len(sys.argv) != 2 :
- print "Usage: " + sys.argv[0] + " <output-dir>"
+ print("Usage: " + sys.argv[0] + " <output-dir>")
sys.exit(-1)
@@ -20,3 +20,3 @@ p.stdin.close()
if p.wait() != 0 :
- print "Error"
+ print("Error")
sys.exit(-1)
@@ -27,6 +27,6 @@ if not os.path.isdir(output_dir) :
for email, name in authors.items() :
- print "Processing avatar for " + name + " <" + email + ">"
+ print("Processing avatar for " + name + " <" + email + ">")
filename = os.path.join(output_dir, name + ".png")
if os.path.isfile(filename) :
- print "-> Already there. Skipping."
+ print("-> Already there. Skipping.")
continue
@@ -36,3 +36,3 @@ for email, name in authors.items() :
url = GRAVATAR_URL % {"id" : m.hexdigest()}
- print "- Downloading " + url
+ print("- Downloading " + url)
f = urllib.urlopen(url)
@@ -43,3 +43,3 @@ for email, name in authors.items() :
if input :
- print "- Saving file " + filename
+ print("- Saving file " + filename)
f = open(filename, "w")
@@ -48,2 +48,2 @@ for email, name in authors.items() :
else :
- print "- No Gravatar found"
+ print("- No Gravatar found")
diff --git a/BuildTools/ProjectCopyrightSummary.py b/BuildTools/ProjectCopyrightSummary.py
index 6e2d824..f6b18a0 100755
--- a/BuildTools/ProjectCopyrightSummary.py
+++ b/BuildTools/ProjectCopyrightSummary.py
@@ -19,3 +19,3 @@ def CopyrightNames(filename):
data = file.read()
- p = re.compile(ur'\* Copyright.*\d\d\d\d (.*?)\.?$', re.MULTILINE)
+ p = re.compile(r'\* Copyright.*\d\d\d\d (.*?)\.?$', re.MULTILINE)
names = re.findall(p, data)
diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot
index 3b21dde..411fb7d 100644
--- a/BuildTools/SCons/SConscript.boot
+++ b/BuildTools/SCons/SConscript.boot
@@ -39,3 +39,4 @@ if os.name == "mac" or (os.name == "posix" and os.uname()[0] == "Darwin"):
if os.name == "nt" :
- vars.Add(PathVariable("vcredist", "MSVC redistributable dir", None, PathVariable.PathAccept))
+ vars.Add(PathVariable("vcredist", "MSVC redistributable path", None, PathVariable.PathAccept))
+ vars.Add(PathVariable("vcredistdir", "MSVC redistributable dir", None, PathVariable.PathAccept))
if os.name == "nt" :
@@ -109,2 +110,3 @@ vars.Add(BoolVariable("experimental", "Build experimental features", "no"))
vars.Add(BoolVariable("set_iterator_debug_level", "Set _ITERATOR_DEBUG_LEVEL=0", "yes"))
+vars.Add(EnumVariable("msvc_runtime", "Choose MSVC runtime library", "MD", ["MT", "MTd", "MD", "MDd"]))
vars.Add(BoolVariable("unbound", "Build bundled ldns and unbound. Use them for DNS lookup.", "no"))
@@ -251,2 +253,5 @@ env["OBJCCFLAGS"] = []
+if env["PLATFORM"] != "win32" :
+ env.AppendUnique(CCFLAGS=['-isystem', Dir('#').abspath + '/Backport/'])
+
# Compile code as C++11
@@ -274,7 +279,9 @@ if env["debug"] :
env.Append(LINKFLAGS = ["/OPT:NOREF"])
- env.Append(CCFLAGS = ["/MD"])
else :
env.Append(CCFLAGS = ["-g"])
-elif env["PLATFORM"] == "win32" :
- env.Append(CCFLAGS = ["/MD"])
+
+if env["PLATFORM"] == "win32" :
+ env.AppendUnique(CCFLAGS = ["/{}".format(env.get("msvc_runtime"))])
+ # debug builds against debug MSVC runtime can cause some more sections in the object file
+ env.AppendUnique(CCFLAGS = ["/bigobj"])
@@ -365,3 +372,2 @@ else :
- "-Wno-inconsistent-missing-destructor-override", # FIXME: fix source code issues regarding this warning later
"-Wno-shadow-field", # FIXME: fix source code issues regarding this warning later
diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 6d63d5b..78f388b 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -9,5 +9,5 @@ root = Dir("../..").abspath
oldSConscript = SConscript
-def SConscript(*arguments, **keywords) :
- if not keywords.get("test_only", False) or env["TEST"] :
- return apply(oldSConscript, arguments, keywords)
+def SConscript(*args, **kwargs) :
+ if not kwargs.get("test_only", False) or env["TEST"] :
+ return oldSConscript(*args, **kwargs)
env.SConscript = SConscript
@@ -144,3 +144,3 @@ conf = Configure(conf_env, custom_tests = {
if not conf.CheckCXX() or not conf.CheckCC() :
- print "Error: You need a working compiler"
+ print("Error: You need a working compiler")
Exit(1)
@@ -148,3 +148,3 @@ if not conf.CheckCXX() or not conf.CheckCC() :
if not conf.CheckCpp11Support() :
- print "Error: You need a compiler with support for the C++11 standard"
+ print("Error: You need a compiler with support for the C++11 standard")
Exit(1)
@@ -172,3 +172,3 @@ if zlib_okay :
elif not env.get("zlib_bundled_enable", True) :
- print "Error: Zlib not found and zlib_bundled_enable is false"
+ print("Error: Zlib not found and zlib_bundled_enable is false")
Exit(1)
@@ -240,3 +240,3 @@ if not env.get("boost_force_bundled") and allLibsPresent :
elif not env.get("boost_bundled_enable", True) :
- print "Error: Boost not found and boost_bundled_enable is false"
+ print("Error: Boost not found and boost_bundled_enable is false")
Exit(1)
@@ -375,3 +375,3 @@ bundledExpat = False
if not env.get("HAVE_EXPAT", 0) and not env.get("HAVE_LIBXML", 0) :
- print "Expat or LibXML not found. Using bundled Expat"
+ print("Expat or LibXML not found. Using bundled Expat")
SConscript("#/3rdParty/Expat/SConscript")
@@ -426,6 +426,6 @@ if not env.get("HAVE_ICU", False) and not env.get("HAVE_LIBIDN", False) :
elif env.get("need_idn", True):
- print "Error: ICU and LIBIDN not found, and libidn_bundled_enable is false"
+ print("Error: ICU and LIBIDN not found, and libidn_bundled_enable is false")
Exit(1)
else:
- print "Proceeding without an IDN library because need_idn was false. This will break all internal binaries"
+ print("Proceeding without an IDN library because need_idn was false. This will break all internal binaries")
@@ -516,3 +516,3 @@ if not env.get("lua_force_bundled", False) and conf.CheckLibWithHeader(env["lua_
else :
- print "Warning: Unable to determine Lua version. Not installing Lua libraries."
+ print("Warning: Unable to determine Lua version. Not installing Lua libraries.")
env["LUA_FLAGS"].update(lua_flags)
@@ -556,2 +556,6 @@ if env["qt"] :
+if env["PLATFORM"] == "win32" :
+ systemIncludeFlag = "/I"
+else:
+ systemIncludeFlag = "-isystem"
@@ -585,5 +589,5 @@ elif env.get("tls_backend") == "openssl" :
if openssl_include:
- openssl_flags = {"CPPPATH":[openssl_include]}
+ openssl_flags = { "CPPFLAGS": [systemIncludeFlag + openssl_include]}
else:
- openssl_flags = { "CPPPATH": [os.path.join(openssl_prefix, "include")] }
+ openssl_flags = { "CPPFLAGS": [systemIncludeFlag + os.path.join(openssl_prefix, "include")] }
if openssl_libdir:
@@ -668,3 +672,3 @@ except SCons.Errors.StopError:
except Exception as e:
- print "Info: %s" % str(e)
+ print("Info: %s" % str(e))
env["HAVE_QT"] = False
@@ -690,3 +694,3 @@ try:
except TypeError:
- print "You seem to be using Swift in a Git submodule. Not installing hooks."
+ print("You seem to be using Swift in a Git submodule. Not installing hooks.")
@@ -705,2 +709,4 @@ if ARGUMENTS.get("replace_pragma_once", False) :
for actual_root, dirs, files in os.walk(root) :
+ dirs.sort()
+ files.sort()
if "3rdParty" in actual_root :
@@ -731,3 +737,3 @@ modules = []
if os.path.isdir(Dir("#/3rdParty").abspath) :
- for dir in os.listdir(Dir("#/3rdParty").abspath) :
+ for dir in sorted(os.listdir(Dir("#/3rdParty").abspath)) :
full_dir = os.path.join(Dir("#/3rdParty").abspath, dir)
@@ -738,3 +744,3 @@ if os.path.isdir(Dir("#/3rdParty").abspath) :
modules.append("3rdParty/" + dir)
-for dir in os.listdir(Dir("#").abspath) :
+for dir in sorted(os.listdir(Dir("#").abspath)) :
full_dir = os.path.join(Dir("#").abspath, dir)
@@ -754,3 +760,3 @@ for stage in ["flags", "build"] :
env["SCONS_STAGE"] = stage
- SConscript(dirs = map(lambda x : root + "/" + x, modules))
+ SConscript(dirs = list(map(lambda x : root + "/" + x, modules)))
@@ -766,5 +772,5 @@ if ARGUMENTS.get("sloccount", False) :
-print
-print " Build Configuration"
-print " -------------------"
+print("")
+print(" Build Configuration")
+print(" -------------------")
@@ -777,12 +783,12 @@ if env.get("HAVE_EXPAT", 0):
parsers.append("(Bundled)")
-print " Projects: " + ' '.join(env["PROJECTS"])
-print ""
-print " XML Parsers: " + ' '.join(parsers)
+print(" Projects: " + ' '.join(env["PROJECTS"]))
+print("")
+print(" XML Parsers: " + ' '.join(parsers))
-print " TLS Support: " + (env.get("HAVE_OPENSSL",0) and "OpenSSL" or env.get("HAVE_SECURETRANSPORT",0) and "Secure Transport" or env.get("HAVE_SCHANNEL", 0) and "Schannel" or "Disabled")
-print " DNSSD Support: " + (env.get("HAVE_BONJOUR") and "Bonjour" or (env.get("HAVE_AVAHI") and "Avahi" or "Disabled"))
-print
+print(" TLS Support: " + (env.get("HAVE_OPENSSL",0) and "OpenSSL" or env.get("HAVE_SECURETRANSPORT",0) and "Secure Transport" or env.get("HAVE_SCHANNEL", 0) and "Schannel" or "Disabled"))
+print(" DNSSD Support: " + (env.get("HAVE_BONJOUR") and "Bonjour" or (env.get("HAVE_AVAHI") and "Avahi" or "Disabled")))
+print("")
if not GetOption("help") and not env.get("HAVE_OPENSSL", 0) and not env.get("HAVE_SCHANNEL", 0) and not env.get("HAVE_SECURETRANSPORT", 0):
- print "Error: A working TLS backend is required. Please check the documentation for more information."
+ print("Error: A working TLS backend is required. Please check the documentation for more information.")
Exit(1)
diff --git a/BuildTools/SCons/Tools/AppBundle.py b/BuildTools/SCons/Tools/AppBundle.py
index 337e83f..31cfef1 100644
--- a/BuildTools/SCons/Tools/AppBundle.py
+++ b/BuildTools/SCons/Tools/AppBundle.py
@@ -36,3 +36,3 @@ def generate(env) :
plist += "<key>" + key + "</key>\n"
- plist += "<string>" + value.encode("utf-8") + "</string>\n"
+ plist += "<string>" + value + "</string>\n"
if handlesXMPPURIs :
@@ -52,3 +52,3 @@ def generate(env) :
plist += "<key>SUPublicDSAKeyFile</key>"
- plist += "<string>" + sparklePublicDSAKey.name.encode("utf-8") + "</string>"
+ plist += "<string>" + sparklePublicDSAKey.name + "</string>"
env.Install(resourcesDir, sparklePublicDSAKey)
diff --git a/BuildTools/SCons/Tools/InstallWithSymLinks.py b/BuildTools/SCons/Tools/InstallWithSymLinks.py
index 23d12ed..4955192 100644
--- a/BuildTools/SCons/Tools/InstallWithSymLinks.py
+++ b/BuildTools/SCons/Tools/InstallWithSymLinks.py
@@ -76,3 +76,3 @@ def scons_copytree(src, dst, symlinks=False):
# XXX What about devices, sockets etc.?
- except (IOError, os.error), why:
+ except (IOError, os.error) as why:
errors.append((srcname, dstname, str(why)))
@@ -80,3 +80,3 @@ def scons_copytree(src, dst, symlinks=False):
# continue with other files
- except CopytreeError, err:
+ except CopytreeError as err:
errors.extend(err.args[0])
@@ -87,6 +87,6 @@ def scons_copytree(src, dst, symlinks=False):
pass
- except OSError, why:
+ except OSError as why:
errors.extend((src, dst, str(why)))
if errors:
- raise CopytreeError, errors
+ raise CopytreeError(errors)
diff --git a/BuildTools/SCons/Tools/WindowsBundle.py b/BuildTools/SCons/Tools/WindowsBundle.py
index 20d41ff..4d73fa3 100644
--- a/BuildTools/SCons/Tools/WindowsBundle.py
+++ b/BuildTools/SCons/Tools/WindowsBundle.py
@@ -35,3 +35,3 @@ def generate(env) :
- p = re.compile(ur'"([^\"]*)" "([^\"]*)"')
+ p = re.compile(r'"([^\"]*)" "([^\"]*)"')
@@ -85,4 +85,17 @@ def generate(env) :
+ # Add QtWebKit dependencies.
+ # This is needed as QtWebKit since 5.6 is developed and released seperately
+ # of Qt and windeployqt does not know about its dependencies anymore.
+ for map_from, map_to in qtmappings:
+ if map_to == "Qt5WebKit.dll":
+ # hidden Qt5WebKit dependencies
+ hidden_dependencies = ["libxml2.dll", "libxslt.dll"]
+ for dependency in hidden_dependencies:
+ dependency_from_path = os.path.join(env["QTDIR"], "bin", dependency)
+ if os.path.isfile(dependency_from_path):
+ qtmappings.append((dependency_from_path, dependency))
+ break
+
# handle core DLLs
- qt_corelib_regex = re.compile(ur".*bin.*\\(.*)\.dll")
+ qt_corelib_regex = re.compile(r".*bin.*\\(.*)\.dll")
@@ -100,3 +113,3 @@ def generate(env) :
# handle plugins
- qt_plugin_regex = re.compile(ur".*plugins.*\\(.*)\\(.*)\.dll")
+ qt_plugin_regex = re.compile(r".*plugins.*\\(.*)\\(.*)\.dll")
for (src_path, target_path) in qtmappings:
@@ -121,2 +134 @@ def exists(env) :
return env["PLATFORM"] == "win32"
-
diff --git a/BuildTools/SCons/Tools/qt4.py b/BuildTools/SCons/Tools/qt4.py
index d5c14e2..372b261 100644
--- a/BuildTools/SCons/Tools/qt4.py
+++ b/BuildTools/SCons/Tools/qt4.py
@@ -39,2 +39,3 @@ import re
import subprocess
+from string import Template
@@ -131,3 +132,5 @@ class _Automoc:
objBuilderEnv = objBuilder.env
- objBuilder.env = env
+ objBuilder.env = env.Clone()
+ if os.path.basename(objBuilder.env ["CXX"]).startswith(("gcc", "clang")):
+ objBuilder.env.Append(CXXFLAGS = "-w")
mocBuilderEnv = env.Moc4.env
@@ -139,4 +142,4 @@ class _Automoc:
for obj in source:
- if isinstance(obj,basestring): # big kludge!
- print "scons: qt4: '%s' MAYBE USING AN OLD SCONS VERSION AND NOT CONVERTED TO 'File'. Discarded." % str(obj)
+ if isinstance(obj,str): # big kludge!
+ print("scons: qt4: '%s' MAYBE USING AN OLD SCONS VERSION AND NOT CONVERTED TO 'File'. Discarded." % str(obj))
continue
@@ -145,3 +148,3 @@ class _Automoc:
if debug:
- print "scons: qt: '%s' seems to be a binary. Discarded." % str(obj)
+ print("scons: qt: '%s' seems to be a binary. Discarded." % str(obj))
continue
@@ -150,3 +153,3 @@ class _Automoc:
if debug:
- print "scons: qt: '%s' is no cxx file. Discarded." % str(cpp)
+ print("scons: qt: '%s' is no cxx file. Discarded." % str(cpp) )
# c or fortran source
@@ -155,3 +158,3 @@ class _Automoc:
try:
- cpp_contents = cpp.get_contents()
+ cpp_contents = str(cpp.get_contents())
except: continue # may be an still not generated source
@@ -165,8 +168,8 @@ class _Automoc:
if debug:
- print "scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp))
+ print("scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp)))
#h_contents = comment.sub('', h.get_contents())
- h_contents = h.get_contents()
+ h_contents = str(h.get_contents())
break
if not h and debug:
- print "scons: qt: no header for '%s'." % (str(cpp))
+ print("scons: qt: no header for '%s'." % (str(cpp)))
if h and q_object_search.search(h_contents):
@@ -178,3 +181,3 @@ class _Automoc:
if debug:
- print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp))
+ print("scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp)))
if cpp and q_object_search.search(cpp_contents):
@@ -185,3 +188,3 @@ class _Automoc:
if debug:
- print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(cpp), str(moc))
+ print("scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(cpp), str(moc)))
#moc.source_scanner = SCons.Defaults.CScan
@@ -346,3 +349,3 @@ def generate(env):
return result
- contents = node.get_contents()
+ contents = str(node.get_contents())
includes = [included[1] for included in qrcinclude_re.findall(contents)]
@@ -370,4 +373,26 @@ def generate(env):
# Interface builder
+ def addDisableWarningsPragmaToFile(target, source, env):
+ assert( len(target) == 1 )
+ assert( len(source) == 1 )
+ srcf = str(source[0])
+ dstf = str(target[0])
+ with open(dstf, 'r+') as uiHeader:
+ data=uiHeader.read()
+
+ template = Template(
+"""#pragma once
+#pragma warning(push, 0)
+#pragma GCC system_header
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wall"
+$uiheadertext
+#pragma clang diagnostic pop
+#pragma warning(pop)
+""")
+ uiHeader.seek(0)
+ uiHeader.write(template.substitute(uiheadertext=data))
+ uiHeader.truncate()
+
uic4builder = Builder(
- action = SCons.Action.Action('$QT4_UICCOM', cmdstr = '$QT4_UICCOMSTR'),
+ action = [SCons.Action.Action('$QT4_UICCOM', cmdstr = '$QT4_UICCOMSTR'), SCons.Action.Action(addDisableWarningsPragmaToFile, None)],
src_suffix='$QT4_UISUFFIX',
diff --git a/BuildTools/SCons/Tools/textfile.py b/BuildTools/SCons/Tools/textfile.py
index cc58666..73105ad 100644
--- a/BuildTools/SCons/Tools/textfile.py
+++ b/BuildTools/SCons/Tools/textfile.py
@@ -109,3 +109,3 @@ def _action(target, source, env):
fd = open(target[0].get_path(), "wb")
- except (OSError,IOError), e:
+ except (OSError,IOError) as e:
raise SCons.Errors.UserError("Can't write target file %s" % target[0])
@@ -115,3 +115,7 @@ def _action(target, source, env):
if lsep: fd.write(lsep)
- fd.write(_do_subst(s, subs).encode("utf-8"))
+ stringtowrite = _do_subst(s, subs)
+ if isinstance(stringtowrite, str):
+ fd.write(stringtowrite)
+ elif isinstance(stringtowrite, unicode):
+ fd.write(stringtowrite.encode('utf-8'))
lsep = linesep
diff --git a/BuildTools/SCons/Tools/wix.py b/BuildTools/SCons/Tools/wix.py
index 907b6d9..889afe4 100644
--- a/BuildTools/SCons/Tools/wix.py
+++ b/BuildTools/SCons/Tools/wix.py
@@ -40,3 +40,3 @@ def generate(env) :
light_builder = SCons.Builder.Builder(
- action = '"$WIX_LIGHT" $WIX_LIGHT_OPTIONS -b "$WIX_SOURCE_OBJECT_DIR" ${SOURCES} -o ${TARGET}',
+ action = '"$WIX_LIGHT" $WIX_LIGHT_OPTIONS -b "$WIX_SOURCE_OBJECT_DIR" ${SOURCES} -loc Swift\\Packaging\\WiX\\Swift_en-us.wxl -o ${TARGET}',
src_suffix = '.wixobj',
@@ -50,2 +50 @@ def exists(env) :
return True
-
diff --git a/BuildTools/SCons/Version.py b/BuildTools/SCons/Version.py
index f215a5d..001374a 100644
--- a/BuildTools/SCons/Version.py
+++ b/BuildTools/SCons/Version.py
@@ -19,3 +19,3 @@ def git(cmd, root) :
# if error:
- # print "Git error: " + error
+ # print("Git error: " + error)
p.stdin.close()
diff --git a/BuildTools/TranslationCoverage.xslt b/BuildTools/TranslationCoverage.xslt
new file mode 100644
index 0000000..4329174
--- /dev/null
+++ b/BuildTools/TranslationCoverage.xslt
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<!--
+
+To use this XSLT, run it with xsltproc:
+
+ xsltproc BuildTools/TranslationCoverage.xslt Swift/Translations/swift_nl.ts
+
+Supported parameters:
+
+ full if set to 1 or true, generate a full report instead of the default oneliner.
+
+-->
+
+<xsl:param name="full" select="'0'" />
+<xsl:param name="filename" />
+<xsl:output method="text" />
+
+<xsl:variable name="contexts" select="count(TS/context)"/>
+<xsl:variable name="vanished" select="count(TS/context/message/translation[@type = 'vanished'])"/>
+<xsl:variable name="obsolete" select="count(TS/context/message/translation[@type = 'obsolete'])"/>
+<xsl:variable name="strings" select="count(TS/context/message/source) - $vanished - $obsolete"/>
+<xsl:variable name="translations" select="count(TS/context/message/translation[not(@type) and text()])"/>
+<xsl:variable name="missing" select="$strings - $translations"/>
+<xsl:variable name="percent_done" select="floor($translations div $strings * 100)"/>
+
+<xsl:template match="/TS">
+ <xsl:choose>
+ <xsl:when test="$full != '0' and $full != 'false'"><xsl:call-template name="full" /></xsl:when>
+ <xsl:otherwise><xsl:call-template name="terse" /></xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="terse"><xsl:value-of select="$percent_done"/>% complete, <xsl:value-of select="$vanished"/> vanished, <xsl:value-of select="$obsolete"/> obsolete, <xsl:value-of select="$missing"/> missing
+</xsl:template>
+
+<xsl:template name="full"><xsl:if test="$filename">Report for <xsl:value-of select="$filename" />:
+
+</xsl:if>Contexts: <xsl:value-of select="$contexts"/>
+Active Strings: <xsl:value-of select="$strings"/>
+Translations: <xsl:value-of select="$translations"/>, <xsl:value-of select="$percent_done"/>% complete
+Missing: <xsl:value-of select="$missing"/>
+Vanished: <xsl:value-of select="$vanished"/>
+Obsolete: <xsl:value-of select="$obsolete"/>
+
+Note: Strings and Translations do not include vanished or obsolete messages.
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/BuildTools/UpdateDebianChangelog.py b/BuildTools/UpdateDebianChangelog.py
index 1d0e3ea..d7e1f1b 100755
--- a/BuildTools/UpdateDebianChangelog.py
+++ b/BuildTools/UpdateDebianChangelog.py
@@ -22,3 +22,3 @@ if project == "" :
-if "dev" in version :
+if "dev" in version or "alpha" in version :
distribution = "development"
@@ -40,2 +40 @@ if last_version != version :
changelog.close()
-
diff --git a/BuildTools/scons2ninja.py b/BuildTools/scons2ninja.py
index 6c77c88..df4c655 100755
--- a/BuildTools/scons2ninja.py
+++ b/BuildTools/scons2ninja.py
@@ -1,3 +1,3 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
@@ -206,5 +206,5 @@ class NinjaBuilder :
if quote :
- return ' '.join([quote_spaces(x) for x in lst])
+ return ' '.join([quote_spaces(x) for x in lst])
else :
- return ' '.join([escape(x) for x in lst])
+ return ' '.join([escape(x) for x in lst])
if is_regexp(lst) :
@@ -250,4 +250,4 @@ ninja.pool('scons_pool', depth = 1)
if sys.platform == 'win32' :
- ninja.rule('cl',
- deps = 'msvc',
+ ninja.rule('cl',
+ deps = 'msvc',
command = '$cl /showIncludes $clflags -c $in /Fo$out',
@@ -371,3 +371,3 @@ for line in f.stdout :
if skip_nth_line >= 0 :
- skip_nth_line -= 1
+ skip_nth_line -= 1
if skip_nth_line == 0 :
@@ -409,3 +409,3 @@ for line in f.stdout :
if filename.startswith('[') :
- filename = filename[1:-1]
+ filename = filename[1:-1]
@@ -431,3 +431,3 @@ for line in f.stdout :
if f.wait() != 0 :
- print "Error calling '" + scons_generate_cmd + "'"
+ print("Error calling '" + scons_generate_cmd + "'")
print f.stderr.read()
@@ -530,6 +530,6 @@ for line in build_lines :
if out in mtflags :
- ninja.build(out, 'link_mt', objects, deps = sorted(deps),
+ ninja.build(out, 'link_mt', objects, deps = sorted(deps),
libs = libs, linkflags = flags, mtflags = mtflags[out])
else :
- ninja.build(out, 'link', objects, deps = sorted(deps),
+ ninja.build(out, 'link', objects, deps = sorted(deps),
libs = libs, linkflags = flags)
@@ -591,3 +591,3 @@ for line in build_lines :
basename, flags = extract_binary_flag("--basename", flags)
- ninja.build(os.path.join(outdir, basename + ".h"), 'sdef', [source],
+ ninja.build(os.path.join(outdir, basename + ".h"), 'sdef', [source],
basename = basename,
@@ -595,2 +595,4 @@ for line in build_lines :
+ elif tool == 'checker':
+ pass