Repo: Rework factory() interface

Rather than handing down a complete config, only pass what is really
needed: a repository fallback path. This can already be determined by
the caller.

Inside Repo.factory(), we can retrieve the global context now and can
stop relying on a reference stored in the config.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka
2018-08-24 19:18:02 +02:00
committed by Daniel Wagner
parent 0c66b24a12
commit 4acde53b94
2 changed files with 9 additions and 6 deletions

View File

@@ -82,9 +82,12 @@ class Config:
"""
repo_config_dict = self._config.get('repos', {})
repo_dict = {}
repo_fallback_path = os.path.dirname(self.filename)
for repo in repo_config_dict:
repo_config_dict[repo] = repo_config_dict[repo] or {}
repo_dict[repo] = Repo.factory(repo, repo_config_dict[repo], self)
repo_dict[repo] = Repo.factory(repo,
repo_config_dict[repo],
repo_fallback_path)
return repo_dict