3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 17:44:08 +00:00

add parameter documentation to nightly

This commit is contained in:
Nikolaj Bjorner 2022-08-16 15:07:19 -07:00
parent fe00e95f72
commit 21033790be
3 changed files with 65 additions and 30 deletions

64
doc/mk_params_doc.py Normal file
View file

@ -0,0 +1,64 @@
# Copyright (c) Microsoft Corporation 2015
"""
Z3 API documentation for parameters
"""
import argparse
import subprocess
import sys
import re
import os
BUILD_DIR='../build'
OUTPUT_DIRECTORY=os.path.join(os.getcwd(), 'api')
def parse_options():
global BUILD_DIR, OUTPUT_DIRECTORY
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('-b',
'--build',
default=BUILD_DIR,
help='Directory where Z3 is built (default: %(default)s)',
)
parser.add_argument('--output-dir',
dest='output_dir',
default=OUTPUT_DIRECTORY,
help='Path to output directory (default: %(default)s)',
)
pargs = parser.parse_args()
BUILD_DIR = pargs.build
OUTPUT_DIRECTORY = pargs.output_dir
def help(ous):
global BUILD_DIR
ous.write("Z3 Options\n")
z3_exe = BUILD_DIR + "/z3"
out = subprocess.Popen([z3_exe, "-pm"],stdout=subprocess.PIPE).communicate()[0]
modules = []
if out != None:
out = out.decode(sys.stdout.encoding)
module_re = re.compile(r"\[module\] (.*)\,")
lines = out.split("\n")
for line in lines:
m = module_re.search(line)
if m:
modules += [m.group(1)]
for module in modules:
out = subprocess.Popen([z3_exe, "-pmmd:%s" % module],stdout=subprocess.PIPE).communicate()[0]
if out == None:
continue
out = out.decode(sys.stdout.encoding)
out = out.replace("\r","")
ous.write(out)
parse_options()
def mk_dir(d):
if not os.path.exists(d):
os.makedirs(d)
mk_dir(os.path.join(OUTPUT_DIRECTORY, 'md'))
with open(OUTPUT_DIRECTORY + "/md/Parameters.md",'w') as ous:
help(ous)

View file

@ -1,30 +0,0 @@
import subprocess
import sys
import re
Z3_EXE = "z3.exe"
def help(ous):
ous.write("Z3 Options\n")
out = subprocess.Popen([Z3_EXE, "-pm"],stdout=subprocess.PIPE).communicate()[0]
modules = []
if out != None:
out = out.decode(sys.stdout.encoding)
module_re = re.compile(r"\[module\] (.*)\,")
lines = out.split("\n")
for line in lines:
m = module_re.search(line)
if m:
modules += [m.group(1)]
for module in modules:
out = subprocess.Popen([Z3_EXE, "-pmmd:%s" % module],stdout=subprocess.PIPE).communicate()[0]
if out == None:
continue
out = out.decode(sys.stdout.encoding)
out = out.replace("\r","")
ous.write(out)
with open("Parameters.md",'w') as ous:
help(ous)

View file

@ -76,6 +76,7 @@ stages:
eval `opam config env`
cd doc
python mk_api_doc.py --mld --z3py-package-path=../build/python/z3
python mk_params_doc.py
mkdir api/html/ml
ocamldoc -html -d api/html/ml -sort -hide Z3 -I $( ocamlfind query zarith ) -I ../build/api/ml ../build/api/ml/z3enums.mli ../build/api/ml/z3.mli
cd ..