summaryrefslogtreecommitdiff
path: root/utils/common/deploy.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils/common/deploy.py')
-rwxr-xr-xutils/common/deploy.py41
1 files changed, 36 insertions, 5 deletions
diff --git a/utils/common/deploy.py b/utils/common/deploy.py
index 42d0375529..ae3817f284 100755
--- a/utils/common/deploy.py
+++ b/utils/common/deploy.py
@@ -69,6 +69,8 @@ environment = os.environ
69progexe = "" 69progexe = ""
70make = "make" 70make = "make"
71programfiles = [] 71programfiles = []
72nsisscript = ""
73nsissetup = ""
72 74
73svnserver = "" 75svnserver = ""
74# Paths and files to retrieve from svn when creating a tarball. 76# Paths and files to retrieve from svn when creating a tarball.
@@ -90,6 +92,8 @@ def usage(myself):
90 print " -a, --add=<file> add file to build folder before building" 92 print " -a, --add=<file> add file to build folder before building"
91 print " -s, --source-only only create source archive" 93 print " -s, --source-only only create source archive"
92 print " -b, --binary-only only create binary archive" 94 print " -b, --binary-only only create binary archive"
95 if nsisscript != "":
96 print " -n, --makensis=<file> path to makensis for building Windows setup program."
93 if sys.platform != "darwin": 97 if sys.platform != "darwin":
94 print " -d, --dynamic link dynamically instead of static" 98 print " -d, --dynamic link dynamically instead of static"
95 print " -k, --keep-temp keep temporary folder on build failure" 99 print " -k, --keep-temp keep temporary folder on build failure"
@@ -235,6 +239,28 @@ def upxfile(wd="."):
235 return 0 239 return 0
236 240
237 241
242def runnsis(versionstring, nsis, srcfolder):
243 # run script through nsis to create installer.
244 print "Running NSIS ..."
245 # Assume the generated installer gets placed in the same folder the nsi
246 # script lives in. This seems to be a valid assumption unless the nsi
247 # script specifies a path. NSIS expects files relative to source folder so
248 # copy the relevant binaries.
249 for f in programfiles:
250 b = srcfolder + "/" + os.path.dirname(nsisscript) + "/" + os.path.dirname(f)
251 if not os.path.exists(b):
252 os.mkdir(b)
253 shutil.copy(srcfolder + "/" + f, b)
254 output = subprocess.Popen([nsis, srcfolder + "/" + nsisscript], stdout=subprocess.PIPE)
255 output.communicate()
256 if not output.returncode == 0:
257 print "NSIS failed!"
258 return -1
259 setupfile = program + "-" + versionstring + "-setup.exe"
260 shutil.copy(srcfolder + "/" + nsissetup, setupfile)
261 return 0
262
263
238def zipball(versionstring, buildfolder): 264def zipball(versionstring, buildfolder):
239 '''package created binary''' 265 '''package created binary'''
240 print "Creating binary zipball." 266 print "Creating binary zipball."
@@ -345,8 +371,8 @@ def deploy():
345 startup = time.time() 371 startup = time.time()
346 372
347 try: 373 try:
348 opts, args = getopt.getopt(sys.argv[1:], "q:p:t:a:sbdkh", 374 opts, args = getopt.getopt(sys.argv[1:], "q:p:t:a:n:sbdkh",
349 ["qmake=", "project=", "tag=", "add=", "source-only", "binary-only", "dynamic", "keep-temp", "help"]) 375 ["qmake=", "project=", "tag=", "add=", "makensis=", "source-only", "binary-only", "dynamic", "keep-temp", "help"])
350 except getopt.GetoptError, err: 376 except getopt.GetoptError, err:
351 print str(err) 377 print str(err)
352 usage(sys.argv[0]) 378 usage(sys.argv[0])
@@ -360,6 +386,7 @@ def deploy():
360 binary = True 386 binary = True
361 source = True 387 source = True
362 keeptemp = False 388 keeptemp = False
389 makensis = ""
363 if sys.platform != "darwin": 390 if sys.platform != "darwin":
364 static = True 391 static = True
365 else: 392 else:
@@ -375,6 +402,8 @@ def deploy():
375 svnbase = svnserver + "tags/" + tag + "/" 402 svnbase = svnserver + "tags/" + tag + "/"
376 if o in ("-a", "--add"): 403 if o in ("-a", "--add"):
377 addfiles.append(a) 404 addfiles.append(a)
405 if o in ("-n", "--makensis"):
406 makensis = a
378 if o in ("-s", "--source-only"): 407 if o in ("-s", "--source-only"):
379 binary = False 408 binary = False
380 if o in ("-b", "--binary-only"): 409 if o in ("-b", "--binary-only"):
@@ -461,6 +490,7 @@ def deploy():
461 if not build(sourcefolder) == 0: 490 if not build(sourcefolder) == 0:
462 tempclean(workfolder, cleanup and not keeptemp) 491 tempclean(workfolder, cleanup and not keeptemp)
463 sys.exit(1) 492 sys.exit(1)
493 buildtime = time.time() - buildstart
464 if sys.platform == "win32": 494 if sys.platform == "win32":
465 if useupx == True: 495 if useupx == True:
466 if not upxfile(sourcefolder) == 0: 496 if not upxfile(sourcefolder) == 0:
@@ -473,6 +503,8 @@ def deploy():
473 if os.uname()[4].endswith("64"): 503 if os.uname()[4].endswith("64"):
474 ver += "-64bit" 504 ver += "-64bit"
475 archive = tarball(ver, sourcefolder) 505 archive = tarball(ver, sourcefolder)
506 if nsisscript != "" and makensis != "":
507 runnsis(ver, makensis, sourcefolder)
476 508
477 # remove temporary files 509 # remove temporary files
478 tempclean(workfolder, cleanup) 510 tempclean(workfolder, cleanup)
@@ -484,11 +516,10 @@ def deploy():
484 filestats(archivename) 516 filestats(archivename)
485 filestats(archive) 517 filestats(archive)
486 duration = time.time() - startup 518 duration = time.time() - startup
487 building = time.time() - buildstart
488 durmins = (int)(duration / 60) 519 durmins = (int)(duration / 60)
489 dursecs = (int)(duration % 60) 520 dursecs = (int)(duration % 60)
490 buildmins = (int)(building / 60) 521 buildmins = (int)(buildtime / 60)
491 buildsecs = (int)(building % 60) 522 buildsecs = (int)(buildtime % 60)
492 print "Overall time %smin %ssec, building took %smin %ssec." % \ 523 print "Overall time %smin %ssec, building took %smin %ssec." % \
493 (durmins, dursecs, buildmins, buildsecs) 524 (durmins, dursecs, buildmins, buildsecs)
494 525