Skip to content

Add UpdateTools Routine #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions cppython/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
"""
Expand All @@ -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)

Expand All @@ -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
Expand Down