From 0a8c6409a2dd18fc5232e140c75ef5f25d7934a2 Mon Sep 17 00:00:00 2001 From: "biao716.wang" Date: Fri, 2 Dec 2022 18:04:30 +0900 Subject: [PATCH] fix Popen return error: python3.x return bytes, not str Change-Id: I8a4c0c566daf98aca4090d6a40b66e71cad4d7d4 Signed-off-by: biao716.wang --- gitbuildsys/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitbuildsys/utils.py b/gitbuildsys/utils.py index 1039c22..39082c6 100644 --- a/gitbuildsys/utils.py +++ b/gitbuildsys/utils.py @@ -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(): -- 2.34.1