summarylogtreecommitdiffstats
path: root/install_remove_apt_check.patch
blob: 4bf249c5075ce03a407fcfd9541af80c0e4a58bb (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
--- a/usr/lib/linuxmint/mintlocale/install_remove.py
+++ b/usr/lib/linuxmint/mintlocale/install_remove.py
@@ -2,8 +2,6 @@
 
 import os
 import gettext
-import apt_pkg
-import aptkit.simpleclient
 import subprocess
 import locale
 import codecs
@@ -11,6 +9,13 @@
 import gi
 gi.require_version('Gtk', '3.0')
 from gi.repository import Gtk, Gdk, GdkPixbuf
+
+# Used to detect Debian derivatives (we don't want to show APT features in other distros)
+IS_DEBIAN = os.path.exists("/etc/debian_version")
+
+if IS_DEBIAN:
+    import apt_pkg
+    import aptkit.simpleclient
 
 # i18n
 APP = 'mintlocale'
@@ -53,8 +58,9 @@
                     else:
                         self.language_packs.append(LanguagePack(category, language, dependency, package))
 
-        apt_pkg.init()
-        self.cache = apt_pkg.Cache(None)
+        if IS_DEBIAN:
+            apt_pkg.init()
+            self.cache = apt_pkg.Cache(None)
         self.cache_updated = False
 
 
@@ -97,7 +103,8 @@
 
         self.build_lang_list()
 
-        self.apt = aptkit.simpleclient.SimpleAPTClient(self.window)
+        if IS_DEBIAN
+            self.apt = aptkit.simpleclient.SimpleAPTClient(self.window)
 
     def data_func_surface(self, column, cell, model, iter_, *args):
         pixbuf = model.get_value(iter_, 2)