Fix issue with relative import when using single header file import.
-- The commit propagates the package option to the newly create
module node so it is recognized by SWIG
-- Added a relativeimport test for this combination
(in lack of py3 I was not able to test it with py3 but it
"should just work")
This commit is contained in:
parent
c43f84af02
commit
1dd297ad9d
23 changed files with 190 additions and 0 deletions
14
Examples/python/import_packages/relativeimport3/py2/Makefile
Normal file
14
Examples/python/import_packages/relativeimport3/py2/Makefile
Normal file
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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 */
|
||||
|
|
@ -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"
|
||||
|
|
@ -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
|
||||
|
|
@ -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 */
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
%module(package="py2.pkg2.pkg3") foo
|
||||
%{
|
||||
#include "../../../py2/pkg2/pkg3/foo.hpp"
|
||||
%}
|
||||
%include "../../../py2/pkg2/pkg3/foo.hpp"
|
||||
Loading…
Add table
Add a link
Reference in a new issue