From: Zac Medico Date: Fri, 28 Oct 2011 05:30:34 +0000 (-0700) Subject: RepoConfig.update(): getattr/setattr loop X-Git-Tag: v2.2.0_alpha72~42 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b6c981f1165e45e3b2ccb0e97c2e0489872b750e;p=portage.git RepoConfig.update(): getattr/setattr loop --- diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 19c1aeb86..2cc8a0bdc 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -161,23 +161,15 @@ class RepoConfig(object): def update(self, new_repo): """Update repository with options in another RepoConfig""" - if new_repo.aliases is not None: - self.aliases = new_repo.aliases - if new_repo.eclass_overrides is not None: - self.eclass_overrides = new_repo.eclass_overrides - if new_repo.masters is not None: - self.masters = new_repo.masters + + for k in ('aliases', 'eclass_overrides', 'location', 'masters', + 'name', 'priority', 'sync', 'user_location'): + v = getattr(new_repo, k, None) + if v is not None: + setattr(self, k, v) + if new_repo.name is not None: - self.name = new_repo.name self.missing_repo_name = new_repo.missing_repo_name - if new_repo.user_location is not None: - self.user_location = new_repo.user_location - if new_repo.location is not None: - self.location = new_repo.location - if new_repo.priority is not None: - self.priority = new_repo.priority - if new_repo.sync is not None: - self.sync = new_repo.sync @staticmethod def _read_valid_repo_name(repo_path):