How to use the pybombs.pb_logging.logger 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 / utils / archives.py View on Github external
def extract_to(filename, path):
    """
    Extract an archive into a directory. Return the prefix for the extracted files.
    """
    log = pb_logging.logger.getChild("extract_to")
    if tarfile.is_tarfile(filename):
        archive = tarfile.open(filename)
        names = archive.getnames()
    elif zipfile.is_zipfile(filename):
        archive = zipfile.ZipFile(filename)
        names = archive.namelist()
    else:
        raise RuntimeError("Cannot extract {}: Unknown archive type")
    log.debug("Unpacking {0}".format(filename))
    if len(names) == 1:
        prefix = os.path.split(archive.getnames()[0])[0]
    else:
        prefix = os.path.commonprefix(archive.getnames())
    if not prefix:
        prefix = '.'
    log.debug("Common prefix: {0}".format(prefix))
github gnuradio / pybombs / pybombs / install_manager.py View on Github external
def __init__(self):
        self.pm = package_manager.PackageManager()
        self.log = pb_logging.logger.getChild("install_manager")
github gnuradio / pybombs / pybombs / requirer.py View on Github external
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.")
github gnuradio / pybombs / pybombs / fetchers / base.py View on Github external
def __init__(self):
        Requirer.__init__(self)
        self.cfg = config_manager
        self.log = pb_logging.logger.getChild("Fetcher.{0}".format(self.url_type))
github gnuradio / pybombs / pybombs / packagers / base.py View on Github external
def __init__(self):
        self.cfg = config_manager
        self.log = pb_logging.logger.getChild("Packager.{0}".format(self.name))
github gnuradio / pybombs / pybombs / commands / base.py View on Github external
def __init__(self,
            cmd, args,
            load_recipes=False,
            require_prefix=True,
        ):
        self.cmd = cmd
        self.args = args
        self.log = pb_logging.logger.getChild(cmd)
        self.log.debug("Initializing command class for command {0}".format(cmd))
        self.cfg = config_manager
        if not cmd in self.cmds.keys():
            raise PBException("{0} is not a valid name for this command.".format(cmd))
        if load_recipes:
            from pybombs import recipe_manager
            self.recipe_manager = recipe_manager.recipe_manager
        self.prefix = None
        if self.cfg.get_active_prefix().prefix_dir is not None:
            self.prefix = self.cfg.get_active_prefix()
        elif require_prefix:
            self.log.error("No prefix specified. Aborting.")
            raise PBException("No prefix specified.")
        if self.prefix is not None:
            self.inventory = self.prefix.inventory
github gnuradio / pybombs / pybombs / gitcache_manager.py View on Github external
def __init__(self, path):
        self.path = path
        self.log = pb_logging.logger.getChild("GitCacheManager")
        self.ensure_repo_exists(path)
        self.remotes = self.get_existing_remotes()
github gnuradio / pybombs / pybombs / main.py View on Github external
def main():
    " Go, go, go! "
    try:
        return dispatch() or 0
    except PBException as ex:
        from pybombs import pb_logging
        if pb_logging.logger.getEffectiveLevel() <= pb_logging.DEBUG:
            pb_logging.logger.debug(str(ex))
        return 1
    except KeyboardInterrupt:
        pass
    return 0
github gnuradio / pybombs / pybombs / main.py View on Github external
def main():
    " Go, go, go! "
    try:
        return dispatch() or 0
    except PBException as ex:
        from pybombs import pb_logging
        if pb_logging.logger.getEffectiveLevel() <= pb_logging.DEBUG:
            pb_logging.logger.debug(str(ex))
        return 1
    except KeyboardInterrupt:
        pass
    return 0
github gnuradio / pybombs / pybombs / recipe.py View on Github external
def __init__(self, filename):
        self.id = os.path.splitext(os.path.basename(filename))[0]
        self.log = pb_logging.logger.getChild("Recipe[{0}]".format(self.id))
        self.inherit = 'empty'
        self._static = False
        # Load original recipe:
        self.log.trace("Loading recipe file: {0}".format(filename))
        self._data = load_recipe_from_file(filename)
        # Recursively do the inheritance:
        while self._data.get('inherit', 'empty'):
            inherit_from = self._data.get('inherit', 'empty')
            try:
                filename = recipe_manager.recipe_manager.get_template_filename(inherit_from)
                self.log.trace("Loading template file: {0}".format(filename))
            except PBException:
                self.log.warn("Recipe attempting to inherit from unknown template {0}".format(
                    inherit_from
                ))
                break