summarylogtreecommitdiffstats
path: root/0001-Migrate-platform-module-to-distro-v0.3.12.patch
blob: 222902ff73c97350a0e52410f5051004083d545a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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