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: handle linux mint #15026

Merged
merged 3 commits into from
Oct 29, 2023
Merged

package_manager: handle linux mint #15026

merged 3 commits into from
Oct 29, 2023

Conversation

RMZeroFour
Copy link
Contributor

@RMZeroFour RMZeroFour commented Oct 29, 2023

Changelog: Fix: Default to apt-get package manager in Linux Mint
Docs: conan-io/docs#3441

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Linux Mint, being based on Ubuntu, should default to using the apt-get package manager. Being a decently popular OS for Linux beginners, ideally Conan should work on it with as little configuration from the user as possible, and the tool name is one such configuration that can be preset.

Right now it fails to install system packages even with sudo=True and mode=install in the global.conf file, as it doesn't know which package manager to use.

@CLAassistant
Copy link

CLAassistant commented Oct 29, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @RMZeroFour
Could you please add this to the tests? In def test_package_manager_distro(distro, tool): test, it should be just a new entry.

@RMZeroFour
Copy link
Contributor Author

There should probably be a helpful error or at least a warning on systems where the default package manager cannot be found and the user hasn't set one, right now Conan only prints out the name of the package not found, with no indication for why (no package manager). I'd be willing to contribute another commit for raising said error, if someone would be kind enough to point me to where might be the best place for this.

Will the run() method below be a suitable place to raise an error, if self._active_tool is not set?

@memsharded
Copy link
Member

There should probably be a helpful error or at least a warning on systems where the default package manager cannot be found and the user hasn't set one

Sounds that the _SystemPackageManagerTool.get_default_tool would be a good place, run() might be too noisy.
Also, it shouldn't be a warning, because it is very common that recipes define some system packages for Linux that are not necessary neither in Windows or in OSX, but recipes do not explicitly check for this. So it shouldn't be a warning in Windows or OSX, for example. But some informational message, like "A default system package manager couldn't be found for XXX, system packages will not be installed" could be good.

@RMZeroFour
Copy link
Contributor Author

There should probably be a helpful error or at least a warning on systems where the default package manager cannot be found and the user hasn't set one

Sounds that the _SystemPackageManagerTool.get_default_tool would be a good place, run() might be too noisy. Also, it shouldn't be a warning, because it is very common that recipes define some system packages for Linux that are not necessary neither in Windows or in OSX, but recipes do not explicitly check for this. So it shouldn't be a warning in Windows or OSX, for example. But some informational message, like "A default system package manager couldn't be found for XXX, system packages will not be installed" could be good.

Gotcha, that makes sense. A self._conanfile.output.info at the end of the get_default_tool function should work right? Please have a look.

@memsharded
Copy link
Member

Sounds good, approved, it will be merged for next 2.0.14 release, thanks again!

@memsharded memsharded merged commit 84e5fae into conan-io:release/2.0 Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants