From 2fb6b4999527f2e491d34a58f7eb87d97ffa050e Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Sun, 28 Feb 2016 11:10:55 +0000 Subject: [PATCH] Fix for python3 --- Makefile | 2 +- wiringpi.i | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2afb13a..6b1080b 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ all: bindings python setup.py build bindings: - swig3.0 -python wiringpi.i + swig3.0 -python -threads wiringpi.i install: sudo python setup.py install diff --git a/wiringpi.i b/wiringpi.i index 0988f69..736fd89 100644 --- a/wiringpi.i +++ b/wiringpi.i @@ -1,6 +1,11 @@ %module wiringpi2 %{ +#if PY_MAJOR_VERSION >= 3 +#define PyInt_AS_LONG PyLong_AsLong +#define PyString_FromStringAndSize PyBytes_FromStringAndSize +#endif + #include "WiringPi/wiringPi/wiringPi.h" #include "WiringPi/wiringPi/wiringPiI2C.h" #include "WiringPi/wiringPi/wiringPiSPI.h"