Guest User

install_remove_apt_check.patch

a guest
Dec 25th, 2024
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. --- a/usr/lib/linuxmint/mintlocale/install_remove.py
  2. +++ b/usr/lib/linuxmint/mintlocale/install_remove.py
  3. @@ -2,7 +2,6 @@
  4.  
  5. import os
  6. import gettext
  7. -import apt_pkg
  8. import aptkit.simpleclient
  9. import subprocess
  10. import locale
  11. @@ -12,6 +11,13 @@ import gi
  12. gi.require_version('Gtk', '3.0')
  13. from gi.repository import Gtk, Gdk, GdkPixbuf
  14.  
  15. +# Used to detect Debian derivatives (we don't want to show APT features in other distros)
  16. +IS_DEBIAN = os.path.exists("/etc/debian_version")
  17. +
  18. +if IS_DEBIAN:
  19. + import apt_pkg
  20. + import mintcommon.aptdaemon
  21. +
  22. # i18n
  23. APP = 'mintlocale'
  24. LOCALE_DIR = "/usr/share/linuxmint/locale"
  25. @@ -53,8 +59,9 @@ class MintLocale:
  26. else:
  27. self.language_packs.append(LanguagePack(category, language, dependency, package))
  28.  
  29. - apt_pkg.init()
  30. - self.cache = apt_pkg.Cache(None)
  31. + if IS_DEBIAN:
  32. + apt_pkg.init()
  33. + self.cache = apt_pkg.Cache(None)
  34. self.cache_updated = False
  35.  
  36.  
  37. @@ -134,7 +141,8 @@ class MintLocale:
  38. return (language_code, country_code, language_label)
  39.  
  40. def build_lang_list(self):
  41. - self.cache = apt_pkg.Cache(None)
  42. + if IS_DEBIAN:
  43. + self.cache = apt_pkg.Cache(None)
  44.  
  45. self.builder.get_object('button_install').set_sensitive(False)
  46. self.builder.get_object('button_remove').set_sensitive(False)
  47.  
Advertisement
Add Comment
Please, Sign In to add comment