diff options
Diffstat (limited to 'utils/common/deploy.py')
-rwxr-xr-x | utils/common/deploy.py | 149 |
1 files changed, 75 insertions, 74 deletions
diff --git a/utils/common/deploy.py b/utils/common/deploy.py index 571424756b..e0bb7029b8 100755 --- a/utils/common/deploy.py +++ b/utils/common/deploy.py | |||
@@ -43,21 +43,21 @@ import getopt | |||
43 | import time | 43 | import time |
44 | import hashlib | 44 | import hashlib |
45 | import tempfile | 45 | import tempfile |
46 | import gitscraper | ||
47 | from datetime import datetime | 46 | from datetime import datetime |
47 | import gitscraper | ||
48 | 48 | ||
49 | # modules that are not part of python itself. | 49 | # modules that are not part of python itself. |
50 | cpus = 1 | 50 | cpus = 1 |
51 | try: | 51 | try: |
52 | import multiprocessing | 52 | import multiprocessing |
53 | cpus = multiprocessing.cpu_count() | 53 | cpus = multiprocessing.cpu_count() |
54 | print "Info: %s cores found." % cpus | 54 | print("Info: %s cores found." % cpus) |
55 | except ImportError: | 55 | except ImportError: |
56 | print "Warning: multiprocessing module not found. Assuming 1 core." | 56 | print("Warning: multiprocessing module not found. Assuming 1 core.") |
57 | 57 | ||
58 | # == Global stuff == | 58 | # == Global stuff == |
59 | # DLL files to ignore when searching for required DLL files. | 59 | # DLL files to ignore when searching for required DLL files. |
60 | systemdlls = [ | 60 | SYSTEMDLLS = [ |
61 | 'advapi32.dll', | 61 | 'advapi32.dll', |
62 | 'comdlg32.dll', | 62 | 'comdlg32.dll', |
63 | 'crypt32.dll', | 63 | 'crypt32.dll', |
@@ -94,23 +94,23 @@ gitrepo = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")) | |||
94 | 94 | ||
95 | # == Functions == | 95 | # == Functions == |
96 | def usage(myself): | 96 | def usage(myself): |
97 | print "Usage: %s [options]" % myself | 97 | print("Usage: %s [options]" % myself) |
98 | print " -q, --qmake=<qmake> path to qmake" | 98 | print(" -q, --qmake=<qmake> path to qmake") |
99 | print " -p, --project=<pro> path to .pro file for building with local tree" | 99 | print(" -p, --project=<pro> path to .pro file for building with local tree") |
100 | print " -t, --tag=<tag> use specified tag from svn" | 100 | print(" -t, --tag=<tag> use specified tag from svn") |
101 | print " -a, --add=<file> add file to build folder before building" | 101 | print(" -a, --add=<file> add file to build folder before building") |
102 | print " -s, --source-only only create source archive" | 102 | print(" -s, --source-only only create source archive") |
103 | print " -b, --binary-only only create binary archive" | 103 | print(" -b, --binary-only only create binary archive") |
104 | if nsisscript != "": | 104 | if nsisscript != "": |
105 | print " -n, --makensis=<file> path to makensis for building Windows setup program." | 105 | print(" -n, --makensis=<file> path to makensis for building Windows setup program.") |
106 | if sys.platform != "darwin": | 106 | if sys.platform != "darwin": |
107 | print " -d, --dynamic link dynamically instead of static" | 107 | print(" -d, --dynamic link dynamically instead of static") |
108 | if sys.platform != "win32": | 108 | if sys.platform != "win32": |
109 | print " -x, --cross= prefix to cross compile for win32" | 109 | print(" -x, --cross= prefix to cross compile for win32") |
110 | print " -k, --keep-temp keep temporary folder on build failure" | 110 | print(" -k, --keep-temp keep temporary folder on build failure") |
111 | print " -h, --help this help" | 111 | print(" -h, --help this help") |
112 | print " If neither a project file nor tag is specified trunk will get downloaded" | 112 | print(" If neither a project file nor tag is specified trunk will get downloaded") |
113 | print " from svn." | 113 | print(" from svn.") |
114 | 114 | ||
115 | 115 | ||
116 | def which(executable): | 116 | def which(executable): |
@@ -119,7 +119,7 @@ def which(executable): | |||
119 | fullpath = p + "/" + executable | 119 | fullpath = p + "/" + executable |
120 | if os.path.exists(fullpath): | 120 | if os.path.exists(fullpath): |
121 | return fullpath | 121 | return fullpath |
122 | print "which: could not find " + executable | 122 | print("which: could not find " + executable) |
123 | return "" | 123 | return "" |
124 | 124 | ||
125 | 125 | ||
@@ -152,7 +152,7 @@ def findversion(versionfile): | |||
152 | 152 | ||
153 | def findqt(cross=""): | 153 | def findqt(cross=""): |
154 | '''Search for Qt4 installation. Return path to qmake.''' | 154 | '''Search for Qt4 installation. Return path to qmake.''' |
155 | print "Searching for Qt" | 155 | print("Searching for Qt") |
156 | bins = [cross + "qmake", cross + "qmake-qt4"] | 156 | bins = [cross + "qmake", cross + "qmake-qt4"] |
157 | for binary in bins: | 157 | for binary in bins: |
158 | try: | 158 | try: |
@@ -162,7 +162,7 @@ def findqt(cross=""): | |||
162 | if not result == "": | 162 | if not result == "": |
163 | return result | 163 | return result |
164 | except: | 164 | except: |
165 | print sys.exc_value | 165 | print(sys.exc_value) |
166 | 166 | ||
167 | return "" | 167 | return "" |
168 | 168 | ||
@@ -172,27 +172,27 @@ def checkqt(qmakebin): | |||
172 | result = "" | 172 | result = "" |
173 | # check if binary exists | 173 | # check if binary exists |
174 | if not os.path.exists(qmakebin): | 174 | if not os.path.exists(qmakebin): |
175 | print "Specified qmake path does not exist!" | 175 | print("Specified qmake path does not exist!") |
176 | return result | 176 | return result |
177 | # check version | 177 | # check version |
178 | output = subprocess.Popen([qmakebin, "-version"], stdout=subprocess.PIPE, | 178 | output = subprocess.Popen( |
179 | stderr=subprocess.PIPE) | 179 | [qmakebin, "-version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
180 | cmdout = output.communicate() | 180 | cmdout = output.communicate() |
181 | # don't check the qmake return code here, Qt3 doesn't return 0 on -version. | 181 | # don't check the qmake return code here, Qt3 doesn't return 0 on -version. |
182 | for ou in cmdout: | 182 | for ou in cmdout: |
183 | r = re.compile("Qt[^0-9]+([0-9\.]+[a-z]*)") | 183 | r = re.compile("Qt[^0-9]+([0-9\.]+[a-z]*)") |
184 | m = re.search(r, ou) | 184 | m = re.search(r, ou) |
185 | if not m == None: | 185 | if not m == None: |
186 | print "Qt found: %s" % m.group(1) | 186 | print("Qt found: %s" % m.group(1)) |
187 | s = re.compile("[45]\..*") | 187 | s = re.compile("[45]\..*") |
188 | n = re.search(s, m.group(1)) | 188 | n = re.search(s, m.group(1)) |
189 | if not n == None: | 189 | if n is not None: |
190 | result = qmakebin | 190 | result = qmakebin |
191 | return result | 191 | return result |
192 | 192 | ||
193 | 193 | ||
194 | def qmake(qmake, projfile, platform=sys.platform, wd=".", static=True, cross=""): | 194 | def qmake(qmake, projfile, platform=sys.platform, wd=".", static=True, cross=""): |
195 | print "Running qmake in %s..." % wd | 195 | print("Running qmake in %s..." % wd) |
196 | command = [qmake, "-config", "release", "-config", "noccache"] | 196 | command = [qmake, "-config", "release", "-config", "noccache"] |
197 | if static == True: | 197 | if static == True: |
198 | command.extend(["-config", "-static"]) | 198 | command.extend(["-config", "-static"]) |
@@ -206,14 +206,14 @@ def qmake(qmake, projfile, platform=sys.platform, wd=".", static=True, cross="") | |||
206 | output = subprocess.Popen(command, stdout=subprocess.PIPE, cwd=wd) | 206 | output = subprocess.Popen(command, stdout=subprocess.PIPE, cwd=wd) |
207 | output.communicate() | 207 | output.communicate() |
208 | if not output.returncode == 0: | 208 | if not output.returncode == 0: |
209 | print "qmake returned an error!" | 209 | print("qmake returned an error!") |
210 | return -1 | 210 | return -1 |
211 | return 0 | 211 | return 0 |
212 | 212 | ||
213 | 213 | ||
214 | def build(wd=".", platform=sys.platform, cross=""): | 214 | def build(wd=".", platform=sys.platform, cross=""): |
215 | # make | 215 | # make |
216 | print "Building ..." | 216 | print("Building ...") |
217 | # use the current platforms make here, cross compiling uses the native make. | 217 | # use the current platforms make here, cross compiling uses the native make. |
218 | command = [make[sys.platform]] | 218 | command = [make[sys.platform]] |
219 | if cpus > 1: | 219 | if cpus > 1: |
@@ -228,36 +228,36 @@ def build(wd=".", platform=sys.platform, cross=""): | |||
228 | sys.stdout.write("\n") | 228 | sys.stdout.write("\n") |
229 | sys.stdout.flush() | 229 | sys.stdout.flush() |
230 | if not output.returncode == 0: | 230 | if not output.returncode == 0: |
231 | print "Build failed!" | 231 | print("Build failed!") |
232 | return -1 | 232 | return -1 |
233 | break | 233 | break |
234 | if platform != "darwin": | 234 | if platform != "darwin": |
235 | # strip. OS X handles this via macdeployqt. | 235 | # strip. OS X handles this via macdeployqt. |
236 | print "Stripping binary." | 236 | print("Stripping binary.") |
237 | output = subprocess.Popen([cross + "strip", progexe[platform]], \ | 237 | output = subprocess.Popen([cross + "strip", progexe[platform]], \ |
238 | stdout=subprocess.PIPE, cwd=wd) | 238 | stdout=subprocess.PIPE, cwd=wd) |
239 | output.communicate() | 239 | output.communicate() |
240 | if not output.returncode == 0: | 240 | if not output.returncode == 0: |
241 | print "Stripping failed!" | 241 | print("Stripping failed!") |
242 | return -1 | 242 | return -1 |
243 | return 0 | 243 | return 0 |
244 | 244 | ||
245 | 245 | ||
246 | def upxfile(wd=".", platform=sys.platform): | 246 | def upxfile(wd=".", platform=sys.platform): |
247 | # run upx on binary | 247 | # run upx on binary |
248 | print "UPX'ing binary ..." | 248 | print("UPX'ing binary ...") |
249 | output = subprocess.Popen(["upx", progexe[platform]], \ | 249 | output = subprocess.Popen(["upx", progexe[platform]], \ |
250 | stdout=subprocess.PIPE, cwd=wd) | 250 | stdout=subprocess.PIPE, cwd=wd) |
251 | output.communicate() | 251 | output.communicate() |
252 | if not output.returncode == 0: | 252 | if not output.returncode == 0: |
253 | print "UPX'ing failed!" | 253 | print("UPX'ing failed!") |
254 | return -1 | 254 | return -1 |
255 | return 0 | 255 | return 0 |
256 | 256 | ||
257 | 257 | ||
258 | def runnsis(versionstring, nsis, script, srcfolder): | 258 | def runnsis(versionstring, nsis, script, srcfolder): |
259 | # run script through nsis to create installer. | 259 | # run script through nsis to create installer. |
260 | print "Running NSIS ..." | 260 | print("Running NSIS ...") |
261 | 261 | ||
262 | # Assume the generated installer gets placed in the same folder the nsi | 262 | # Assume the generated installer gets placed in the same folder the nsi |
263 | # script lives in. This seems to be a valid assumption unless the nsi | 263 | # script lives in. This seems to be a valid assumption unless the nsi |
@@ -276,7 +276,7 @@ def runnsis(versionstring, nsis, script, srcfolder): | |||
276 | stdout=subprocess.PIPE) | 276 | stdout=subprocess.PIPE) |
277 | output.communicate() | 277 | output.communicate() |
278 | if not output.returncode == 0: | 278 | if not output.returncode == 0: |
279 | print "NSIS failed!" | 279 | print("NSIS failed!") |
280 | return -1 | 280 | return -1 |
281 | setupfile = program + "-" + versionstring + "-setup.exe" | 281 | setupfile = program + "-" + versionstring + "-setup.exe" |
282 | # find output filename in nsis script file | 282 | # find output filename in nsis script file |
@@ -285,7 +285,7 @@ def runnsis(versionstring, nsis, script, srcfolder): | |||
285 | if re.match(r'^[^;]*OutFile\s+', line) != None: | 285 | if re.match(r'^[^;]*OutFile\s+', line) != None: |
286 | nsissetup = re.sub(r'^[^;]*OutFile\s+"(.+)"', r'\1', line).rstrip() | 286 | nsissetup = re.sub(r'^[^;]*OutFile\s+"(.+)"', r'\1', line).rstrip() |
287 | if nsissetup == "": | 287 | if nsissetup == "": |
288 | print "Could not retrieve output file name!" | 288 | print("Could not retrieve output file name!") |
289 | return -1 | 289 | return -1 |
290 | shutil.copy(srcfolder + "/" + os.path.dirname(script) + "/" + nsissetup, \ | 290 | shutil.copy(srcfolder + "/" + os.path.dirname(script) + "/" + nsissetup, \ |
291 | setupfile) | 291 | setupfile) |
@@ -330,29 +330,29 @@ def finddlls(program, extrapaths=[], cross=""): | |||
330 | # find DLLs in extrapaths and PATH environment variable. | 330 | # find DLLs in extrapaths and PATH environment variable. |
331 | dllpaths = [] | 331 | dllpaths = [] |
332 | for file in dlls: | 332 | for file in dlls: |
333 | if file in systemdlls: | 333 | if file in SYSTEMDLLS: |
334 | print "System DLL: " + file | 334 | print("System DLL: " + file) |
335 | continue | 335 | continue |
336 | dllpath = "" | 336 | dllpath = "" |
337 | for path in extrapaths: | 337 | for path in extrapaths: |
338 | if os.path.exists(path + "/" + file): | 338 | if os.path.exists(path + "/" + file): |
339 | dllpath = re.sub(r"\\", r"/", path + "/" + file) | 339 | dllpath = re.sub(r"\\", r"/", path + "/" + file) |
340 | print file + ": found at " + dllpath | 340 | print(file + ": found at " + dllpath) |
341 | dllpaths.append(dllpath) | 341 | dllpaths.append(dllpath) |
342 | break | 342 | break |
343 | if dllpath == "": | 343 | if dllpath == "": |
344 | try: | 344 | try: |
345 | dllpath = re.sub(r"\\", r"/", which(file)) | 345 | dllpath = re.sub(r"\\", r"/", which(file)) |
346 | print file + ": found at " + dllpath | 346 | print(file + ": found at " + dllpath) |
347 | dllpaths.append(dllpath) | 347 | dllpaths.append(dllpath) |
348 | except: | 348 | except: |
349 | print "MISSING DLL: " + file | 349 | print("MISSING DLL: " + file) |
350 | return dllpaths | 350 | return dllpaths |
351 | 351 | ||
352 | 352 | ||
353 | def zipball(programfiles, versionstring, buildfolder, platform=sys.platform): | 353 | def zipball(programfiles, versionstring, buildfolder, platform=sys.platform): |
354 | '''package created binary''' | 354 | '''package created binary''' |
355 | print "Creating binary zipball." | 355 | print("Creating binary zipball.") |
356 | archivebase = program + "-" + versionstring | 356 | archivebase = program + "-" + versionstring |
357 | outfolder = buildfolder + "/" + archivebase | 357 | outfolder = buildfolder + "/" + archivebase |
358 | archivename = archivebase + ".zip" | 358 | archivename = archivebase + ".zip" |
@@ -379,7 +379,7 @@ def zipball(programfiles, versionstring, buildfolder, platform=sys.platform): | |||
379 | 379 | ||
380 | def tarball(programfiles, versionstring, buildfolder): | 380 | def tarball(programfiles, versionstring, buildfolder): |
381 | '''package created binary''' | 381 | '''package created binary''' |
382 | print "Creating binary tarball." | 382 | print("Creating binary tarball.") |
383 | archivebase = program + "-" + versionstring | 383 | archivebase = program + "-" + versionstring |
384 | outfolder = buildfolder + "/" + archivebase | 384 | outfolder = buildfolder + "/" + archivebase |
385 | archivename = archivebase + ".tar.bz2" | 385 | archivename = archivebase + ".tar.bz2" |
@@ -404,7 +404,7 @@ def macdeploy(versionstring, buildfolder, platform=sys.platform): | |||
404 | 404 | ||
405 | # workaround to Qt issues when building out-of-tree. Copy files into bundle. | 405 | # workaround to Qt issues when building out-of-tree. Copy files into bundle. |
406 | sourcebase = buildfolder + re.sub('[^/]+.pro$', '', project) + "/" | 406 | sourcebase = buildfolder + re.sub('[^/]+.pro$', '', project) + "/" |
407 | print sourcebase | 407 | print(sourcebase) |
408 | for src in bundlecopy: | 408 | for src in bundlecopy: |
409 | shutil.copy(sourcebase + src, appbundle + "/" + bundlecopy[src]) | 409 | shutil.copy(sourcebase + src, appbundle + "/" + bundlecopy[src]) |
410 | # end of Qt workaround | 410 | # end of Qt workaround |
@@ -413,7 +413,7 @@ def macdeploy(versionstring, buildfolder, platform=sys.platform): | |||
413 | stdout=subprocess.PIPE, cwd=buildfolder) | 413 | stdout=subprocess.PIPE, cwd=buildfolder) |
414 | output.communicate() | 414 | output.communicate() |
415 | if not output.returncode == 0: | 415 | if not output.returncode == 0: |
416 | print "macdeployqt failed!" | 416 | print("macdeployqt failed!") |
417 | return -1 | 417 | return -1 |
418 | # copy dmg to output folder | 418 | # copy dmg to output folder |
419 | shutil.copy(buildfolder + "/" + program + ".dmg", dmgfile) | 419 | shutil.copy(buildfolder + "/" + program + ".dmg", dmgfile) |
@@ -440,32 +440,33 @@ def filestats(filename): | |||
440 | if not os.path.exists(filename): | 440 | if not os.path.exists(filename): |
441 | return | 441 | return |
442 | st = os.stat(filename) | 442 | st = os.stat(filename) |
443 | print filename, "\n", "-" * len(filename) | 443 | print(filename, "\n", "-" * len(filename)) |
444 | print "Size: %i bytes" % st.st_size | 444 | print("Size: %i bytes" % st.st_size) |
445 | h = filehashes(filename) | 445 | h = filehashes(filename) |
446 | print "md5sum: %s" % h[0] | 446 | print("md5sum: %s" % h[0]) |
447 | print "sha1sum: %s" % h[1] | 447 | print("sha1sum: %s" % h[1]) |
448 | print "-" * len(filename), "\n" | 448 | print("-" * len(filename), "\n") |
449 | 449 | ||
450 | 450 | ||
451 | def tempclean(workfolder, nopro): | 451 | def tempclean(workfolder, nopro): |
452 | if nopro == True: | 452 | if nopro == True: |
453 | print "Cleaning up working folder %s" % workfolder | 453 | print("Cleaning up working folder %s" % workfolder) |
454 | shutil.rmtree(workfolder) | 454 | shutil.rmtree(workfolder) |
455 | else: | 455 | else: |
456 | print "Project file specified or cleanup disabled!" | 456 | print("Project file specified or cleanup disabled!") |
457 | print "Temporary files kept at %s" % workfolder | 457 | print("Temporary files kept at %s" % workfolder) |
458 | 458 | ||
459 | 459 | ||
460 | def deploy(): | 460 | def deploy(): |
461 | startup = time.time() | 461 | startup = time.time() |
462 | 462 | ||
463 | try: | 463 | try: |
464 | opts, args = getopt.getopt(sys.argv[1:], "q:p:t:a:n:sbdkx:i:h", | 464 | opts, args = getopt.getopt( |
465 | sys.argv[1:], "q:p:t:a:n:sbdkx:i:h", | ||
465 | ["qmake=", "project=", "tag=", "add=", "makensis=", "source-only", | 466 | ["qmake=", "project=", "tag=", "add=", "makensis=", "source-only", |
466 | "binary-only", "dynamic", "keep-temp", "cross=", "buildid=", "help"]) | 467 | "binary-only", "dynamic", "keep-temp", "cross=", "buildid=", "help"]) |
467 | except getopt.GetoptError, err: | 468 | except getopt.GetoptError as err: |
468 | print str(err) | 469 | print(str(err)) |
469 | usage(sys.argv[0]) | 470 | usage(sys.argv[0]) |
470 | sys.exit(1) | 471 | sys.exit(1) |
471 | qt = "" | 472 | qt = "" |
@@ -516,17 +517,17 @@ def deploy(): | |||
516 | sys.exit(0) | 517 | sys.exit(0) |
517 | 518 | ||
518 | if source == False and binary == False: | 519 | if source == False and binary == False: |
519 | print "Building build neither source nor binary means nothing to do. Exiting." | 520 | print("Building build neither source nor binary means nothing to do. Exiting.") |
520 | sys.exit(1) | 521 | sys.exit(1) |
521 | 522 | ||
522 | print "Building " + progexe[platform] + " for " + platform | 523 | print("Building " + progexe[platform] + " for " + platform) |
523 | # search for qmake | 524 | # search for qmake |
524 | if qt == "": | 525 | if qt == "": |
525 | qm = findqt(cross) | 526 | qm = findqt(cross) |
526 | else: | 527 | else: |
527 | qm = checkqt(qt) | 528 | qm = checkqt(qt) |
528 | if qm == "": | 529 | if qm == "": |
529 | print "ERROR: No suitable Qt installation found." | 530 | print("ERROR: No suitable Qt installation found.") |
530 | sys.exit(1) | 531 | sys.exit(1) |
531 | 532 | ||
532 | # create working folder. Use current directory if -p option used. | 533 | # create working folder. Use current directory if -p option used. |
@@ -552,7 +553,7 @@ def deploy(): | |||
552 | archivename = program + "-" + str(revision) + versionextra + "-src.tar.bz2" | 553 | archivename = program + "-" + str(revision) + versionextra + "-src.tar.bz2" |
553 | ver = str(revision) | 554 | ver = str(revision) |
554 | os.mkdir(sourcefolder) | 555 | os.mkdir(sourcefolder) |
555 | print "Version: %s" % revision | 556 | print("Version: %s" % revision) |
556 | else: | 557 | else: |
557 | workfolder = "." | 558 | workfolder = "." |
558 | sourcefolder = "." | 559 | sourcefolder = "." |
@@ -561,12 +562,12 @@ def deploy(): | |||
561 | if proj == "": | 562 | if proj == "": |
562 | proj = sourcefolder + project | 563 | proj = sourcefolder + project |
563 | # get sources and pack source tarball | 564 | # get sources and pack source tarball |
564 | if not getsources(treehash, svnpaths, sourcefolder) == 0: | 565 | if getsources(treehash, svnpaths, sourcefolder) != 0: |
565 | tempclean(workfolder, cleanup and not keeptemp) | 566 | tempclean(workfolder, cleanup and not keeptemp) |
566 | sys.exit(1) | 567 | sys.exit(1) |
567 | 568 | ||
568 | # replace version strings. | 569 | # replace version strings. |
569 | print "Updating version information in sources" | 570 | print("Updating version information in sources") |
570 | for f in regreplace: | 571 | for f in regreplace: |
571 | infile = open(sourcefolder + "/" + f, "r") | 572 | infile = open(sourcefolder + "/" + f, "r") |
572 | incontents = infile.readlines() | 573 | incontents = infile.readlines() |
@@ -590,7 +591,7 @@ def deploy(): | |||
590 | outfile.close() | 591 | outfile.close() |
591 | 592 | ||
592 | if source == True: | 593 | if source == True: |
593 | print "Creating source tarball %s\n" % archivename | 594 | print("Creating source tarball %s\n" % archivename) |
594 | tf = tarfile.open(archivename, mode='w:bz2') | 595 | tf = tarfile.open(archivename, mode='w:bz2') |
595 | tf.add(sourcefolder, os.path.basename(re.subn('/$', '', sourcefolder)[0])) | 596 | tf.add(sourcefolder, os.path.basename(re.subn('/$', '', sourcefolder)[0])) |
596 | tf.close() | 597 | tf.close() |
@@ -607,7 +608,7 @@ def deploy(): | |||
607 | 608 | ||
608 | # check project file | 609 | # check project file |
609 | if not os.path.exists(proj): | 610 | if not os.path.exists(proj): |
610 | print "ERROR: path to project file wrong." | 611 | print("ERROR: path to project file wrong.") |
611 | sys.exit(1) | 612 | sys.exit(1) |
612 | 613 | ||
613 | # copy specified (--add) files to working folder | 614 | # copy specified (--add) files to working folder |
@@ -615,8 +616,8 @@ def deploy(): | |||
615 | shutil.copy(f, sourcefolder) | 616 | shutil.copy(f, sourcefolder) |
616 | buildstart = time.time() | 617 | buildstart = time.time() |
617 | header = "Building %s %s" % (program, ver) | 618 | header = "Building %s %s" % (program, ver) |
618 | print header | 619 | print(header) |
619 | print len(header) * "=" | 620 | print(len(header) * "=") |
620 | 621 | ||
621 | # build it. | 622 | # build it. |
622 | if not qmake(qm, proj, platform, sourcefolder, static, cross) == 0: | 623 | if not qmake(qm, proj, platform, sourcefolder, static, cross) == 0: |
@@ -649,8 +650,8 @@ def deploy(): | |||
649 | if platform == "linux2": | 650 | if platform == "linux2": |
650 | for p in progfiles: | 651 | for p in progfiles: |
651 | prog = sourcefolder + "/" + p | 652 | prog = sourcefolder + "/" + p |
652 | output = subprocess.Popen(["file", prog], | 653 | output = subprocess.Popen( |
653 | stdout=subprocess.PIPE) | 654 | ["file", prog], stdout=subprocess.PIPE) |
654 | res = output.communicate() | 655 | res = output.communicate() |
655 | if re.findall("ELF 64-bit", res[0]): | 656 | if re.findall("ELF 64-bit", res[0]): |
656 | ver += "-64bit" | 657 | ver += "-64bit" |
@@ -663,7 +664,7 @@ def deploy(): | |||
663 | 664 | ||
664 | # display summary | 665 | # display summary |
665 | headline = "Build Summary for %s" % program | 666 | headline = "Build Summary for %s" % program |
666 | print "\n", headline, "\n", "=" * len(headline) | 667 | print("\n", headline, "\n", "=" * len(headline)) |
667 | if not archivename == "": | 668 | if not archivename == "": |
668 | filestats(archivename) | 669 | filestats(archivename) |
669 | filestats(archive) | 670 | filestats(archive) |
@@ -672,10 +673,10 @@ def deploy(): | |||
672 | dursecs = (int)(duration % 60) | 673 | dursecs = (int)(duration % 60) |
673 | buildmins = (int)(buildtime / 60) | 674 | buildmins = (int)(buildtime / 60) |
674 | buildsecs = (int)(buildtime % 60) | 675 | buildsecs = (int)(buildtime % 60) |
675 | print "Overall time %smin %ssec, building took %smin %ssec." % \ | 676 | print("Overall time %smin %ssec, building took %smin %ssec." % \ |
676 | (durmins, dursecs, buildmins, buildsecs) | 677 | (durmins, dursecs, buildmins, buildsecs)) |
677 | 678 | ||
678 | 679 | ||
679 | if __name__ == "__main__": | 680 | if __name__ == "__main__": |
680 | print "You cannot run this module directly!" | 681 | print("You cannot run this module directly!") |
681 | print "Set required environment and call deploy()." | 682 | print("Set required environment and call deploy().") |