diff --git a/python/mesa_pd/Module.py b/python/mesa_pd/Module.py index dc94b5fbf74c75521c5a1137225108a35db43ade..eec965f3ec53835682bb2037f245ea59c29e9465 100644 --- a/python/mesa_pd/Module.py +++ b/python/mesa_pd/Module.py @@ -33,7 +33,7 @@ class Module: for root, dirnames, filenames in os.walk(self.context['module_path']): for filename in filenames: filedata = None - print(f'{root}/{filename}') + # print(f'renaming module name: {root}/{filename}') with open(f'{root}/{filename}', 'r') as file: filedata = file.read() @@ -51,6 +51,8 @@ class Module: mesa_pd_folder = (Path(__file__).parents[2] / 'src' / 'mesa_pd').resolve() if (mesa_pd_folder != self.context['module_path']): + if not self.context['module_path'].exists(): + self.context['module_path'].mkdir() shutil.rmtree(self.context['module_path']) shutil.copytree(mesa_pd_folder, self.context['module_path']) diff --git a/python/mesa_pd/utility.py b/python/mesa_pd/utility.py index b5a86337d29245a4aaff6454b0fb90ae8622ea4d..0475b988bf62325eee7be8f4c48c8225ad86cd88 100644 --- a/python/mesa_pd/utility.py +++ b/python/mesa_pd/utility.py @@ -34,6 +34,9 @@ def generate_file(path, template, context={}, filename=None): if filename == None: filename = template.replace(".templ", "") env = get_jinja_environment() + if not (path / filename).exists(): + print(f"{TerminalColor.YELLOW}skipping: {(path / filename)}{TerminalColor.DEFAULT}") + return print(f"generating: {(path / filename)}") with open(path / filename, "wb") as fout: content = env.get_template(template).render(context)