# Path: lbuild/exception.py
# class BlobException(Exception):
#     """
#     Base class for exception thrown by lbuild.
#     """
#     pass
# 
# class BlobTemplateException(BlobException):
#     """
#     Error in Jinja2 template evaluation.
#     """
#     pass
# 
# class BlobForwardException(BlobException):
#     """
#     Handler for regular Python exception thrown in user defined functions.
# 
#     Use to forward the exception to the command line interface and provide
#     additional informations.
#     """
#     def __init__(self, module, exception):
#         self.module = module
#         self.exception = exception


import os
import time
import shutil
import fnmatch
import jinja2
import logging
import lbuild.filter
from .exception import BlobException, BlobTemplateException, BlobForwardException
        if src.startswith(".."):
            raise BlobException("Cannot access template outside of repository!\n"
                                "'{}'".format(src))

        if substitutions is None:
            substitutions = {}

        substitutions.update(self.substitutions)
        try:
            if filters is not None:
                # Reload environment if it uses different filters than
                # the previous environment
                self.__reload_template_environment(filters)

            template = self.template_environment.get_template(src, globals=self.__template_global_substitutions)
            output = template.render(substitutions)
        except jinja2.TemplateNotFound as error:
            raise BlobException('Failed to retrieve Template: %s' % error)
        except (jinja2.exceptions.TemplateAssertionError,
                jinja2.exceptions.TemplateSyntaxError) as error:
            raise BlobException("Error in template '{}:{}':\n"
                                " {}: {}".format(error.filename,
                                                 error.lineno,
                                                 error.__class__.__name__,
                                                 error))
        except jinja2.exceptions.UndefinedError as error:
            raise BlobTemplateException("Error in template '{}':\n"
                                        " {}: {}".format(self.modulepath(src),
                                                         error.__class__.__name__,
                                                         error))

# Path: lbuild/exception.py
# class BlobException(Exception):
#     """
#     Base class for exception thrown by lbuild.
#     """
#     pass
# 
# class BlobTemplateException(BlobException):
#     """
#     Error in Jinja2 template evaluation.
#     """
#     pass
# 
# class BlobForwardException(BlobException):
#     """
#     Handler for regular Python exception thrown in user defined functions.
# 
#     Use to forward the exception to the command line interface and provide
#     additional informations.
#     """
#     def __init__(self, module, exception):
#         self.module = module
#         self.exception = exception


# Path: lbuild/environment.py
import os
import time
import shutil
import fnmatch
import jinja2
import logging
import lbuild.filter
from .exception import BlobException, BlobTemplateException, BlobForwardException

        if src.startswith(".."):
            raise BlobException("Cannot access template outside of repository!\n"
                                "'{}'".format(src))

        if substitutions is None:
            substitutions = {}

        substitutions.update(self.substitutions)
        try:
            if filters is not None:
                # Reload environment if it uses different filters than
                # the previous environment
                self.__reload_template_environment(filters)

            template = self.template_environment.get_template(src, globals=self.__template_global_substitutions)
            output = template.render(substitutions)
        except jinja2.TemplateNotFound as error:
            raise BlobException('Failed to retrieve Template: %s' % error)
        except (jinja2.exceptions.TemplateAssertionError,
                jinja2.exceptions.TemplateSyntaxError) as error:
            raise BlobException("Error in template '{}:{}':\n"
                                " {}: {}".format(error.filename,
                                                 error.lineno,
                                                 error.__class__.__name__,
                                                 error))
        except jinja2.exceptions.UndefinedError as error:
            raise BlobTemplateException("Error in template '{}':\n"
                                        " {}: {}".format(self.modulepath(src),
                                                         error.__class__.__name__,
                                                         error))

        except BlobException as error: