diff options
Diffstat (limited to 'ganarchy/data.py')
-rw-r--r-- | ganarchy/data.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/ganarchy/data.py b/ganarchy/data.py index 1f4cd19..36c32d9 100644 --- a/ganarchy/data.py +++ b/ganarchy/data.py @@ -71,6 +71,7 @@ class CommitPredicate(abdl.predicates.Predicate): # sanitize = skip invalid entries # validate = error on invalid entries # LEGACY. DO NOT USE. +# TODO remove CONFIG_REPOS_SANITIZE = abdl.compile("""->'projects'?:?$dict ->commit[:?$str:?$commit]:?$dict ->url[:?$str:?$uri]:?$dict @@ -86,7 +87,9 @@ CONFIG_BASE_URL_SANITIZE = abdl.compile("""->base_url'base_url'?:?$str:?$uri""", _MATCHER_REPOS = abdl.compile("""->'projects':$dict ->commit[:?$str:?$commit]:?$dict ->url[:?$str:?$uri]:?$dict - ->branch:?$dict(->'active'?:?$bool)""", + ->branch:?$dict + (->active'active'?:?$bool) + (->federate'federate'?:?$bool)?""", dict(bool=bool, dict=dict, str=str, uri=URIPredicate(), commit=CommitPredicate())) _MATCHER_REPO_LIST_SRCS = abdl.compile("""->'repo_list_srcs':$dict ->src[:?$str:?$uri]:?$dict @@ -150,6 +153,10 @@ class PCTP(OverridableProperty): def as_key(self): return (self.project_commit, self.uri, self.branch, ) + @property + def federate(self): + return self.options.get('federate', True) + class RepoListSource(OverridableProperty): """A source for a repo list. @@ -266,7 +273,7 @@ class ObjectDataSource(DataSource): _SUPPORTED_PROPERTIES = { DataProperty.INSTANCE_TITLE: lambda obj: (d['title'][1] for d in _MATCHER_TITLE.match(obj)), DataProperty.INSTANCE_BASE_URL: lambda obj: (d['base_url'][1] for d in _MATCHER_BASE_URL.match(obj)), - DataProperty.VCS_REPOS: lambda obj: (PCTP(r['commit'][0], r['url'][0], r['branch'][0], r['branch'][1]) for r in _MATCHER_REPOS.match(obj)), + DataProperty.VCS_REPOS: lambda obj: (PCTP(r['commit'][0], r['url'][0], r['branch'][0], {k: v[1] for k, v in r.items() if k in {'active', 'federate'}}) for r in _MATCHER_REPOS.match(obj)), DataProperty.REPO_LIST_SOURCES: lambda obj: (RepoListSource(d['src'][0], d['src'][1]) for d in _MATCHER_REPO_LIST_SRCS.match(obj)), } @@ -504,6 +511,10 @@ class RepoListManager(DataSource): else: for pctp in iterator: # but repo lists aren't allowed to override anything + try: + del pctp.options['federate'] + except KeyError: + pass if pctp.active: yield pctp |