Rename get_updated_config_files() to find_updated_config_files() and make
authorZac Medico <zmedico@gentoo.org>
Thu, 30 Jul 2009 20:48:08 +0000 (20:48 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 30 Jul 2009 20:48:08 +0000 (20:48 -0000)
it an iterator of tuples.

svn path=/main/trunk/; revision=13859

pym/_emerge/actions.py
pym/portage/util.py

index affa6bc49dc363b7f68c335099a5bae1796b0778..94ec37e8afd972bb600eda20214be9d140de48db 100644 (file)
@@ -2610,7 +2610,8 @@ def load_emerge_config(trees=None):
        return settings, trees, mtimedb
 
 def chk_updated_cfg_files(target_root, config_protect):
-       result = portage.util.get_updated_config_files(target_root, config_protect)
+       result = list(
+               portage.util.find_updated_config_files(target_root, config_protect))
 
        for x in result:
                print "\n"+colorize("WARN", " * IMPORTANT:"),
@@ -2619,7 +2620,7 @@ def chk_updated_cfg_files(target_root, config_protect):
                else: # it's a protected dir
                        print "%d config files in '%s' need updating." % (len(x[1]), x[0])
 
-       if result != []:
+       if result:
                print " "+yellow("*")+" See the "+colorize("INFORM","CONFIGURATION FILES")\
                                + " section of the " + bold("emerge")
                print " "+yellow("*")+" man page to learn how to update config files."
index 1759e132e5d2e18fd43c2593fb7b5f894e025a1e..f3e79ba7c89706b410a73de8f48a597989a801a8 100644 (file)
@@ -5,7 +5,7 @@
 __all__ = ['apply_permissions', 'apply_recursive_permissions',
        'apply_secpass_permissions', 'apply_stat_permissions', 'atomic_ofstream',
        'cmp_sort_key', 'ConfigProtect', 'dump_traceback', 'ensure_dirs',
-       'getconfig', 'getlibpaths', 'get_updated_config_files' 'grabdict',
+       'find_updated_config_files', 'getconfig', 'getlibpaths', 'grabdict',
        'grabdict_package', 'grabfile', 'grabfile_package', 'grablines',
        'initialize_logger', 'LazyItemsDict', 'map_dictlist_vals',
        'new_protect_filename', 'normalize_path', 'pickle_read', 'stack_dictlist',
@@ -1291,7 +1291,7 @@ def new_protect_filename(mydest, newmd5=None):
                                return old_pfile
        return new_pfile
 
-def get_updated_config_files(target_root, config_protect):
+def find_updated_config_files(target_root, config_protect):
        """
        Return a list of configuration files that needs to be updated.
        The list contains tuple organized like this:
@@ -1301,8 +1301,6 @@ def get_updated_config_files(target_root, config_protect):
        If no configuration files needs to be updated, [] is returned
        """
 
-       rval = []
-
        if config_protect:
                # directories with some protect files in them
                for x in config_protect:
@@ -1342,11 +1340,9 @@ def get_updated_config_files(target_root, config_protect):
                                        del files[-1]
                                if files:
                                        if stat.S_ISDIR(mymode):
-                                               rval.append([x, files])
+                                               yield (x, files)
                                        else:
-                                               rval.append([x, None])
-
-       return rval
+                                               yield (x, None)
 
 def getlibpaths(root):
        """ Return a list of paths that are used for library lookups """