Exemple #1
0
    def print_details(self, spec):
        data = self._get_dist_data(spec.name)
        ver = self.get_best_version(data, spec, quiet=True)
        data = self.api.meta(spec.name, ver)
        for k in u"""
            name abstract description maintainer license release_status
            version date sha1
        """.split():
            try:
                v = data[k]
            except KeyError:
                logger.warning(_("data key '%s' not found"), k)
                continue

            if isinstance(v, list):
                for vv in v:
                    emit("%s: %s" % (k, vv))
            elif isinstance(v, dict):
                for kk, vv in v.items():
                    emit("%s: %s: %s" % (k, kk, vv))
            else:
                emit("%s: %s" % (k, v))

        k = 'provides'
        for ext, dext in data[k].items():
            emit("%s: %s: %s" % (k, ext, dext['version']))

        k = 'prereqs'
        if k in data:
            for phase, rels in data[k].items():
                for rel, pkgs in rels.items():
                    for pkg, ver in pkgs.items():
                        emit("%s: %s: %s %s" % (phase, rel, pkg, ver))
Exemple #2
0
    def print_details(self, spec):
        data = self._get_dist_data(spec.name)
        ver = self.get_best_version(data, spec, quiet=True)
        data = self.api.meta(spec.name, ver)
        for k in u"""
            name abstract description maintainer license release_status
            version date sha1
        """.split():
            try:
                v = data[k]
            except KeyError:
                logger.warning(_("data key '%s' not found"), k)
                continue

            if isinstance(v, list):
                for vv in v:
                    emit("%s: %s" % (k, vv))
            elif isinstance(v, dict):
                for kk, vv in v.items():
                    emit("%s: %s: %s" % (k, kk, vv))
            else:
                emit("%s: %s" % (k, v))

        k = 'provides'
        for ext, dext in data[k].items():
            emit("%s: %s: %s" % (k, ext, dext['version']))

        k = 'prereqs'
        if k in data:
            for phase, rels in data[k].items():
                for rel, pkgs in rels.items():
                    for pkg, ver in pkgs.items():
                        emit("%s: %s: %s %s" % (phase, rel, pkg, ver))
Exemple #3
0
 def print_versions(self, spec):
     data = self._get_dist_data(spec.name)
     name = data['name']
     vs = [(SemVer(d['version']), s) for s, ds in data['releases'].items()
           for d in ds]
     vs = [(v, s) for v, s in vs if spec.accepted(v)]
     vs.sort(reverse=True)
     for v, s in vs:
         emit("%s %s %s" % (name, v, s))
Exemple #4
0
def _get_exec(cmd):
    fn = find_script('pgxn-' + cmd)
    if not fn:
        emit(
            "pgxn: unknown command: '%s'. See 'pgxn --help'" % cmd,
            file=sys.stderr,
        )
        sys.exit(2)

    return fn
Exemple #5
0
 def print_versions(self, spec):
     data = self._get_dist_data(spec.name)
     name = data['name']
     vs = [
         (SemVer(d['version']), s)
         for s, ds in data['releases'].items()
         for d in ds
     ]
     vs = [(v, s) for v, s in vs if spec.accepted(v)]
     vs.sort(reverse=True)
     for v, s in vs:
         emit("%s %s %s" % (name, v, s))
Exemple #6
0
    def print_all_commands(self):
        cmds = self.find_all_commands()
        title = _("Available PGXN Client commands")
        emit(title)
        emit("-" * len(title))

        for cmd in cmds:
            emit("  " + cmd)
Exemple #7
0
    def print_all_commands(self):
        cmds = self.find_all_commands()
        title = _("Available PGXN Client commands")
        emit(title)
        emit("-" * len(title))

        for cmd in cmds:
            emit("  " + cmd)
Exemple #8
0
    def run(self):
        data = self.api.search(self.opts.where, self.opts.query)

        for hit in data['hits']:
            emit("%s %s" % (hit['dist'], hit['version']))
            if 'excerpt' in hit:
                excerpt = self.clean_excerpt(hit['excerpt'])

                for line in textwrap.wrap(excerpt, 72):
                    emit("    " + line)
                emit()
Exemple #9
0
    def run(self):
        data = self.api.search(self.opts.where, self.opts.query)

        for hit in data['hits']:
            emit("%s %s" % (hit['dist'], hit['version']))
            if 'excerpt' in hit:
                excerpt = self.clean_excerpt(hit['excerpt'])

                for line in textwrap.wrap(excerpt, 72):
                    emit("    " + line)
                emit()
Exemple #10
0
    def run(self):
        data = self.api.mirrors()
        if self.opts.uri:
            detailed = True
            data = [d for d in data if d['uri'] == self.opts.uri]
            if not data:
                raise ResourceNotFound(
                    _('mirror not found: %s') % self.opts.uri)
        else:
            detailed = self.opts.detailed

        for i, d in enumerate(data):
            if not detailed:
                emit(d['uri'])
            else:
                for k in u"""
                    uri frequency location bandwidth organization email
                    timezone src rsync notes
                """.split():
                    emit("%s: %s" % (k, d.get(k, '')))

                emit()
Exemple #11
0
    def run(self):
        data = self.api.mirrors()
        if self.opts.uri:
            detailed = True
            data = [d for d in data if d['uri'] == self.opts.uri]
            if not data:
                raise ResourceNotFound(
                    _('mirror not found: %s') % self.opts.uri
                )
        else:
            detailed = self.opts.detailed

        for i, d in enumerate(data):
            if not detailed:
                emit(d['uri'])
            else:
                for k in u"""
                    uri frequency location bandwidth organization email
                    timezone src rsync notes
                """.split():
                    emit("%s: %s" % (k, d.get(k, '')))

                emit()
Exemple #12
0
 def print_libexec(self):
     emit(get_public_scripts_dir())
Exemple #13
0
 def print_readme(self, spec):
     data = self._get_dist_data(spec.name)
     ver = self.get_best_version(data, spec, quiet=True)
     emit(self.api.readme(spec.name, ver))
Exemple #14
0
 def print_readme(self, spec):
     data = self._get_dist_data(spec.name)
     ver = self.get_best_version(data, spec, quiet=True)
     emit(self.api.readme(spec.name, ver))
Exemple #15
0
 def print_meta(self, spec):
     data = self._get_dist_data(spec.name)
     ver = self.get_best_version(data, spec, quiet=True)
     emit(self.api.meta(spec.name, ver, as_json=False))
Exemple #16
0
 def print_libexec(self):
     emit(get_public_scripts_dir())
Exemple #17
0
 def print_meta(self, spec):
     data = self._get_dist_data(spec.name)
     ver = self.get_best_version(data, spec, quiet=True)
     emit(self.api.meta(spec.name, ver, as_json=False))