Ignore:
Timestamp:
May 25, 2010 9:25:58 AM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
75720ab
Parents:
d38ff56
Message:

parse services from file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/fedd_create.py

    rd38ff56 rb10375f  
    22
    33import sys
     4import re
    45
    56from federation.remote_service import service_caller
     
    7475
    7576# Main line
     77service_re = re.compile('^\\s*#\\s*SERVICE:\\s*([\\S]+)')
    7678parser = fedd_create_opts()
    7779(opts, args) = parser.parse_args()
     
    8284if opts.file:
    8385    try:
    84         exp_desc = "".join([ line for line in open(opts.file, 'r')])
     86        lines = [ line for line in open(opts.file, 'r')]
     87        exp_desc = "".join(lines)
    8588    except EnvironmentError:
    8689        sys.exit("Cannot read description file (%s)" %opts.file)
     
    9598    svcs.append(project_export_service(opts.master, opts.project))
    9699svcs.extend([ parse_service(s) for s in opts.service])
     100# Parse all the strings that we can pull out of the file using the service_re.
     101svcs.extend([parse_service(service_re.match(l).group(1)) \
     102        for l in lines if service_re.match(l)])
     103
    97104if not svcs:
    98105    print >>sys.stderr, "Warning:Neither master/project nor services requested"
Note: See TracChangeset for help on using the changeset viewer.