Esempio n. 1
0
 def __getitem__(self, key):
     if self.recur.has_key(key):
         return ""
     self.recur[key] = True
     try:
         value = expandMacros(self.macros[key], self)
     finally:
         del self.recur[key]
     return value
Esempio n. 2
0
 def macroString(self, trait):
     from pyre.util import expandMacros
     class InventoryAdapter(object):
         def __init__(self, inventory):
             self.inventory = inventory
         def __getitem__(self, key):
             return expandMacros(str(self.inventory.getTraitValue(key)), self)
     descriptor = self.inventory.getTraitDescriptor(trait.name)
     return expandMacros(descriptor.value, InventoryAdapter(self.inventory))
Esempio n. 3
0
 def __setitem__(self, trait, value):
     locator = locators.file(self.fp.name, self.fp.lineno)
     path = trait.split('.')
     key = path[-1]
     path = path[:-1]
     node = _getNode(self.node, path)
     value = expandMacros(value, self.macros)
     node.setProperty(key, value, locator)
     dict.__setitem__(self, key, value)
Esempio n. 4
0
 def __getitem__(self, key):
     if self.recur.has_key(key):
         return ""
     self.recur[key] = True
     try:
         value = expandMacros(self.macros[key], self)
     finally:
         del self.recur[key]
     return value
Esempio n. 5
0
    def _expandNodeListArgs(self, args):
        from pyre.util import expandMacros

        machinefile = self.machinefile
        nodegen = self.nodegen
        file = open(machinefile, "w")
        for node in self.nodelist:
            file.write((nodegen + '\n') % node)
        file.close()

        substitutions = {
            'launcher.machinefile': machinefile,
        }
        for i, arg in enumerate(args):
            args[i] = expandMacros(arg, substitutions)

        return
Esempio n. 6
0
    def _expandNodeListArgs(self, args):
        from pyre.util import expandMacros
        
        machinefile = self.machinefile
        nodegen = self.nodegen
        file = open(machinefile, "w")
        for node in self.nodelist:
            file.write((nodegen + '\n') % node)
        file.close()

        substitutions = {
            'launcher.machinefile': machinefile,
            }
        for i,arg in enumerate(args):
            args[i] = expandMacros(arg, substitutions)

        return
Esempio n. 7
0
 def __getitem__(self, key):
     return expandMacros(str(self.inventory.getTraitValue(key)), self)
Esempio n. 8
0
 def expandMacros(self, value):
     return expandMacros(value, self.rp)
Esempio n. 9
0
 def expandMacros(self, value):
     return expandMacros(value, self.rp)