fix Popen return error: python3.x return bytes, not str 97/284997/1
authorbiao716.wang <biao716.wang@samsung.com>
Fri, 2 Dec 2022 09:04:30 +0000 (18:04 +0900)
committerbiao716.wang <biao716.wang@samsung.com>
Fri, 2 Dec 2022 09:04:30 +0000 (18:04 +0900)
Change-Id: I8a4c0c566daf98aca4090d6a40b66e71cad4d7d4
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
gitbuildsys/utils.py

index 1039c226303f6f3b2e66b20d4ae73523dd44c445..39082c6bcd70879c4ce6d7970fbccdbdb788fc1a 100644 (file)
@@ -79,7 +79,7 @@ def guess_spec(git_path, packaging_dir, given_spec, commit_id='WC.UNTRACKED'):
         except (subprocess.CalledProcessError, OSError):
             raise GbsError("failed to run %s in %s" % (' '.join(cmd), git_path))
         output = outp.communicate()[0]
-        if not output.startswith('tree %s' % git_object):
+        if not output.decode().startswith('tree %s' % git_object):
             # packaging_dir is a symlink
             packaging_dir = output
         check = lambda fname, dir_only=False: file_exists_in_rev(git_path,
@@ -777,7 +777,7 @@ def file_exists_in_rev(git_path, relative_path, commit_id, dir_only=False):
         raise GbsError('failed to check existence of %s in %s:%s' % (
             relative_path, commit_id, str(err)))
 
-    return output != ''
+    return output.decode() != ''
 
 
 def glob_in_inc(git_path, packaging_dir, pattern):
@@ -804,7 +804,7 @@ def glob_in_rev(git_path, pattern, commit_id):
         raise GbsError('failed to glob %s in %s:%s' % (
             pattern, commit_id, str(err)))
 
-    return fnmatch.filter(output.splitlines(), pattern)
+    return fnmatch.filter(output.decode().splitlines(), pattern)
 
 
 def get_editor_cmd():