From 1b3a2390c537d19f08064d8bbdc52d5fd40a6b78 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 30 Jul 2009 20:48:08 +0000 Subject: Rename get_updated_config_files() to find_updated_config_files() and make it an iterator of tuples. svn path=/main/trunk/; revision=13859 --- pym/_emerge/actions.py | 5 +++-- pym/portage/util.py | 12 ++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'pym') diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index affa6bc49..94ec37e8a 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -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." diff --git a/pym/portage/util.py b/pym/portage/util.py index 1759e132e..f3e79ba7c 100644 --- a/pym/portage/util.py +++ b/pym/portage/util.py @@ -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 """ -- cgit v1.2.3-1-g7c22