def run(self, cfg, flags, args): output = target.flag(flags, "-o", "-") if ("--join", "") in flags: if len(args) < 1: raise target.ArgError() ifs = [parse(x) for x in args] result = ifs[0] for x in ifs[1:]: interface.joinInterfaces(result, x) else: # This is computing the interface if len(args) < 1: raise target.ArgError() if args[0] == "@*": iface = None else: iface = parse(args[0]) libs = args[1:] if "--deep" in flags: result = deep(libs, iface) else: result = shallow(libs, iface) interface.writeInterface(result, output) return 0
def shallow(libs, iface): tf = tempfile.NamedTemporaryFile(suffix=".iface", delete=False) tf.close() if not (iface is None): interface.writeInterface(iface, tf.name) else: iface = interface.emptyInterface() for l in libs: passes.interface(l, tf.name, [tf.name], quiet=True) x = interface.parseInterface(tf.name) interface.joinInterfaces(iface, x) tf.unlink(tf.name) return iface