summaryrefslogtreecommitdiff
path: root/Examples/python/import_packages
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/python/import_packages')
-rw-r--r--Examples/python/import_packages/Makefile19
-rw-r--r--Examples/python/import_packages/from_init1/Makefile4
-rw-r--r--Examples/python/import_packages/from_init1/py2/Makefile2
-rw-r--r--Examples/python/import_packages/from_init1/py2/pkg2/Makefile12
-rw-r--r--Examples/python/import_packages/from_init1/py3/Makefile2
-rw-r--r--Examples/python/import_packages/from_init1/py3/pkg2/Makefile12
-rw-r--r--Examples/python/import_packages/from_init1/runme.py8
-rw-r--r--Examples/python/import_packages/from_init2/Makefile4
-rw-r--r--Examples/python/import_packages/from_init2/py2/Makefile2
-rw-r--r--Examples/python/import_packages/from_init2/py2/pkg2/Makefile6
-rw-r--r--Examples/python/import_packages/from_init2/py2/pkg2/pkg3/Makefile6
-rw-r--r--Examples/python/import_packages/from_init2/py3/Makefile2
-rw-r--r--Examples/python/import_packages/from_init2/py3/pkg2/Makefile6
-rw-r--r--Examples/python/import_packages/from_init2/py3/pkg2/pkg3/Makefile6
-rw-r--r--Examples/python/import_packages/from_init2/runme.py8
-rw-r--r--Examples/python/import_packages/from_init3/Makefile4
-rw-r--r--Examples/python/import_packages/from_init3/py2/Makefile2
-rw-r--r--Examples/python/import_packages/from_init3/py2/pkg2/Makefile6
-rw-r--r--Examples/python/import_packages/from_init3/py2/pkg2/pkg3/Makefile2
-rw-r--r--Examples/python/import_packages/from_init3/py2/pkg2/pkg3/pkg4/Makefile6
-rw-r--r--Examples/python/import_packages/from_init3/py3/Makefile2
-rw-r--r--Examples/python/import_packages/from_init3/py3/pkg2/Makefile6
-rw-r--r--Examples/python/import_packages/from_init3/py3/pkg2/pkg3/Makefile2
-rw-r--r--Examples/python/import_packages/from_init3/py3/pkg2/pkg3/pkg4/Makefile6
-rw-r--r--Examples/python/import_packages/from_init3/runme.py8
-rw-r--r--Examples/python/import_packages/relativeimport1/Makefile4
-rw-r--r--Examples/python/import_packages/relativeimport1/py2/Makefile2
-rw-r--r--Examples/python/import_packages/relativeimport1/py2/pkg2/Makefile6
-rw-r--r--Examples/python/import_packages/relativeimport1/py2/pkg2/pkg3/Makefile6
-rw-r--r--Examples/python/import_packages/relativeimport1/py3/Makefile2
-rw-r--r--Examples/python/import_packages/relativeimport1/py3/pkg2/Makefile6
-rw-r--r--Examples/python/import_packages/relativeimport1/py3/pkg2/pkg3/Makefile6
-rw-r--r--Examples/python/import_packages/relativeimport1/runme.py8
-rw-r--r--Examples/python/import_packages/relativeimport2/Makefile4
-rw-r--r--Examples/python/import_packages/relativeimport2/py2/Makefile2
-rw-r--r--Examples/python/import_packages/relativeimport2/py2/pkg2/Makefile6
-rw-r--r--Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/Makefile2
-rw-r--r--Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/pkg4/Makefile6
-rw-r--r--Examples/python/import_packages/relativeimport2/py3/Makefile2
-rw-r--r--Examples/python/import_packages/relativeimport2/py3/pkg2/Makefile6
-rw-r--r--Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/Makefile2
-rw-r--r--Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/pkg4/Makefile6
-rw-r--r--Examples/python/import_packages/relativeimport2/runme.py8
-rw-r--r--Examples/python/import_packages/relativeimport2/runme3.py9
-rw-r--r--Examples/python/import_packages/relativeimport3/Makefile25
-rw-r--r--Examples/python/import_packages/relativeimport3/README22
-rw-r--r--Examples/python/import_packages/relativeimport3/py2/Makefile14
-rw-r--r--Examples/python/import_packages/relativeimport3/py2/__init__.py0
-rw-r--r--Examples/python/import_packages/relativeimport3/py2/pkg2/Makefile18
-rw-r--r--Examples/python/import_packages/relativeimport3/py2/pkg2/__init__.py0
-rw-r--r--Examples/python/import_packages/relativeimport3/py2/pkg2/bar.hpp5
-rw-r--r--Examples/python/import_packages/relativeimport3/py2/pkg2/bar.i6
-rw-r--r--Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/Makefile15
-rw-r--r--Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/__init__.py0
-rw-r--r--Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/foo.hpp4
-rw-r--r--Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/foo.i5
-rw-r--r--Examples/python/import_packages/relativeimport3/py3/Makefile14
-rw-r--r--Examples/python/import_packages/relativeimport3/py3/__init__.py0
-rw-r--r--Examples/python/import_packages/relativeimport3/py3/pkg2/Makefile18
-rw-r--r--Examples/python/import_packages/relativeimport3/py3/pkg2/__init__.py0
-rw-r--r--Examples/python/import_packages/relativeimport3/py3/pkg2/bar.hpp5
-rw-r--r--Examples/python/import_packages/relativeimport3/py3/pkg2/bar.i6
-rw-r--r--Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/Makefile15
-rw-r--r--Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/__init__.py0
-rw-r--r--Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/foo.hpp4
-rw-r--r--Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/foo.i5
-rw-r--r--Examples/python/import_packages/relativeimport3/runme.py13
-rw-r--r--Examples/python/import_packages/same_modnames1/Makefile4
-rw-r--r--Examples/python/import_packages/same_modnames1/pkg1/Makefile6
-rw-r--r--Examples/python/import_packages/same_modnames1/pkg2/Makefile6
-rw-r--r--Examples/python/import_packages/same_modnames1/runme.py6
-rw-r--r--Examples/python/import_packages/same_modnames2/Makefile4
-rw-r--r--Examples/python/import_packages/same_modnames2/pkg1/Makefile6
-rw-r--r--Examples/python/import_packages/same_modnames2/pkg1/pkg2/Makefile6
-rw-r--r--Examples/python/import_packages/same_modnames2/runme.py5
75 files changed, 349 insertions, 124 deletions
diff --git a/Examples/python/import_packages/Makefile b/Examples/python/import_packages/Makefile
index fda2380b3..dfd46d05c 100644
--- a/Examples/python/import_packages/Makefile
+++ b/Examples/python/import_packages/Makefile
@@ -5,17 +5,23 @@ LIBS =
PY3 =
import_packages_subdirs = \
- same_modnames1 \
+ same_modnames1 \
same_modnames2 \
from_init1 \
from_init2 \
from_init3 \
relativeimport1 \
- relativeimport1
+ relativeimport2 \
+ relativeimport3
check: build
+ if test "x$(SRCDIR)" != x; then \
+ for file in `cd $(SRCDIR) && find . -type f -name __init__.py`; do \
+ cp "${SRCDIR}$$file" "$$file" || exit 1; \
+ done; \
+ fi; \
for s in $(import_packages_subdirs); do \
- (cd $$s && $(MAKE) check); \
+ (cd $$s && $(MAKE) check); \
done
build:
@@ -29,7 +35,12 @@ static:
done
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
+ if test "x$(SRCDIR)" != x; then \
+ for file in `cd $(SRCDIR) && find . -type f -name __init__.py`; do \
+ rm -f "$$file" || exit 1; \
+ done; \
+ fi; \
for s in $(import_packages_subdirs); do \
(cd $$s && $(MAKE) clean); \
done
diff --git a/Examples/python/import_packages/from_init1/Makefile b/Examples/python/import_packages/from_init1/Makefile
index 8e35c6c61..b9d803a0e 100644
--- a/Examples/python/import_packages/from_init1/Makefile
+++ b/Examples/python/import_packages/from_init1/Makefile
@@ -11,7 +11,7 @@ else
endif
check: build
- $(MAKE) -f $(TOP)/Makefile python_run
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
@@ -20,6 +20,6 @@ static:
cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd py2 && $(MAKE) clean
cd py3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init1/py2/Makefile b/Examples/python/import_packages/from_init1/py2/Makefile
index 4c0dfab07..9595397d8 100644
--- a/Examples/python/import_packages/from_init1/py2/Makefile
+++ b/Examples/python/import_packages/from_init1/py2/Makefile
@@ -10,5 +10,5 @@ static:
cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg2 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init1/py2/pkg2/Makefile b/Examples/python/import_packages/from_init1/py2/pkg2/Makefile
index 0dd174659..1eb810e05 100644
--- a/Examples/python/import_packages/from_init1/py2/pkg2/Makefile
+++ b/Examples/python/import_packages/from_init1/py2/pkg2/Makefile
@@ -4,17 +4,17 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp_static
clean::
- $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean
- $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
diff --git a/Examples/python/import_packages/from_init1/py3/Makefile b/Examples/python/import_packages/from_init1/py3/Makefile
index 4c0dfab07..9595397d8 100644
--- a/Examples/python/import_packages/from_init1/py3/Makefile
+++ b/Examples/python/import_packages/from_init1/py3/Makefile
@@ -10,5 +10,5 @@ static:
cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg2 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init1/py3/pkg2/Makefile b/Examples/python/import_packages/from_init1/py3/pkg2/Makefile
index 0dd174659..1eb810e05 100644
--- a/Examples/python/import_packages/from_init1/py3/pkg2/Makefile
+++ b/Examples/python/import_packages/from_init1/py3/pkg2/Makefile
@@ -4,17 +4,17 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp_static
clean::
- $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean
- $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
diff --git a/Examples/python/import_packages/from_init1/runme.py b/Examples/python/import_packages/from_init1/runme.py
index c23a085fa..bbe092bab 100644
--- a/Examples/python/import_packages/from_init1/runme.py
+++ b/Examples/python/import_packages/from_init1/runme.py
@@ -1,6 +1,10 @@
-# Test import of modules content from within __init__.py
-print "Testing %module(package=...) + python 'import' in __init__.py"
import sys
+import os.path
+
+# Test import of modules content from within __init__.py
+testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
+print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+
if sys.version_info < (3,0):
import py2.pkg2
print " Finished importing py2.pkg2"
diff --git a/Examples/python/import_packages/from_init2/Makefile b/Examples/python/import_packages/from_init2/Makefile
index 8e35c6c61..b9d803a0e 100644
--- a/Examples/python/import_packages/from_init2/Makefile
+++ b/Examples/python/import_packages/from_init2/Makefile
@@ -11,7 +11,7 @@ else
endif
check: build
- $(MAKE) -f $(TOP)/Makefile python_run
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
@@ -20,6 +20,6 @@ static:
cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd py2 && $(MAKE) clean
cd py3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init2/py2/Makefile b/Examples/python/import_packages/from_init2/py2/Makefile
index 4c0dfab07..9595397d8 100644
--- a/Examples/python/import_packages/from_init2/py2/Makefile
+++ b/Examples/python/import_packages/from_init2/py2/Makefile
@@ -10,5 +10,5 @@ static:
cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg2 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init2/py2/pkg2/Makefile b/Examples/python/import_packages/from_init2/py2/pkg2/Makefile
index 3fe56139d..36e099b78 100644
--- a/Examples/python/import_packages/from_init2/py2/pkg2/Makefile
+++ b/Examples/python/import_packages/from_init2/py2/pkg2/Makefile
@@ -4,15 +4,15 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
cd pkg3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init2/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/from_init2/py2/pkg2/pkg3/Makefile
index a417e2745..cb20bd25f 100644
--- a/Examples/python/import_packages/from_init2/py2/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/from_init2/py2/pkg2/pkg3/Makefile
@@ -4,12 +4,12 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/from_init2/py3/Makefile b/Examples/python/import_packages/from_init2/py3/Makefile
index 4c0dfab07..9595397d8 100644
--- a/Examples/python/import_packages/from_init2/py3/Makefile
+++ b/Examples/python/import_packages/from_init2/py3/Makefile
@@ -10,5 +10,5 @@ static:
cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg2 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init2/py3/pkg2/Makefile b/Examples/python/import_packages/from_init2/py3/pkg2/Makefile
index 3fe56139d..36e099b78 100644
--- a/Examples/python/import_packages/from_init2/py3/pkg2/Makefile
+++ b/Examples/python/import_packages/from_init2/py3/pkg2/Makefile
@@ -4,15 +4,15 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
cd pkg3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init2/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/from_init2/py3/pkg2/pkg3/Makefile
index a417e2745..cb20bd25f 100644
--- a/Examples/python/import_packages/from_init2/py3/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/from_init2/py3/pkg2/pkg3/Makefile
@@ -4,12 +4,12 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/from_init2/runme.py b/Examples/python/import_packages/from_init2/runme.py
index c23a085fa..bbe092bab 100644
--- a/Examples/python/import_packages/from_init2/runme.py
+++ b/Examples/python/import_packages/from_init2/runme.py
@@ -1,6 +1,10 @@
-# Test import of modules content from within __init__.py
-print "Testing %module(package=...) + python 'import' in __init__.py"
import sys
+import os.path
+
+# Test import of modules content from within __init__.py
+testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
+print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+
if sys.version_info < (3,0):
import py2.pkg2
print " Finished importing py2.pkg2"
diff --git a/Examples/python/import_packages/from_init3/Makefile b/Examples/python/import_packages/from_init3/Makefile
index 8e35c6c61..b9d803a0e 100644
--- a/Examples/python/import_packages/from_init3/Makefile
+++ b/Examples/python/import_packages/from_init3/Makefile
@@ -11,7 +11,7 @@ else
endif
check: build
- $(MAKE) -f $(TOP)/Makefile python_run
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
@@ -20,6 +20,6 @@ static:
cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd py2 && $(MAKE) clean
cd py3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init3/py2/Makefile b/Examples/python/import_packages/from_init3/py2/Makefile
index 4c0dfab07..9595397d8 100644
--- a/Examples/python/import_packages/from_init3/py2/Makefile
+++ b/Examples/python/import_packages/from_init3/py2/Makefile
@@ -10,5 +10,5 @@ static:
cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg2 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init3/py2/pkg2/Makefile b/Examples/python/import_packages/from_init3/py2/pkg2/Makefile
index 3fe56139d..36e099b78 100644
--- a/Examples/python/import_packages/from_init3/py2/pkg2/Makefile
+++ b/Examples/python/import_packages/from_init3/py2/pkg2/Makefile
@@ -4,15 +4,15 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
cd pkg3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/Makefile
index 470f9d561..d6ae1b2bc 100644
--- a/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/Makefile
@@ -10,5 +10,5 @@ static:
cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg4 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/pkg4/Makefile b/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/pkg4/Makefile
index a98d31122..286d90070 100644
--- a/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/pkg4/Makefile
+++ b/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/pkg4/Makefile
@@ -4,12 +4,12 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/from_init3/py3/Makefile b/Examples/python/import_packages/from_init3/py3/Makefile
index 4c0dfab07..9595397d8 100644
--- a/Examples/python/import_packages/from_init3/py3/Makefile
+++ b/Examples/python/import_packages/from_init3/py3/Makefile
@@ -10,5 +10,5 @@ static:
cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg2 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init3/py3/pkg2/Makefile b/Examples/python/import_packages/from_init3/py3/pkg2/Makefile
index 3fe56139d..36e099b78 100644
--- a/Examples/python/import_packages/from_init3/py3/pkg2/Makefile
+++ b/Examples/python/import_packages/from_init3/py3/pkg2/Makefile
@@ -4,15 +4,15 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
cd pkg3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/Makefile
index 470f9d561..d6ae1b2bc 100644
--- a/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/Makefile
@@ -10,5 +10,5 @@ static:
cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg4 && $(MAKE) clean
diff --git a/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/pkg4/Makefile b/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/pkg4/Makefile
index a98d31122..286d90070 100644
--- a/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/pkg4/Makefile
+++ b/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/pkg4/Makefile
@@ -4,12 +4,12 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/from_init3/runme.py b/Examples/python/import_packages/from_init3/runme.py
index c23a085fa..bbe092bab 100644
--- a/Examples/python/import_packages/from_init3/runme.py
+++ b/Examples/python/import_packages/from_init3/runme.py
@@ -1,6 +1,10 @@
-# Test import of modules content from within __init__.py
-print "Testing %module(package=...) + python 'import' in __init__.py"
import sys
+import os.path
+
+# Test import of modules content from within __init__.py
+testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
+print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+
if sys.version_info < (3,0):
import py2.pkg2
print " Finished importing py2.pkg2"
diff --git a/Examples/python/import_packages/relativeimport1/Makefile b/Examples/python/import_packages/relativeimport1/Makefile
index 8e35c6c61..b9d803a0e 100644
--- a/Examples/python/import_packages/relativeimport1/Makefile
+++ b/Examples/python/import_packages/relativeimport1/Makefile
@@ -11,7 +11,7 @@ else
endif
check: build
- $(MAKE) -f $(TOP)/Makefile python_run
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
@@ -20,6 +20,6 @@ static:
cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd py2 && $(MAKE) clean
cd py3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport1/py2/Makefile b/Examples/python/import_packages/relativeimport1/py2/Makefile
index 4c0dfab07..9595397d8 100644
--- a/Examples/python/import_packages/relativeimport1/py2/Makefile
+++ b/Examples/python/import_packages/relativeimport1/py2/Makefile
@@ -10,5 +10,5 @@ static:
cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg2 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport1/py2/pkg2/Makefile b/Examples/python/import_packages/relativeimport1/py2/pkg2/Makefile
index 3fe56139d..36e099b78 100644
--- a/Examples/python/import_packages/relativeimport1/py2/pkg2/Makefile
+++ b/Examples/python/import_packages/relativeimport1/py2/pkg2/Makefile
@@ -4,15 +4,15 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
cd pkg3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport1/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport1/py2/pkg2/pkg3/Makefile
index a417e2745..cb20bd25f 100644
--- a/Examples/python/import_packages/relativeimport1/py2/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/relativeimport1/py2/pkg2/pkg3/Makefile
@@ -4,12 +4,12 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/relativeimport1/py3/Makefile b/Examples/python/import_packages/relativeimport1/py3/Makefile
index 4c0dfab07..9595397d8 100644
--- a/Examples/python/import_packages/relativeimport1/py3/Makefile
+++ b/Examples/python/import_packages/relativeimport1/py3/Makefile
@@ -10,5 +10,5 @@ static:
cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg2 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport1/py3/pkg2/Makefile b/Examples/python/import_packages/relativeimport1/py3/pkg2/Makefile
index 3fe56139d..36e099b78 100644
--- a/Examples/python/import_packages/relativeimport1/py3/pkg2/Makefile
+++ b/Examples/python/import_packages/relativeimport1/py3/pkg2/Makefile
@@ -4,15 +4,15 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
cd pkg3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport1/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport1/py3/pkg2/pkg3/Makefile
index a417e2745..cb20bd25f 100644
--- a/Examples/python/import_packages/relativeimport1/py3/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/relativeimport1/py3/pkg2/pkg3/Makefile
@@ -4,12 +4,12 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/relativeimport1/runme.py b/Examples/python/import_packages/relativeimport1/runme.py
index 44ce8d1c4..99b6e513e 100644
--- a/Examples/python/import_packages/relativeimport1/runme.py
+++ b/Examples/python/import_packages/relativeimport1/runme.py
@@ -1,6 +1,10 @@
-# Test import of modules content from within __init__.py
-print "Testing %module(package=...) with -relativeimport"
import sys
+import os.path
+
+# Test import of modules content from within __init__.py
+testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
+print "Testing " + testname + " - %module(package=...) with -relativeimport"
+
if sys.version_info < (3,0):
import py2.pkg2.bar
print " Finished importing py2.pkg2.bar"
diff --git a/Examples/python/import_packages/relativeimport2/Makefile b/Examples/python/import_packages/relativeimport2/Makefile
index 8e35c6c61..b9d803a0e 100644
--- a/Examples/python/import_packages/relativeimport2/Makefile
+++ b/Examples/python/import_packages/relativeimport2/Makefile
@@ -11,7 +11,7 @@ else
endif
check: build
- $(MAKE) -f $(TOP)/Makefile python_run
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
@@ -20,6 +20,6 @@ static:
cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd py2 && $(MAKE) clean
cd py3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport2/py2/Makefile b/Examples/python/import_packages/relativeimport2/py2/Makefile
index 4c0dfab07..9595397d8 100644
--- a/Examples/python/import_packages/relativeimport2/py2/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py2/Makefile
@@ -10,5 +10,5 @@ static:
cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg2 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport2/py2/pkg2/Makefile b/Examples/python/import_packages/relativeimport2/py2/pkg2/Makefile
index 3fe56139d..36e099b78 100644
--- a/Examples/python/import_packages/relativeimport2/py2/pkg2/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py2/pkg2/Makefile
@@ -4,15 +4,15 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
cd pkg3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/Makefile
index 470f9d561..d6ae1b2bc 100644
--- a/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/Makefile
@@ -10,5 +10,5 @@ static:
cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg4 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/pkg4/Makefile b/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/pkg4/Makefile
index a98d31122..286d90070 100644
--- a/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/pkg4/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/pkg4/Makefile
@@ -4,12 +4,12 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/relativeimport2/py3/Makefile b/Examples/python/import_packages/relativeimport2/py3/Makefile
index 4c0dfab07..9595397d8 100644
--- a/Examples/python/import_packages/relativeimport2/py3/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py3/Makefile
@@ -10,5 +10,5 @@ static:
cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg2 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport2/py3/pkg2/Makefile b/Examples/python/import_packages/relativeimport2/py3/pkg2/Makefile
index 3fe56139d..36e099b78 100644
--- a/Examples/python/import_packages/relativeimport2/py3/pkg2/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py3/pkg2/Makefile
@@ -4,15 +4,15 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
cd pkg3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/Makefile
index 470f9d561..d6ae1b2bc 100644
--- a/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/Makefile
@@ -10,5 +10,5 @@ static:
cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg4 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/pkg4/Makefile b/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/pkg4/Makefile
index a98d31122..286d90070 100644
--- a/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/pkg4/Makefile
+++ b/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/pkg4/Makefile
@@ -4,12 +4,12 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/relativeimport2/runme.py b/Examples/python/import_packages/relativeimport2/runme.py
index ac60eb630..f0ab6c446 100644
--- a/Examples/python/import_packages/relativeimport2/runme.py
+++ b/Examples/python/import_packages/relativeimport2/runme.py
@@ -1,6 +1,10 @@
-# Test import of modules content from within __init__.py
-print "Testing %module(package=...) + python 'import' in __init__.py"
import sys
+import os.path
+
+# Test import of modules content from within __init__.py
+testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
+print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+
if sys.version_info < (3,0):
import py2.pkg2.bar
print " Finished importing py2.pkg2.bar"
diff --git a/Examples/python/import_packages/relativeimport2/runme3.py b/Examples/python/import_packages/relativeimport2/runme3.py
deleted file mode 100644
index 4b0d112cf..000000000
--- a/Examples/python/import_packages/relativeimport2/runme3.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Test import of modules content from within __init__.py
-print("Testing %module(package=...) + python 'import' in __init__.py")
-import sys
-if sys.version_info < (3, 0):
- import py2.pkg2.bar
- print(" Finished importing py2.pkg2.bar")
-else:
- import py3.pkg2.bar
- print(" Finished importing py3.pkg2.bar")
diff --git a/Examples/python/import_packages/relativeimport3/Makefile b/Examples/python/import_packages/relativeimport3/Makefile
new file mode 100644
index 000000000..b9d803a0e
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/Makefile
@@ -0,0 +1,25 @@
+TOP = ../../..
+SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGOPT =
+LIBS =
+PY3 =
+
+ifeq (,$(PY3))
+ PKG1DIR = "py2"
+else
+ PKG1DIR = "py3"
+endif
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
+
+build:
+ cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build
+
+static:
+ cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
+ cd py2 && $(MAKE) clean
+ cd py3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport3/README b/Examples/python/import_packages/relativeimport3/README
new file mode 100644
index 000000000..a99ef2426
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/README
@@ -0,0 +1,22 @@
+This example tests the %import directive and -relativeimport swig option.
+
+Use 'python runme.py' to run a test.
+
+Overview:
+---------
+
+The example defines 2 different extension modules--each wrapping a separate C++
+class.
+
+ pyX/pkg2/pkg3/foo.i - Pkg3_Foo class
+ pyX/pkg2/bar.i - Pkg2_Bar class derived from Pkg3_Foo
+
+The code is processed by swig with -relativeimport flag. The runtime test
+imports pyX.pkg2.bar module.
+
+If everything works well, the module pyX.pkg2.bar shall load properly.
+
+Unix:
+-----
+- Run make
+- Run the test as described above
diff --git a/Examples/python/import_packages/relativeimport3/py2/Makefile b/Examples/python/import_packages/relativeimport3/py2/Makefile
new file mode 100644
index 000000000..9595397d8
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py2/Makefile
@@ -0,0 +1,14 @@
+TOP = ../../../..
+SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGOPT =
+LIBS =
+
+build:
+ cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+
+static:
+ cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
+ cd pkg2 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport3/py2/__init__.py b/Examples/python/import_packages/relativeimport3/py2/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py2/__init__.py
diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/Makefile b/Examples/python/import_packages/relativeimport3/py2/pkg2/Makefile
new file mode 100644
index 000000000..36e099b78
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/Makefile
@@ -0,0 +1,18 @@
+TOP = ../../../../..
+SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGOPT =
+LIBS =
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+
+static:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
+ cd pkg3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/__init__.py b/Examples/python/import_packages/relativeimport3/py2/pkg2/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/__init__.py
diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/bar.hpp b/Examples/python/import_packages/relativeimport3/py2/pkg2/bar.hpp
new file mode 100644
index 000000000..8f09cd5fa
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/bar.hpp
@@ -0,0 +1,5 @@
+#ifndef PY2_PKG2_BAR_HPP
+#define PY2_PKG2_BAR_HPP
+#include "../../py2/pkg2/pkg3/foo.hpp"
+struct Pkg2_Bar : Pkg3_Foo {};
+#endif /* PY2_PKG2_BAR_HPP */
diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/bar.i b/Examples/python/import_packages/relativeimport3/py2/pkg2/bar.i
new file mode 100644
index 000000000..6f4690b25
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/bar.i
@@ -0,0 +1,6 @@
+%module(package="py2.pkg2") bar
+%{
+#include "../../py2/pkg2/bar.hpp"
+%}
+%import (module="foo", package="py2.pkg2.pkg3") "../../py2/pkg2/pkg3/foo.hpp"
+%include "../../py2/pkg2/bar.hpp"
diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/Makefile
new file mode 100644
index 000000000..cb20bd25f
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/Makefile
@@ -0,0 +1,15 @@
+TOP = ../../../../../..
+SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGOPT =
+LIBS =
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+
+static:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/__init__.py b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/__init__.py
diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/foo.hpp b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/foo.hpp
new file mode 100644
index 000000000..b6c89a431
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/foo.hpp
@@ -0,0 +1,4 @@
+#ifndef PY2_PKG2_PKG3_FOO_HPP
+#define PY2_PKG2_PKG3_FOO_HPP
+struct Pkg3_Foo {};
+#endif /* PY2_PKG2_PKG3_FOO_HPP */
diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/foo.i b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/foo.i
new file mode 100644
index 000000000..ba32483d2
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/foo.i
@@ -0,0 +1,5 @@
+%module(package="py2.pkg2.pkg3") foo
+%{
+#include "../../../py2/pkg2/pkg3/foo.hpp"
+%}
+%include "../../../py2/pkg2/pkg3/foo.hpp"
diff --git a/Examples/python/import_packages/relativeimport3/py3/Makefile b/Examples/python/import_packages/relativeimport3/py3/Makefile
new file mode 100644
index 000000000..9595397d8
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py3/Makefile
@@ -0,0 +1,14 @@
+TOP = ../../../..
+SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGOPT =
+LIBS =
+
+build:
+ cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+
+static:
+ cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
+ cd pkg2 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport3/py3/__init__.py b/Examples/python/import_packages/relativeimport3/py3/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py3/__init__.py
diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/Makefile b/Examples/python/import_packages/relativeimport3/py3/pkg2/Makefile
new file mode 100644
index 000000000..36e099b78
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/Makefile
@@ -0,0 +1,18 @@
+TOP = ../../../../..
+SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGOPT =
+LIBS =
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
+
+static:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp
+ cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean
+ cd pkg3 && $(MAKE) clean
diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/__init__.py b/Examples/python/import_packages/relativeimport3/py3/pkg2/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/__init__.py
diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/bar.hpp b/Examples/python/import_packages/relativeimport3/py3/pkg2/bar.hpp
new file mode 100644
index 000000000..408d910d7
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/bar.hpp
@@ -0,0 +1,5 @@
+#ifndef PY3_PKG2_BAR_HPP
+#define PY3_PKG2_BAR_HPP
+#include "../../py3/pkg2/pkg3/foo.hpp"
+struct Pkg2_Bar : Pkg3_Foo {};
+#endif /* PY3_PKG2_BAR_HPP */
diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/bar.i b/Examples/python/import_packages/relativeimport3/py3/pkg2/bar.i
new file mode 100644
index 000000000..157c62e2c
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/bar.i
@@ -0,0 +1,6 @@
+%module(package="py3.pkg2") bar
+%{
+#include "../../py3/pkg2/bar.hpp"
+%}
+%import (module="foo", package="py3.pkg2.pkg3") "../../py3/pkg2/pkg3/foo.hpp"
+%include "../../py3/pkg2/bar.hpp"
diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/Makefile
new file mode 100644
index 000000000..cb20bd25f
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/Makefile
@@ -0,0 +1,15 @@
+TOP = ../../../../../..
+SWIG = $(realpath $(TOP)/../preinst-swig)
+SWIGOPT =
+LIBS =
+
+build:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
+
+static:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/__init__.py b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/__init__.py
diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/foo.hpp b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/foo.hpp
new file mode 100644
index 000000000..531721d36
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/foo.hpp
@@ -0,0 +1,4 @@
+#ifndef PY3_PKG2_PKG3_FOO_HPP
+#define PY3_PKG2_PKG3_FOO_HPP
+struct Pkg3_Foo {};
+#endif /* PY3_PKG2_PKG3_FOO_HPP */
diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/foo.i b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/foo.i
new file mode 100644
index 000000000..c6ba529b7
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/foo.i
@@ -0,0 +1,5 @@
+%module(package="py3.pkg2.pkg3") foo
+%{
+#include "../../../py3/pkg2/pkg3/foo.hpp"
+%}
+%include "../../../py3/pkg2/pkg3/foo.hpp"
diff --git a/Examples/python/import_packages/relativeimport3/runme.py b/Examples/python/import_packages/relativeimport3/runme.py
new file mode 100644
index 000000000..99b6e513e
--- /dev/null
+++ b/Examples/python/import_packages/relativeimport3/runme.py
@@ -0,0 +1,13 @@
+import sys
+import os.path
+
+# Test import of modules content from within __init__.py
+testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
+print "Testing " + testname + " - %module(package=...) with -relativeimport"
+
+if sys.version_info < (3,0):
+ import py2.pkg2.bar
+ print " Finished importing py2.pkg2.bar"
+else:
+ import py3.pkg2.bar
+ print " Finished importing py3.pkg2.bar"
diff --git a/Examples/python/import_packages/same_modnames1/Makefile b/Examples/python/import_packages/same_modnames1/Makefile
index 9dd5971dc..e05c13017 100644
--- a/Examples/python/import_packages/same_modnames1/Makefile
+++ b/Examples/python/import_packages/same_modnames1/Makefile
@@ -4,7 +4,7 @@ SWIGOPT =
LIBS =
check: build
- $(MAKE) -f $(TOP)/Makefile python_run
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
cd pkg1 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
@@ -15,6 +15,6 @@ static:
cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg1 && $(MAKE) clean
cd pkg2 && $(MAKE) clean
diff --git a/Examples/python/import_packages/same_modnames1/pkg1/Makefile b/Examples/python/import_packages/same_modnames1/pkg1/Makefile
index 9b51a76ed..df1b30321 100644
--- a/Examples/python/import_packages/same_modnames1/pkg1/Makefile
+++ b/Examples/python/import_packages/same_modnames1/pkg1/Makefile
@@ -4,12 +4,12 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/same_modnames1/pkg2/Makefile b/Examples/python/import_packages/same_modnames1/pkg2/Makefile
index 9b51a76ed..df1b30321 100644
--- a/Examples/python/import_packages/same_modnames1/pkg2/Makefile
+++ b/Examples/python/import_packages/same_modnames1/pkg2/Makefile
@@ -4,12 +4,12 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/same_modnames1/runme.py b/Examples/python/import_packages/same_modnames1/runme.py
index 923f0e0bb..7bec1ec1e 100644
--- a/Examples/python/import_packages/same_modnames1/runme.py
+++ b/Examples/python/import_packages/same_modnames1/runme.py
@@ -1,5 +1,9 @@
+import os.path
+
# Test import of same modules from different packages
-print "Testing %module(package=...) + %import + same modules in different packages"
+testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
+print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+
import pkg2.foo
print " Finished importing pkg2.foo"
diff --git a/Examples/python/import_packages/same_modnames2/Makefile b/Examples/python/import_packages/same_modnames2/Makefile
index cfc327883..770343a80 100644
--- a/Examples/python/import_packages/same_modnames2/Makefile
+++ b/Examples/python/import_packages/same_modnames2/Makefile
@@ -4,7 +4,7 @@ SWIGOPT =
LIBS =
check: build
- $(MAKE) -f $(TOP)/Makefile python_run
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run
build:
cd pkg1 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build
@@ -15,6 +15,6 @@ static:
cd pkg1/pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static
clean:
- $(MAKE) -f $(TOP)/Makefile python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean
cd pkg1 && $(MAKE) clean
cd pkg1/pkg2 && $(MAKE) clean
diff --git a/Examples/python/import_packages/same_modnames2/pkg1/Makefile b/Examples/python/import_packages/same_modnames2/pkg1/Makefile
index 9b51a76ed..df1b30321 100644
--- a/Examples/python/import_packages/same_modnames2/pkg1/Makefile
+++ b/Examples/python/import_packages/same_modnames2/pkg1/Makefile
@@ -4,12 +4,12 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/same_modnames2/pkg1/pkg2/Makefile b/Examples/python/import_packages/same_modnames2/pkg1/pkg2/Makefile
index 053b911f5..11e8573ad 100644
--- a/Examples/python/import_packages/same_modnames2/pkg1/pkg2/Makefile
+++ b/Examples/python/import_packages/same_modnames2/pkg1/pkg2/Makefile
@@ -4,12 +4,12 @@ SWIGOPT =
LIBS =
build:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp
static:
- $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static
clean:
- $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean
diff --git a/Examples/python/import_packages/same_modnames2/runme.py b/Examples/python/import_packages/same_modnames2/runme.py
index af8f78194..eec6121eb 100644
--- a/Examples/python/import_packages/same_modnames2/runme.py
+++ b/Examples/python/import_packages/same_modnames2/runme.py
@@ -1,3 +1,8 @@
+import os.path
+
+testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
+print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+
import pkg1.pkg2.foo
print " Finished importing pkg1.pkg2.foo"