summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2019-11-17 13:40:42 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2020-06-13 20:11:53 +0200
commit9b4e6ef7b31cc76ae5880ae133853f91e5547254 (patch)
tree5a6b35149fe31656c8467b4572b917e0fd71a46b
parent440791105a22c7c42ef0c57ef44e4e6f01fa00e9 (diff)
downloadrockbox-9b4e6ef7b31cc76ae5880ae133853f91e5547254.tar.gz
rockbox-9b4e6ef7b31cc76ae5880ae133853f91e5547254.zip
deploy: Support Python3.
Change-Id: Iff92a1f6a918f7da80f26f1a9ca02a6f6f082b7d
-rwxr-xr-xutils/common/deploy-rbutil.py9
-rwxr-xr-xutils/common/deploy-themeeditor.py9
-rwxr-xr-xutils/common/deploy.py34
3 files changed, 29 insertions, 23 deletions
diff --git a/utils/common/deploy-rbutil.py b/utils/common/deploy-rbutil.py
index 2cdbdb52b5..9bfc909c2c 100755
--- a/utils/common/deploy-rbutil.py
+++ b/utils/common/deploy-rbutil.py
@@ -54,7 +54,8 @@ deploy.bundlecopy = {
54deploy.progexe = { 54deploy.progexe = {
55 "win32" : "release/RockboxUtility.exe", 55 "win32" : "release/RockboxUtility.exe",
56 "darwin" : "RockboxUtility.app", 56 "darwin" : "RockboxUtility.app",
57 "linux2" : "RockboxUtility" 57 "linux2" : "RockboxUtility",
58 "linux" : "RockboxUtility"
58} 59}
59deploy.regreplace = { 60deploy.regreplace = {
60 "rbutil/rbutilqt/version.h" : [["\$Rev\$", "%REVISION%"], 61 "rbutil/rbutilqt/version.h" : [["\$Rev\$", "%REVISION%"],
@@ -66,12 +67,14 @@ deploy.regreplace = {
66deploy.qmakespec = { 67deploy.qmakespec = {
67 "win32" : "", 68 "win32" : "",
68 "darwin" : "macx-g++40", 69 "darwin" : "macx-g++40",
69 "linux2" : "" 70 "linux2" : "",
71 "linux" : ""
70} 72}
71deploy.make = { 73deploy.make = {
72 "win32" : "mingw32-make", 74 "win32" : "mingw32-make",
73 "darwin" : "make", 75 "darwin" : "make",
74 "linux2" : "make" 76 "linux2" : "make",
77 "linux" : "make"
75} 78}
76 79
77# all files of the program. Will get put into an archive after building 80# all files of the program. Will get put into an archive after building
diff --git a/utils/common/deploy-themeeditor.py b/utils/common/deploy-themeeditor.py
index 0b72d43985..a85317a426 100755
--- a/utils/common/deploy-themeeditor.py
+++ b/utils/common/deploy-themeeditor.py
@@ -33,7 +33,8 @@ deploy.bundlecopy = {
33deploy.progexe = { 33deploy.progexe = {
34 "win32" : "release/rbthemeeditor.exe", 34 "win32" : "release/rbthemeeditor.exe",
35 "darwin" : "rbthemeeditor.app", 35 "darwin" : "rbthemeeditor.app",
36 "linux2" : "rbthemeeditor" 36 "linux2" : "rbthemeeditor",
37 "linux" : "rbthemeeditor"
37} 38}
38deploy.regreplace = {} 39deploy.regreplace = {}
39# OS X 10.6 defaults to gcc 4.2. Building universal binaries that are 40# OS X 10.6 defaults to gcc 4.2. Building universal binaries that are
@@ -41,12 +42,14 @@ deploy.regreplace = {}
41deploy.qmakespec = { 42deploy.qmakespec = {
42 "win32" : "", 43 "win32" : "",
43 "darwin" : "macx-g++40", 44 "darwin" : "macx-g++40",
44 "linux2" : "" 45 "linux2" : "",
46 "linux" : ""
45} 47}
46deploy.make = { 48deploy.make = {
47 "win32" : "mingw32-make", 49 "win32" : "mingw32-make",
48 "darwin" : "make", 50 "darwin" : "make",
49 "linux2" : "make" 51 "linux2" : "make",
52 "linux" : "make"
50} 53}
51 54
52# all files of the program. Will get put into an archive after building 55# all files of the program. Will get put into an archive after building
diff --git a/utils/common/deploy.py b/utils/common/deploy.py
index e0bb7029b8..1dbeb494dd 100755
--- a/utils/common/deploy.py
+++ b/utils/common/deploy.py
@@ -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_info()[1])
166 166
167 return "" 167 return ""
168 168
@@ -180,11 +180,11 @@ def checkqt(qmakebin):
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(b'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 m is not None:
186 print("Qt found: %s" % m.group(1)) 186 print("Qt found: %s" % m.group(1).decode())
187 s = re.compile("[45]\..*") 187 s = re.compile(b'[45]\..*')
188 n = re.search(s, m.group(1)) 188 n = re.search(s, m.group(1))
189 if n is not None: 189 if n is not None:
190 result = qmakebin 190 result = qmakebin
@@ -302,7 +302,7 @@ def nsisfileinject(nsis, outscript, filelist):
302 output.write(line) 302 output.write(line)
303 # inject files after the progexe binary. 303 # inject files after the progexe binary.
304 # Match the basename only to avoid path mismatches. 304 # Match the basename only to avoid path mismatches.
305 if re.match(r'^\s*File\s*.*' + os.path.basename(progexe["win32"]), \ 305 if re.match(r'^\s*File\s*.*' + os.path.basename(progexe["win32"]),
306 line, re.IGNORECASE): 306 line, re.IGNORECASE):
307 for f in filelist: 307 for f in filelist:
308 injection = " File /oname=$INSTDIR\\" + os.path.basename(f) \ 308 injection = " File /oname=$INSTDIR\\" + os.path.basename(f) \
@@ -322,7 +322,7 @@ def finddlls(program, extrapaths=[], cross=""):
322 322
323 # create list of used DLLs. Store as lower case as W32 is case-insensitive. 323 # create list of used DLLs. Store as lower case as W32 is case-insensitive.
324 dlls = [] 324 dlls = []
325 for line in cmdout[0].split('\n'): 325 for line in cmdout[0].decode().split('\n'):
326 if re.match(r'\s*DLL Name', line) != None: 326 if re.match(r'\s*DLL Name', line) != None:
327 dll = re.sub(r'^\s*DLL Name:\s+([a-zA-Z_\-0-9\.\+]+).*$', r'\1', line) 327 dll = re.sub(r'^\s*DLL Name:\s+([a-zA-Z_\-0-9\.\+]+).*$', r'\1', line)
328 dlls.append(dll.lower()) 328 dlls.append(dll.lower())
@@ -429,7 +429,7 @@ def filehashes(filename):
429 f = open(filename, 'rb') 429 f = open(filename, 'rb')
430 while True: 430 while True:
431 d = f.read(65536) 431 d = f.read(65536)
432 if d == "": 432 if d == b"":
433 break 433 break
434 m.update(d) 434 m.update(d)
435 s.update(d) 435 s.update(d)
@@ -440,12 +440,12 @@ 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("%s\n%s" % (filename, "-" * 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("%s\n" % ("-" * len(filename)))
449 449
450 450
451def tempclean(workfolder, nopro): 451def tempclean(workfolder, nopro):
@@ -539,12 +539,12 @@ def deploy():
539 revision = gitscraper.describe_treehash(gitrepo, treehash) 539 revision = gitscraper.describe_treehash(gitrepo, treehash)
540 # try to find a version number from describe output. 540 # try to find a version number from describe output.
541 # WARNING: this is broken and just a temporary workaround! 541 # WARNING: this is broken and just a temporary workaround!
542 v = re.findall('([\d\.a-f]+)', revision) 542 v = re.findall(b'([\d\.a-f]+)', revision)
543 if v: 543 if v:
544 if v[-1].find('.') >= 0: 544 if v[-1].decode().find('.') >= 0:
545 revision = "v" + v[-1] 545 revision = "v" + v[-1].decode()
546 else: 546 else:
547 revision = v[-1] 547 revision = v[-1].decode()
548 if buildid == None: 548 if buildid == None:
549 versionextra = "" 549 versionextra = ""
550 else: 550 else:
@@ -647,7 +647,7 @@ def deploy():
647 elif platform == "darwin": 647 elif platform == "darwin":
648 archive = macdeploy(ver, sourcefolder, platform) 648 archive = macdeploy(ver, sourcefolder, platform)
649 else: 649 else:
650 if platform == "linux2": 650 if platform in ['linux', 'linux2']:
651 for p in progfiles: 651 for p in progfiles:
652 prog = sourcefolder + "/" + p 652 prog = sourcefolder + "/" + p
653 output = subprocess.Popen( 653 output = subprocess.Popen(
@@ -664,8 +664,8 @@ def deploy():
664 664
665 # display summary 665 # display summary
666 headline = "Build Summary for %s" % program 666 headline = "Build Summary for %s" % program
667 print("\n", headline, "\n", "=" * len(headline)) 667 print("\n%s\n%s" % (headline, "=" * len(headline)))
668 if not archivename == "": 668 if archivename != "":
669 filestats(archivename) 669 filestats(archivename)
670 filestats(archive) 670 filestats(archive)
671 duration = time.time() - startup 671 duration = time.time() - startup