示例#1
0
    def create_feed(self, entries, outdir, target):
        name = self._context['path'][0]
        xmldoc, feed = new_xmldoc_feed()
        feed.id = "https://developers.yubico.com/%s/Releases/" % (name)
        feed.title = name + " Releases"
        link = Link("https://developers.yubico.com/%s/Releases/atom.xml" %
                    (name))
        link.attrs["rel"] = "self"
        feed.links.append(link)
        mtimes = []
        for entry in entries:
            for file in entry['files']:
                e = Entry()
                e.id = "https://developers.yubico.com/%s/Releases/%s" % (
                    name, file['filename'])
                e.title = file['filename']
                e.author = Author("Yubico")
                e.updated = path.getmtime(
                    path.join(self._target, target, file['filename']))
                mtimes.append(e.updated)
                e.summary = "Release %s of %s" % (entry['version'], name)
                link = Link("https://developers.yubico.com/%s/Releases/%s" %
                            (name, file['filename']))
                e.links.append(link)
                feed.entries.append(e)

                if self._all_entries[0][0] < e.updated:
                    heapq.heapreplace(self._all_entries, (e.updated, e))

        feed.updated = max(mtimes)

        with open(outdir + "/atom.xml", 'w') as outfile:
            outfile.write(str(xmldoc))
    def create_feed(self, entries, outdir, target):
        name = self._context['path'][0]
        xmldoc, feed = new_xmldoc_feed()
        feed.id = "https://developers.yubico.com/%s/Releases/" % (name)
        feed.title = name + " Releases"
        link = Link("https://developers.yubico.com/%s/Releases/atom.xml" % (name))
        link.attrs["rel"] = "self"
        feed.links.append(link)
        mtimes = []
        for entry in entries:
            for file in entry['files']:
                e = Entry()
                e.id = "https://developers.yubico.com/%s/Releases/%s" % (name, file['filename'])
                e.title = file['filename']
                e.author = Author("Yubico")
                e.updated = path.getmtime(path.join(self._target, target, file['filename']))
                mtimes.append(e.updated)
                e.summary = "Release %s of %s" % (entry['version'], name)
                link = Link("https://developers.yubico.com/%s/Releases/%s" % (name, file['filename']))
                e.links.append(link)
                feed.entries.append(e)

                if self._all_entries[0][0] < e.updated:
                    heapq.heapreplace(self._all_entries, (e.updated, e))

        feed.updated = max(mtimes)

        with open(outdir + "/atom.xml", 'w') as outfile:
            outfile.write(str(xmldoc))
示例#3
0
    def _post_run(self):
        if os.environ.get('NORELEASES'):
            return
        aggregate = self.get_conf('releases_aggregate_feed')
        if not aggregate or not self._all_entries:
            return

        xmldoc, feed = new_xmldoc_feed()
        feed.id = "https://developers.yubico.com/Software_Projects/"
        feed.title = "Yubico software releases"
        link = Link("https://developers.yubico.com/" + aggregate)
        link.attrs["rel"] = "self"
        feed.links.append(link)
        entries = sorted(self._all_entries, reverse=True)
        feed.updated = entries[0][0]
        for (t, e) in entries:
            feed.entries.append(e)
            if e is None:
                break

        outpath = path.join(self._target, aggregate)
        if not path.isdir(path.dirname(outpath)):
            os.makedirs(path.dirname(outpath))
        with open(outpath, 'w') as outfile:
            outfile.write(str(xmldoc))
    def _post_run(self):
        aggregate = self.get_conf('releases_aggregate_feed')
        if not aggregate or not self._all_entries:
            return

        xmldoc, feed = new_xmldoc_feed()
        feed.id = "https://developers.yubico.com/Software_Projects/"
        feed.title = "Yubico software releases"
        link = Link("https://developers.yubico.com/" + aggregate)
        link.attrs["rel"] = "self"
        feed.links.append(link)
        entries = sorted(self._all_entries, reverse=True)
        feed.updated = entries[0][0]
        for (t, e) in entries:
            feed.entries.append(e)
            if e is None:
                break

        outpath = path.join(self._target, aggregate)
        if not path.isdir(path.dirname(outpath)):
            os.makedirs(path.dirname(outpath))
        with open(outpath, 'w') as outfile:
            outfile.write(str(xmldoc))