summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/ingen.py122
-rwxr-xr-xscripts/ingenams45
-rwxr-xr-xscripts/ingenish14
-rw-r--r--src/client/wscript2
-rw-r--r--src/gui/wscript5
-rw-r--r--src/server/wscript86
-rw-r--r--src/wscript30
-rw-r--r--wscript118
8 files changed, 224 insertions, 198 deletions
diff --git a/scripts/ingen.py b/scripts/ingen.py
index 6f9b5ed5..d56d7e0b 100644
--- a/scripts/ingen.py
+++ b/scripts/ingen.py
@@ -25,6 +25,7 @@ try:
except ImportError:
from io import StringIO as StringIO
+
class NS:
atom = rdflib.Namespace('http://lv2plug.in/ns/ext/atom#')
ingen = rdflib.Namespace('http://drobilla.net/ns/ingen#')
@@ -35,6 +36,7 @@ class NS:
rsz = rdflib.Namespace('http://lv2plug.in/ns/ext/resize-port#')
xsd = rdflib.Namespace('http://www.w3.org/2001/XMLSchema#')
+
class Interface:
'The core Ingen interface'
def put(self, subject, body):
@@ -58,10 +60,12 @@ class Interface:
def delete(self, subject):
pass
+
class Error(Exception):
def __init__(self, msg, cause):
Exception.__init__(self, '%s; cause: %s' % (msg, cause))
+
def lv2_path():
path = os.getenv('LV2_PATH')
if path:
@@ -77,13 +81,14 @@ def lv2_path():
'/boot/common/add-ons/lv2'])
elif sys.platform == 'win32':
return os.pathsep.join([
- os.path.join(os.getenv('APPDATA'), 'LV2'),
- os.path.join(os.getenv('COMMONPROGRAMFILES'), 'LV2')])
+ os.path.join(os.getenv('APPDATA'), 'LV2'),
+ os.path.join(os.getenv('COMMONPROGRAMFILES'), 'LV2')])
else:
return os.pathsep.join(['~/.lv2',
'/usr/lib/lv2',
'/usr/local/lib/lv2'])
+
def ingen_bundle_path():
for d in lv2_path().split(os.pathsep):
bundle = os.path.abspath(os.path.join(d, 'ingen.lv2'))
@@ -91,6 +96,7 @@ def ingen_bundle_path():
return bundle
return None
+
class Remote(Interface):
def __init__(self, uri='unix:///tmp/ingen.sock'):
self.msg_id = 1
@@ -137,15 +143,13 @@ class Remote(Interface):
put = i[0]
subject = update.value(put, NS.patch.subject, None)
body = update.value(put, NS.patch.body, None)
- desc = {}
for i in update.triples([body, None, None]):
self.model.add([subject, i[1], i[2]])
return update
def uri_to_path(self, uri):
- path = uri
if uri.startswith(self.server_base):
- return uri[len(self.server_base)-1:]
+ return uri[len(self.server_base) - 1:]
return uri
def recv(self):
@@ -184,10 +188,10 @@ class Remote(Interface):
raise Error(fmt, cause)
def send(self, msg):
+ if type(msg) == list:
+ msg = '\n'.join(msg)
+
# Send message to server
- payload = msg
- if sys.version_info[0] == 3:
- payload = bytes(msg, 'utf-8')
self.sock.send(self.msgencode(msg))
# Receive response and parse into a model
@@ -203,18 +207,17 @@ class Remote(Interface):
# Add new prefixes to prepend to future responses because rdflib sucks
for line in response_str.split('\n'):
if line.startswith('@prefix'):
- match = re.search('@prefix ([^:]*): <(.*)> *\.', line)
+ match = re.search('@prefix ([^:]*): <(.*)> *\\.', line)
if match:
name = match.group(1)
uri = match.group(2)
- self.ns_manager.bind(match.group(1), match.group(2))
+ self.ns_manager.bind(name, uri)
# Handle response (though there should be only one)
blanks = []
response_desc = []
for i in response_model.triples([None, NS.rdf.type, NS.patch.Response]):
response = i[0]
- subject = response_model.value(response, NS.patch.subject, None)
body = response_model.value(response, NS.patch.body, None)
response_desc += [i]
@@ -240,70 +243,57 @@ class Remote(Interface):
return self.update_model(response_model)
def get(self, subject):
- return self.send('''
-[]
- a patch:Get ;
- patch:subject <%s> .
-''' % subject)
+ return self.send(['[]',
+ ' a patch:Get ;',
+ ' patch:subject <%s> .' % subject])
def put(self, subject, body):
- return self.send('''
-[]
- a patch:Put ;
- patch:subject <%s> ;
- patch:body [
-%s
- ] .
-''' % (subject, body))
+ return self.send(['[]',
+ ' a patch:Put ;',
+ ' patch:subject <%s> ;' % subject,
+ ' patch:body [',
+ ' ' + body,
+ ' ] .'])
def patch(self, subject, remove, add):
- return self.send('''
-[]
- a patch:Patch ;
- patch:subject <%s> ;
- patch:remove [
-%s
- ] ;
- patch:add [
-%s
- ] .
-''' % (subject, remove, add))
+ return self.send(['[]',
+ ' a patch:Patch ;',
+ ' patch:subject <%s> ;' % subject,
+ ' patch:remove [',
+ remove,
+ ' ] ;',
+ ' patch:add [',
+ add,
+ ' ] .'])
def set(self, subject, key, value):
- return self.send('''
-[]
- a patch:Set ;
- patch:subject <%s> ;
- patch:property <%s> ;
- patch:value %s .
-''' % (subject, key, value))
+ return self.send(['[]',
+ ' a patch:Set ;',
+ ' patch:subject <%s> ;' % subject,
+ ' patch:property <%s> ;' % key,
+ ' patch:value %s .' % value])
def connect(self, tail, head):
- return self.send('''
-[]
- a patch:Put ;
- patch:subject <%s> ;
- patch:body [
- a ingen:Arc ;
- ingen:tail <%s> ;
- ingen:head <%s> ;
- ] .
-''' % (os.path.commonprefix([tail, head]), tail, head))
+ subject = os.path.commonprefix([tail, head])
+ return self.send(['[]',
+ ' a patch:Put ;',
+ ' patch:subject <%s> ;' % subject,
+ ' patch:body [',
+ ' a ingen:Arc ;',
+ ' ingen:tail <%s> ;' % tail,
+ ' ingen:head <%s> ;' % head,
+ ' ] .'])
def disconnect(self, tail, head):
- return self.send('''
-[]
- a patch:Delete ;
- patch:body [
- a ingen:Arc ;
- ingen:tail <%s> ;
- ingen:head <%s> ;
- ] .
-''' % (tail, head))
+ return self.send(['[]',
+ ' a patch:Delete ;',
+ ' patch:body [',
+ ' a ingen:Arc ;',
+ ' ingen:tail <%s> ;' % tail,
+ ' ingen:head <%s> ;' % head,
+ ' ] .'])
def delete(self, subject):
- return self.send('''
-[]
- a patch:Delete ;
- patch:subject <%s> .
-''' % subject)
+ return self.send(['[]',
+ ' a patch:Delete ;',
+ ' patch:subject <%s> .' % subject])
diff --git a/scripts/ingenams b/scripts/ingenams
index a183586a..a88f96d0 100755
--- a/scripts/ingenams
+++ b/scripts/ingenams
@@ -23,6 +23,7 @@ ams_prefix = 'http://github.com/blablack/ams-lv2/'
fomp_prefix = 'http://drobilla.net/plugins/fomp/'
note_uri = 'http://drobilla.net/ns/ingen-internals#Note'
+
class World:
def __init__(self, server_uri):
self.server_uri = server_uri
@@ -37,10 +38,10 @@ class World:
def add_block(self, mod_id, plugin_uri, x, y):
self.mod_prototypes[self.mod_sym(mod_id)] = plugin_uri
self.server.put('/' + self.mod_sym(mod_id),
- ('\t\ta ingen:Block ;\n'
- + 'lv2:prototype <%s> ;\n' % plugin_uri
- + 'ingen:canvasX %f ;\n' % x
- + 'ingen:canvasY %f' % y).replace('\n', '\n\t\t'))
+ ('\t\ta ingen:Block ;\n' +
+ 'lv2:prototype <%s> ;\n' % plugin_uri +
+ 'ingen:canvasX %f ;\n' % x +
+ 'ingen:canvasY %f' % y).replace('\n', '\n\t\t'))
def add_arc(self,
head_port_id, tail_port_id,
@@ -84,7 +85,7 @@ class World:
port_index = int(port_id)
if world.mod_prototypes[self.mod_sym(mod_id)] == note_uri:
# Adapt MCV/ADVMCV port index to Note port index
- port_mapping = [ 3, 0, 2, 4, 6, 5, -1, -1, -1, -1 ]
+ port_mapping = [3, 0, 2, 4, 6, 5, -1, -1, -1, -1]
port_index = port_mapping[port_index]
if port_index == -1:
sys.stderr.write('warning: unsupported MCV port %d\n' % int(port_id))
@@ -107,9 +108,10 @@ class World:
if tail and head:
self.server.connect(self.server.uri_to_path(tail),
self.server.uri_to_path(head))
- except:
+ except Exception:
pass
+
# Static enumeration of special module type IDs
class Special:
CUSTOM = 0
@@ -119,17 +121,18 @@ class Special:
SCQUANTIZER = 31
ADVMCV = 35
+
# Module types list, indexed by numeric ID in file
# Except where otherwise commented, these correspond to internal modules,
# and the string is the suffix of the corresponding AMS LV2 plugin URI
module_types = [
- "custom", # 0 = custom (unsupported)
+ "custom", # 0 = custom (unsupported)
"vco",
"vca",
"lfo",
"delay",
"ringmod",
- "ladspa", # 6 = LADSPA plugin
+ "ladspa", # 6 = LADSPA plugin
"pcmout",
"mix",
"vcf",
@@ -153,8 +156,8 @@ module_types = [
"jackin",
"jackout",
"midiout",
- "scmcv", # Scala module (different line format)
- "scquantizer", # Scala module (different line format)
+ "scmcv", # Scala module (different line format)
+ "scquantizer", # Scala module (different line format)
"stereomix",
"conv",
"vcenv",
@@ -171,6 +174,7 @@ module_types = [
"vco2"
]
+
class Module:
def __init__(self, num, plugin_uri, properties={}):
self.num = num
@@ -178,10 +182,12 @@ class Module:
self.properties = properties
self.ports = []
+
class Patch:
def __init__(self):
self.modules = []
+
def ladspa_module(world, mod_id, x, y, poly, lib, label):
lv2_uri = ''
# Kludge LADSPA library and label to LV2 URIs where applicable
@@ -197,8 +203,10 @@ def ladspa_module(world, mod_id, x, y, poly, lib, label):
else:
print('MOD %3d LADSPA %s %s %s' % (mod_id, poly, lib, label))
+
def scala_module(world, mod_id, scala_name):
- sys.stderr.write('warning: scala module %3d (%s) unsupported\n' % (d, scala_name))
+ sys.stderr.write('warning: scala module %3d (%s) unsupported\n' % (mod_id, scala_name))
+
def standard_module(world, mod_id, x, y, name, arg):
if name == 'vca':
@@ -212,15 +220,18 @@ def standard_module(world, mod_id, x, y, name, arg):
lv2_uri = ams_prefix + name
world.add_block(mod_id, lv2_uri, x, y)
+
def float_control(world, mod_id, port_index, value,
logarithmic, minimum, maximum, midi_sign):
- #print('FLOAT CONTROL %s:%s = %s' % (mod_id, port_index, value))
+ # print('FLOAT CONTROL %s:%s = %s' % (mod_id, port_index, value))
pass
+
def control(world, mod_id, port_index, value, midi_sign):
- #print('CONTROL %s:%s = %s' % (mod_id, port_index, value))
+ # print('CONTROL %s:%s = %s' % (mod_id, port_index, value))
pass
+
if len(sys.argv) != 2 and len(sys.argv) != 3:
sys.stderr.write('Usage: %s AMS_PATCH_FILE [SERVER_URI]\n' % sys.argv[0])
sys.exit(1)
@@ -267,10 +278,10 @@ for l in in_file:
(expr[8], expr[9], expr[10]))
elif expr[0] == 'FSlider':
float_control(world, mod_id,
- expr[2], expr[3], expr[4], expr[5], expr[6], expr[7])
+ expr[2], expr[3], expr[4], expr[5], expr[6], expr[7])
elif expr[0] == 'ISlider' or expr[0] == 'LSlider':
- control(world, mod_id, expr[2], expr[3], expr[4])
- #else:
+ control(world, mod_id, expr[2], expr[3], expr[4])
+ # else:
# sys.stderr.write('warning: unsupported form %s\n' % expr[0])
except ingen.Error:
e = sys.exc_info()[1]
@@ -278,6 +289,6 @@ for l in in_file:
world.create_arcs()
-#print(world.server.model.serialize(format='n3'))
+# print(world.server.model.serialize(format='n3'))
in_file.close()
diff --git a/scripts/ingenish b/scripts/ingenish
index ee53c4a5..4fac6307 100755
--- a/scripts/ingenish
+++ b/scripts/ingenish
@@ -15,15 +15,8 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import ingen
-import os.path
-import re
import shlex
import sys
-import time
-try:
- import readline
-except:
- pass
# Python 2 compatibility
try:
@@ -31,6 +24,7 @@ try:
except NameError:
pass
+
def print_usage():
print('''Usage: ingenish [OPTION]... [COMMAND [ARGUMENT]...]
@@ -70,6 +64,7 @@ Example:
set /main/tone/output ingen:value 0.7
''')
+
def run(cmd):
if cmd[0] == 'help':
print_usage()
@@ -91,6 +86,7 @@ def run(cmd):
return ingen.delete(cmd[1])
return False
+
a = 1
server = 'unix:///tmp/ingen.sock'
if len(sys.argv) > 1:
@@ -110,12 +106,12 @@ if len(sys.argv) - a == 0:
run(shlex.split(input('> ')))
except (EOFError, KeyboardInterrupt, SystemExit):
break
- except:
+ except Exception:
print('error: %s' % sys.exc_info()[1])
else:
try:
update = run(sys.argv[a:])
if update:
print(update.serialize(format='n3'))
- except:
+ except Exception:
print('error: %s' % sys.exc_info()[1])
diff --git a/src/client/wscript b/src/client/wscript
index 805d8c86..394c9e4d 100644
--- a/src/client/wscript
+++ b/src/client/wscript
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from waflib.extras import autowaf as autowaf
+
def build(bld):
obj = bld(features = 'cxx cxxshlib',
diff --git a/src/gui/wscript b/src/gui/wscript
index a483f5a4..b33bd31e 100644
--- a/src/gui/wscript
+++ b/src/gui/wscript
@@ -1,13 +1,15 @@
#!/usr/bin/env python
-import waflib.extras.autowaf as autowaf
+
import waflib.Utils as Utils
import waflib.Options as Options
+
def options(ctx):
opt = ctx.configuration_options()
opt.add_option('--light-theme', action='store_true', dest='light_theme',
help='use light coloured theme')
+
def configure(conf):
conf.check_pkg('glibmm-2.4 >= 2.14.0',
uselib_store='GLIBMM',
@@ -36,6 +38,7 @@ def configure(conf):
if Options.options.light_theme:
conf.define('INGEN_USE_LIGHT_THEME', 1)
+
def build(bld):
obj = bld(features = 'cxx cxxshlib',
cflags = ['-fvisibility=hidden'],
diff --git a/src/server/wscript b/src/server/wscript
index f01c6e0b..00588915 100644
--- a/src/server/wscript
+++ b/src/server/wscript
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from waflib.extras import autowaf as autowaf
+
def build(bld):
core_source = '''
@@ -55,52 +55,52 @@ def build(bld):
core_libs = 'LV2 LILV RAUL SERD SORD SRATOM'
- obj = bld(features = 'cxx cxxshlib',
- source = core_source,
- export_includes = ['../..'],
- includes = ['.', '../..'],
- name = 'libingen_server',
- target = 'ingen_server',
- install_path = '${LIBDIR}',
- use = 'libingen libingen_socket',
- uselib = core_libs,
- cxxflags = bld.env.PTHREAD_CFLAGS + bld.env.INGEN_TEST_CXXFLAGS,
- linkflags = bld.env.PTHREAD_LINKFLAGS + bld.env.INGEN_TEST_LINKFLAGS)
+ bld(features = 'cxx cxxshlib',
+ source = core_source,
+ export_includes = ['../..'],
+ includes = ['.', '../..'],
+ name = 'libingen_server',
+ target = 'ingen_server',
+ install_path = '${LIBDIR}',
+ use = 'libingen libingen_socket',
+ uselib = core_libs,
+ cxxflags = bld.env.PTHREAD_CFLAGS + bld.env.INGEN_TEST_CXXFLAGS,
+ linkflags = bld.env.PTHREAD_LINKFLAGS + bld.env.INGEN_TEST_LINKFLAGS)
if bld.env.HAVE_JACK:
- obj = bld(features = 'cxx cxxshlib',
- source = 'JackDriver.cpp ingen_jack.cpp',
- includes = ['.', '../..'],
- name = 'libingen_jack',
- target = 'ingen_jack',
- install_path = '${LIBDIR}',
- use = 'libingen_server',
- uselib = core_libs + ' JACK',
- cxxflags = ['-fvisibility=hidden'] + bld.env.PTHREAD_CFLAGS,
- linkflags = bld.env.PTHREAD_LINKFLAGS)
+ bld(features = 'cxx cxxshlib',
+ source = 'JackDriver.cpp ingen_jack.cpp',
+ includes = ['.', '../..'],
+ name = 'libingen_jack',
+ target = 'ingen_jack',
+ install_path = '${LIBDIR}',
+ use = 'libingen_server',
+ uselib = core_libs + ' JACK',
+ cxxflags = ['-fvisibility=hidden'] + bld.env.PTHREAD_CFLAGS,
+ linkflags = bld.env.PTHREAD_LINKFLAGS)
if bld.env.HAVE_PORTAUDIO:
- obj = bld(features = 'cxx cxxshlib',
- source = 'PortAudioDriver.cpp ingen_portaudio.cpp',
- includes = ['.', '../..'],
- name = 'libingen_portaudio',
- target = 'ingen_portaudio',
- install_path = '${LIBDIR}',
- use = 'libingen_server',
- uselib = core_libs + ' PORTAUDIO',
- cxxflags = ['-fvisibility=hidden'] + bld.env.PTHREAD_CFLAGS,
- linkflags = bld.env.PTHREAD_LINKFLAGS)
+ bld(features = 'cxx cxxshlib',
+ source = 'PortAudioDriver.cpp ingen_portaudio.cpp',
+ includes = ['.', '../..'],
+ name = 'libingen_portaudio',
+ target = 'ingen_portaudio',
+ install_path = '${LIBDIR}',
+ use = 'libingen_server',
+ uselib = core_libs + ' PORTAUDIO',
+ cxxflags = ['-fvisibility=hidden'] + bld.env.PTHREAD_CFLAGS,
+ linkflags = bld.env.PTHREAD_LINKFLAGS)
# Ingen LV2 wrapper
if bld.env.INGEN_BUILD_LV2:
- obj = bld(features = 'cxx cxxshlib',
- source = ' ingen_lv2.cpp ',
- cflags = ['-fvisibility=hidden'],
- includes = ['.', '../..'],
- name = 'libingen_lv2',
- target = 'ingen_lv2',
- install_path = '${LV2DIR}/ingen.lv2/',
- use = 'libingen libingen_server',
- uselib = core_libs,
- cxxflags = ['-fvisibility=hidden'] + bld.env.PTHREAD_CFLAGS,
- linkflags = bld.env.PTHREAD_LINKFLAGS)
+ bld(features = 'cxx cxxshlib',
+ source = ' ingen_lv2.cpp ',
+ cflags = ['-fvisibility=hidden'],
+ includes = ['.', '../..'],
+ name = 'libingen_lv2',
+ target = 'ingen_lv2',
+ install_path = '${LV2DIR}/ingen.lv2/',
+ use = 'libingen libingen_server',
+ uselib = core_libs,
+ cxxflags = ['-fvisibility=hidden'] + bld.env.PTHREAD_CFLAGS,
+ linkflags = bld.env.PTHREAD_LINKFLAGS)
diff --git a/src/wscript b/src/wscript
index ee4311e1..72c7d48c 100644
--- a/src/wscript
+++ b/src/wscript
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from waflib.extras import autowaf as autowaf
+
def build(bld):
sources = [
@@ -26,22 +26,22 @@ def build(bld):
'runtime_paths.cpp'
]
if bld.is_defined('HAVE_SOCKET'):
- sources += [ 'SocketReader.cpp', 'SocketWriter.cpp' ]
+ sources += ['SocketReader.cpp', 'SocketWriter.cpp']
lib = []
if bld.is_defined('HAVE_LIBDL'):
lib += ['dl']
- obj = bld(features = 'cxx cxxshlib',
- source = sources,
- export_includes = ['..'],
- includes = ['..'],
- name = 'libingen',
- target = 'ingen-%s' % bld.env.INGEN_MAJOR_VERSION,
- vnum = bld.env.INGEN_VERSION,
- install_path = '${LIBDIR}',
- lib = lib,
- uselib = 'LV2 LILV RAUL SERD SORD SRATOM',
- cxxflags = (['-fvisibility=hidden'] +
- bld.env.PTHREAD_CFLAGS + bld.env.INGEN_TEST_CXXFLAGS),
- linkflags = bld.env.PTHREAD_LINKFLAGS + bld.env.INGEN_TEST_LINKFLAGS)
+ bld(features = 'cxx cxxshlib',
+ source = sources,
+ export_includes = ['..'],
+ includes = ['..'],
+ name = 'libingen',
+ target = 'ingen-%s' % bld.env.INGEN_MAJOR_VERSION,
+ vnum = bld.env.INGEN_VERSION,
+ install_path = '${LIBDIR}',
+ lib = lib,
+ uselib = 'LV2 LILV RAUL SERD SORD SRATOM',
+ cxxflags = (['-fvisibility=hidden'] +
+ bld.env.PTHREAD_CFLAGS + bld.env.INGEN_TEST_CXXFLAGS),
+ linkflags = bld.env.PTHREAD_LINKFLAGS + bld.env.INGEN_TEST_LINKFLAGS)
diff --git a/wscript b/wscript
index 1c4d46df..b27424c6 100644
--- a/wscript
+++ b/wscript
@@ -1,7 +1,6 @@
#!/usr/bin/env python
import os
-import subprocess
from waflib import Logs, Options, Utils
from waflib.extras import autowaf
@@ -18,6 +17,7 @@ out = 'build' # Build directory
line_just = 47
+
def options(ctx):
ctx.load('compiler_cxx')
ctx.load('python')
@@ -32,16 +32,17 @@ def options(ctx):
ctx.add_flags(
opt,
- {'no-gui': 'do not build GUI',
- 'no-client': 'do not build client library (or GUI)',
- 'no-jack': 'do not build jack backend (for ingen.lv2 only)',
- 'no-plugin': 'do not build ingen.lv2 plugin',
- 'no-python': 'do not install Python bindings',
- 'no-webkit': 'do not use webkit to display plugin documentation',
+ {'no-gui': 'do not build GUI',
+ 'no-client': 'do not build client library (or GUI)',
+ 'no-jack': 'do not build jack backend (for ingen.lv2 only)',
+ 'no-plugin': 'do not build ingen.lv2 plugin',
+ 'no-python': 'do not install Python bindings',
+ 'no-webkit': 'do not use webkit to display plugin documentation',
'no-jack-session': 'do not build JACK session support',
- 'no-socket': 'do not build Socket interface',
- 'debug-urids': 'print a trace of URI mapping',
- 'portaudio': 'build PortAudio backend'})
+ 'no-socket': 'do not build Socket interface',
+ 'debug-urids': 'print a trace of URI mapping',
+ 'portaudio': 'build PortAudio backend'})
+
def configure(conf):
conf.load('compiler_cxx', cache=True)
@@ -73,19 +74,19 @@ def configure(conf):
conf.check_pkg('portaudio-2.0', uselib_store='PORTAUDIO', mandatory=False)
conf.check_pkg('sigc++-2.0', uselib_store='SIGCPP', mandatory=False)
- conf.check_function('cxx', 'posix_memalign',
+ conf.check_function('cxx', 'posix_memalign',
defines = '_POSIX_C_SOURCE=200809L',
header_name = 'stdlib.h',
define_name = 'HAVE_POSIX_MEMALIGN',
mandatory = False)
- conf.check_function('cxx', 'isatty',
+ conf.check_function('cxx', 'isatty',
header_name = 'unistd.h',
defines = '_POSIX_C_SOURCE=200809L',
define_name = 'HAVE_ISATTY',
mandatory = False)
- conf.check_function('cxx', 'vasprintf',
+ conf.check_function('cxx', 'vasprintf',
header_name = 'stdio.h',
defines = '_GNU_SOURCE=1',
define_name = 'HAVE_VASPRINTF',
@@ -96,25 +97,25 @@ def configure(conf):
mandatory = False)
if not Options.options.no_socket:
- conf.check_function('cxx', 'socket',
+ conf.check_function('cxx', 'socket',
header_name = 'sys/socket.h',
define_name = 'HAVE_SOCKET',
mandatory = False)
if not Options.options.no_python:
- conf.check_python_version((2,4,0), mandatory=False)
+ conf.check_python_version((2, 4, 0), mandatory=False)
if not Options.options.no_plugin:
conf.env.INGEN_BUILD_LV2 = 1
if not Options.options.no_jack:
conf.check_pkg('jack >= 0.120.0', uselib_store='JACK', mandatory=False)
- conf.check_function('cxx', 'jack_set_property',
+ conf.check_function('cxx', 'jack_set_property',
header_name = 'jack/metadata.h',
define_name = 'HAVE_JACK_METADATA',
uselib = 'JACK',
mandatory = False)
- conf.check_function('cxx', 'jack_port_rename',
+ conf.check_function('cxx', 'jack_port_rename',
header_name = 'jack/jack.h',
define_name = 'HAVE_JACK_PORT_RENAME',
uselib = 'JACK',
@@ -142,7 +143,7 @@ def configure(conf):
if conf.check(linkflags=['-lpthread'], mandatory=False):
conf.env.PTHREAD_LINKFLAGS += ['-lpthread']
- conf.define('INGEN_SHARED', 1);
+ conf.define('INGEN_SHARED', 1)
conf.define('INGEN_VERSION', INGEN_VERSION)
if conf.env.HAVE_SIGCPP and not Options.options.no_client:
@@ -170,22 +171,24 @@ def configure(conf):
autowaf.display_summary(
conf,
- {'GUI': bool(conf.env.INGEN_BUILD_GUI),
+ {'GUI': bool(conf.env.INGEN_BUILD_GUI),
'HTML plugin doc support': bool(conf.env.HAVE_WEBKIT),
- 'PortAudio driver': bool(conf.env.HAVE_PORTAUDIO),
- 'Jack driver': bool(conf.env.HAVE_JACK),
- 'Jack session support': conf.is_defined('INGEN_JACK_SESSION'),
- 'Jack metadata support': conf.is_defined('HAVE_JACK_METADATA'),
- 'LV2 plugin driver': bool(conf.env.INGEN_BUILD_LV2),
- 'LV2 bundle': conf.env.INGEN_BUNDLE_DIR,
- 'LV2 plugin support': bool(conf.env.HAVE_LILV),
- 'Socket interface': conf.is_defined('HAVE_SOCKET')})
+ 'PortAudio driver': bool(conf.env.HAVE_PORTAUDIO),
+ 'Jack driver': bool(conf.env.HAVE_JACK),
+ 'Jack session support': conf.is_defined('INGEN_JACK_SESSION'),
+ 'Jack metadata support': conf.is_defined('HAVE_JACK_METADATA'),
+ 'LV2 plugin driver': bool(conf.env.INGEN_BUILD_LV2),
+ 'LV2 bundle': conf.env.INGEN_BUNDLE_DIR,
+ 'LV2 plugin support': bool(conf.env.HAVE_LILV),
+ 'Socket interface': conf.is_defined('HAVE_SOCKET')})
+
unit_tests = ['tst_FilePath']
+
def build(bld):
opts = Options.options
- opts.datadir = opts.datadir or bld.env.PREFIX + 'share'
+ opts.datadir = opts.datadir or bld.env.PREFIX + 'share'
opts.moduledir = opts.moduledir or bld.env.PREFIX + 'lib/ingen'
# Headers
@@ -208,26 +211,26 @@ def build(bld):
bld.recurse('src/gui')
# Program
- obj = bld(features = 'c cxx cxxprogram',
- source = 'src/ingen/ingen.cpp',
- target = 'ingen',
- includes = ['.'],
- use = 'libingen',
- uselib = 'SERD SORD SRATOM RAUL LILV LV2',
- install_path = '${BINDIR}')
+ bld(features = 'c cxx cxxprogram',
+ source = 'src/ingen/ingen.cpp',
+ target = 'ingen',
+ includes = ['.'],
+ use = 'libingen',
+ uselib = 'SERD SORD SRATOM RAUL LILV LV2',
+ install_path = '${BINDIR}')
# Test program
if bld.env.BUILD_TESTS:
for i in ['ingen_test', 'ingen_bench'] + unit_tests:
- obj = bld(features = 'cxx cxxprogram',
- source = 'tests/%s.cpp' % i,
- target = 'tests/%s' % i,
- includes = ['.'],
- use = 'libingen',
- uselib = 'SERD SORD SRATOM RAUL LILV LV2',
- install_path = '',
- cxxflags = bld.env.INGEN_TEST_CXXFLAGS,
- linkflags = bld.env.INGEN_TEST_LINKFLAGS)
+ bld(features = 'cxx cxxprogram',
+ source = 'tests/%s.cpp' % i,
+ target = 'tests/%s' % i,
+ includes = ['.'],
+ use = 'libingen',
+ uselib = 'SERD SORD SRATOM RAUL LILV LV2',
+ install_path = '',
+ cxxflags = bld.env.INGEN_TEST_CXXFLAGS,
+ linkflags = bld.env.INGEN_TEST_LINKFLAGS)
bld.install_files('${DATADIR}/applications', 'src/ingen/ingen.desktop')
bld.install_files('${BINDIR}', 'scripts/ingenish', chmod=Utils.O755)
@@ -270,9 +273,29 @@ def build(bld):
bld.add_post_fun(autowaf.run_ldconfig)
+
def lint(ctx):
"checks code for style issues"
import subprocess
+
+ status = 0
+
+ # Check Python style with flake8
+ try:
+ for i in ["src/client/wscript",
+ "src/gui/wscript",
+ "src/server/wscript",
+ "src/wscript",
+ "scripts/ingen.py",
+ "scripts/ingenish",
+ "scripts/ingenams",
+ "wscript"]:
+ status += subprocess.call(["flake8",
+ "--ignore", "E221,W504,E251,E501",
+ i])
+ except Exception:
+ Logs.warn('warning: Failed to call flake8')
+
cmd = ("clang-tidy -p=. -header-filter=ingen/ -checks=\"*," +
"-clang-analyzer-alpha.*," +
"-cppcoreguidelines-*," +
@@ -290,9 +313,11 @@ def lint(ctx):
"$(find .. -name '*.cpp')")
subprocess.call(cmd, cwd='build', shell=True)
-def upload_docs(ctx):
- import shutil
+ if status != 0:
+ ctx.fatal("Lint checks failed")
+
+def upload_docs(ctx):
# Ontology documentation
os.system('rsync -avz -e ssh bundles/ingen.lv2/ingen.ttl drobilla@drobilla.net:~/drobilla.net/ns/')
os.system('rsync -avz -e ssh build/ingen.lv2/ingen.html drobilla@drobilla.net:~/drobilla.net/ns/')
@@ -301,6 +326,7 @@ def upload_docs(ctx):
# Doxygen documentation
os.system('rsync -ravz --delete -e ssh build/doc/html/* drobilla@drobilla.net:~/drobilla.net/docs/ingen/')
+
def test(tst):
with tst.group('unit') as check:
for i in unit_tests: