How to use the pikaur.core.interactive_spawn 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 / install_cli.py View on Github external
):
                    git_args = [
                        'git',
                        '-C',
                        repo_status.repo_path,
                        'diff',
                    ] + PikaurConfig().build.GitDiffArgs.get_str().split(',') + [
                        repo_status.last_installed_hash,
                        repo_status.current_hash,
                    ]
                    diff_pager = PikaurConfig().ui.DiffPager
                    if diff_pager == 'always':
                        git_args = ['env', 'GIT_PAGER=less -+F'] + git_args
                    elif diff_pager == 'never':
                        git_args = ['env', 'GIT_PAGER=cat'] + git_args
                    interactive_spawn(git_args)
            elif self.args.noconfirm:
                print_stdout(_skip_diff_label.format(
                    pkg=_pkg_label,
                    reason="--noconfirm"
                ))
            elif not repo_status.last_installed_hash:
                print_warning(_skip_diff_label.format(
                    pkg=_pkg_label,
                    reason=_("installing for the first time")
                ))
            else:
                print_warning(_skip_diff_label.format(
                    pkg=_pkg_label,
                    reason=_("already reviewed")
                ))
github actionless / pikaur / pikaur / main.py View on Github external
sudo(restart_args)
            ).returncode)
        else:
            if not require_sudo or running_as_root():
                # Just run the operation normally
                pikaur_operation()
            else:
                # Or use sudo loop if not running as root but need to have it later
                run_with_sudo_loop(pikaur_operation)
    else:
        # Just bypass all the args to pacman
        pacman_args = [PikaurConfig().misc.PacmanPath.get_str(), ] + (args.raw or [])
        if require_sudo:
            pacman_args = sudo(pacman_args)
        sys.exit(
            interactive_spawn(pacman_args).returncode
        )
github actionless / pikaur / pikaur / build.py View on Github external
mkdir(to_path)

    from_paths = []
    for src_path in glob(f'{from_path}/*') + glob(f'{from_path}/.*'):
        if os.path.basename(src_path) != '.git':
            from_paths.append(src_path)
    to_path = f'{to_path}/'

    cmd_args = isolate_root_cmd(['cp', '-r'] + from_paths + [to_path])

    result = spawn(cmd_args)
    if result.returncode != 0:
        if os.path.exists(to_path):
            remove_dir(to_path)
            mkdir(to_path)
        result = interactive_spawn(cmd_args)
        if result.returncode != 0:
            raise Exception(_(f"Can't copy '{from_path}' to '{to_path}'."))
github actionless / pikaur / pikaur / install_cli.py View on Github external
return False
        if ask_to_continue(
                _("Do you want to {edit} {file} for {name} package?").format(
                    edit=bold_line(_("edit")),
                    file=filename,
                    name=bold_line(', '.join(package_build.package_names)),
                ),
                default_yes=not (package_build.last_installed_hash or
                                 PikaurConfig().build.DontEditByDefault.get_bool())
        ):
            full_filename = os.path.join(
                package_build.repo_path,
                filename
            )
            old_hash = hash_file(full_filename)
            interactive_spawn(
                editor_cmd + [full_filename]
            )
            new_hash = hash_file(full_filename)
            return old_hash != new_hash
        return False
github actionless / pikaur / pikaur / build.py View on Github external
while True:
            cmd_args = MakePkgCommand.get() + makepkg_args
            if skip_pgp_check:
                cmd_args += ['--skippgpcheck']
            if skip_file_checksums:
                cmd_args += ['--skipchecksums']
            if self.skip_carch_check:
                cmd_args += ['--ignorearch']
            cmd_args = isolate_root_cmd(cmd_args, cwd=self.build_dir)
            spawn_kwargs: Dict[str, Any] = {}
            if self.args.hide_build_log:
                spawn_kwargs = dict(
                    stdout=subprocess.PIPE,
                    stderr=subprocess.PIPE
                )
            result = interactive_spawn(
                cmd_args,
                cwd=self.build_dir,
                **spawn_kwargs
            )
            print_stdout()
            build_succeeded = result.returncode == 0
            if build_succeeded:
                break

            print_stderr(color_line(_("Command '{}' failed to execute.").format(
                ' '.join(cmd_args)
            ), 9))
            if PikaurConfig().build.SkipFailedBuild.get_bool():
                answer = _("s")
            elif self.args.noconfirm:
                answer = _("a")
github actionless / pikaur / pikaur / build.py View on Github external
def git_reset_changed(self) -> InteractiveSpawn:
        return interactive_spawn(isolate_root_cmd([
            'git',
            '-C',
            self.repo_path,
            'checkout',
            '--',
            "*"
        ]))