[llvm] r350686 - gn build: Fix a Python2ism in write_vcsrevision.py.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 8 20:05:07 PST 2019


Author: pcc
Date: Tue Jan  8 20:05:07 2019
New Revision: 350686

URL: http://llvm.org/viewvc/llvm-project?rev=350686&view=rev
Log:
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

Modified:
    llvm/trunk/utils/gn/build/write_vcsrevision.py

Modified: llvm/trunk/utils/gn/build/write_vcsrevision.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/build/write_vcsrevision.py?rev=350686&r1=350685&r2=350686&view=diff
==============================================================================
--- llvm/trunk/utils/gn/build/write_vcsrevision.py (original)
+++ llvm/trunk/utils/gn/build/write_vcsrevision.py Tue Jan  8 20:05:07 2019
@@ -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.




More information about the llvm-commits mailing list