# Path: pybombs/pb_logging.py
# BOLD = str('\033[1m')
# TRACE = 1
# class ColoredConsoleHandler(logging.StreamHandler):
# class PBLogger(logging.getLoggerClass()):
#     def emit(self, record):
#     def __init__(self, *args, **kwargs):
#     def trace(self, *args, **kwargs):
# 
# Path: pybombs/requirer.py
# class Requirer(object):
#     """
#     Any child class of this can operate with a guarantee that certain
#     packets will have been installed.
#     """
#     host_sys_deps = []
# 
#     def __init__(self):
#         # There's a pretty good reason assert_requirements() is not called
#         # here, in fact, it used to be, but I can't remember why not. Probably
#         # to avoid infinite loops.
#         pass
# 
#     def assert_requirements(self, requirements=None):
#         """
#         Make sure this class' requirements are met, whatever necessary,
#         and fail if not.
#         """
#         if requirements is None:
#             requirements = self.host_sys_deps
#         if getattr(self, 'log', None) is not None:
#             logger = self.log
#         else:
#             from pybombs import pb_logging
#             logger = pb_logging.logger.getChild("Requirer")
#         if requirements:
#             logger.debug("Requiring packages on host system: {deps}".format(deps=self.host_sys_deps))
#             require_hostsys_dependencies(requirements)
#             logger.debug("Requirements met.")
# 
# Path: pybombs/utils/subproc.py
# READ_TIMEOUT = 0.1 # s
# def check_output(*args, **kwargs):
# def get_child_pids(pid):
# def kill_process_tree(process, pid=None):
# def run_with_output_processing(p, o_proc, event, cleanup=None):
#     def enqueue_output(stdout_data, stdout_queue, stderr_data, stderr_queue):
#     def poll_queue(q):
# def _process_thread(event, args, kwargs):
#     def elevate_command(args, elevate_pre_args):
#     def pretty_print_cmd(args):
# def monitor_process(args, **kwargs):
# def match_output(command, pattern, match_key=None, **kwargs):


import os
import shutil
from pybombs import pb_logging
from pybombs.requirer import Requirer
from pybombs.utils import subproc
from pybombs.utils import output_proc
from pybombs.pb_exception import PBException
from pybombs.packagers.base import PackagerBase
        from pybombs.fetcher import Fetcher
        Run 'make test' or whatever checks a build was successful
        """
        self.log.debug("Verifying package {0}".format(recipe.id))
        self.log.debug("In cwd - {0}".format(os.getcwd()))
        o_proc = None
        if self.log.getEffectiveLevel() >= pb_logging.DEBUG and not try_again:
            o_proc = output_proc.OutputProcessorMake(preamble="Verifying: ")
        cmd = recipe.var_replace_all(self.get_command('verify', recipe))
        cmd = self.filter_cmd(cmd, recipe, 'make_filter')
        if subproc.monitor_process(cmd, shell=True, o_proc=o_proc) == 0:
            self.log.debug("Verification successful")
            return True
        # OK, something bad happened.
        if try_again == False:
            self.log.warning("Verification failed. Retrying...")
            recipe.vars['makewidth'] = '1'
            self.verify(recipe, try_again=True)
        else:
            self.log.error("Verification failed. See output above for error messages.")
            raise PBException("Verification failed.")

    def make_install(self, recipe):
        """
        Run 'make install' or whatever copies the files to the right place.
        """
        self.log.debug("Installing package {0}".format(recipe.id))
        self.log.debug("In cwd - {0}".format(os.getcwd()))
        pre_cmd = recipe.var_replace_all(self.get_command('install', recipe))
        cmd = self.filter_cmd(pre_cmd, recipe, 'install_filter')
        o_proc = None

# Path: pybombs/pb_logging.py
# BOLD = str('\033[1m')
# TRACE = 1
# class ColoredConsoleHandler(logging.StreamHandler):
# class PBLogger(logging.getLoggerClass()):
#     def emit(self, record):
#     def __init__(self, *args, **kwargs):
#     def trace(self, *args, **kwargs):
# 
# Path: pybombs/requirer.py
# class Requirer(object):
#     """
#     Any child class of this can operate with a guarantee that certain
#     packets will have been installed.
#     """
#     host_sys_deps = []
# 
#     def __init__(self):
#         # There's a pretty good reason assert_requirements() is not called
#         # here, in fact, it used to be, but I can't remember why not. Probably
#         # to avoid infinite loops.
#         pass
# 
#     def assert_requirements(self, requirements=None):
#         """
#         Make sure this class' requirements are met, whatever necessary,
#         and fail if not.
#         """
#         if requirements is None:
#             requirements = self.host_sys_deps
#         if getattr(self, 'log', None) is not None:
#             logger = self.log
#         else:
#             from pybombs import pb_logging
#             logger = pb_logging.logger.getChild("Requirer")
#         if requirements:
#             logger.debug("Requiring packages on host system: {deps}".format(deps=self.host_sys_deps))
#             require_hostsys_dependencies(requirements)
#             logger.debug("Requirements met.")
# 
# Path: pybombs/utils/subproc.py
# READ_TIMEOUT = 0.1 # s
# def check_output(*args, **kwargs):
# def get_child_pids(pid):
# def kill_process_tree(process, pid=None):
# def run_with_output_processing(p, o_proc, event, cleanup=None):
#     def enqueue_output(stdout_data, stdout_queue, stderr_data, stderr_queue):
#     def poll_queue(q):
# def _process_thread(event, args, kwargs):
#     def elevate_command(args, elevate_pre_args):
#     def pretty_print_cmd(args):
# def monitor_process(args, **kwargs):
# def match_output(command, pattern, match_key=None, **kwargs):


# Path: pybombs/packagers/source.py
import os
import shutil
from pybombs import pb_logging
from pybombs.requirer import Requirer
from pybombs.utils import subproc
from pybombs.utils import output_proc
from pybombs.pb_exception import PBException
from pybombs.packagers.base import PackagerBase
        from pybombs.fetcher import Fetcher

        Run 'make test' or whatever checks a build was successful
        """
        self.log.debug("Verifying package {0}".format(recipe.id))
        self.log.debug("In cwd - {0}".format(os.getcwd()))
        o_proc = None
        if self.log.getEffectiveLevel() >= pb_logging.DEBUG and not try_again:
            o_proc = output_proc.OutputProcessorMake(preamble="Verifying: ")
        cmd = recipe.var_replace_all(self.get_command('verify', recipe))
        cmd = self.filter_cmd(cmd, recipe, 'make_filter')
        if subproc.monitor_process(cmd, shell=True, o_proc=o_proc) == 0:
            self.log.debug("Verification successful")
            return True
        # OK, something bad happened.
        if try_again == False:
            self.log.warning("Verification failed. Retrying...")
            recipe.vars['makewidth'] = '1'
            self.verify(recipe, try_again=True)
        else:
            self.log.error("Verification failed. See output above for error messages.")
            raise PBException("Verification failed.")

    def make_install(self, recipe):
        """
        Run 'make install' or whatever copies the files to the right place.
        """
        self.log.debug("Installing package {0}".format(recipe.id))
        self.log.debug("In cwd - {0}".format(os.getcwd()))
        pre_cmd = recipe.var_replace_all(self.get_command('install', recipe))
        cmd = self.filter_cmd(pre_cmd, recipe, 'install_filter')
        o_proc = None

        if self.log.getEffectiveLevel() >= pb_logging.DEBUG: