How to use the pkgbuilder.DS.fancy_msg 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
qs = 1
            if quit:
                exit(qs)

        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)
github Kwpolska / pkgbuilder / pkgbuilder / __main__.py View on Github external
qs = 1
            if quit:
                exit(qs)

        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)
github Kwpolska / pkgbuilder / pkgbuilder / transaction.py View on Github external
def validate(self, quiet):
        """Check if packages were installed.

        :param bool quiet: suppress messages
        :return: number of packages that were not installed
        :rtype: int
        """
        if self.pkgnames:
            if not quiet:
                DS.fancy_msg(_('Validating installation status...'))
            DS.log.info('Validating: ' + '; '.join(self.pkgnames))
            DS.pycreload()
            localdb = DS.pyc.get_localdb()

            aurpkgs = {aurpkg.name: aurpkg.version for aurpkg in
                       pkgbuilder.utils.info(self.pkgnames)}

            wrong = len(self.pkgnames)
        else:
            wrong = 0

        for pkgname in self.pkgnames:
            lpkg = localdb.get_pkg(pkgname)
            try:
                aurversion = aurpkgs[pkgname]
            except KeyError:
github Kwpolska / pkgbuilder / pkgbuilder / transaction.py View on Github external
def run(self, standalone=True, quiet=False, validate=True):
        """Run a transaction."""
        if not quiet:
            if not standalone:
                DS.fancy_msg(_('Installing built packages...'))
            if self.filename:
                DS.fancy_msg(_('Running transaction from file {0}...').format(
                    self.filename))
            else:
                DS.fancy_msg(_('Running transaction...'))

        DS.log.info("Running transaction {0!r}".format(self))

        self._test_sudo()

        ret = self.move(True, quiet)
        if ret != 0:
            self._print_txfail('move', quiet)
            return False
        ret = self.install(True, quiet)
        if ret != 0:
            self._print_txfail('install', quiet)
            return False
github Kwpolska / pkgbuilder / pkgbuilder / build.py View on Github external
prefix=DS.colors['blue'] +
                                          '  ->' + DS.colors['all_off'] +
                                          DS.colors['bold'] + ' ',
                                          prefixp='  -> ')
    sys.stdout.write(DS.colors['all_off'])
    if pkg.is_abs:
        DS.fancy_msg(_('Retrieving from ASP...'))
        rc = asp_export(pkg)
        if rc > 0:
            raise pkgbuilder.exceptions.NetworkError(
                _('Failed to retieve {0} (from ASP).').format(
                    pkg.name), source='asp', pkg=pkg, retcode=rc)

        existing = find_packagefile(pkg.name)
        if any(pkg.name in i for i in existing[0]):
            DS.fancy_msg(_('Found an existing package for '
                           '{0}').format(pkgname))
            if not pkginstall:
                existing = ([], [])
            return [RES_EXISTING, existing]
        try:
            os.chdir('./{0}'.format(pkg.name))
        except FileNotFoundError:
            raise pkgbuilder.exceptions.PBException(
                'The package download failed.\n    This package might '
                'be generated from a split PKGBUILD.  Please find out the '
                'name of the “main” package (eg. python- instead of python2-) '
                'and try again.', pkg.name, exit=False)

        if not os.path.exists('.SRCINFO'):
            # Create a .SRCINFO file for ASP/repo packages.
            # Slightly hacky, but saves us work on parsing bash.
github Kwpolska / pkgbuilder / pkgbuilder / build.py View on Github external
pkg = pkgbuilder.utils.info([pkgname])[0]
    except IndexError:
        DS.log.info('{0} not found in the AUR, checking in repositories'.format(
            pkgname))
        syncpkgs = []
        for j in [i.pkgcache for i in DS.pyc.get_syncdbs()]:
            syncpkgs.append(j)
        syncpkgs = functools.reduce(lambda x, y: x + y, syncpkgs)
        abspkg = pyalpm.find_satisfier(syncpkgs, pkgname)
        if abspkg:  # abspkg can be None or a pyalpm.Package object.
            pkg = pkgbuilder.package.ABSPackage.from_pyalpm(abspkg)
            subpackages = [pkg.name]  # no way to get it
    if not pkg:
        raise pkgbuilder.exceptions.PackageNotFoundError(pkgname, 'build')

    DS.fancy_msg(_('Building {0}...').format(pkg.name))
    pkgbuilder.utils.print_package_search(pkg,
                                          prefix=DS.colors['blue'] +
                                          '  ->' + DS.colors['all_off'] +
                                          DS.colors['bold'] + ' ',
                                          prefixp='  -> ')
    sys.stdout.write(DS.colors['all_off'])
    if pkg.is_abs:
        DS.fancy_msg(_('Retrieving from ASP...'))
        rc = asp_export(pkg)
        if rc > 0:
            raise pkgbuilder.exceptions.NetworkError(
                _('Failed to retieve {0} (from ASP).').format(
                    pkg.name), source='asp', pkg=pkg, retcode=rc)

        existing = find_packagefile(pkg.name)
        if any(pkg.name in i for i in existing[0]):