How to use the pikaur.pprint.print_stdout function in pikaur

To help you get started, we’ve selected a few pikaur 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 actionless / pikaur / pikaur / main.py View on Github external
def cli_clean_packages_cache() -> None:
    args = parse_args()
    if not args.repo:
        for directory, message, minimal_clean_level in (
                (BUILD_CACHE_PATH, _("Build directory"), 1, ),
                (PACKAGE_CACHE_PATH, _("Packages directory"), 2, ),
        ):
            if minimal_clean_level <= args.clean and os.path.exists(directory):
                print_stdout('\n' + "{}: {}".format(message, directory))
                if ask_to_continue(text='{} {}'.format(
                        color_line('::', 12),
                        _("Do you want to remove all files?")
                )):
                    remove_dir(directory)
    if not args.aur:
        raise SysExit(
            interactive_spawn(sudo(
                [PikaurConfig().misc.PacmanPath.get_str(), ] + reconstruct_args(args)
            )).returncode
github actionless / pikaur / pikaur / install_cli.py View on Github external
if self.args.noconfirm:
            _print_sysupgrade()
            return
        answer = None
        while True:
            if answer is None:
                answer = _confirm_sysupgrade()
            if answer:
                letter = answer.lower()[0]
                if letter == _("y"):
                    break
                if letter == _("v"):
                    answer = _confirm_sysupgrade(verbose=True)
                    continue
                if letter == _("m"):
                    print_stdout()
                    self.manual_package_selection()
                    self.get_all_packages_info()
                    self.install_prompt()
                    break
                raise SysExit(125)
            break
github actionless / pikaur / pikaur / news.py View on Github external
def print_news(self) -> None:
        # check if we got a valid news feed by checking if we got an xml structure
        if not isinstance(self._news_feed, xml.etree.ElementTree.Element):
            return
        news_entry: xml.etree.ElementTree.Element
        first_news = True
        for news_entry in self._news_feed.iter('item'):
            child: xml.etree.ElementTree.Element
            for child in news_entry:
                if 'pubDate' in child.tag:
                    if self._is_new(str(child.text)):
                        if first_news:
                            print_stdout(
                                '\n' + color_line(_('There are news from archlinux.org!'), 9) + '\n'
                            )
                        self._print_one_entry(news_entry)
                        # news are in inverse chronological order (newest first).
                        # if there is something to print, we save this date
                        # in our cache
                        if first_news:
                            self._update_last_seen_news(news_entry)
                            first_news = False
                    else:
                        # no more news
                        return
github actionless / pikaur / pikaur / install_cli.py View on Github external
def install_repo_packages(self) -> None:
        print_stdout()
        extra_args = []
        if not (self.install_package_names or self.args.sysupgrade):
            return
        for excluded_pkg_name in self.manually_excluded_packages_names + self.args.ignore:
            extra_args.append('--ignore')
            # pacman's --ignore doesn't work with repo name:
            extra_args.append(strip_repo_name(excluded_pkg_name))
        if not retry_interactive_command(
                sudo(
                    get_pacman_command() + [
                        '--sync',
                    ] + reconstruct_args(self.args, ignore_args=[
                        'sync',
                        'ignore',
                        'refresh',
                    ]) + self.install_package_names + extra_args
github actionless / pikaur / pikaur / install_cli.py View on Github external
def _print_sysupgrade(verbose=False) -> None:
            print_stdout(pretty_format_sysupgrade(
                install_info=self.install_info,
                verbose=verbose
            ))
github actionless / pikaur / pikaur / main.py View on Github external
def cli_print_upgradeable() -> None:
    args = parse_args()
    updates: List[InstallInfo] = []
    if not args.repo:
        aur_updates, _not_found_aur_pkgs = find_aur_updates()
        updates += aur_updates
    if not args.aur:
        updates += find_repo_upgradeable()
    if not updates:
        return
    if args.quiet:
        print_stdout('\n'.join([
            pkg_update.name for pkg_update in updates
        ]))
    else:
        print_stdout(pretty_format_upgradeable(
            updates,
            print_repo=PikaurConfig().sync.AlwaysShowPkgOrigin.get_bool()
        ))
github actionless / pikaur / pikaur / build.py View on Github external
def get_latest_dev_sources(self, check_dev_pkgs=True) -> None:
        self.prepare_build_destination()
        if (
                self._source_repo_updated
        ) or (
            not (is_devel_pkg(self.package_base) and check_dev_pkgs)
        ) or (
            (self.last_installed_hash != self.current_hash) and not self.reviewed
        ):
            return
        print_stdout('{} {}...'.format(
            color_line('::', 15),
            _n(
                "Downloading the latest sources for a devel package {}",
                "Downloading the latest sources for devel packages {}",
                len(self.package_names)
            ).format(
                bold_line(', '.join(self.package_names))
            )
        ))
        pkgver_result = joined_spawn(
            isolate_root_cmd(
                MakePkgCommand.get() + [
                    '--nobuild', '--noprepare', '--nocheck', '--nodeps'
                ],
                cwd=self.build_dir
            ),
github actionless / pikaur / pikaur / build.py View on Github external
def mkdir(to_path) -> None:
    mkdir_result = spawn(isolate_root_cmd(['mkdir', '-p', to_path]))
    if mkdir_result.returncode != 0:
        print_stdout(mkdir_result.stdout_text)
        print_stderr(mkdir_result.stderr_text)
        raise Exception(_(f"Can't create destination directory '{to_path}'."))