6 """ Python script to workaround issue mesonbuild/meson#9702
7 (https://github.com/mesonbuild/meson/issues/9702). It returns the relative path
8 of the prefixdir from the cmake directory."""
15 if len(sys.argv) <= 2:
16 print(
"Usage: {} <prefixdir> <cmakedir>".format(sys.argv[0]))
19 prefix_dir = sys.argv[1]
20 cmake_dir = sys.argv[2]
22 return prefix_dir, cmake_dir
26 prefix_dir, cmake_dir =
parse()
28 prefix_dir = os.path.abspath(prefix_dir)
29 if not os.path.isabs(cmake_dir):
30 cmake_dir = os.path.abspath(os.path.join(prefix_dir, cmake_dir))
33 relpath = os.path.relpath(prefix_dir, cmake_dir).
replace(os.sep,
"/")
34 print(
"%s" % (relpath,))
37 if __name__ ==
"__main__":
int replace(char *string, const char *token, const char *fmt,...)