mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
python: Don't generate calls with non-existent C optargs structures.
In the case where we are building a Python dist (which can be
distributed separately), we generated calls to non-existent optargs
structures if an API was once no-optargs but had optargs added. A
typical error was this (library: 1.32.5, Python sdist: 1.33.42):
guestfs-py.c: In function ‘guestfs_int_py_glob_expand’:
guestfs-py.c:9648:40: error: storage size of ‘optargs_s’ isn’t known
struct guestfs_glob_expand_opts_argv optargs_s;
This is a simple solution to this, although it has the possible
disadvantage that such functions will not be bound at all.
This commit is contained in:
@@ -253,8 +253,9 @@ put_table (char * const * const argv)
|
||||
List.iter (
|
||||
fun { name = name; style = (ret, args, optargs as style);
|
||||
blocking = blocking;
|
||||
c_name = c_name;
|
||||
c_function = c_function; c_optarg_prefix = c_optarg_prefix } ->
|
||||
pr "#ifdef GUESTFS_HAVE_%s\n" (String.uppercase name);
|
||||
pr "#ifdef GUESTFS_HAVE_%s\n" (String.uppercase c_name);
|
||||
pr "static PyObject *\n";
|
||||
pr "guestfs_int_py_%s (PyObject *self, PyObject *args)\n" name;
|
||||
pr "{\n";
|
||||
@@ -560,8 +561,8 @@ put_table (char * const * const argv)
|
||||
pr " { (char *) \"event_to_string\",\n";
|
||||
pr " guestfs_int_py_event_to_string, METH_VARARGS, NULL },\n";
|
||||
List.iter (
|
||||
fun { name = name } ->
|
||||
pr "#ifdef GUESTFS_HAVE_%s\n" (String.uppercase name);
|
||||
fun { name = name; c_name = c_name } ->
|
||||
pr "#ifdef GUESTFS_HAVE_%s\n" (String.uppercase c_name);
|
||||
pr " { (char *) \"%s\", guestfs_int_py_%s, METH_VARARGS, NULL },\n"
|
||||
name name;
|
||||
pr "#endif\n"
|
||||
|
||||
Reference in New Issue
Block a user