install_remove_apt_check.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --- a/usr/lib/linuxmint/mintlocale/install_remove.py
  2. +++ b/usr/lib/linuxmint/mintlocale/install_remove.py
  3. @@ -2,15 +2,21 @@
  4. import os
  5. import gettext
  6. -import apt_pkg
  7. import subprocess
  8. import locale
  9. import codecs
  10. -import mintcommon.aptdaemon
  11. import gi
  12. gi.require_version('Gtk', '3.0')
  13. from gi.repository import Gtk, Gdk, GdkPixbuf
  14. +
  15. ++
  16. ++# Used to detect Debian derivatives (we don't want to show APT features in other distros)
  17. ++IS_DEBIAN = os.path.exists("/etc/debian_version")
  18. ++
  19. ++if IS_DEBIAN:
  20. ++ import apt_pkg
  21. ++ import mintcommon.aptdaemon
  22. # i18n
  23. APP = 'mintlocale'
  24. @@ -53,8 +59,9 @@
  25. else:
  26. self.language_packs.append(LanguagePack(category, language, dependency, package))
  27. - apt_pkg.init()
  28. - self.cache = apt_pkg.Cache(None)
  29. + if IS_DEBIAN:
  30. + apt_pkg.init()
  31. + self.cache = apt_pkg.Cache(None)
  32. self.cache_updated = False
  33. @@ -134,7 +141,8 @@
  34. return (language_code, country_code, language_label)
  35. def build_lang_list(self):
  36. - self.cache = apt_pkg.Cache(None)
  37. + if IS_DEBIAN:
  38. + self.cache = apt_pkg.Cache(None)
  39. self.builder.get_object('button_install').set_sensitive(False)
  40. self.builder.get_object('button_remove').set_sensitive(False)