Skip to content

Commit

Permalink
Workaround for SWIG 3.0.12 import handling (NanoComp#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherHogan authored and stevengj committed Feb 2, 2018
1 parent eb01d23 commit 6c1cba5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,22 @@ endif

if MAINTAINER_MODE

SWIG ?= swig
SWIG_SRC = meep.i numpy.i vec.i
SWIG_VERSION = $(shell $(SWIG) -version | grep Version | awk '{print $$3}')

meep-python.cpp: $(SWIG_SRC) $(HPPFILES)
swig -Wextra $(AM_CPPFLAGS) -outdir $(builddir) -c++ -python -o $@ $(srcdir)/meep.i
$(SWIG) -Wextra $(AM_CPPFLAGS) -outdir $(builddir) -c++ -python -o $@ $(srcdir)/meep.i

meep.py: meep-python.cpp

__init__.py: meep.py
cp $< $@
if [[ "${SWIG_VERSION}" = 3.0.12 ]]; then \
sed -i '/^if _swig_python_version_info >= (2, 7, 0):/,/^else:/d' $@; \
sed -i 's/ import _meep/from . import _meep/' $@; \
fi


INIT_PY = __init__.py

Expand Down

0 comments on commit 6c1cba5

Please sign in to comment.