How to use the pyalpm.Handle function in pyalpm

To help you get started, we’ve selected a few pyalpm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github archlinux / pyalpm / test / test_refcounting.py View on Github external
def get_find_grp_pkgs():
    handle = Handle('/', '/tmp/')
    repo = handle.register_syncdb(REPO_1, 0)
    repo.servers = [TEST_MIRROR.format(REPO_1, ARCH)]
    db = handle.get_syncdbs()[0]
    db.update(False)
    return find_grp_pkgs([db], "base")[0]
github archlinux / pyalpm / test / test_refcounting.py View on Github external
def get_syncdb():
    # Return syncdb, so handle should go out of scope
    handle = Handle('/', '/tmp/')
    repo = handle.register_syncdb(REPO_1, 0)
    repo.servers = [TEST_MIRROR.format(REPO_1, ARCH)]
    return handle.get_syncdbs()[0]
github Antergos / Cnchi / cnchi / pacman / pac.py View on Github external
def initialize_alpm(self):
        """ Set alpm setup """
        if self.config is not None:
            root_dir = self.config.options["RootDir"]
            db_path = self.config.options["DBPath"]
        else:
            root_dir = _DEFAULT_ROOT_DIR
            db_path = _DEFAULT_DB_PATH

        self.handle = pyalpm.Handle(root_dir, db_path)

        logging.debug("ALPM initialised with root dir %s and db path %s", root_dir, db_path)

        if self.handle is None:
            raise pyalpm.error

        if self.config is not None:
            self.config.apply(self.handle)

        # Set callback functions
        # Callback used for logging
        self.handle.logcb = self.cb_log
        # Callback used to report download progress
        self.handle.dlcb = self.cb_dl
        # Callback used to report total download size
        self.handle.totaldlcb = self.cb_totaldl
github FrostyX / tracer / tracer / packageManagers / alpm.py View on Github external
def __init__(self, *args, **kwargs):
			self.opts = kwargs
			self.handle = pyalpm.Handle('/', '/var/lib/pacman')
			self.db = self.handle.get_localdb()
github Antergos / Cnchi / src / pacman / pac_config.py View on Github external
def initialize_alpm(self):
        h = pyalpm.Handle(self.options["RootDir"], self.options["DBPath"])
        self.apply(h)
        return h
github Antergos / Cnchi / src / pacman / pac.py View on Github external
def initialize_alpm(self):
        """ Set alpm setup """
        if self.config is not None:
            root_dir = self.config.options["RootDir"]
            db_path = self.config.options["DBPath"]
        else:
            root_dir = _DEFAULT_ROOT_DIR
            db_path = _DEFAULT_DB_PATH

        self.handle = pyalpm.Handle(root_dir, db_path)

        logging.debug(
            "ALPM initialised with root dir %s and db path %s", root_dir, db_path)

        if self.handle is None:
            raise pyalpm.error

        if self.config is not None:
            self.config.apply(self.handle)

        # Set callback functions
        # Callback used for logging
        self.handle.logcb = self.cb_log
        # Callback used to report download progress
        self.handle.dlcb = self.cb_dl
        # Callback used to report total download size
github lfos / aurweb / aurweb / scripts / aurblup.py View on Github external
def main():
    blacklist = set()
    providers = set()
    repomap = dict()

    h = pyalpm.Handle("/", db_path)
    for sync_db in sync_dbs:
        repo = h.register_syncdb(sync_db, pyalpm.SIG_DATABASE_OPTIONAL)
        repo.servers = [server.replace("%s", sync_db)]
        t = h.init_transaction()
        repo.update(False)
        t.release()

        for pkg in repo.pkgcache:
            blacklist.add(pkg.name)
            [blacklist.add(x) for x in pkg.replaces]
            providers.add((pkg.name, pkg.name))
            repomap[(pkg.name, pkg.name)] = repo.name
            for provision in pkg.provides:
                provisionname = re.sub(r'(<|=|>).*', '', provision)
                providers.add((pkg.name, provisionname))
                repomap[(pkg.name, provisionname)] = repo.name