86 basedir = os.path.abspath(indir)
88 print (
'Looking for configurations in subdirectories of', indir)
90 types = [
'minutes10',
'minutes30',
'run']
91 searchparams = [(
'Cosmics',
'cosmics'), (
'Collisions',
'collisions'),
92 (
'HeavyIons',
'heavyions')]
97 for dir1, fn
in searchparams:
99 filepathdict[dir1] = {}
101 print (
' ', t,
'...',)
102 fname = os.path.join(basedir, dir1,
103 '%s_%s.current.hcfg' % (fn, t))
104 if os.access(fname, os.R_OK):
106 if os.path.islink(fname)
and os.path.isfile(fname):
107 realname = os.readlink(fname)
108 if not os.path.isabs(realname):
109 realname = os.path.join(os.path.dirname(fname), realname)
110 print (
'is symlink to', realname)
111 filepathdict[dir1][t] = realname
112 filelist.append(realname)
114 print (
'but is not valid symlink')
117 if filepathdict[dir1] == {}:
118 del filepathdict[dir1]
120 commonpart = os.path.dirname(os.path.commonprefix(filelist)) + os.sep
122 filepathdict[
'basename'] = commonpart
125 for dir1, fn
in searchparams:
128 filepathdict[dir1][t] = filepathdict[dir1][t].
replace(commonpart,
'')
133 print (
'-------------------------------------')
134 print (
'File path dictionary to upload:')
136 print (
'-------------------------------------')
139 val = updict.get(
'phconfig', {})
140 if isinstance(val, str):
142 val[
'filepaths'] = filepathdict
143 updict[
'phconfig'] =
'"%s"' % val