How to use the pkgbuilder.DS.fancy_error2 function in pkgbuilder

To help you get started, we’ve selected a few pkgbuilder 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 Kwpolska / pkgbuilder / pkgbuilder / main.py View on Github external
if args.search:
            if not pkgnames:
                if quit:
                    exit(1)
            else:
                DS.log.debug('Searching...')
                searchstring = '+'.join(pkgnames)
                if len(searchstring) < 2:
                    # this would be too many entries, but this is an actual API
                    # limitation and not an idea of yours truly.
                    DS.fancy_error(_('Search query too short'))
                    DS.fancy_msg(_('Searching for exact match...'))
                    search = pkgbuilder.utils.info([searchstring])
                    if search == []:
                        DS.fancy_error2(_('not found'))
                        if quit:
                            exit(0)
                    else:
                        pkgbuilder.utils.print_package_search(
                            search[0], prefix=(DS.colors['blue'] + '  ->' +
                                               DS.colors['all_off'] +
                                               DS.colors['bold'] + ' '),
                            prefixp='  -> ')
                        sys.stdout.write(DS.colors['all_off'])
                        if quit:
                            exit(0)
                else:
                    search = pkgbuilder.utils.search(searchstring)

            output = ''
            for pkg in search:
github Kwpolska / pkgbuilder / pkgbuilder / __main__.py View on Github external
for pkgname in pkgnames:
                try:
                    DS.log.info('Building {0}'.format(pkgname))
                    out = pkgbuilder.build.auto_build(pkgname, DS.depcheck,
                                                      DS.pkginst, pkgnames,
                                                      DS.edit_pkgbuild)
                    if out:
                        toinstall += out[1][0]
                        sigs += out[1][1]
                except PBException as e:
                    DS.fancy_error(str(e))
                    if e.exit:
                        exit(1)
                    else:
                        DS.fancy_error2(_("skipping package {0}").format(
                            pkgname))

            if DS.pkginst:
                # If there is nothing to install, but the user asked to install
                # something, we will exit with the amount of packages that were
                # not installed; this behavior is similar to what transaction
                # validation would do.
                qs = len(tovalidate)
            else:
                # But otherwise (-w, --buildonly), we can just exit with zero.
                qs = 0

            if toinstall:
                tx = pkgbuilder.transaction.Transaction(
                    pkgnames=tovalidate,
                    pkgpaths=toinstall,
github Kwpolska / pkgbuilder / pkgbuilder / __main__.py View on Github external
if args.search:
            if not pkgnames:
                if quit:
                    exit(1)
            else:
                DS.log.debug('Searching...')
                search_string = ' '.join(pkgnames)
                if len(search_string) < 2:
                    # this would be too many entries, but this is an actual API
                    # limitation and not an idea of yours truly.
                    DS.fancy_error(_('Search query too short'))
                    DS.fancy_msg(_('Searching for exact match...'))
                    search = pkgbuilder.utils.info([search_string])
                    if search == []:
                        DS.fancy_error2(_('not found'))
                        if quit:
                            exit(0)
                    else:
                        pkgbuilder.utils.print_package_search(
                            search[0], prefix=(DS.colors['blue'] + '  ->' +
                                               DS.colors['all_off'] +
                                               DS.colors['bold'] + ' '),
                            prefixp='  -> ')
                        sys.stdout.write(DS.colors['all_off'])
                        if quit:
                            exit(0)
                else:
                    search = pkgbuilder.utils.search(search_string)

            output = ''
            for pkg in search:
github Kwpolska / pkgbuilder / pkgbuilder / transaction.py View on Github external
def _print_txfail(self, stage, quiet):
        """Print transaction failure message."""
        if not quiet:
            DS.log.error("Transaction {0!r} failed (stage {1})".format(
                self, stage))
            if self.pacmanreturn == 0 and self.invalid > 0:
                # special case: retrying the transaction is not helpful, as it
                # won't help fix the validation status.  The user should
                # investigate by reading the build logs and acting accordingly.
                DS.fancy_error(_("Some packages failed to build."))
            else:
                DS.fancy_error(_("Transaction failed!"))
                if self.filename:
                    c = 'c' if self.delete else ''
                    DS.fancy_error2(_("To retry, run:"))
                    DS.fancy_error2("pkgbuilder -X{c} {fn}".format(
                        c=c, fn=self.filename))
github Kwpolska / pkgbuilder / pkgbuilder / transaction.py View on Github external
def _print_txfail(self, stage, quiet):
        """Print transaction failure message."""
        if not quiet:
            DS.log.error("Transaction {0!r} failed (stage {1})".format(
                self, stage))
            if self.pacmanreturn == 0 and self.invalid > 0:
                # special case: retrying the transaction is not helpful, as it
                # won't help fix the validation status.  The user should
                # investigate by reading the build logs and acting accordingly.
                DS.fancy_error(_("Some packages failed to build."))
            else:
                DS.fancy_error(_("Transaction failed!"))
                if self.filename:
                    c = 'c' if self.delete else ''
                    DS.fancy_error2(_("To retry, run:"))
                    DS.fancy_error2("pkgbuilder -X{c} {fn}".format(
                        c=c, fn=self.filename))