Skip to content

Commit

Permalink
Merge pull request #838 from douglasjacobsen/fix-software-package-info
Browse files Browse the repository at this point in the history
Ensure package conflicts are printed correctly
  • Loading branch information
douglasjacobsen authored Jan 23, 2025
2 parents 1b0e0bd + 556a4b9 commit 2688f37
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions lib/ramble/ramble/software_environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,19 @@ def render_package(self, expander: object, package_manager: PackageManagerBase):

if new_pkg.name in self._rendered_packages[pm_name]:
if new_pkg != self._rendered_packages[pm_name][name]:
new_info = new_pkg.info(only_used=False, color_level=-1).replace("@", "")
old_info = (
self._rendered_packages[pm_name][name]
.info(only_used=False, color_level=-1)
.replace("@", "")
)
raise RambleSoftwareEnvironmentError(
f"Package {new_pkg.name} defined multiple times with "
"inconsistent definitions.\n"
"New definition is:\n"
f"{new_pkg}"
f"{new_info}\n"
"Old definition is:\n"
f"{self._rendered_packages[pm_name][name]}"
f"{old_info}\n"
)
return self._rendered_packages[pm_name][name]
else:
Expand Down
4 changes: 3 additions & 1 deletion lib/ramble/ramble/util/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@


def level_func(level):
if level <= 0:
if level < 0:
return str
elif level == 0:
return section_title
elif level == 1:
return nested_1
Expand Down

0 comments on commit 2688f37

Please sign in to comment.