Skip to content

Commit 5eee5ef

Browse files
committed
Add motors.iocsh to st.cmd files
1 parent c38bfd4 commit 5eee5ef

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

configIOC.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,22 @@ def configureWindows(iocName):
287287
if not ignore:
288288
fh.write(line)
289289

290-
def patchStCmd(iocName):
290+
def includeMotorIocsh(iocName):
291291
#
292-
pass
292+
lineSubstitutions = { '< common.iocsh\n' : '< common.iocsh\n\n< iocsh/motors.iocsh\n',
293+
}
294+
linesToReplace = lineSubstitutions.keys()
295+
296+
for fn in os.listdir('iocBoot/ioc{}'.format(iocName)):
297+
if 'st.cmd' in fn:
298+
with open("iocBoot/ioc{}/{}".format(iocName, fn), 'r') as fh:
299+
contents = fh.readlines()
300+
with open("iocBoot/ioc{}/{}.new".format(iocName, fn), 'w') as fh:
301+
for line in contents:
302+
if line in linesToReplace:
303+
fh.write(lineSubstitutions[line])
304+
else:
305+
fh.write(line)
293306

294307
def main(options):
295308
print(options)
@@ -317,6 +330,9 @@ def main(options):
317330
configureWindows(iocName)
318331
elif (options.os == 'vxWorks'):
319332
configureVxWorks(iocName)
333+
334+
#
335+
includeMotorIocsh(iocName)
320336
else:
321337
print("{} is not an IOC dir".format(cwd))
322338

0 commit comments

Comments
 (0)