Skip to content

Commit

Permalink
Merge branch 'mr/adjust_installation' into 'master'
Browse files Browse the repository at this point in the history
Review uninstallation handling

See merge request eng/toolchain/gnatcoll-core!166
  • Loading branch information
Nikokrock committed Dec 11, 2024
2 parents e327ec6 + 5c87aa5 commit 10b2aef
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions gprproject/gprbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,23 @@ def run(self, args: list[str], **kwargs) -> int:
)

status = 0
if cmd_name == "gprinstall":
# Try to uninstall a project before calling installation.
manifest_file = os.path.join(
final_prefix, "share", "gpr", "manifests", self.project_name
)
if os.path.isfile(manifest_file):
# We have a manifest file for the project. Perform uninstallation
uninstall_cmd = [cmd[0], "--uninstall", f"-P{manifest_file}"]
print(uninstall_cmd)
status = run(uninstall_cmd, **kwargs).returncode
if status != 0:
return status

if "--uninstall" in cmd:
# This was a explicit call to uninstall command. Nothing more to do
return status

for variants_value in self.variants_values:
final_cmd = list(cmd)
if self.variants_var:
Expand Down

0 comments on commit 10b2aef

Please sign in to comment.