[Mesa-dev] [PATCH mesa] git_sha1_gen: fix output on python3
Jose Fonseca
jfonseca at vmware.com
Wed Aug 2 14:57:52 UTC 2017
Ah, yeah. We only expect an hash, so probably it's better to avoid UTF
and presume output is ASCII:
diff --git a/bin/git_sha1_gen.py b/bin/git_sha1_gen.py
index 6d13db1e16..61e59e4131 100755
--- a/bin/git_sha1_gen.py
+++ b/bin/git_sha1_gen.py
@@ -17,4 +17,5 @@ except subprocess.CalledProcessError as e:
# don't print anything if git fails
pass
else:
+ git_sha1 = git_sha1.decode('ASCII', 'replace')
sys.stdout.write('#define MESA_GIT_SHA1 "git-%s"\n' %
git_sha1.rstrip())
On 02/08/17 15:10, Eric Engestrom wrote:
> String handling has changed on python3.
>
> Before this patch:
> After:
>
> (No change on python2, it always looked ok)
>
> Cc: Jose Fonseca <jfonseca at vmware.com>
> Fixes: b99dcbfeb344390fea99 "build: Convert git_sha1_gen script to Python."
> Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
> ---
> bin/git_sha1_gen.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/bin/git_sha1_gen.py b/bin/git_sha1_gen.py
> index e26d3a3f76..e1018cdc47 100755
> --- a/bin/git_sha1_gen.py
> +++ b/bin/git_sha1_gen.py
> @@ -12,7 +12,7 @@
> 'rev-parse',
> '--short=10',
> 'HEAD',
> - ], stderr=open(os.devnull, 'w'))
> + ], stderr=open(os.devnull, 'w')).decode("utf-8")
> except:
> # don't print anything if it fails
> pass
>
More information about the mesa-dev
mailing list