From 5efc8a0f538fdc7d62e7846a2344b326c3344637 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 26 May 2011 22:55:49 +0000 Subject: Add automatic extension release generation script --- ext/event.lv2/waf | 1 - ext/event.lv2/wscript | 33 --------------------------- genreleases.py | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ wscript.template | 33 +++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 34 deletions(-) delete mode 120000 ext/event.lv2/waf delete mode 100644 ext/event.lv2/wscript create mode 100755 genreleases.py create mode 100644 wscript.template diff --git a/ext/event.lv2/waf b/ext/event.lv2/waf deleted file mode 120000 index 59a1ac9..0000000 --- a/ext/event.lv2/waf +++ /dev/null @@ -1 +0,0 @@ -../../waf \ No newline at end of file diff --git a/ext/event.lv2/wscript b/ext/event.lv2/wscript deleted file mode 100644 index 22d4cbe..0000000 --- a/ext/event.lv2/wscript +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python -from waflib.extras import autowaf as autowaf -import waflib.Logs as Logs - -# Variables for 'waf dist' -APPNAME = 'lv2-event' -VERSION = '1.2' - -# Mandatory variables -top = '.' -out = 'build' - -def options(opt): - autowaf.set_options(opt) - -def configure(conf): - autowaf.configure(conf) - autowaf.display_msg(conf, "LV2 bundle directory", - conf.env['LV2DIR']) - print('') - -def build(bld): - bld.install_files('${LV2DIR}/event.lv2', - 'event.ttl event.h event-helpers.h manifest.ttl') - - bld.add_post_fun(warn_lv2config) - -def warn_lv2config(ctx): - if ctx.cmd == 'install': - Logs.warn(''' -* LV2 Extension Installed -* You need to run lv2config to update extension headers -''') diff --git a/genreleases.py b/genreleases.py new file mode 100755 index 0000000..3e75a3e --- /dev/null +++ b/genreleases.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import RDF +import glob +import os +import re +import shutil +import sys + +lv2 = RDF.NS('http://lv2plug.in/ns/lv2core#') + +manifests = glob.glob('ext/*.lv2/manifest.ttl') + +try: + os.mkdir('build') + os.mkdir('spec') +except: + pass + +for i in manifests: + match = re.search('.*/([^/]*).lv2/.*', i) + name = match.group(1) + + match = re.search('(.*)/.*', i) + dir = match.group(1) + + m = RDF.Model() + p = RDF.Parser(name="turtle") + p.parse_into_model(m, 'file:' + i) + + s = m.find_statements(RDF.Statement(None, lv2.minorVersion, None)) + if not s.current(): + #print("No minor version found for %s\n" % i) + continue + minor = s.current().object.literal_value['string'] + + s = m.find_statements(RDF.Statement(None, lv2.microVersion, None)) + if not s.current(): + #print("No micro version found for %s\n" % i) + continue + micro = s.current().object.literal_value['string'] + + if int(minor) != 0 and int(micro) % 2 == 0: + print('Packaging %s extension version %s.%s' % (name, minor, micro)) + wscript_template = open('wscript.template') + wscript = open('%s/wscript' % dir, 'w') + for l in wscript_template: + wscript.write(l.replace( + '@NAME@', name).replace( + '@MINOR@', minor).replace( + '@MICRO@', micro)) + wscript_template.close() + wscript.close() + try: + os.remove('%s/waf' % dir) + except: + pass + os.symlink('../../waf', '%s/waf' % dir) + + os.system('tar --exclude=".*" -cjhf build/spec/lv2-%s-%s.%s.tar.bz2 %s' % ( + name, minor, micro, dir)) + diff --git a/wscript.template b/wscript.template new file mode 100644 index 0000000..b2e5912 --- /dev/null +++ b/wscript.template @@ -0,0 +1,33 @@ +#!/usr/bin/env python +from waflib.extras import autowaf as autowaf +import waflib.Logs as Logs + +# Variables for 'waf dist' +APPNAME = 'lv2-@NAME@' +VERSION = '@MINOR@.@MICRO@' + +# Mandatory variables +top = '.' +out = 'build' + +def options(opt): + autowaf.set_options(opt) + +def configure(conf): + autowaf.configure(conf) + autowaf.display_msg(conf, "LV2 bundle directory", + conf.env['LV2DIR']) + print('') + +def build(bld): + bld.install_files('${LV2DIR}/@NAME@.lv2', + bld.path.ant_glob('*.*')) + + bld.add_post_fun(warn_lv2config) + +def warn_lv2config(ctx): + if ctx.cmd == 'install': + Logs.warn(''' +* LV2 Extension Installed +* You need to run lv2config to update extension headers +''') -- cgit v1.2.1