def main(): """ function to display configuration informations """ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Reads config file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('\n\nLoading Options and Configurations\n' + 72 * '~' + '\n') parser = ArgumentParser(description=('''\n List active configurations:\n 1. check if your system points to a valid configuration file 2. parse your configuration file and display the briefs of your active configurations ''')) parser = add_config_argument(parser) parser.add_argument("--clean", action="store_true", dest="config_delete", default=False, help="remove the directories in relation to the" "named configuration(s)") options = parser.parse_args() # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ update_config(options) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ banners ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ svn_banner(CFGS.get_root()) for cfgname in CFGS.configs: CFGS.cfgname = cfgname CFGS.compute_modules_info() CFGS.light_dump() if options.config_delete: CFGS.clean_install(cfgname) print('\n\n' + '~' * 72 + '\n') # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Jenkins' success message ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('\n\nMy work is done\n\n') sys.exit(0)
def main(): """ Main function of doxygenTELEMAC """ bypass = False # /!\ Temporary bypass for subroutine within programs # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Reads config file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('\n\nLoading Options and Configurations\n'+'~'*72+'\n') parser = ArgumentParser(\ formatter_class=RawDescriptionHelpFormatter, description=('''\n Generate the DOXYGEN documentation of the whole TELEMAC system. '''), usage=' (--help for help)\n---------\n => '\ '%(prog)s [options] \n---------') parser = add_config_argument(parser) parser.add_argument(\ "-d", "--doxydir", dest="doxyDir", default='', help="specify the root, default is taken from config file") parser.add_argument(\ "-m", "--modules", dest="modules", default='', help="specify the list modules, default is taken from config file") options = parser.parse_args() # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ update_config(options) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ banners ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ svn_banner(CFGS.get_root()) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Works for one configuration only ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Works for only one configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cfg = CFGS.configs[CFGS.cfgname] # still in lower case if options.modules != '': cfg['modules'] = options.modules.replace(',', ' ')\ .replace(';', ' ')\ .replace('.', ' ') if options.doxyDir == '': cfg.update({'doxydocs':path.join(cfg['root'], 'documentation', CFGS.cfgname)}) else: cfg.update({'doxydocs':options.doxyDir}) if not path.isdir(cfg['doxydocs']): create_directories(cfg['doxydocs']) # parsing for proper naming CFGS.compute_doxy_info() print('\n\nScanning the source code for:\n'+'~'*72+'\n') CFGS.light_dump() # ~~ Scans all source files to build a relation database ~~ fic, _, _, _, _, _, _, racine = scan_sources(CFGS.cfgname, cfg, bypass) # ~~ Scann all source files to update Doxygen ~~~~~~~~~~~~~~~~ for mod in fic: print('\nCreating the DOXYGEN headers for ' + mod + '\n'+'~'*72+'\n') for ifile in fic[mod]: # ~~ Read the content of the source file ~~~~~~~~~~~~ ilines = get_file_content(ifile) # ~~ Update its Doxygen content ~~~~~~~~~~~~~~~~~~~~~ olines = create_doxygen(ifile, ilines, mod, racine) # ~~ Make sure the distination exists ~~~~~~~~~~~~~~~ ofile = ifile.replace(cfg['root'], cfg['doxydocs']) create_directories(path.dirname(ofile)) # ~~ Write the content of the source file ~~~~~~~~~~~ put_file_content(ofile, olines) # ~~ Run Doxygen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('\nNow running DOXYGEN within ' + cfg['doxydocs'] + '\n'+'~'*72+'\n') chdir(cfg['doxydocs']) if not path.exists(cfg['cmd_doxygen']): raise Exception('Do not know where to find {}\n ' '... you can correct this through the key ' 'cmd_doxygen in your configuration file' ''.format(cfg['cmd_doxygen'])) if sp.call([cfg['cmd_doxygen']]): raise Exception # ~~ Scan all HTML files and replace template in phases replace_doxygen(path.join(cfg['doxydocs'], 'html')) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Jenkins' success message ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('\n\nMy work is done\n\n') sys.exit(0)
def main(): """ Main function of compileTELEMAC """ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~ Reads config file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('\n\nLoading Options and Configurations\n' + 72 * '~' + '\n') parser = ArgumentParser( formatter_class=RawDescriptionHelpFormatter, description=('''\n Compile the TELEMAC system:\n 1. rescan the tree dependencies if necessary 2. check which files need re-compilation 3. create object files, libraries, executable, and other binaries depending on your configuration settings Work with all active configurations. ''')) parser = add_config_argument(parser) parser.add_argument( "-m", "--modules", metavar="modules", dest="modules", default='', help="specify the list modules . separated, default is taken from config file") parser.add_argument( "-b", "--bypass", action="store_true", dest="bypass", default=False, help="will bypass execution failures and try to carry on " "(final report at the end)") parser.add_argument( "--rescan", action="store_true", dest="rescan", default=False, help="will redo the scan of sources for an update of " "all the cmdf files") parser.add_argument( "--clean", action="store_true", dest="cleanup", default=False, help="will erase all object, executable libraries from folder " "on the selected configs/modules") parser.add_argument( "-j", type=int, dest="ncsize", default=0, help="set the number of core used for the parallel " "compilation of objects") parser.add_argument( "-v", "--verbose", action="store_true", dest="verbose", default=False, help="If given will print every command") options = parser.parse_args() # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ update_config(options) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ banners ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ svn_banner(CFGS.get_root()) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Separately dealing with rescan for all configs ? ~~~~~~~~~~~~ for cfgname in CFGS.configs: # Setting configuration name CFGS.cfgname = cfgname # Getting configuration cfg = CFGS.configs[cfgname] if options.cleanup: CFGS.clean_install(cfgname) print('\n\n' + '\n'.join(banner(cfgname))) print('Scanning the source code for:\n' + '~' * 72 + '\n') compute_config(options.cleanup and options.rescan, options.bypass) CFGS.light_dump() # Only if we ask for a scan if options.rescan: update_cmdf(options.bypass, options.cleanup, options.verbose) # /!\ multiple configurations will now generate multiple rescan # (because of tags and adds, specific to some configurations) compute_config(False, options.bypass) # ~~ Scans all cmdf files found in all modules ~~~~~~~~~~~~~~~~~~~~~ # Specifying what module to compile if options.modules == '': modules = [] else: modules = options.modules.split(".") compile_cmdf(options.ncsize, modules, options.verbose) # Compiling api if asked for cfg_opt = cfg.get('options', []) if 'api' in cfg_opt: compile_api_files(silent=not options.verbose, static='static' in cfg_opt, hermes_only='hermes_only' in cfg_opt) print('\n\nMy work is done\n\n') sys.exit(0)
def main(): """ Main function of compactTELEMAC """ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Reads config file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('\n\nLoading Options and Configurations\n' + 72 * '~' + '\n') parser = ArgumentParser(formatter_class=RawDescriptionHelpFormatter, description=('''\n\ Compact the TELEMAC system files, into various archived:\n 1. archiving sources if necessary 2. archiving examples if necessary 3. archiving binaries if necessary 4. ... '''), usage=' (--help for help)\n---------\n =>' ' %(prog)s [options] \n---------') parser = add_config_argument(parser) parser.add_argument( "-a", "--archive-name", metavar="archive name", dest="archive_name", default='', help="specify the archive name, default is taken as the config name") parser.add_argument( "-m", "--modules", metavar="modules", dest="modules", default='', help="specify the list modules, default is taken from config file") parser.add_argument( "--src", action="store_true", dest="src_only", default=False, help="create a zip containing only the sources i.e. the " "bare minimum to use telemac-mascaret") parser.add_argument( "--examples", action="store_true", dest="examplesOnly", default=False, help="create a zip containing only the sources i.e. the " "bare minimum to use telemac-mascaret") options = parser.parse_args() # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ update_config(options) root_dir = CFGS.get_root() # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ banners ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ svn_banner(root_dir) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Works for only one common root and zipper ~~~~~~~~~~~~~~~~~~~ CFGS.compute_zip_info() cfg = CFGS.configs[CFGS.cfgname] version = cfg['version'] zip_ext = cfg['ZIPPER'] # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ srcOnlly is independent of config ~~~~~~~~~~~~~~~~~~~~~~~~~~~ if options.src_only: # ~~> create the archive directory if options.archive_name != '': archive_name = options.archive_name else: archive_name = 'otm_' + version + '-src' print('\n\nArchive ' + archive_name + '\n' + '~' * 72 + '\n') tmp_dir = path.join(root_dir, archive_name) if path.exists(tmp_dir): remove_directories(tmp_dir) create_directories(tmp_dir) # ~~> copy the content of the following dirs into the archive directory dirs = ['optionals', 'scripts', 'sources', 'documentation', 'configs'] for pid in dirs: input_path = path.join(root_dir, pid) output_path = input_path.replace(root_dir, tmp_dir) copytree(input_path, output_path, ignore=ignore_patterns('.svn', '*.pyc')) print(' +> ' + input_path) # ~~> copy the following files into the archive directory files = ['NEWS.txt', 'README.txt'] for pid in files: input_path = path.join(root_dir, pid) output_path = input_path.replace(root_dir, tmp_dir) copy_file(input_path, output_path) print(' +> ' + input_path) # ~~> prepare an empty diretory for future builds pid = path.join(root_dir, 'builds') output_path = pid.replace(root_dir, tmp_dir) create_directories(output_path) # ~~> zipping the archive directory print('\n... now packaging ' + archive_name) tel_zip(archive_name, tmp_dir, zip_ext) # ~~> cleaning the archive directory print('\n... now cleaning ') remove_directories(tmp_dir) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ examplesOnly is independent of config ~~~~~~~~~~~~~~~~~~~~~~~ elif options.examplesOnly: # ~~> create the archive directory if options.archive_name != '': archive_name = options.archive_name else: archive_name = 'otm_' + version + '-examples' print('\n\nArchive ' + archive_name + '\n' + '~' * 72 + '\n') tmp_dir = path.join(root_dir, archive_name) if path.exists(tmp_dir): remove_directories(tmp_dir) create_directories(tmp_dir) # ~~> copy the content of the following dir into the archive directory dirs = ['examples'] for pid in dirs: input_path = path.join(root_dir, pid) output_path = input_path.replace(root_dir, tmp_dir) copytree(input_path, output_path, ignore=ignore_patterns('.svn', '*.pyc')) print(' +> ' + input_path) # ~~> zipping the archive directory print('\n... now packaging ' + archive_name) tel_zip(archive_name, tmp_dir, zip_ext) # ~~> cleaning the archive directory print('\n... now cleaning ') remove_directories(tmp_dir) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Works for all configurations unless specified ~~~~~~~~~~~~~~~ else: for cfgname in CFGS.configs: if options.modules != '': cfg['modules'] = \ options.modules.replace(',', ' ')\ .replace(';', ' ').replace('.', ' ') # parsing for proper naming CFGS.compute_compact_info() CFGS.light_dump() # ~~ Scans all source files to build a relation database ~~~~~~~~~~~ if cfg['MODULES'] == {}: raise TelemacException(\ '\nNot able to find any modules within' 'your root directory {}\n'.format(cfg['root'])) # ~~> create the archive directory if options.archive_name != '': archive_name = options.archive_name else: archive_name = 'otm_' + version + '-builds-' + cfgname print('\n\nArchive ' + archive_name + '\n' + '~' * 72 + '\n') tmp_dir = path.join(root_dir, archive_name) if path.exists(tmp_dir): remove_directories(tmp_dir) create_directories(tmp_dir) # ~~> copy the content of the following dir # into the archive directory dirs = ['builds' + sep + cfgname, 'scripts', 'sources', 'configs'] for pid in dirs: input_path = path.join(root_dir, pid) output_path = input_path.replace(root_dir, tmp_dir) copytree(input_path, output_path, ignore=ignore_patterns('.svn', '*.pyc')) print(' +> ' + input_path) # ~~> zipping the archive directory print('\n... now packaging ' + cfgname) tel_zip(cfgname, tmp_dir, cfg['ZIPPER']) # ~~> cleaning the archive directory print('\n... now cleaning ') remove_directories(tmp_dir) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Jenkins' success message ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('\n\nMy work is done\n\n') sys.exit(0)
def run_mascaret(): """ Main function that runs the mascaret executable in the current folder """ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Reads config file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('\n\nLoading Options and Configurations\n'+72*'~'+'\n') parser = ArgumentParser( formatter_class=RawDescriptionHelpFormatter, description=('''\n\ Run the mascaret executable in the current folder, given a CAS file. ''')) parser.add_argument("args", nargs='*') # ~~> Environment parser = add_config_argument(parser) parser.add_argument( "-s", "--sortiefile", action="store_true", dest="sortie_file", default=False, help="specify whether there is a sortie file, default is no") parser.add_argument( "-b", "--bypass", action="store_true", dest="bypass", default=False, help="will bypass execution failures and try to carry on " "(final report at the end)") options = parser.parse_args() # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ update_config(options) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ banners ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ svn_banner(CFGS.get_root()) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Works for one configuration only ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if len(options.args) < 1: print('\nThe name of the CAS file is required\n') parser.print_help() sys.exit(1) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Reads command line arguments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cas = options.args[0] # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Works for only one configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ xcpts = Messages() # still in lower case # parsing for proper naming CFGS.compute_execution_info() cfg = CFGS.configs[CFGS.cfgname] create_mascaret_files(cfg, cas) mascaret_exe = path.join(cfg['root'], 'builds', CFGS.cfgname, 'bin', 'mascaret' + cfg['sfx_exe']) _, code = xcpts.run_cmd(mascaret_exe, options.bypass) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Reporting errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if xcpts.not_empty() or code != 0: print('\n\nHummm ... I could not complete my work.\n'+'~'*72 + xcpts.except_messages()) sys.exit(1) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Jenkins' success message ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ else: print('\n\nMy work is done\n\n') sys.exit(0)
def main(module=None): """ @brief Main function of the runcode.py module @param module (string): the name of the module to run ( available modules are: telemac2d, telemac3d, artemis, tomawac, sisyphe, artemis, postel3d, ...) @return None """ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Reads config file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('\n\nLoading Options and Configurations\n' + 72 * '~' + '\n') if module is None: parser = ArgumentParser( formatter_class=RawDescriptionHelpFormatter, description=('''\n runcode is the execution launcher for all TELEMAC modules.\n where module can be:\n mascaret the 1D hydrodyanmic / tracer / water quality solver telemac2d the 2D hydrodyanmic / tracer / water quality solver telemac3d the 3D hydrodynamic / tracer / water quality solver artemis the phase resolving wave solver tomawac the 3rd generation wave transformation solver sisyphe the sediment transport and geomorphogical solver stbtel a pre-processor for the modules postel3d a post-processor for telemac3d '''), usage=' (--help for help)\n---------\n => ' '%(prog)s module [options] casfile(s)\n---------', epilog=('''\nexamples:\n--------- 1: => runcode.py telemac2d -s t2d.cas ---------''')) parser.add_argument("module", default=None, choices=[ 'telemac2d', 'telemac3d', 'artemis', 'tomawac', 'stbtel', 'postel3d', 'sisyphe', 'partel', 'estel3d', 'mascaret' ]) else: parser = ArgumentParser(formatter_class=RawDescriptionHelpFormatter, description=('''\n %(prog)s is one of the execution launcher for the TELEMAC system. '''), epilog=('''\nexamples:\n--------- 1: => %(prog)s -s t2d.cas ---------''')) parser.set_defaults(module=module) parser = add_runcode_argument(parser, module=module) # Arguments parser.add_argument("args", metavar='cas file(s)', nargs="+") options = parser.parse_args() # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ update_config(options) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ banners ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ svn_banner(CFGS.get_root()) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Works for one configuration only ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Checking if symlink is available if options.use_link and not check_sym_link(options.use_link): raise TelemacException(\ '\nThe symlink option is only ' 'available on Linux systems. ' 'Remove the option and try again') # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Reads command line arguments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ code_name = options.module cas_files = options.args # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Works for only one configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # bypass errors and carries on options.bypass = False if options.split or options.merge or options.run: if options.w_dir == '': raise TelemacException(\ '\nPlease use option -w (--workdirectory)' ' with either of the options ' '--split, --run or --merge\n') # parsing for proper naming CFGS.compute_execution_info() cfg = CFGS.configs[CFGS.cfgname] print('\n\nRunning your CAS file(s) for:\n' + '~' * 72 + '\n') CFGS.light_dump() if options.w_dir != '': print(' +> directory ' + options.w_dir) options.tmpdirectory = False print('\n\n' + '~' * 72 + '\n') # >>> Check wether the config has been compiled for the runcode if options.compileonly: cfg['REBUILD'] = 1 if code_name not in cfg['MODULES']: raise TelemacException(\ '\nThe code requested is not installed ' 'on this system : {}\n'.format(code_name)) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Reporting errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ xcpts = Messages() # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Run the Code from the CAS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ for cas_file in cas_files: run_study(cas_file, code_name, options) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Reporting errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if xcpts.not_empty(): raise TelemacException(\ '\n\nHummm ... I could not complete ' 'my work.\n{}{}'.format('~'*72, xcpts.except_messages())) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Jenkins' success message ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('\n\nMy work is done\n\n') sys.exit(0)
def main(): """ @brief Main function of validateTELEMAC. """ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~ Handles input arguments options = set_parser() # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ update_config(options) version = CFGS.configs[CFGS.cfgname].get('version', 'trunk') # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ banners ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ svn_banner(CFGS.get_root(), version) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Works for all configurations unless specified ~~~~~~~~~~~~~~~ # Checking if symlink is available if options.use_link and not check_sym_link(options.use_link): raise TelemacException(\ '\nThe symlink option is only available on Linux systems. ' 'Remove the option and try again') # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Forces not to use any Xwindows backend for Jenkins ~~~~~~~~~~ if options.vnv_post: import matplotlib.pyplot as plt plt.switch_backend('agg') # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Reporting errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ xcpts = Messages() # ~~~~ Reporting summary ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if options.notebook: type_valid = 'notebooks' else: type_valid = 'examples' report = Report(options.report_name, type_valid) # ~~~ Running validation cfg = config_corrections(options, CFGS.cfgname) if options.notebook: run_validation_notebooks(options, report, xcpts) else: if options.vnv_mode == 'slurm': run_validation_python_slurm(cfg, options, report, xcpts) else: run_validation_python_mpi(cfg, options, report, xcpts) # Writting report if options.report_name != '': report.write() # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Reporting errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if xcpts.not_empty(): print('\n\nHummm ... I could not complete my work.\n' '{}\n{}'.format('~' * 72, xcpts.except_messages())) sys.exit(1) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Jenkins' success message ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ else: print('\n\nMy work is done\n\n') sys.exit(0)