1
0
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:
Anthony Scemama 2023-10-11 10:56:30 +02:00
parent 59d14d0a21
commit 142757572f
3 changed files with 47 additions and 6 deletions

View File

@ -7,6 +7,21 @@ stubs_file= "trexio_stubs.c"
ml_file = "trexio.ml"
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):
with open("src/"+stubs_file,'r') as f:
@ -643,6 +658,7 @@ def write_ml(data):
def main():
check_version()
with open(json_file,'r') as f:
data = json.load(f)
for group in data:

View File

@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "2.3.2"
version: "2.4.0"
synopsis: "Binding for the TREXIO Input/Output library"
description:
"TREXIO is a file format and library for storing wave functions and integrals for quantum chemistry."

View File

@ -1,9 +1,29 @@
#!/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 = {}
be = {}
with open("../../include/trexio.h", 'r') as f:
with open(trexio_h, 'r') as f:
for line in f:
buf = line.lstrip()
@ -35,5 +55,10 @@ def main():
def make_functions():
pass
if __name__ == '__main__':
main()
check_version()
make_interface()
make_functions()