- In the case of manipulating configuration values after loading the configuration file we need to save the changes because other analysis phases again read the configuration file - We now save the project configuration file to a temporary location since we don't want to overwrite the original - The project file location variable is then changed to this new temp file so that future reads will be on the manipulated values, not the originals Signed-off-by: Mitchell Joblin <mitchell.joblin.ext@xxxxxxxxxxx> --- codeface/configuration.py | 7 +++++++ codeface/project.py | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/codeface/configuration.py b/codeface/configuration.py index 0307925..45bf0df 100644 --- a/codeface/configuration.py +++ b/codeface/configuration.py @@ -134,6 +134,13 @@ class Configuration(Mapping): for key in unknown_keys: log.warning("Unknown key '{}' in configuration.".format(key)) + def write(self): + conf_file = "/tmp/" + self._conf["project"] + ".conf" + project_file = open(conf_file, 'w') + dic = self._conf + yaml.dump(dic, project_file) + project_file.close() + # Function for the Configuration object to function as a dict def __getitem__(self, key): return self._conf[key] diff --git a/codeface/project.py b/codeface/project.py index e12d6eb..a6edf81 100644 --- a/codeface/project.py +++ b/codeface/project.py @@ -69,6 +69,11 @@ def project_analyse(resdir, gitdir, codeface_conf, project_conf, check4ctags() project_id, dbm, all_range_ids = project_setup(conf, recreate) + + ## Save configuration file + conf.write() + project_conf = "/tmp/" + project + ".conf" + # Analyse new revision ranges for i, range_id in enumerate(all_range_ids): start_rev, end_rev, rc_rev = dbm.get_release_range(project_id, range_id) -- 1.8.3.2