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

Fix OpenSuse >= 15 support #319

Merged
merged 2 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class InfoDict(TypedDict):
#: * Value: Normalized value.
NORMALIZED_OS_ID = {
"ol": "oracle", # Oracle Linux
"opensuse-leap": "opensuse", # Newer versions of OpenSuSE report as opensuse-leap
}

#: Translation table for normalizing the "Distributor ID" attribute returned by
Expand Down
10 changes: 10 additions & 0 deletions tests/resources/distros/opensuse15/etc/os-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NAME="openSUSE Leap"
VERSION="15.2"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.2"
PRETTY_NAME="openSUSE Leap 15.2"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.2"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
26 changes: 26 additions & 0 deletions tests/test_distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,18 @@ def test_opensuse42_os_release(self) -> None:
}
self._test_outcome(desired_outcome)

def test_opensuse15_os_release(self) -> None:
desired_outcome = {
"id": "opensuse",
"name": "openSUSE Leap",
"pretty_name": "openSUSE Leap 15.2",
"version": "15.2",
"pretty_version": "15.2",
"best_version": "15.2",
"like": "suse opensuse",
}
self._test_outcome(desired_outcome)

def test_raspbian7_os_release(self) -> None:
desired_outcome = {
"id": "raspbian",
Expand Down Expand Up @@ -1352,6 +1364,20 @@ def test_opensuse42_release(self) -> None:
}
self._test_release_file_info("SuSE-release", desired_info)

def test_opensuse15_release(self) -> None:
desired_outcome = {
"id": "opensuse",
"name": "openSUSE Leap",
"pretty_name": "openSUSE Leap 15.2",
"version": "15.2",
"pretty_version": "15.2",
"best_version": "15.2",
"like": "suse opensuse",
"major_version": "15",
"minor_version": "2",
}
self._test_outcome(desired_outcome)

def test_oracle7_release(self) -> None:
desired_outcome = {
"id": "oracle",
Expand Down