disable autotestdict in cython
[liba.git] / script / meson.py
blobdc862852fc26a73da2457176a5ca28563f876a67
1 #!/usr/bin/env python
2 import os, re
4 SUFFIXS = (".c", ".h", ".cc", ".hh", ".cpp", ".hpp", ".cxx", ".hxx")
6 sources = []
7 for dirpath, dirnames, filenames in os.walk("include"):
8 for filename in filenames:
9 source = os.path.join(dirpath, filename)
10 prefix, suffix = os.path.splitext(source)
11 if suffix in SUFFIXS:
12 sources.append(source.replace("\\", "/"))
13 for dirpath, dirnames, filenames in os.walk("src"):
14 for filename in filenames:
15 source = os.path.join(dirpath, filename)
16 prefix, suffix = os.path.splitext(source)
17 if suffix in SUFFIXS:
18 sources.append(source.replace("\\", "/"))
19 sources = sorted(sources)
21 with open("meson.build", "r") as f:
22 meson = f.read()
23 cur = re.findall(r"sources = ([^\]]+)", meson)[0] + "]\n"
24 new = "[\n '" + "',\n '".join(sources) + "',\n]\n"
25 with open("meson.build", "wb") as f:
26 meson = f.write(meson.replace(cur, new).encode())