Skip to content

Commit

Permalink
update clean option
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Mar 23, 2017
1 parent c0aca3f commit 8c74859
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
6 changes: 5 additions & 1 deletion tools/Readme.configure
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,15 @@ 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
.env_mach_specific.csh
.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.
this will set the proper environment for supported systems which use modules.
25 changes: 16 additions & 9 deletions tools/configure
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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:
Expand Down Expand Up @@ -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()

0 comments on commit 8c74859

Please sign in to comment.