def run(self): syms = {} for x in self.inputs: slist = eval(x.read()) for s in slist: syms[s] = 1 lsyms = list(syms.keys()) lsyms.sort() if self.env.DEST_BINFMT == 'pe': self.outputs[0].write('EXPORTS\n' + '\n'.join(lsyms)) elif self.env.DEST_BINFMT == 'elf': self.outputs[0].write('{ global:\n' + ';\n'.join(lsyms) + ";\nlocal: *; };\n") else: raise WafError('NotImplemented')
def get_lv2_base(bld, kw, nframes=3): try: lv2_base = kw['lv2_base'] except KeyError: pass else: return lv2_base, '${LV2DIR}/%s.lv2' % lv2_base cf = inspect.currentframe() for i in range(nframes): cf = cf.f_back fi = inspect.getframeinfo(cf) fn = bld.root.make_node(fi.filename).srcpath() raise WafError( '{}[{}]: lv2_base not set in lv2 task generator:\n{}'.format( fn, fi.lineno, pprint.pformat(kw)))
def register_darwin_external_ly_metrics(ctx, configuration): # Do not regsiter as an external library if the source exists if os.path.exists(ctx.Path('Code/Tools/LyMetrics/wscript')): return platform = 'mac' if configuration not in ('Debug', 'Release'): raise WafError("Invalid configuration value {}", configuration) target_platform = 'darwin' ly_identity_base_path = ctx.CreateRootRelativePath( 'Tools/InternalSDKs/LyMetrics') include_path = os.path.join(ly_identity_base_path, 'include') stlib_path = os.path.join(ly_identity_base_path, 'lib', platform, configuration) shlib_path = os.path.join(ly_identity_base_path, 'bin', platform, configuration) ctx.register_3rd_party_uselib( 'LyMetricsShared_shared', target_platform, includes=[include_path], defines=['LINK_LY_METRICS_DYNAMICALLY'], importlib=['libLyMetricsShared_shared.dylib'], sharedlibpath=[shlib_path], sharedlib=['libLyMetricsShared_shared.dylib']) ctx.register_3rd_party_uselib('LyMetricsShared_static', target_platform, includes=[include_path], libpath=[stlib_path], lib=['libLyMetricsShared_static.a']) ctx.register_3rd_party_uselib( 'LyMetricsProducer_shared', target_platform, includes=[include_path], defines=['LINK_LY_METRICS_PRODUCER_DYNAMICALLY'], importlib=['libLyMetricsProducer_shared.dylib'], sharedlibpath=[shlib_path], sharedlib=['libLyMetricsProducer_shared.dylib']) ctx.register_3rd_party_uselib('LyMetricsProducer_static', target_platform, includes=[include_path], libpath=[stlib_path], lib=['libLyMetricsProducer_static.a'])
def do_the_symbol_stuff(self): tsk = self.create_task('compile_sym', [self.path.find_node(self.export_symbols_def)], self.path.find_or_declare(getattr(self, 'sym_filename', self.target + '.def'))) self.link_task.set_run_after(tsk) self.link_task.dep_nodes.append(tsk.outputs[0]) if 'msvc' in (self.env.CC_NAME, self.env.CXX_NAME): self.link_task.env.append_value('LINKFLAGS', ['/def:' + tsk.outputs[0].bldpath()]) elif self.env.DEST_BINFMT == 'pe': #gcc on windows takes *.def as an additional input self.link_task.inputs.append(tsk.outputs[0]) elif self.env.DEST_BINFMT == 'elf': self.link_task.env.append_value('LINKFLAGS', ['-Wl,-version-script', '-Wl,' + tsk.outputs[0].bldpath()]) elif self.env.DEST_BINFMT == 'mac-o': self.link_task.env.append_value('LINKFLAGS', ['-exported_symbols_list', tsk.outputs[0].bldpath()]) else: raise WafError('NotImplemented')
def run(self): syms = {} for x in self.inputs: slist = eval(x.read()) for s in slist: syms[s] = 1 lsyms = list(syms.keys()) lsyms.sort() if self.env.DEST_BINFMT == "pe": self.outputs[0].write("EXPORTS\n" + "\n".join(lsyms)) elif self.env.DEST_BINFMT == "elf": self.outputs[0].write("{ global:\n" + ";\n".join(lsyms) + ";\nlocal: *; };\n") elif self.env.DEST_BINFMT == "mac-o": self.outputs[0].write("\n".join(lsyms) + "\n") else: raise WafError("NotImplemented")
def get_run_program(program_string, command_template=None): env = bld.env if command_template in (None, '%s'): argv = shlex.split(program_string) program_name = argv[0] try: program_obj = find_program(program_name, env) except ValueError, ex: raise WafError(str(ex)) program_node = program_obj.path.find_or_declare(program_obj.target) execvec = [program_node.abspath()] + argv[1:]
def compatible(self, text): """Checks the lines of text and yields all of them that have compatible version markers, all markers removed.""" programs = set() for line in text: match = self.marker.search(line) if match: program = match.group("program") programs.add(program) try: if self.operators[match.group("operator")]( self.get_version(program), version(match.group("version"))): yield self.marker.sub('', line) except TypeError: raise WafError('version missing for program ' + program) else: yield line self.generator.bld.raw_deps[self.uid()] = programs
def outFileName(ctx, inp, lang, absPath=False): fileparts = getFileParts(ctx, inp) def defaultOutFileName(fileparts, absPath): ret = "" if absPath: if fileparts[3] != "": ret = fileparts[3] if fileparts[1] != "": if ret != "": ret = ret + "/" ret = ret + '/'.join(fileparts[1].split('.')) if fileparts[2] != "": if ret != "": ret = ret + "/" ret = ret + fileparts[2] return ret if lang == 'zcm': return defaultOutFileName(fileparts, absPath) if lang == 'c': hfileparts = fileparts[:] cfileparts = fileparts[:] hfileparts[2] = fileparts[2].replace('.zcm', '.h') cfileparts[2] = fileparts[2].replace('.zcm', '.c') if fileparts[1] != "": hfileparts[2] = '_'.join( fileparts[1].split('.')) + "_" + hfileparts[2] cfileparts[2] = '_'.join( fileparts[1].split('.')) + "_" + cfileparts[2] return [ defaultOutFileName(hfileparts, absPath).replace('.zcm', '.h'), defaultOutFileName(cfileparts, absPath).replace('.zcm', '.c') ] if lang == 'cpp': return defaultOutFileName(fileparts, absPath).replace('.zcm', '.hpp') if lang == 'python': return defaultOutFileName(fileparts, absPath).replace('.zcm', '.py') raise WafError('This should not be possible')
def scan(task): try: incn = task.generator.includes_nodes except AttributeError: raise WafError('%r is missing a feature such as "go" or "includes": ' % task.generator) # filter out nodes that are not in the project directory, we don't care # about these nodepaths = [ x for x in incn if x.is_child_of(x.ctx.bldnode) or x.is_child_of(x.ctx.srcnode) ] bldnode = task.generator.bld.bldnode deps = [] for input in task.inputs: file = Utils.readf(input.abspath()) try: gp = GoParser(file) gp.parse() except ParserError: pass for s in gp.statements: if not isinstance(s, ImportSpec): continue # TODO: global paths should be treated as local too, but # no one uses them? if s.path.startswith("./") or s.path.startswith("../"): node = find_local(s.path, bldnode) else: node = find_global(s.path, nodepaths) if node: deps.append(node) return (deps, None)
def runnable_status(self): gen = self.generator inp = self.inputs[0] bldpath = gen.path.get_bld().abspath() files = outFileNames(gen.bld, bldpath, inp.abspath(), pkgPrefix=gen.pkgPrefix, javapkg=gen.javapkg, juliapkg=gen.juliapkg, lang=gen.lang) for f in files: out_node = gen.path.find_or_declare(f) self.outputs.append(out_node) if not self.outputs: raise WafError( 'No ZCMtypes generated, ensure a valid lang is specified') return super(zcmgen, self).runnable_status()
def apply_ns3moduleheader(self): ## get all of the ns3 headers ns3_dir_node = self.bld.path.find_or_declare("ns3") all_headers_inputs = [] found_the_module = False for ns3headers in self.bld.all_task_gen: if 'ns3header' in getattr(ns3headers, "features", []): if ns3headers.module != self.module: continue found_the_module = True for source in sorted(ns3headers.headers): source = os.path.basename(source) node = ns3_dir_node.find_or_declare(os.path.basename(source)) if node is None: fatal("missing header file %s" % (source,)) all_headers_inputs.append(node) if not found_the_module: raise WafError("error finding headers for module %s" % self.module) if not all_headers_inputs: return try: module_obj = self.bld.get_tgen_by_name("ns3-" + self.module) except WafError: # maybe the module was disabled, and therefore removed return all_headers_outputs = [ns3_dir_node.find_or_declare("%s-module.h" % self.module)] task = self.create_task('gen_ns3_module_header') task.module = self.module task.mode = getattr(self, "mode", "install") if task.mode == 'install': assert module_obj is not None, self.module self.bld.install_files('${INCLUDEDIR}/%s%s/ns3' % (wutils.APPNAME, wutils.VERSION), ns3_dir_node.find_or_declare("%s-module.h" % self.module)) task.set_inputs(all_headers_inputs) task.set_outputs(all_headers_outputs) task.module_deps = module_obj.module_deps else: task.header_to_remove = all_headers_outputs[0]
def configure(cfg): if not cfg.options.cpu: raise WafError('Missing option CPU type not provided') cfg.env.ISIX_CPU_TYPE = cfg.options.cpu cflags = _get_flag(cfg.options.cpu, 'cflags') + _cflags if cfg.options.debug == True: cfg.env.ASFLAGS += ['-gstabs'] cflags += _cflags_debug cfg.env.DEFINES += ['PDEBUG'] else: cflags += _cflags_ndebug cfg.env.LDFLAGS = _ldflags_ndebug optflag = ['-O%s' % cfg.options.optimize] cfg.env.CFLAGS += cflags + \ ['-std=gnu11', '-Werror=implicit-function-declaration' ] + optflag cfg.env.CXXFLAGS += cflags + ['-std=gnu++17'] + optflag cfg.env.ASFLAGS += cflags + ['-Wa,-mapcs-32'] + optflag cfg.env.DEFINES += _get_flag(cfg.options.cpu, 'defs') cfg.env.LDFLAGS += ['-nostdlib', '-nostartfiles'] + cflags + optflag if cfg.options.disable_isix == True: cfg.env.DEFINES += ['CONFIG_ISIX_WITHOUT_KERNEL=1'] if cfg.options.disable_exceptions == True: cfg.env.CXXFLAGS += ['-fno-exceptions', '-fno-rtti']
def register_darwin_external_ly_identity(self, configuration): # Do not regsiter as an external library if the source exists if os.path.exists(self.Path('Code/Tools/LyIdentity/wscript')): return platform = 'mac' if configuration not in ('Debug', 'Release'): raise WafError("Invalid configuration value {}", configuration) target_platform = 'darwin' ly_identity_base_path = self.CreateRootRelativePath( 'Tools/InternalSDKs/LyIdentity') include_path = os.path.join(ly_identity_base_path, 'include') stlib_path = os.path.join(ly_identity_base_path, 'lib', platform, configuration) self.register_3rd_party_uselib('LyIdentity_static', target_platform, includes=[include_path], libpath=[stlib_path], lib=['libLyIdentity_static.a'])
def do_the_symbol_stuff(self): ins = [x.outputs[0] for x in self.compiled_tasks] self.gen_sym_tasks = [ self.create_task('gen_sym', x, x.change_ext('.%d.sym' % self.idx)) for x in ins ] tsk = self.create_task( 'compile_sym', [x.outputs[0] for x in self.gen_sym_tasks], self.path.find_or_declare( getattr(self, 'sym_filename', self.target + '.def'))) self.link_task.set_run_after(tsk) self.link_task.dep_nodes = [tsk.outputs[0]] if 'msvc' in (self.env.CC_NAME, self.env.CXX_NAME): self.link_task.env.append_value('LINKFLAGS', ['/def:' + tsk.outputs[0].bldpath()]) elif self.env.DEST_BINFMT == 'pe': #gcc on windows takes *.def as an additional input self.link_task.inputs.append(tsk.outputs[0]) elif self.env.DEST_BINFMT == 'elf': self.link_task.env.append_value( 'LINKFLAGS', ['-Wl,-version-script', '-Wl,' + tsk.outputs[0].bldpath()]) else: raise WafError('NotImplemented')
def _read_openocd_initial_string(ctx): from waflib.Errors import WafError if not ctx.env.OPENOCD: ctx.fatal('Error openocd tool is required for the program target mcu') if not ctx.env.OPENOCD_SCRIPT_FILE: ctx.fatal('Error openocd script does not exist') cfg = ctx.read_default_configuration() if not cfg: ctx.fatal('Error default configuration does not exist') try: cfg_tgt = cfg['jtag']['target'] if type(cfg_tgt) is str: final_tgt = cfg_tgt elif type(cfg_tgt) is dict: final_tgt = _ask_for_item_choice(cfg_tgt) tgt = os.path.join(ctx.out_dir, os.path.normpath(final_tgt)) family = ctx.isix_get_cpu_family() ini_cmd = "set ISIX_INTERFACE %s; " % cfg['jtag']['type'] ini_cmd += "set ISIX_INTERFACE_TARGET stm32%sx; " % family ini_cmd += "set ISIX_INTERFACE_SWD %s; " % cfg['jtag']['swd'] ini_cmd += "set ISIX_INTERFACE_SPEED_KHZ %s; " % cfg['jtag']['speed'] except KeyError as err: raise WafError('Error invalid jtag config %r' % err, err) return ini_cmd, tgt
except WindowsError, ex: raise WafError("Command %s raised exception %s" % (argv, ex)) if retval: signame = None if retval < 0: # signal? import signal for name, val in vars(signal).iteritems(): if len(name) > 3 and name[:3] == 'SIG' and name[3] != '_': if val == -retval: signame = name break if signame: raise WafError( "Command %s terminated with signal %s." " Run it under a debugger to get more information " "(./waf --run <program> --command-template=\"gdb --args %%s <args>\")." % (argv, signame)) else: raise WafError("Command %s exited with code %i" % (argv, retval)) return retval def get_run_program(program_string, command_template=None): """ Return the program name and argv of the process that would be executed by run_program(program_string, command_template). """ #print "get_run_program_argv(program_string=%r, command_template=%r)" % (program_string, command_template) env = bld.env
def zcmgen(ctx, **kw): # TODO: should raise an error if ctx.env.ZCMGEN is not set uselib_name = 'zcmtypes' if 'name' in kw: uselib_name = kw['name'] javapkg_name = 'zcmtypes' if 'javapkg' in kw: javapkg_name = kw['javapkg'] building = True if 'build' in kw: building = kw['build'] littleEndian = False if 'littleEndian' in kw: littleEndian = kw['littleEndian'] if 'lang' not in kw: # TODO: this should probably be a more specific error type raise WafError('zcmgen requires keword argument: "lang"') # Add .zcm files to build so the process_zcmtypes rule picks them up genfiles_name = uselib_name + '_genfiles' tg = ctx(name = genfiles_name, source = kw['source'], lang = kw['lang'], littleEndian = littleEndian, javapkg = javapkg_name) if not building: return bld = ctx.path.get_bld().abspath() inc = os.path.dirname(bld) if 'c_stlib' in kw['lang']: csrc = [] for src in tg.source: outfile = outFileName(ctx, src.abspath(), 'c') outnode = ctx.path.find_or_declare(outfile[1]) csrc.append(outnode) cstlibtg = ctx.stlib(name = uselib_name + '_c_stlib', target = uselib_name, use = ['default', 'zcm'], includes = inc, export_includes = inc, source = csrc) if 'c_shlib' in kw['lang']: cshlibtg = ctx.shlib(name = uselib_name + '_c_shlib', target = uselib_name, use = ['default', 'zcm'], includes = inc, export_includes = inc, source = csrc) if 'cpp' in kw['lang']: cpptg = ctx(target = uselib_name + '_cpp', rule = 'touch ${TGT}', export_includes = inc) if 'java' in kw['lang']: javatg = ctx(name = uselib_name + '_java', features = 'javac jar', use = ['zcmjar', genfiles_name], srcdir = ctx.path.find_or_declare('java/' + javapkg_name.split('.')[0]), outdir = 'java/classes', # path to output (for .class) basedir = 'java/classes', # basedir for jar destfile = uselib_name + '.jar') if 'python' in kw['lang']: pythontg = ctx(target = uselib_name + '_python', rule = 'touch ${TGT}')
def run_argv(argv, env, os_env=None, cwd=None, force_no_valgrind=False): proc_env = get_proc_env(os_env) if Options.options.valgrind and Options.options.command_template: raise WafError( "Options --command-template and --valgrind are conflicting") if Options.options.gdb and Options.options.command_template: raise WafError("Options --command-template and --gdb are conflicting") if Options.options.gdb and Options.options.valgrind: raise WafError("Options --valgrind and --gdb are conflicting") if Options.options.gdb: argv = ["gdb", "--args"] + argv proc = subprocess.Popen(argv, env=proc_env, cwd=cwd) retval = proc.wait() return retval elif Options.options.valgrind and not force_no_valgrind: if not env['VALGRIND']: raise WafError("valgrind is not installed") # Use the first program found in the env['VALGRIND'] list argv = [ env['VALGRIND'][0], "--leak-check=full", "--show-reachable=yes", "--error-exitcode=1" ] + argv proc = subprocess.Popen(argv, env=proc_env, cwd=cwd, stderr=subprocess.PIPE) stderrdata = proc.communicate()[1] stderrdata = stderrdata.decode('utf-8') error = False for line in stderrdata: sys.stderr.write(line) if "== LEAK SUMMARY" in line: error = True retval = proc.wait() if retval == 0 and error: retval = 1 else: try: WindowsError except NameError: retval = subprocess.Popen(argv, env=proc_env, cwd=cwd).wait() else: try: retval = subprocess.Popen(argv, env=proc_env, cwd=cwd).wait() except WindowsError as ex: raise WafError("Command %s raised exception %s" % (argv, ex)) if retval: signame = None if retval < 0: # signal? import signal for name, val in vars(signal).items(): if len(name) > 3 and name[:3] == 'SIG' and name[3] != '_': if val == -retval: signame = name break if signame: raise WafError("Command %s terminated with signal %s." " Run it under a debugger to get more information " "(./waf --run <program> --gdb\")." % (argv, signame)) else: raise WafError("Command %s exited with code %i" % (argv, retval)) return retval
def zcmgen(ctx, **kw): if not getattr(ctx.env, 'ZCMGEN', []): raise WafError( 'zcmgen requires ctx.env.ZCMGEN set to the zcm-gen executable') uselib_name = kw.get('name', 'zcmtypes') building = kw.get('build', True) pkgPrefix = kw.get('pkgPrefix', '') littleEndian = kw.get('littleEndian', False) javapkg = kw.get('javapkg', 'zcmtypes') juliapkg = kw.get('juliapkg', '') juliagenpkgs = kw.get('juliagenpkgs', False) lang = kw.get('lang', []) if isinstance(lang, str): lang = lang.split(' ') if ((not lang) and (not juliagenpkgs)): # TODO: this should probably be a more specific error type raise WafError('zcmgen requires keword argument: "lang"') if 'source' not in kw: # TODO: this should probably be a more specific error type raise WafError('zcmgen requires keword argument: "source"') # exit early if no source files input if not kw['source']: return zcmgen = ctx.root.find_or_declare(ctx.env.ZCMGEN) bld = ctx.path.get_bld().abspath() inc = os.path.dirname(bld) if 'nodejs' in lang: bldcmd = '%s --node --npath %s ' % (ctx.env['ZCMGEN'], bld) if (pkgPrefix): bldcmd += '--package-prefix %s ' % pkgPrefix ctx(name=uselib_name + '_nodejs', target='zcmtypes.js', source=kw['source'], rule=bldcmd + '${SRC}') lang.remove( 'nodejs' ) # Done with nodejs, remove so we don't try to gen node files below if juliagenpkgs: ctx(target=uselib_name + '_juliapkgs', rule=genJuliaPkgFiles, source=kw['source'], pkgPrefix=pkgPrefix, juliapkg=juliapkg) if len(lang) == 0: return # Add .zcm files to build so the process_zcmtypes rule picks them up genfiles_name = uselib_name + '_genfiles' tg = ctx(name=genfiles_name, source=kw['source'], lang=lang, pkgPrefix=pkgPrefix, littleEndian=littleEndian, juliapkg=juliapkg, javapkg=javapkg) for s in tg.source: ctx.add_manual_dependency(s, zcmgen) if not building: return if 'c_stlib' in lang or 'c_shlib' in lang: csrc = [] for src in tg.source: # Note: assuming c_stlib and c_shlib have the same treatment in outFileNames files = outFileNames(ctx, ctx.path.get_bld().abspath(), src.abspath(), lang=['c_stlib', 'c_shlib'], pkgPrefix=pkgPrefix) for f in files: if f.endswith('.c'): outnode = ctx.path.find_or_declare(f) csrc.append(outnode) if 'c_stlib' in lang: ctx.stlib(name=uselib_name + '_c_stlib', target=uselib_name, use=['default', 'zcm'], includes=inc, export_includes=inc, source=csrc) if 'c_shlib' in lang: ctx.shlib(name=uselib_name + '_c_shlib', target=uselib_name, use=['default', 'zcm'], includes=inc, export_includes=inc, source=csrc) if 'cpp' in lang: ctx(target=uselib_name + '_cpp', rule='touch ${TGT}', use=['zcm'], export_includes=inc) if 'java' in lang: ctx( name=uselib_name + '_java', features='javac jar', use=['zcmjar', genfiles_name], srcdir=ctx.path.find_or_declare('java/' + javapkg.split('.')[0]), outdir='java/classes', # path to output (for .class) basedir='java/classes', # basedir for jar destfile=uselib_name + '.jar') if 'python' in lang: ctx(target=uselib_name + '_python', rule='touch ${TGT}') if 'julia' in lang: ctx(target=uselib_name + '_julia', rule='touch ${TGT}')
def create_calibre_pex_task(self): self.rule_file = self.get_calibre_pex_rule_file_path().make_node( 'rules_' + self.cellname) self.xcells_file = self.get_calibre_pex_rule_file_path().make_node( 'xcells_' + self.cellname) self.hcells_file = self.get_calibre_pex_rule_file_path().make_node( 'hcells_' + self.cellname) self.svdb = self.get_resultdir_node().make_node('svdb') if not os.path.exists(self.svdb.abspath()): self.svdb.mkdir() which_names = 'LAYOUTNAMES' if getattr(self, 'use_sourcenames', False): which_names = 'SOURCENAMES' selected_nets = "" if hasattr(self, 'only_extract_nets') and len(self.only_extract_nets) > 0: include_mode = 'TOPLEVEL' if getattr(self, 'extract_include_recursive', False): include_mode = 'RECURSIVE' selected_nets = 'PEX EXTRACT INCLUDE ' + which_names + ' ' + include_mode + ' "' + '" "'.join( getattr(self, 'only_extract_nets', [])) + '"' elif hasattr(self, 'dont_extract_nets') and len(self.dont_extract_nets) > 0: exclude_mode = 'TOPLEVEL' if getattr(self, 'extract_exclude_recursive', False): exclude_mode = 'RECURSIVE' selected_nets = 'PEX EXTRACT EXCLUDE ' + which_names + ' ' + exclude_mode + ' "' + '" "'.join( getattr(self, 'dont_extract_nets', [])) + '"' f = open(self.rule_file.abspath(), "w") if 1: #try: f.write("""#!tvf tvf::VERBATIM {{ LAYOUT PATH "{0}" LAYOUT PRIMARY "{1}" LAYOUT SYSTEM GDSII LAYOUT CASE YES """.format(self.layout_gds.abspath(), self.cellname)) f.write(""" MASK SVDB DIRECTORY "{1}" QUERY XRC CCI NOPINLOC IXF NXF SLPH PEX NETLIST "{0}.pex.netlist" HSPICE 1 {2} GROUND "gnd" SEPARATOR "_" LOCATION RCNAMED RLOCATION RWIDTH RLENGTH RLAYER RTHICKNESS PEX NETLIST SIMPLE "{0}.pex.netlist" HSPICE 1 {2} LOCATION RCNAMED PEX REPORT "{0}.pex.report" {2}""".format( self.get_calibre_pex_output_file_node().abspath(), self.svdb.abspath(), which_names)) f.write(""" {0} PEX REDUCE ANALOG NO PEX REDUCE MINCAP COMBINE 0.001 PEX REDUCE MINCAP REMOVE 0 PEX REDUCE MINRES COMBINE 0.1 PEX REDUCE MINRES SHORT 0 PEX NETLIST UPPERCASE KEYWORDS NO PEX NETLIST VIRTUAL CONNECT NO PEX NETLIST NOXREF NET NAMES NO PEX NETLIST MUTUAL RESISTANCE YES //PEX NETLIST ESCAPE CHARACTERS "<>" PEX NETLIST CHARACTER MAP "<[ >] %_" //PEX NETLIST GLOBAL NETS pc_pre_buf pc_pst_buf pc_preb_buf sense_pre_buf wen_pst_buf wen_pre_buf enb_int_left writeen_pst_buf DRC ICSTATION YES """.format(selected_nets)) #except AttributeError as e: # error_string = str(e) # error_string = error_string.replace('\'task_gen\' object has no','') # Logs.error('Please specify the missing parameter in the task generator call for feature calibre_pex: '+error_string) # return for inc in self.includes: f.write('\nINCLUDE "' + inc.abspath() + '"') for line in getattr(self, 'mixins', []): f.write('\n' + line) f.write('\n}') f.close() if hasattr(self, 'xcells'): f = open(self.xcells_file.abspath(), "w") f.write("\n".join(getattr(self, 'xcells', []))) f.close() inputs = [self.layout_gds] if getattr(self, 'use_sourcenames', False): layout_spice_node = self.svdb.make_node(self.cellname + '.sp') if not os.path.exists(layout_spice_node.abspath()): from waflib.Errors import WafError raise WafError( 'File ' + self.cellname + '.sp not found in ' + self.svdb.abspath() + ' (tool calibre_pex). Probably, you forgot to run LVS first.') inputs.append(layout_spice_node) pdb = self.create_task('calibrePexPDBTask', inputs) if not getattr(self, 'use_sourcenames', False): phdb = self.create_task('calibrePexPHDBTask', inputs) pdb.set_run_after(phdb) fmt = self.create_task('calibrePexFMTTask', inputs, [ self.get_calibre_pex_output_file_node(".pex.netlist"), self.get_calibre_pex_output_file_node(".pex.report") ]) fmt.set_run_after(pdb)
def zcmgen(ctx, **kw): if not getattr(ctx.env, 'ZCMGEN', []): raise WafError( 'zcmgen requires ctx.env.ZCMGEN set to the zcm-gen executable') uselib_name = 'zcmtypes' if 'name' in kw: uselib_name = kw['name'] javapkg_name = 'zcmtypes' if 'javapkg' in kw: javapkg_name = kw['javapkg'] building = True if 'build' in kw: building = kw['build'] littleEndian = False if 'littleEndian' in kw: littleEndian = kw['littleEndian'] if 'lang' not in kw: # TODO: this should probably be a more specific error type raise WafError('zcmgen requires keword argument: "lang"') lang = kw['lang'] if isinstance(kw['lang'], basestring): lang = kw['lang'].split(' ') if 'source' not in kw: # TODO: this should probably be a more specific error type raise WafError('zcmgen requires keword argument: "source"') # exit early if no source files input if not kw['source']: return # Add .zcm files to build so the process_zcmtypes rule picks them up genfiles_name = uselib_name + '_genfiles' tg = ctx(name=genfiles_name, source=kw['source'], lang=lang, littleEndian=littleEndian, javapkg=javapkg_name) bld = ctx.path.get_bld().abspath() inc = os.path.dirname(bld) if 'nodejs' in lang: bldcmd = '%s --node --npath %s ' % (ctx.env['ZCMGEN'], bld) nodejstg = ctx(name=uselib_name + '_nodejs', target='zcmtypes.js', source=tg.source, rule=bldcmd + '${SRC}') if not building: return if 'c_stlib' in lang or 'c_shlib' in lang: csrc = [] for src in tg.source: outfile = outFileName(ctx, src.abspath(), 'c') outnode = ctx.path.find_or_declare(outfile[1]) csrc.append(outnode) if 'c_stlib' in lang: cstlibtg = ctx.stlib(name=uselib_name + '_c_stlib', target=uselib_name, use=['default', 'zcm'], includes=inc, export_includes=inc, source=csrc) if 'c_shlib' in lang: cshlibtg = ctx.shlib(name=uselib_name + '_c_shlib', target=uselib_name, use=['default', 'zcm'], includes=inc, export_includes=inc, source=csrc) if 'cpp' in lang: cpptg = ctx(target=uselib_name + '_cpp', rule='touch ${TGT}', export_includes=inc) if 'java' in lang: javatg = ctx( name=uselib_name + '_java', features='javac jar', use=['zcmjar', genfiles_name], srcdir=ctx.path.find_or_declare('java/' + javapkg_name.split('.')[0]), outdir='java/classes', # path to output (for .class) basedir='java/classes', # basedir for jar destfile=uselib_name + '.jar') if 'python' in lang: pythontg = ctx(target=uselib_name + '_python', rule='touch ${TGT}')