Besides all print “XXX” to print (“XXX”), there are still a bunch of modifications need to be done…
$ git diff scripts/common.py
diff --git a/scripts/common.py b/scripts/common.py
index 16785b83b5..b6fb00ddbd 100644
--- a/scripts/common.py
+++ b/scripts/common.py
@@ -88,7 +88,7 @@ def copytree(src, dst, symlinks=False, ignore=None):
def get_qt_install_info(qmake_bin):
output = subprocess.check_output([qmake_bin, '-query'])
- lines = output.strip().split('\n')
+ lines = (bytes.decode( output.strip() )).split('\n')
info = {}
for line in lines:
(var, sep, value) = line.partition(':')
@@ -103,13 +103,13 @@ def get_rpath(libfilepath, chrpath=None):
except subprocess.CalledProcessError: # no RPATH or RUNPATH
return []
marker = 'RPATH='
- index = output.find(marker)
+ index = bytes.decode(output).find(marker)
if index < 0:
marker = 'RUNPATH='
- index = output.find(marker)
+ index = bytes.decode(output).find(marker)
if index < 0:
return []
- return output[index + len(marker):].split(':')
+ return bytes.decode(output)[index + len(marker):].split(':')
def fix_rpaths(path, qt_deploy_path, qt_install_info, chrpath=None):
if chrpath is None:
@@ -153,7 +153,7 @@ def fix_rpaths(path, qt_deploy_path, qt_install_info, chrpath=None):
lddOutput = subprocess.check_output(['ldd', filepath])
#OPENMV-DIFF#
- if lddOutput.find('libQt5') >= 0 or lddOutput.find('libicu') >= 0:
+ if bytes.decode(lddOutput).find('libQt5') >= 0 or bytes.decode(lddOutput).find('libicu') >= 0:
# add Qt RPATH if necessary
relative_path = os.path.relpath(qt_deploy_path, os.path.dirname(filepath))
if relative_path == '.':
@@ -162,10 +162,10 @@ def fix_rpaths(path, qt_deploy_path, qt_install_info, chrpath=None):
relative_path = '/' + relative_path
qt_rpath = '$ORIGIN' + relative_path
if not any((path == qt_rpath) for path in rpath):
- new_rpath.append(qt_rpath)
+ list(new_rpath).append(qt_rpath)
# change RPATH
- if len(new_rpath) > 0:
+ if len(list(new_rpath)) > 0:
subprocess.check_call([chrpath, '-r', ':'.join(new_rpath), filepath])
else: # no RPATH / RUNPATH left. delete.
subprocess.check_call([chrpath, '-d', filepath])
@@ -173,8 +173,8 @@ def fix_rpaths(path, qt_deploy_path, qt_install_info, chrpath=None):
def is_unix_executable(filepath):
# Whether a file is really a binary executable and not a script and not a symlink (unix only)
if os.path.exists(filepath) and os.access(filepath, os.X_OK) and not os.path.islink(filepath):
- with open(filepath) as f:
- return f.read(2) != "#!"
+ with open(filepath, 'r', encoding="ascii", errors="surrogateescape") as f:
+ return (f.read(2) != "#!")
def is_unix_library(filepath):
# Whether a file is really a library and not a symlink (unix only)
@@ -183,5 +183,5 @@ def fix_rpaths(path, qt_deploy_path, qt_install_info, chrpath=None):
for dirpath, dirnames, filenames in os.walk(path):
for filename in filenames:
filepath = os.path.join(dirpath, filename)
- if is_unix_executable(filepath) or is_unix_library(filepath):
+ if (is_unix_executable(filepath) or is_unix_library(filepath)):
fix_rpaths_helper(filepath)
[1]+ Stopped git diff scripts/common.py
Cheers
Pei