How to use the pkgbuilder.utils.print_package_search 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 / tests / test_pkgbuilder.py View on Github external
def test_utils_print_package_search(self):
        sample = ('aur/pkgbuilderts 3.2.0-1 (19 votes) '
                  '\x1b[1;1m\x1b[1;31m[out of date]\x1b[1;0m\n'
                  '    A Python AUR helper/library.')

        req = pkgbuilder.utils.print_package_search(self.fpkg, True)
        self.assertEqual(req, sample)
github Kwpolska / pkgbuilder / pkgbuilder / main.py View on Github external
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:
                if args.pac:
                    output = output + pkgbuilder.utils.print_package_search(
                        pkg, False, True) + '\n'
                else:
github Kwpolska / pkgbuilder / pkgbuilder / __main__.py View on Github external
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:
                output = output + pkgbuilder.utils.print_package_search(
                    pkg, True) + '\n'
            if output != '':
                print(output.rstrip())
            if quit:
                exit(0)

        if args.finst:
            # We do not know package names, and are unaware of signature files
            # Also, file names are where package names would usually be
            tx = pkgbuilder.transaction.Transaction(
                pkgnames=[],
                pkgpaths=pkgnames,
                sigpaths=[],
                filename=pkgbuilder.transaction.generate_filename(),
                delete=True)
            tx.run(standalone=False, validate=False)
github Kwpolska / pkgbuilder / pkgbuilder / __main__.py View on Github external
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:
                output = output + pkgbuilder.utils.print_package_search(
                    pkg, True) + '\n'
            if output != '':
                print(output.rstrip())
github Kwpolska / pkgbuilder / pkgbuilder / main.py View on Github external
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:
                if args.pac:
                    output = output + pkgbuilder.utils.print_package_search(
                        pkg, False, True) + '\n'
                else:
                    output = output + pkgbuilder.utils.print_package_search(
                        pkg, True, True) + '\n'
            if output != '':
                print(output.rstrip())
            if quit:
                exit(0)

        if args.finst:
            pkgbuilder.build.install(pkgnames, [], False)
            if quit:
                exit(0)

        if args.pac:
            DS.log.debug('-S passed, building in /tmp/.')
github Kwpolska / pkgbuilder / pkgbuilder / main.py View on Github external
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:
                if args.pac:
                    output = output + pkgbuilder.utils.print_package_search(
                        pkg, False, True) + '\n'
                else:
                    output = output + pkgbuilder.utils.print_package_search(
                        pkg, True, True) + '\n'
            if output != '':
                print(output.rstrip())
            if quit:
                exit(0)

        if args.finst:
            pkgbuilder.build.install(pkgnames, [], False)
            if quit:
                exit(0)

        if args.pac:
            DS.log.debug('-S passed, building in /tmp/.')
            path = '/tmp/pkgbuilder-{0}'.format(str(DS.uid))
            if not os.path.exists(path):
                os.mkdir(path)
github Kwpolska / pkgbuilder / pkgbuilder / build.py View on Github external
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]):
            DS.fancy_msg(_('Found an existing package for '