summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2014-02-22 12:33:59 (GMT)
committerKevin Smith <git@kismith.co.uk>2014-02-22 16:25:27 (GMT)
commit989b3711186d7fe9766dffa9334d70de78666db3 (patch)
treeca282e67d6da17430f0119362fa907357c32e0bb
parentbe45135a1b1051eab02003fe54ee7e87f5f1558e (diff)
downloadswift-contrib-989b3711186d7fe9766dffa9334d70de78666db3.zip
swift-contrib-989b3711186d7fe9766dffa9334d70de78666db3.tar.bz2
Make git and wix wrappers in build system more convenient for use by other projects
Change-Id: I173f42bfe2dde7d18be3d54976649aa1bac13dbf
-rw-r--r--BuildTools/SCons/Tools/wix.py4
-rw-r--r--BuildTools/SCons/Version.py16
-rw-r--r--Swift/QtUI/SConscript1
3 files changed, 13 insertions, 8 deletions
diff --git a/BuildTools/SCons/Tools/wix.py b/BuildTools/SCons/Tools/wix.py
index 69622f6..7b62508 100644
--- a/BuildTools/SCons/Tools/wix.py
+++ b/BuildTools/SCons/Tools/wix.py
@@ -14,37 +14,37 @@ def generate(env) :
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()
includes = wixIncludeRegexp.findall(contents)
return [ "" + include for include in includes ]
heat_builder = SCons.Builder.Builder(
- action = '"$WIX_HEAT" dir Swift\\QtUI\\Swift -cg Files $WIX_HEAT_OPTIONS -o ${TARGET} -t Swift\\Packaging\\WiX\\include.xslt',
+ 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',
function = WiX_IncludeScanner,
argument = None,
skeys = ['.wxs'])
candle_builder = SCons.Builder.Builder(
action = '"$WIX_CANDLE" $WIX_CANDLE_OPTIONS ${SOURCES} -o ${TARGET}',
src_suffix = '.wxs',
suffix = '.wixobj',
source_scanner = candle_scanner,
src_builder = heat_builder)
light_builder = SCons.Builder.Builder(
- action = '"$WIX_LIGHT" $WIX_LIGHT_OPTIONS -b Swift\\QtUI\\Swift ${SOURCES} -o ${TARGET}',
+ action = '"$WIX_LIGHT" $WIX_LIGHT_OPTIONS -b "$WIX_SOURCE_OBJECT_DIR" ${SOURCES} -o ${TARGET}',
src_suffix = '.wixobj',
src_builder = candle_builder)
env['BUILDERS']['WiX_Heat'] = heat_builder
env['BUILDERS']['WiX_Candle'] = candle_builder
env['BUILDERS']['WiX_Light'] = light_builder
def exists(env) :
return True
diff --git a/BuildTools/SCons/Version.py b/BuildTools/SCons/Version.py
index 607b6f7..f98a8b9 100644
--- a/BuildTools/SCons/Version.py
+++ b/BuildTools/SCons/Version.py
@@ -1,37 +1,41 @@
import subprocess, os, datetime, re, os.path
-def getGitBuildVersion(project) :
- tag = git("describe --tags --exact --match \"" + project + "-*\"")
+def getGitBuildVersion(root, project) :
+ tag = git("describe --tags --exact --match \"" + project + "-*\"", root)
if tag :
return tag.rstrip()[len(project)+1:]
- tag = git("describe --tags --match \"" + project + "-*\"")
+ tag = git("describe --tags --match \"" + project + "-*\"", root)
if tag :
m = re.match(project + "-(.*)-(.*)-(.*)", tag)
if m :
return m.group(1) + "-dev" + m.group(2)
return None
-def git(cmd) :
- p = subprocess.Popen("git " + cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(os.name != "nt"))
+def git(cmd, root) :
+ full_cmd = "git " + cmd
+ p = subprocess.Popen(full_cmd, cwd=root, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(os.name != "nt"))
gitVersion = p.stdout.read()
+ # error = p.stderr.read()
+ # if error:
+ # print "Git error: " + error
p.stdin.close()
return gitVersion if p.wait() == 0 else None
def getBuildVersion(root, project) :
versionFilename = os.path.join(root, "VERSION." + project)
if os.path.isfile(versionFilename) :
f = open(versionFilename)
version = f.read().strip()
f.close()
return version
- gitVersion = getGitBuildVersion(project)
+ gitVersion = getGitBuildVersion(root, project)
if gitVersion :
return gitVersion
return datetime.date.today().strftime("%Y%m%d")
def convertToWindowsVersion(version) :
version_match = re.match("(\d+)\.(\d+)(.*)", version)
major = int(version_match.group(1)) if version_match else 0
minor = int(version_match.group(2)) if version_match else 0
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index 24fb371..56d2d1b 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -423,18 +423,19 @@ if env["PLATFORM"] == "win32" :
wixvariables = {
'VCCRTFile': env["vcredist"],
'Version': str(myenv["SWIFT_VERSION_MAJOR"]) + "." + str(myenv["SWIFT_VERSION_MINOR"]) + "." + str(myenv["SWIFT_VERSION_PATCH"])
}
wixincludecontent = "<Include>"
for key in wixvariables:
wixincludecontent += "<?define %s = \"%s\" ?>" % (key, wixvariables[key])
wixincludecontent += "</Include>"
myenv.WriteVal("..\\Packaging\\Wix\\variables.wxs", env.Value(wixincludecontent))
+ myenv["WIX_SOURCE_OBJECT_DIR"] = "Swift\\QtUI\\Swift"
myenv.WiX_Heat('..\\Packaging\\WiX\\gen_files.wxs', windowsBundleFiles + copying)
myenv.WiX_Candle('..\\Packaging\\WiX\\Swift.wixobj', '..\\Packaging\\WiX\\Swift.wxs')
myenv.WiX_Candle('..\\Packaging\\WiX\\gen_files.wixobj', '..\\Packaging\\WiX\\gen_files.wxs')
myenv.WiX_Light('#/Packages/Swift/Swift-' + myenv["SWIFT_VERSION"] + '.msi', ['..\\Packaging\\WiX\\gen_files.wixobj','..\\Packaging\\WiX\\Swift.wixobj'])
if myenv["debug"] :
myenv.InstallAs('#/Packages/Swift/Swift-' + myenv["SWIFT_VERSION"] + '.pdb', "Swift.pdb")