How to use the pybombs.pb_logging function in PyBOMBS

To help you get started, we’ve selected a few PyBOMBS examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gnuradio / pybombs / pybombs / dep_manager.py View on Github external
def __init__(self, pm=None):
        self.pm = pm or package_manager.PackageManager()
        self.cfg = config_manager.config_manager
        self.log = pb_logging.logger.getChild("DepManager")
github gnuradio / pybombs / pybombs / recipe.py View on Github external
def get_recipe(pkgname, target='package', fail_easy=False):
    """
    Return a recipe object by its package name.
    """
    cache_key = pkgname
    if cache_key in RECIPE_CACHE:
        pb_logging.logger.getChild("get_recipe").trace("Woohoo, this one's already cached ({0})".format(pkgname))
        return RECIPE_CACHE[cache_key]
    try:
        r = Recipe(recipe_manager.recipe_manager.get_recipe_filename(pkgname))
    except PBException as ex:
        if fail_easy:
            return None
        else:
            pb_logging.logger.getChild("get_recipe").error("Error fetching recipe `{0}':\n{1}".format(
                pkgname, str(ex)
            ))
            raise ex
    RECIPE_CACHE[cache_key] = r
    if target is not None and r.target != target:
        if fail_easy:
            return None
        pb_logging.logger.getChild("get_recipe").error(
github gnuradio / pybombs / pybombs / config_manager.py View on Github external
def __init__(self, select_prefix=None):
        ## Get location of module
        self.module_dir = os.path.dirname(pb_logging.__file__)
        self.load(select_prefix)
        pb_logging.logger.info("PyBOMBS Version %s", __version__)
github gnuradio / pybombs / pybombs / inventory.py View on Github external
def __init__(
            self,
            inventory_file=None,
        ):
        self._filename = inventory_file
        self.log = pb_logging.logger.getChild("Inventory")
        self._state_names = {}
        for state in self._states.keys():
            setattr(self, "STATE_{0}".format(state.upper()), self._states[state][0])
            self._state_names[self._states[state][0]] = state
        self.load()
github gnuradio / pybombs / pybombs / fetcher.py View on Github external
def __init__(self):
        self.cfg = config_manager
        self.log = pb_logging.logger.getChild("Fetcher")
        self.prefix = self.cfg.get_active_prefix()
        if self.prefix.prefix_dir is not None:
            self.inventory = self.prefix.inventory
            self.src_dir = self.prefix.src_dir
        from pybombs import fetchers
        self.available = fetchers.get_all()
github gnuradio / pybombs / pybombs / config_manager.py View on Github external
def load(self, select_prefix=None):
        """
        Load the actual configuration. We put this outside the ctor so we can
        reload on the same object. In that case, anything unsaved is reset!
        """
        ## Get command line args:
        parser = argparse.ArgumentParser(add_help=False)
        self.setup_parser(parser)
        args = parser.parse_known_args()[0]
        cfg_files = []
        ## Set verbosity level:
        verb_offset = args.verbose - args.quiet
        verb_level = pb_logging.default_log_level - 10 * verb_offset
        if verb_level < pb_logging.TRACE:
            verb_level = pb_logging.TRACE
        pb_logging.logger.setLevel(verb_level)
        self.yes = args.yes
        ## Set up logger:
        self.log = pb_logging.logger.getChild("ConfigManager")
        ## Setup cfg_cascade:
        # self.cfg_cascade is a list of dicts. The higher the index,
        # the more important the dict.
        # Zeroth layer: The default values.
        self.cfg_cascade = [{k: v[0] for k, v in iteritems(self.defaults)},]
        # Global defaults
        global_cfg = os.path.join(self.global_base_dir, self.cfg_file_name)
        if self._append_cfg_from_file(global_cfg):
            cfg_files.insert(0, global_cfg)
        # Home directory:
        self.local_cfg_dir = self.get_pybombs_dir()
        if not os.path.isdir(self.local_cfg_dir):
            try:
github gnuradio / pybombs / pybombs / config_manager.py View on Github external
def load(self, select_prefix=None):
        """
        Load the actual configuration. We put this outside the ctor so we can
        reload on the same object. In that case, anything unsaved is reset!
        """
        ## Get command line args:
        parser = argparse.ArgumentParser(add_help=False)
        self.setup_parser(parser)
        args = parser.parse_known_args()[0]
        cfg_files = []
        ## Set verbosity level:
        verb_offset = args.verbose - args.quiet
        verb_level = pb_logging.default_log_level - 10 * verb_offset
        if verb_level < pb_logging.TRACE:
            verb_level = pb_logging.TRACE
        pb_logging.logger.setLevel(verb_level)
        self.yes = args.yes
        ## Set up logger:
        self.log = pb_logging.logger.getChild("ConfigManager")
        ## Setup cfg_cascade:
        # self.cfg_cascade is a list of dicts. The higher the index,
        # the more important the dict.
        # Zeroth layer: The default values.
        self.cfg_cascade = [{k: v[0] for k, v in iteritems(self.defaults)},]
        # Global defaults
        global_cfg = os.path.join(self.global_base_dir, self.cfg_file_name)
        if self._append_cfg_from_file(global_cfg):
            cfg_files.insert(0, global_cfg)
        # Home directory: