From: Peter Collingbourne Date: Wed, 9 Jan 2019 04:05:07 +0000 (+0000) Subject: gn build: Fix a Python2ism in write_vcsrevision.py. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ca3d5270844cf978b6859a5541b90f395cddc88d;p=llvm gn build: Fix a Python2ism in write_vcsrevision.py. Convert the output of "git rev-parse --short HEAD" to a string before substituting it into the output file. Without this the output file will look like this on Python 3: #define LLVM_REVISION "git-b'6a4895a025f'" Differential Revision: https://reviews.llvm.org/D56459 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350686 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/gn/build/write_vcsrevision.py b/utils/gn/build/write_vcsrevision.py index ed7c05f1d0e..b9b3755526c 100755 --- a/utils/gn/build/write_vcsrevision.py +++ b/utils/gn/build/write_vcsrevision.py @@ -52,9 +52,9 @@ def main(): git = which('git.bat') use_shell = True rev = subprocess.check_output([git, 'rev-parse', '--short', 'HEAD'], - cwd=git_dir, shell=use_shell) + cwd=git_dir, shell=use_shell).decode().strip() # FIXME: add pizzas such as the svn revision read off a git note? - vcsrevision_contents = '#define LLVM_REVISION "git-%s"\n' % rev.strip() + vcsrevision_contents = '#define LLVM_REVISION "git-%s"\n' % rev # If the output already exists and is identical to what we'd write, # return to not perturb the existing file's timestamp.