mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
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>
This commit is contained in:
parent
3599cc3975
commit
e257d56665
4
repo
4
repo
@ -1060,6 +1060,10 @@ def _Version():
|
|||||||
print('git %s' % (ParseGitVersion().full,))
|
print('git %s' % (ParseGitVersion().full,))
|
||||||
print('Python %s' % sys.version)
|
print('Python %s' % sys.version)
|
||||||
uname = platform.uname()
|
uname = platform.uname()
|
||||||
|
if sys.version_info.major < 3:
|
||||||
|
# Python 3 returns a named tuple, but Python 2 is simpler.
|
||||||
|
print(uname)
|
||||||
|
else:
|
||||||
print('OS %s %s (%s)' % (uname.system, uname.release, uname.version))
|
print('OS %s %s (%s)' % (uname.system, uname.release, uname.version))
|
||||||
print('CPU %s (%s)' %
|
print('CPU %s (%s)' %
|
||||||
(uname.machine, uname.processor if uname.processor else 'unknown'))
|
(uname.machine, uname.processor if uname.processor else 'unknown'))
|
||||||
|
@ -56,6 +56,10 @@ class Version(Command, MirrorSafeCommand):
|
|||||||
print('git User-Agent %s' % user_agent.git)
|
print('git User-Agent %s' % user_agent.git)
|
||||||
print('Python %s' % sys.version)
|
print('Python %s' % sys.version)
|
||||||
uname = platform.uname()
|
uname = platform.uname()
|
||||||
|
if sys.version_info.major < 3:
|
||||||
|
# Python 3 returns a named tuple, but Python 2 is simpler.
|
||||||
|
print(uname)
|
||||||
|
else:
|
||||||
print('OS %s %s (%s)' % (uname.system, uname.release, uname.version))
|
print('OS %s %s (%s)' % (uname.system, uname.release, uname.version))
|
||||||
print('CPU %s (%s)' %
|
print('CPU %s (%s)' %
|
||||||
(uname.machine, uname.processor if uname.processor else 'unknown'))
|
(uname.machine, uname.processor if uname.processor else 'unknown'))
|
||||||
|
Loading…
Reference in New Issue
Block a user