Commit c0b56815 authored by David C. Lonie's avatar David C. Lonie
Browse files

Work around API changes in python.

Rather than disabling matplotlib, define the missing typedef when
python is older than 2.6.

Note: Matplotlib still isn't supported on these
versions, this change just allows the module to build. A runtime check
will still fail when importing matplotlib.

Change-Id: Id5cd18cf9ea07e115104cecc16b7d1c83c46d6f1
parent 6b1a1f2c
# Check that python is both found and version >= 2.6
if(NOT PYTHON_EXECUTABLE)
message(FATAL_ERROR "Cannot build RenderingMatplotlib: PYTHON_EXECUTABLE not set.")
endif()
if(${PYTHON_VERSION_STRING} VERSION_LESS "2.6")
message(FATAL_ERROR "Cannot build RenderingMatplotlib: Python is too old. "
"Required: >= 2.6, Found: ${PYTHON_VERSION_STRING}")
# Check that python is found
if(NOT PYTHON_LIBRARIES)
message(FATAL_ERROR "Cannot build RenderingMatplotlib: PYTHON_LIBRARIES not set.")
endif()
set(Module_SRCS
......
......@@ -42,6 +42,18 @@
#include <vector>
// We need to define Py_ssize_t for older python API version
#if PYTHON_API_VERSION < 1013
// Taken from pyport.h
# ifdef HAVE_SSIZE_T
typedef ssize_t Py_ssize_t;
# elif SIZEOF_VOID_P == SIZEOF_SIZE_T
typedef Py_intptr_t Py_ssize_t;
# else
# error "Python needs a typedef for Py_ssize_t."
# endif
#endif
// Smart pointer for PyObjects. Calls Py_XDECREF when scope ends.
class SmartPyObject
{
......
Markdown is supported
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