Skip to content

Commit

Permalink
Update AutoWIG
Browse files Browse the repository at this point in the history
  • Loading branch information
pfernique committed Apr 1, 2018
1 parent 3255663 commit dea2340
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/py/autowig/boost_python_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1337,10 +1337,13 @@ def module(self):
def package(self):
modules = []
parent = self.parent
while parent is not None and os.path.exists(parent.globalname + '__init__.py'):
while parent is not None and parent.globalname + '__init__.py' in self._asg:
modules.append(parent.localname.strip(os.sep))
parent = parent.parent
return '.'.join(reversed(modules))
if len(modules) == 0:
return '.'
else:
return '.'.join(reversed(modules))

class BoostPythonDecoratorDefaultFileProxy(BoostPythonDecoratorFileProxy):

Expand All @@ -1351,7 +1354,7 @@ class BoostPythonDecoratorDefaultFileProxy(BoostPythonDecoratorFileProxy):
# Import dependency decorator modules
% for dependency in dependencies:
% if dependency:
import ${dependency.package}.${dependency.prefix}
from ${dependency.package} import ${dependency.prefix}
% endif
% endfor
% endif
Expand Down Expand Up @@ -1505,6 +1508,10 @@ def boost_python_generator(asg, nodes, module='./module.cpp', decorator=None, **
else:
decorator = asg.add_file(decorator, proxy=boost_python_decorator())
decorator.module = module
parent = decorator.parent
while parent is not None and os.path.exists(parent.globalname + '__init__.py'):
asg.add_file(parent.globalname + '__init__.py')
parent = parent.parent

if 'helder' in kwargs:
module.header.helder = kwargs.pop('helder')
Expand Down
2 changes: 1 addition & 1 deletion src/py/autowig/default_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ def default_controller(asg, **kwargs):
"""
if kwargs.pop('refactoring', True):
asg = refactoring(asg)
if kwargs.pop('clean', True):
if kwargs.pop('clean', False):
asg = cleaning(asg)
return asg

0 comments on commit dea2340

Please sign in to comment.