Verified Commit cd8b9cf7 authored by Jelle van der Waa's avatar Jelle van der Waa 🚧
Browse files

Update handle.arch getter/setter

Pacman now supports multiple 'Architecture' values and change the
setter/getter library functions which now accepts a list of
architectures.
parent 67596333
......@@ -154,7 +154,6 @@ static struct _alpm_str_getset dbpath_getset = { alpm_option_get_dbpath, NULL }
static struct _alpm_str_getset lockfile_getset = { alpm_option_get_lockfile, NULL };
static struct _alpm_str_getset logfile_getset = { alpm_option_get_logfile, alpm_option_set_logfile };
static struct _alpm_str_getset gpgdir_getset = { alpm_option_get_gpgdir, alpm_option_set_gpgdir };
static struct _alpm_str_getset arch_getset = { alpm_option_get_arch, alpm_option_set_arch };
/* Callback attributes get/setters */
typedef int (*alpm_cb_setter)(alpm_handle_t*, void*);
......@@ -240,9 +239,9 @@ struct PyGetSetDef pyalpm_handle_getset[] = {
/** strings */
{ "arch",
(getter)_get_string_attr,
(setter)_set_string_attr,
"Target archichecture", &arch_getset } ,
(getter)option_get_architectures_alpm,
(setter)option_set_architectures_alpm,
"Target archichecture(s)", NULL } ,
/** booleans */
{ "usesyslog",
......
......@@ -94,6 +94,22 @@ int option_set_checkspace_alpm(PyObject *self, PyObject *value, void* closure)
* in addition to getters/setters, these have add/remove methods
*/
PyObject* option_get_architectures_alpm(PyObject *self, void* closure) {
alpm_handle_t *handle = ALPM_HANDLE(self);
return alpmlist_to_pylist(alpm_option_get_architectures(handle), pyobject_from_string);
}
int option_set_architectures_alpm(PyObject *self, PyObject *value, void *closure)
{
alpm_handle_t *handle = ALPM_HANDLE(self);
alpm_list_t *target;
if (pylist_string_to_alpmlist(value, &target) == -1)
return -1;
alpm_option_set_architectures(handle, target);
return 0;
}
PyObject* option_get_cachedirs_alpm(PyObject *self, void* closure) {
alpm_handle_t *handle = ALPM_HANDLE(self);
return alpmlist_to_pylist(alpm_option_get_cachedirs(handle), pyobject_from_string);
......
......@@ -34,12 +34,14 @@ PyObject* option_get_checkspace_alpm(PyObject *self, void* closure);
int option_set_checkspace_alpm(PyObject *self, PyObject *value, void* closure);
/** list options */
PyObject* option_get_architectures_alpm(PyObject *self, void* closure);
PyObject* option_get_cachedirs_alpm(PyObject *self, void* closure);
PyObject* option_get_noupgrades_alpm(PyObject *self, void* closure);
PyObject* option_get_noextracts_alpm(PyObject *self, void* closure);
PyObject* option_get_ignorepkgs_alpm(PyObject *self, void* closure);
PyObject* option_get_ignoregrps_alpm(PyObject *self, void* closure);
int option_set_architectures_alpm(PyObject *self, PyObject *value, void *closure);
int option_set_cachedirs_alpm(PyObject *self, PyObject *value, void *closure);
int option_set_noupgrades_alpm(PyObject *self, PyObject *value, void *closure);
int option_set_noextracts_alpm(PyObject *self, PyObject *value, void *closure);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment