File sles15.patch of Package koan

Index: koan-2.9.0/koan/utils.py
===================================================================
--- koan-2.9.0.orig/koan/utils.py
+++ koan-2.9.0/koan/utils.py
@@ -332,6 +332,13 @@ def check_dist():
         return lsb_release.get_distro_information()['ID'].lower()
     elif os.path.exists("/etc/SuSE-release"):
         return "suse"
+    elif os.path.exists("/etc/os-release"):
+        fh = open("/etc/os-release")
+        data = fh.read().lower()
+        if data.find("suse") != -1:
+            return "suse"
+        else:
+            return "redhat"
     else:
         # valid for Fedora and all Red Hat / Fedora derivatives
         return "redhat"
@@ -372,14 +379,26 @@ def os_release():
         make = "ubuntu"
         return (make, float(version))
     elif check_dist() in ("suse", "opensuse"):
-        fd = open("/etc/SuSE-release")
-        for line in fd.read().split("\n"):
-            if line.find("VERSION") != -1:
-                version = line.replace("VERSION = ", "")
-            if line.find("PATCHLEVEL") != -1:
-                rest = line.replace("PATCHLEVEL = ", "")
-        make = "suse"
-        return (make, float(version))
+        if os.path.exists("/etc/SuSE-release"):
+            fd = open("/etc/SuSE-release")
+            for line in fd.read().split("\n"):
+                if line.find("VERSION") != -1:
+                    version = line.replace("VERSION = ", "")
+                if line.find("PATCHLEVEL") != -1:
+                    rest = line.replace("PATCHLEVEL = ", "")
+            make = "suse"
+            return (make, float(version))
+        elif os.path.exists("/etc/os-release"):
+            fd = open("/etc/os-release")
+            for line in fd.read().split("\n"):
+                if line.find("VERSION_ID=") != -1:
+                    version = line.replace("VERSION_ID=", "").strip('"')
+                if line.find("PATCHLEVEL") != -1:
+                    rest = line.replace("PATCHLEVEL=", "").strip('"')
+            make = "suse"
+            return (make, float(version))
+        else:
+            return ("unknown", 0)
     else:
         return ("unknown", 0)
openSUSE Build Service is sponsored by