mirror of
https://github.com/Z3Prover/z3
synced 2025-04-14 12:58:44 +00:00
to ``mk_genfile_common.py`` and adapt ``mk_util.py`` and ``mk_gparams_register_modules_cpp.py`` to use the code at its new location. The interface has been changed slightly so that ``mk_gparams_register_modules_internal()`` now returns the path to the generated file. The motivation behind this so that clients of the function know the path to the generated file. Whilst I'm here reindent ``mk_gparams_register_modules_cpp.py`` and the relevant code in ``mk_util.py``. Also remove duplicated code that is now available in ``mk_genfile_common.py``. The purpose of this change is to have Python code common to the Python and CMake build systems separate from Python code that is only used for the Python build system.
40 lines
1.1 KiB
Python
Executable file
40 lines
1.1 KiB
Python
Executable file
#!/usr/bin/env python
|
|
"""
|
|
Determines the available global parameters
|
|
in header files in the list of source directions
|
|
and generates a ``gparams_register_modules.cpp`` file in
|
|
the destination directory that defines a function
|
|
``void gparams_register_modules()``.
|
|
"""
|
|
import mk_genfile_common
|
|
import argparse
|
|
import logging
|
|
import os
|
|
import sys
|
|
|
|
def main(args):
|
|
logging.basicConfig(level=logging.INFO)
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("destination_dir", help="destination directory")
|
|
parser.add_argument("source_dirs", nargs="+",
|
|
help="One or more source directories to search")
|
|
pargs = parser.parse_args(args)
|
|
|
|
if not mk_genfile_common.check_dir_exists(pargs.destination_dir):
|
|
return 1
|
|
|
|
for source_dir in pargs.source_dirs:
|
|
if not mk_genfile_common.check_dir_exists(source_dir):
|
|
return 1
|
|
|
|
output = mk_genfile_common.mk_gparams_register_modules_internal(
|
|
pargs.source_dirs,
|
|
pargs.destination_dir
|
|
)
|
|
logging.info('Generated "{}"'.format(output))
|
|
return 0
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main(sys.argv[1:]))
|
|
|