Skip to content
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

Ensure package conflicts are printed correctly #838

Merged
Show file tree
Hide file tree
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
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
Loading