mirror of
https://github.com/TREX-CoE/trexio.git
synced 2025-01-09 12:44:11 +01:00
Check consistency of versions in OCaml
This commit is contained in:
parent
59d14d0a21
commit
142757572f
@ -7,6 +7,21 @@ stubs_file= "trexio_stubs.c"
|
|||||||
ml_file = "trexio.ml"
|
ml_file = "trexio.ml"
|
||||||
mli_file = ml_file+"i"
|
mli_file = ml_file+"i"
|
||||||
|
|
||||||
|
def check_version():
|
||||||
|
with open('trexio.opam','r') as f:
|
||||||
|
for line in f:
|
||||||
|
if line.startswith("version"):
|
||||||
|
ocaml_version = line.split(':')[1].strip()[1:-1]
|
||||||
|
break
|
||||||
|
with open('../../configure.ac','r') as f:
|
||||||
|
for line in f:
|
||||||
|
if line.startswith("AC_INIT"):
|
||||||
|
trexio_version = line.split(',')[1].strip()[1:-1]
|
||||||
|
break
|
||||||
|
if ocaml_version != trexio_version:
|
||||||
|
print(f"Inconsistent versions:\nTREXIO:{trexio_version}\nOCaml: {ocaml_version}\n")
|
||||||
|
raise
|
||||||
|
|
||||||
def write_stubs(data):
|
def write_stubs(data):
|
||||||
|
|
||||||
with open("src/"+stubs_file,'r') as f:
|
with open("src/"+stubs_file,'r') as f:
|
||||||
@ -643,6 +658,7 @@ def write_ml(data):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
|
check_version()
|
||||||
with open(json_file,'r') as f:
|
with open(json_file,'r') as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
for group in data:
|
for group in data:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# This file is generated by dune, edit dune-project instead
|
# This file is generated by dune, edit dune-project instead
|
||||||
opam-version: "2.0"
|
opam-version: "2.0"
|
||||||
version: "2.3.2"
|
version: "2.4.0"
|
||||||
synopsis: "Binding for the TREXIO Input/Output library"
|
synopsis: "Binding for the TREXIO Input/Output library"
|
||||||
description:
|
description:
|
||||||
"TREXIO is a file format and library for storing wave functions and integrals for quantum chemistry."
|
"TREXIO is a file format and library for storing wave functions and integrals for quantum chemistry."
|
||||||
|
@ -1,9 +1,29 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
def main():
|
json_file = "../../trex.json"
|
||||||
|
trexio_h = "../../include/trexio.h"
|
||||||
|
|
||||||
|
def check_version():
|
||||||
|
with open('Cargo.toml','r') as f:
|
||||||
|
for line in f:
|
||||||
|
if line.startswith("version"):
|
||||||
|
rust_version = line.split('=')[1].strip()[1:-1]
|
||||||
|
break
|
||||||
|
with open('../../configure.ac','r') as f:
|
||||||
|
for line in f:
|
||||||
|
if line.startswith("AC_INIT"):
|
||||||
|
trexio_version = line.split(',')[1].strip()[1:-1]
|
||||||
|
break
|
||||||
|
if rust_version != trexio_version:
|
||||||
|
print(f"Inconsistent versions:\nTREXIO:{trexio_version}\nRust: {rust_version}\n")
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def make_interface():
|
||||||
err = {}
|
err = {}
|
||||||
be = {}
|
be = {}
|
||||||
with open("../../include/trexio.h", 'r') as f:
|
with open(trexio_h, 'r') as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
buf = line.lstrip()
|
buf = line.lstrip()
|
||||||
|
|
||||||
@ -11,7 +31,7 @@ def main():
|
|||||||
if buf.startswith("#define TREXIO_") and "(trexio_exit_code)" in buf :
|
if buf.startswith("#define TREXIO_") and "(trexio_exit_code)" in buf :
|
||||||
buf2 = buf.replace(")","").replace("(","").split()
|
buf2 = buf.replace(")","").replace("(","").split()
|
||||||
err[buf2[1]] = int(buf2[3].strip())
|
err[buf2[1]] = int(buf2[3].strip())
|
||||||
|
|
||||||
# Get backends
|
# Get backends
|
||||||
if buf.startswith("#define TREXIO_") and "(back_end_t)" in buf :
|
if buf.startswith("#define TREXIO_") and "(back_end_t)" in buf :
|
||||||
buf2 = buf.replace(")","").replace("(","").split()
|
buf2 = buf.replace(")","").replace("(","").split()
|
||||||
@ -33,7 +53,12 @@ def main():
|
|||||||
f.write(f"#undef TREXIO_AUTO;\n")
|
f.write(f"#undef TREXIO_AUTO;\n")
|
||||||
f.write(f"const back_end_t TREXIO_AUTO = TREXIO_INVALID_BACK_END;\n")
|
f.write(f"const back_end_t TREXIO_AUTO = TREXIO_INVALID_BACK_END;\n")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def make_functions():
|
||||||
|
pass
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
check_version()
|
||||||
|
make_interface()
|
||||||
|
make_functions()
|
||||||
|
Loading…
Reference in New Issue
Block a user