58def find_file(pattern, max_files=1):
60 Bash inline command frequently used in multi-step tests
61 to pass the output of one step to the input of another
62 based on a name pattern rather than a fixed full file name.
64 By default only the first match is returned. Set max_files
65 to None to return all matches (as space separated list).
67 cmd = f'find . -name \'{pattern}\''
68 if max_files is not None:
69 cmd += f' | tail -n {max_files}'
73def find_file_in_path(filename, path_env_var):
74 '''Find filename in search path given by environment variable'''
76 # same as AthenaCommon.unixtools.FindFile but don't want AthenaCommon dependency
77 for path in os.environ[path_env_var].split(os.pathsep):
78 f = os.path.join( path, filename )
79 if os.access(f, os.R_OK):