Example #1
0
def main():
    # Get list
    list = utils.getCfPVlist('/cf-update', 'xf23id?-ioc1.va-01.dbl')
    list = utils.applyRegexToList(list, ['^XF:23ID(A|1|2)*-VA', '.*(?<!_)$'])

    caf = files.CAFile('engine.xml')

    group_a = caf.findGroup('23IDA')
    list_a = utils.applyRegexToList(list, ['^XF:23IDA', '^((?!RGA).)*$'])
    for pv in list_a:
        group_a.addPV(pv)

    group_1 = caf.findGroup('23ID1')
    list_1 = utils.applyRegexToList(list, ['^XF:23ID1', '^((?!RGA).)*$'])
    for pv in list_1:
        group_1.addPV(pv)

    group_2 = caf.findGroup('23ID2')
    list_2 = utils.applyRegexToList(list, ['^XF:23ID2', '^((?!RGA).)*$'])
    for pv in list_2:
        group_2.addPV(pv)

    #group_3 = caf.findGroup('23ID')
    #list_3 = utils.applyRegexToList(list, '^XF:23ID')
    #for pv in list_3:
    #  group_3.addPV(pv)

    caf.writeFile('engine.xml')
Example #2
0
def make_engine_config(args=None):
    args = parser.parse_args(args)
    outfile = ''

    # if no destination file is indicated, use './engine.xml'
    if args.destination is None:
        print 'No destination directory provided. Defaulting to \'./\''
        outfile = chk_engine_file('.')
    else:
        outfile = chk_engine_file(args.destination)

    cafile = files.CAFile(outfile)
    #prepare pv source-file
    src_path = ''
    src_pattern = ''
    if args.source.find(path.sep) < 0:
        src_path, src_pattern = path.curdir + path.sep, args.source
    else:
        src_path, src_pattern = path.split(args.source)
    pvlist = utils.getCfPVlist(src_path, src_pattern)

    #if xml 'group' does not exist, add it to the destination file
    group = cafile.findGroup(args.group)
    if group is None:
        group = cafile.createGroup(args.group)
    [group.addPV(pv) for pv in utils.applyRegexToList(pvlist, args.regex)]

    cafile.writeFile(outfile)
def make_engine_config(args=None):
    args = parser.parse_args(args)
    outfile  = ''

    # if no destination file is indicated, use './engine.xml'
    if args.destination is None:
        print 'No destination directory provided. Defaulting to \'./\''
        outfile = chk_engine_file('.')
    else:
        outfile = chk_engine_file(args.destination)

    cafile = files.CAFile(outfile)
    #prepare pv source-file
    src_path = ''
    src_pattern = ''
    if args.source.find(path.sep) < 0:
        src_path,src_pattern = path.curdir + path.sep, args.source
    else: 
        src_path, src_pattern = path.split(args.source)
    pvlist = utils.getCfPVlist(src_path, src_pattern)

    #if xml 'group' does not exist, add it to the destination file 
    group = cafile.findGroup(args.group)
    if group is None:
        group = cafile.createGroup(args.group)
    [group.addPV(pv) for pv in utils.applyRegexToList(pvlist, args.regex)]

    cafile.writeFile(outfile)        
def main():
  # Get list
  list = utils.getCfPVlist('/cf-update','xf23id?-ioc1.va-01.dbl')
  list = utils.applyRegexToList(list, ['^XF:23ID(A|1|2)*-VA', '.*(?<!_)$'])

  caf = files.CAFile('engine.xml')
 
  group_a = caf.findGroup('23IDA')
  list_a = utils.applyRegexToList(list, ['^XF:23IDA', '^((?!RGA).)*$'])
  for pv in list_a:
    group_a.addPV(pv)

  group_1 = caf.findGroup('23ID1')
  list_1 = utils.applyRegexToList(list, ['^XF:23ID1','^((?!RGA).)*$'])
  for pv in list_1:
    group_1.addPV(pv)

  group_2 = caf.findGroup('23ID2')
  list_2 = utils.applyRegexToList(list, ['^XF:23ID2','^((?!RGA).)*$'])
  for pv in list_2:
    group_2.addPV(pv)

  #group_3 = caf.findGroup('23ID')
  #list_3 = utils.applyRegexToList(list, '^XF:23ID')
  #for pv in list_3:
  #  group_3.addPV(pv)

  caf.writeFile('engine.xml')