Skip to content

Commit

Permalink
Fix OpenSuse >= 15 support (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
rpluem-vf authored Oct 27, 2021
1 parent 1072f99 commit dd1a802
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
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

0 comments on commit dd1a802

Please sign in to comment.