Skip to content
Snippets Groups Projects
Commit 7366ba7d authored by Martin Nolte's avatar Martin Nolte Committed by Andreas Dedner
Browse files

[builder] migrate builder exceptions to separate module

The builder exceptions should be shared between different implementations of the
builder interface. This patch migrates them to a separate module
`dune.generator.exceptions`. For convenience they are also imported into
`dune.generator` itself.
parent 9f3d2d59
Branches
Tags
1 merge request!790Feature/add python bindings
......@@ -2,5 +2,6 @@ add_python_targets(generator
__init__
algorithm
builder
exceptions
generator
)
import os
from .exceptions import CompileError, ConfigurationError
from .builder import Builder
env_force = os.environ.get('DUNE_FORCE_BUILD', 'FALSE').upper()
......
......@@ -9,20 +9,12 @@ import sys
from dune.common import comm
from dune.common.compatibility import buffer_to_str, isString, reload_module
from dune.generator.exceptions import CompileError, ConfigurationError
import dune.common.module
logger = logging.getLogger(__name__)
class Builder:
class CompileError(Exception):
'''raise this when there's a problem compiling an extension module'''
def __init__(self, error):
Exception.__init__(self,error)
class ConfigurationError(Exception):
'''raise this when there's a problem with the configuration of dune-py'''
def __init__(self, error):
Exception.__init__(self,error)
def __init__(self, force=False):
self.force = force
......@@ -52,7 +44,7 @@ class Builder:
logger.debug(buffer_to_str(stdout))
if cmake.returncode > 0:
logger.error(buffer_to_str(stderr))
raise self.CompileError(buffer_to_str(stderr))
raise CompileError(buffer_to_str(stderr))
def load(self, moduleName, source, pythonName):
module = sys.modules.get("dune.generated." + moduleName)
......
from __future__ import absolute_import, division, print_function, unicode_literals
class CompileError(Exception):
'''raise this when there's a problem compiling an extension module'''
def __init__(self, error):
Exception.__init__(self,error)
class ConfigurationError(Exception):
'''raise this when there's a problem with the configuration of dune-py'''
def __init__(self, error):
Exception.__init__(self,error)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment