How to use the pkgbuilder._ 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 / build.py View on Github external
for pkg in abspkgs:
                pm.msg(_('retrieving {0}').format(pkg.name), True)
                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)

        if aurpkgs:
            print(_(':: Retrieving packages from aur...'))
            pm = pkgbuilder.ui.Progress(len(aurpkgs))
            for pkg in aurpkgs:
                pm.msg(_('cloning {0}').format(pkg.packagebase), True)
                clone(pkg.packagebase)

        print(_('Successfully fetched: ') + ' '.join(pkgnames))
    except pkgbuilder.exceptions.PBException as e:
        print(':: ERROR: ' + str(e.msg))
        exit(1)
github Kwpolska / pkgbuilder / pkgbuilder / __main__.py View on Github external
def main(source='AUTO', quit=True):
    """Main routine of PKGBUILDer."""
    try:
        verstring = 'PKGBUILDer v' + __version__
        # TRANSLATORS: translate the whole sentence.
        # Alternatively, use translation instead of locale.
        locale = _('LANG locale by AUTHOR ')
        if locale != 'LANG locale by AUTHOR ':
            verstring = ' — '.join([verstring, locale])
        DS.log.info('Initialized, parsing arguments.')
        parser = argparse.ArgumentParser(
            prog='pkgbuilder',
            description=_('An AUR helper (and library) in Python 3.'),
            epilog=_('Also accepts repository packages to build from source.'))
        parser.add_argument(
            '-V', '--version', action='version', version=verstring,
            help=_('show version number and quit'))
        parser.add_argument(
            'pkgnames', metavar=_('PACKAGE'), action='store', nargs='*',
            help=_('AUR/repository packages to build'))

        argopr = parser.add_argument_group(_('operations'))
        argopr.add_argument(
            '-S', '--sync', action='store_true', dest='pac',
            help=_('build in /tmp'))
        argopr.add_argument(
            '-F', '--fetch', '-G', '--get', action='store_true', dest='fetch',
            help=_('fetch package files'))
        argopr.add_argument(
            '--userfetch', action='append', dest='userfetch',
github Kwpolska / pkgbuilder / pkgbuilder / __main__.py View on Github external
'-F', '--fetch', '-G', '--get', action='store_true', dest='fetch',
            help=_('fetch package files'))
        argopr.add_argument(
            '--userfetch', action='append', dest='userfetch',
            metavar=_('USER'), help=_('fetch all package files of an user'))
        argopr.add_argument('-i', '--info', action='store_true', dest='info',
                            help=_('view package information'))
        argopr.add_argument(
            '-s', '--search', action='store_true', dest='search',
            help=_('search the AUR for matching strings'))
        argopr.add_argument(
            '-u', '--sysupgrade', action='count', default=False,
            dest='upgrade', help=_('upgrade installed AUR packages'))
        argopr.add_argument(
            '-U', '--upgrade', action='store_true', dest='finst',
            help=_('move package files to pacman cache and install them'))
        argopr.add_argument(
            '-X', '--runtx', action='store_true', dest='runtx',
            help=_('run transactions from .tx files'))

        argopt = parser.add_argument_group(_('options'))

        argopt.add_argument(
            '-c', '--clean', action='store_true', dest='clean',
            help=_('clean up work files before and after build'))
        argopt.add_argument(
            '--noclean', action='store_true', dest='noclean',
            help=_('don\'t clean up work files before and after build '
                   '(default)'))

        argopt.add_argument(
            '--colors', action='store_true', dest='colors',
github Kwpolska / pkgbuilder / pkgbuilder / utils.py View on Github external
Popularity     : {pop}
Out of Date    : {ood}
Maintainer     : {mnt}
First Submitted: {fsb}
Last Updated   : {upd}
Description    : {dsc}
Keywords       : {key}
""")

        to = []
        for pkg in pkgs:
            upd = pkg.modified.strftime(fmt)
            fsb = pkg.added.strftime(fmt)

            if pkg.is_outdated:
                ood = DS.colors['red'] + _('yes') + DS.colors['all_off']
            else:
                ood = _('no')
            termwidth = get_termwidth()
            if termwidth is None:
                termwidth = 9001  # Auto-wrap by terminal.

            to.append(t.format(nme=pkg.name,
                               bse=pkg.packagebase,
                               url=pkg.url,
                               ver=pkg.version,
                               lic=mlist(pkg.licenses, termwidth=termwidth),
                               grp=mlist(pkg.groups, termwidth=termwidth),
                               prv=mlist(pkg.provides, termwidth=termwidth),
                               dep=mlist(pkg.depends, termwidth=termwidth),
                               mkd=mlist(pkg.makedepends, termwidth=termwidth),
                               ckd=mlist(pkg.checkdepends,
github Kwpolska / pkgbuilder / pkgbuilder / build.py View on Github external
if not os.path.exists('.SRCINFO'):
            # Create a .SRCINFO file for ASP/repo packages.
            # Slightly hacky, but saves us work on parsing bash.
            DS.log.debug("Creating .SRCINFO for repository package")
            srcinfo = subprocess.check_output(["makepkg", "--printsrcinfo"])
            with open(".SRCINFO", "wb") as fh:
                fh.write(srcinfo)
    else:
        existing = find_packagefile(pkg.packagebase)
        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]
        DS.fancy_msg(_('Cloning the git repository...'))
        clone(pkg.packagebase)
        os.chdir('./{0}/'.format(pkg.packagebase))
        if not os.path.exists('.SRCINFO'):
            raise pkgbuilder.exceptions.EmptyRepoError(pkg.packagebase)
    subpackages = find_subpackages(os.path.abspath('./.SRCINFO'))

    if performdepcheck:
        DS.fancy_msg(_('Checking dependencies...'))
        depends = prepare_deps(os.path.abspath('./.SRCINFO'))
        deps = depcheck(depends, pkg)
        pkgtypes = [_('found in system'), _('found in repos'),
                    _('found in the AUR')]
        aurbuild = []
        if not deps:
            DS.fancy_msg2(_('none found'))
github Kwpolska / pkgbuilder / pkgbuilder / main.py View on Github external
description=_('An AUR helper (and library) in Python 3.'),
            epilog=_('Also accepting ABS packages.'))
        parser.add_argument(
            '-V', '--version', action='version', version=verstring,
            help=_('show version number and quit'))
        parser.add_argument(
            'pkgnames', metavar=_('PACKAGE'), action='store', nargs='*',
            help=_('AUR/ABS packages to build'))

        argopr = parser.add_argument_group(_('operations'))
        argopr.add_argument(
            '-F', '--fetch', action='store_true', default=False, dest='fetch',
            help=_('fetch package files'))
        argopr.add_argument(
            '--userfetch', action='append', dest='userfetch',
            metavar=_('USER'), help=_('fetch all package files of an user'))
        argopr.add_argument('-i', '--info', action='store_true', default=False,
                            dest='info', help=_('view package information'))
        argopr.add_argument(
            '-s', '--search', action='store_true',
            default=False, dest='search', help=_('search the AUR for '
                                                 'matching strings'))
        argopr.add_argument(
            '-u', '--sysupgrade', action='count', default=False,
            dest='upgrade', help=_('upgrade installed AUR packages'))
        argopr.add_argument(
            '-U', '--upgrade', action='store_true', default=False,
            dest='finst',
            help=_('copy package files to pacman cache and install them'))

        argopt = parser.add_argument_group(_('options'))
        argopt.add_argument(
github Kwpolska / pkgbuilder / pkgbuilder / __main__.py View on Github external
'--validation', action='store_true', dest='validation',
            help=_('check if packages were installed after build (default)'))
        argopt.add_argument(
            '-v', '--novalidation', action='store_true', dest='novalidation',
            help=_('don\'t check if packages were installed after build'))

        argopt.add_argument(
            '--install', action='store_true', dest='pkginst',
            help=_('install packages after building (default)'))
        argopt.add_argument(
            '-w', '--buildonly', action='store_true', dest='nopkginst',
            help=_('don\'t install packages after building'))

        argopt.add_argument(
            '--pgpcheck', action='store_true', dest='pgpcheck',
            help=_('verify source files with PGP signatures (default)'))
        argopt.add_argument(
            '--skippgpcheck', action='store_true', dest='nopgpcheck',
            help=_('do not verify source files with PGP signatures'))

        argopt.add_argument(
            '--confirm', action='store_true', dest='confirm',
            help=_('ask for confirmation (default)'))
        argopt.add_argument(
            '--noconfirm', action='store_true', dest='noconfirm',
            help=_('do not ask for any confirmation'))

        argopt.add_argument(
            '--shallow', action='store_true', dest='shallowclone',
            help=_('use shallow git clones (default)'))
        argopt.add_argument(
            '--deep', action='store_true', dest='deepclone',
github Kwpolska / pkgbuilder / pkgbuilder / main.py View on Github external
parser.add_argument(
            '-V', '--version', action='version', version=verstring,
            help=_('show version number and quit'))
        parser.add_argument(
            'pkgnames', metavar=_('PACKAGE'), action='store', nargs='*',
            help=_('AUR/ABS packages to build'))

        argopr = parser.add_argument_group(_('operations'))
        argopr.add_argument(
            '-F', '--fetch', action='store_true', default=False, dest='fetch',
            help=_('fetch package files'))
        argopr.add_argument(
            '--userfetch', action='append', dest='userfetch',
            metavar=_('USER'), help=_('fetch all package files of an user'))
        argopr.add_argument('-i', '--info', action='store_true', default=False,
                            dest='info', help=_('view package information'))
        argopr.add_argument(
            '-s', '--search', action='store_true',
            default=False, dest='search', help=_('search the AUR for '
                                                 'matching strings'))
        argopr.add_argument(
            '-u', '--sysupgrade', action='count', default=False,
            dest='upgrade', help=_('upgrade installed AUR packages'))
        argopr.add_argument(
            '-U', '--upgrade', action='store_true', default=False,
            dest='finst',
            help=_('copy package files to pacman cache and install them'))

        argopt = parser.add_argument_group(_('options'))
        argopt.add_argument(
            '-4', '--aur4', action='store_true',
            default=False, dest='aur4', help=_('use aur4.archlinux.org'))