From d5e7c2a1164921fdedb80e1b285bcc54e2dfa700 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 16 Dec 2010 16:03:35 +0000 Subject: [PATCH] Revert previous commit, renaming comedi_wrap.c back to comedi_python_wrap.c. Add "comedi_python.i" swig interface file which merely %includes the "comedi.i" in the parent directory. Fix paths in "setup.py" and set it up to run swig directly (using "comedi_python.i" as the source). Change "_comedi.py" to "comedi.py" (but keep the underscore prefix on the .so and .la files). Based on a patch by W. Trevor King. --- swig/python/Makefile.am | 10 +++++----- swig/python/comedi_python.i | 1 + swig/python/setup.py | 12 +++++++----- 3 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 swig/python/comedi_python.i diff --git a/swig/python/Makefile.am b/swig/python/Makefile.am index 7aa4cca..6f8f37b 100644 --- a/swig/python/Makefile.am +++ b/swig/python/Makefile.am @@ -2,19 +2,19 @@ if HAVE_PYTHON pyexec_LTLIBRARIES = _comedi.la clean-local: - $(RM) comedi_wrap.c comedi.py + $(RM) comedi_python_wrap.c comedi.py else pyexec_LTLIBRARIES = clean-local: endif -nodist__comedi_la_SOURCES = comedi_wrap.c +nodist__comedi_la_SOURCES = comedi_python_wrap.c _comedi_la_CFLAGS = $(COMEDILIB_CFLAGS) $(PYTHON_INCLUDES) $(PYTHON_QUIET) _comedi_la_LDFLAGS = -module -avoid-version $(COMEDILIB_LIBS) pyexec_SCRIPTS = comedi.py -EXTRA_DIST = README.txt setup.py test_comedi.py +EXTRA_DIST = README.txt comedi_python.i setup.py test_comedi.py -comedi_wrap.c comedi.py: $(srcdir)/../comedi.i - $(SWIG) -python -o comedi_wrap.c -I$(top_srcdir)/include $(srcdir)/../comedi.i +comedi_python_wrap.c comedi.py: $(srcdir)/comedi_python.i $(srcdir)/../comedi.i + $(SWIG) -python -o comedi_python_wrap.c -I$(top_srcdir)/include -I$(srcdir)/.. $(srcdir)/comedi_python.i diff --git a/swig/python/comedi_python.i b/swig/python/comedi_python.i new file mode 100644 index 0000000..e18d092 --- /dev/null +++ b/swig/python/comedi_python.i @@ -0,0 +1 @@ +%include "comedi.i" diff --git a/swig/python/setup.py b/swig/python/setup.py index 4c0c1eb..3f3aa41 100644 --- a/swig/python/setup.py +++ b/swig/python/setup.py @@ -3,15 +3,17 @@ from distutils.core import setup, Extension module1 = Extension('_comedi', define_macros = [('MAJOR_VERSION','0'), ('MINOR_VERSION','1')], - include_dirs = ['../include'], - library_dirs = ['../lib'], + include_dirs = ['../../include'], + library_dirs = ['../../lib'], + swig_opts = ['-I../../include', '-I..'], libraries = ['comedi'], - sources = ['comedi_wrap.c']) + sources = ['comedi_python.i']) -setup (name='_comedi', +setup (name='comedi', version = '0.1', description = 'Python wrapper module for the Comedi data-acquisition drivers', author = 'Bryan E. Cole', author_email = 'bryan.cole@teraview.co.uk', long_description = ''' Wrapper for the Comedi data-acquisition library ''', - ext_modules = [module1]) + ext_modules = [module1], + py_modules = ['comedi']) -- 2.26.2