From e2d1141de25433ba8f7803957d3ad4afdf4da043 Mon Sep 17 00:00:00 2001 From: czoido Date: Wed, 13 Sep 2023 16:42:34 +0200 Subject: [PATCH 1/2] check if we can change default --- conan/tools/system/package_manager.py | 5 ++--- conans/test/integration/tools/system/package_manager_test.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/conan/tools/system/package_manager.py b/conan/tools/system/package_manager.py index a274e96d949..b64876bca1f 100644 --- a/conan/tools/system/package_manager.py +++ b/conan/tools/system/package_manager.py @@ -234,7 +234,7 @@ def __init__(self, conanfile, arch_names=None): self._arch_separator = ":" - def install(self, packages, update=False, check=False, recommends=False): + def install(self, packages, recommends=False, **kwargs): """ Will try to install the list of packages passed as a parameter. Its behaviour is affected by the value of ``tools.system.package_manager:mode`` @@ -248,8 +248,7 @@ def install(self, packages, update=False, check=False, recommends=False): :return: the return code of the executed apt command. """ recommends_str = '' if recommends else '--no-install-recommends ' - return super(Apt, self).install(packages, update=update, check=check, - recommends=recommends_str) + return super(Apt, self).install(packages, recommends=recommends_str, **kwargs) class Yum(_SystemPackageManagerTool): diff --git a/conans/test/integration/tools/system/package_manager_test.py b/conans/test/integration/tools/system/package_manager_test.py index 9c268e553c7..bf20c43d88c 100644 --- a/conans/test/integration/tools/system/package_manager_test.py +++ b/conans/test/integration/tools/system/package_manager_test.py @@ -100,7 +100,7 @@ def test_apt_install_recommends(recommends, recommends_str): with mock.patch('conan.ConanFile.context', new_callable=PropertyMock) as context_mock: context_mock.return_value = "host" apt = Apt(conanfile) - apt.install(["package1", "package2"], recommends=recommends) + apt.install(["package1", "package2"], recommends=recommends, check=False) assert apt._conanfile.command == "apt-get install -y {}package1 package2".format(recommends_str) From 34a2fe031887abf9bc326d2a9cbb44f966cb2d7a Mon Sep 17 00:00:00 2001 From: czoido Date: Thu, 14 Sep 2023 09:07:23 +0200 Subject: [PATCH 2/2] fix arguments --- conan/tools/system/package_manager.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/conan/tools/system/package_manager.py b/conan/tools/system/package_manager.py index b64876bca1f..87cb6b87174 100644 --- a/conan/tools/system/package_manager.py +++ b/conan/tools/system/package_manager.py @@ -234,7 +234,7 @@ def __init__(self, conanfile, arch_names=None): self._arch_separator = ":" - def install(self, packages, recommends=False, **kwargs): + def install(self, packages, update=False, check=True, recommends=False): """ Will try to install the list of packages passed as a parameter. Its behaviour is affected by the value of ``tools.system.package_manager:mode`` @@ -248,7 +248,8 @@ def install(self, packages, recommends=False, **kwargs): :return: the return code of the executed apt command. """ recommends_str = '' if recommends else '--no-install-recommends ' - return super(Apt, self).install(packages, recommends=recommends_str, **kwargs) + return super(Apt, self).install(packages, update=update, check=check, + recommends=recommends_str) class Yum(_SystemPackageManagerTool):