Skip to content
Snippets Groups Projects
AutoConfigFlags.py 710 B
Newer Older
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
from PyUtils.MetaReader import read_metadata
Walter Lampl's avatar
Walter Lampl committed

#Module level cache of file-metadata:
_fileMetaData=dict()

def GetFileMD(filenames):
    from AthenaCommon.Logging import logging
    msg = logging.getLogger('AutoConfigFlags')
Walter Lampl's avatar
Walter Lampl committed
    filename=filenames[0]
    if filename not in _fileMetaData:
Walter Lampl's avatar
Walter Lampl committed
        if len(filenames)>1:
            msg.info("Multiple input files. Use the first one for auto-configuration")
        msg.info("Obtaining metadata of auto-configuration by peeking into %s", filename)


        thisFileMD=read_metadata(filename,None,'peeker')
Walter Lampl's avatar
Walter Lampl committed
        _fileMetaData.update(thisFileMD)

    return _fileMetaData[filename]