-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.py
43 lines (35 loc) · 814 Bytes
/
build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from cffi import FFI
ffibuilder = FFI()
ffibuilder.set_source(
"_fastx",
r"""
#include <zlib.h>
#include <stdio.h>
#include "kseq.h"
KSEQ_INIT(gzFile, gzread)
kseq_t *open_fastx (const char *fn) {
gzFile fp = gzopen(fn, "r");
return kseq_init(fp);
}
void close_fastx(kseq_t *kseq) {
gzclose(kseq->f->f);
kseq_destroy(kseq);
}
""",
libraries=['z'], include_dirs=['src']
)
ffibuilder.cdef(
r"""
typedef struct kstring_t {
size_t l, m; char *s;
} kstring_t;
typedef struct kseq_t {
kstring_t name, comment, seq, qual;
...;
} kseq_t;
kseq_t *open_fastx(const char *fn);
void close_fastx(kseq_t *kseq);
int kseq_read(kseq_t *kseq);
"""
)
ffibuilder.compile(verbose=True)