diff --git a/python/dune/perftool/options.py b/python/dune/perftool/options.py index 9e345954f24a313d216af9a6061f54edd2e45b81..dfc1e837b9172e579ce59842ffc847bd8e5d9610 100644 --- a/python/dune/perftool/options.py +++ b/python/dune/perftool/options.py @@ -1,12 +1,15 @@ -""" A module that manages the command line options to the form compiler executable """ +""" Manage the command line options to the form compiler executable """ +from argparse import ArgumentParser +from os import path from pytools import memoize +from dune.common.parametertree.parser import parse_ini_file + @memoize def get_form_compiler_arguments(): # define an argument parser. - from argparse import ArgumentParser parser = ArgumentParser(description="Compile UFL files to PDELab C++ code", epilog="Please report bugs to dominic.kempf@iwr.uni-heidelberg.de") parser.add_argument("uflfile", type=str, nargs=1, help="the UFL file to compile") parser.add_argument("--driver-file", type=str, help="The filename for the generated driver header") @@ -47,13 +50,12 @@ def get_form_compiler_arguments(): args["uflfile"] = args["uflfile"][0] # Turn any relative paths into absolute ones for consistency - import os.path if args["driver_file"]: - args["driver_file"] = os.path.abspath(args["driver_file"]) + args["driver_file"] = path.abspath(args["driver_file"]) if args["operator_file"]: - args["operator_file"] = os.path.abspath(args["operator_file"]) + args["operator_file"] = path.abspath(args["operator_file"]) if args["ini_file"]: - args["ini_file"] = os.path.abspath(args["ini_file"]) + args["ini_file"] = path.abspath(args["ini_file"]) # Return the argument dict. This result is memoized to turn all get_option calls into simple dict lookups. return args @@ -72,7 +74,6 @@ def init_option_dict(): # Read arguments from the given inifile if _option_dict["ini_file"]: - from dune.common.parametertree.parser import parse_ini_file inifile = parse_ini_file(_option_dict["ini_file"]) for key, value in inifile.get("formcompiler", {}).items(): if key not in _option_dict or _option_dict[key] is None: