config: Clean up ConfigStatic constructor
Make it more straightforward by removing complete variable and terminating the loop on the condition - no more missing repos - directly. Rename variables to clarify what they reference. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
		
				
					committed by
					
						
						Daniel Wagner
					
				
			
			
				
	
			
			
			
						parent
						
							8e4fbd6d3f
						
					
				
				
					commit
					19ee6edcb1
				
			@@ -313,27 +313,33 @@ class ConfigStatic(Config):
 | 
				
			|||||||
    def __init__(self, filename, _):
 | 
					    def __init__(self, filename, _):
 | 
				
			||||||
        from .includehandler import GlobalIncludes, IncludeException
 | 
					        from .includehandler import GlobalIncludes, IncludeException
 | 
				
			||||||
        super().__init__()
 | 
					        super().__init__()
 | 
				
			||||||
        self._config = {}
 | 
					 | 
				
			||||||
        self.setup_environ()
 | 
					        self.setup_environ()
 | 
				
			||||||
        self.filename = os.path.abspath(filename)
 | 
					        self.filename = os.path.abspath(filename)
 | 
				
			||||||
        self.handler = GlobalIncludes(self.filename)
 | 
					        self.handler = GlobalIncludes(self.filename)
 | 
				
			||||||
        complete = False
 | 
					
 | 
				
			||||||
        repos = {}
 | 
					        repo_paths = {}
 | 
				
			||||||
        missing_repos_old = []
 | 
					        missing_repo_names_old = []
 | 
				
			||||||
        while not complete:
 | 
					        (self._config, missing_repo_names) = \
 | 
				
			||||||
            complete = True
 | 
					            self.handler.get_config(repos=repo_paths)
 | 
				
			||||||
            self._config, missing_repos = self.handler.get_config(repos=repos)
 | 
					
 | 
				
			||||||
            if missing_repos_old and missing_repos == missing_repos_old:
 | 
					        while missing_repo_names:
 | 
				
			||||||
 | 
					            if missing_repo_names == missing_repo_names_old:
 | 
				
			||||||
                raise IncludeException('Could not fetch all repos needed by '
 | 
					                raise IncludeException('Could not fetch all repos needed by '
 | 
				
			||||||
                                       'includes.')
 | 
					                                       'includes.')
 | 
				
			||||||
            missing_repos_old = missing_repos
 | 
					
 | 
				
			||||||
            if missing_repos:
 | 
					            repo_dict = self.get_repo_dict()
 | 
				
			||||||
                complete = False
 | 
					            missing_repos = [repo_dict[repo_name]
 | 
				
			||||||
                repo_dict = self.get_repo_dict()
 | 
					                             for repo_name in missing_repo_names]
 | 
				
			||||||
                for repo in missing_repos:
 | 
					
 | 
				
			||||||
                    repo_fetch(self, repo_dict[repo])
 | 
					            for repo in missing_repos:
 | 
				
			||||||
                    repo_checkout(self, repo_dict[repo])
 | 
					                repo_fetch(self, repo)
 | 
				
			||||||
                repos = {r: repo_dict[r].path for r in repo_dict}
 | 
					                repo_checkout(self, repo)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            repo_paths = {r: repo_dict[r].path for r in repo_dict}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            missing_repo_names_old = missing_repo_names
 | 
				
			||||||
 | 
					            (self._config, missing_repo_names) = \
 | 
				
			||||||
 | 
					                self.handler.get_config(repos=repo_paths)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_repos(self):
 | 
					    def get_repos(self):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user