From 2fe6f551d955029638369e0801569441961ca04b Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 12 Feb 2021 16:33:55 +0100 Subject: Do some miscellaneous tidy-up in util/cmake/ A typo-fix, a simplification and a trivial restructuring. Change-Id: I434457c4eb83eebfb9b472c6914659199fe5be71 Reviewed-by: Joerg Bornemann --- util/cmake/configurejson2cmake.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'util/cmake/configurejson2cmake.py') diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py index a5d44b4195..b5e148f63c 100755 --- a/util/cmake/configurejson2cmake.py +++ b/util/cmake/configurejson2cmake.py @@ -1520,11 +1520,9 @@ class special_cased_file: def __exit__(self, type, value, trace_back): self.file.close() - if self.preserve_special_cases and self.sc_handler.handle_special_cases(): - os.replace(self.gen_file_path, self.file_path) - else: - os.replace(self.gen_file_path, self.file_path) - + if self.preserve_special_cases: + self.sc_handler.handle_special_cases() + os.replace(self.gen_file_path, self.file_path) def processJson(path, ctx, data, skip_special_case_preservation=False): ctx["project_dir"] = path @@ -1572,11 +1570,8 @@ def main(): print("This scripts needs one directory to process!") quit(1) - skip_special_case_preservation = False - if len(sys.argv) > 2 and sys.argv[2] == "-s": - skip_special_case_preservation = True - directory = sys.argv[1] + skip_special_case_preservation = '-s' in sys.argv[2:] print(f"Processing: {directory}.") -- cgit v1.2.3