From c6ea049bd6ca669a9b11c3a2a5f39fb6a78d4964 Mon Sep 17 00:00:00 2001 From: Asher Norland Date: Thu, 19 May 2022 18:18:00 -0400 Subject: [PATCH] Add UpdateTools Routine --- cppython/project.py | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/cppython/project.py b/cppython/project.py index dd3dcd9..525d9b9 100644 --- a/cppython/project.py +++ b/cppython/project.py @@ -244,12 +244,12 @@ def cppython(self): """ return self._modified_cppython_data - def download(self) -> None: + def download_generator_tools(self) -> None: """ Download the generator tooling if required """ if not self._enabled: - cppython_logger.info("Skipping download because the project is not enabled") + cppython_logger.info("Skipping 'download_generator_tools' because the project is not enabled") return base_path = self.cppython.install_path @@ -269,6 +269,24 @@ def download(self) -> None: else: cppython_logger.info(f"The {generator.name()} generator is already downloaded") + def update_generator_tools(self) -> None: + """ + Update the generator tooling if available + """ + if not self._enabled: + cppython_logger.info("Skipping 'update_generator_tools' because the project is not enabled") + return + + self.download_generator_tools() + + base_path = self.cppython.install_path + + for generator in self._generators: + + path = base_path / generator.name() + + generator.update_generator(path) + # API Contract def install(self) -> None: """ @@ -278,9 +296,10 @@ def install(self) -> None: cppython_logger.info("Skipping install because the project is not enabled") return - cppython_logger.info("Installing project") - self.download() + cppython_logger.info("Installing tools") + self.download_generator_tools() + cppython_logger.info("Installing project") tool_path = self.cppython.tool_path tool_path.mkdir(parents=True, exist_ok=True) @@ -307,6 +326,9 @@ def update(self) -> None: cppython_logger.info("Skipping update because the project is not enabled") return + cppython_logger.info("Updating tools") + self.update_generator_tools() + cppython_logger.info("Updating project") tool_path = self.cppython.tool_path