Back to home page

Project CMSSW displayed by LXR

 
 

    


Warning, /FWCore/ParameterSet/scripts/edmConfigDump is written in an unsupported language. File is not indexed.

0001 #! /usr/bin/env python3
0002 
0003 import sys
0004 import os 
0005 import argparse
0006 from FWCore.ParameterSet.processFromFile import processFromFile
0007 
0008 # make the behaviour of 'cmsRun file.py' and 'edmConfigDump file.py' more consistent
0009 sys.path.append(os.getcwd())
0010 
0011 parser = argparse.ArgumentParser(description="Expand python configuration")
0012 parser.add_argument("filename",
0013                     help="Python configuration file")
0014 parser.add_argument("--prune", action="store_true",
0015                     help="Prune the configuration before printing it")
0016 parser.add_argument("--pruneVerbose", action="store_true",
0017                     help="With --prune, be verbose on what is pruned")
0018 parser.add_argument("-o", "--output", type=str, default=None,
0019                     help="Save the configuration dump into this file. In this case any printouts from the configuration continue to be printed to stdout. Default is to print the configuration dump to stdout.")
0020 parser.add_argument("configArgs",
0021                     nargs=argparse.REMAINDER, help="arguments that will be passed to Python configuration file")
0022 
0023 options = parser.parse_args()
0024 cmsProcess = processFromFile(options.filename, options.configArgs)
0025 
0026 if options.prune:
0027     cmsProcess.prune(options.pruneVerbose)
0028 
0029 if options.output is not None:
0030     with open(options.output, "w") as f:
0031         f.write(cmsProcess.dumpPython())
0032 else:
0033     print(cmsProcess.dumpPython())
0034