diff options
Diffstat (limited to 'tools/scripts/git_submodule.py')
-rw-r--r-- | tools/scripts/git_submodule.py | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/tools/scripts/git_submodule.py b/tools/scripts/git_submodule.py index 07b5eb756..b2c21de27 100644 --- a/tools/scripts/git_submodule.py +++ b/tools/scripts/git_submodule.py @@ -18,15 +18,9 @@ def subprocessCheckOutput(args): print(args) return subprocess.check_output(args).decode() -class DEPSParser: +class SubmoduleDEPSParser(resolver.DEPSParser): def __init__(self): - self.global_scope = { - 'Var': lambda var_name: '{%s}' % var_name, - 'Str': str, - 'deps_os': {}, - } - self.local_scope = {} - self.topmost_supermodule_path_prefix = '' + super().__init__() def get_vars(self): """Returns a dictionary of effective variable values @@ -37,9 +31,6 @@ class DEPSParser: #result.update(self.custom_vars or {}) return result - def get_recursedeps(self): - return self.local_scope["recursedeps"] - def createSubmodulesFromScope(self, scope, os): submodules = [] for dep in scope: @@ -48,25 +39,18 @@ class DEPSParser: url = scope[dep] elif (type(scope[dep]) == dict and 'url' in scope[dep]): url = scope[dep]['url'] - - if ('condition' in scope[dep]) and (not 'checkout_linux' in scope[dep]['condition']): + if ('condition' in scope[dep]) and \ + (not 'checkout_linux' in scope[dep]['condition']) and \ + (not 'checkout_android_native_support' in scope[dep]['condition']): url = '' - if url: url = url.format(**self.get_vars()) repo_rev = url.split('@') repo = repo_rev[0] rev = repo_rev[1] - subdir = dep - if subdir.startswith('src/'): - subdir = subdir[4:] - # Don't skip submodules that have a supermodule path prefix set (at the moment these - # are 2nd level deep submodules). - elif not self.topmost_supermodule_path_prefix: - # Ignore the information about chromium itself since we get that from git, - # also ignore anything outside src/ (e.g. depot_tools) + subdir = self.subdir(dep) + if subdir is None: continue - submodule = Submodule(subdir, repo, sp=self.topmost_supermodule_path_prefix) submodule.os = os @@ -294,7 +278,7 @@ class Submodule: def readSubmodules(self, use_deps=False): submodules = [] if use_deps: - submodules = resolver.readSubmodules() + submodules = resolver.read(SubmoduleDEPSParser) print('DEPS file provides the following submodules:') for submodule in submodules: print('{:<80}'.format(submodule.pathRelativeToTopMostSupermodule()) + '{:<120}'.format(submodule.url) + submodule.ref) |