3 from future
import standard_library
4 standard_library.install_aliases()
6 from PyDumper.Dumpers
import get_dumper_fct
7 from AthenaPython
import PyAthena
8 from PyUtils.fprint
import fprintln
10 if (
'ATLAS_REFERENCE_TAG' not in globals()
and
11 'ATLAS_REFERENCE_TAG' in os.environ):
12 ATLAS_REFERENCE_TAG = os.environ[
'ATLAS_REFERENCE_TAG']
17 path = os.path.join (p, fname)
18 if os.path.exists (path):
20 print (
'ERROR: Cannot find file: ', fname)
30 for l
in output.split (
'\n'):
32 if l.startswith (
'+++')
or l.startswith (
'---'):
continue
33 if l[0] ==
'-':
return None
36 if l.startswith (
'+ ')
and pos > 0:
46 def __init__ (self, name, inputFile, Keys, refpaths):
47 PyAthena.Alg.__init__ (self, name)
54 self.
sg = PyAthena.py_svc (
'StoreGateSvc')
56 refbase = os.path.basename (self.
infile) +
'.ref'
61 if not os.path.exists (self.
reffile_name)
and 'ATLAS_REFERENCE_TAG' in globals():
62 from AthenaCommon.Utils.unixtools
import find_datafile
63 r = find_datafile (ATLAS_REFERENCE_TAG)
65 self.
reffile_name = os.path.join (r, ATLAS_REFERENCE_TAG,
68 if not os.path.exists (self.
reffile_name)
and 'ATLAS_REFERENCE_TAG' in globals():
69 self.
reffile_name = find_file (os.path.join (ATLAS_REFERENCE_TAG,
80 newvars = checknewvars (output)
82 print (
'WARNING: new xAOD variables ', newvars)
84 print (
'ERROR running diff with reference')
95 nmax = int (k[apos+1:])
97 fprintln (self.
ofile,
'-->', k)
102 store = PyAthena.py_svc (k[:spos])
107 (typ, k) = k.split (
'#')
108 o = store.retrieve (typ, k)
111 dumper = get_dumper_fct (type (o), self.
ofile, nmax = nmax)
113 fprintln (self.
ofile,
'\n')