How to use the pkgbuilder.DS.log.error 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
DS.colors_status = DS.get_setting('--colors', 'options', 'colors',
                                          args.colors, args.nocolors)
        DS.edit_pkgbuild = DS.get_setting('--edit-pkgbuild', 'options', 'edit_pkgbuild',
                                          args.edit_pkgbuild, args.noedit_pkgbuild)
        pkgnames = args.pkgnames

        if DS.get_setting('--debug', 'options', 'debug',
                          args.debug, args.nodebug):
            DS.debugmode(nochange=True)
            DS.log.info('*** PKGBUILDer v{0}'.format(__version__))
            DS.log.debug('*** debug output on.')

        DS.log.info('Arguments parsed.  {0}'.format(args.__dict__))

        if 'VIRTUAL_ENV' in os.environ:
            DS.log.error("virtualenv detected, exiting.")
            DS.fancy_error(_("PKGBUILDer cannot work in a virtualenv, "
                             "exiting."))
            exit(83)

        if not DS.colors_status:
            DS.colorsoff()
            DS.log.debug('Colors turned off.')

        if args.info:
            DS.log.debug('Showing info...')

            pkgs = pkgbuilder.utils.info(pkgnames)
            foundnames = [i.name for i in pkgs]
            if pkgs:
                pkgbuilder.utils.print_package_info(pkgs)
                qs = 0
github Kwpolska / pkgbuilder / pkgbuilder / main.py View on Github external
DS.pacman = args.pac
        DS.cleanup = args.cleanup
        pkgnames = args.pkgnames

        if args.aur4:
            pkgbuilder.aur.AUR.base = 'https://aur4.archlinux.org'

        if args.debug:
            DS.debugmode(nochange=True)
            DS.log.info('*** PKGBUILDer v{0}'.format(__version__))
            DS.log.debug('*** debug output on.')

        DS.log.info('Arguments parsed.  {0}'.format(args.__dict__))

        if 'VIRTUAL_ENV' in os.environ:
            DS.log.error("virtualenv detected, exiting.")
            DS.fancy_error(_("PKGBUILDer cannot work in a virtualenv, "
                             "exiting."))
            exit(83)

        if not args.color:
            DS.colorsoff()
            DS.log.debug('Colors turned off.')

        if args.info:
            DS.log.debug('Showing info...')

            pkgs = pkgbuilder.utils.info(pkgnames)
            foundnames = [i.name for i in pkgs]
            if pkgs:
                pkgbuilder.utils.print_package_info(pkgs)
                qs = 0
github Kwpolska / pkgbuilder / pkgbuilder / exceptions.py View on Github external
def __init__(self, msg, source, exit=True, *args, **kwargs):
        """Initialize and log the error."""
        DS.log.error('({0:<20}) {1} (via {2})'.format(self.qualname, msg,
                                                      source))
        self.msg = msg
        try:
            self.source = source.args[0].reason
        except Exception:
            try:
                self.source = source.args[0]
            except Exception:
                self.source = source
        self._source = source
        self.exit = exit
        self.args = args
        self.kwargs = kwargs
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 / exceptions.py View on Github external
def __init__(self, retcode, exit=True, *args, **kwargs):
        """Initialize and log the error."""
        DS.log.error('({0:<20}) {1}'.format(self.qualname, retcode))
        self.retcode = retcode
        self.source = 'makepkg'
        self.exit = exit
        self.args = args
        self.kwargs = kwargs
github Kwpolska / pkgbuilder / pkgbuilder / transaction.py View on Github external
pkgpaths = []
        sigpaths = []
        failed_files = 0
        for p in self.pkgpaths:
            pacp = self._pacman_pkgpath(p)
            if p == pacp:
                DS.log.warning("Not moving package file {0} -- "
                               "already in pacman cache".format(p))
            elif os.path.exists(p):
                pkgpaths.append(p)
            elif os.path.exists(pacp):
                DS.log.warning("Not moving package file {0} -- "
                               "found in pacman cache".format(p))
            else:
                DS.log.error("Not moving package file {0} -- "
                             "not found".format(p))
                if not quiet:
                    DS.fancy_warning2(_("Package file {0} not found").format(
                        p))
                failed_files += 1

        for s in self.sigpaths:
            pacs = self._pacman_pkgpath(p)
            if s == pacs:
                DS.log.warning("Not moving signature file {0} -- "
                               "already in pacman cache".format(s))
            elif os.path.exists(s):
                sigpaths.append(s)
            elif os.path.exists(pacs):
                DS.log.warning("Not moving signature file {0} -- "
                               "found in pacman cache".format(s))