diff options
author | Mike Frysinger <vapier@google.com> | 2020-03-23 16:55:02 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2020-03-25 04:56:07 +0000 |
commit | e257d5666568a9621b7dfece313c705e41e17070 (patch) | |
tree | 82720ced71c4aaa1a12cecd79a95c83d506fd644 /subcmds/version.py | |
parent | 3599cc397581086b7fddcd2e07308bfdac7751b1 (diff) | |
download | git-repo-e257d5666568a9621b7dfece313c705e41e17070.tar.gz |
version: fix running under Python 2
This gets the unittests passing again for now.
Change-Id: Ibed430a305bc26b907ad0ea424c7eec7de37e942
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259994
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Jonathan Nieder <jrn@google.com>
Diffstat (limited to 'subcmds/version.py')
-rw-r--r-- | subcmds/version.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/subcmds/version.py b/subcmds/version.py index 8721bf49..0bf200f3 100644 --- a/subcmds/version.py +++ b/subcmds/version.py | |||
@@ -56,6 +56,10 @@ class Version(Command, MirrorSafeCommand): | |||
56 | print('git User-Agent %s' % user_agent.git) | 56 | print('git User-Agent %s' % user_agent.git) |
57 | print('Python %s' % sys.version) | 57 | print('Python %s' % sys.version) |
58 | uname = platform.uname() | 58 | uname = platform.uname() |
59 | print('OS %s %s (%s)' % (uname.system, uname.release, uname.version)) | 59 | if sys.version_info.major < 3: |
60 | print('CPU %s (%s)' % | 60 | # Python 3 returns a named tuple, but Python 2 is simpler. |
61 | (uname.machine, uname.processor if uname.processor else 'unknown')) | 61 | print(uname) |
62 | else: | ||
63 | print('OS %s %s (%s)' % (uname.system, uname.release, uname.version)) | ||
64 | print('CPU %s (%s)' % | ||
65 | (uname.machine, uname.processor if uname.processor else 'unknown')) | ||