← Back to issue list

repo: Use os-release(5) to detect supported Linux distributions

View original Github issue

Metadata

Project
snapcraft
Number
#1527
Type
pull request
State
merged
Author
Conan-Kudo
Labels
Created
Updated
Closed

Current evaluation

Merged after replacing the deprecated platform.linux_distribution method with /etc/os-release for Linux detection. Refactored into snapcraft/internal/common.py per reviewer feedback, approved by three reviewers, passed CI, and modified 10 files.

Suggested action:

No scores available.

Issue body

All supported Linux distributions provide an `/etc/os-release` file that contains the necessary information for determining supported repository modules to use. Thus, we can rely on it instead of the deprecated `linux_distribution` method from the `platform` module that will be removed in Python 3.7. This will also make it much easier to extend to support RPM-based Linux distributions. Signed-off-by: Neal Gompa <ngompa13@gmail.com> ----- - [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] Have you successfully run `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh unit`?

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged after replacing the deprecated platform.linux_distribution method with /etc/os-release for Linux detection. Refactored into snapcraft/internal/common.py per reviewer feedback, approved by three reviewers, passed CI, and modified 10 files.
qwen3.6-35b-a3b-mtp-q6 Merged update replacing the deprecated platform.linux_distribution method with /etc/os-release for Linux distribution detection. Logic was refactored into snapcraft/internal/common.py as _get_os_release_info following reviewer feedback.
qwen3.6-35b-a3b-mtp-q6 Merged. Replaced deprecated platform.linux_distribution() with /etc/os-release for distro detection. Moved helper to snapcraft/internal/common.py per review, enabling RPM support and fixing Python 3.7 deprecation warnings.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#59 util: replace os_release.py with distro package craft-archives merged Merged: replaced os_release.py with the distro package. Approved by a reviewer, passed CI, and reduced code by 90 lines across five files. Validated in snapcraft and rockcraft, increasing coverage by 0.01%.
76%
#3646 utils: gracefully determine host os (CRAFT-845) snapcraft merged Merged into snapcraft/7.0. Adds a class to parse /etc/os-release for graceful host OS detection and fallback when VERSION_CODENAME is unset. Forward-ported from prior work, approved, passed CI, and achieved 100% diff coverage.
71%