[PATCH] D30594: Make llvm-git (monorepo helper) compatible with both Python 2 and 3

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 3 15:59:58 PST 2017


zturner added inline comments.


================
Comment at: llvm/utils/git-svn/git-llvm:99
             eprint('`%s` printed to stderr:' % ' '.join(cmd))
             eprint(stderr.rstrip())
         if strip:
----------------
This is a bit wrong since it will try to print call `str(b'...')` behind the scenes.  So if the output is "Hello, world" we'll see `b'Hello world`` printed.

Can you add a decode here? 


================
Comment at: llvm/utils/git-svn/git-llvm:100
             eprint(stderr.rstrip())
         if strip:
+            stdout = stdout.rstrip(b'\r\n')
----------------
I'd add the `decode` above this line, that way you can strip it without the `b` syntax.


================
Comment at: llvm/utils/git-svn/git-llvm:106
     if stderr:
         eprint(stderr.rstrip())
     if die_on_failure:
----------------
Probably will need another `decode` here.  Alternatively, you could try hiding this inside of the `eprint` function so users don't have to remember to do it.


Repository:
  rL LLVM

https://reviews.llvm.org/D30594





More information about the llvm-commits mailing list