diff options
-rwxr-xr-x | utils/common/deploy-themeeditor.py | 5 | ||||
-rwxr-xr-x | utils/common/deploy.py | 41 |
2 files changed, 40 insertions, 6 deletions
diff --git a/utils/common/deploy-themeeditor.py b/utils/common/deploy-themeeditor.py index 527976616c..566c04d68d 100755 --- a/utils/common/deploy-themeeditor.py +++ b/utils/common/deploy-themeeditor.py | |||
@@ -24,7 +24,8 @@ deploy.project = "utils/themeeditor/themeeditor.pro" | |||
24 | deploy.svnserver = "svn://svn.rockbox.org/rockbox/" | 24 | deploy.svnserver = "svn://svn.rockbox.org/rockbox/" |
25 | deploy.svnpaths = \ | 25 | deploy.svnpaths = \ |
26 | [ "utils/themeeditor/", | 26 | [ "utils/themeeditor/", |
27 | "lib/skin_parser/" ] | 27 | "lib/skin_parser/", |
28 | "docs/COPYING" ] | ||
28 | deploy.useupx = False | 29 | deploy.useupx = False |
29 | deploy.bundlecopy = { | 30 | deploy.bundlecopy = { |
30 | "resources/windowicon.icns" : "Contents/Resources/", | 31 | "resources/windowicon.icns" : "Contents/Resources/", |
@@ -46,6 +47,8 @@ else: | |||
46 | # all files of the program. Will get put into an archive after building | 47 | # all files of the program. Will get put into an archive after building |
47 | # (zip on w32, tar.bz2 on Linux). Does not apply on Mac which uses dmg. | 48 | # (zip on w32, tar.bz2 on Linux). Does not apply on Mac which uses dmg. |
48 | deploy.programfiles = [ deploy.progexe ] | 49 | deploy.programfiles = [ deploy.progexe ] |
50 | deploy.nsisscript = "utils/themeeditor/themeeditor.nsi" | ||
51 | deploy.nsissetup = "utils/themeeditor/rbthemeeditor-setup.exe" | ||
49 | 52 | ||
50 | deploy.deploy() | 53 | deploy.deploy() |
51 | 54 | ||
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 | |||
69 | progexe = "" | 69 | progexe = "" |
70 | make = "make" | 70 | make = "make" |
71 | programfiles = [] | 71 | programfiles = [] |
72 | nsisscript = "" | ||
73 | nsissetup = "" | ||
72 | 74 | ||
73 | svnserver = "" | 75 | svnserver = "" |
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 | ||
242 | def 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 | |||
238 | def zipball(versionstring, buildfolder): | 264 | def 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 | ||