From 8c748593be2f16db164cd970198c6b811ebf1477 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 23 Mar 2017 13:29:47 -0600 Subject: [PATCH] update clean option --- tools/Readme.configure | 6 +++++- tools/configure | 25 ++++++++++++++++--------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/tools/Readme.configure b/tools/Readme.configure index 034c4204725..36b310ee5f9 100644 --- a/tools/Readme.configure +++ b/tools/Readme.configure @@ -46,6 +46,10 @@ optional arguments: for each machine, use the utility manage_case in this directory. The default is the first listing in MPILIBS in config_machines.xml + --clean Remove old Macros and env files before attempting to + create new ones + + It will create a Macros file in make or cmake format along with the module support for the specified or default compiler. It will also create two files @@ -53,4 +57,4 @@ for the specified or default compiler. It will also create two files .env_mach_specific.sh Before you try to run make you should source the file above appropriate for your shell -this will set the proper environment for supported systems which use modules. \ No newline at end of file +this will set the proper environment for supported systems which use modules. diff --git a/tools/configure b/tools/configure index 15db5997e65..bba14b82d70 100755 --- a/tools/configure +++ b/tools/configure @@ -67,7 +67,7 @@ def parse_command_line(args): parser.add_argument("--clean", action="store_true", help="Remove old Macros and env files before attempting to create new ones") - + argcnt = len(args) args = parser.parse_args() CIME.utils.handle_standard_logging_options(args) @@ -85,12 +85,6 @@ def parse_command_line(args): opts['machobj'] = machobj - if args.clean: - files = ["Macros.make", "Macros.cmake", "env_mach_specific.xml", ".env_mach_specific.sh", ".env_mach_specific.csh"] - for file_ in files: - if os.path.isfile(file_): - os.remove(file_) - if args.macros_format is None: opts['macros_format'] = [] else: @@ -139,12 +133,25 @@ def parse_command_line(args): os.environ["DEBUG"] = "FALSE" opts['debug'] = debug + + if args.clean: + files = ["Macros.make", "Macros.cmake", "env_mach_specific.xml", ".env_mach_specific.sh", + ".env_mach_specific.csh", "Depends.%s"%compiler, "Depends.%s"%args.machine, + "Depends.%s.%s"%(args.machine,compiler)] + for file_ in files: + if os.path.isfile(file_): + logger.warn("Removing file %s"%file_) + os.remove(file_) + if argcnt == 2: + opts['clean_only'] = True + return opts def _main(): opts = parse_command_line(sys.argv) - configure(opts['machobj'], opts['output_dir'], opts['macros_format'], - opts['compiler'], opts['mpilib'], opts['debug'], opts['os']) + if "clean_only" not in opts or not opts["clean_only"]: + configure(opts['machobj'], opts['output_dir'], opts['macros_format'], + opts['compiler'], opts['mpilib'], opts['debug'], opts['os']) if __name__ == "__main__": _main()