Skip to content

Commit 2e60535

Browse files
authored
Add UpdateTools Routine (#58)
1 parent 9f51348 commit 2e60535

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

cppython/project.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,12 @@ def cppython(self):
244244
"""
245245
return self._modified_cppython_data
246246

247-
def download(self) -> None:
247+
def download_generator_tools(self) -> None:
248248
"""
249249
Download the generator tooling if required
250250
"""
251251
if not self._enabled:
252-
cppython_logger.info("Skipping download because the project is not enabled")
252+
cppython_logger.info("Skipping 'download_generator_tools' because the project is not enabled")
253253
return
254254

255255
base_path = self.cppython.install_path
@@ -269,6 +269,24 @@ def download(self) -> None:
269269
else:
270270
cppython_logger.info(f"The {generator.name()} generator is already downloaded")
271271

272+
def update_generator_tools(self) -> None:
273+
"""
274+
Update the generator tooling if available
275+
"""
276+
if not self._enabled:
277+
cppython_logger.info("Skipping 'update_generator_tools' because the project is not enabled")
278+
return
279+
280+
self.download_generator_tools()
281+
282+
base_path = self.cppython.install_path
283+
284+
for generator in self._generators:
285+
286+
path = base_path / generator.name()
287+
288+
generator.update_generator(path)
289+
272290
# API Contract
273291
def install(self) -> None:
274292
"""
@@ -278,9 +296,10 @@ def install(self) -> None:
278296
cppython_logger.info("Skipping install because the project is not enabled")
279297
return
280298

281-
cppython_logger.info("Installing project")
282-
self.download()
299+
cppython_logger.info("Installing tools")
300+
self.download_generator_tools()
283301

302+
cppython_logger.info("Installing project")
284303
tool_path = self.cppython.tool_path
285304
tool_path.mkdir(parents=True, exist_ok=True)
286305

@@ -307,6 +326,9 @@ def update(self) -> None:
307326
cppython_logger.info("Skipping update because the project is not enabled")
308327
return
309328

329+
cppython_logger.info("Updating tools")
330+
self.update_generator_tools()
331+
310332
cppython_logger.info("Updating project")
311333

312334
tool_path = self.cppython.tool_path

0 commit comments

Comments
 (0)