config: Make common repository check a bit more Pythonic
Shortens code and makes the intent clearer. Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
0e7c32cc79
commit
22f7c0b03d
@ -39,19 +39,16 @@ class Config:
|
|||||||
self._override_target = target
|
self._override_target = target
|
||||||
self._override_task = task
|
self._override_task = task
|
||||||
self._config = {}
|
self._config = {}
|
||||||
self.filenames = []
|
self.filenames = [os.path.abspath(configfile)
|
||||||
|
for configfile in filename.split(':')]
|
||||||
|
|
||||||
for configfile in filename.split(':'):
|
repo_paths = [Repo.get_root_path(os.path.dirname(configfile),
|
||||||
configfile = os.path.abspath(configfile)
|
|
||||||
repo_path = Repo.get_root_path(os.path.dirname(configfile),
|
|
||||||
fallback=False)
|
fallback=False)
|
||||||
if self.filenames == []:
|
for configfile in self.filenames]
|
||||||
common_path = repo_path
|
if len(set(repo_paths)) > 1:
|
||||||
elif repo_path != common_path:
|
|
||||||
raise IncludeException('All concatenated config files must '
|
raise IncludeException('All concatenated config files must '
|
||||||
'belong to the same repository or all '
|
'belong to the same repository or all '
|
||||||
'must be outside of versioning control')
|
'must be outside of versioning control')
|
||||||
self.filenames.append(configfile)
|
|
||||||
|
|
||||||
self.handler = IncludeHandler(self.filenames)
|
self.handler = IncludeHandler(self.filenames)
|
||||||
self.repo_dict = self._get_repo_dict()
|
self.repo_dict = self._get_repo_dict()
|
||||||
|
Loading…
Reference in New Issue
Block a user