fix version matching in FindPackage.cmake
[liba.git] / meson / fixup.py
blob1dac6c9b5e131a5a205ec379609a750b7db34b3f
1 #!/usr/bin/env python
2 import os, argparse
4 parser = argparse.ArgumentParser()
5 parser.add_argument("src")
6 parser.add_argument("dst")
7 args = parser.parse_known_args()
9 if args[0].dst:
10 with open(args[0].dst, "r") as f:
11 text = f.read()
13 cur = "#if defined(A_HAVE_H)"
14 dst = os.path.dirname(args[0].src)
15 src = os.path.basename(args[0].src)
16 new = '#include "{}"\n{}'.format(src, cur)
17 text = text.replace(cur, new)
19 with open(os.path.join(dst, os.path.basename(args[0].dst)), "wb") as f:
20 f.write(text.encode())