summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2025-03-27 16:32:16 -0400
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2025-03-28 19:13:49 -0700
commit59b81c84ded4e2312b2b554d22a51dca89825bc3 (patch)
tree4be3e56b9dfdb6ead08a0a3160f6fc84a79f4b86
parent507d46360097b830b0ad6a3c6f137c54a1b0ed8c (diff)
downloadgit-repo-59b81c84ded4e2312b2b554d22a51dca89825bc3.tar.gz
launcher: change collections.namedtuple to typing.NamedTuple
Since we require Python 3.6 now in the launcher, switch to NamedTuple so we get better documentation & typing information. Change-Id: Ic58fdc07db02fc49166eccbbc3e527f474973424 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/463721 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
-rwxr-xr-xrepo17
1 files changed, 11 insertions, 6 deletions
diff --git a/repo b/repo
index d9e28ab0..21085688 100755
--- a/repo
+++ b/repo
@@ -27,6 +27,7 @@ import platform
27import shlex 27import shlex
28import subprocess 28import subprocess
29import sys 29import sys
30from typing import NamedTuple
30 31
31 32
32# These should never be newer than the main.py version since this needs to be a 33# These should never be newer than the main.py version since this needs to be a
@@ -217,7 +218,6 @@ S_manifests = "manifests" # special manifest repository
217REPO_MAIN = S_repo + "/main.py" # main script 218REPO_MAIN = S_repo + "/main.py" # main script
218 219
219 220
220import collections
221import errno 221import errno
222import json 222import json
223import optparse 223import optparse
@@ -672,11 +672,16 @@ def run_git(*args, **kwargs):
672 raise CloneFailure() 672 raise CloneFailure()
673 673
674 674
675# The git version info broken down into components for easy analysis. 675class GitVersion(NamedTuple):
676# Similar to Python's sys.version_info. 676 """The git version info broken down into components for easy analysis.
677GitVersion = collections.namedtuple( 677
678 "GitVersion", ("major", "minor", "micro", "full") 678 Similar to Python's sys.version_info.
679) 679 """
680
681 major: int
682 minor: int
683 micro: int
684 full: int
680 685
681 686
682def ParseGitVersion(ver_str=None): 687def ParseGitVersion(ver_str=None):