Ejemplo n.º 1
0
static PyObject* pyalpm_package_get_db(AlpmPackage *self, void *closure) {
  alpm_db_t* db;
  CHECK_IF_INITIALIZED();
  db = alpm_pkg_get_db(self->c_data);
  if (db)
    return pyalpm_db_from_pmdb(db);
  else
    Py_RETURN_NONE;
}
Ejemplo n.º 2
0
static PyObject* pyalpm_register_syncdb(PyObject *self, PyObject *args) {
  alpm_handle_t *handle = ALPM_HANDLE(self);
  const char *dbname;
  alpm_db_t *result;
  int pgp_level;

  if (!PyArg_ParseTuple(args, "si", &dbname, &pgp_level)) {
    PyErr_Format(PyExc_TypeError, "%s() takes a string and an integer", __func__);
    return NULL;
  }

  result = alpm_register_syncdb(handle, dbname, pgp_level);
  if (! result) {
    PyErr_Format(alpm_error, "unable to register sync database %s", dbname);
    return NULL;
  }

  return pyalpm_db_from_pmdb(result);
}
Ejemplo n.º 3
0
static PyObject* pyalpm_get_localdb(PyObject *self, PyObject *dummy) {
  alpm_handle_t *handle = ALPM_HANDLE(self);
  return pyalpm_db_from_pmdb(alpm_get_localdb(handle));
}