We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[bug] EndeavourOS not among list of distros listed for pacman support
### Environment Details (include every applicable attribute)
  * Operating System+version: EndeavourOS 2022.06.23
  * Compiler+version: Clang 14.0.6
  * Conan version: 1.51.3
  * Python version: 3.10.6

### Steps to reproduce (Include if Applicable)
In a python interpreter
```bash
>>> from conans import tools
>>> tools.os_info.with_pacman
False
>>>tools.os_info.is_linux
True
>>> tools.os_info.linux_distro
'endeavouros'
```

We need to add `endeavouros` to this [line](https://github.com/conan-io/conan/blob/develop/conans/client/tools/oss.py#L220)

### Logs (Executed commands with output) (Include/Attach if Applicable)
As a result of the above, OpenGL recipe doesn't know how to install itself, xorg/system also fails to install some dependencies as well

```log
opengl/system: Package installed 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
opengl/system: Downloaded package revision 0
xorg/system: Retrieving package 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 from remote 'conancenter' 
Downloading conanmanifest.txt completed [0.06k]                                          
Downloading conaninfo.txt completed [0.16k]                                              
Downloading conan_package.tgz completed [0.06k]                                          
Decompressing conan_package.tgz completed [0.00k]                                        
xorg/system: Package installed 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
xorg/system: Downloaded package revision 0
opengl/system: WARN: Don't know how to install OpenGL for your distro.
ERROR: xorg/system: Error in package_info() method, line 79
        pkg_config.fill_cpp_info(
        ConanException: pkg-config command ['pkg-config', '--print-provides', 'xvmc', '--print-errors'] failed with error: Command 'pkg-config --print-provides xvmc --print-errors' returned non-zero exit status 1.
Package xvmc was not found in the pkg-config search path.
Perhaps you should add the directory containing `xvmc.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xvmc', required by 'virtual:world', not found
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `conan/tools/system/package_manager.py`
Content:
```
1 import platform
2 
3 from conans.client.graph.graph import CONTEXT_BUILD
4 from conans.errors import ConanException
5 
6 
7 class _SystemPackageManagerTool(object):
8     mode_check = "check"
9     mode_install = "install"
10     tool_name = None
11     install_command = ""
12     update_command = ""
13     check_command = ""
14     accepted_install_codes = [0]
15     accepted_update_codes = [0]
16     accepted_check_codes = [0, 1]
17 
18     def __init__(self, conanfile):
19         self._conanfile = conanfile
20         self._active_tool = self._conanfile.conf.get("tools.system.package_manager:tool", default=self.get_default_tool())
21         self._sudo = self._conanfile.conf.get("tools.system.package_manager:sudo", default=False, check_type=bool)
22         self._sudo_askpass = self._conanfile.conf.get("tools.system.package_manager:sudo_askpass", default=False, check_type=bool)
23         self._mode = self._conanfile.conf.get("tools.system.package_manager:mode", default=self.mode_check)
24         self._arch = self._conanfile.settings_build.get_safe('arch') \
25             if self._conanfile.context == CONTEXT_BUILD else self._conanfile.settings.get_safe('arch')
26         self._arch_names = {}
27         self._arch_separator = ""
28 
29     def get_default_tool(self):
30         os_name = platform.system()
31         if os_name in ["Linux", "FreeBSD"]:
32             import distro
33             os_name = distro.id() or os_name
34         elif os_name == "Windows" and self._conanfile.conf.get("tools.microsoft.bash:subsystem") == "msys2":
35             os_name = "msys2"
36         manager_mapping = {"apt-get": ["Linux", "ubuntu", "debian", "raspbian"],
37                            "yum": ["pidora", "scientific", "xenserver", "amazon", "oracle", "amzn",
38                                    "almalinux", "rocky"],
39                            "dnf": ["fedora", "rhel", "centos", "mageia"],
40                            "brew": ["Darwin"],
41                            "pacman": ["arch", "manjaro", "msys2"],
42                            "choco": ["Windows"],
43                            "zypper": ["opensuse", "sles"],
44                            "pkg": ["freebsd"],
45                            "pkgutil": ["Solaris"]}
46         # first check exact match of name
47         for tool, distros in manager_mapping.items():
48             if os_name in distros:
49                 return tool
50         # in case we did not detect any exact match, check
51         # if the name is contained inside the returned distro name
52         # like for opensuse, that can have opensuse-version names
53         for tool, distros in manager_mapping.items():
54             for d in distros:
55                 if d in os_name:
56                     return tool
57 
58     def get_package_name(self, package):
59         # TODO: should we only add the arch if cross-building?
60         if self._arch in self._arch_names:
61             return "{}{}{}".format(package, self._arch_separator,
62                                    self._arch_names.get(self._arch))
63         return package
64 
65     @property
66     def sudo_str(self):
67         sudo = "sudo " if self._sudo else ""
68         askpass = "-A " if self._sudo and self._sudo_askpass else ""
69         return "{}{}".format(sudo, askpass)
70 
71     def run(self, method, *args, **kwargs):
72         if self._active_tool == self.__class__.tool_name:
73             return method(*args, **kwargs)
74 
75     def _conanfile_run(self, command, accepted_returns):
76         ret = self._conanfile.run(command, ignore_errors=True)
77         if ret not in accepted_returns:
78             raise ConanException("Command '%s' failed" % command)
79         return ret
80 
81     def install_substitutes(self, *args, **kwargs):
82         return self.run(self._install_substitutes, *args, **kwargs)
83 
84     def install(self, *args, **kwargs):
85         return self.run(self._install, *args, **kwargs)
86 
87     def update(self, *args, **kwargs):
88         return self.run(self._update, *args, **kwargs)
89 
90     def check(self, *args, **kwargs):
91         return self.run(self._check, *args, **kwargs)
92 
93     def _install_substitutes(self, *packages_substitutes, update=False, check=True, **kwargs):
94         errors = []
95         for packages in packages_substitutes:
96             try:
97                 return self.install(packages, update, check, **kwargs)
98             except ConanException as e:
99                 errors.append(e)
100 
101         for error in errors:
102             self._conanfile.output.warn(str(error))
103         raise ConanException("None of the installs for the package substitutes succeeded.")
104 
105     def _install(self, packages, update=False, check=True, **kwargs):
106         if check:
107             packages = self.check(packages)
108 
109         if self._mode == self.mode_check and packages:
110             raise ConanException("System requirements: '{0}' are missing but can't install "
111                                  "because tools.system.package_manager:mode is '{1}'."
112                                  "Please update packages manually or set "
113                                  "'tools.system.package_manager:mode' "
114                                  "to '{2}' in the [conf] section of the profile, "
115                                  "or in the command line using "
116                                  "'-c tools.system.package_manager:mode={2}'".format(", ".join(packages),
117                                                                                      self.mode_check,
118                                                                                      self.mode_install))
119         elif packages:
120             if update:
121                 self.update()
122 
123             packages_arch = [self.get_package_name(package) for package in packages]
124             if packages_arch:
125                 command = self.install_command.format(sudo=self.sudo_str,
126                                                       tool=self.tool_name,
127                                                       packages=" ".join(packages_arch),
128                                                       **kwargs)
129                 return self._conanfile_run(command, self.accepted_install_codes)
130         else:
131             self._conanfile.output.info("System requirements: {} already "
132                                         "installed".format(" ".join(packages)))
133 
134     def _update(self):
135         # we just update the package manager database in case we are in 'install mode'
136         # in case we are in check mode just ignore
137         if self._mode == self.mode_install:
138             command = self.update_command.format(sudo=self.sudo_str, tool=self.tool_name)
139             return self._conanfile_run(command, self.accepted_update_codes)
140 
141     def _check(self, packages):
142         missing = [pkg for pkg in packages if self.check_package(self.get_package_name(pkg)) != 0]
143         return missing
144 
145     def check_package(self, package):
146         command = self.check_command.format(tool=self.tool_name,
147                                             package=package)
148         return self._conanfile_run(command, self.accepted_check_codes)
149 
150 
151 class Apt(_SystemPackageManagerTool):
152     # TODO: apt? apt-get?
153     tool_name = "apt-get"
154     install_command = "{sudo}{tool} install -y {recommends}{packages}"
155     update_command = "{sudo}{tool} update"
156     check_command = "dpkg-query -W -f='${{Status}}' {package} | grep -q \"ok installed\""
157 
158     def __init__(self, conanfile, arch_names=None):
159         super(Apt, self).__init__(conanfile)
160         self._arch_names = {"x86_64": "amd64",
161                             "x86": "i386",
162                             "ppc32": "powerpc",
163                             "ppc64le": "ppc64el",
164                             "armv7": "arm",
165                             "armv7hf": "armhf",
166                             "armv8": "arm64",
167                             "s390x": "s390x"} if arch_names is None else arch_names
168 
169         self._arch_separator = ":"
170 
171     def install(self, packages, update=False, check=False, recommends=False):
172         recommends_str = '' if recommends else '--no-install-recommends '
173         return super(Apt, self).install(packages, update=update, check=check,
174                                         recommends=recommends_str)
175 
176 
177 class Yum(_SystemPackageManagerTool):
178     tool_name = "yum"
179     install_command = "{sudo}{tool} install -y {packages}"
180     update_command = "{sudo}{tool} check-update -y"
181     check_command = "rpm -q {package}"
182     accepted_update_codes = [0, 100]
183 
184     def __init__(self, conanfile, arch_names=None):
185         super(Yum, self).__init__(conanfile)
186         self._arch_names = {"x86_64": "x86_64",
187                             "x86": "i?86",
188                             "ppc32": "powerpc",
189                             "ppc64le": "ppc64le",
190                             "armv7": "armv7",
191                             "armv7hf": "armv7hl",
192                             "armv8": "aarch64",
193                             "s390x": "s390x"} if arch_names is None else arch_names
194         self._arch_separator = "."
195 
196 
197 class Dnf(Yum):
198     tool_name = "dnf"
199 
200 
201 class Brew(_SystemPackageManagerTool):
202     tool_name = "brew"
203     install_command = "{sudo}{tool} install {packages}"
204     update_command = "{sudo}{tool} update"
205     check_command = 'test -n "$({tool} ls --versions {package})"'
206 
207 
208 class Pkg(_SystemPackageManagerTool):
209     tool_name = "pkg"
210     install_command = "{sudo}{tool} install -y {packages}"
211     update_command = "{sudo}{tool} update"
212     check_command = "{tool} info {package}"
213 
214 
215 class PkgUtil(_SystemPackageManagerTool):
216     tool_name = "pkgutil"
217     install_command = "{sudo}{tool} --install --yes {packages}"
218     update_command = "{sudo}{tool} --catalog"
219     check_command = 'test -n "`{tool} --list {package}`"'
220 
221 
222 class Chocolatey(_SystemPackageManagerTool):
223     tool_name = "choco"
224     install_command = "{tool} install --yes {packages}"
225     update_command = "{tool} outdated"
226     check_command = '{tool} search --local-only --exact {package} | ' \
227                     'findstr /c:"1 packages installed."'
228 
229 
230 class PacMan(_SystemPackageManagerTool):
231     tool_name = "pacman"
232     install_command = "{sudo}{tool} -S --noconfirm {packages}"
233     update_command = "{sudo}{tool} -Syyu --noconfirm"
234     check_command = "{tool} -Qi {package}"
235 
236     def __init__(self, conanfile, arch_names=None):
237         super(PacMan, self).__init__(conanfile)
238         self._arch_names = {"x86": "lib32"} if arch_names is None else arch_names
239         self._arch_separator = "-"
240 
241 
242 class Zypper(_SystemPackageManagerTool):
243     tool_name = "zypper"
244     install_command = "{sudo}{tool} --non-interactive in {packages}"
245     update_command = "{sudo}{tool} --non-interactive ref"
246     check_command = "rpm -q {package}"
247
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/conan/tools/system/package_manager.py b/conan/tools/system/package_manager.py
--- a/conan/tools/system/package_manager.py
+++ b/conan/tools/system/package_manager.py
@@ -38,7 +38,7 @@
                                    "almalinux", "rocky"],
                            "dnf": ["fedora", "rhel", "centos", "mageia"],
                            "brew": ["Darwin"],
-                           "pacman": ["arch", "manjaro", "msys2"],
+                           "pacman": ["arch", "manjaro", "msys2", "endeavouros"],
                            "choco": ["Windows"],
                            "zypper": ["opensuse", "sles"],
                            "pkg": ["freebsd"],

{"golden_diff": "diff --git a/conan/tools/system/package_manager.py b/conan/tools/system/package_manager.py\n--- a/conan/tools/system/package_manager.py\n+++ b/conan/tools/system/package_manager.py\n@@ -38,7 +38,7 @@\n                                    \"almalinux\", \"rocky\"],\n                            \"dnf\": [\"fedora\", \"rhel\", \"centos\", \"mageia\"],\n                            \"brew\": [\"Darwin\"],\n-                           \"pacman\": [\"arch\", \"manjaro\", \"msys2\"],\n+                           \"pacman\": [\"arch\", \"manjaro\", \"msys2\", \"endeavouros\"],\n                            \"choco\": [\"Windows\"],\n                            \"zypper\": [\"opensuse\", \"sles\"],\n                            \"pkg\": [\"freebsd\"],\n", "issue": "[bug] EndeavourOS not among list of distros listed for pacman support\n### Environment Details (include every applicable attribute)\r\n  * Operating System+version: EndeavourOS 2022.06.23\r\n  * Compiler+version: Clang 14.0.6\r\n  * Conan version: 1.51.3\r\n  * Python version: 3.10.6\r\n\r\n### Steps to reproduce (Include if Applicable)\r\nIn a python interpreter\r\n```bash\r\n>>> from conans import tools\r\n>>> tools.os_info.with_pacman\r\nFalse\r\n>>>tools.os_info.is_linux\r\nTrue\r\n>>> tools.os_info.linux_distro\r\n'endeavouros'\r\n```\r\n\r\nWe need to add `endeavouros` to this [line](https://github.com/conan-io/conan/blob/develop/conans/client/tools/oss.py#L220)\r\n\r\n### Logs (Executed commands with output) (Include/Attach if Applicable)\r\nAs a result of the above, OpenGL recipe doesn't know how to install itself, xorg/system also fails to install some dependencies as well\r\n\r\n```log\r\nopengl/system: Package installed 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\r\nopengl/system: Downloaded package revision 0\r\nxorg/system: Retrieving package 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 from remote 'conancenter' \r\nDownloading conanmanifest.txt completed [0.06k]                                          \r\nDownloading conaninfo.txt completed [0.16k]                                              \r\nDownloading conan_package.tgz completed [0.06k]                                          \r\nDecompressing conan_package.tgz completed [0.00k]                                        \r\nxorg/system: Package installed 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\r\nxorg/system: Downloaded package revision 0\r\nopengl/system: WARN: Don't know how to install OpenGL for your distro.\r\nERROR: xorg/system: Error in package_info() method, line 79\r\n        pkg_config.fill_cpp_info(\r\n        ConanException: pkg-config command ['pkg-config', '--print-provides', 'xvmc', '--print-errors'] failed with error: Command 'pkg-config --print-provides xvmc --print-errors' returned non-zero exit status 1.\r\nPackage xvmc was not found in the pkg-config search path.\r\nPerhaps you should add the directory containing `xvmc.pc'\r\nto the PKG_CONFIG_PATH environment variable\r\nPackage 'xvmc', required by 'virtual:world', not found\r\n```\r\n\n", "before_files": [{"content": "import platform\n\nfrom conans.client.graph.graph import CONTEXT_BUILD\nfrom conans.errors import ConanException\n\n\nclass _SystemPackageManagerTool(object):\n    mode_check = \"check\"\n    mode_install = \"install\"\n    tool_name = None\n    install_command = \"\"\n    update_command = \"\"\n    check_command = \"\"\n    accepted_install_codes = [0]\n    accepted_update_codes = [0]\n    accepted_check_codes = [0, 1]\n\n    def __init__(self, conanfile):\n        self._conanfile = conanfile\n        self._active_tool = self._conanfile.conf.get(\"tools.system.package_manager:tool\", default=self.get_default_tool())\n        self._sudo = self._conanfile.conf.get(\"tools.system.package_manager:sudo\", default=False, check_type=bool)\n        self._sudo_askpass = self._conanfile.conf.get(\"tools.system.package_manager:sudo_askpass\", default=False, check_type=bool)\n        self._mode = self._conanfile.conf.get(\"tools.system.package_manager:mode\", default=self.mode_check)\n        self._arch = self._conanfile.settings_build.get_safe('arch') \\\n            if self._conanfile.context == CONTEXT_BUILD else self._conanfile.settings.get_safe('arch')\n        self._arch_names = {}\n        self._arch_separator = \"\"\n\n    def get_default_tool(self):\n        os_name = platform.system()\n        if os_name in [\"Linux\", \"FreeBSD\"]:\n            import distro\n            os_name = distro.id() or os_name\n        elif os_name == \"Windows\" and self._conanfile.conf.get(\"tools.microsoft.bash:subsystem\") == \"msys2\":\n            os_name = \"msys2\"\n        manager_mapping = {\"apt-get\": [\"Linux\", \"ubuntu\", \"debian\", \"raspbian\"],\n                           \"yum\": [\"pidora\", \"scientific\", \"xenserver\", \"amazon\", \"oracle\", \"amzn\",\n                                   \"almalinux\", \"rocky\"],\n                           \"dnf\": [\"fedora\", \"rhel\", \"centos\", \"mageia\"],\n                           \"brew\": [\"Darwin\"],\n                           \"pacman\": [\"arch\", \"manjaro\", \"msys2\"],\n                           \"choco\": [\"Windows\"],\n                           \"zypper\": [\"opensuse\", \"sles\"],\n                           \"pkg\": [\"freebsd\"],\n                           \"pkgutil\": [\"Solaris\"]}\n        # first check exact match of name\n        for tool, distros in manager_mapping.items():\n            if os_name in distros:\n                return tool\n        # in case we did not detect any exact match, check\n        # if the name is contained inside the returned distro name\n        # like for opensuse, that can have opensuse-version names\n        for tool, distros in manager_mapping.items():\n            for d in distros:\n                if d in os_name:\n                    return tool\n\n    def get_package_name(self, package):\n        # TODO: should we only add the arch if cross-building?\n        if self._arch in self._arch_names:\n            return \"{}{}{}\".format(package, self._arch_separator,\n                                   self._arch_names.get(self._arch))\n        return package\n\n    @property\n    def sudo_str(self):\n        sudo = \"sudo \" if self._sudo else \"\"\n        askpass = \"-A \" if self._sudo and self._sudo_askpass else \"\"\n        return \"{}{}\".format(sudo, askpass)\n\n    def run(self, method, *args, **kwargs):\n        if self._active_tool == self.__class__.tool_name:\n            return method(*args, **kwargs)\n\n    def _conanfile_run(self, command, accepted_returns):\n        ret = self._conanfile.run(command, ignore_errors=True)\n        if ret not in accepted_returns:\n            raise ConanException(\"Command '%s' failed\" % command)\n        return ret\n\n    def install_substitutes(self, *args, **kwargs):\n        return self.run(self._install_substitutes, *args, **kwargs)\n\n    def install(self, *args, **kwargs):\n        return self.run(self._install, *args, **kwargs)\n\n    def update(self, *args, **kwargs):\n        return self.run(self._update, *args, **kwargs)\n\n    def check(self, *args, **kwargs):\n        return self.run(self._check, *args, **kwargs)\n\n    def _install_substitutes(self, *packages_substitutes, update=False, check=True, **kwargs):\n        errors = []\n        for packages in packages_substitutes:\n            try:\n                return self.install(packages, update, check, **kwargs)\n            except ConanException as e:\n                errors.append(e)\n\n        for error in errors:\n            self._conanfile.output.warn(str(error))\n        raise ConanException(\"None of the installs for the package substitutes succeeded.\")\n\n    def _install(self, packages, update=False, check=True, **kwargs):\n        if check:\n            packages = self.check(packages)\n\n        if self._mode == self.mode_check and packages:\n            raise ConanException(\"System requirements: '{0}' are missing but can't install \"\n                                 \"because tools.system.package_manager:mode is '{1}'.\"\n                                 \"Please update packages manually or set \"\n                                 \"'tools.system.package_manager:mode' \"\n                                 \"to '{2}' in the [conf] section of the profile, \"\n                                 \"or in the command line using \"\n                                 \"'-c tools.system.package_manager:mode={2}'\".format(\", \".join(packages),\n                                                                                     self.mode_check,\n                                                                                     self.mode_install))\n        elif packages:\n            if update:\n                self.update()\n\n            packages_arch = [self.get_package_name(package) for package in packages]\n            if packages_arch:\n                command = self.install_command.format(sudo=self.sudo_str,\n                                                      tool=self.tool_name,\n                                                      packages=\" \".join(packages_arch),\n                                                      **kwargs)\n                return self._conanfile_run(command, self.accepted_install_codes)\n        else:\n            self._conanfile.output.info(\"System requirements: {} already \"\n                                        \"installed\".format(\" \".join(packages)))\n\n    def _update(self):\n        # we just update the package manager database in case we are in 'install mode'\n        # in case we are in check mode just ignore\n        if self._mode == self.mode_install:\n            command = self.update_command.format(sudo=self.sudo_str, tool=self.tool_name)\n            return self._conanfile_run(command, self.accepted_update_codes)\n\n    def _check(self, packages):\n        missing = [pkg for pkg in packages if self.check_package(self.get_package_name(pkg)) != 0]\n        return missing\n\n    def check_package(self, package):\n        command = self.check_command.format(tool=self.tool_name,\n                                            package=package)\n        return self._conanfile_run(command, self.accepted_check_codes)\n\n\nclass Apt(_SystemPackageManagerTool):\n    # TODO: apt? apt-get?\n    tool_name = \"apt-get\"\n    install_command = \"{sudo}{tool} install -y {recommends}{packages}\"\n    update_command = \"{sudo}{tool} update\"\n    check_command = \"dpkg-query -W -f='${{Status}}' {package} | grep -q \\\"ok installed\\\"\"\n\n    def __init__(self, conanfile, arch_names=None):\n        super(Apt, self).__init__(conanfile)\n        self._arch_names = {\"x86_64\": \"amd64\",\n                            \"x86\": \"i386\",\n                            \"ppc32\": \"powerpc\",\n                            \"ppc64le\": \"ppc64el\",\n                            \"armv7\": \"arm\",\n                            \"armv7hf\": \"armhf\",\n                            \"armv8\": \"arm64\",\n                            \"s390x\": \"s390x\"} if arch_names is None else arch_names\n\n        self._arch_separator = \":\"\n\n    def install(self, packages, update=False, check=False, recommends=False):\n        recommends_str = '' if recommends else '--no-install-recommends '\n        return super(Apt, self).install(packages, update=update, check=check,\n                                        recommends=recommends_str)\n\n\nclass Yum(_SystemPackageManagerTool):\n    tool_name = \"yum\"\n    install_command = \"{sudo}{tool} install -y {packages}\"\n    update_command = \"{sudo}{tool} check-update -y\"\n    check_command = \"rpm -q {package}\"\n    accepted_update_codes = [0, 100]\n\n    def __init__(self, conanfile, arch_names=None):\n        super(Yum, self).__init__(conanfile)\n        self._arch_names = {\"x86_64\": \"x86_64\",\n                            \"x86\": \"i?86\",\n                            \"ppc32\": \"powerpc\",\n                            \"ppc64le\": \"ppc64le\",\n                            \"armv7\": \"armv7\",\n                            \"armv7hf\": \"armv7hl\",\n                            \"armv8\": \"aarch64\",\n                            \"s390x\": \"s390x\"} if arch_names is None else arch_names\n        self._arch_separator = \".\"\n\n\nclass Dnf(Yum):\n    tool_name = \"dnf\"\n\n\nclass Brew(_SystemPackageManagerTool):\n    tool_name = \"brew\"\n    install_command = \"{sudo}{tool} install {packages}\"\n    update_command = \"{sudo}{tool} update\"\n    check_command = 'test -n \"$({tool} ls --versions {package})\"'\n\n\nclass Pkg(_SystemPackageManagerTool):\n    tool_name = \"pkg\"\n    install_command = \"{sudo}{tool} install -y {packages}\"\n    update_command = \"{sudo}{tool} update\"\n    check_command = \"{tool} info {package}\"\n\n\nclass PkgUtil(_SystemPackageManagerTool):\n    tool_name = \"pkgutil\"\n    install_command = \"{sudo}{tool} --install --yes {packages}\"\n    update_command = \"{sudo}{tool} --catalog\"\n    check_command = 'test -n \"`{tool} --list {package}`\"'\n\n\nclass Chocolatey(_SystemPackageManagerTool):\n    tool_name = \"choco\"\n    install_command = \"{tool} install --yes {packages}\"\n    update_command = \"{tool} outdated\"\n    check_command = '{tool} search --local-only --exact {package} | ' \\\n                    'findstr /c:\"1 packages installed.\"'\n\n\nclass PacMan(_SystemPackageManagerTool):\n    tool_name = \"pacman\"\n    install_command = \"{sudo}{tool} -S --noconfirm {packages}\"\n    update_command = \"{sudo}{tool} -Syyu --noconfirm\"\n    check_command = \"{tool} -Qi {package}\"\n\n    def __init__(self, conanfile, arch_names=None):\n        super(PacMan, self).__init__(conanfile)\n        self._arch_names = {\"x86\": \"lib32\"} if arch_names is None else arch_names\n        self._arch_separator = \"-\"\n\n\nclass Zypper(_SystemPackageManagerTool):\n    tool_name = \"zypper\"\n    install_command = \"{sudo}{tool} --non-interactive in {packages}\"\n    update_command = \"{sudo}{tool} --non-interactive ref\"\n    check_command = \"rpm -q {package}\"\n", "path": "conan/tools/system/package_manager.py"}], "after_files": [{"content": "import platform\n\nfrom conans.client.graph.graph import CONTEXT_BUILD\nfrom conans.errors import ConanException\n\n\nclass _SystemPackageManagerTool(object):\n    mode_check = \"check\"\n    mode_install = \"install\"\n    tool_name = None\n    install_command = \"\"\n    update_command = \"\"\n    check_command = \"\"\n    accepted_install_codes = [0]\n    accepted_update_codes = [0]\n    accepted_check_codes = [0, 1]\n\n    def __init__(self, conanfile):\n        self._conanfile = conanfile\n        self._active_tool = self._conanfile.conf.get(\"tools.system.package_manager:tool\", default=self.get_default_tool())\n        self._sudo = self._conanfile.conf.get(\"tools.system.package_manager:sudo\", default=False, check_type=bool)\n        self._sudo_askpass = self._conanfile.conf.get(\"tools.system.package_manager:sudo_askpass\", default=False, check_type=bool)\n        self._mode = self._conanfile.conf.get(\"tools.system.package_manager:mode\", default=self.mode_check)\n        self._arch = self._conanfile.settings_build.get_safe('arch') \\\n            if self._conanfile.context == CONTEXT_BUILD else self._conanfile.settings.get_safe('arch')\n        self._arch_names = {}\n        self._arch_separator = \"\"\n\n    def get_default_tool(self):\n        os_name = platform.system()\n        if os_name in [\"Linux\", \"FreeBSD\"]:\n            import distro\n            os_name = distro.id() or os_name\n        elif os_name == \"Windows\" and self._conanfile.conf.get(\"tools.microsoft.bash:subsystem\") == \"msys2\":\n            os_name = \"msys2\"\n        manager_mapping = {\"apt-get\": [\"Linux\", \"ubuntu\", \"debian\", \"raspbian\"],\n                           \"yum\": [\"pidora\", \"scientific\", \"xenserver\", \"amazon\", \"oracle\", \"amzn\",\n                                   \"almalinux\", \"rocky\"],\n                           \"dnf\": [\"fedora\", \"rhel\", \"centos\", \"mageia\"],\n                           \"brew\": [\"Darwin\"],\n                           \"pacman\": [\"arch\", \"manjaro\", \"msys2\", \"endeavouros\"],\n                           \"choco\": [\"Windows\"],\n                           \"zypper\": [\"opensuse\", \"sles\"],\n                           \"pkg\": [\"freebsd\"],\n                           \"pkgutil\": [\"Solaris\"]}\n        # first check exact match of name\n        for tool, distros in manager_mapping.items():\n            if os_name in distros:\n                return tool\n        # in case we did not detect any exact match, check\n        # if the name is contained inside the returned distro name\n        # like for opensuse, that can have opensuse-version names\n        for tool, distros in manager_mapping.items():\n            for d in distros:\n                if d in os_name:\n                    return tool\n\n    def get_package_name(self, package):\n        # TODO: should we only add the arch if cross-building?\n        if self._arch in self._arch_names:\n            return \"{}{}{}\".format(package, self._arch_separator,\n                                   self._arch_names.get(self._arch))\n        return package\n\n    @property\n    def sudo_str(self):\n        sudo = \"sudo \" if self._sudo else \"\"\n        askpass = \"-A \" if self._sudo and self._sudo_askpass else \"\"\n        return \"{}{}\".format(sudo, askpass)\n\n    def run(self, method, *args, **kwargs):\n        if self._active_tool == self.__class__.tool_name:\n            return method(*args, **kwargs)\n\n    def _conanfile_run(self, command, accepted_returns):\n        ret = self._conanfile.run(command, ignore_errors=True)\n        if ret not in accepted_returns:\n            raise ConanException(\"Command '%s' failed\" % command)\n        return ret\n\n    def install_substitutes(self, *args, **kwargs):\n        return self.run(self._install_substitutes, *args, **kwargs)\n\n    def install(self, *args, **kwargs):\n        return self.run(self._install, *args, **kwargs)\n\n    def update(self, *args, **kwargs):\n        return self.run(self._update, *args, **kwargs)\n\n    def check(self, *args, **kwargs):\n        return self.run(self._check, *args, **kwargs)\n\n    def _install_substitutes(self, *packages_substitutes, update=False, check=True, **kwargs):\n        errors = []\n        for packages in packages_substitutes:\n            try:\n                return self.install(packages, update, check, **kwargs)\n            except ConanException as e:\n                errors.append(e)\n\n        for error in errors:\n            self._conanfile.output.warn(str(error))\n        raise ConanException(\"None of the installs for the package substitutes succeeded.\")\n\n    def _install(self, packages, update=False, check=True, **kwargs):\n        if check:\n            packages = self.check(packages)\n\n        if self._mode == self.mode_check and packages:\n            raise ConanException(\"System requirements: '{0}' are missing but can't install \"\n                                 \"because tools.system.package_manager:mode is '{1}'.\"\n                                 \"Please update packages manually or set \"\n                                 \"'tools.system.package_manager:mode' \"\n                                 \"to '{2}' in the [conf] section of the profile, \"\n                                 \"or in the command line using \"\n                                 \"'-c tools.system.package_manager:mode={2}'\".format(\", \".join(packages),\n                                                                                     self.mode_check,\n                                                                                     self.mode_install))\n        elif packages:\n            if update:\n                self.update()\n\n            packages_arch = [self.get_package_name(package) for package in packages]\n            if packages_arch:\n                command = self.install_command.format(sudo=self.sudo_str,\n                                                      tool=self.tool_name,\n                                                      packages=\" \".join(packages_arch),\n                                                      **kwargs)\n                return self._conanfile_run(command, self.accepted_install_codes)\n        else:\n            self._conanfile.output.info(\"System requirements: {} already \"\n                                        \"installed\".format(\" \".join(packages)))\n\n    def _update(self):\n        # we just update the package manager database in case we are in 'install mode'\n        # in case we are in check mode just ignore\n        if self._mode == self.mode_install:\n            command = self.update_command.format(sudo=self.sudo_str, tool=self.tool_name)\n            return self._conanfile_run(command, self.accepted_update_codes)\n\n    def _check(self, packages):\n        missing = [pkg for pkg in packages if self.check_package(self.get_package_name(pkg)) != 0]\n        return missing\n\n    def check_package(self, package):\n        command = self.check_command.format(tool=self.tool_name,\n                                            package=package)\n        return self._conanfile_run(command, self.accepted_check_codes)\n\n\nclass Apt(_SystemPackageManagerTool):\n    # TODO: apt? apt-get?\n    tool_name = \"apt-get\"\n    install_command = \"{sudo}{tool} install -y {recommends}{packages}\"\n    update_command = \"{sudo}{tool} update\"\n    check_command = \"dpkg-query -W -f='${{Status}}' {package} | grep -q \\\"ok installed\\\"\"\n\n    def __init__(self, conanfile, arch_names=None):\n        super(Apt, self).__init__(conanfile)\n        self._arch_names = {\"x86_64\": \"amd64\",\n                            \"x86\": \"i386\",\n                            \"ppc32\": \"powerpc\",\n                            \"ppc64le\": \"ppc64el\",\n                            \"armv7\": \"arm\",\n                            \"armv7hf\": \"armhf\",\n                            \"armv8\": \"arm64\",\n                            \"s390x\": \"s390x\"} if arch_names is None else arch_names\n\n        self._arch_separator = \":\"\n\n    def install(self, packages, update=False, check=False, recommends=False):\n        recommends_str = '' if recommends else '--no-install-recommends '\n        return super(Apt, self).install(packages, update=update, check=check,\n                                        recommends=recommends_str)\n\n\nclass Yum(_SystemPackageManagerTool):\n    tool_name = \"yum\"\n    install_command = \"{sudo}{tool} install -y {packages}\"\n    update_command = \"{sudo}{tool} check-update -y\"\n    check_command = \"rpm -q {package}\"\n    accepted_update_codes = [0, 100]\n\n    def __init__(self, conanfile, arch_names=None):\n        super(Yum, self).__init__(conanfile)\n        self._arch_names = {\"x86_64\": \"x86_64\",\n                            \"x86\": \"i?86\",\n                            \"ppc32\": \"powerpc\",\n                            \"ppc64le\": \"ppc64le\",\n                            \"armv7\": \"armv7\",\n                            \"armv7hf\": \"armv7hl\",\n                            \"armv8\": \"aarch64\",\n                            \"s390x\": \"s390x\"} if arch_names is None else arch_names\n        self._arch_separator = \".\"\n\n\nclass Dnf(Yum):\n    tool_name = \"dnf\"\n\n\nclass Brew(_SystemPackageManagerTool):\n    tool_name = \"brew\"\n    install_command = \"{sudo}{tool} install {packages}\"\n    update_command = \"{sudo}{tool} update\"\n    check_command = 'test -n \"$({tool} ls --versions {package})\"'\n\n\nclass Pkg(_SystemPackageManagerTool):\n    tool_name = \"pkg\"\n    install_command = \"{sudo}{tool} install -y {packages}\"\n    update_command = \"{sudo}{tool} update\"\n    check_command = \"{tool} info {package}\"\n\n\nclass PkgUtil(_SystemPackageManagerTool):\n    tool_name = \"pkgutil\"\n    install_command = \"{sudo}{tool} --install --yes {packages}\"\n    update_command = \"{sudo}{tool} --catalog\"\n    check_command = 'test -n \"`{tool} --list {package}`\"'\n\n\nclass Chocolatey(_SystemPackageManagerTool):\n    tool_name = \"choco\"\n    install_command = \"{tool} install --yes {packages}\"\n    update_command = \"{tool} outdated\"\n    check_command = '{tool} search --local-only --exact {package} | ' \\\n                    'findstr /c:\"1 packages installed.\"'\n\n\nclass PacMan(_SystemPackageManagerTool):\n    tool_name = \"pacman\"\n    install_command = \"{sudo}{tool} -S --noconfirm {packages}\"\n    update_command = \"{sudo}{tool} -Syyu --noconfirm\"\n    check_command = \"{tool} -Qi {package}\"\n\n    def __init__(self, conanfile, arch_names=None):\n        super(PacMan, self).__init__(conanfile)\n        self._arch_names = {\"x86\": \"lib32\"} if arch_names is None else arch_names\n        self._arch_separator = \"-\"\n\n\nclass Zypper(_SystemPackageManagerTool):\n    tool_name = \"zypper\"\n    install_command = \"{sudo}{tool} --non-interactive in {packages}\"\n    update_command = \"{sudo}{tool} --non-interactive ref\"\n    check_command = \"rpm -q {package}\"\n", "path": "conan/tools/system/package_manager.py"}]}