diff --git a/repo b/repo index 66a2a07d..12904c3e 100755 --- a/repo +++ b/repo @@ -1060,9 +1060,13 @@ def _Version(): print('git %s' % (ParseGitVersion().full,)) print('Python %s' % sys.version) uname = platform.uname() - print('OS %s %s (%s)' % (uname.system, uname.release, uname.version)) - print('CPU %s (%s)' % - (uname.machine, uname.processor if uname.processor else 'unknown')) + 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('CPU %s (%s)' % + (uname.machine, uname.processor if uname.processor else 'unknown')) sys.exit(0) 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): print('git User-Agent %s' % user_agent.git) print('Python %s' % sys.version) uname = platform.uname() - print('OS %s %s (%s)' % (uname.system, uname.release, uname.version)) - print('CPU %s (%s)' % - (uname.machine, uname.processor if uname.processor else 'unknown')) + 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('CPU %s (%s)' % + (uname.machine, uname.processor if uname.processor else 'unknown'))