<s> """<STR_LIT>""" <EOL> __revision__ = "<STR_LIT>" <EOL> import os . path <EOL> import re <EOL> import SCons . Action <EOL> import SCons . Defaults <EOL> import SCons . Scanner <EOL> import SCons . Tool <EOL> import SCons . Util <EOL> SwigAction = SCons . Action . Action ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def swigSuffixEmitter ( env , source ) : <EOL> if '<STR_LIT>' in SCons . Util . CLVar ( env . subst ( "<STR_LIT>" , source = source ) ) : <EOL> return '<STR_LIT>' <EOL> else : <EOL> return '<STR_LIT>' <EOL> _reModule = re . compile ( r'<STR_LIT>' ) <EOL> def _find_modules ( src ) : <EOL> """<STR_LIT>""" <EOL> mnames = [ ] <EOL> matches = _reModule . findall ( open ( src ) . read ( ) ) <EOL> for m in matches : <EOL> mnames . append ( m [ <NUM_LIT:2> ] ) <EOL> return mnames <EOL> def _swigEmitter ( target , source , env ) : <EOL> swigflags = env . subst ( "<STR_LIT>" , target = target , source = source ) <EOL> flags = SCons . Util . CLVar ( swigflags ) <EOL> for src in source : <EOL> src = str ( src . rfile ( ) ) <EOL> mnames = None <EOL> if "<STR_LIT>" in flags and "<STR_LIT>" not in flags : <EOL> if mnames is None : <EOL> mnames = _find_modules ( src ) <EOL> target . extend ( map ( lambda m , d = target [ <NUM_LIT:0> ] . dir : <EOL> d . File ( m + "<STR_LIT>" ) , mnames ) ) <EOL> if "<STR_LIT>" in flags : <EOL> if mnames is None : <EOL> mnames = _find_modules ( src ) <EOL> java_files = map ( lambda m : [ m + "<STR_LIT>" , m + "<STR_LIT>" ] , mnames ) <EOL> java_files = SCons . Util . flatten ( java_files ) <EOL> outdir = env . subst ( '<STR_LIT>' , target = target , source = source ) <EOL> if outdir : <EOL> java_files = map ( lambda j , o = outdir : os . path . join ( o , j ) , java_files ) <EOL> java_files = map ( env . fs . File , java_files ) <EOL> for jf in java_files : <EOL> t_from_s = lambda t , p , s , x : t . dir <EOL> SCons . Util . AddMethod ( jf , t_from_s , '<STR_LIT>' ) <EOL> target . extend ( java_files ) <EOL> return ( target , source ) <EOL> def generate ( env ) : <EOL> """<STR_LIT>""" <EOL> c_file , cxx_file = SCons . Tool . createCFileBuilders ( env ) <EOL> c_file . suffix [ '<STR_LIT>' ] = swigSuffixEmitter <EOL> cxx_file . suffix [ '<STR_LIT>' ] = swigSuffixEmitter <EOL> c_file . add_action ( '<STR_LIT>' , SwigAction ) <EOL> c_file . add_emitter ( '<STR_LIT>' , _swigEmitter ) <EOL> cxx_file . add_action ( '<STR_LIT>' , SwigAction ) <EOL> cxx_file . add_emitter ( '<STR_LIT>' , _swigEmitter ) <EOL> java_file = SCons . Tool . CreateJavaFileBuilder ( env ) <EOL> java_file . suffix [ '<STR_LIT>' ] = swigSuffixEmitter <EOL> java_file . add_action ( '<STR_LIT>' , SwigAction ) <EOL> java_file . add_emitter ( '<STR_LIT>' , _swigEmitter ) <EOL> env [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> env [ '<STR_LIT>' ] = SCons . Util . CLVar ( '<STR_LIT>' ) <EOL> env [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> env [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> env [ '<STR_LIT>' ] = r'<STR_LIT>' <EOL> env [ '<STR_LIT>' ] = [ ] <EOL> env [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> env [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> env [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> env [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> expr = '<STR_LIT>' <EOL> scanner = SCons . Scanner . ClassicCPP ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , expr ) <EOL> env . Append ( SCANNERS = scanner ) <EOL> def exists ( env ) : <EOL> return env . Detect ( [ '<STR_LIT>' ] ) </s>
