From 84e5faef3c81aaa4a1582e090707fc3de3bb3a7f Mon Sep 17 00:00:00 2001 From: Ritobroto Mukherjee Date: Sun, 29 Oct 2023 19:06:04 +0530 Subject: [PATCH] package_manager: handle linux mint (#15026) * package_manager: handle linux mint * tests: verify apt-get for linux mint * package_manager: notify when not found --- conan/tools/system/package_manager.py | 7 ++++++- .../test/integration/tools/system/package_manager_test.py | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/conan/tools/system/package_manager.py b/conan/tools/system/package_manager.py index 5a40478e6a9..6b8cb887715 100644 --- a/conan/tools/system/package_manager.py +++ b/conan/tools/system/package_manager.py @@ -39,7 +39,7 @@ def get_default_tool(self): os_name = distro.id() or os_name elif os_name == "Windows" and self._conanfile.conf.get("tools.microsoft.bash:subsystem") == "msys2": os_name = "msys2" - manager_mapping = {"apt-get": ["Linux", "ubuntu", "debian", "raspbian"], + manager_mapping = {"apt-get": ["Linux", "ubuntu", "debian", "raspbian", "linuxmint"], "apk": ["alpine"], "yum": ["pidora", "scientific", "xenserver", "amazon", "oracle", "amzn", "almalinux", "rocky"], @@ -61,6 +61,11 @@ def get_default_tool(self): for d in distros: if d in os_name: return tool + + # No default package manager was found for the system, + # so notify the user + self._conanfile.output.info("A default system package manager couldn't be found for {}, " + "system packages will not be installed.".format(os_name)) def get_package_name(self, package, host_package=True): # Only if the package is for building, for example a library, diff --git a/conans/test/integration/tools/system/package_manager_test.py b/conans/test/integration/tools/system/package_manager_test.py index 669d2592757..de65d8f447c 100644 --- a/conans/test/integration/tools/system/package_manager_test.py +++ b/conans/test/integration/tools/system/package_manager_test.py @@ -45,6 +45,7 @@ def test_msys2(): @pytest.mark.parametrize("distro, tool", [ ("ubuntu", "apt-get"), ("debian", "apt-get"), + ("linuxmint", "apt-get"), ("pidora", "yum"), ("rocky", "yum"), ("fedora", "dnf"),