Changeset 2e0a952
- Timestamp:
- May 17, 2010 6:12:04 AM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 4a53c72
- Parents:
- f00fb7d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/compose.py
rf00fb7d r2e0a952 255 255 return (top, marks) 256 256 257 def import_topdl_component(fn): 258 top = topdl.topology_from_xml(filename=fn, top='experiment') 259 marks = { } 260 for e in [ e for e in top.elements if isinstance(e, topdl.Computer)]: 261 if e.get_attribute('composition_point'): 262 r = e.get_attribute('required') or 'false' 263 a = e.get_attribute('accepts') 264 p = e.get_attribute('provides') 265 if a and p: 266 c = constraint(name=e.name, required=(r == 'required'), 267 provides=p.split(','), accepts=a.split(',')) 268 marks[e.name] = c 269 return (top, marks) 270 257 271 def index_constraints(constraints, provides, accepts): 258 272 """ … … 319 333 provides = { } 320 334 accepts = { } 335 imp = ( (('.tcl', '.ns'), import_ns2_component), 336 (('.xml', '.topdl'), import_topdl_component), 337 ) 321 338 for fn, cnt in files: 322 339 try: 323 top, marks = import_ns2_component(fn) 340 for suffix, importer in imp: 341 if fn.endswith(suffix): 342 top, marks = importer(fn) 343 break 344 else: 345 print >>sys.stderr, "Unknown suffix on file %s. Ignored" % fn 346 continue 324 347 except service_error, e: 325 348 print >>sys.stderr, "Remote error on %s: %s" % (fn, e)
Note: See TracChangeset
for help on using the changeset viewer.