Exemplo n.º 1
0
    def get_rev_deps(self, name, repo=None):
        try:
            rvdb = self.rvdb.get_item(name, repo)
        except BaseException:  # FIXME: what exception could we catch here, replace with that.
            return []

        rev_deps = []

        for pkg, dep in rvdb:
            node = xmlext.parseString(dep)
            dependency = inary.analyzer.dependency.Dependency()
            dependency.package = xmlext.getNodeText(node)

            if xmlext.getAttributeList(node):
                if xmlext.getNodeAttribute(node, "version"):
                    dependency.__dict__["version"] = xmlext.getNodeAttribute(
                        node, "version")
                elif xmlext.getNodeAttribute(node, "release"):
                    dependency.__dict__["release"] = xmlext.getNodeAttribute(
                        node, "release")
                else:
                    pass  # FIXME: ugly
            rev_deps.append((pkg, dependency))

        return rev_deps
Exemplo n.º 2
0
 def _set_i18n(tag, inst):
     try:
         for summary in xmlext.getTagByName(tag, "Summary"):
             inst.summary[xmlext.getNodeAttribute(
                 summary, "xml:lang")] = xmlext.getNodeText(summary)
         for desc in xmlext.getTagByName(tag, "Description"):
             inst.description[xmlext.getNodeAttribute(
                 desc, "xml:lang")] = xmlext.getNodeText(desc)
     except AttributeError as e:
         raise Error(
             _("translations.xml file is badly formed.: {}").format(e))
Exemplo n.º 3
0
    def __get_release(meta_doc):
        history = xmlext.getNode(meta_doc, 'History')
        update = xmlext.getNode(history, 'Update')

        release = xmlext.getNodeAttribute(update, 'release')

        return release
Exemplo n.º 4
0
    def __get_version(meta_doc):
        history = xmlext.getNode(meta_doc, 'History')
        update = xmlext.getNode(history, 'Update')

        version = xmlext.getNodeText(update, 'Version')
        release = xmlext.getNodeAttribute(update, 'release')

        return version, release, None
Exemplo n.º 5
0
    def __make_dependency(depStr):

        node = xmlext.parseString(depStr)

        dependency = inary.analyzer.dependency.Dependency()
        dependency.package = xmlext.getNodeText(node)

        if xmlext.getAttributeList(node):
            if xmlext.getNodeAttribute(node, "version"):
                dependency.__dict__["version"] = xmlext.getNodeAttribute(
                    node, "version")
            elif xmlext.getNodeAttribute(node, "release"):
                dependency.__dict__["release"] = xmlext.getNodeAttribute(
                    node, "release")
            else:
                pass  #FIXME: ugly
        return dependency
Exemplo n.º 6
0
 def decode(self, node, errs, where=""):
     # flags, tag name, instance attribute
     assert self.tag != ''
     nodes = xmlext.getAllNodes(node, self.tag)
     if not nodes:
         if self.req == mandatory:
             errs.append(where + ': ' +
                         _("At least one '{}' tag should have local text."
                           ).format(self.tag))
     else:
         for node in nodes:
             lang = xmlext.getNodeAttribute(node, 'xml:lang')
             c = xmlext.getNodeText(node)
             if not c:
                 errs.append(where + ': ' +
                             _("'{0}' language of tag '{1}' is empty."
                               ).format(lang, self.tag))
             # FIXME: check for dups and 'en'
             if not lang:
                 lang = 'en'
             self[lang] = str(c)
Exemplo n.º 7
0
 def readtext(node, attr):
     return xmlext.getNodeAttribute(node, attr)