# 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
        try:
            self.run_build(
                recipe,
                make_clean=make_clean,
                nuke_builddir=nuke_builddir,
            )
            os.chdir(cwd)
            return True
        except PBException as err:
            self.log.error("Problem occurred while building package {0}:".format(recipe.id))
            self.log.error(str(err).strip())
        os.chdir(cwd)
        return False

    def run_build(self,
            recipe,
            make_clean=False,
            nuke_builddir=False,
            warn_if_builddir_exists=False,
            fail_if_builddir_missing=False,
        ):
        """
        Goes through the actual steps of configuring, building and installing
        a source package.

        Assumes source dir is in place (fetch was successful).

        Does not return a value, only raises PBException if something goes
        wrong ("net g'meckert isch lob genug").
        """

# 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

        try:
            self.run_build(
                recipe,
                make_clean=make_clean,
                nuke_builddir=nuke_builddir,
            )
            os.chdir(cwd)
            return True
        except PBException as err:
            self.log.error("Problem occurred while building package {0}:".format(recipe.id))
            self.log.error(str(err).strip())
        os.chdir(cwd)
        return False

    def run_build(self,
            recipe,
            make_clean=False,
            nuke_builddir=False,
            warn_if_builddir_exists=False,
            fail_if_builddir_missing=False,
        ):
        """
        Goes through the actual steps of configuring, building and installing
        a source package.

        Assumes source dir is in place (fetch was successful).

        Does not return a value, only raises PBException if something goes
        wrong ("net g'meckert isch lob genug").
        """

        Requirer().assert_requirements(['build-essential'])