Example #1
0
    def init_sync(self):
        """
        Loads the cache asynchronously.  Returns True if all went ok, and returns False if there
        is no cache (or it's too old.)  You should then call init() with a callback so the cache
        can be regenerated.
        """
        self.settings = Gio.Settings(schema_id="com.linuxmint.install")

        if self._fp_remotes_have_changed():
            self.remotes_changed = True
            return False

        self.backend_table = {}

        self.cache = cache.PkgCache()

        if self.cache.status == self.cache.STATUS_OK:
            self.inited = True

            GObject.idle_add(self.initialize_appstream)
            self.generate_uncached_pkginfos(self.cache)

            return True

        return False
Example #2
0
    def init(self, ready_callback=None):
        """
        Loads the cache asynchronously.  If there is no cache (or it's too old,) it causes
        one to be generated and saved.  The ready_callback is called on idle once this is finished.
        """
        self.backend_table = {}

        self.cache = cache.PkgCache()

        self._init_cb = ready_callback

        if self.cache.status == self.cache.STATUS_OK and not self.remotes_changed:
            self.inited = True

            GObject.idle_add(self._idle_cache_load_done)
        else:
            if self.remotes_changed:
                print("MintInstall: Flatpak remotes have changed, forcing a new cache.")

            self.cache.force_new_cache_async(self._idle_cache_load_done)

        return self
#!/usr/bin/python3

from installer import cache

pkgcache = cache.PkgCache()

try:
    pkgcache.force_new_cache()
except Exception as e:
    print(e)

exit()