File: build.py

package info (click to toggle)
libvbz-hdf-plugin 1.0.2-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,384 kB
  • sloc: cpp: 28,289; python: 392; ansic: 40; sh: 21; makefile: 19; xml: 16
file content (71 lines) | stat: -rw-r--r-- 1,390 bytes parent folder | download | duplicates (2)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""
Builds the C Python wrapper for libvbz
"""

import os
from cffi import FFI


vbz_include_paths = os.environ["VBZ_INCLUDE_PATHS"].split(";")
vbz_libs = os.environ["VBZ_LINK_LIBS"].split(";")


ffibuilder = FFI()


ffibuilder.set_source(
    "_vbz",
    """
    #include <vbz.h>
    """,
    include_dirs=vbz_include_paths,
    extra_objects=vbz_libs,
    source_extension='.cpp',
    libraries=['c', 'stdc++'],
    extra_compile_args=['-std=c++11'],
)


ffibuilder.cdef("""
typedef uint32_t vbz_size_t;

typedef struct {
    bool perform_delta_zig_zag;
    unsigned int integer_size;
    unsigned int zstd_compression_level;
    unsigned int vbz_version;
} CompressionOptions;

bool vbz_is_error(vbz_size_t result_value);

vbz_size_t vbz_max_compressed_size(
    vbz_size_t source_size,
    CompressionOptions const* options
);

vbz_size_t vbz_decompressed_size(
    void const* source,
    vbz_size_t source_size,
    CompressionOptions const* options
);

vbz_size_t vbz_compress_sized(
    void const* source,
    vbz_size_t source_size,
    void* destination,
    vbz_size_t destination_capacity,
    CompressionOptions const* options
);

vbz_size_t vbz_decompress_sized(
    void const* source,
    vbz_size_t source_size,
    void* destination,
    vbz_size_t destination_capacity,
    CompressionOptions const* options
);
""")


if __name__ == "__main__":
    ffibuilder.compile()