diff options
author | David Robillard <d@drobilla.net> | 2011-11-18 04:29:59 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-11-18 04:29:59 +0000 |
commit | 1d6dd704f914b56ece9c40752532b421acc5e59d (patch) | |
tree | c855e18fe615c761b53728fa86eb4c6d99455a0b /ext.wscript | |
parent | e68b060190de260dcc8822b5e69deaaad447ab69 (diff) | |
download | lv2-1d6dd704f914b56ece9c40752532b421acc5e59d.tar.xz |
Add generated NEWS file to distributions.
Don't install lv2extinfo files.
Diffstat (limited to 'ext.wscript')
-rw-r--r-- | ext.wscript | 53 |
1 files changed, 50 insertions, 3 deletions
diff --git a/ext.wscript b/ext.wscript index 82646c0..7a9908f 100644 --- a/ext.wscript +++ b/ext.wscript @@ -106,7 +106,7 @@ def build(bld): # Install bundle bld.install_files(bundle_dir, - bld.path.ant_glob('?*.*', excl='*.pc.in')) + bld.path.ant_glob('?*.*', excl='*.pc.in lv2extinfo.*')) # Install URI-like includes if bld.env['COPY_HEADERS']: @@ -116,6 +116,48 @@ def build(bld): bld.symlink_as(os.path.join(include_dir, info.NAME), os.path.relpath(bundle_dir, include_dir)) +def write_news(doap_file): + import rdflib + import textwrap + from time import strftime, strptime + + doap = rdflib.Namespace('http://usefulinc.com/ns/doap#') + dcs = rdflib.Namespace('http://ontologi.es/doap-changeset#') + rdfs = rdflib.Namespace('http://www.w3.org/2000/01/rdf-schema#') + foaf = rdflib.Namespace('http://xmlns.com/foaf/0.1/') + rdf = rdflib.Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#') + + m = rdflib.ConjunctiveGraph() + m.parse(doap_file, format='n3') + spec = m.value(None, rdf.type, doap.Project) + + entries = {} + for r in m.triples([spec, doap.release, None]): + release = r[2] + revision = m.value(release, doap.revision, None) or '9999' + date = m.value(release, doap.created, None) or '9999-01-01' + blamee = m.value(release, dcs.blame, None) + changeset = m.value(release, dcs.changeset, None) + + entry = '%s (%s) stable;\n' % (APPNAME, revision) + + if changeset: + for i in m.triples([changeset, dcs.item, None]): + entry += '\n * ' + '\n '.join( + textwrap.wrap(m.value(i[2], rdfs.label, None), width=79)) + + entry += '\n\n -- %s <%s> %s\n\n' % ( + m.value(blamee, foaf.name, None), + m.value(blamee, foaf.mbox, None).replace('mailto:', ''), + strftime('%a, %d %b %Y %H:%M:%S +0000', strptime(date, '%Y-%m-%d'))) + + entries[revision] = entry + + news = open('NEWS', 'w') + for e in sorted(entries.keys(), reverse=True): + news.write(entries[e]) + news.close() + class Dist(Scripting.Dist): fun = 'dist' cmd = 'dist' @@ -132,14 +174,19 @@ class Dist(Scripting.Dist): lv2extinfo_py.write("%s = %s\n" % (i, repr(info.__dict__[i]))) lv2extinfo_py.close() + # Write NEWS file + write_news(info.NAME + '-doap.ttl') + # Build distribution Scripting.Dist.archive(self) - # Delete lv2extinfo.py from source tree + # Delete generated files from source tree try: + os.remove('NEWS') os.remove('lv2extinfo.py') os.remove('lv2extinfo.pyc') - except: + except Exception as e: + print "error cleaning:", e pass class DistCheck(Dist, Scripting.DistCheck): |