summaryrefslogtreecommitdiffstats
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.tar.bz2
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 = {
deploy.progexe = {
"win32" : "release/RockboxUtility.exe",
"darwin" : "RockboxUtility.app",
- "linux2" : "RockboxUtility"
+ "linux2" : "RockboxUtility",
+ "linux" : "RockboxUtility"
}
deploy.regreplace = {
"rbutil/rbutilqt/version.h" : [["\$Rev\$", "%REVISION%"],
@@ -66,12 +67,14 @@ deploy.regreplace = {
deploy.qmakespec = {
"win32" : "",
"darwin" : "macx-g++40",
- "linux2" : ""
+ "linux2" : "",
+ "linux" : ""
}
deploy.make = {
"win32" : "mingw32-make",
"darwin" : "make",
- "linux2" : "make"
+ "linux2" : "make",
+ "linux" : "make"
}
# 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 = {
deploy.progexe = {
"win32" : "release/rbthemeeditor.exe",
"darwin" : "rbthemeeditor.app",
- "linux2" : "rbthemeeditor"
+ "linux2" : "rbthemeeditor",
+ "linux" : "rbthemeeditor"
}
deploy.regreplace = {}
# OS X 10.6 defaults to gcc 4.2. Building universal binaries that are
@@ -41,12 +42,14 @@ deploy.regreplace = {}
deploy.qmakespec = {
"win32" : "",
"darwin" : "macx-g++40",
- "linux2" : ""
+ "linux2" : "",
+ "linux" : ""
}
deploy.make = {
"win32" : "mingw32-make",
"darwin" : "make",
- "linux2" : "make"
+ "linux2" : "make",
+ "linux" : "make"
}
# 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=""):
if not result == "":
return result
except:
- print(sys.exc_value)
+ print(sys.exc_info()[1])
return ""
@@ -180,11 +180,11 @@ def checkqt(qmakebin):
cmdout = output.communicate()
# don't check the qmake return code here, Qt3 doesn't return 0 on -version.
for ou in cmdout:
- r = re.compile("Qt[^0-9]+([0-9\.]+[a-z]*)")
+ r = re.compile(b'Qt[^0-9]+([0-9\.]+[a-z]*)')
m = re.search(r, ou)
- if not m == None:
- print("Qt found: %s" % m.group(1))
- s = re.compile("[45]\..*")
+ if m is not None:
+ print("Qt found: %s" % m.group(1).decode())
+ s = re.compile(b'[45]\..*')
n = re.search(s, m.group(1))
if n is not None:
result = qmakebin
@@ -302,7 +302,7 @@ def nsisfileinject(nsis, outscript, filelist):
output.write(line)
# inject files after the progexe binary.
# Match the basename only to avoid path mismatches.
- if re.match(r'^\s*File\s*.*' + os.path.basename(progexe["win32"]), \
+ if re.match(r'^\s*File\s*.*' + os.path.basename(progexe["win32"]),
line, re.IGNORECASE):
for f in filelist:
injection = " File /oname=$INSTDIR\\" + os.path.basename(f) \
@@ -322,7 +322,7 @@ def finddlls(program, extrapaths=[], cross=""):
# create list of used DLLs. Store as lower case as W32 is case-insensitive.
dlls = []
- for line in cmdout[0].split('\n'):
+ for line in cmdout[0].decode().split('\n'):
if re.match(r'\s*DLL Name', line) != None:
dll = re.sub(r'^\s*DLL Name:\s+([a-zA-Z_\-0-9\.\+]+).*$', r'\1', line)
dlls.append(dll.lower())
@@ -429,7 +429,7 @@ def filehashes(filename):
f = open(filename, 'rb')
while True:
d = f.read(65536)
- if d == "":
+ if d == b"":
break
m.update(d)
s.update(d)
@@ -440,12 +440,12 @@ def filestats(filename):
if not os.path.exists(filename):
return
st = os.stat(filename)
- print(filename, "\n", "-" * len(filename))
+ print("%s\n%s" % (filename, "-" * len(filename)))
print("Size: %i bytes" % st.st_size)
h = filehashes(filename)
print("md5sum: %s" % h[0])
print("sha1sum: %s" % h[1])
- print("-" * len(filename), "\n")
+ print("%s\n" % ("-" * len(filename)))
def tempclean(workfolder, nopro):
@@ -539,12 +539,12 @@ def deploy():
revision = gitscraper.describe_treehash(gitrepo, treehash)
# try to find a version number from describe output.
# WARNING: this is broken and just a temporary workaround!
- v = re.findall('([\d\.a-f]+)', revision)
+ v = re.findall(b'([\d\.a-f]+)', revision)
if v:
- if v[-1].find('.') >= 0:
- revision = "v" + v[-1]
+ if v[-1].decode().find('.') >= 0:
+ revision = "v" + v[-1].decode()
else:
- revision = v[-1]
+ revision = v[-1].decode()
if buildid == None:
versionextra = ""
else:
@@ -647,7 +647,7 @@ def deploy():
elif platform == "darwin":
archive = macdeploy(ver, sourcefolder, platform)
else:
- if platform == "linux2":
+ if platform in ['linux', 'linux2']:
for p in progfiles:
prog = sourcefolder + "/" + p
output = subprocess.Popen(
@@ -664,8 +664,8 @@ def deploy():
# display summary
headline = "Build Summary for %s" % program
- print("\n", headline, "\n", "=" * len(headline))
- if not archivename == "":
+ print("\n%s\n%s" % (headline, "=" * len(headline)))
+ if archivename != "":
filestats(archivename)
filestats(archive)
duration = time.time() - startup