diff options
Diffstat (limited to 'subcmds/version.py')
| -rw-r--r-- | subcmds/version.py | 75 |
1 files changed, 41 insertions, 34 deletions
diff --git a/subcmds/version.py b/subcmds/version.py index c68cb0af..c539db63 100644 --- a/subcmds/version.py +++ b/subcmds/version.py | |||
| @@ -22,45 +22,52 @@ from wrapper import Wrapper | |||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | class Version(Command, MirrorSafeCommand): | 24 | class Version(Command, MirrorSafeCommand): |
| 25 | wrapper_version = None | 25 | wrapper_version = None |
| 26 | wrapper_path = None | 26 | wrapper_path = None |
| 27 | 27 | ||
| 28 | COMMON = False | 28 | COMMON = False |
| 29 | helpSummary = "Display the version of repo" | 29 | helpSummary = "Display the version of repo" |
| 30 | helpUsage = """ | 30 | helpUsage = """ |
| 31 | %prog | 31 | %prog |
| 32 | """ | 32 | """ |
| 33 | 33 | ||
| 34 | def Execute(self, opt, args): | 34 | def Execute(self, opt, args): |
| 35 | rp = self.manifest.repoProject | 35 | rp = self.manifest.repoProject |
| 36 | rem = rp.GetRemote() | 36 | rem = rp.GetRemote() |
| 37 | branch = rp.GetBranch('default') | 37 | branch = rp.GetBranch("default") |
| 38 | 38 | ||
| 39 | # These might not be the same. Report them both. | 39 | # These might not be the same. Report them both. |
| 40 | src_ver = RepoSourceVersion() | 40 | src_ver = RepoSourceVersion() |
| 41 | rp_ver = rp.bare_git.describe(HEAD) | 41 | rp_ver = rp.bare_git.describe(HEAD) |
| 42 | print('repo version %s' % rp_ver) | 42 | print("repo version %s" % rp_ver) |
| 43 | print(' (from %s)' % rem.url) | 43 | print(" (from %s)" % rem.url) |
| 44 | print(' (tracking %s)' % branch.merge) | 44 | print(" (tracking %s)" % branch.merge) |
| 45 | print(' (%s)' % rp.bare_git.log('-1', '--format=%cD', HEAD)) | 45 | print(" (%s)" % rp.bare_git.log("-1", "--format=%cD", HEAD)) |
| 46 | 46 | ||
| 47 | if self.wrapper_path is not None: | 47 | if self.wrapper_path is not None: |
| 48 | print('repo launcher version %s' % self.wrapper_version) | 48 | print("repo launcher version %s" % self.wrapper_version) |
| 49 | print(' (from %s)' % self.wrapper_path) | 49 | print(" (from %s)" % self.wrapper_path) |
| 50 | 50 | ||
| 51 | if src_ver != rp_ver: | 51 | if src_ver != rp_ver: |
| 52 | print(' (currently at %s)' % src_ver) | 52 | print(" (currently at %s)" % src_ver) |
| 53 | 53 | ||
| 54 | print('repo User-Agent %s' % user_agent.repo) | 54 | print("repo User-Agent %s" % user_agent.repo) |
| 55 | print('git %s' % git.version_tuple().full) | 55 | print("git %s" % git.version_tuple().full) |
| 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 | if sys.version_info.major < 3: | 59 | if sys.version_info.major < 3: |
| 60 | # Python 3 returns a named tuple, but Python 2 is simpler. | 60 | # Python 3 returns a named tuple, but Python 2 is simpler. |
| 61 | print(uname) | 61 | print(uname) |
| 62 | else: | 62 | else: |
| 63 | print('OS %s %s (%s)' % (uname.system, uname.release, uname.version)) | 63 | print( |
| 64 | print('CPU %s (%s)' % | 64 | "OS %s %s (%s)" % (uname.system, uname.release, uname.version) |
| 65 | (uname.machine, uname.processor if uname.processor else 'unknown')) | 65 | ) |
| 66 | print('Bug reports:', Wrapper().BUG_URL) | 66 | print( |
| 67 | "CPU %s (%s)" | ||
| 68 | % ( | ||
| 69 | uname.machine, | ||
| 70 | uname.processor if uname.processor else "unknown", | ||
| 71 | ) | ||
| 72 | ) | ||
| 73 | print("Bug reports:", Wrapper().BUG_URL) | ||
