Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:31

0001 #! /usr/bin/env python3
0002 
0003 # A Pyrelval Wrapper
0004 
0005 def run():
0006         import sys
0007         import os
0008         import Configuration.Applications
0009         from Configuration.Applications.ConfigBuilder import ConfigBuilder
0010         from Configuration.Applications.cmsDriverOptions import OptionsFromCommandLine
0011         options = OptionsFromCommandLine()
0012         
0013         # after cleanup of all config parameters pass it to the ConfigBuilder
0014         configBuilder = ConfigBuilder(options, with_output = True, with_input = True)
0015 
0016         configBuilder.prepare()
0017         # fetch the results and write it to file
0018         config = open(options.python_filename,"w")
0019         config.write(configBuilder.pythonCfgCode)
0020         config.close()
0021 
0022         # handle different dump options
0023         if options.dump_python:
0024             status_code = os.system('edmConfigDump -o {f} {f}'.format(f=options.python_filename))
0025             if status_code: sys.exit(status_code)
0026             print("Expanded config file", options.python_filename, "created")
0027             sys.exit(0)           
0028   
0029         if options.no_exec_flag:
0030             print("Config file "+options.python_filename+ " created")
0031             sys.exit(0)
0032         else:
0033             commandString = options.prefix+" cmsRun "+options.suffix
0034             print("Starting "+commandString+' '+options.python_filename)
0035             commands = commandString.lstrip().split()
0036             sys.stdout.flush()
0037             os.execvpe(commands[0],commands+[options.python_filename],os.environ)
0038             sys.exit()
0039 
0040 run()