diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2019-01-15 13:47:26 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2019-01-15 13:47:26 +0100 |
commit | 5b45be4e83c7e0d62fb949dba32bb9f832c1df5b (patch) | |
tree | 4969fdeba2f0f3709d7d60f43da72af014ec768c /unittest/conftest.py | |
parent | 1f3da5c76acb20b2183ac52373ed3b0b63e1151e (diff) | |
download | libnitrokey-5b45be4e83c7e0d62fb949dba32bb9f832c1df5b.tar.gz libnitrokey-5b45be4e83c7e0d62fb949dba32bb9f832c1df5b.tar.bz2 |
Add support for multiline C definitions in NK_C_API + test
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest/conftest.py')
-rw-r--r-- | unittest/conftest.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/unittest/conftest.py b/unittest/conftest.py index 253e1d8..669dc23 100644 --- a/unittest/conftest.py +++ b/unittest/conftest.py @@ -44,13 +44,13 @@ def C(request=None): cnt = 0 a = iter(declarations) for declaration in a: - if declaration.strip().startswith('NK_C_API'): + if declaration.strip().startswith('NK_C_API') \ + or declaration.strip().startswith('struct'): declaration = declaration.replace('NK_C_API', '').strip() - while ';' not in declaration: - declaration += (next(a)).strip() - # print(declaration) + while ');' not in declaration and '};' not in declaration: + declaration += (next(a)).strip()+'\n' ffi.cdef(declaration, override=True) - cnt +=1 + cnt += 1 print('Imported {} declarations'.format(cnt)) C = None |