Optimize PROFILE_ONLY_VARIABLES handling.
authorZac Medico <zmedico@gentoo.org>
Tue, 23 Oct 2007 19:30:15 +0000 (19:30 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 23 Oct 2007 19:30:15 +0000 (19:30 -0000)
svn path=/main/trunk/; revision=8255

pym/portage/__init__.py

index ac391e645dad4a4a3c4f7be9baed7b555683f468..cc713c1d20fda59cbfbf3b9c4164d3e27f79d64d 100644 (file)
@@ -1195,9 +1195,10 @@ class config(object):
 
 
                        # Don't allow the user to override certain variables in make.conf
-                       for key in self.mygcfg.keys():
-                               if key in self.configdict["defaults"].get("PROFILE_ONLY_VARIABLES", "").split():
-                                       del self.mygcfg[key]
+                       profile_only_variables = self.configdict["defaults"].get(
+                               "PROFILE_ONLY_VARIABLES", "").split()
+                       for k in profile_only_variables:
+                               self.mygcfg.pop(k, None)
                        
                        # Allow ROOT setting to come from make.conf if it's not overridden
                        # by the constructor argument (from the calling environment).  As a
@@ -1224,9 +1225,8 @@ class config(object):
 
                        myenv = os.environ.copy()               
                        # Don't allow the user to override certain variables in the env
-                       for key in myenv.keys():
-                               if key in self.configdict["defaults"].get("PROFILE_ONLY_VARIABLES", "").split():
-                                       del myenv[key]
+                       for k in profile_only_variables:
+                               myenv.pop(k, None)
 
                        self.configlist.append(myenv)
                        self.configdict["env"]=self.configlist[-1]