diff --git a/Tools/PyUtils/python/MetaReader.py b/Tools/PyUtils/python/MetaReader.py index 3b21d5b33ebd099f31b1db1d2257558f3814fa47..0435fbc9087c934f2d21e2d71f88effb4cb3b48e 100644 --- a/Tools/PyUtils/python/MetaReader.py +++ b/Tools/PyUtils/python/MetaReader.py @@ -22,10 +22,11 @@ regex_cppname = re.compile(r'^([\w:]+)(<.*>)?$') # regex_persistent_class = re.compile(r'^([a-zA-Z]+_p\d+::)*[a-zA-Z]+_p\d+$') regex_persistent_class = re.compile(r'^([a-zA-Z]+(_[pv]\d+)?::)*[a-zA-Z]+_[pv]\d+$') regex_BS_files = re.compile(r'^(\w+):.*((\.D?RAW\..*)|(\.data$))') +regex_URI_scheme = re.compile(r'^([A-Za-z0-9\+\.\-]+)\:') def read_metadata(filenames, file_type = None, mode = 'lite', promote = None, meta_key_filter = [], - unique_tag_info_values = True, ignoreNonExistingFiles=False): + unique_tag_info_values = True, ignoreNonExistingLocalFiles=False): """ This tool is independent of Athena framework and returns the metadata from a given file. :param filenames: the input file from which metadata needs to be extracted. @@ -70,7 +71,7 @@ def read_metadata(filenames, file_type = None, mode = 'lite', promote = None, me if not file_type: if os.path.isfile(filename): - if ignoreNonExistingFiles and gSystem.AccessPathName(filename): # Attention, bizarre convention of return value!! + if ignoreNonExistingLocalFiles and not regex_URI_scheme.match(filename) and gSystem.AccessPathName(filename): # Attention, bizarre convention of return value!! msg.warn('Ignoring not accessible file: {}'.format(filename)) continue @@ -106,7 +107,7 @@ def read_metadata(filenames, file_type = None, mode = 'lite', promote = None, me # ----- retrieves metadata from POOL files ------------------------------------------------------------------# if current_file_type == 'POOL': - if ignoreNonExistingFiles and gSystem.AccessPathName(filename): # Attention, bizarre convention of return value!! + if ignoreNonExistingLocalFiles and not regex_URI_scheme.match(filename) and gSystem.AccessPathName(filename): # Attention, bizarre convention of return value!! msg.warn('Ignoring not accessible file: {}'.format(filename)) continue @@ -309,7 +310,7 @@ def read_metadata(filenames, file_type = None, mode = 'lite', promote = None, me # ----- retrieves metadata from bytestream (BS) files (RAW, DRAW) ------------------------------------------# elif current_file_type == 'BS': - if ignoreNonExistingFiles and not os.path.isfile(filename): + if ignoreNonExistingLocalFiles and not regex_URI_scheme.match(filename) and not os.path.isfile(filename): msg.warn('Ignoring not accessible file: {}'.format(filename)) continue diff --git a/Tools/PyUtils/python/MetaReaderPeeker.py b/Tools/PyUtils/python/MetaReaderPeeker.py index b9c80346ef5f815c22d0cb8589fdcca5a664959c..b6692b686ca4d29feae4a4f435269fcf04b7442c 100644 --- a/Tools/PyUtils/python/MetaReaderPeeker.py +++ b/Tools/PyUtils/python/MetaReaderPeeker.py @@ -33,7 +33,7 @@ def _setup(): msg.warning("No input files specified yet! Cannot do anything.") return - metadata_all_files = read_metadata(inFiles, mode='peeker', promote=True, ignoreNonExistingFiles=True) + metadata_all_files = read_metadata(inFiles, mode='peeker', promote=True, ignoreNonExistingLocalFiles=True) # use first non-empty file first_filename = None diff --git a/Tools/PyUtils/python/MetaReaderPeekerFull.py b/Tools/PyUtils/python/MetaReaderPeekerFull.py index ac8bce15e4ae53e5ae8662ae89310a9200287633..40d9de0b7170dc0dd08cc2337de44b1f7b5ff153 100644 --- a/Tools/PyUtils/python/MetaReaderPeekerFull.py +++ b/Tools/PyUtils/python/MetaReaderPeekerFull.py @@ -34,7 +34,7 @@ def _setup(): msg.warning("No input files specified yet! Cannot do anything.") return - metadata_all_files = read_metadata(inFiles, mode='full', ignoreNonExistingFiles=True) + metadata_all_files = read_metadata(inFiles, mode='full', ignoreNonExistingLocalFiles=True) first_filename = inFiles[-1] # take only the last input file from the infiles