Skip to content
Snippets Groups Projects
Commit 6931ed0f authored by Rolf Bork's avatar Rolf Bork
Browse files

Merge branch 'post-build-ws' into 'master'

post_build_script white space clean up

See merge request cds/advligorts!43
parents f13c4efd d01ef31c
No related branches found
No related tags found
No related merge requests found
......@@ -68,7 +68,7 @@ rcg_lib_path = os.path.join('/opt/rtcds',site,ifo.lower(),'core/release/src/epic
medm_target = os.path.join('/opt/rtcds',site,ifo.lower(),'medm',model_name)
cds_medm_path = '/'.join(['/opt/rtcds',site,ifo.lower(),'medm/templates/'])
cds_medm_path = '/'.join(['/opt/rtcds',site,ifo.lower(),'medm/templates/'])
cds_scripts_path = '/'.join(['/opt/rtcds',site,ifo.lower(),'/scripts/post_build/'])
tmp = model_name + 'epics/burt'
......@@ -104,7 +104,7 @@ except KeyError:
sys.stderr.write(medm_target + "\n\n")
#Get the actual model file
full_model_path = find_file_in_path(rcg_lib_path,model_name + '.mdl')
full_model_path = find_file_in_path(rcg_lib_path,model_name + '.mdl')
#An object that contains all the Name "C1SY", Descrption "Blah, blah" in a dictionary
#Also contains a subarray of blocks underneath it
......@@ -112,7 +112,7 @@ class Block:
def __init__(self):
self.data = {}
self.subblocks = []
#Parses a "block" of an .mdl file and returns the corresponding Block structure along with the last line number parsed
def parse_block(data_lines,line_number,reference_name):
new_block = Block()
......@@ -147,7 +147,7 @@ def parse_block(data_lines,line_number,reference_name):
except KeyError:
pass
new_block.subblocks.append(temp_block)
#We have just a line with data
#We have just a line with data
else:
new_data_entry = data_lines[line_number]
#Handle the case of descriptions/inputs which are multiple lines, with 2nd and later starting with '"'.
......@@ -235,7 +235,7 @@ def find_library(library_name):
sys.stderr.write("Could not open reference file: " + reference_file_name + "\n")
sys.stderr.write("Exiting\n")
sys.exit(1)
return reference_file.readlines()
return reference_file.readlines()
sys.stderr.write("ERROR: For part referencing: " + library_name + "\n")
sys.stderr.write("Could not find reference file: " + reference_file_name + "\n")
sys.stderr.write("Exiting\n")
......@@ -269,7 +269,7 @@ def read_tree(node,name_so_far):
name_so_far = name_so_far + (node.data['Name'].strip('"'),)
else:
name_so_far = name_so_far + (node.data['Name'].strip('"'),)
chan_name = ''
part_name = ''
if (len(name_so_far) == 0):
......@@ -285,7 +285,7 @@ def read_tree(node,name_so_far):
chan_name = '_'.join((temp_name,) + name_so_far[2:len(name_so_far)])
temp_name = ifo.upper() + name_so_far[0]
part_name = '_'.join((temp_name,) + name_so_far[1:len(name_so_far)])
#Arrays containing lines with keywords at the beginning of the line
new_script_line = []
new_adl_line = []
......@@ -302,7 +302,7 @@ def read_tree(node,name_so_far):
if (re.search('^ADL=',line) != None):
new_adl_line.append(re.search('^ADL=(.*)',line).group(1))
if (re.search('^NO DEFAULT',line) != None):
make_library_screens = False
make_library_screens = False
print("No default screens")
if ('Reference_Descrip' in node.data) and (make_library_screens):
......@@ -312,7 +312,7 @@ def read_tree(node,name_so_far):
script_line.append(re.search('^SCRIPT=(.*)',line).group(1))
if (re.search('^ADL=',line) != None):
adl_line.append(re.search('^ADL=(.*)',line).group(1))
if new_script_line != []:
for script_entry in new_script_line:
script_line.append(script_entry)
......@@ -323,7 +323,7 @@ def read_tree(node,name_so_far):
dict_of_params = {}
list_of_params = model_params.split('\\n')
for param in list_of_params:
try:
try:
dict_of_params[param.split('=')[0]] = param.split('=')[1]
except:
pass
......@@ -355,7 +355,7 @@ def read_tree(node,name_so_far):
script_command = script_location + script[len(script_name):]
print(script_command)
os.system(script_command)
for adl in adl_line:
custom_subs = []
adl_info = adl.strip().split(',')
......@@ -422,7 +422,7 @@ def read_tree(node,name_so_far):
read_tree(node, name_so_far)
############################
############################
#Start of the actual program
#Very first block, which will have the system name associated with it.
......@@ -460,33 +460,31 @@ model_params = find_cdsParam(root_block)
#Do something fancy with top names now
read_tree(root_block,(model_name[2:5].upper(),))
if os.path.isfile(epics_sdf_file):
print('safe.snap exists ')
print('safe.snap exists ')
else:
print('Creating safe.snap file')
f = open(epics_burt_file,'r')
sdf = open(epics_sdf_file,'w')
for line in f:
if '.HSV' in line or '.LSV' in line or '.HIGH' in line or '.LOW' in line or '.OSV' in line or '.ZSV' in line:
continue
word = line.split()
if word[0] == 'RO':
continue
elif '_SW1S' in word[0]:
tmp = word[0] + ' 1 4.000000000000000e+00 0xffffffff \n'
sdf.write(tmp)
elif '_SW2S' in word[0]:
tmp = word[0] + ' 1 1.536000000000000e+03 0xffffffff \n'
sdf.write(tmp)
elif '_BURT_RESTORE' in word[0]:
tmp = word[0] + ' 1 1.000000000000000e+00 1 \n'
sdf.write(tmp)
elif '_DACDT_ENABLE' in word[0]:
tmp = word[0] + ' 1 OFF 1 \n'
sdf.write(tmp)
else:
tmp = word[0] + ' 1 1.000000000000000e+00 1 \n'
sdf.write(tmp)
f.close()
sdf.close()
print('Creating safe.snap file')
f = open(epics_burt_file,'r')
sdf = open(epics_sdf_file,'w')
for line in f:
if '.HSV' in line or '.LSV' in line or '.HIGH' in line or '.LOW' in line or '.OSV' in line or '.ZSV' in line:
continue
word = line.split()
if word[0] == 'RO':
continue
elif '_SW1S' in word[0]:
tmp = word[0] + ' 1 4.000000000000000e+00 0xffffffff \n'
sdf.write(tmp)
elif '_SW2S' in word[0]:
tmp = word[0] + ' 1 1.536000000000000e+03 0xffffffff \n'
sdf.write(tmp)
elif '_BURT_RESTORE' in word[0]:
tmp = word[0] + ' 1 1.000000000000000e+00 1 \n'
sdf.write(tmp)
elif '_DACDT_ENABLE' in word[0]:
tmp = word[0] + ' 1 OFF 1 \n'
sdf.write(tmp)
else:
tmp = word[0] + ' 1 1.000000000000000e+00 1 \n'
sdf.write(tmp)
f.close()
sdf.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment