File: apigen.py

package info (click to toggle)
mpi4py 4.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,540 kB
  • sloc: python: 34,465; ansic: 16,475; makefile: 614; sh: 325; cpp: 193; f90: 178
file content (29 lines) | stat: -rw-r--r-- 683 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
import os
import pathlib
import sys

wrkdir = pathlib.Path(__file__).resolve().parent
topdir = wrkdir.parent.parent
srcdir = topdir / "src"
cfgdir = topdir / "conf"

sys.path.insert(0, os.fspath(cfgdir))
from mpiapigen import Generator  # noqa: E402

generator = Generator()
libmpi_pxd = srcdir / "mpi4py" / "libmpi.pxd"
generator.parse_file(libmpi_pxd)
libmpi_h = wrkdir / "libmpi.h"
generator.dump_header_h(libmpi_h)

# from io import StringIO
# libmpi_h = StringIO()
# generator.dump_header_h(libmpi_h)
# print libmpi_h.read()

libmpi_c = wrkdir / "libmpi.c.in"
with libmpi_c.open("w", encoding="utf-8") as f:
    f.write(f"""\
#include <mpi.h>
#include "{srcdir}/lib-mpi.h"
""")