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

package_manager: fix opensuse detection #11660

Merged
merged 7 commits into from Jul 22, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions conan/tools/system/package_manager.py
Expand Up @@ -40,9 +40,17 @@ def get_default_tool(self):
"zypper": ["opensuse", "sles"],
"pkg": ["freebsd"],
"pkgutil": ["Solaris"]}
# first check exact match of name
for tool, distros in manager_mapping.items():
if os_name in distros:
return tool
# in case we did not detect any exact match, check
# if the name is contained inside the returned distro name
# like for opensuse, that can have opensuse-version names
for tool, distros in manager_mapping.items():
for d in distros:
if d in os_name:
return tool

def get_package_name(self, package):
# TODO: should we only add the arch if cross-building?
Expand Down
5 changes: 5 additions & 0 deletions conans/test/integration/tools/system/package_manager_test.py
Expand Up @@ -51,6 +51,11 @@ def test_msys2():
("fedora", "dnf"),
("arch", "pacman"),
("opensuse", "zypper"),
("sles", "zypper"),
("opensuse", "zypper"),
("opensuse-tumbleweed", "zypper"),
("opensuse-leap", "zypper"),
("opensuse-next_version", "zypper"),
("freebsd", "pkg"),
])
@pytest.mark.skipif(platform.system() != "Linux", reason="Only linux")
Expand Down