[PATCH] D56459: gn build: Fix a Python2ism in write_vcsrevision.py.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 8 15:59:06 PST 2019


pcc created this revision.
pcc added reviewers: serge-sans-paille, phosek, thakis.

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'"


Repository:
  rL LLVM

https://reviews.llvm.org/D56459

Files:
  llvm/utils/gn/build/write_vcsrevision.py


Index: llvm/utils/gn/build/write_vcsrevision.py
===================================================================
--- llvm/utils/gn/build/write_vcsrevision.py
+++ llvm/utils/gn/build/write_vcsrevision.py
@@ -53,9 +53,9 @@
         return 1
 
     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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56459.180761.patch
Type: text/x-patch
Size: 817 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190108/ec5bc7ba/attachment.bin>


More information about the llvm-commits mailing list