aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlv2include/lv2include.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/lv2include/lv2include.py b/lv2include/lv2include.py
index 8786411..f4b9b3c 100755
--- a/lv2include/lv2include.py
+++ b/lv2include/lv2include.py
@@ -34,8 +34,20 @@ import sys
import RDF
-rdf = RDF.NS('http://www.w3.org/1999/02/22-rdf-syntax-ns#')
-lv2 = RDF.NS('http://lv2plug.in/ns/lv2core#')
+def rdf_load(uri):
+ model = RDF.Model()
+ parser = RDF.Parser(name="guess")
+ parser.parse_into_model(model, uri)
+ return model
+
+def rdf_find(model, s, p, o):
+ return model.find_statements(RDF.Statement(s, p, o))
+
+def rdf_namespace(uri):
+ return RDF.NS(uri)
+
+rdf = rdf_namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')
+lv2 = rdf_namespace('http://lv2plug.in/ns/lv2core#')
def lv2_path():
"Return the LV2 search path (LV2_PATH in the environment, or a default)."
@@ -81,12 +93,10 @@ def build_tree(search_path, outdir):
the extension URIs."""
for bundle in __bundles(search_path):
# Load manifest into model
- manifest = RDF.Model()
- parser = RDF.Parser(name="guess")
- parser.parse_into_model(manifest, 'file://' + os.path.join(bundle, 'manifest.ttl'))
+ manifest = rdf_load('file://' + os.path.join(bundle, 'manifest.ttl'))
# Query extension URI
- results = manifest.find_statements(RDF.Statement(None, rdf.type, lv2.Specification))
+ results = rdf_find(manifest, None, rdf.type, lv2.Specification)
for r in results:
ext_uri = str(r.subject.uri)
ext_scheme = ext_uri[0:ext_uri.find(':')]
' href='#n159'>159 160 161 162 163 164 165 166 167 168