Separated post back build into release and debug #4464

Also related to #4463
This commit is contained in:
Nick Bolton 2015-03-21 18:38:25 +00:00
parent 0b4d480bcc
commit e0cb5bda6e
2 changed files with 215 additions and 52 deletions

View File

@ -698,33 +698,36 @@ class InternalCommands:
raise Exception('Build command not supported with generator: ' + generator)
def makeGui(self, targets, args=""):
name = "Synergy.app"
self.try_chdir(self.getGenerator().binDir)
if os.path.exists(name):
print "removing exisiting bundle"
shutil.rmtree(name)
self.restore_chdir()
for target in targets:
if sys.platform == 'win32':
gui_make_cmd = self.w32_make_cmd
elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']:
gui_make_cmd = self.make_cmd + " -w"
else:
raise Exception('Unsupported platform: ' + sys.platform)
gui_make_cmd += args
gui_make_cmd = self.w32_make_cmd + ' ' + target + args
print 'Make GUI command: ' + gui_make_cmd
if sys.platform == 'win32':
for target in targets:
self.try_chdir(self.gui_dir)
err = os.system(gui_make_cmd + ' ' + target)
err = os.system(gui_make_cmd)
self.restore_chdir()
if err != 0:
raise Exception(gui_make_cmd + ' failed with error: ' + str(err))
else:
elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']:
gui_make_cmd = self.make_cmd + " -w" + args
print 'Make GUI command: ' + gui_make_cmd
# start with a clean app bundle
targetDir = self.getGenerator().getBinDir(target)
bundleTargetDir = targetDir + '/Synergy.app'
if os.path.exists(bundleTargetDir):
shutil.rmtree(bundleTargetDir)
binDir = self.getGenerator().binDir
bundleTempDir = binDir + '/Synergy.app'
if os.path.exists(bundleTempDir):
shutil.rmtree(bundleTempDir)
self.try_chdir(self.gui_dir)
err = os.system(gui_make_cmd)
self.restore_chdir()
@ -733,8 +736,9 @@ class InternalCommands:
raise Exception(gui_make_cmd + ' failed with error: ' + str(err))
if sys.platform == 'darwin' and not "clean" in args:
for target in targets:
self.macPostMake(target)
self.macPostGuiMake(target)
else:
raise Exception('Unsupported platform: ' + sys.platform)
def symlink(self, source, target):
if not os.path.exists(target):
@ -744,36 +748,41 @@ class InternalCommands:
if os.path.exists(source):
shutil.move(source, target)
def macPostMake(self, target):
def macPostGuiMake(self, target):
dir = self.getGenerator().binDir
bundle = 'Synergy.app'
binDir = self.getGenerator().binDir
targetDir = self.getGenerator().getBinDir(target)
bundleTempDir = binDir + '/' + bundle
bundleTargetDir = targetDir + '/' + bundle
if os.path.exists(bundleTempDir):
shutil.move(bundleTempDir, bundleTargetDir)
if self.enableMakeCore:
# copy core binaries into the bundle, since the gui
# now looks for the binaries in the current app dir.
targetDir = self.getGenerator().getBinDir(target)
bundleBinDir = dir + "/Synergy.app/Contents/MacOS/"
bundleBinDir = bundleTargetDir + "/Contents/MacOS/"
shutil.copy(targetDir + "/synergyc", bundleBinDir)
shutil.copy(targetDir + "/synergys", bundleBinDir)
shutil.copy(targetDir + "/syntool", bundleBinDir)
if self.enableMakeGui:
self.loadConfig()
if not self.macIdentity:
raise Exception("run config with --mac-identity")
# use qt to copy libs to bundle so no dependencies are needed. do not create a
# dmg at this point, since we need to sign it first, and then create our own
# after signing (so that qt does not affect the signed app bundle).
bin = "macdeployqt Synergy.app -verbose=2 -codesign='" + self.macIdentity + "'"
self.try_chdir(dir)
err = os.system(bin)
self.restore_chdir()
if sys.version_info < (2, 4):
raise Exception("Python 2.4 or greater required.")
if err != 0:
raise Exception(bin + " failed with error: " + str(err))
output = os.popen(
"macdeployqt %s/Synergy.app -verbose=2 -codesign='%s'" % (
targetDir, self.macIdentity)).read()
print output
if "ERROR" in output:
raise Exception("macdeployqt failed")
def signmac(self):
print "signmac is now obsolete"
@ -1183,16 +1192,16 @@ class InternalCommands:
def distMac(self):
self.loadConfig()
dir = self.getGenerator().binDir
binDir = self.getGenerator().getBinDir('Release')
name = "Synergy"
dist = dir + "/" + name
dist = binDir + "/" + name
# ensure dist dir is clean
if os.path.exists(dist):
shutil.rmtree(dist)
os.makedirs(dist)
shutil.move(dir + "/" + name + ".app", dist + "/" + name + ".app")
shutil.move(binDir + "/" + name + ".app", dist + "/" + name + ".app")
self.try_chdir(dist)
err = os.system("ln -s /Applications")
@ -1205,7 +1214,7 @@ class InternalCommands:
cmd = "hdiutil create " + fileName + " -srcfolder ./" + name + "/ -ov"
self.try_chdir(dir)
self.try_chdir(binDir)
err = os.system(cmd)
self.restore_chdir()
@ -1376,8 +1385,9 @@ class InternalCommands:
pattern = re.escape(self.project + '-') + '\d+\.\d+\.\d+' + re.escape('-' + platform + '.' + ext)
# only use release dir if not windows
target = ''
if type == 'mac':
target = 'Release'
for filename in os.listdir(self.getBinDir(target)):
if re.search(pattern, filename):

153
temp.diff Normal file
View File

@ -0,0 +1,153 @@
diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py
index f29a721..cdd2ac6 100644
--- a/ext/toolchain/commands1.py
+++ b/ext/toolchain/commands1.py
@@ -698,43 +698,49 @@ class InternalCommands:
raise Exception('Build command not supported with generator: ' + generator)
def makeGui(self, targets, args=""):
- name = "Synergy.app"
- self.try_chdir(self.getGenerator().binDir)
- if os.path.exists(name):
- print "removing exisiting bundle"
- shutil.rmtree(name)
- self.restore_chdir()
-
- if sys.platform == 'win32':
- gui_make_cmd = self.w32_make_cmd
- elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']:
- gui_make_cmd = self.make_cmd + " -w"
- else:
- raise Exception('Unsupported platform: ' + sys.platform)
-
- gui_make_cmd += args
-
- print 'Make GUI command: ' + gui_make_cmd
+ for target in targets:
- if sys.platform == 'win32':
- for target in targets:
+ if sys.platform == 'win32':
+
+ gui_make_cmd = self.w32_make_cmd + ' ' + target + args
+ print 'Make GUI command: ' + gui_make_cmd
+
self.try_chdir(self.gui_dir)
- err = os.system(gui_make_cmd + ' ' + target)
+ err = os.system(gui_make_cmd)
self.restore_chdir()
if err != 0:
raise Exception(gui_make_cmd + ' failed with error: ' + str(err))
- else:
- self.try_chdir(self.gui_dir)
- err = os.system(gui_make_cmd)
- self.restore_chdir()
- if err != 0:
- raise Exception(gui_make_cmd + ' failed with error: ' + str(err))
+ elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']:
- if sys.platform == 'darwin' and not "clean" in args:
- for target in targets:
- self.macPostMake(target)
+ gui_make_cmd = self.make_cmd + " -w" + args
+ print 'Make GUI command: ' + gui_make_cmd
+
+ # start with a clean app bundle
+ targetDir = self.getGenerator().getBinDir(target)
+ bundleTargetDir = targetDir + '/Synergy.app'
+ print bundleTargetDir
+ if os.path.exists(bundleTargetDir):
+ shutil.rmtree(bundleTargetDir)
+
+ binDir = self.getGenerator().binDir
+ bundleTempDir = binDir + '/Synergy.app'
+ print bundleTempDir
+ if os.path.exists(bundleTempDir):
+ shutil.rmtree(bundleTempDir)
+
+ self.try_chdir(self.gui_dir)
+ err = os.system(gui_make_cmd)
+ self.restore_chdir()
+
+ if err != 0:
+ raise Exception(gui_make_cmd + ' failed with error: ' + str(err))
+
+ if sys.platform == 'darwin' and not "clean" in args:
+ self.macPostGuiMake(target)
+ else:
+ raise Exception('Unsupported platform: ' + sys.platform)
def symlink(self, source, target):
if not os.path.exists(target):
@@ -744,36 +750,51 @@ class InternalCommands:
if os.path.exists(source):
shutil.move(source, target)
- def macPostMake(self, target):
+ def macPostGuiMake(self, target):
- dir = self.getGenerator().binDir
+ bundle = 'Synergy.app'
+ binDir = self.getGenerator().binDir
+ targetDir = self.getGenerator().getBinDir(target)
+ bundleTempDir = binDir + '/' + bundle
+ bundleTargetDir = targetDir + '/' + bundle
+
+ if os.path.exists(bundleTempDir):
+ shutil.move(bundleTempDir, bundleTargetDir)
if self.enableMakeCore:
# copy core binaries into the bundle, since the gui
# now looks for the binaries in the current app dir.
- targetDir = self.getGenerator().getBinDir(target)
- bundleBinDir = dir + "/Synergy.app/Contents/MacOS/"
+ bundleBinDir = bundleTargetDir + "/Contents/MacOS/"
shutil.copy(targetDir + "/synergyc", bundleBinDir)
shutil.copy(targetDir + "/synergys", bundleBinDir)
shutil.copy(targetDir + "/syntool", bundleBinDir)
- if self.enableMakeGui:
+ self.loadConfig()
+ if not self.macIdentity:
+ raise Exception("run config with --mac-identity")
- self.loadConfig()
- if not self.macIdentity:
- raise Exception("run config with --mac-identity")
-
- # use qt to copy libs to bundle so no dependencies are needed. do not create a
- # dmg at this point, since we need to sign it first, and then create our own
- # after signing (so that qt does not affect the signed app bundle).
- bin = "macdeployqt Synergy.app -verbose=2 -codesign='" + self.macIdentity + "'"
- self.try_chdir(dir)
- err = os.system(bin)
- self.restore_chdir()
+ if sys.version_info < (2, 4):
+ raise Exception("Python 2.4 or greater required.")
- if err != 0:
- raise Exception(bin + " failed with error: " + str(err))
+ self.try_chdir(targetDir)
+
+ p = subprocess.Popen(
+ ["macdeployqt", "Synergy.app", "-verbose=2",
+ "-codesign='" + self.macIdentity + "'"],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+
+ stdout, stderr = p.communicate()
+
+ self.restore_chdir()
+
+ # print stderr to standard out, since macdeployqt sends
+ # everything to stderr making it meaningless.
+ print stdout
+ print stderr
+
+ if "ERROR" in stderr:
+ raise Exception("macdeployqt failed")
def signmac(self):
print "signmac is now obsolete"