def get_changelog_entries(): key = 'ietf:release:get_changelog_entries:%s' % ietf.__version__ log_entries = cache.get(key) if not log_entries: if os.path.exists(settings.CHANGELOG_PATH): log_entries = changelog.parse(settings.CHANGELOG_PATH) cache.set(key, log_entries, 60 * 60 * 24) return log_entries
def release(request, version=None): entries = {} if os.path.exists(settings.CHANGELOG_PATH): log_entries = changelog.parse(settings.CHANGELOG_PATH) else: raise Http404() next = None for entry in log_entries: if next: next.prev = entry entry.next = next next = entry entries = dict([ (entry.version, entry) for entry in log_entries]) if version == None or version not in entries: version = log_entries[0].version return render_to_response('release/release.html', { 'releases': log_entries, 'version': version, 'entry': entries[version], }, context_instance=RequestContext(request))
def release(request, version=None): entries = {} if os.path.exists(settings.CHANGELOG_PATH): log_entries = changelog.parse(settings.CHANGELOG_PATH) else: return HttpResponse("Error: changelog file %s not found" % settings.CHANGELOG_PATH) next = None for entry in log_entries: if next: next.prev = entry entry.next = next next = entry entries = dict((entry.version, entry) for entry in log_entries) if version == None or version not in entries: version = log_entries[0].version entries[version].logentry = trac_links(entries[version].logentry.strip('\n')) code_coverage_url = None code_coverage_time = None if os.path.exists(settings.TEST_CODE_COVERAGE_REPORT_FILE) and version == log_entries[0].version: code_coverage_url = settings.TEST_CODE_COVERAGE_REPORT_URL code_coverage_time = datetime.datetime.fromtimestamp(os.path.getmtime(settings.TEST_CODE_COVERAGE_REPORT_FILE)) coverage = {} if os.path.exists(settings.TEST_COVERAGE_MASTER_FILE): if settings.TEST_COVERAGE_MASTER_FILE.endswith(".gz"): with gzip.open(settings.TEST_COVERAGE_MASTER_FILE, "rb") as file: coverage_data = json.load(file) else: with open(settings.TEST_COVERAGE_MASTER_FILE) as file: coverage_data = json.load(file) if version in coverage_data: coverage = coverage_data[version] for key in coverage: if "coverage" in coverage[key]: coverage[key]["percentage"] = coverage[key]["coverage"] * 100 return render_to_response('release/release.html', { 'releases': log_entries, 'version': version, 'entry': entries[version], 'coverage': coverage, 'code_coverage_url': code_coverage_url, 'code_coverage_time': code_coverage_time, }, context_instance=RequestContext(request))
def release(request, version=None): entries = {} if os.path.exists(settings.CHANGELOG_PATH): log_entries = changelog.parse(settings.CHANGELOG_PATH) else: return HttpResponse("Error: changelog file %s not found" % settings.CHANGELOG_PATH) next = None for entry in log_entries: if next: next.prev = entry entry.next = next next = entry entries = dict((entry.version, entry) for entry in log_entries) if version == None or version not in entries: version = log_entries[0].version entries[version].logentry = trac_links(entries[version].logentry) return render_to_response('release/release.html', { 'releases': log_entries, 'version': version, 'entry': entries[version], }, context_instance=RequestContext(request))
#!/usr/bin/python -B import sys import changelog print 'DOWNLOADS = \\' for release in changelog.parse(sys.stdin.read().decode('utf8')): for download in release.downloads: print ' releases/%s \\' % download print
</div> </content> </entry> </feed> ''') if __name__ == '__main__': from optparse import OptionParser parser = OptionParser('usage: %prog [options] beaker.spec', description=__doc__) parser.add_option('-f', '--format', type='choice', choices=['html', 'atom'], help='Output format [default: %default]') parser.set_defaults(format='html') options, args = parser.parse_args() if len(args) != 1: parser.error('Specify beaker.spec to parse') if args[0] == '-': f = sys.stdin else: f = open(args[0], 'r') releases = list(changelog.parse(f.read().decode('utf8'))) if options.format == 'html': stream = html_template.generate(**globals()) sys.stdout.write(stream.render('xhtml', doctype='html5')) elif options.format == 'atom': stream = atom_template.generate(**globals()) sys.stdout.write(stream.render('xml')) else: assert False