File: builder.py

package info (click to toggle)
eccodes-python 2%3A1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 400 kB
  • sloc: python: 2,695; ansic: 262; makefile: 83
file content (19 lines) | stat: -rw-r--r-- 435 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import logging

import cffi
import sys

ffibuilder = cffi.FFI()
ffibuilder.set_source(
    "gribapi._bindings",
    "#include <eccodes.h>",
    libraries=["eccodes"],
)
ffibuilder.cdef(open("gribapi/grib_api.h").read() + open("gribapi/eccodes.h").read())

if __name__ == "__main__":
    try:
        ffibuilder.compile(verbose=True)
    except Exception:
        logging.exception("can't compile ecCodes bindings")
        sys.exit(1)