1
0
Fork 0
forked from len0rd/rockbox

deploy: Support Python3.

Change-Id: Iff92a1f6a918f7da80f26f1a9ca02a6f6f082b7d
This commit is contained in:
Dominik Riebeling 2019-11-17 13:40:42 +01:00
parent 440791105a
commit 9b4e6ef7b3
3 changed files with 29 additions and 23 deletions

View file

@ -54,7 +54,8 @@ deploy.bundlecopy = {
deploy.progexe = { deploy.progexe = {
"win32" : "release/RockboxUtility.exe", "win32" : "release/RockboxUtility.exe",
"darwin" : "RockboxUtility.app", "darwin" : "RockboxUtility.app",
"linux2" : "RockboxUtility" "linux2" : "RockboxUtility",
"linux" : "RockboxUtility"
} }
deploy.regreplace = { deploy.regreplace = {
"rbutil/rbutilqt/version.h" : [["\$Rev\$", "%REVISION%"], "rbutil/rbutilqt/version.h" : [["\$Rev\$", "%REVISION%"],
@ -66,12 +67,14 @@ deploy.regreplace = {
deploy.qmakespec = { deploy.qmakespec = {
"win32" : "", "win32" : "",
"darwin" : "macx-g++40", "darwin" : "macx-g++40",
"linux2" : "" "linux2" : "",
"linux" : ""
} }
deploy.make = { deploy.make = {
"win32" : "mingw32-make", "win32" : "mingw32-make",
"darwin" : "make", "darwin" : "make",
"linux2" : "make" "linux2" : "make",
"linux" : "make"
} }
# all files of the program. Will get put into an archive after building # all files of the program. Will get put into an archive after building

View file

@ -33,7 +33,8 @@ deploy.bundlecopy = {
deploy.progexe = { deploy.progexe = {
"win32" : "release/rbthemeeditor.exe", "win32" : "release/rbthemeeditor.exe",
"darwin" : "rbthemeeditor.app", "darwin" : "rbthemeeditor.app",
"linux2" : "rbthemeeditor" "linux2" : "rbthemeeditor",
"linux" : "rbthemeeditor"
} }
deploy.regreplace = {} deploy.regreplace = {}
# OS X 10.6 defaults to gcc 4.2. Building universal binaries that are # OS X 10.6 defaults to gcc 4.2. Building universal binaries that are
@ -41,12 +42,14 @@ deploy.regreplace = {}
deploy.qmakespec = { deploy.qmakespec = {
"win32" : "", "win32" : "",
"darwin" : "macx-g++40", "darwin" : "macx-g++40",
"linux2" : "" "linux2" : "",
"linux" : ""
} }
deploy.make = { deploy.make = {
"win32" : "mingw32-make", "win32" : "mingw32-make",
"darwin" : "make", "darwin" : "make",
"linux2" : "make" "linux2" : "make",
"linux" : "make"
} }
# all files of the program. Will get put into an archive after building # all files of the program. Will get put into an archive after building

View file

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