diff --git a/scripts/ccpp_prebuild.py b/scripts/ccpp_prebuild.py index b67de540..3cb4ee19 100755 --- a/scripts/ccpp_prebuild.py +++ b/scripts/ccpp_prebuild.py @@ -55,7 +55,7 @@ def parse_arguments(): verbose = args.verbose debug = args.debug if args.suites: - sdfs = ['suite_{0}.xml'.format(x) for x in args.suites.split(',')] + sdfs = ['{0}.xml'.format(x) for x in args.suites.split(',')] else: sdfs = None builddir = args.builddir @@ -181,8 +181,22 @@ def parse_suites(suites_dir, sdfs): logging.info('Parsing suite definition files ...') suites = [] for sdf in sdfs: - logging.info('Parsing suite definition file {0} ...'.format(os.path.join(suites_dir, sdf))) - suite = Suite(sdf_name=os.path.join(suites_dir, sdf)) + sdf_file=os.path.join(suites_dir, sdf) + if not os.path.exists(sdf_file): + # If suite file not found, check old filename convention (suite_[suitename].xml) + sdf_file_legacy=os.path.join(suites_dir, f"suite_{sdf}") + if os.path.exists(sdf_file_legacy): + logging.warning("Parsing suite definition file using legacy naming convention") + logging.warning(f"Filename {os.path.basename(sdf_file_legacy)}") + logging.warning(f"Suite name {sdf}") + sdf_file=sdf_file_legacy + else: + logging.critical(f"Suite definition file {sdf_file} not found.") + success = False + return (success, suites) + + logging.info(f'Parsing suite definition file {sdf_file} ...') + suite = Suite(sdf_name=sdf_file) success = suite.parse() if not success: logging.error('Parsing suite definition file {0} failed.'.format(sdf)) diff --git a/scripts/common.py b/scripts/common.py index c29ccda2..f5ba7f1d 100755 --- a/scripts/common.py +++ b/scripts/common.py @@ -73,7 +73,7 @@ CCPP_STATIC_SUBROUTINE_NAME = 'ccpp_physics_{stage}' # Filename pattern for suite definition files -SUITE_DEFINITION_FILENAME_PATTERN = re.compile('^suite_(.*)\.xml$') +SUITE_DEFINITION_FILENAME_PATTERN = re.compile('^(.*)\.xml$') # Maximum number of concurrent CCPP instances per MPI task CCPP_NUM_INSTANCES = 200 diff --git a/scripts/mkstatic.py b/scripts/mkstatic.py index 4f00b9b9..889b2c1d 100755 --- a/scripts/mkstatic.py +++ b/scripts/mkstatic.py @@ -691,11 +691,16 @@ def parse(self, make_call_tree=False): suite_xml = tree.getroot() self._name = suite_xml.get('name') # Validate name of suite in XML tag against filename; could be moved to common.py - if not (os.path.basename(self._sdf_name) == 'suite_{}.xml'.format(self._name)): - logging.critical("Invalid suite name {0} in suite definition file {1}.".format( - self._name, self._sdf_name)) - success = False - return success + if not (os.path.basename(self._sdf_name) == '{}.xml'.format(self._name)): + if (os.path.basename(self._sdf_name) == 'suite_{}.xml'.format(self._name)): + logging.debug("Parsing suite using legacy naming convention") + logging.debug(f"Filename {os.path.basename(self._sdf_name)}") + logging.debug(f"Suite name {format(self._name)}") + else: + logging.critical("Invalid suite name {0} in suite definition file {1}.".format( + self._name, self._sdf_name)) + success = False + return success # Check if suite name is too long if len(self._name) > SUITE_NAME_MAX_CHARS: diff --git a/test_prebuild/test_blocked_data/suite_blocked_data_suite.xml b/test_prebuild/test_blocked_data/blocked_data_suite.xml similarity index 100% rename from test_prebuild/test_blocked_data/suite_blocked_data_suite.xml rename to test_prebuild/test_blocked_data/blocked_data_suite.xml