summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'BuildTools/SCons/Tools')
-rw-r--r--BuildTools/SCons/Tools/AppBundle.py4
-rw-r--r--BuildTools/SCons/Tools/InstallWithSymLinks.py8
-rw-r--r--BuildTools/SCons/Tools/WindowsBundle.py26
-rw-r--r--BuildTools/SCons/Tools/qt4.py51
-rw-r--r--BuildTools/SCons/Tools/textfile.py175
-rw-r--r--BuildTools/SCons/Tools/wix.py8
6 files changed, 70 insertions, 202 deletions
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
@@ -34,7 +34,7 @@ def generate(env) :
"""
for key, value in infoDict.items() :
plist += "<key>" + key + "</key>\n"
- plist += "<string>" + value.encode("utf-8") + "</string>\n"
+ plist += "<string>" + value + "</string>\n"
if handlesXMPPURIs :
plist += """<key>CFBundleURLTypes</key>
<array>
@@ -50,7 +50,7 @@ def generate(env) :
if sparklePublicDSAKey :
plist += "<key>SUPublicDSAKeyFile</key>"
- plist += "<string>" + sparklePublicDSAKey.name.encode("utf-8") + "</string>"
+ plist += "<string>" + sparklePublicDSAKey.name + "</string>"
env.Install(resourcesDir, sparklePublicDSAKey)
plist += """</dict>
</plist>
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
@@ -74,21 +74,21 @@ def scons_copytree(src, dst, symlinks=False):
else:
shutil.copy2(srcname, dstname)
# XXX What about devices, sockets etc.?
- except (IOError, os.error), why:
+ except (IOError, os.error) as why:
errors.append((srcname, dstname, str(why)))
# catch the CopytreeError from the recursive copytree so that we can
# continue with other files
- except CopytreeError, err:
+ except CopytreeError as err:
errors.extend(err.args[0])
try:
shutil.copystat(src, dst)
except WindowsError:
# can't copy file access times on Windows
pass
- except OSError, why:
+ except OSError as why:
errors.extend((src, dst, str(why)))
if errors:
- raise CopytreeError, errors
+ raise CopytreeError(errors)
def symlinkBuilderImpl(target, source, env):
diff --git a/BuildTools/SCons/Tools/WindowsBundle.py b/BuildTools/SCons/Tools/WindowsBundle.py
index 20d41ff..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(ur'"([^\"]*)" "([^\"]*)"')
+ 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
@@ -83,8 +87,21 @@ def generate(env) :
qtmappings = captureWinDeployQtMapping()
assert(qtmappings)
+ # 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")
for qtlib in qtlibs:
if qtlib.startswith("Qt5"):
@@ -98,7 +115,7 @@ def generate(env) :
all_files += env.Install(bundle, src_path)
# 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:
if qt_plugin_regex.match(src_path):
plugin_folder, filename = qt_plugin_regex.match(src_path).groups()
@@ -119,4 +136,3 @@ def generate(env) :
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
@@ -37,6 +37,7 @@ __revision__ = "/home/scons/scons/branch.0/branch.96/baseline/src/engine/SCons/T
import os.path
import re
import subprocess
+from string import Template
import SCons.Action
import SCons.Builder
@@ -129,7 +130,9 @@ class _Automoc:
# The following is kind of hacky to get builders working properly (FIXME)
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
env.Moc4.env = env
@@ -137,23 +140,23 @@ class _Automoc:
out_sources = source[:]
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
if not obj.has_builder():
# binary obj file provided
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
cpp = obj.sources[0]
if not splitext(str(cpp))[1] in cxx_suffixes:
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
continue
#cpp_contents = comment.sub('', cpp.get_contents())
try:
- cpp_contents = cpp.get_contents()
+ cpp_contents = str(cpp.get_contents())
except: continue # may be an still not generated source
h=None
for h_ext in header_extensions:
@@ -163,12 +166,12 @@ class _Automoc:
h = find_file(hname, (cpp.get_dir(),), env.File)
if h:
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):
# h file with the Q_OBJECT macro found -> add moc_cpp
moc_cpp = env.Moc4(h)
@@ -176,14 +179,14 @@ class _Automoc:
out_sources.append(moc_o)
#moc_cpp.target_scanner = SCons.Defaults.CScan
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):
# cpp file with Q_OBJECT macro found -> add moc
# (to be included in cpp)
moc = env.Moc4(cpp)
env.Ignore(moc, moc)
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
# restore the original env attributes (FIXME)
objBuilder.env = objBuilderEnv
@@ -344,7 +347,7 @@ def generate(env):
else:
result.append(itemPath)
return result
- contents = node.get_contents()
+ contents = str(node.get_contents())
includes = [included[1] for included in qrcinclude_re.findall(contents)]
qrcpath = os.path.dirname(node.path)
dirs = [included for included in includes if os.path.isdir(os.path.join(qrcpath,included))]
@@ -368,8 +371,30 @@ def generate(env):
env.Append( BUILDERS = { 'Qrc': qrcbuilder } )
# 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',
suffix='$QT4_UICDECLSUFFIX',
prefix='$QT4_UICDECLPREFIX',
diff --git a/BuildTools/SCons/Tools/textfile.py b/BuildTools/SCons/Tools/textfile.py
deleted file mode 100644
index 89f8963..0000000
--- a/BuildTools/SCons/Tools/textfile.py
+++ /dev/null
@@ -1,175 +0,0 @@
-# -*- python -*-
-#
-# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__doc__ = """
-Textfile/Substfile builder for SCons.
-
- Create file 'target' which typically is a textfile. The 'source'
- may be any combination of strings, Nodes, or lists of same. A
- 'linesep' will be put between any part written and defaults to
- os.linesep.
-
- The only difference between the Textfile builder and the Substfile
- builder is that strings are converted to Value() nodes for the
- former and File() nodes for the latter. To insert files in the
- former or strings in the latter, wrap them in a File() or Value(),
- respectively.
-
- The values of SUBST_DICT first have any construction variables
- expanded (its keys are not expanded). If a value of SUBST_DICT is
- a python callable function, it is called and the result is expanded
- as the value. Values are substituted in a "random" order; if any
- substitution could be further expanded by another subsitition, it
- is unpredictible whether the expansion will occur.
-"""
-
-__revision__ = "src/engine/SCons/Tool/textfile.py 5357 2011/09/09 21:31:03 bdeegan"
-
-import SCons
-
-import os
-import re
-
-from SCons.Node import Node
-from SCons.Node.Python import Value
-from SCons.Util import is_String, is_Sequence, is_Dict
-
-def _do_subst(node, subs):
- """
- Fetch the node contents and replace all instances of the keys with
- their values. For example, if subs is
- {'%VERSION%': '1.2345', '%BASE%': 'MyProg', '%prefix%': '/bin'},
- then all instances of %VERSION% in the file will be replaced with
- 1.2345 and so forth.
- """
- contents = node.get_text_contents()
- if not subs: return contents
- for (k,v) in subs:
- contents = re.sub(k, v, contents)
- return contents
-
-def _action(target, source, env):
- # prepare the line separator
- linesep = env['LINESEPARATOR']
- if linesep is None:
- linesep = os.linesep
- elif is_String(linesep):
- pass
- elif isinstance(linesep, Value):
- linesep = linesep.get_text_contents()
- else:
- raise SCons.Errors.UserError(
- 'unexpected type/class for LINESEPARATOR: %s'
- % repr(linesep), None)
-
- # create a dictionary to use for the substitutions
- if 'SUBST_DICT' not in env:
- subs = None # no substitutions
- else:
- d = env['SUBST_DICT']
- if is_Dict(d):
- d = list(d.items())
- elif is_Sequence(d):
- pass
- else:
- raise SCons.Errors.UserError('SUBST_DICT must be dict or sequence')
- subs = []
- for (k,v) in d:
- if callable(v):
- v = v()
- if is_String(v):
- v = env.subst(v)
- else:
- v = str(v)
- subs.append((k,v))
-
- # write the file
- try:
- fd = open(target[0].get_path(), "wb")
- except (OSError,IOError), e:
- raise SCons.Errors.UserError("Can't write target file %s" % target[0])
- # separate lines by 'linesep' only if linesep is not empty
- lsep = None
- for s in source:
- if lsep: fd.write(lsep)
- fd.write(_do_subst(s, subs))
- lsep = linesep
- fd.close()
-
-def _strfunc(target, source, env):
- return "Creating '%s'" % target[0]
-
-def _convert_list_R(newlist, sources):
- for elem in sources:
- if is_Sequence(elem):
- _convert_list_R(newlist, elem)
- elif isinstance(elem, Node):
- newlist.append(elem)
- else:
- newlist.append(Value(elem))
-def _convert_list(target, source, env):
- if len(target) != 1:
- raise SCons.Errors.UserError("Only one target file allowed")
- newlist = []
- _convert_list_R(newlist, source)
- return target, newlist
-
-_common_varlist = ['SUBST_DICT', 'LINESEPARATOR']
-
-_text_varlist = _common_varlist + ['TEXTFILEPREFIX', 'TEXTFILESUFFIX']
-_text_builder = SCons.Builder.Builder(
- action = SCons.Action.Action(_action, _strfunc, varlist = _text_varlist),
- source_factory = Value,
- emitter = _convert_list,
- prefix = '$TEXTFILEPREFIX',
- suffix = '$TEXTFILESUFFIX',
- )
-
-_subst_varlist = _common_varlist + ['SUBSTFILEPREFIX', 'TEXTFILESUFFIX']
-_subst_builder = SCons.Builder.Builder(
- action = SCons.Action.Action(_action, _strfunc, varlist = _subst_varlist),
- source_factory = SCons.Node.FS.File,
- emitter = _convert_list,
- prefix = '$SUBSTFILEPREFIX',
- suffix = '$SUBSTFILESUFFIX',
- src_suffix = ['.in'],
- )
-
-def generate(env):
- env['LINESEPARATOR'] = os.linesep
- env['BUILDERS']['MyTextfile'] = _text_builder
- env['TEXTFILEPREFIX'] = ''
- env['TEXTFILESUFFIX'] = '.txt'
- env['BUILDERS']['MySubstfile'] = _subst_builder
- env['SUBSTFILEPREFIX'] = ''
- env['SUBSTFILESUFFIX'] = ''
-
-def exists(env):
- return 1
-
-# Local Variables:
-# tab-width:4
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/BuildTools/SCons/Tools/wix.py b/BuildTools/SCons/Tools/wix.py
index 907b6d9..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 ]
@@ -38,7 +41,7 @@ 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',
src_builder = candle_builder)
@@ -48,4 +51,3 @@ def generate(env) :
def exists(env) :
return True
-