SWIG_init() returns void for Python 2.x and 'PyObject *' for Python 3.
Use an #if to handle both cases properly, otherwise the Python bindings
for either Python 2 or 3 will fail to build.
Python 3.x failure:
sigrok/core/classes_wrap.cpp: In function ‘PyObject* PyInit__classes()’:
sigrok/core/classes_wrap.cpp:59002:5: error: return-statement with no
value, in function returning ‘PyObject* {aka _object*}’ [-fpermissive]
return;
^
Python 2.x failure:
In file included from /usr/include/dirent.h:244:0,
from /usr/include/glib-2.0/glib/gdir.h:32,
from /usr/include/glib-2.0/glib.h:45,
from /usr/include/pygobject-3.0/pygobject.h:7,
from sigrok/core/classes_wrap.cpp:3179:
sigrok/core/classes_wrap.cpp: In function ‘void init_classes()’:
sigrok/core/classes_wrap.cpp:59002:12: error: return-statement with a
value, in function returning 'void' [-fpermissive]
return NULL;
^
Extend setup.py to allow environment variables to be set on the
command line. Use that functionality to replace the pkg-config
invocations with flags passed on from make. Suppress the annoying
-Wstrict-prototypes warning by overriding the OPT variable.
Also move the "cd bindings/python" from Makefile.am to setup.py
to side-step problems with "cd" in make rules.
This also fixes bug #628.
The tables defined with this struct can now be used for information
on items other than config keys.
Functions to access these tables have been renamed sr_key_info_[name_]get.
These take an extra argument, keytype, which should be set to SR_KEY_CONFIG
to get the config key tables. Other key types will be added.
This fixes a build problem due to the reduced include search paths
introduced by my recent changes. Also fix a couple of other
includes to use angle brackets.
When the import of gi.repository.GLib failed, we would get a NULL
pointer that we passed along without any checking. In this situation,
the entire program would crash with a segmentation fault, and no
message to indicate the problem.
When the import fails, abort the SWIG init and print a message. The
Python interpreter then prints out a backtrace, which can be useful
in tracking down the problem.
This requires sr_hw_cleanup_all() and sanity_check_all_drivers()
to also take a context.
The (runtime) generation of the driver list now happens in sr_init()
and sr_driver_list() always returns that pre-generated list. This fixes
a segfault when (correctly) invoking multiple sr_init() and sr_exit()
calls with different contexts (caught by the unit tests).
This fixes bug #565.
Fix "undefined reference to `sigrok::EnumValue<sigrok::LogLevel,
sr_loglevel>::_values'", which happens at least when using clang(++),
e.g. on Linux, Mac OS X, or FreeBSD.
This fixes bug #534.
Thanks to Uffe Jakobsen and Martin Ling for reporting and investigating!
As per upstream docs "#include <glibmm.h>" is the correct usage,
the "glibmm-2.4" directory is handled correctly via pkg-config:
$ pkg-config --cflags glibmm-2.4
-I/usr/include/glibmm-2.4 [...]
libsigrokcxx.pc has a "Requires" field listing "libsigrok" which
will cause libsigrok's "Requires.private" entries to be used/inherited
when 'pkg-config --libs --static libsigrokcxx' is used.
Silence some warnings when building the Python bindings:
sigrok/core/classes_wrap.cpp: In function ‘PyObject* _wrap_new_OutputFormatMap(PyObject*, PyObject*)’:
sigrok/core/classes_wrap.cpp:5232:4: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0);
^
sigrok/core/classes_wrap.cpp:14383:13: note: ‘argv[0]’ was declared here
PyObject *argv[2];
^
sigrok/core/classes_wrap.cpp: In function ‘PyObject* _wrap_new_ChannelGroupMap(PyObject*, PyObject*)’:
sigrok/core/classes_wrap.cpp:5232:4: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0);
^
sigrok/core/classes_wrap.cpp:23356:13: note: ‘argv[0]’ was declared here
PyObject *argv[2];
^
We add -Wno-uninitialized since the warnings are harmless and we really
don't care about them in the generated classes_wrap.cpp.
This fixes parts of #417.