def find_msvc(conf): if sys.platform=='cygwin': conf.fatal('MSVC module does not work under cygwin Python!') v=conf.env path=v['PATH'] compiler=v['MSVC_COMPILER'] version=v['MSVC_VERSION'] compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler) v.MSVC_MANIFEST=(compiler=='msvc'and version>=8)or(compiler=='wsdk'and version>=6)or(compiler=='intel'and version>=11) cxx=conf.find_program(compiler_name,var='CXX',path_list=path) env=dict(conf.environ) if path:env.update(PATH=';'.join(path)) if not conf.cmd_and_log(cxx+['/nologo','/help'],env=env): conf.fatal('the msvc compiler could not be identified') v['CC']=v['CXX']=cxx v['CC_NAME']=v['CXX_NAME']='msvc' if not v['LINK_CXX']: link=conf.find_program(linker_name,path_list=path) if link:v['LINK_CXX']=link else:conf.fatal('%s was not found (linker)'%linker_name) v['LINK']=link if not v['LINK_CC']: v['LINK_CC']=v['LINK_CXX'] if not v['AR']: stliblink=conf.find_program(lib_name,path_list=path,var='AR') if not stliblink:return v['ARFLAGS']=['/NOLOGO'] if v.MSVC_MANIFEST: conf.find_program('MT',path_list=path,var='MT') v['MTFLAGS']=['/NOLOGO'] try: conf.load('winres') except Errors.WafError: warn('Resource compiler not found. Compiling resource file is disabled')
def find_ifort_win32(conf): v=conf.env path=v['PATH'] compiler=v['MSVC_COMPILER'] version=v['MSVC_VERSION'] compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler) v.IFORT_MANIFEST=(compiler=='intel'and version>=11) fc=conf.find_program(compiler_name,var='FC',path_list=path) env=dict(conf.environ) if path:env.update(PATH=';'.join(path)) if not conf.cmd_and_log(fc+['/nologo','/help'],env=env): conf.fatal('not intel fortran compiler could not be identified') v['FC_NAME']='IFORT' if not v['LINK_FC']: conf.find_program(linker_name,var='LINK_FC',path_list=path,mandatory=True) if not v['AR']: conf.find_program(lib_name,path_list=path,var='AR',mandatory=True) v['ARFLAGS']=['/NOLOGO'] if v.IFORT_MANIFEST: conf.find_program('MT',path_list=path,var='MT') v['MTFLAGS']=['/NOLOGO'] try: conf.load('winres') except Errors.WafError: warn('Resource compiler not found. Compiling resource file is disabled')
def find_msvc(conf): """Due to path format limitations, limit operation only to native Win32. Yeah it sucks.""" if sys.platform == 'cygwin': conf.fatal('MSVC module does not work under cygwin Python!') # the autodetection is supposed to be performed before entering in this method v = conf.env path = v['PATH'] compiler = v['MSVC_COMPILER'] version = v['MSVC_VERSION'] compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) v.MSVC_MANIFEST = (compiler == 'msvc' and version >= 8) or (compiler == 'wsdk' and version >= 6) or (compiler == 'intel' and version >= 11) # compiler cxx = None if v['CXX']: cxx = v['CXX'] elif 'CXX' in conf.environ: cxx = conf.environ['CXX'] cxx = conf.find_program(compiler_name, var='CXX', path_list=path) cxx = conf.cmd_to_list(cxx) # before setting anything, check if the compiler is really msvc env = dict(conf.environ) if path: env.update(PATH = ';'.join(path)) if not conf.cmd_and_log(cxx + ['/nologo', '/help'], env=env): conf.fatal('the msvc compiler could not be identified') # c/c++ compiler v['CC'] = v['CXX'] = cxx v['CC_NAME'] = v['CXX_NAME'] = 'msvc' # linker if not v['LINK_CXX']: link = conf.find_program(linker_name, path_list=path) if link: v['LINK_CXX'] = link else: conf.fatal('%s was not found (linker)' % linker_name) v['LINK'] = link if not v['LINK_CC']: v['LINK_CC'] = v['LINK_CXX'] # staticlib linker if not v['AR']: stliblink = conf.find_program(lib_name, path_list=path, var='AR') if not stliblink: return v['ARFLAGS'] = ['/NOLOGO'] # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later if v.MSVC_MANIFEST: conf.find_program('MT', path_list=path, var='MT') v['MTFLAGS'] = ['/NOLOGO'] try: conf.load('winres') except Errors.WafError: warn('Resource compiler not found. Compiling resource file is disabled')
def find_boost_includes(self, kw): """ check every path in kw['includes'] for subdir that either starts with boost- or is named boost. Then the version is checked and selected accordingly to min_version/max_version. The highest possible version number is selected! If no versiontag is set the versiontag is set accordingly to the selected library and INCLUDES_BOOST is set. """ boostPath = getattr(Options.options, 'boostincludes', '') if boostPath: boostPath = [os.path.normpath(os.path.expandvars(os.path.expanduser(boostPath)))] else: boostPath = Utils.to_list(kw['includes']) min_version = string_to_version(kw.get('min_version', '')) max_version = string_to_version(kw.get('max_version', '')) or (sys.maxint - 1) version = 0 for include_path in boostPath: boost_paths = [p for p in glob.glob(os.path.join(include_path, 'boost*')) if os.path.isdir(p)] debug('BOOST Paths: %r' % boost_paths) for path in boost_paths: pathname = os.path.split(path)[-1] ret = -1 if pathname == 'boost': path = include_path ret = self.get_boost_version_number(path) elif pathname.startswith('boost-'): ret = self.get_boost_version_number(path) ret = int(ret) if ret != -1 and ret >= min_version and ret <= max_version and ret > version: boost_path = path version = ret if not version: self.fatal('boost headers not found! (required version min: %s max: %s)' % (kw['min_version'], kw['max_version'])) return False found_version = version_string(version) versiontag = '^' + found_version + '$' if kw['tag_version'] is None: kw['tag_version'] = versiontag elif kw['tag_version'] != versiontag: warn('boost header version %r and tag_version %r do not match!' % (versiontag, kw['tag_version'])) env = self.env env['INCLUDES_BOOST'] = boost_path env['BOOST_VERSION'] = found_version self.found_includes = 1 ret = '%s (ver %s)' % (boost_path, found_version) return ret
def makeindex(self): try: idx_path=self.idx_node.abspath() os.stat(idx_path) except OSError: warn('index file %s absent, not calling makeindex'%idx_path) else: warn('calling makeindex') self.env.SRCFILE=self.idx_node.name self.env.env={} self.check_status('error when calling makeindex %s'%idx_path,self.makeindex_fun())
def makeindex(self): """look on the filesystem if there is a .idx file to process""" try: idx_path = self.idx_node.abspath() os.stat(idx_path) except OSError: warn('index file %s absent, not calling makeindex' % idx_path) else: warn('calling makeindex') self.env.SRCFILE = self.idx_node.name self.env.env = {} self.check_status('error when calling makeindex %s' % idx_path, self.makeindex_fun())
def configure(conf): try: conf.find_program('python',var='PYTHON') except conf.errors.ConfigurationError: warn("could not find a python executable, setting to sys.executable '%s'"%sys.executable) conf.env.PYTHON=sys.executable if conf.env.PYTHON!=sys.executable: warn("python executable '%s' different from sys.executable '%s'"%(conf.env.PYTHON,sys.executable)) v=conf.env v['PYCMD']='"import sys, py_compile;py_compile.compile(sys.argv[1], sys.argv[2])"' v['PYFLAGS']='' v['PYFLAGS_OPT']='-O' v['PYC']=getattr(Options.options,'pyc',1) v['PYO']=getattr(Options.options,'pyo',1)
def bibunits(self): try: bibunits = bibunitscan(self) except FSError: error("error bibunitscan") else: if bibunits: fn = ["bu" + str(i) for i in xrange(1, len(bibunits) + 1)] if fn: warn("calling bibtex on bibunits") for f in fn: self.env.env = {"BIBINPUTS": self.TEXINPUTS, "BSTINPUTS": self.TEXINPUTS} self.env.SRCFILE = f self.check_status("error when calling bibtex", self.bibtex_fun())
def bibfile(self): try: ct=self.aux_node.read() except(OSError,IOError): error('error bibtex scan') else: fo=g_bibtex_re.findall(ct) if fo: warn('calling bibtex') self.env.env={} self.env.env.update(os.environ) self.env.env.update({'BIBINPUTS':self.TEXINPUTS,'BSTINPUTS':self.TEXINPUTS}) self.env.SRCFILE=self.aux_node.name[:-4] self.check_status('error when calling bibtex',self.bibtex_fun())
def bibunits(self): try: bibunits=bibunitscan(self) except FSError: error('error bibunitscan') else: if bibunits: fn=['bu'+str(i)for i in xrange(1,len(bibunits)+1)] if fn: warn('calling bibtex on bibunits') for f in fn: self.env.env={'BIBINPUTS':self.TEXINPUTS,'BSTINPUTS':self.TEXINPUTS} self.env.SRCFILE=f self.check_status('error when calling bibtex',self.bibtex_fun())
def resolve(ctx): """ The resolve function for the dependency resolver tool :param ctx: the resolve context """ # We need to load git to resolve the dependencies ctx.load('wurf_git') # Check if git meets the minimum requirements if ctx.options.check_git_version: ctx.git_check_minimum_version((1, 7, 0)) # Get the remote url of the parent project # to see which protocol prefix (https://, git@, git://) # was used when the project was cloned parent_url = None try: parent_url = \ ctx.git_config(['--get', 'remote.origin.url'], cwd=os.getcwd()) except Exception as e: ctx.to_log('Exception when executing git config - fallback to ' 'default protocol! parent_url: {0}'.format(parent_url)) ctx.to_log(e) global git_protocol_handler if ctx.options.git_protocol: git_protocol_handler = ctx.options.git_protocol else: # Check if parent protocol is supported for g in git_protocols: if parent_url and parent_url.startswith(g): git_protocol_handler = g break else: git_protocol_handler = 'https://' # Unsupported parent protocol, using default # Set the protocol handler via the --git-protocol option from waflib.Logs import warn warn("Using default git protocol ({}) to resolve dependencies. " "Use --git-protocol=[proto] to select another protocol. " "Supported protocols: {}".format(git_protocol_handler, git_protocols)) if git_protocol_handler not in git_protocols: ctx.fatal('Unknown git protocol specified: "{}", supported protocols ' 'are {}'.format(git_protocol_handler, git_protocols))
def configure(conf): try: conf.find_program("python", var="PYTHON") except conf.errors.ConfigurationError: warn("could not find a python executable, setting to sys.executable '%s'" % sys.executable) conf.env.PYTHON = sys.executable if conf.env.PYTHON != sys.executable: warn("python executable '%s' different from sys.executable '%s'" % (conf.env.PYTHON, sys.executable)) conf.env.PYTHON = conf.cmd_to_list(conf.env.PYTHON) v = conf.env v["PYCMD"] = '"import sys, py_compile;py_compile.compile(sys.argv[1], sys.argv[2])"' v["PYFLAGS"] = "" v["PYFLAGS_OPT"] = "-O" v["PYC"] = getattr(Options.options, "pyc", 1) v["PYO"] = getattr(Options.options, "pyo", 1)
def makeindex(self): """ Look on the filesystem if there is a *.idx* file to process. If yes, execute :py:meth:`waflib.Tools.tex.tex.makeindex_fun` """ try: idx_path = self.idx_node.abspath() os.stat(idx_path) except OSError: warn('index file %s absent, not calling makeindex' % idx_path) else: warn('calling makeindex') self.env.SRCFILE = self.idx_node.name self.env.env = {} self.check_status('error when calling makeindex %s' % idx_path, self.makeindex_fun())
def bibunits(self): self.env.env = {} self.env.env.update(os.environ) self.env.env.update({'BIBINPUTS': self.TEXINPUTS, 'BSTINPUTS': self.TEXINPUTS}) self.env.SRCFILE = self.aux_node.name[:-4] if not self.env['PROMPT_LATEX']: self.env.append_unique('BIBERFLAGS', '--quiet') path = self.aux_node.abspath()[:-4] + '.bcf' if os.path.isfile(path): warn('calling biber') self.check_status('error when calling biber, check %s.blg for errors' % (self.env.SRCFILE), self.biber_fun()) else: super(tex, self).bibfile() super(tex, self).bibunits()
def bibfile(self): need_bibtex=False try: for aux_node in self.aux_nodes: ct=aux_node.read() if g_bibtex_re.findall(ct): need_bibtex=True break except(OSError,IOError): error('error bibtex scan') else: if need_bibtex: warn('calling bibtex') self.env.env={} self.env.env.update(os.environ) self.env.env.update({'BIBINPUTS':self.TEXINPUTS,'BSTINPUTS':self.TEXINPUTS}) self.env.SRCFILE=self.aux_nodes[0].name[:-4] self.check_status('error when calling bibtex',self.bibtex_fun())
def configure(conf): """ Detect the python interpreter """ default = [sys.executable] try: conf.find_program('python', var='PYTHON') except conf.errors.ConfigurationError: warn("could not find a python executable, setting to sys.executable '%s'" % sys.executable) conf.env.PYTHON = default if conf.env.PYTHON != default: warn("python executable '%s' different from sys.executable '%s'" % (conf.env.PYTHON, default)) conf.env.PYTHON = conf.cmd_to_list(default) v = conf.env v['PYCMD'] = '"import sys, py_compile;py_compile.compile(sys.argv[1], sys.argv[2])"' v['PYFLAGS'] = '' v['PYFLAGS_OPT'] = '-O'
def bibunits(self): """ Parse the *.aux* file to find bibunit files. If there are bibunit files, execute :py:meth:`waflib.Tools.tex.tex.bibtex_fun`. """ try: bibunits = bibunitscan(self) except FSError: error('error bibunitscan') else: if bibunits: fn = ['bu' + str(i) for i in xrange(1, len(bibunits) + 1)] if fn: warn('calling bibtex on bibunits') for f in fn: self.env.env = {'BIBINPUTS': self.TEXINPUTS, 'BSTINPUTS': self.TEXINPUTS} self.env.SRCFILE = f self.check_status('error when calling bibtex', self.bibtex_fun())
def find_msvc(conf): if sys.platform=='cygwin': conf.fatal('MSVC module does not work under cygwin Python!') v=conf.env compiler,version,path,includes,libdirs=detect_msvc(conf) v['PATH']=path v['INCLUDES']=includes v['LIBPATH']=libdirs v['MSVC_VERSION']=float(version) compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler) v.MSVC_MANIFEST=(compiler=='msvc'and float(version)>=8)or(compiler=='wsdk'and float(version)>=6)or(compiler=='intel'and float(version)>=11) cxx=None if v['CXX']:cxx=v['CXX'] elif'CXX'in conf.environ:cxx=conf.environ['CXX'] cxx=conf.find_program(compiler_name,var='CXX',path_list=path) cxx=conf.cmd_to_list(cxx) env=dict(conf.environ) env.update(PATH=';'.join(path)) if not conf.cmd_and_log(cxx+['/nologo','/help'],env=env): conf.fatal('the msvc compiler could not be identified') v['CC']=v['CXX']=cxx v['CC_NAME']=v['CXX_NAME']='msvc' try:v.prepend_value('INCLUDES',conf.environ['INCLUDE']) except KeyError:pass try:v.prepend_value('LIBPATH',conf.environ['LIB']) except KeyError:pass if not v['LINK_CXX']: link=conf.find_program(linker_name,path_list=path) if link:v['LINK_CXX']=link else:conf.fatal('%s was not found (linker)'%linker_name) v['LINK']=link if not v['LINK_CC']: v['LINK_CC']=v['LINK_CXX'] if not v['AR']: stliblink=conf.find_program(lib_name,path_list=path,var='AR') if not stliblink:return v['ARFLAGS']=['/NOLOGO'] if v.MSVC_MANIFEST: mt=conf.find_program('MT',path_list=path,var='MT') v['MTFLAGS']=['/NOLOGO'] conf.load('winres') if not conf.env['WINRC']: warn('Resource compiler not found. Compiling resource file is disabled')
def run(self): env=self.env if not env['PROMPT_LATEX']: env.append_value('LATEXFLAGS','-interaction=batchmode') env.append_value('PDFLATEXFLAGS','-interaction=batchmode') env.append_value('XELATEXFLAGS','-interaction=batchmode') fun=self.texfun node=self.inputs[0] srcfile=node.abspath() texinputs=self.env.TEXINPUTS or'' self.TEXINPUTS=node.parent.get_bld().abspath()+os.pathsep+node.parent.get_src().abspath()+os.pathsep+texinputs+os.pathsep self.aux_node=node.change_ext('.aux') self.cwd=self.inputs[0].parent.get_bld().abspath() warn('first pass on %s'%self.__class__.__name__) self.env.env={} self.env.env.update(os.environ) self.env.env.update({'TEXINPUTS':self.TEXINPUTS}) self.env.SRCFILE=srcfile self.check_status('error when calling latex',fun()) self.aux_nodes=self.scan_aux(node.change_ext('.aux')) self.idx_node=node.change_ext('.idx') self.bibfile() self.bibunits() self.makeindex() hash='' for i in range(10): prev_hash=hash try: hashes=[Utils.h_file(x.abspath())for x in self.aux_nodes] hash=Utils.h_list(hashes) except(OSError,IOError): error('could not read aux.h') pass if hash and hash==prev_hash: break warn('calling %s'%self.__class__.__name__) self.env.env={} self.env.env.update(os.environ) self.env.env.update({'TEXINPUTS':self.TEXINPUTS}) self.env.SRCFILE=srcfile self.check_status('error when calling %s'%self.__class__.__name__,fun())
def bibfile(self): """ Parse the *.aux* file to find a bibfile to process. If yes, execute :py:meth:`waflib.Tools.tex.tex.bibtex_fun` """ try: ct = self.aux_node.read() except (OSError, IOError): error('error bibtex scan') else: fo = g_bibtex_re.findall(ct) # there is a .aux file to process if fo: warn('calling bibtex') self.env.env = {} self.env.env.update(os.environ) self.env.env.update({'BIBINPUTS': self.TEXINPUTS, 'BSTINPUTS': self.TEXINPUTS}) self.env.SRCFILE = self.aux_node.name[:-4] self.check_status('error when calling bibtex', self.bibtex_fun())
def find_ifort_win32(conf): # the autodetection is supposed to be performed before entering in this method v = conf.env path = v['PATH'] compiler = v['MSVC_COMPILER'] version = v['MSVC_VERSION'] compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) v.IFORT_MANIFEST = (compiler == 'intel' and version >= 11) # compiler fc = conf.find_program(compiler_name, var='FC', path_list=path) # before setting anything, check if the compiler is really intel fortran env = dict(conf.environ) if path: env.update(PATH = ';'.join(path)) if not conf.cmd_and_log(fc + ['/nologo', '/help'], env=env): conf.fatal('not intel fortran compiler could not be identified') v['FC_NAME'] = 'IFORT' # linker if not v['LINK_FC']: conf.find_program(linker_name, var='LINK_FC', path_list=path, mandatory=True) # staticlib linker if not v['AR']: conf.find_program(lib_name, path_list=path, var='AR', mandatory=True) v['ARFLAGS'] = ['/NOLOGO'] # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later if v.IFORT_MANIFEST: conf.find_program('MT', path_list=path, var='MT') v['MTFLAGS'] = ['/NOLOGO'] try: conf.load('winres') except Errors.WafError: warn('Resource compiler not found. Compiling resource file is disabled')
def run(self): env=self.env bld=self.generator.bld if not env['PROMPT_LATEX']: env.append_value('LATEXFLAGS','-interaction=batchmode') env.append_value('PDFLATEXFLAGS','-interaction=batchmode') env.append_value('XELATEXFLAGS','-interaction=batchmode') fun=self.texfun node=self.inputs[0] srcfile=node.abspath() self.TEXINPUTS=node.parent.get_bld().abspath()+os.pathsep+node.parent.get_src().abspath()+os.pathsep self.aux_node=node.change_ext('.aux') self.idx_node=node.change_ext('.idx') self.cwd=self.inputs[0].parent.get_bld().abspath() warn('first pass on %s'%self.__class__.__name__) self.env.env={} self.env.env.update(os.environ) self.env.env.update({'TEXINPUTS':self.TEXINPUTS}) self.env.SRCFILE=srcfile self.check_status('error when calling latex',fun()) self.bibfile() self.bibunits() self.makeindex() hash='' for i in range(10): prev_hash=hash try: hash=Utils.h_file(self.aux_node.abspath()) except(OSError,IOError): error('could not read aux.h -> %s'%self.aux_node.abspath()) pass if hash and hash==prev_hash: break warn('calling %s'%self.__class__.__name__) self.env.env={} self.env.env.update(os.environ) self.env.env.update({'TEXINPUTS':self.TEXINPUTS}) self.env.SRCFILE=srcfile self.check_status('error when calling %s'%self.__class__.__name__,fun())
def run(self): env = self.env bld = self.generator.bld if not env["PROMPT_LATEX"]: env.append_value("LATEXFLAGS", "-interaction=batchmode") env.append_value("PDFLATEXFLAGS", "-interaction=batchmode") env.append_value("XELATEXFLAGS", "-interaction=batchmode") fun = self.texfun node = self.inputs[0] srcfile = node.abspath() self.TEXINPUTS = node.parent.get_bld().abspath() + os.pathsep + node.parent.get_src().abspath() + os.pathsep self.aux_node = node.change_ext(".aux") self.idx_node = node.change_ext(".idx") self.cwd = self.inputs[0].parent.get_bld().abspath() warn("first pass on %s" % self.__class__.__name__) self.env.env = {} self.env.env.update(os.environ) self.env.env.update({"TEXINPUTS": self.TEXINPUTS}) self.env.SRCFILE = srcfile self.check_status("error when calling latex", fun()) self.bibfile() self.bibunits() self.makeindex() hash = "" for i in range(10): prev_hash = hash try: hash = Utils.h_file(self.aux_node.abspath()) except (OSError, IOError): error("could not read aux.h -> %s" % self.aux_node.abspath()) pass if hash and hash == prev_hash: break warn("calling %s" % self.__class__.__name__) self.env.env = {} self.env.env.update(os.environ) self.env.env.update({"TEXINPUTS": self.TEXINPUTS}) self.env.SRCFILE = srcfile self.check_status("error when calling %s" % self.__class__.__name__, fun())
def find_msvc(conf): if sys.platform=='cygwin': conf.fatal('MSVC module does not work under cygwin Python!') v=conf.env path=v['PATH'] compiler=v['MSVC_COMPILER'] version=v['MSVC_VERSION'] compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler) v.MSVC_MANIFEST=(compiler=='msvc'and version>=8)or(compiler=='wsdk'and version>=6)or(compiler=='intel'and version>=11) cxx=None if v['CXX']:cxx=v['CXX'] elif'CXX'in conf.environ:cxx=conf.environ['CXX'] cxx=conf.find_program(compiler_name,var='CXX',path_list=path) cxx=conf.cmd_to_list(cxx) env=dict(conf.environ) if path:env.update(PATH=';'.join(path)) if not conf.cmd_and_log(cxx+['/nologo','/help'],env=env): conf.fatal('the msvc compiler could not be identified') v['CC']=v['CXX']=cxx v['CC_NAME']=v['CXX_NAME']='msvc' if not v['LINK_CXX']: link=conf.find_program(linker_name,path_list=path) if link:v['LINK_CXX']=link else:conf.fatal('%s was not found (linker)'%linker_name) v['LINK']=link if not v['LINK_CC']: v['LINK_CC']=v['LINK_CXX'] if not v['AR']: stliblink=conf.find_program(lib_name,path_list=path,var='AR') if not stliblink:return v['ARFLAGS']=['/NOLOGO'] if v.MSVC_MANIFEST: conf.find_program('MT',path_list=path,var='MT') v['MTFLAGS']=['/NOLOGO'] try: conf.load('winres') except Errors.WafError: warn('Resource compiler not found. Compiling resource file is disabled')
def bibunits(self): """ Parse the *.aux* file to find bibunit files. If there are bibunit files, execute :py:meth:`waflib.Tools.tex.tex.bibtex_fun`. """ try: bibunits = bibunitscan(self) except FSError: error('error bibunitscan') else: if bibunits: fn = ['bu' + str(i) for i in xrange(1, len(bibunits) + 1)] if fn: warn('calling bibtex on bibunits') for f in fn: self.env.env = { 'BIBINPUTS': self.TEXINPUTS, 'BSTINPUTS': self.TEXINPUTS } self.env.SRCFILE = f self.check_status('error when calling bibtex', self.bibtex_fun())
def run(self): env = self.env gen = self.generator path = gen.path bld = gen.bld if hasattr(gen, 'root'): build_root = path.find_node(gen.root) else: build_root = path jam = bld.srcnode.find_resource(env.BJAM_CONFIG) if jam: debug('bjam: Using jam configuration from ' + jam.srcpath()) jam_rel = jam.relpath_gen(build_root) else: warn( 'No build configuration in build_config/user-config.jam. Using default' ) jam_rel = None bjam_exe = bld.srcnode.find_node(env.BJAM) if not bjam_exe: error('env.BJAM is not set') return -1 bjam_exe_rel = bjam_exe.relpath_gen(build_root) cmd = ([bjam_exe_rel] + (['--user-config=' + jam_rel] if jam_rel else []) + ['--stagedir=' + path.get_bld().path_from(build_root)] + ['--debug-configuration'] + ['--with-' + lib for lib in self.generator.target] + (['toolset=' + env.BJAM_TOOLSET] if env.BJAM_TOOLSET else []) + ['link=' + 'shared'] + ['variant=' + 'release']) debug('runner: ' + build_root.srcpath() + '> ' + str(cmd)) ret = self.exec_command(cmd, cwd=build_root.srcpath()) if ret != 0: return ret self.set_outputs(path.get_bld().ant_glob('lib/*') + path.get_bld().ant_glob('bin/*')) return 0
def configure(conf): """ Detect the python interpreter """ try: conf.find_program('python', var='PYTHON') except conf.errors.ConfigurationError: warn( "could not find a python executable, setting to sys.executable '%s'" % sys.executable) conf.env.PYTHON = sys.executable if conf.env.PYTHON != sys.executable: warn("python executable '%s' different from sys.executable '%s'" % (conf.env.PYTHON, sys.executable)) conf.env.PYTHON = conf.cmd_to_list(conf.env.PYTHON) v = conf.env v['PYCMD'] = '"import sys, py_compile;py_compile.compile(sys.argv[1], sys.argv[2])"' v['PYFLAGS'] = '' v['PYFLAGS_OPT'] = '-O' v['PYC'] = getattr(Options.options, 'pyc', 1) v['PYO'] = getattr(Options.options, 'pyo', 1)
def run(self): env = self.env gen = self.generator path = gen.path bld = gen.bld if hasattr(gen, 'root'): build_root = path.find_node(gen.root) else: build_root = path jam = bld.srcnode.find_resource(env.BJAM_CONFIG) if jam: debug('bjam: Using jam configuration from ' + jam.srcpath()) jam_rel = jam.relpath_gen(build_root) else: warn('No build configuration in build_config/user-config.jam. Using default') jam_rel = None bjam_exe = bld.srcnode.find_node(env.BJAM) if not bjam_exe: error('env.BJAM is not set') return -1 bjam_exe_rel = bjam_exe.relpath_gen(build_root) cmd = ([bjam_exe_rel] + (['--user-config=' + jam_rel] if jam_rel else []) + ['--stagedir=' + path.get_bld().path_from(build_root)] + ['--debug-configuration'] + ['--with-' + lib for lib in self.generator.target] + (['toolset=' + env.BJAM_TOOLSET] if env.BJAM_TOOLSET else []) + ['link=' + 'shared'] + ['variant=' + 'release'] ) debug('runner: ' + build_root.srcpath() + '> ' + str(cmd)) ret = self.exec_command(cmd, cwd=build_root.srcpath()) if ret != 0: return ret self.set_outputs(path.get_bld().ant_glob('lib/*') + path.get_bld().ant_glob('bin/*')) return 0
def bibfile(self): """ Parse the *.aux* files to find a bibfile to process. If yes, execute :py:meth:`waflib.Tools.tex.tex.bibtex_fun` """ need_bibtex = False try: for aux_node in self.aux_nodes: ct = aux_node.read() if g_bibtex_re.findall(ct): need_bibtex = True break except (OSError, IOError): error('error bibtex scan') else: # only the main .aux file needs to be processed if need_bibtex: warn('calling bibtex') self.env.env = {} self.env.env.update(os.environ) self.env.env.update({'BIBINPUTS': self.TEXINPUTS, 'BSTINPUTS': self.TEXINPUTS}) self.env.SRCFILE = self.aux_nodes[0].name[:-4] self.check_status('error when calling bibtex', self.bibtex_fun())
def smplpkg(bld, name, use='', app_use='', test_use=''): use = list(set(to_list(use))) app_use = list(set(use + to_list(app_use))) test_use = list(set(use + to_list(test_use))) includes = [] headers = [] source = [] incdir = bld.path.find_dir('inc') srcdir = bld.path.find_dir('src') dictdir = bld.path.find_dir('dict') testsrc = bld.path.ant_glob('test/test_*.cxx') test_scripts = bld.path.ant_glob('test/test_*.sh') + bld.path.ant_glob( 'test/test_*.py') test_jsonnets = bld.path.ant_glob('test/test*.jsonnet') appsdir = bld.path.find_dir('apps') if incdir: headers += incdir.ant_glob(name + '/*.h') includes += ['inc'] bld.env['INCLUDES_' + name] = [incdir.abspath()] if headers: bld.install_files('${PREFIX}/include/%s' % name, headers) if srcdir: source += srcdir.ant_glob('*.cxx') source += srcdir.ant_glob('*.cu') # cuda # fixme: I should move this out of here. # root dictionary if dictdir: if not headers: error('No header files for ROOT dictionary "%s"' % name) #print 'Building ROOT dictionary: %s using %s' % (name,use) if 'ROOTSYS' in use: linkdef = dictdir.find_resource('LinkDef.h') bld.gen_rootcling_dict(name, linkdef, headers=headers, includes=includes, use=use) source.append(bld.path.find_or_declare(name + 'Dict.cxx')) else: warn( 'No ROOT dictionary will be generated for "%s" unless "ROOTSYS" added to "use"' % name) def get_rpath(uselst, local=True): ret = set([bld.env["PREFIX"] + "/lib"]) for one in uselst: libpath = bld.env["LIBPATH_" + one] for l in libpath: ret.add(l) if local: if one.startswith("WireCell"): sd = one[8:].lower() blddir = bld.path.find_or_declare(bld.out_dir) pkgdir = blddir.find_or_declare(sd).abspath() #print pkgdir ret.add(pkgdir) ret = list(ret) return ret # the library if incdir and srcdir: #print "Building library: %s using %s"%(name, use) bld(features='cxx cxxshlib', name=name, source=source, target=name, rpath=get_rpath(use), includes='inc', export_includes='inc', use=use) if appsdir: for app in appsdir.ant_glob('*.cxx'): #print 'Building %s app: %s using %s' % (name, app, app_use) bld.program(source=[app], target=app.name.replace('.cxx', ''), includes='inc', rpath=get_rpath(app_use + [name], local=False), use=app_use + [name]) if (testsrc or test_scripts) and not bld.options.no_tests: for test_main in testsrc: #print 'Building %s test: %s using %s' % (name, test_main, test_use) rpath = get_rpath(test_use + [name]) #print rpath bld.program(features='test', source=[test_main], ut_cwd=bld.path, target=test_main.name.replace('.cxx', ''), install_path=None, rpath=rpath, includes=['inc', 'test', 'tests'], use=test_use + [name]) for test_script in test_scripts: interp = "${BASH}" if test_script.abspath().endswith(".py"): interp = "${PYTHON}" #print 'Building %s test %s script: %s using %s' % (name, interp, test_script, test_use) bld(features="test_scripts", ut_cwd=bld.path, test_scripts_source=test_script, test_scripts_template="pwd && " + interp + " ${SCRIPT}") if test_jsonnets and not bld.options.no_tests: # print ("testing %d jsonnets in %s" % (len(test_jsonnets), bld.path )) for test_jsonnet in test_jsonnets: bld(features="test_scripts", ut_cwd=bld.path, test_scripts_source=test_jsonnet, test_scripts_template="pwd && wcsonnet ${SCRIPT}")
def run(self): """ Runs the TeX build process. It may require multiple passes, depending on the usage of cross-references, bibliographies, content susceptible of needing such passes. The appropriate TeX compiler is called until the *.aux* file ceases changing. Makeindex and bibtex are called if necessary. """ env = self.env bld = self.generator.bld if not env['PROMPT_LATEX']: env.append_value('LATEXFLAGS', '-interaction=batchmode') env.append_value('PDFLATEXFLAGS', '-interaction=batchmode') env.append_value('XELATEXFLAGS', '-interaction=batchmode') fun = self.texfun node = self.inputs[0] srcfile = node.abspath() self.TEXINPUTS = node.parent.get_bld().abspath() + os.pathsep + node.parent.get_src().abspath() + os.pathsep self.aux_node = node.change_ext('.aux') self.idx_node = node.change_ext('.idx') # important, set the cwd for everybody self.cwd = self.inputs[0].parent.get_bld().abspath() warn('first pass on %s' % self.__class__.__name__) self.env.env = {} self.env.env.update(os.environ) self.env.env.update({'TEXINPUTS': self.TEXINPUTS}) self.env.SRCFILE = srcfile self.check_status('error when calling latex', fun()) self.bibfile() self.bibunits() self.makeindex() hash = '' for i in range(10): # prevent against infinite loops - one never knows # watch the contents of file.aux and stop if file.aux does not change anymore prev_hash = hash try: hash = Utils.h_file(self.aux_node.abspath()) except (OSError, IOError): error('could not read aux.h -> %s' % self.aux_node.abspath()) pass if hash and hash == prev_hash: break # run the command warn('calling %s' % self.__class__.__name__) self.env.env = {} self.env.env.update(os.environ) self.env.env.update({'TEXINPUTS': self.TEXINPUTS}) self.env.SRCFILE = srcfile self.check_status('error when calling %s' % self.__class__.__name__, fun())
def tex_build(task,command='LATEX'): env=task.env bld=task.generator.bld if not env['PROMPT_LATEX']: env.append_value('LATEXFLAGS','-interaction=batchmode') env.append_value('PDFLATEXFLAGS','-interaction=batchmode') fun=latex_fun if command=='PDFLATEX': fun=pdflatex_fun node=task.inputs[0] srcfile=node.abspath() sr2=node.parent.get_bld().abspath()+os.pathsep+node.parent.get_src().abspath()+os.pathsep aux_node=node.change_ext('.aux') idx_node=node.change_ext('.idx') nm=aux_node.name docuname=nm[:len(nm)-4] task.cwd=task.inputs[0].parent.get_bld().abspath() warn('first pass on %s'%command) task.env.env={'TEXINPUTS':sr2} task.env.SRCFILE=srcfile ret=fun(task) if ret: return ret try: ct=Utils.readf(aux_node.abspath()) except(OSError,IOError): error('error bibtex scan') else: fo=g_bibtex_re.findall(ct) if fo: warn('calling bibtex') task.env.env={'BIBINPUTS':sr2,'BSTINPUTS':sr2} task.env.SRCFILE=docuname ret=bibtex_fun(task) if ret: error('error when calling bibtex %s'%docuname) return ret try: idx_path=idx_node.abspath() os.stat(idx_path) except OSError: error('error file.idx scan') else: warn('calling makeindex') task.env.SRCFILE=idx_node.name task.env.env={} ret=makeindex_fun(task) if ret: error('error when calling makeindex %s'%idx_path) return ret hash='' i=0 while i<10: i+=1 prev_hash=hash try: hash=Utils.h_file(aux_node.abspath()) except KeyError: error('could not read aux.h -> %s'%aux_node.abspath()) pass if hash and hash==prev_hash: break warn('calling %s'%command) task.env.env={'TEXINPUTS':sr2+os.pathsep} task.env.SRCFILE=srcfile ret=fun(task) if ret: error('error when calling %s %s'%(command,latex_compile_cmd)) return ret return None
def find_msvc(conf): """Due to path format limitations, limit operation only to native Win32. Yeah it sucks.""" if sys.platform == 'cygwin': conf.fatal('MSVC module does not work under cygwin Python!') v = conf.env compiler, version, path, includes, libdirs = detect_msvc(conf) v['PATH'] = path v['INCLUDES'] = includes v['LIBPATH'] = libdirs compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) v.MSVC_MANIFEST = (compiler == 'msvc' and float(version) >= 8) or (compiler == 'wsdk' and float(version) >= 6) or (compiler == 'intel' and float(version) >= 11) # compiler cxx = None if v['CXX']: cxx = v['CXX'] elif 'CXX' in conf.environ: cxx = conf.environ['CXX'] cxx = conf.find_program(compiler_name, var='CXX', path_list=path) cxx = conf.cmd_to_list(cxx) # before setting anything, check if the compiler is really msvc env = dict(conf.environ) env.update(PATH = ';'.join(path)) if not conf.cmd_and_log(cxx + ['/nologo', '/help'], env=env): conf.fatal('the msvc compiler could not be identified') # c/c++ compiler v['CC'] = v['CXX'] = cxx v['CC_NAME'] = v['CXX_NAME'] = 'msvc' # environment flags try: v.prepend_value('INCLUDES', conf.environ['INCLUDE']) # notice the 'S' except KeyError: pass try: v.prepend_value('LIBPATH', conf.environ['LIB']) except KeyError: pass # linker if not v['LINK_CXX']: link = conf.find_program(linker_name, path_list=path) if link: v['LINK_CXX'] = link else: conf.fatal('%s was not found (linker)' % linker_name) v['LINK'] = link if not v['LINK_CC']: v['LINK_CC'] = v['LINK_CXX'] # staticlib linker if not v['AR']: stliblink = conf.find_program(lib_name, path_list=path, var='AR') if not stliblink: return v['ARFLAGS'] = ['/NOLOGO'] # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later if v.MSVC_MANIFEST: mt = conf.find_program('MT', path_list=path, var='MT') v['MTFLAGS'] = ['/NOLOGO'] conf.load('winres') if not conf.env['WINRC']: warn('Resource compiler not found. Compiling resource file is disabled')
def tex_build(task, command='LATEX'): env = task.env bld = task.generator.bld if not env['PROMPT_LATEX']: env.append_value('LATEXFLAGS', '-interaction=batchmode') env.append_value('PDFLATEXFLAGS', '-interaction=batchmode') fun = latex_fun if command == 'PDFLATEX': fun = pdflatex_fun node = task.inputs[0] srcfile = node.abspath() sr2 = node.parent.get_bld().abspath() + os.pathsep + node.parent.get_src().abspath() + os.pathsep aux_node = node.change_ext('.aux') idx_node = node.change_ext('.idx') nm = aux_node.name docuname = nm[ : len(nm) - 4 ] # 4 is the size of ".aux" # important, set the cwd for everybody task.cwd = task.inputs[0].parent.get_bld().abspath() warn('first pass on %s' % command) task.env.env = {'TEXINPUTS': sr2} task.env.SRCFILE = srcfile ret = fun(task) if ret: return ret # look in the .aux file if there is a bibfile to process try: ct = Utils.readf(aux_node.abspath()) except (OSError, IOError): error('error bibtex scan') else: fo = g_bibtex_re.findall(ct) # there is a .aux file to process if fo: warn('calling bibtex') task.env.env = {'BIBINPUTS': sr2, 'BSTINPUTS': sr2} task.env.SRCFILE = docuname ret = bibtex_fun(task) if ret: error('error when calling bibtex %s' % docuname) return ret # look on the filesystem if there is a .idx file to process try: idx_path = idx_node.abspath() os.stat(idx_path) except OSError: error('error file.idx scan') else: warn('calling makeindex') task.env.SRCFILE = idx_node.name task.env.env = {} ret = makeindex_fun(task) if ret: error('error when calling makeindex %s' % idx_path) return ret hash = '' i = 0 while i < 10: # prevent against infinite loops - one never knows i += 1 # watch the contents of file.aux prev_hash = hash try: hash = Utils.h_file(aux_node.abspath()) except KeyError: error('could not read aux.h -> %s' % aux_node.abspath()) pass # debug #print "hash is, ", hash, " ", old_hash # stop if file.aux does not change anymore if hash and hash == prev_hash: break # run the command warn('calling %s' % command) task.env.env = {'TEXINPUTS': sr2 + os.pathsep} task.env.SRCFILE = srcfile ret = fun(task) if ret: error('error when calling %s %s' % (command, latex_compile_cmd)) return ret return None # ok
def find_msvc(conf): # due to path format limitations, limit operation only to native Win32. Yeah it sucks. if sys.platform != 'win32': conf.fatal('MSVC module only works under native Win32 Python! cygwin is not supported yet') v = conf.env compiler, path, includes, libdirs = detect_msvc(conf) v['PATH'] = path v['INCLUDES'] = includes v['LIBPATH'] = libdirs compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) # compiler cxx = None if v['CXX']: cxx = v['CXX'] elif 'CXX' in conf.environ: cxx = conf.environ['CXX'] if not cxx: cxx = conf.find_program(compiler_name, var='CXX', path_list=path) if not cxx: conf.fatal('%s was not found (compiler)' % compiler_name) cxx = conf.cmd_to_list(cxx) # before setting anything, check if the compiler is really msvc env = dict(conf.environ) env.update(PATH = ';'.join(path)) if not conf.cmd_and_log(cxx + ['/nologo', '/?'], env=env): conf.fatal('the msvc compiler could not be identified') # c/c++ compiler v['CC'] = v['CXX'] = cxx v['CC_NAME'] = v['CXX_NAME'] = 'msvc' # environment flags try: v.prepend_value('INCLUDES', conf.environ['INCLUDE']) except KeyError: pass try: v.prepend_value('LIBPATH', conf.environ['LIB']) except KeyError: pass # linker if not v['LINK_CXX']: link = conf.find_program(linker_name, path_list=path) if link: v['LINK_CXX'] = link else: conf.fatal('%s was not found (linker)' % linker_name) v['LINK'] = link if not v['LINK_CC']: v['LINK_CC'] = v['LINK_CXX'] # staticlib linker if not v['AR']: stliblink = conf.find_program(lib_name, path_list=path) if not stliblink: return v['AR'] = stliblink v['ARFLAGS'] = ['/NOLOGO'] # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later manifesttool = conf.find_program('MT', path_list=path) if manifesttool: v['MT'] = [manifesttool] v['MTFLAGS'] = ['/NOLOGO'] conf.check_tool('winres') if not conf.env['WINRC']: warn('Resource compiler not found. Compiling resource file is disabled')
def run(self): """ Runs the TeX build process. It may require multiple passes, depending on the usage of cross-references, bibliographies, content susceptible of needing such passes. The appropriate TeX compiler is called until the *.aux* files stop changing. Makeindex and bibtex are called if necessary. """ env = self.env if not env['PROMPT_LATEX']: env.append_value('LATEXFLAGS', '-interaction=batchmode') env.append_value('PDFLATEXFLAGS', '-interaction=batchmode') env.append_value('XELATEXFLAGS', '-interaction=batchmode') fun = self.texfun node = self.inputs[0] srcfile = node.abspath() texinputs = self.env.TEXINPUTS or '' self.TEXINPUTS = node.parent.get_bld().abspath( ) + os.pathsep + node.parent.get_src().abspath( ) + os.pathsep + texinputs + os.pathsep self.aux_node = node.change_ext( '.aux') # TODO waf 1.7 remove (left for compatibility) # important, set the cwd for everybody self.cwd = self.inputs[0].parent.get_bld().abspath() warn('first pass on %s' % self.__class__.__name__) self.env.env = {} self.env.env.update(os.environ) self.env.env.update({'TEXINPUTS': self.TEXINPUTS}) self.env.SRCFILE = srcfile self.check_status('error when calling latex', fun()) self.aux_nodes = self.scan_aux(node.change_ext('.aux')) self.idx_node = node.change_ext('.idx') self.bibfile() self.bibunits() self.makeindex() hash = '' for i in range(10): # prevent against infinite loops - one never knows # watch the contents of file.aux and stop if file.aux does not change anymore prev_hash = hash try: hashes = [Utils.h_file(x.abspath()) for x in self.aux_nodes] hash = Utils.h_list(hashes) except (OSError, IOError): error('could not read aux.h') pass if hash and hash == prev_hash: break # run the command warn('calling %s' % self.__class__.__name__) self.env.env = {} self.env.env.update(os.environ) self.env.env.update({'TEXINPUTS': self.TEXINPUTS}) self.env.SRCFILE = srcfile self.check_status( 'error when calling %s' % self.__class__.__name__, fun())
def find_msvc(conf): """Due to path format limitations, limit operation only to native Win32. Yeah it sucks.""" if sys.platform == "cygwin": conf.fatal("MSVC module does not work under cygwin Python!") # the autodetection is supposed to be performed before entering in this method v = conf.env path = v["PATH"] compiler = v["MSVC_COMPILER"] version = v["MSVC_VERSION"] compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) v.MSVC_MANIFEST = ( (compiler == "msvc" and version >= 8) or (compiler == "wsdk" and version >= 6) or (compiler == "intel" and version >= 11) ) # compiler cxx = None if v["CXX"]: cxx = v["CXX"] elif "CXX" in conf.environ: cxx = conf.environ["CXX"] cxx = conf.find_program(compiler_name, var="CXX", path_list=path) # before setting anything, check if the compiler is really msvc env = dict(conf.environ) if path: env.update(PATH=";".join(path)) if not conf.cmd_and_log(cxx + ["/nologo", "/help"], env=env): conf.fatal("the msvc compiler could not be identified") # c/c++ compiler v["CC"] = v["CXX"] = cxx v["CC_NAME"] = v["CXX_NAME"] = "msvc" # linker if not v["LINK_CXX"]: link = conf.find_program(linker_name, path_list=path) if link: v["LINK_CXX"] = link else: conf.fatal("%s was not found (linker)" % linker_name) v["LINK"] = link if not v["LINK_CC"]: v["LINK_CC"] = v["LINK_CXX"] # staticlib linker if not v["AR"]: stliblink = conf.find_program(lib_name, path_list=path, var="AR") if not stliblink: return v["ARFLAGS"] = ["/NOLOGO"] # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later if v.MSVC_MANIFEST: conf.find_program("MT", path_list=path, var="MT") v["MTFLAGS"] = ["/NOLOGO"] try: conf.load("winres") except Errors.WafError: warn("Resource compiler not found. Compiling resource file is disabled")
def find_msvc(conf): """Due to path format limitations, limit operation only to native Win32. Yeah it sucks.""" if sys.platform == 'cygwin': conf.fatal('MSVC module does not work under cygwin Python!') # the autodetection is supposed to be performed before entering in this method v = conf.env path = v['PATH'] compiler = v['MSVC_COMPILER'] version = v['MSVC_VERSION'] compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) v.MSVC_MANIFEST = (compiler == 'msvc' and version >= 8) or ( compiler == 'wsdk' and version >= 6) or (compiler == 'intel' and version >= 11) # compiler cxx = None if v['CXX']: cxx = v['CXX'] elif 'CXX' in conf.environ: cxx = conf.environ['CXX'] cxx = conf.find_program(compiler_name, var='CXX', path_list=path, silent_output=True) cxx = conf.cmd_to_list(cxx) # before setting anything, check if the compiler is really msvc env = dict(conf.environ) if path: env.update(PATH=';'.join(path)) if not conf.cmd_and_log(cxx + ['/nologo', '/help'], env=env): conf.fatal('the msvc compiler could not be identified') # c/c++ compiler v['CC'] = v['CXX'] = cxx[0] v['CC_NAME'] = v['CXX_NAME'] = 'msvc' # linker if not v['LINK_CXX']: link = conf.find_program(linker_name, path_list=path, silent_output=True) if link: v['LINK_CXX'] = link else: conf.fatal('%s was not found (linker)' % linker_name) v['LINK'] = link if not v['LINK_CC']: v['LINK_CC'] = v['LINK_CXX'] # staticlib linker if not v['AR']: stliblink = conf.find_program(lib_name, path_list=path, var='AR', silent_output=True) if not stliblink: return v['ARFLAGS'] = ['/NOLOGO'] # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later if v.MSVC_MANIFEST: conf.find_program('MT', path_list=path, var='MT', silent_output=True) v['MTFLAGS'] = ['/NOLOGO'] try: conf.load('winres') except Errors.WafError: warn( 'Resource compiler not found. Compiling resource file is disabled')
def find_msvc(conf): """Due to path format limitations, limit operation only to native Win32. Yeah it sucks.""" if sys.platform == 'cygwin': conf.fatal('MSVC module does not work under cygwin Python!') # the autodetection is supposed to be performed before entering in this method v = conf.env path = v['PATH'] compiler = v['MSVC_COMPILER'] version = v['MSVC_VERSION'] compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) v.MSVC_MANIFEST = (compiler == 'msvc' and version >= 8) or ( compiler == 'wsdk' and version >= 6) or (compiler == 'intel' and version >= 11) # compiler cxx = None if v['CXX']: cxx = v['CXX'] elif 'CXX' in conf.environ: cxx = conf.environ['CXX'] cxx = conf.find_program(compiler_name, var='CXX', path_list=path, silent_output=True) cxx = conf.cmd_to_list(cxx) # before setting anything, check if the compiler is really msvc env = dict(conf.environ) if path: env.update(PATH=';'.join(path)) if not conf.cmd_and_log(cxx + ['/nologo', '/help'], env=env): conf.fatal('the msvc compiler could not be identified') # c/c++ compiler v['CC'] = v['CXX'] = cxx[0] v['CC_NAME'] = v['CXX_NAME'] = 'msvc' # Bullseye code coverage if conf.is_option_true('use_bullseye_coverage'): # TODO: Error handling for this is opaque. This will fail the MSVS 2015 tool check, # and not say anything about bullseye being missing. try: covc = conf.find_program('covc', var='BULL_COVC', path_list=path, silent_output=True) covlink = conf.find_program('covlink', var='BULL_COVLINK', path_list=path, silent_output=True) covselect = conf.find_program('covselect', var='BULL_COVSELECT', path_list=path, silent_output=True) v['BULL_COVC'] = covc v['BULL_COVLINK'] = covlink v['BULL_COV_FILE'] = conf.CreateRootRelativePath( conf.options.bullseye_cov_file) # Update the coverage file with the region selections detailed in the settings regions parameters # NOTE: should we clear other settings at this point, or allow them to accumulate? # Maybe we need a flag for that in the setup? regions = conf.options.bullseye_coverage_regions.replace( ' ', '').split(',') conf.cmd_and_log( ([covselect] + ['--file', v['BULL_COV_FILE'], '-a'] + regions)) except: Logs.error( 'Could not find the Bullseye Coverage tools on the path, or coverage tools are not correctly installed. Coverage build disabled.' ) # linker if not v['LINK_CXX']: link = conf.find_program(linker_name, path_list=path, silent_output=True) if link: v['LINK_CXX'] = link else: conf.fatal('%s was not found (linker)' % linker_name) v['LINK'] = link if not v['LINK_CC']: v['LINK_CC'] = v['LINK_CXX'] # staticlib linker if not v['AR']: stliblink = conf.find_program(lib_name, path_list=path, var='AR', silent_output=True) if not stliblink: return v['ARFLAGS'] = ['/NOLOGO'] # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later if v.MSVC_MANIFEST: conf.find_program('MT', path_list=path, var='MT', silent_output=True) v['MTFLAGS'] = ['/NOLOGO'] # call configure on the waflib winres module to setup the environment for configure # conf.load('winres') caches the environment as part of the module load key, and we just modified # the environment, causing the cache to miss, and extra calls import/load the module # winres is loaded try: module = sys.modules['waflib.Tools.winres'] func = getattr(module, 'configure', None) if func: func(conf) except Error as e: warn( 'Resource compiler not found. Compiling resource file is disabled')