#! /usr/bin/env python # encoding: utf-8 import os import Task,Options,Utils from Configure import conf from TaskGen import extension,taskgen,feature,before xsubpp_str='${PERL} ${XSUBPP} -noprototypes -typemap ${EXTUTILS_TYPEMAP} ${SRC} > ${TGT}' EXT_XS=['.xs'] def init_perlext(self): self.uselib=self.to_list(getattr(self,'uselib','')) if not'PERL'in self.uselib:self.uselib.append('PERL') if not'PERLEXT'in self.uselib:self.uselib.append('PERLEXT') self.env['shlib_PATTERN']=self.env['perlext_PATTERN'] def xsubpp_file(self,node): outnode=node.change_ext('.c') self.create_task('xsubpp',node,outnode) self.allnodes.append(outnode) Task.simple_task_type('xsubpp',xsubpp_str,color='BLUE',before='cc cxx',shell=False) def check_perl_version(conf,minver=None): if getattr(Options.options,'perlbinary',None): conf.env.PERL=Options.options.perlbinary else: conf.find_program('perl',var='PERL',mandatory=True) try: version=Utils.cmd_output([conf.env.PERL,'-e','printf "%vd",$^V']) except: conf.fatal('could not determine the perl version') conf.env.PERL_VERSION=version cver='' if minver: try: ver=tuple(map(int,version.split('.'))) except: conf.fatal('unsupported perl version %r'%version) if ver