From 493d5cb821b2b5f41f0cfba8e23d7f16cf170e9a Mon Sep 17 00:00:00 2001
From: Luke Horwell <code@horwell.me>
Date: Thu, 14 Nov 2019 21:04:40 +0000
Subject: [PATCH] Migrate 'platform' module to 'distro' (v0.3.12)

'platform' was dropped in Python 3.8.

Addresses #183
---
 polychromatic-controller | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/polychromatic-controller b/polychromatic-controller
index 26ff445..c8694c9 100755
--- a/polychromatic-controller
+++ b/polychromatic-controller
@@ -23,6 +23,7 @@ Main application for Polychromatic, a GUI for interfacing with Razer devices.
 Requires openrazer-daemon to be installed and running on the system.
 """
 
+import distro
 import os
 import sys
 import glob
@@ -34,7 +35,6 @@ import argparse
 from setproctitle import setproctitle
 from subprocess import Popen as background_process
 from subprocess import check_output
-from platform import linux_distribution
 
 try:
     import openrazer.client as rclient
@@ -2184,9 +2184,9 @@ class PageLoaded():
             appobj.update_device_active_options()
 
         # Show message about the old PPA being deprecated.
-        distro = linux_distribution()[0]
-        if distro == "Ubuntu" or distro == "Debian":
-            codename = linux_distribution()[2]
+        distro_name = distro.linux_distribution()[0]
+        if distro_name == "Ubuntu" or distro_name == "Debian":
+            codename = distro.codename
             for source_file in [
                 "/etc/apt/sources.list.d/lah7-ubuntu-polychromatic-" + codename + ".list",
                 "/etc/apt/sources.list.d/lah7-ubuntu-polychromatic-daily-" + codename + ".list"
@@ -2228,9 +2228,9 @@ class PageLoaded():
             html += UIControls.print_about_label(_("Profile:"), "v" + str(prof.version))
 
             # For Apt, check for the source file to determine builds.
-            distro = linux_distribution()[0]
-            if distro == "Ubuntu" or distro == "Debian":
-                codename = linux_distribution()[2]
+            distro_name = distro.linux_distribution()[0]
+            if distro_name == "Ubuntu" or distro_name == "Debian":
+                codename = distro.codename()
                 source_html = ""
 
                 source_file = "/etc/apt/sources.list.d/lah7-ubuntu-polychromatic-" + codename + ".list"
-- 
2.24.0

