[entropy.spm] PortagePlugin: generate a dynamic config_file_map

Generate config_file_map dinamically by considering config file paths
as potential directories and if available, by adding the collected
subpaths to it
This commit is contained in:
Fabio Erculiani
2012-05-17 22:53:10 +02:00
parent dbd34912a2
commit 5dc080d475
@@ -2752,7 +2752,20 @@ class PortagePlugin(SpmPlugin):
"""
Reimplemented from SpmPlugin class.
"""
return PortagePlugin._config_files_map.copy()
config_map = PortagePlugin._config_files_map.copy()
# extend with config files inside directories
for key, path in list(config_map.items()):
if os.path.exists(path) and os.path.isdir(path):
try:
path_list = os.listdir(path)
except (OSError, IOError):
continue
for path_file in path_list:
full_path_file = os.path.join(path, path_file)
if os.path.isfile(full_path_file):
file_key = key + ":" + path_file
config_map[file_key] = full_path_file
return config_map
def execute_package_phase(self, action_metadata, package_metadata,
action_name, phase_name):