How to use the west.log.banner function in west

To help you get started, we’ve selected a few west 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 zephyrproject-rtos / west / src / west / app / main.py View on Github external
if self.mle:
                    self.handle_builtin_manifest_load_err(args)

                cmd = self.builtins.get(args.command, self.builtins['help'])
                cmd.run(args, unknown, self.topdir, manifest=self.manifest)
            else:
                self.run_extension(args.command, argv)
        except KeyboardInterrupt:
            sys.exit(0)
        except BrokenPipeError:
            sys.exit(0)
        except CalledProcessError as cpe:
            log.err(f'command exited with status {cpe.returncode}: '
                    f'{quote_sh_list(cpe.cmd)}', fatal=True)
            if args.verbose >= log.VERBOSE_EXTREME:
                log.banner('Traceback (enabled by -vvv):')
                traceback.print_exc()
            sys.exit(cpe.returncode)
        except ExtensionCommandError as ece:
            msg = f"extension command \"{args.command}\" couldn't be run"
            if ece.hint:
                msg += '\n  Hint: ' + ece.hint

            if args.verbose >= log.VERBOSE_EXTREME:
                log.err(msg, fatal=True)
                log.banner('Traceback (enabled by -vvv):')
                traceback.print_exc()
            else:
                tb_file = dump_traceback()
                msg += f'\n  See {tb_file} for a traceback.'
                log.err(msg, fatal=True)
            sys.exit(ece.returncode)
github zephyrproject-rtos / west / src / west / app / project.py View on Github external
def local(self, args) -> Path:
        if args.manifest_rev is not None:
            log.die('--mr cannot be used with -l')

        manifest_dir = Path(args.directory or os.getcwd())
        manifest_file = manifest_dir / 'west.yml'
        topdir = manifest_dir.parent
        rel_manifest = manifest_dir.name
        west_dir = topdir / WEST_DIR

        if not manifest_file.is_file():
            log.die(f'can\'t init: no "west.yml" found in {manifest_dir}')

        log.banner('Initializing from existing manifest repository',
                   rel_manifest)
        log.small_banner(f'Creating {west_dir} and local configuration file')
        self.create(west_dir)
        os.chdir(topdir)
        update_config('manifest', 'path', os.fspath(rel_manifest))

        return topdir
github zephyrproject-rtos / west / src / west / app / project.py View on Github external
def update(self, project):
        if self.args.stats:
            stats = dict()
            update_start = perf_counter()
        else:
            stats = None
        take_stats = stats is not None

        log.banner(f'updating {project.name_and_path}:')

        # Make sure we've got a project to work with.
        self.ensure_cloned(project, stats, take_stats)

        # Point refs/heads/manifest-rev at project.revision,
        # fetching it from the remote if necessary.
        self.set_new_manifest_rev(project, stats, take_stats)

        # Clean up refs/west/*. At some point, we should only do this
        # if we've fetched, but we're leaving it here to clean up
        # garbage in people's repositories introduced by previous
        # versions of west that left refs in place here.
        self.clean_refs_west(project, stats, take_stats)

        # Make sure HEAD is pointing at *something*.
        self.ensure_head_ok(project, stats, take_stats)
github NordicPlayground / fw-nrfconnect-nrf / scripts / west_commands / ncs_commands.py View on Github external
for p in projects:
                log.small_banner(p.format('{name_and_path}'))

        if missing_blacklisted and log.VERBOSE >= log.VERBOSE_NORMAL:
            log.banner('blacklisted zephyr projects',
                       'not in nrf (these are all OK):')
            print_lst(missing_blacklisted)

        log.banner('blacklisted zephyr projects in nrf:')
        if present_blacklisted:
            log.wrn('these should all be removed from nrf')
            print_lst(present_blacklisted)
        else:
            log.inf('none (OK)')

        log.banner('non-blacklisted zephyr projects',
                   'missing from nrf:')
        if missing_allowed:
            log.wrn('these should be blacklisted or added to nrf')
            for p in missing_allowed:
                log.small_banner(p.format('{name_and_path}'))
                log.inf(p.format('upstream revision: {revision}'))
                log.inf(p.format('upstream URL: {url}'))
        else:
            log.inf('none (OK)')

        if present_allowed:
            log.banner('projects in both zephyr and nrf:')
            for zp in present_allowed:
                # Do some extra checking on unmerged commits.
                self.allowed_project(zp)
github zephyrproject-rtos / west / src / west / app / project.py View on Github external
def bootstrap(self, args) -> Path:
        manifest_url = args.manifest_url or MANIFEST_URL_DEFAULT
        manifest_rev = args.manifest_rev or MANIFEST_REV_DEFAULT
        topdir = Path(abspath(args.directory or os.getcwd()))
        west_dir = topdir / WEST_DIR

        try:
            already = util.west_topdir(topdir, fall_back=False)
            self.die_already(already)
        except util.WestNotFound:
            pass

        log.banner('Initializing in', topdir)
        if not topdir.is_dir():
            self.create(topdir, exist_ok=False)

        # Clone the manifest repository into a temporary directory.
        tempdir: Path = west_dir / 'manifest-tmp'
        if tempdir.is_dir():
            log.dbg('removing existing temporary manifest directory', tempdir)
            shutil.rmtree(tempdir)
        try:
            self.clone_manifest(manifest_url, manifest_rev, os.fspath(tempdir))
        except subprocess.CalledProcessError:
            shutil.rmtree(tempdir, ignore_errors=True)
            raise

        # Verify the manifest file exists.
        temp_manifest = tempdir / 'west.yml'
github NordicPlayground / fw-nrfconnect-nrf / scripts / west_commands / ncs_commands.py View on Github external
else:
            log.inf('none (OK)')

        log.banner('non-blacklisted zephyr projects',
                   'missing from nrf:')
        if missing_allowed:
            log.wrn('these should be blacklisted or added to nrf')
            for p in missing_allowed:
                log.small_banner(p.format('{name_and_path}'))
                log.inf(p.format('upstream revision: {revision}'))
                log.inf(p.format('upstream URL: {url}'))
        else:
            log.inf('none (OK)')

        if present_allowed:
            log.banner('projects in both zephyr and nrf:')
            for zp in present_allowed:
                # Do some extra checking on unmerged commits.
                self.allowed_project(zp)

        if log.VERBOSE <= log.VERBOSE_NONE:
            log.inf('\nNote: verbose output was omitted,',
                    'use "west -v ncs-compare" for more details.')