diff options
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/python/lilv.py | 9 | ||||
-rw-r--r-- | bindings/test/python/test_api.py | 9 |
2 files changed, 13 insertions, 5 deletions
diff --git a/bindings/python/lilv.py b/bindings/python/lilv.py index e4e9f6a..70fb79f 100644 --- a/bindings/python/lilv.py +++ b/bindings/python/lilv.py @@ -8,6 +8,8 @@ __maintainer__ = "David Robillard" __email__ = "d@drobilla.net" __status__ = "Production" +import sys + from ctypes import Structure, CDLL, POINTER, CFUNCTYPE from ctypes import c_bool, c_double, c_float, c_int, c_size_t, c_uint, c_uint32 from ctypes import c_char, c_char_p, c_void_p @@ -22,10 +24,10 @@ class _LilvLib: """Object that represents the liblilv C library""" def __init__(self): - import sys - if sys.platform == "darwin": self.lib = CDLL("liblilv-0.dylib") + elif sys.platform == "win32": + self.lib = CDLL("lilv-0.dll") else: self.lib = CDLL("liblilv-0.so") @@ -807,7 +809,8 @@ class Node(Structure): Returns None if value is not a file URI.""" c_str = c.node_get_path(self.node, hostname) string = cast(c_str, c_char_p).value.decode("utf-8") - c.free(c_str) + if sys.platform != 'win32': # TODO: Memory comes from libserd + c.free(c_str) return string def is_float(self): diff --git a/bindings/test/python/test_api.py b/bindings/test/python/test_api.py index fd49cc9..23345e8 100644 --- a/bindings/test/python/test_api.py +++ b/bindings/test/python/test_api.py @@ -14,10 +14,15 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. import lilv -import unittest import os +import sys +import unittest + +from urllib.parse import urljoin +from urllib.request import pathname2url -location = "file://" + os.getcwd() + "/bindings/bindings_test_plugin.lv2/" +path = os.path.abspath("bindings/bindings_test_plugin.lv2/") +location = urljoin("file:", pathname2url(path) + "/") class NodeTests(unittest.TestCase): |