import logging


def setup_required(func):
    """Decorator to ensure respository is setup before being used."""
    def wrapper_setup_required(self, *args, **kwargs):
        if not self.__setup_flag__:
            logging.error('Repository setup required to use {}. Did you \
                forget to run acmRepository.setup()?'.format(func.__name__))
        else:
            return func(*args, **kwargs)
        return wrapper_setup_required