mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-04-02 14:09:18 +00:00
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>
This commit is contained in:
parent
507d463600
commit
59b81c84de
17
repo
17
repo
@ -27,6 +27,7 @@ import platform
|
|||||||
import shlex
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
from typing import NamedTuple
|
||||||
|
|
||||||
|
|
||||||
# These should never be newer than the main.py version since this needs to be a
|
# 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
|
|||||||
REPO_MAIN = S_repo + "/main.py" # main script
|
REPO_MAIN = S_repo + "/main.py" # main script
|
||||||
|
|
||||||
|
|
||||||
import collections
|
|
||||||
import errno
|
import errno
|
||||||
import json
|
import json
|
||||||
import optparse
|
import optparse
|
||||||
@ -672,11 +672,16 @@ def run_git(*args, **kwargs):
|
|||||||
raise CloneFailure()
|
raise CloneFailure()
|
||||||
|
|
||||||
|
|
||||||
# The git version info broken down into components for easy analysis.
|
class GitVersion(NamedTuple):
|
||||||
# Similar to Python's sys.version_info.
|
"""The git version info broken down into components for easy analysis.
|
||||||
GitVersion = collections.namedtuple(
|
|
||||||
"GitVersion", ("major", "minor", "micro", "full")
|
Similar to Python's sys.version_info.
|
||||||
)
|
"""
|
||||||
|
|
||||||
|
major: int
|
||||||
|
minor: int
|
||||||
|
micro: int
|
||||||
|
full: int
|
||||||
|
|
||||||
|
|
||||||
def ParseGitVersion(ver_str=None):
|
def ParseGitVersion(ver_str=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user