code
stringlengths
1
1.49M
vector
listlengths
0
7.38k
snippet
listlengths
0
7.38k
"""engine.SCons.Tool.cvf Tool-specific initialization for the Compaq Visual Fortran compiler. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Tool/cvf.py 4720 2010/03/24 03:14:11 jars" import fortran compilers = ['f90'] def generate(env): """Add Builders and construction variables for compaq visual fortran to an Environment.""" fortran.generate(env) env['FORTRAN'] = 'f90' env['FORTRANCOM'] = '$FORTRAN $FORTRANFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows}' env['FORTRANPPCOM'] = '$FORTRAN $FORTRANFLAGS $CPPFLAGS $_CPPDEFFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows}' env['SHFORTRANCOM'] = '$SHFORTRAN $SHFORTRANFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows}' env['SHFORTRANPPCOM'] = '$SHFORTRAN $SHFORTRANFLAGS $CPPFLAGS $_CPPDEFFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows}' env['OBJSUFFIX'] = '.obj' env['FORTRANMODDIR'] = '${TARGET.dir}' env['FORTRANMODDIRPREFIX'] = '/module:' env['FORTRANMODDIRSUFFIX'] = '' def exists(env): return env.Detect(compilers) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0517, 0.0862, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.5172, 0.0172, 0, 0.66, 0.2, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.5517, 0.0172, 0, 0.66, ...
[ "\"\"\"engine.SCons.Tool.cvf\n\nTool-specific initialization for the Compaq Visual Fortran compiler.\n\n\"\"\"", "__revision__ = \"src/engine/SCons/Tool/cvf.py 4720 2010/03/24 03:14:11 jars\"", "import fortran", "compilers = ['f90']", "def generate(env):\n \"\"\"Add Builders and construction variables fo...
"""SCons.Tool.yacc Tool-specific initialization for yacc. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Tool/yacc.py 4720 2010/03/24 03:14:11 jars" import os.path import string import SCons.Defaults import SCons.Tool import SCons.Util YaccAction = SCons.Action.Action("$YACCCOM", "$YACCCOMSTR") def _yaccEmitter(target, source, env, ysuf, hsuf): yaccflags = env.subst("$YACCFLAGS", target=target, source=source) flags = SCons.Util.CLVar(yaccflags) targetBase, targetExt = os.path.splitext(SCons.Util.to_String(target[0])) if '.ym' in ysuf: # If using Objective-C target = [targetBase + ".m"] # the extension is ".m". # If -d is specified on the command line, yacc will emit a .h # or .hpp file with the same name as the .c or .cpp output file. if '-d' in flags: target.append(targetBase + env.subst(hsuf, target=target, source=source)) # If -g is specified on the command line, yacc will emit a .vcg # file with the same base name as the .y, .yacc, .ym or .yy file. if "-g" in flags: base, ext = os.path.splitext(SCons.Util.to_String(source[0])) target.append(base + env.subst("$YACCVCGFILESUFFIX")) # With --defines and --graph, the name of the file is totally defined # in the options. fileGenOptions = ["--defines=", "--graph="] for option in flags: for fileGenOption in fileGenOptions: l = len(fileGenOption) if option[:l] == fileGenOption: # A file generating option is present, so add the file # name to the list of targets. fileName = string.strip(option[l:]) target.append(fileName) return (target, source) def yEmitter(target, source, env): return _yaccEmitter(target, source, env, ['.y', '.yacc'], '$YACCHFILESUFFIX') def ymEmitter(target, source, env): return _yaccEmitter(target, source, env, ['.ym'], '$YACCHFILESUFFIX') def yyEmitter(target, source, env): return _yaccEmitter(target, source, env, ['.yy'], '$YACCHXXFILESUFFIX') def generate(env): """Add Builders and construction variables for yacc to an Environment.""" c_file, cxx_file = SCons.Tool.createCFileBuilders(env) # C c_file.add_action('.y', YaccAction) c_file.add_emitter('.y', yEmitter) c_file.add_action('.yacc', YaccAction) c_file.add_emitter('.yacc', yEmitter) # Objective-C c_file.add_action('.ym', YaccAction) c_file.add_emitter('.ym', ymEmitter) # C++ cxx_file.add_action('.yy', YaccAction) cxx_file.add_emitter('.yy', yyEmitter) env['YACC'] = env.Detect('bison') or 'yacc' env['YACCFLAGS'] = SCons.Util.CLVar('') env['YACCCOM'] = '$YACC $YACCFLAGS -o $TARGET $SOURCES' env['YACCHFILESUFFIX'] = '.h' # Apparently, OS X now creates file.hpp like everybody else # I have no idea when it changed; it was fixed in 10.4 #if env['PLATFORM'] == 'darwin': # # Bison on Mac OS X just appends ".h" to the generated target .cc # # or .cpp file name. Hooray for delayed expansion of variables. # env['YACCHXXFILESUFFIX'] = '${TARGET.suffix}.h' #else: # env['YACCHXXFILESUFFIX'] = '.hpp' env['YACCHXXFILESUFFIX'] = '.hpp' env['YACCVCGFILESUFFIX'] = '.vcg' def exists(env): return env.Detect(['bison', 'yacc']) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0382, 0.0687, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.2595, 0.0076, 0, 0.66, 0.0769, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.2748, 0.0076, 0, 0.66,...
[ "\"\"\"SCons.Tool.yacc\n\nTool-specific initialization for yacc.\n\nThere normally shouldn't be any need to import this module directly.\nIt will usually be imported through the generic SCons.Tool.Tool()\nselection method.", "__revision__ = \"src/engine/SCons/Tool/yacc.py 4720 2010/03/24 03:14:11 jars\"", "impo...
"""SCons.Tool.rpcgen Tool-specific initialization for RPCGEN tools. Three normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Tool/rpcgen.py 4720 2010/03/24 03:14:11 jars" from SCons.Builder import Builder import SCons.Util cmd = "cd ${SOURCE.dir} && $RPCGEN -%s $RPCGENFLAGS %s -o ${TARGET.abspath} ${SOURCE.file}" rpcgen_client = cmd % ('l', '$RPCGENCLIENTFLAGS') rpcgen_header = cmd % ('h', '$RPCGENHEADERFLAGS') rpcgen_service = cmd % ('m', '$RPCGENSERVICEFLAGS') rpcgen_xdr = cmd % ('c', '$RPCGENXDRFLAGS') def generate(env): "Add RPCGEN Builders and construction variables for an Environment." client = Builder(action=rpcgen_client, suffix='_clnt.c', src_suffix='.x') header = Builder(action=rpcgen_header, suffix='.h', src_suffix='.x') service = Builder(action=rpcgen_service, suffix='_svc.c', src_suffix='.x') xdr = Builder(action=rpcgen_xdr, suffix='_xdr.c', src_suffix='.x') env.Append(BUILDERS={'RPCGenClient' : client, 'RPCGenHeader' : header, 'RPCGenService' : service, 'RPCGenXDR' : xdr}) env['RPCGEN'] = 'rpcgen' env['RPCGENFLAGS'] = SCons.Util.CLVar('') env['RPCGENCLIENTFLAGS'] = SCons.Util.CLVar('') env['RPCGENHEADERFLAGS'] = SCons.Util.CLVar('') env['RPCGENSERVICEFLAGS'] = SCons.Util.CLVar('') env['RPCGENXDRFLAGS'] = SCons.Util.CLVar('') def exists(env): return env.Detect('rpcgen') # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0643, 0.1143, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.4714, 0.0143, 0, 0.66, 0.1, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.5, 0.0143, 0, 0.66, 0...
[ "\"\"\"SCons.Tool.rpcgen\n\nTool-specific initialization for RPCGEN tools.\n\nThree normally shouldn't be any need to import this module directly.\nIt will usually be imported through the generic SCons.Tool.Tool()\nselection method.\n\"\"\"", "__revision__ = \"src/engine/SCons/Tool/rpcgen.py 4720 2010/03/24 03:14...
"""SCons.Tool.Perforce.py Tool-specific initialization for Perforce Source Code Management system. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Tool/Perforce.py 4720 2010/03/24 03:14:11 jars" import os import SCons.Action import SCons.Builder import SCons.Node.FS import SCons.Util # This function should maybe be moved to SCons.Util? from SCons.Tool.PharLapCommon import addPathIfNotExists # Variables that we want to import from the base OS environment. _import_env = [ 'P4PORT', 'P4CLIENT', 'P4USER', 'USER', 'USERNAME', 'P4PASSWD', 'P4CHARSET', 'P4LANGUAGE', 'SystemRoot' ] PerforceAction = SCons.Action.Action('$P4COM', '$P4COMSTR') def generate(env): """Add a Builder factory function and construction variables for Perforce to an Environment.""" def PerforceFactory(env=env): """ """ return SCons.Builder.Builder(action = PerforceAction, env = env) #setattr(env, 'Perforce', PerforceFactory) env.Perforce = PerforceFactory env['P4'] = 'p4' env['P4FLAGS'] = SCons.Util.CLVar('') env['P4COM'] = '$P4 $P4FLAGS sync $TARGET' try: environ = env['ENV'] except KeyError: environ = {} env['ENV'] = environ # Perforce seems to use the PWD environment variable rather than # calling getcwd() for itself, which is odd. If no PWD variable # is present, p4 WILL call getcwd, but this seems to cause problems # with good ol' Windows's tilde-mangling for long file names. environ['PWD'] = env.Dir('#').get_abspath() for var in _import_env: v = os.environ.get(var) if v: environ[var] = v if SCons.Util.can_read_reg: # If we can read the registry, add the path to Perforce to our environment. try: k=SCons.Util.RegOpenKeyEx(SCons.Util.hkey_mod.HKEY_LOCAL_MACHINE, 'Software\\Perforce\\environment') val, tok = SCons.Util.RegQueryValueEx(k, 'P4INSTROOT') addPathIfNotExists(environ, 'PATH', val) except SCons.Util.RegError: # Can't detect where Perforce is, hope the user has it set in the # PATH. pass def exists(env): return env.Detect('p4') # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0481, 0.0865, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.3269, 0.0096, 0, 0.66, 0.0909, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.3462, 0.0096, 0, 0.66,...
[ "\"\"\"SCons.Tool.Perforce.py\n\nTool-specific initialization for Perforce Source Code Management system.\n\nThere normally shouldn't be any need to import this module directly.\nIt will usually be imported through the generic SCons.Tool.Tool()\nselection method.", "__revision__ = \"src/engine/SCons/Tool/Perforce...
"""SCons.Tool.aixcc Tool-specific initialization for IBM xlc / Visual Age C compiler. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Tool/aixcc.py 4720 2010/03/24 03:14:11 jars" import os.path import SCons.Platform.aix import cc packages = ['vac.C', 'ibmcxx.cmp'] def get_xlc(env): xlc = env.get('CC', 'xlc') xlc_r = env.get('SHCC', 'xlc_r') return SCons.Platform.aix.get_xlc(env, xlc, xlc_r, packages) def generate(env): """Add Builders and construction variables for xlc / Visual Age suite to an Environment.""" path, _cc, _shcc, version = get_xlc(env) if path: _cc = os.path.join(path, _cc) _shcc = os.path.join(path, _shcc) cc.generate(env) env['CC'] = _cc env['SHCC'] = _shcc env['CCVERSION'] = version def exists(env): path, _cc, _shcc, version = get_xlc(env) if path and _cc: xlc = os.path.join(path, _cc) if os.path.exists(xlc): return xlc return None # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0608, 0.1081, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.4459, 0.0135, 0, 0.66, 0.125, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.473, 0.0135, 0, 0.66, ...
[ "\"\"\"SCons.Tool.aixcc\n\nTool-specific initialization for IBM xlc / Visual Age C compiler.\n\nThere normally shouldn't be any need to import this module directly.\nIt will usually be imported through the generic SCons.Tool.Tool()\nselection method.\n\"\"\"", "__revision__ = \"src/engine/SCons/Tool/aixcc.py 4720...
"""SCons.Tool.wix Tool-specific initialization for wix, the Windows Installer XML Tool. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Tool/wix.py 4720 2010/03/24 03:14:11 jars" import SCons.Builder import SCons.Action import os import string def generate(env): """Add Builders and construction variables for WiX to an Environment.""" if not exists(env): return env['WIXCANDLEFLAGS'] = ['-nologo'] env['WIXCANDLEINCLUDE'] = [] env['WIXCANDLECOM'] = '$WIXCANDLE $WIXCANDLEFLAGS -I $WIXCANDLEINCLUDE -o ${TARGET} ${SOURCE}' env['WIXLIGHTFLAGS'].append( '-nologo' ) env['WIXLIGHTCOM'] = "$WIXLIGHT $WIXLIGHTFLAGS -out ${TARGET} ${SOURCES}" object_builder = SCons.Builder.Builder( action = '$WIXCANDLECOM', suffix = '.wxiobj', src_suffix = '.wxs') linker_builder = SCons.Builder.Builder( action = '$WIXLIGHTCOM', src_suffix = '.wxiobj', src_builder = object_builder) env['BUILDERS']['WiX'] = linker_builder def exists(env): env['WIXCANDLE'] = 'candle.exe' env['WIXLIGHT'] = 'light.exe' # try to find the candle.exe and light.exe tools and # add the install directory to light libpath. #for path in os.environ['PATH'].split(os.pathsep): for path in string.split(os.environ['PATH'], os.pathsep): if not path: continue # workaround for some weird python win32 bug. if path[0] == '"' and path[-1:]=='"': path = path[1:-1] # normalize the path path = os.path.normpath(path) # search for the tools in the PATH environment variable try: if env['WIXCANDLE'] in os.listdir(path) and\ env['WIXLIGHT'] in os.listdir(path): env.PrependENVPath('PATH', path) env['WIXLIGHTFLAGS'] = [ os.path.join( path, 'wixui.wixlib' ), '-loc', os.path.join( path, 'WixUI_en-us.wxl' ) ] return 1 except OSError: pass # ignore this, could be a stale PATH entry. return None # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.045, 0.08, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.33, 0.01, 0, 0.66, 0.1429, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.35, 0.01, 0, 0.66, 0.2857...
[ "\"\"\"SCons.Tool.wix\n\nTool-specific initialization for wix, the Windows Installer XML Tool.\n\nThere normally shouldn't be any need to import this module directly.\nIt will usually be imported through the generic SCons.Tool.Tool()\nselection method.\n\"\"\"", "__revision__ = \"src/engine/SCons/Tool/wix.py 4720...
"""SCons.Tool.javac Tool-specific initialization for javac. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Tool/javac.py 4720 2010/03/24 03:14:11 jars" import os import os.path import string import SCons.Action import SCons.Builder from SCons.Node.FS import _my_normcase from SCons.Tool.JavaCommon import parse_java_file import SCons.Util def classname(path): """Turn a string (path name) into a Java class name.""" return string.replace(os.path.normpath(path), os.sep, '.') def emit_java_classes(target, source, env): """Create and return lists of source java files and their corresponding target class files. """ java_suffix = env.get('JAVASUFFIX', '.java') class_suffix = env.get('JAVACLASSSUFFIX', '.class') target[0].must_be_same(SCons.Node.FS.Dir) classdir = target[0] s = source[0].rentry().disambiguate() if isinstance(s, SCons.Node.FS.File): sourcedir = s.dir.rdir() elif isinstance(s, SCons.Node.FS.Dir): sourcedir = s.rdir() else: raise SCons.Errors.UserError("Java source must be File or Dir, not '%s'" % s.__class__) slist = [] js = _my_normcase(java_suffix) find_java = lambda n, js=js, ljs=len(js): _my_normcase(n[-ljs:]) == js for entry in source: entry = entry.rentry().disambiguate() if isinstance(entry, SCons.Node.FS.File): slist.append(entry) elif isinstance(entry, SCons.Node.FS.Dir): result = SCons.Util.OrderedDict() def visit(arg, dirname, names, fj=find_java, dirnode=entry.rdir()): java_files = filter(fj, names) # The on-disk entries come back in arbitrary order. Sort # them so our target and source lists are determinate. java_files.sort() mydir = dirnode.Dir(dirname) java_paths = map(lambda f, d=mydir: d.File(f), java_files) for jp in java_paths: arg[jp] = True os.path.walk(entry.rdir().get_abspath(), visit, result) entry.walk(visit, result) slist.extend(result.keys()) else: raise SCons.Errors.UserError("Java source must be File or Dir, not '%s'" % entry.__class__) version = env.get('JAVAVERSION', '1.4') full_tlist = [] for f in slist: tlist = [] source_file_based = True pkg_dir = None if not f.is_derived(): pkg_dir, classes = parse_java_file(f.rfile().get_abspath(), version) if classes: source_file_based = False if pkg_dir: d = target[0].Dir(pkg_dir) p = pkg_dir + os.sep else: d = target[0] p = '' for c in classes: t = d.File(c + class_suffix) t.attributes.java_classdir = classdir t.attributes.java_sourcedir = sourcedir t.attributes.java_classname = classname(p + c) tlist.append(t) if source_file_based: base = f.name[:-len(java_suffix)] if pkg_dir: t = target[0].Dir(pkg_dir).File(base + class_suffix) else: t = target[0].File(base + class_suffix) t.attributes.java_classdir = classdir t.attributes.java_sourcedir = f.dir t.attributes.java_classname = classname(base) tlist.append(t) for t in tlist: t.set_specific_source([f]) full_tlist.extend(tlist) return full_tlist, slist JavaAction = SCons.Action.Action('$JAVACCOM', '$JAVACCOMSTR') JavaBuilder = SCons.Builder.Builder(action = JavaAction, emitter = emit_java_classes, target_factory = SCons.Node.FS.Entry, source_factory = SCons.Node.FS.Entry) class pathopt: """ Callable object for generating javac-style path options from a construction variable (e.g. -classpath, -sourcepath). """ def __init__(self, opt, var, default=None): self.opt = opt self.var = var self.default = default def __call__(self, target, source, env, for_signature): path = env[self.var] if path and not SCons.Util.is_List(path): path = [path] if self.default: path = path + [ env[self.default] ] if path: return [self.opt, string.join(path, os.pathsep)] #return self.opt + " " + string.join(path, os.pathsep) else: return [] #return "" def Java(env, target, source, *args, **kw): """ A pseudo-Builder wrapper around the separate JavaClass{File,Dir} Builders. """ if not SCons.Util.is_List(target): target = [target] if not SCons.Util.is_List(source): source = [source] # Pad the target list with repetitions of the last element in the # list so we have a target for every source element. target = target + ([target[-1]] * (len(source) - len(target))) java_suffix = env.subst('$JAVASUFFIX') result = [] for t, s in zip(target, source): if isinstance(s, SCons.Node.FS.Base): if isinstance(s, SCons.Node.FS.File): b = env.JavaClassFile else: b = env.JavaClassDir else: if os.path.isfile(s): b = env.JavaClassFile elif os.path.isdir(s): b = env.JavaClassDir elif s[-len(java_suffix):] == java_suffix: b = env.JavaClassFile else: b = env.JavaClassDir result.extend(apply(b, (t, s) + args, kw)) return result def generate(env): """Add Builders and construction variables for javac to an Environment.""" java_file = SCons.Tool.CreateJavaFileBuilder(env) java_class = SCons.Tool.CreateJavaClassFileBuilder(env) java_class_dir = SCons.Tool.CreateJavaClassDirBuilder(env) java_class.add_emitter(None, emit_java_classes) java_class.add_emitter(env.subst('$JAVASUFFIX'), emit_java_classes) java_class_dir.emitter = emit_java_classes env.AddMethod(Java) env['JAVAC'] = 'javac' env['JAVACFLAGS'] = SCons.Util.CLVar('') env['JAVABOOTCLASSPATH'] = [] env['JAVACLASSPATH'] = [] env['JAVASOURCEPATH'] = [] env['_javapathopt'] = pathopt env['_JAVABOOTCLASSPATH'] = '${_javapathopt("-bootclasspath", "JAVABOOTCLASSPATH")} ' env['_JAVACLASSPATH'] = '${_javapathopt("-classpath", "JAVACLASSPATH")} ' env['_JAVASOURCEPATH'] = '${_javapathopt("-sourcepath", "JAVASOURCEPATH", "_JAVASOURCEPATHDEFAULT")} ' env['_JAVASOURCEPATHDEFAULT'] = '${TARGET.attributes.java_sourcedir}' env['_JAVACCOM'] = '$JAVAC $JAVACFLAGS $_JAVABOOTCLASSPATH $_JAVACLASSPATH -d ${TARGET.attributes.java_classdir} $_JAVASOURCEPATH $SOURCES' env['JAVACCOM'] = "${TEMPFILE('$_JAVACCOM')}" env['JAVACLASSSUFFIX'] = '.class' env['JAVASUFFIX'] = '.java' def exists(env): return 1 # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0214, 0.0385, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.1453, 0.0043, 0, 0.66, 0.0588, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.1538, 0.0043, 0, 0.66,...
[ "\"\"\"SCons.Tool.javac\n\nTool-specific initialization for javac.\n\nThere normally shouldn't be any need to import this module directly.\nIt will usually be imported through the generic SCons.Tool.Tool()\nselection method.", "__revision__ = \"src/engine/SCons/Tool/javac.py 4720 2010/03/24 03:14:11 jars\"", "i...
"""SCons.Tool.sunf90 Tool-specific initialization for sunf90, the Sun Studio F90 compiler. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Tool/sunf90.py 4720 2010/03/24 03:14:11 jars" import SCons.Util from FortranCommon import add_all_to_env compilers = ['sunf90', 'f90'] def generate(env): """Add Builders and construction variables for sun f90 compiler to an Environment.""" add_all_to_env(env) fcomp = env.Detect(compilers) or 'f90' env['FORTRAN'] = fcomp env['F90'] = fcomp env['SHFORTRAN'] = '$FORTRAN' env['SHF90'] = '$F90' env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS -KPIC') env['SHF90FLAGS'] = SCons.Util.CLVar('$F90FLAGS -KPIC') def exists(env): return env.Detect(compilers) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0781, 0.1406, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.5312, 0.0156, 0, 0.66, 0.1667, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.5625, 0.0156, 0, 0.66,...
[ "\"\"\"SCons.Tool.sunf90\n\nTool-specific initialization for sunf90, the Sun Studio F90 compiler.\n\nThere normally shouldn't be any need to import this module directly.\nIt will usually be imported through the generic SCons.Tool.Tool()\nselection method.", "__revision__ = \"src/engine/SCons/Tool/sunf90.py 4720 2...
"""SCons.Tool.midl Tool-specific initialization for midl (Microsoft IDL compiler). There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Tool/midl.py 4720 2010/03/24 03:14:11 jars" import string import SCons.Action import SCons.Builder import SCons.Defaults import SCons.Scanner.IDL import SCons.Util from MSCommon import msvc_exists def midl_emitter(target, source, env): """Produces a list of outputs from the MIDL compiler""" base, ext = SCons.Util.splitext(str(target[0])) tlb = target[0] incl = base + '.h' interface = base + '_i.c' t = [tlb, incl, interface] midlcom = env['MIDLCOM'] if string.find(midlcom, '/proxy') != -1: proxy = base + '_p.c' t.append(proxy) if string.find(midlcom, '/dlldata') != -1: dlldata = base + '_data.c' t.append(dlldata) return (t,source) idl_scanner = SCons.Scanner.IDL.IDLScan() midl_action = SCons.Action.Action('$MIDLCOM', '$MIDLCOMSTR') midl_builder = SCons.Builder.Builder(action = midl_action, src_suffix = '.idl', suffix='.tlb', emitter = midl_emitter, source_scanner = idl_scanner) def generate(env): """Add Builders and construction variables for midl to an Environment.""" env['MIDL'] = 'MIDL.EXE' env['MIDLFLAGS'] = SCons.Util.CLVar('/nologo') env['MIDLCOM'] = '$MIDL $MIDLFLAGS /tlb ${TARGETS[0]} /h ${TARGETS[1]} /iid ${TARGETS[2]} /proxy ${TARGETS[3]} /dlldata ${TARGETS[4]} $SOURCE 2> NUL' env['BUILDERS']['TypeLibrary'] = midl_builder def exists(env): return msvc_exists() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0556, 0.1, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.3778, 0.0111, 0, 0.66, 0.0714, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.4, 0.0111, 0, 0.66, 0...
[ "\"\"\"SCons.Tool.midl\n\nTool-specific initialization for midl (Microsoft IDL compiler).\n\nThere normally shouldn't be any need to import this module directly.\nIt will usually be imported through the generic SCons.Tool.Tool()\nselection method.", "__revision__ = \"src/engine/SCons/Tool/midl.py 4720 2010/03/24 ...
"""SCons.Tool.default Initialization with a default tool list. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Tool/default.py 4720 2010/03/24 03:14:11 jars" import SCons.Tool def generate(env): """Add default tools.""" for t in SCons.Tool.tool_list(env['PLATFORM'], env): SCons.Tool.Tool(t)(env) def exists(env): return 1 # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.1, 0.18, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.68, 0.02, 0, 0.66, 0.25, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.72, 0.02, 0, 0.66, 0.5, 1...
[ "\"\"\"SCons.Tool.default\n\nInitialization with a default tool list.\n\nThere normally shouldn't be any need to import this module directly.\nIt will usually be imported through the generic SCons.Tool.Tool()\nselection method.", "__revision__ = \"src/engine/SCons/Tool/default.py 4720 2010/03/24 03:14:11 jars\"",...
"""SCons.Tool.tex Tool-specific initialization for TeX. Generates .dvi files from .tex files There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Tool/tex.py 4720 2010/03/24 03:14:11 jars" import os.path import re import string import shutil import SCons.Action import SCons.Node import SCons.Node.FS import SCons.Util import SCons.Scanner.LaTeX Verbose = False must_rerun_latex = True # these are files that just need to be checked for changes and then rerun latex check_suffixes = ['.toc', '.lof', '.lot', '.out', '.nav', '.snm'] # these are files that require bibtex or makeindex to be run when they change all_suffixes = check_suffixes + ['.bbl', '.idx', '.nlo', '.glo', '.acn'] # # regular expressions used to search for Latex features # or outputs that require rerunning latex # # search for all .aux files opened by latex (recorded in the .fls file) openout_aux_re = re.compile(r"INPUT *(.*\.aux)") #printindex_re = re.compile(r"^[^%]*\\printindex", re.MULTILINE) #printnomenclature_re = re.compile(r"^[^%]*\\printnomenclature", re.MULTILINE) #printglossary_re = re.compile(r"^[^%]*\\printglossary", re.MULTILINE) # search to find rerun warnings warning_rerun_str = '(^LaTeX Warning:.*Rerun)|(^Package \w+ Warning:.*Rerun)' warning_rerun_re = re.compile(warning_rerun_str, re.MULTILINE) # search to find citation rerun warnings rerun_citations_str = "^LaTeX Warning:.*\n.*Rerun to get citations correct" rerun_citations_re = re.compile(rerun_citations_str, re.MULTILINE) # search to find undefined references or citations warnings undefined_references_str = '(^LaTeX Warning:.*undefined references)|(^Package \w+ Warning:.*undefined citations)' undefined_references_re = re.compile(undefined_references_str, re.MULTILINE) # used by the emitter auxfile_re = re.compile(r".", re.MULTILINE) tableofcontents_re = re.compile(r"^[^%\n]*\\tableofcontents", re.MULTILINE) makeindex_re = re.compile(r"^[^%\n]*\\makeindex", re.MULTILINE) bibliography_re = re.compile(r"^[^%\n]*\\bibliography", re.MULTILINE) listoffigures_re = re.compile(r"^[^%\n]*\\listoffigures", re.MULTILINE) listoftables_re = re.compile(r"^[^%\n]*\\listoftables", re.MULTILINE) hyperref_re = re.compile(r"^[^%\n]*\\usepackage.*\{hyperref\}", re.MULTILINE) makenomenclature_re = re.compile(r"^[^%\n]*\\makenomenclature", re.MULTILINE) makeglossary_re = re.compile(r"^[^%\n]*\\makeglossary", re.MULTILINE) makeglossaries_re = re.compile(r"^[^%\n]*\\makeglossaries", re.MULTILINE) makeacronyms_re = re.compile(r"^[^%\n]*\\makeglossaries", re.MULTILINE) beamer_re = re.compile(r"^[^%\n]*\\documentclass\{beamer\}", re.MULTILINE) # search to find all files included by Latex include_re = re.compile(r'^[^%\n]*\\(?:include|input){([^}]*)}', re.MULTILINE) includeOnly_re = re.compile(r'^[^%\n]*\\(?:include){([^}]*)}', re.MULTILINE) # search to find all graphics files included by Latex includegraphics_re = re.compile(r'^[^%\n]*\\(?:includegraphics(?:\[[^\]]+\])?){([^}]*)}', re.MULTILINE) # search to find all files opened by Latex (recorded in .log file) openout_re = re.compile(r"OUTPUT *(.*)") # list of graphics file extensions for TeX and LaTeX TexGraphics = SCons.Scanner.LaTeX.TexGraphics LatexGraphics = SCons.Scanner.LaTeX.LatexGraphics # An Action sufficient to build any generic tex file. TeXAction = None # An action to build a latex file. This action might be needed more # than once if we are dealing with labels and bibtex. LaTeXAction = None # An action to run BibTeX on a file. BibTeXAction = None # An action to run MakeIndex on a file. MakeIndexAction = None # An action to run MakeIndex (for nomencl) on a file. MakeNclAction = None # An action to run MakeIndex (for glossary) on a file. MakeGlossaryAction = None # An action to run MakeIndex (for acronyms) on a file. MakeAcronymsAction = None # Used as a return value of modify_env_var if the variable is not set. _null = SCons.Scanner.LaTeX._null modify_env_var = SCons.Scanner.LaTeX.modify_env_var def FindFile(name,suffixes,paths,env,requireExt=False): if requireExt: name,ext = SCons.Util.splitext(name) # if the user gave an extension use it. if ext: name = name + ext if Verbose: print " searching for '%s' with extensions: " % name,suffixes for path in paths: testName = os.path.join(path,name) if Verbose: print " look for '%s'" % testName if os.path.exists(testName): if Verbose: print " found '%s'" % testName return env.fs.File(testName) else: name_ext = SCons.Util.splitext(testName)[1] if name_ext: continue # if no suffix try adding those passed in for suffix in suffixes: testNameExt = testName + suffix if Verbose: print " look for '%s'" % testNameExt if os.path.exists(testNameExt): if Verbose: print " found '%s'" % testNameExt return env.fs.File(testNameExt) if Verbose: print " did not find '%s'" % name return None def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None): """A builder for LaTeX files that checks the output in the aux file and decides how many times to use LaTeXAction, and BibTeXAction.""" global must_rerun_latex # This routine is called with two actions. In this file for DVI builds # with LaTeXAction and from the pdflatex.py with PDFLaTeXAction # set this up now for the case where the user requests a different extension # for the target filename if (XXXLaTeXAction == LaTeXAction): callerSuffix = ".dvi" else: callerSuffix = env['PDFSUFFIX'] basename = SCons.Util.splitext(str(source[0]))[0] basedir = os.path.split(str(source[0]))[0] basefile = os.path.split(str(basename))[1] abspath = os.path.abspath(basedir) targetext = os.path.splitext(str(target[0]))[1] targetdir = os.path.split(str(target[0]))[0] saved_env = {} for var in SCons.Scanner.LaTeX.LaTeX.env_variables: saved_env[var] = modify_env_var(env, var, abspath) # Create base file names with the target directory since the auxiliary files # will be made there. That's because the *COM variables have the cd # command in the prolog. We check # for the existence of files before opening them--even ones like the # aux file that TeX always creates--to make it possible to write tests # with stubs that don't necessarily generate all of the same files. targetbase = os.path.join(targetdir, basefile) # if there is a \makeindex there will be a .idx and thus # we have to run makeindex at least once to keep the build # happy even if there is no index. # Same for glossaries and nomenclature src_content = source[0].get_text_contents() run_makeindex = makeindex_re.search(src_content) and not os.path.exists(targetbase + '.idx') run_nomenclature = makenomenclature_re.search(src_content) and not os.path.exists(targetbase + '.nlo') run_glossary = makeglossary_re.search(src_content) and not os.path.exists(targetbase + '.glo') run_glossaries = makeglossaries_re.search(src_content) and not os.path.exists(targetbase + '.glo') run_acronyms = makeacronyms_re.search(src_content) and not os.path.exists(targetbase + '.acn') saved_hashes = {} suffix_nodes = {} for suffix in all_suffixes: theNode = env.fs.File(targetbase + suffix) suffix_nodes[suffix] = theNode saved_hashes[suffix] = theNode.get_csig() if Verbose: print "hashes: ",saved_hashes must_rerun_latex = True # # routine to update MD5 hash and compare # # TODO(1.5): nested scopes def check_MD5(filenode, suffix, saved_hashes=saved_hashes, targetbase=targetbase): global must_rerun_latex # two calls to clear old csig filenode.clear_memoized_values() filenode.ninfo = filenode.new_ninfo() new_md5 = filenode.get_csig() if saved_hashes[suffix] == new_md5: if Verbose: print "file %s not changed" % (targetbase+suffix) return False # unchanged saved_hashes[suffix] = new_md5 must_rerun_latex = True if Verbose: print "file %s changed, rerunning Latex, new hash = " % (targetbase+suffix), new_md5 return True # changed # generate the file name that latex will generate resultfilename = targetbase + callerSuffix count = 0 while (must_rerun_latex and count < int(env.subst('$LATEXRETRIES'))) : result = XXXLaTeXAction(target, source, env) if result != 0: return result count = count + 1 must_rerun_latex = False # Decide if various things need to be run, or run again. # Read the log file to find warnings/errors logfilename = targetbase + '.log' logContent = '' if os.path.exists(logfilename): logContent = open(logfilename, "rb").read() # Read the fls file to find all .aux files flsfilename = targetbase + '.fls' flsContent = '' auxfiles = [] if os.path.exists(flsfilename): flsContent = open(flsfilename, "rb").read() auxfiles = openout_aux_re.findall(flsContent) if Verbose: print "auxfiles ",auxfiles # Now decide if bibtex will need to be run. # The information that bibtex reads from the .aux file is # pass-independent. If we find (below) that the .bbl file is unchanged, # then the last latex saw a correct bibliography. # Therefore only do this on the first pass if count == 1: for auxfilename in auxfiles: target_aux = os.path.join(targetdir, auxfilename) if os.path.exists(target_aux): content = open(target_aux, "rb").read() if string.find(content, "bibdata") != -1: if Verbose: print "Need to run bibtex" bibfile = env.fs.File(targetbase) result = BibTeXAction(bibfile, bibfile, env) if result != 0: print env['BIBTEX']," returned an error, check the blg file" return result must_rerun_latex = check_MD5(suffix_nodes['.bbl'],'.bbl') break # Now decide if latex will need to be run again due to index. if check_MD5(suffix_nodes['.idx'],'.idx') or (count == 1 and run_makeindex): # We must run makeindex if Verbose: print "Need to run makeindex" idxfile = suffix_nodes['.idx'] result = MakeIndexAction(idxfile, idxfile, env) if result != 0: print env['MAKEINDEX']," returned an error, check the ilg file" return result # TO-DO: need to add a way for the user to extend this list for whatever # auxiliary files they create in other (or their own) packages # Harder is case is where an action needs to be called -- that should be rare (I hope?) for index in check_suffixes: check_MD5(suffix_nodes[index],index) # Now decide if latex will need to be run again due to nomenclature. if check_MD5(suffix_nodes['.nlo'],'.nlo') or (count == 1 and run_nomenclature): # We must run makeindex if Verbose: print "Need to run makeindex for nomenclature" nclfile = suffix_nodes['.nlo'] result = MakeNclAction(nclfile, nclfile, env) if result != 0: print env['MAKENCL']," (nomenclature) returned an error, check the nlg file" #return result # Now decide if latex will need to be run again due to glossary. if check_MD5(suffix_nodes['.glo'],'.glo') or (count == 1 and run_glossaries) or (count == 1 and run_glossary): # We must run makeindex if Verbose: print "Need to run makeindex for glossary" glofile = suffix_nodes['.glo'] result = MakeGlossaryAction(glofile, glofile, env) if result != 0: print env['MAKEGLOSSARY']," (glossary) returned an error, check the glg file" #return result # Now decide if latex will need to be run again due to acronyms. if check_MD5(suffix_nodes['.acn'],'.acn') or (count == 1 and run_acronyms): # We must run makeindex if Verbose: print "Need to run makeindex for acronyms" acrfile = suffix_nodes['.acn'] result = MakeAcronymsAction(acrfile, acrfile, env) if result != 0: print env['MAKEACRONYMS']," (acronymns) returned an error, check the alg file" return result # Now decide if latex needs to be run yet again to resolve warnings. if warning_rerun_re.search(logContent): must_rerun_latex = True if Verbose: print "rerun Latex due to latex or package rerun warning" if rerun_citations_re.search(logContent): must_rerun_latex = True if Verbose: print "rerun Latex due to 'Rerun to get citations correct' warning" if undefined_references_re.search(logContent): must_rerun_latex = True if Verbose: print "rerun Latex due to undefined references or citations" if (count >= int(env.subst('$LATEXRETRIES')) and must_rerun_latex): print "reached max number of retries on Latex ,",int(env.subst('$LATEXRETRIES')) # end of while loop # rename Latex's output to what the target name is if not (str(target[0]) == resultfilename and os.path.exists(resultfilename)): if os.path.exists(resultfilename): print "move %s to %s" % (resultfilename, str(target[0]), ) shutil.move(resultfilename,str(target[0])) # Original comment (when TEXPICTS was not restored): # The TEXPICTS enviroment variable is needed by a dvi -> pdf step # later on Mac OSX so leave it # # It is also used when searching for pictures (implicit dependencies). # Why not set the variable again in the respective builder instead # of leaving local modifications in the environment? What if multiple # latex builds in different directories need different TEXPICTS? for var in SCons.Scanner.LaTeX.LaTeX.env_variables: if var == 'TEXPICTS': continue if saved_env[var] is _null: try: del env['ENV'][var] except KeyError: pass # was never set else: env['ENV'][var] = saved_env[var] return result def LaTeXAuxAction(target = None, source= None, env=None): result = InternalLaTeXAuxAction( LaTeXAction, target, source, env ) return result LaTeX_re = re.compile("\\\\document(style|class)") def is_LaTeX(flist,env,abspath): """Scan a file list to decide if it's TeX- or LaTeX-flavored.""" # We need to scan files that are included in case the # \documentclass command is in them. # get path list from both env['TEXINPUTS'] and env['ENV']['TEXINPUTS'] savedpath = modify_env_var(env, 'TEXINPUTS', abspath) paths = env['ENV']['TEXINPUTS'] if SCons.Util.is_List(paths): pass else: # Split at os.pathsep to convert into absolute path # TODO(1.5) #paths = paths.split(os.pathsep) paths = string.split(paths, os.pathsep) # now that we have the path list restore the env if savedpath is _null: try: del env['ENV']['TEXINPUTS'] except KeyError: pass # was never set else: env['ENV']['TEXINPUTS'] = savedpath if Verbose: print "is_LaTeX search path ",paths print "files to search :",flist # Now that we have the search path and file list, check each one for f in flist: if Verbose: print " checking for Latex source ",str(f) content = f.get_text_contents() if LaTeX_re.search(content): if Verbose: print "file %s is a LaTeX file" % str(f) return 1 if Verbose: print "file %s is not a LaTeX file" % str(f) # now find included files inc_files = [ ] inc_files.extend( include_re.findall(content) ) if Verbose: print "files included by '%s': "%str(f),inc_files # inc_files is list of file names as given. need to find them # using TEXINPUTS paths. # search the included files for src in inc_files: srcNode = FindFile(src,['.tex','.ltx','.latex'],paths,env,requireExt=False) # make this a list since is_LaTeX takes a list. fileList = [srcNode,] if Verbose: print "FindFile found ",srcNode if srcNode is not None: file_test = is_LaTeX(fileList, env, abspath) # return on first file that finds latex is needed. if file_test: return file_test if Verbose: print " done scanning ",str(f) return 0 def TeXLaTeXFunction(target = None, source= None, env=None): """A builder for TeX and LaTeX that scans the source file to decide the "flavor" of the source and then executes the appropriate program.""" # find these paths for use in is_LaTeX to search for included files basedir = os.path.split(str(source[0]))[0] abspath = os.path.abspath(basedir) if is_LaTeX(source,env,abspath): result = LaTeXAuxAction(target,source,env) if result != 0: print env['LATEX']," returned an error, check the log file" else: result = TeXAction(target,source,env) if result != 0: print env['TEX']," returned an error, check the log file" return result def TeXLaTeXStrFunction(target = None, source= None, env=None): """A strfunction for TeX and LaTeX that scans the source file to decide the "flavor" of the source and then returns the appropriate command string.""" if env.GetOption("no_exec"): # find these paths for use in is_LaTeX to search for included files basedir = os.path.split(str(source[0]))[0] abspath = os.path.abspath(basedir) if is_LaTeX(source,env,abspath): result = env.subst('$LATEXCOM',0,target,source)+" ..." else: result = env.subst("$TEXCOM",0,target,source)+" ..." else: result = '' return result def tex_eps_emitter(target, source, env): """An emitter for TeX and LaTeX sources when executing tex or latex. It will accept .ps and .eps graphics files """ (target, source) = tex_emitter_core(target, source, env, TexGraphics) return (target, source) def tex_pdf_emitter(target, source, env): """An emitter for TeX and LaTeX sources when executing pdftex or pdflatex. It will accept graphics files of types .pdf, .jpg, .png, .gif, and .tif """ (target, source) = tex_emitter_core(target, source, env, LatexGraphics) return (target, source) def ScanFiles(theFile, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir, aux_files): """ For theFile (a Node) update any file_tests and search for graphics files then find all included files and call ScanFiles recursively for each of them""" content = theFile.get_text_contents() if Verbose: print " scanning ",str(theFile) for i in range(len(file_tests_search)): if file_tests[i][0] is None: file_tests[i][0] = file_tests_search[i].search(content) incResult = includeOnly_re.search(content) if incResult: aux_files.append(os.path.join(targetdir, incResult.group(1))) if Verbose: print "\include file names : ", aux_files # recursively call this on each of the included files inc_files = [ ] inc_files.extend( include_re.findall(content) ) if Verbose: print "files included by '%s': "%str(theFile),inc_files # inc_files is list of file names as given. need to find them # using TEXINPUTS paths. for src in inc_files: srcNode = FindFile(src,['.tex','.ltx','.latex'],paths,env,requireExt=False) if srcNode is not None: file_tests = ScanFiles(srcNode, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir, aux_files) if Verbose: print " done scanning ",str(theFile) return file_tests def tex_emitter_core(target, source, env, graphics_extensions): """An emitter for TeX and LaTeX sources. For LaTeX sources we try and find the common created files that are needed on subsequent runs of latex to finish tables of contents, bibliographies, indices, lists of figures, and hyperlink references. """ basename = SCons.Util.splitext(str(source[0]))[0] basefile = os.path.split(str(basename))[1] targetdir = os.path.split(str(target[0]))[0] targetbase = os.path.join(targetdir, basefile) basedir = os.path.split(str(source[0]))[0] abspath = os.path.abspath(basedir) target[0].attributes.path = abspath # # file names we will make use of in searching the sources and log file # emit_suffixes = ['.aux', '.log', '.ilg', '.blg', '.nls', '.nlg', '.gls', '.glg', '.alg'] + all_suffixes auxfilename = targetbase + '.aux' logfilename = targetbase + '.log' flsfilename = targetbase + '.fls' env.SideEffect(auxfilename,target[0]) env.SideEffect(logfilename,target[0]) env.SideEffect(flsfilename,target[0]) if Verbose: print "side effect :",auxfilename,logfilename,flsfilename env.Clean(target[0],auxfilename) env.Clean(target[0],logfilename) env.Clean(target[0],flsfilename) content = source[0].get_text_contents() idx_exists = os.path.exists(targetbase + '.idx') nlo_exists = os.path.exists(targetbase + '.nlo') glo_exists = os.path.exists(targetbase + '.glo') acr_exists = os.path.exists(targetbase + '.acn') # set up list with the regular expressions # we use to find features used file_tests_search = [auxfile_re, makeindex_re, bibliography_re, tableofcontents_re, listoffigures_re, listoftables_re, hyperref_re, makenomenclature_re, makeglossary_re, makeglossaries_re, makeacronyms_re, beamer_re ] # set up list with the file suffixes that need emitting # when a feature is found file_tests_suff = [['.aux'], ['.idx', '.ind', '.ilg'], ['.bbl', '.blg'], ['.toc'], ['.lof'], ['.lot'], ['.out'], ['.nlo', '.nls', '.nlg'], ['.glo', '.gls', '.glg'], ['.glo', '.gls', '.glg'], ['.acn', '.acr', '.alg'], ['.nav', '.snm', '.out', '.toc'] ] # build the list of lists file_tests = [] for i in range(len(file_tests_search)): file_tests.append( [None, file_tests_suff[i]] ) # TO-DO: need to add a way for the user to extend this list for whatever # auxiliary files they create in other (or their own) packages # get path list from both env['TEXINPUTS'] and env['ENV']['TEXINPUTS'] savedpath = modify_env_var(env, 'TEXINPUTS', abspath) paths = env['ENV']['TEXINPUTS'] if SCons.Util.is_List(paths): pass else: # Split at os.pathsep to convert into absolute path # TODO(1.5) #paths = paths.split(os.pathsep) paths = string.split(paths, os.pathsep) # now that we have the path list restore the env if savedpath is _null: try: del env['ENV']['TEXINPUTS'] except KeyError: pass # was never set else: env['ENV']['TEXINPUTS'] = savedpath if Verbose: print "search path ",paths aux_files = [] file_tests = ScanFiles(source[0], target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir, aux_files) for (theSearch,suffix_list) in file_tests: if theSearch: for suffix in suffix_list: env.SideEffect(targetbase + suffix,target[0]) if Verbose: print "side effect :",targetbase + suffix env.Clean(target[0],targetbase + suffix) for aFile in aux_files: aFile_base = SCons.Util.splitext(aFile)[0] env.SideEffect(aFile_base + '.aux',target[0]) if Verbose: print "side effect :",aFile_base + '.aux' env.Clean(target[0],aFile_base + '.aux') # read fls file to get all other files that latex creates and will read on the next pass # remove files from list that we explicitly dealt with above if os.path.exists(flsfilename): content = open(flsfilename, "rb").read() out_files = openout_re.findall(content) myfiles = [auxfilename, logfilename, flsfilename, targetbase+'.dvi',targetbase+'.pdf'] for filename in out_files[:]: if filename in myfiles: out_files.remove(filename) env.SideEffect(out_files,target[0]) if Verbose: print "side effect :",out_files env.Clean(target[0],out_files) return (target, source) TeXLaTeXAction = None def generate(env): """Add Builders and construction variables for TeX to an Environment.""" global TeXLaTeXAction if TeXLaTeXAction is None: TeXLaTeXAction = SCons.Action.Action(TeXLaTeXFunction, strfunction=TeXLaTeXStrFunction) env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes) generate_common(env) import dvi dvi.generate(env) bld = env['BUILDERS']['DVI'] bld.add_action('.tex', TeXLaTeXAction) bld.add_emitter('.tex', tex_eps_emitter) def generate_common(env): """Add internal Builders and construction variables for LaTeX to an Environment.""" # A generic tex file Action, sufficient for all tex files. global TeXAction if TeXAction is None: TeXAction = SCons.Action.Action("$TEXCOM", "$TEXCOMSTR") # An Action to build a latex file. This might be needed more # than once if we are dealing with labels and bibtex. global LaTeXAction if LaTeXAction is None: LaTeXAction = SCons.Action.Action("$LATEXCOM", "$LATEXCOMSTR") # Define an action to run BibTeX on a file. global BibTeXAction if BibTeXAction is None: BibTeXAction = SCons.Action.Action("$BIBTEXCOM", "$BIBTEXCOMSTR") # Define an action to run MakeIndex on a file. global MakeIndexAction if MakeIndexAction is None: MakeIndexAction = SCons.Action.Action("$MAKEINDEXCOM", "$MAKEINDEXCOMSTR") # Define an action to run MakeIndex on a file for nomenclatures. global MakeNclAction if MakeNclAction is None: MakeNclAction = SCons.Action.Action("$MAKENCLCOM", "$MAKENCLCOMSTR") # Define an action to run MakeIndex on a file for glossaries. global MakeGlossaryAction if MakeGlossaryAction is None: MakeGlossaryAction = SCons.Action.Action("$MAKEGLOSSARYCOM", "$MAKEGLOSSARYCOMSTR") # Define an action to run MakeIndex on a file for acronyms. global MakeAcronymsAction if MakeAcronymsAction is None: MakeAcronymsAction = SCons.Action.Action("$MAKEACRONYMSCOM", "$MAKEACRONYMSCOMSTR") env['TEX'] = 'tex' env['TEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') env['TEXCOM'] = 'cd ${TARGET.dir} && $TEX $TEXFLAGS ${SOURCE.file}' env['PDFTEX'] = 'pdftex' env['PDFTEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') env['PDFTEXCOM'] = 'cd ${TARGET.dir} && $PDFTEX $PDFTEXFLAGS ${SOURCE.file}' env['LATEX'] = 'latex' env['LATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') env['LATEXCOM'] = 'cd ${TARGET.dir} && $LATEX $LATEXFLAGS ${SOURCE.file}' env['LATEXRETRIES'] = 3 env['PDFLATEX'] = 'pdflatex' env['PDFLATEXFLAGS'] = SCons.Util.CLVar('-interaction=nonstopmode -recorder') env['PDFLATEXCOM'] = 'cd ${TARGET.dir} && $PDFLATEX $PDFLATEXFLAGS ${SOURCE.file}' env['BIBTEX'] = 'bibtex' env['BIBTEXFLAGS'] = SCons.Util.CLVar('') env['BIBTEXCOM'] = 'cd ${TARGET.dir} && $BIBTEX $BIBTEXFLAGS ${SOURCE.filebase}' env['MAKEINDEX'] = 'makeindex' env['MAKEINDEXFLAGS'] = SCons.Util.CLVar('') env['MAKEINDEXCOM'] = 'cd ${TARGET.dir} && $MAKEINDEX $MAKEINDEXFLAGS ${SOURCE.file}' env['MAKEGLOSSARY'] = 'makeindex' env['MAKEGLOSSARYSTYLE'] = '${SOURCE.filebase}.ist' env['MAKEGLOSSARYFLAGS'] = SCons.Util.CLVar('-s ${MAKEGLOSSARYSTYLE} -t ${SOURCE.filebase}.glg') env['MAKEGLOSSARYCOM'] = 'cd ${TARGET.dir} && $MAKEGLOSSARY ${SOURCE.filebase}.glo $MAKEGLOSSARYFLAGS -o ${SOURCE.filebase}.gls' env['MAKEACRONYMS'] = 'makeindex' env['MAKEACRONYMSSTYLE'] = '${SOURCE.filebase}.ist' env['MAKEACRONYMSFLAGS'] = SCons.Util.CLVar('-s ${MAKEACRONYMSSTYLE} -t ${SOURCE.filebase}.alg') env['MAKEACRONYMSCOM'] = 'cd ${TARGET.dir} && $MAKEACRONYMS ${SOURCE.filebase}.acn $MAKEACRONYMSFLAGS -o ${SOURCE.filebase}.acr' env['MAKENCL'] = 'makeindex' env['MAKENCLSTYLE'] = 'nomencl.ist' env['MAKENCLFLAGS'] = '-s ${MAKENCLSTYLE} -t ${SOURCE.filebase}.nlg' env['MAKENCLCOM'] = 'cd ${TARGET.dir} && $MAKENCL ${SOURCE.filebase}.nlo $MAKENCLFLAGS -o ${SOURCE.filebase}.nls' def exists(env): return env.Detect('tex') # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0068, 0.0124, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0435, 0.0012, 0, 0.66, 0.0159, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.046, 0.0012, 0, 0.66, ...
[ "\"\"\"SCons.Tool.tex\n\nTool-specific initialization for TeX.\nGenerates .dvi files from .tex files\n\nThere normally shouldn't be any need to import this module directly.\nIt will usually be imported through the generic SCons.Tool.Tool()\nselection method.", "__revision__ = \"src/engine/SCons/Tool/tex.py 4720 2...
# # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/compat/_scons_itertools.py 4720 2010/03/24 03:14:11 jars" __doc__ = """ Implementations of itertools functions for Python versions that don't have iterators. These implement the functions by creating the entire list, not returning it element-by-element as the real itertools functions do. This means that early Python versions won't get the performance benefit of using the itertools, but we can still use them so the later Python versions do get the advantages of using iterators. Because we return the entire list, we intentionally do not implement the itertools functions that "return" infinitely-long lists: the count(), cycle() and repeat() functions. Other functions below have remained unimplemented simply because they aren't being used (yet) and it wasn't obvious how to do it. Or, conversely, we only implemented those functions that *were* easy to implement (mostly because the Python documentation contained examples of equivalent code). Note that these do not have independent unit tests, so it's possible that there are bugs. """ def chain(*iterables): result = [] for x in iterables: result.extend(list(x)) return result def count(n=0): # returns infinite length, should not be supported raise NotImplementedError def cycle(iterable): # returns infinite length, should not be supported raise NotImplementedError def dropwhile(predicate, iterable): result = [] for x in iterable: if not predicate(x): result.append(x) break result.extend(iterable) return result def groupby(iterable, *args): raise NotImplementedError def ifilter(predicate, iterable): result = [] if predicate is None: predicate = bool for x in iterable: if predicate(x): result.append(x) return result def ifilterfalse(predicate, iterable): result = [] if predicate is None: predicate = bool for x in iterable: if not predicate(x): result.append(x) return result def imap(function, *iterables): return apply(map, (function,) + tuple(iterables)) def islice(*args, **kw): raise NotImplementedError def izip(*iterables): return apply(zip, iterables) def repeat(*args, **kw): # returns infinite length, should not be supported raise NotImplementedError def starmap(*args, **kw): raise NotImplementedError def takewhile(predicate, iterable): result = [] for x in iterable: if predicate(x): result.append(x) else: break return result def tee(*args, **kw): raise NotImplementedError # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 14, 0, 0.1935, 0.0081, 0, 0.66, 0, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.2903, 0.1694, 0, 0.66, 0.0667, 155, 1, 0, 0, 0, 0, 3, 0 ], [ 2, 0, 0.4032, 0.0403, 0, 0....
[ "__revision__ = \"src/engine/SCons/compat/_scons_itertools.py 4720 2010/03/24 03:14:11 jars\"", "__doc__ = \"\"\"\nImplementations of itertools functions for Python versions that don't\nhave iterators.\n\nThese implement the functions by creating the entire list, not returning\nit element-by-element as the real i...
# # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/compat/_scons_UserString.py 4720 2010/03/24 03:14:11 jars" __doc__ = """ A user-defined wrapper around string objects This class is "borrowed" from the Python 2.2 UserString and modified slightly for use with SCons. It is *NOT* guaranteed to be fully compliant with the standard UserString class from all later versions of Python. In particular, it does not necessarily contain all of the methods found in later versions. """ import types StringType = types.StringType if hasattr(types, 'UnicodeType'): UnicodeType = types.UnicodeType def is_String(obj): return type(obj) in (StringType, UnicodeType) else: def is_String(obj): return type(obj) is StringType class UserString: def __init__(self, seq): if is_String(seq): self.data = seq elif isinstance(seq, UserString): self.data = seq.data[:] else: self.data = str(seq) def __str__(self): return str(self.data) def __repr__(self): return repr(self.data) def __int__(self): return int(self.data) def __long__(self): return long(self.data) def __float__(self): return float(self.data) def __complex__(self): return complex(self.data) def __hash__(self): return hash(self.data) def __cmp__(self, string): if isinstance(string, UserString): return cmp(self.data, string.data) else: return cmp(self.data, string) def __contains__(self, char): return char in self.data def __len__(self): return len(self.data) def __getitem__(self, index): return self.__class__(self.data[index]) def __getslice__(self, start, end): start = max(start, 0); end = max(end, 0) return self.__class__(self.data[start:end]) def __add__(self, other): if isinstance(other, UserString): return self.__class__(self.data + other.data) elif is_String(other): return self.__class__(self.data + other) else: return self.__class__(self.data + str(other)) def __radd__(self, other): if is_String(other): return self.__class__(other + self.data) else: return self.__class__(str(other) + self.data) def __mul__(self, n): return self.__class__(self.data*n) __rmul__ = __mul__ # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 14, 0, 0.2449, 0.0102, 0, 0.66, 0, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.3061, 0.0918, 0, 0.66, 0.2, 155, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.3673, 0.0102, 0, 0.66,...
[ "__revision__ = \"src/engine/SCons/compat/_scons_UserString.py 4720 2010/03/24 03:14:11 jars\"", "__doc__ = \"\"\"\nA user-defined wrapper around string objects\n\nThis class is \"borrowed\" from the Python 2.2 UserString and modified\nslightly for use with SCons. It is *NOT* guaranteed to be fully compliant\nwi...
"""SCons.Scanner.Fortran This module implements the dependency scanner for Fortran code. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Scanner/Fortran.py 4720 2010/03/24 03:14:11 jars" import re import string import SCons.Node import SCons.Node.FS import SCons.Scanner import SCons.Util import SCons.Warnings class F90Scanner(SCons.Scanner.Classic): """ A Classic Scanner subclass for Fortran source files which takes into account both USE and INCLUDE statements. This scanner will work for both F77 and F90 (and beyond) compilers. Currently, this scanner assumes that the include files do not contain USE statements. To enable the ability to deal with USE statements in include files, add logic right after the module names are found to loop over each include file, search for and locate each USE statement, and append each module name to the list of dependencies. Caching the search results in a common dictionary somewhere so that the same include file is not searched multiple times would be a smart thing to do. """ def __init__(self, name, suffixes, path_variable, use_regex, incl_regex, def_regex, *args, **kw): self.cre_use = re.compile(use_regex, re.M) self.cre_incl = re.compile(incl_regex, re.M) self.cre_def = re.compile(def_regex, re.M) def _scan(node, env, path, self=self): node = node.rfile() if not node.exists(): return [] return self.scan(node, env, path) kw['function'] = _scan kw['path_function'] = SCons.Scanner.FindPathDirs(path_variable) kw['recursive'] = 1 kw['skeys'] = suffixes kw['name'] = name apply(SCons.Scanner.Current.__init__, (self,) + args, kw) def scan(self, node, env, path=()): # cache the includes list in node so we only scan it once: if node.includes != None: mods_and_includes = node.includes else: # retrieve all included filenames includes = self.cre_incl.findall(node.get_text_contents()) # retrieve all USE'd module names modules = self.cre_use.findall(node.get_text_contents()) # retrieve all defined module names defmodules = self.cre_def.findall(node.get_text_contents()) # Remove all USE'd module names that are defined in the same file d = {} for m in defmodules: d[m] = 1 modules = filter(lambda m, d=d: not d.has_key(m), modules) #modules = self.undefinedModules(modules, defmodules) # Convert module name to a .mod filename suffix = env.subst('$FORTRANMODSUFFIX') modules = map(lambda x, s=suffix: string.lower(x) + s, modules) # Remove unique items from the list mods_and_includes = SCons.Util.unique(includes+modules) node.includes = mods_and_includes # This is a hand-coded DSU (decorate-sort-undecorate, or # Schwartzian transform) pattern. The sort key is the raw name # of the file as specifed on the USE or INCLUDE line, which lets # us keep the sort order constant regardless of whether the file # is actually found in a Repository or locally. nodes = [] source_dir = node.get_dir() if callable(path): path = path() for dep in mods_and_includes: n, i = self.find_include(dep, source_dir, path) if n is None: SCons.Warnings.warn(SCons.Warnings.DependencyWarning, "No dependency generated for file: %s (referenced by: %s) -- file not found" % (i, node)) else: sortkey = self.sort_key(dep) nodes.append((sortkey, n)) nodes.sort() nodes = map(lambda pair: pair[1], nodes) return nodes def FortranScan(path_variable="FORTRANPATH"): """Return a prototype Scanner instance for scanning source files for Fortran USE & INCLUDE statements""" # The USE statement regex matches the following: # # USE module_name # USE :: module_name # USE, INTRINSIC :: module_name # USE, NON_INTRINSIC :: module_name # # Limitations # # -- While the regex can handle multiple USE statements on one line, # it cannot properly handle them if they are commented out. # In either of the following cases: # # ! USE mod_a ; USE mod_b [entire line is commented out] # USE mod_a ! ; USE mod_b [in-line comment of second USE statement] # # the second module name (mod_b) will be picked up as a dependency # even though it should be ignored. The only way I can see # to rectify this would be to modify the scanner to eliminate # the call to re.findall, read in the contents of the file, # treating the comment character as an end-of-line character # in addition to the normal linefeed, loop over each line, # weeding out the comments, and looking for the USE statements. # One advantage to this is that the regex passed to the scanner # would no longer need to match a semicolon. # # -- I question whether or not we need to detect dependencies to # INTRINSIC modules because these are built-in to the compiler. # If we consider them a dependency, will SCons look for them, not # find them, and kill the build? Or will we there be standard # compiler-specific directories we will need to point to so the # compiler and SCons can locate the proper object and mod files? # Here is a breakdown of the regex: # # (?i) : regex is case insensitive # ^ : start of line # (?: : group a collection of regex symbols without saving the match as a "group" # ^|; : matches either the start of the line or a semicolon - semicolon # ) : end the unsaved grouping # \s* : any amount of white space # USE : match the string USE, case insensitive # (?: : group a collection of regex symbols without saving the match as a "group" # \s+| : match one or more whitespace OR .... (the next entire grouped set of regex symbols) # (?: : group a collection of regex symbols without saving the match as a "group" # (?: : establish another unsaved grouping of regex symbols # \s* : any amount of white space # , : match a comma # \s* : any amount of white space # (?:NON_)? : optionally match the prefix NON_, case insensitive # INTRINSIC : match the string INTRINSIC, case insensitive # )? : optionally match the ", INTRINSIC/NON_INTRINSIC" grouped expression # \s* : any amount of white space # :: : match a double colon that must appear after the INTRINSIC/NON_INTRINSIC attribute # ) : end the unsaved grouping # ) : end the unsaved grouping # \s* : match any amount of white space # (\w+) : match the module name that is being USE'd # # use_regex = "(?i)(?:^|;)\s*USE(?:\s+|(?:(?:\s*,\s*(?:NON_)?INTRINSIC)?\s*::))\s*(\w+)" # The INCLUDE statement regex matches the following: # # INCLUDE 'some_Text' # INCLUDE "some_Text" # INCLUDE "some_Text" ; INCLUDE "some_Text" # INCLUDE kind_"some_Text" # INCLUDE kind_'some_Text" # # where some_Text can include any alphanumeric and/or special character # as defined by the Fortran 2003 standard. # # Limitations: # # -- The Fortran standard dictates that a " or ' in the INCLUDE'd # string must be represented as a "" or '', if the quotes that wrap # the entire string are either a ' or ", respectively. While the # regular expression below can detect the ' or " characters just fine, # the scanning logic, presently is unable to detect them and reduce # them to a single instance. This probably isn't an issue since, # in practice, ' or " are not generally used in filenames. # # -- This regex will not properly deal with multiple INCLUDE statements # when the entire line has been commented out, ala # # ! INCLUDE 'some_file' ; INCLUDE 'some_file' # # In such cases, it will properly ignore the first INCLUDE file, # but will actually still pick up the second. Interestingly enough, # the regex will properly deal with these cases: # # INCLUDE 'some_file' # INCLUDE 'some_file' !; INCLUDE 'some_file' # # To get around the above limitation, the FORTRAN programmer could # simply comment each INCLUDE statement separately, like this # # ! INCLUDE 'some_file' !; INCLUDE 'some_file' # # The way I see it, the only way to get around this limitation would # be to modify the scanning logic to replace the calls to re.findall # with a custom loop that processes each line separately, throwing # away fully commented out lines before attempting to match against # the INCLUDE syntax. # # Here is a breakdown of the regex: # # (?i) : regex is case insensitive # (?: : begin a non-saving group that matches the following: # ^ : either the start of the line # | : or # ['">]\s*; : a semicolon that follows a single quote, # double quote or greater than symbol (with any # amount of whitespace in between). This will # allow the regex to match multiple INCLUDE # statements per line (although it also requires # the positive lookahead assertion that is # used below). It will even properly deal with # (i.e. ignore) cases in which the additional # INCLUDES are part of an in-line comment, ala # " INCLUDE 'someFile' ! ; INCLUDE 'someFile2' " # ) : end of non-saving group # \s* : any amount of white space # INCLUDE : match the string INCLUDE, case insensitive # \s+ : match one or more white space characters # (?\w+_)? : match the optional "kind-param _" prefix allowed by the standard # [<"'] : match the include delimiter - an apostrophe, double quote, or less than symbol # (.+?) : match one or more characters that make up # the included path and file name and save it # in a group. The Fortran standard allows for # any non-control character to be used. The dot # operator will pick up any character, including # control codes, but I can't conceive of anyone # putting control codes in their file names. # The question mark indicates it is non-greedy so # that regex will match only up to the next quote, # double quote, or greater than symbol # (?=["'>]) : positive lookahead assertion to match the include # delimiter - an apostrophe, double quote, or # greater than symbol. This level of complexity # is required so that the include delimiter is # not consumed by the match, thus allowing the # sub-regex discussed above to uniquely match a # set of semicolon-separated INCLUDE statements # (as allowed by the F2003 standard) include_regex = """(?i)(?:^|['">]\s*;)\s*INCLUDE\s+(?:\w+_)?[<"'](.+?)(?=["'>])""" # The MODULE statement regex finds module definitions by matching # the following: # # MODULE module_name # # but *not* the following: # # MODULE PROCEDURE procedure_name # # Here is a breakdown of the regex: # # (?i) : regex is case insensitive # ^\s* : any amount of white space # MODULE : match the string MODULE, case insensitive # \s+ : match one or more white space characters # (?!PROCEDURE) : but *don't* match if the next word matches # PROCEDURE (negative lookahead assertion), # case insensitive # (\w+) : match one or more alphanumeric characters # that make up the defined module name and # save it in a group def_regex = """(?i)^\s*MODULE\s+(?!PROCEDURE)(\w+)""" scanner = F90Scanner("FortranScan", "$FORTRANSUFFIXES", path_variable, use_regex, include_regex, def_regex) return scanner # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0094, 0.0156, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0938, 0.0031, 0, 0.66, 0.1, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.1, 0.0031, 0, 0.66, 0...
[ "\"\"\"SCons.Scanner.Fortran\n\nThis module implements the dependency scanner for Fortran code.\n\n\"\"\"", "__revision__ = \"src/engine/SCons/Scanner/Fortran.py 4720 2010/03/24 03:14:11 jars\"", "import re", "import string", "import SCons.Node", "import SCons.Node.FS", "import SCons.Scanner", "import...
"""SCons.Scanner.LaTeX This module implements the dependency scanner for LaTeX code. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Scanner/LaTeX.py 4720 2010/03/24 03:14:11 jars" import os.path import string import re import SCons.Scanner import SCons.Util # list of graphics file extensions for TeX and LaTeX TexGraphics = ['.eps', '.ps'] LatexGraphics = ['.pdf', '.png', '.jpg', '.gif', '.tif'] # Used as a return value of modify_env_var if the variable is not set. class _Null: pass _null = _Null # The user specifies the paths in env[variable], similar to other builders. # They may be relative and must be converted to absolute, as expected # by LaTeX and Co. The environment may already have some paths in # env['ENV'][var]. These paths are honored, but the env[var] paths have # higher precedence. All changes are un-done on exit. def modify_env_var(env, var, abspath): try: save = env['ENV'][var] except KeyError: save = _null env.PrependENVPath(var, abspath) try: if SCons.Util.is_List(env[var]): #TODO(1.5) #env.PrependENVPath(var, [os.path.abspath(str(p)) for p in env[var]]) env.PrependENVPath(var, map(lambda p: os.path.abspath(str(p)), env[var])) else: # Split at os.pathsep to convert into absolute path #TODO(1.5) env.PrependENVPath(var, [os.path.abspath(p) for p in str(env[var]).split(os.pathsep)]) env.PrependENVPath(var, map(lambda p: os.path.abspath(p), string.split(str(env[var]), os.pathsep))) except KeyError: pass # Convert into a string explicitly to append ":" (without which it won't search system # paths as well). The problem is that env.AppendENVPath(var, ":") # does not work, refuses to append ":" (os.pathsep). if SCons.Util.is_List(env['ENV'][var]): # TODO(1.5) #env['ENV'][var] = os.pathsep.join(env['ENV'][var]) env['ENV'][var] = string.join(env['ENV'][var], os.pathsep) # Append the trailing os.pathsep character here to catch the case with no env[var] env['ENV'][var] = env['ENV'][var] + os.pathsep return save class FindENVPathDirs: """A class to bind a specific *PATH variable name to a function that will return all of the *path directories.""" def __init__(self, variable): self.variable = variable def __call__(self, env, dir=None, target=None, source=None, argument=None): import SCons.PathList try: path = env['ENV'][self.variable] except KeyError: return () dir = dir or env.fs._cwd path = SCons.PathList.PathList(path).subst_path(env, target, source) return tuple(dir.Rfindalldirs(path)) def LaTeXScanner(): """Return a prototype Scanner instance for scanning LaTeX source files when built with latex. """ ds = LaTeX(name = "LaTeXScanner", suffixes = '$LATEXSUFFIXES', # in the search order, see below in LaTeX class docstring graphics_extensions = TexGraphics, recursive = 0) return ds def PDFLaTeXScanner(): """Return a prototype Scanner instance for scanning LaTeX source files when built with pdflatex. """ ds = LaTeX(name = "PDFLaTeXScanner", suffixes = '$LATEXSUFFIXES', # in the search order, see below in LaTeX class docstring graphics_extensions = LatexGraphics, recursive = 0) return ds class LaTeX(SCons.Scanner.Base): """Class for scanning LaTeX files for included files. Unlike most scanners, which use regular expressions that just return the included file name, this returns a tuple consisting of the keyword for the inclusion ("include", "includegraphics", "input", or "bibliography"), and then the file name itself. Based on a quick look at LaTeX documentation, it seems that we should append .tex suffix for the "include" keywords, append .tex if there is no extension for the "input" keyword, and need to add .bib for the "bibliography" keyword that does not accept extensions by itself. Finally, if there is no extension for an "includegraphics" keyword latex will append .ps or .eps to find the file, while pdftex may use .pdf, .jpg, .tif, .mps, or .png. The actual subset and search order may be altered by DeclareGraphicsExtensions command. This complication is ignored. The default order corresponds to experimentation with teTeX $ latex --version pdfeTeX 3.141592-1.21a-2.2 (Web2C 7.5.4) kpathsea version 3.5.4 The order is: ['.eps', '.ps'] for latex ['.png', '.pdf', '.jpg', '.tif']. Another difference is that the search path is determined by the type of the file being searched: env['TEXINPUTS'] for "input" and "include" keywords env['TEXINPUTS'] for "includegraphics" keyword env['TEXINPUTS'] for "lstinputlisting" keyword env['BIBINPUTS'] for "bibliography" keyword env['BSTINPUTS'] for "bibliographystyle" keyword FIXME: also look for the class or style in document[class|style]{} FIXME: also look for the argument of bibliographystyle{} """ keyword_paths = {'include': 'TEXINPUTS', 'input': 'TEXINPUTS', 'includegraphics': 'TEXINPUTS', 'bibliography': 'BIBINPUTS', 'bibliographystyle': 'BSTINPUTS', 'usepackage': 'TEXINPUTS', 'lstinputlisting': 'TEXINPUTS'} env_variables = SCons.Util.unique(keyword_paths.values()) def __init__(self, name, suffixes, graphics_extensions, *args, **kw): # We have to include \n with the % we exclude from the first part # part of the regex because the expression is compiled with re.M. # Without the \n, the ^ could match the beginning of a *previous* # line followed by one or more newline characters (i.e. blank # lines), interfering with a match on the next line. regex = r'^[^%\n]*\\(include|includegraphics(?:\[[^\]]+\])?|lstinputlisting(?:\[[^\]]+\])?|input|bibliography|usepackage){([^}]*)}' self.cre = re.compile(regex, re.M) self.graphics_extensions = graphics_extensions def _scan(node, env, path=(), self=self): node = node.rfile() if not node.exists(): return [] return self.scan_recurse(node, path) class FindMultiPathDirs: """The stock FindPathDirs function has the wrong granularity: it is called once per target, while we need the path that depends on what kind of included files is being searched. This wrapper hides multiple instances of FindPathDirs, one per the LaTeX path variable in the environment. When invoked, the function calculates and returns all the required paths as a dictionary (converted into a tuple to become hashable). Then the scan function converts it back and uses a dictionary of tuples rather than a single tuple of paths. """ def __init__(self, dictionary): self.dictionary = {} for k,n in dictionary.items(): self.dictionary[k] = ( SCons.Scanner.FindPathDirs(n), FindENVPathDirs(n) ) def __call__(self, env, dir=None, target=None, source=None, argument=None): di = {} for k,(c,cENV) in self.dictionary.items(): di[k] = ( c(env, dir=None, target=None, source=None, argument=None) , cENV(env, dir=None, target=None, source=None, argument=None) ) # To prevent "dict is not hashable error" return tuple(di.items()) class LaTeXScanCheck: """Skip all but LaTeX source files, i.e., do not scan *.eps, *.pdf, *.jpg, etc. """ def __init__(self, suffixes): self.suffixes = suffixes def __call__(self, node, env): current = not node.has_builder() or node.is_up_to_date() scannable = node.get_suffix() in env.subst_list(self.suffixes)[0] # Returning false means that the file is not scanned. return scannable and current kw['function'] = _scan kw['path_function'] = FindMultiPathDirs(LaTeX.keyword_paths) kw['recursive'] = 0 kw['skeys'] = suffixes kw['scan_check'] = LaTeXScanCheck(suffixes) kw['name'] = name apply(SCons.Scanner.Base.__init__, (self,) + args, kw) def _latex_names(self, include): filename = include[1] if include[0] == 'input': base, ext = os.path.splitext( filename ) if ext == "": return [filename + '.tex'] if (include[0] == 'include'): return [filename + '.tex'] if include[0] == 'bibliography': base, ext = os.path.splitext( filename ) if ext == "": return [filename + '.bib'] if include[0] == 'usepackage': base, ext = os.path.splitext( filename ) if ext == "": return [filename + '.sty'] if include[0] == 'includegraphics': base, ext = os.path.splitext( filename ) if ext == "": #TODO(1.5) return [filename + e for e in self.graphics_extensions] #return map(lambda e, f=filename: f+e, self.graphics_extensions + TexGraphics) # use the line above to find dependency for PDF builder when only .eps figure is present # Since it will be found if the user tell scons how to make the pdf figure leave it out for now. return map(lambda e, f=filename: f+e, self.graphics_extensions) return [filename] def sort_key(self, include): return SCons.Node.FS._my_normcase(str(include)) def find_include(self, include, source_dir, path): try: sub_path = path[include[0]] except (IndexError, KeyError): sub_path = () try_names = self._latex_names(include) for n in try_names: # see if we find it using the path in env[var] i = SCons.Node.FS.find_file(n, (source_dir,) + sub_path[0]) if i: return i, include # see if we find it using the path in env['ENV'][var] i = SCons.Node.FS.find_file(n, (source_dir,) + sub_path[1]) if i: return i, include return i, include def scan(self, node): # Modify the default scan function to allow for the regular # expression to return a comma separated list of file names # as can be the case with the bibliography keyword. # Cache the includes list in node so we only scan it once: # path_dict = dict(list(path)) noopt_cre = re.compile('\[.*$') if node.includes != None: includes = node.includes else: includes = self.cre.findall(node.get_text_contents()) # 1. Split comma-separated lines, e.g. # ('bibliography', 'phys,comp') # should become two entries # ('bibliography', 'phys') # ('bibliography', 'comp') # 2. Remove the options, e.g., such as # ('includegraphics[clip,width=0.7\\linewidth]', 'picture.eps') # should become # ('includegraphics', 'picture.eps') split_includes = [] for include in includes: inc_type = noopt_cre.sub('', include[0]) inc_list = string.split(include[1],',') for j in range(len(inc_list)): split_includes.append( (inc_type, inc_list[j]) ) # includes = split_includes node.includes = includes return includes def scan_recurse(self, node, path=()): """ do a recursive scan of the top level target file This lets us search for included files based on the directory of the main file just as latex does""" path_dict = dict(list(path)) queue = [] queue.extend( self.scan(node) ) seen = {} # This is a hand-coded DSU (decorate-sort-undecorate, or # Schwartzian transform) pattern. The sort key is the raw name # of the file as specifed on the \include, \input, etc. line. # TODO: what about the comment in the original Classic scanner: # """which lets # us keep the sort order constant regardless of whether the file # is actually found in a Repository or locally.""" nodes = [] source_dir = node.get_dir() #for include in includes: while queue: include = queue.pop() # TODO(1.5): more compact: #try: # if seen[include[1]] == 1: # continue #except KeyError: # seen[include[1]] = 1 try: already_seen = seen[include[1]] except KeyError: seen[include[1]] = 1 already_seen = False if already_seen: continue # # Handle multiple filenames in include[1] # n, i = self.find_include(include, source_dir, path_dict) if n is None: # Do not bother with 'usepackage' warnings, as they most # likely refer to system-level files if include[0] != 'usepackage': SCons.Warnings.warn(SCons.Warnings.DependencyWarning, "No dependency generated for file: %s (included from: %s) -- file not found" % (i, node)) else: sortkey = self.sort_key(n) nodes.append((sortkey, n)) # recurse down queue.extend( self.scan(n) ) # nodes.sort() nodes = map(lambda pair: pair[1], nodes) return nodes # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0079, 0.0132, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0794, 0.0026, 0, 0.66, 0.0667, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.0847, 0.0026, 0, 0.66,...
[ "\"\"\"SCons.Scanner.LaTeX\n\nThis module implements the dependency scanner for LaTeX code.\n\n\"\"\"", "__revision__ = \"src/engine/SCons/Scanner/LaTeX.py 4720 2010/03/24 03:14:11 jars\"", "import os.path", "import string", "import re", "import SCons.Scanner", "import SCons.Util", "TexGraphics = ['...
"""SCons.Scanner.D Scanner for the Digital Mars "D" programming language. Coded by Andy Friesen 17 Nov 2003 """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Scanner/D.py 4720 2010/03/24 03:14:11 jars" import re import string import SCons.Scanner def DScanner(): """Return a prototype Scanner instance for scanning D source files""" ds = D() return ds class D(SCons.Scanner.Classic): def __init__ (self): SCons.Scanner.Classic.__init__ (self, name = "DScanner", suffixes = '$DSUFFIXES', path_variable = 'DPATH', regex = 'import\s+(?:[a-zA-Z0-9_.]+)\s*(?:,\s*(?:[a-zA-Z0-9_.]+)\s*)*;') self.cre2 = re.compile ('(?:import\s)?\s*([a-zA-Z0-9_.]+)\s*(?:,|;)', re.M) def find_include(self, include, source_dir, path): # translate dots (package separators) to slashes inc = string.replace(include, '.', '/') i = SCons.Node.FS.find_file(inc + '.d', (source_dir,) + path) if i is None: i = SCons.Node.FS.find_file (inc + '.di', (source_dir,) + path) return i, include def find_include_names(self, node): includes = [] for i in self.cre.findall(node.get_text_contents()): includes = includes + self.cre2.findall(i) return includes # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0608, 0.1081, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.4459, 0.0135, 0, 0.66, 0.1667, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.473, 0.0135, 0, 0.66, ...
[ "\"\"\"SCons.Scanner.D\n\nScanner for the Digital Mars \"D\" programming language.\n\nCoded by Andy Friesen\n17 Nov 2003\n\n\"\"\"", "__revision__ = \"src/engine/SCons/Scanner/D.py 4720 2010/03/24 03:14:11 jars\"", "import re", "import string", "import SCons.Scanner", "def DScanner():\n \"\"\"Return a ...
"""SCons.Scanner.RC This module implements the depenency scanner for RC (Interface Definition Language) files. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Scanner/RC.py 4720 2010/03/24 03:14:11 jars" import SCons.Node.FS import SCons.Scanner import re def RCScan(): """Return a prototype Scanner instance for scanning RC source files""" res_re= r'^(?:\s*#\s*(?:include)|' \ '.*?\s+(?:ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)' \ '\s*.*?)' \ '\s*(<|"| )([^>"\s]+)(?:[>" ])*$' resScanner = SCons.Scanner.ClassicCPP( "ResourceScanner", "$RCSUFFIXES", "CPPPATH", res_re ) return resScanner # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0636, 0.1091, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.5636, 0.0182, 0, 0.66, 0.2, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.6, 0.0182, 0, 0.66, 0...
[ "\"\"\"SCons.Scanner.RC\n\nThis module implements the depenency scanner for RC (Interface\nDefinition Language) files.\n\n\"\"\"", "__revision__ = \"src/engine/SCons/Scanner/RC.py 4720 2010/03/24 03:14:11 jars\"", "import SCons.Node.FS", "import SCons.Scanner", "import re", "def RCScan():\n \"\"\"Retur...
# # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Scanner/Prog.py 4720 2010/03/24 03:14:11 jars" import string import SCons.Node import SCons.Node.FS import SCons.Scanner import SCons.Util # global, set by --debug=findlibs print_find_libs = None def ProgramScanner(**kw): """Return a prototype Scanner instance for scanning executable files for static-lib dependencies""" kw['path_function'] = SCons.Scanner.FindPathDirs('LIBPATH') ps = apply(SCons.Scanner.Base, [scan, "ProgramScanner"], kw) return ps def scan(node, env, libpath = ()): """ This scanner scans program files for static-library dependencies. It will search the LIBPATH environment variable for libraries specified in the LIBS variable, returning any files it finds as dependencies. """ try: libs = env['LIBS'] except KeyError: # There are no LIBS in this environment, so just return a null list: return [] if SCons.Util.is_String(libs): libs = string.split(libs) else: libs = SCons.Util.flatten(libs) try: prefix = env['LIBPREFIXES'] if not SCons.Util.is_List(prefix): prefix = [ prefix ] except KeyError: prefix = [ '' ] try: suffix = env['LIBSUFFIXES'] if not SCons.Util.is_List(suffix): suffix = [ suffix ] except KeyError: suffix = [ '' ] pairs = [] for suf in map(env.subst, suffix): for pref in map(env.subst, prefix): pairs.append((pref, suf)) result = [] if callable(libpath): libpath = libpath() find_file = SCons.Node.FS.find_file adjustixes = SCons.Util.adjustixes for lib in libs: if SCons.Util.is_String(lib): lib = env.subst(lib) for pref, suf in pairs: l = adjustixes(lib, pref, suf) l = find_file(l, libpath, verbose=print_find_libs) if l: result.append(l) else: result.append(lib) return result # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 14, 0, 0.233, 0.0097, 0, 0.66, 0, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.2524, 0.0097, 0, 0.66, 0.125, 890, 0, 1, 0, 0, 890, 0, 0 ], [ 1, 0, 0.2718, 0.0097, 0, 0.6...
[ "__revision__ = \"src/engine/SCons/Scanner/Prog.py 4720 2010/03/24 03:14:11 jars\"", "import string", "import SCons.Node", "import SCons.Node.FS", "import SCons.Scanner", "import SCons.Util", "print_find_libs = None", "def ProgramScanner(**kw):\n \"\"\"Return a prototype Scanner instance for scanni...
"""SCons.Scanner The Scanner package for the SCons software construction utility. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Scanner/__init__.py 4720 2010/03/24 03:14:11 jars" import re import string import SCons.Node.FS import SCons.Util class _Null: pass # This is used instead of None as a default argument value so None can be # used as an actual argument value. _null = _Null def Scanner(function, *args, **kw): """ Public interface factory function for creating different types of Scanners based on the different types of "functions" that may be supplied. TODO: Deprecate this some day. We've moved the functionality inside the Base class and really don't need this factory function any more. It was, however, used by some of our Tool modules, so the call probably ended up in various people's custom modules patterned on SCons code. """ if SCons.Util.is_Dict(function): return apply(Selector, (function,) + args, kw) else: return apply(Base, (function,) + args, kw) class FindPathDirs: """A class to bind a specific *PATH variable name to a function that will return all of the *path directories.""" def __init__(self, variable): self.variable = variable def __call__(self, env, dir=None, target=None, source=None, argument=None): import SCons.PathList try: path = env[self.variable] except KeyError: return () dir = dir or env.fs._cwd path = SCons.PathList.PathList(path).subst_path(env, target, source) return tuple(dir.Rfindalldirs(path)) class Base: """ The base class for dependency scanners. This implements straightforward, single-pass scanning of a single file. """ def __init__(self, function, name = "NONE", argument = _null, skeys = _null, path_function = None, # Node.FS.Base so that, by default, it's okay for a # scanner to return a Dir, File or Entry. node_class = SCons.Node.FS.Base, node_factory = None, scan_check = None, recursive = None): """ Construct a new scanner object given a scanner function. 'function' - a scanner function taking two or three arguments and returning a list of strings. 'name' - a name for identifying this scanner object. 'argument' - an optional argument that, if specified, will be passed to both the scanner function and the path_function. 'skeys' - an optional list argument that can be used to determine which scanner should be used for a given Node. In the case of File nodes, for example, the 'skeys' would be file suffixes. 'path_function' - a function that takes four or five arguments (a construction environment, Node for the directory containing the SConscript file that defined the primary target, list of target nodes, list of source nodes, and optional argument for this instance) and returns a tuple of the directories that can be searched for implicit dependency files. May also return a callable() which is called with no args and returns the tuple (supporting Bindable class). 'node_class' - the class of Nodes which this scan will return. If node_class is None, then this scanner will not enforce any Node conversion and will return the raw results from the underlying scanner function. 'node_factory' - the factory function to be called to translate the raw results returned by the scanner function into the expected node_class objects. 'scan_check' - a function to be called to first check whether this node really needs to be scanned. 'recursive' - specifies that this scanner should be invoked recursively on all of the implicit dependencies it returns (the canonical example being #include lines in C source files). May be a callable, which will be called to filter the list of nodes found to select a subset for recursive scanning (the canonical example being only recursively scanning subdirectories within a directory). The scanner function's first argument will be a Node that should be scanned for dependencies, the second argument will be an Environment object, the third argument will be the tuple of paths returned by the path_function, and the fourth argument will be the value passed into 'argument', and the returned list should contain the Nodes for all the direct dependencies of the file. Examples: s = Scanner(my_scanner_function) s = Scanner(function = my_scanner_function) s = Scanner(function = my_scanner_function, argument = 'foo') """ # Note: this class could easily work with scanner functions that take # something other than a filename as an argument (e.g. a database # node) and a dependencies list that aren't file names. All that # would need to be changed is the documentation. self.function = function self.path_function = path_function self.name = name self.argument = argument if skeys is _null: if SCons.Util.is_Dict(function): skeys = function.keys() else: skeys = [] self.skeys = skeys self.node_class = node_class self.node_factory = node_factory self.scan_check = scan_check if callable(recursive): self.recurse_nodes = recursive elif recursive: self.recurse_nodes = self._recurse_all_nodes else: self.recurse_nodes = self._recurse_no_nodes def path(self, env, dir=None, target=None, source=None): if not self.path_function: return () if not self.argument is _null: return self.path_function(env, dir, target, source, self.argument) else: return self.path_function(env, dir, target, source) def __call__(self, node, env, path = ()): """ This method scans a single object. 'node' is the node that will be passed to the scanner function, and 'env' is the environment that will be passed to the scanner function. A list of direct dependency nodes for the specified node will be returned. """ if self.scan_check and not self.scan_check(node, env): return [] self = self.select(node) if not self.argument is _null: list = self.function(node, env, path, self.argument) else: list = self.function(node, env, path) kw = {} if hasattr(node, 'dir'): kw['directory'] = node.dir node_factory = env.get_factory(self.node_factory) nodes = [] for l in list: if self.node_class and not isinstance(l, self.node_class): l = apply(node_factory, (l,), kw) nodes.append(l) return nodes def __cmp__(self, other): try: return cmp(self.__dict__, other.__dict__) except AttributeError: # other probably doesn't have a __dict__ return cmp(self.__dict__, other) def __hash__(self): return id(self) def __str__(self): return self.name def add_skey(self, skey): """Add a skey to the list of skeys""" self.skeys.append(skey) def get_skeys(self, env=None): if env and SCons.Util.is_String(self.skeys): return env.subst_list(self.skeys)[0] return self.skeys def select(self, node): if SCons.Util.is_Dict(self.function): key = node.scanner_key() try: return self.function[key] except KeyError: return None else: return self def _recurse_all_nodes(self, nodes): return nodes def _recurse_no_nodes(self, nodes): return [] recurse_nodes = _recurse_no_nodes def add_scanner(self, skey, scanner): self.function[skey] = scanner self.add_skey(skey) class Selector(Base): """ A class for selecting a more specific scanner based on the scanner_key() (suffix) for a specific Node. TODO: This functionality has been moved into the inner workings of the Base class, and this class will be deprecated at some point. (It was never exposed directly as part of the public interface, although it is used by the Scanner() factory function that was used by various Tool modules and therefore was likely a template for custom modules that may be out there.) """ def __init__(self, dict, *args, **kw): apply(Base.__init__, (self, None,)+args, kw) self.dict = dict self.skeys = dict.keys() def __call__(self, node, env, path = ()): return self.select(node)(node, env, path) def select(self, node): try: return self.dict[node.scanner_key()] except KeyError: return None def add_scanner(self, skey, scanner): self.dict[skey] = scanner self.add_skey(skey) class Current(Base): """ A class for scanning files that are source files (have no builder) or are derived files and are current (which implies that they exist, either locally or in a repository). """ def __init__(self, *args, **kw): def current_check(node, env): return not node.has_builder() or node.is_up_to_date() kw['scan_check'] = current_check apply(Base.__init__, (self,) + args, kw) class Classic(Current): """ A Scanner subclass to contain the common logic for classic CPP-style include scanning, but which can be customized to use different regular expressions to find the includes. Note that in order for this to work "out of the box" (without overriding the find_include() and sort_key() methods), the regular expression passed to the constructor must return the name of the include file in group 0. """ def __init__(self, name, suffixes, path_variable, regex, *args, **kw): self.cre = re.compile(regex, re.M) def _scan(node, env, path=(), self=self): node = node.rfile() if not node.exists(): return [] return self.scan(node, path) kw['function'] = _scan kw['path_function'] = FindPathDirs(path_variable) kw['recursive'] = 1 kw['skeys'] = suffixes kw['name'] = name apply(Current.__init__, (self,) + args, kw) def find_include(self, include, source_dir, path): n = SCons.Node.FS.find_file(include, (source_dir,) + tuple(path)) return n, include def sort_key(self, include): return SCons.Node.FS._my_normcase(include) def find_include_names(self, node): return self.cre.findall(node.get_text_contents()) def scan(self, node, path=()): # cache the includes list in node so we only scan it once: if node.includes is not None: includes = node.includes else: includes = self.find_include_names (node) # Intern the names of the include files. Saves some memory # if the same header is included many times. node.includes = map(SCons.Util.silent_intern, includes) # This is a hand-coded DSU (decorate-sort-undecorate, or # Schwartzian transform) pattern. The sort key is the raw name # of the file as specifed on the #include line (including the # " or <, since that may affect what file is found), which lets # us keep the sort order constant regardless of whether the file # is actually found in a Repository or locally. nodes = [] source_dir = node.get_dir() if callable(path): path = path() for include in includes: n, i = self.find_include(include, source_dir, path) if n is None: SCons.Warnings.warn(SCons.Warnings.DependencyWarning, "No dependency generated for file: %s (included from: %s) -- file not found" % (i, node)) else: sortkey = self.sort_key(include) nodes.append((sortkey, n)) nodes.sort() nodes = map(lambda pair: pair[1], nodes) return nodes class ClassicCPP(Classic): """ A Classic Scanner subclass which takes into account the type of bracketing used to include the file, and uses classic CPP rules for searching for the files based on the bracketing. Note that in order for this to work, the regular expression passed to the constructor must return the leading bracket in group 0, and the contained filename in group 1. """ def find_include(self, include, source_dir, path): if include[0] == '"': paths = (source_dir,) + tuple(path) else: paths = tuple(path) + (source_dir,) n = SCons.Node.FS.find_file(include[1], paths) i = SCons.Util.silent_intern(include[1]) return n, i def sort_key(self, include): return SCons.Node.FS._my_normcase(string.join(include)) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0072, 0.012, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0719, 0.0024, 0, 0.66, 0.0714, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.0767, 0.0024, 0, 0.66, ...
[ "\"\"\"SCons.Scanner\n\nThe Scanner package for the SCons software construction utility.\n\n\"\"\"", "__revision__ = \"src/engine/SCons/Scanner/__init__.py 4720 2010/03/24 03:14:11 jars\"", "import re", "import string", "import SCons.Node.FS", "import SCons.Util", "class _Null:\n pass", "_null = _N...
# # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Scanner/Dir.py 4720 2010/03/24 03:14:11 jars" import SCons.Node.FS import SCons.Scanner def only_dirs(nodes): is_Dir = lambda n: isinstance(n.disambiguate(), SCons.Node.FS.Dir) return filter(is_Dir, nodes) def DirScanner(**kw): """Return a prototype Scanner instance for scanning directories for on-disk files""" kw['node_factory'] = SCons.Node.FS.Entry kw['recursive'] = only_dirs return apply(SCons.Scanner.Base, (scan_on_disk, "DirScanner"), kw) def DirEntryScanner(**kw): """Return a prototype Scanner instance for "scanning" directory Nodes for their in-memory entries""" kw['node_factory'] = SCons.Node.FS.Entry kw['recursive'] = None return apply(SCons.Scanner.Base, (scan_in_memory, "DirEntryScanner"), kw) skip_entry = {} skip_entry_list = [ '.', '..', '.sconsign', # Used by the native dblite.py module. '.sconsign.dblite', # Used by dbm and dumbdbm. '.sconsign.dir', # Used by dbm. '.sconsign.pag', # Used by dumbdbm. '.sconsign.dat', '.sconsign.bak', # Used by some dbm emulations using Berkeley DB. '.sconsign.db', ] for skip in skip_entry_list: skip_entry[skip] = 1 skip_entry[SCons.Node.FS._my_normcase(skip)] = 1 do_not_scan = lambda k: not skip_entry.has_key(k) def scan_on_disk(node, env, path=()): """ Scans a directory for on-disk files and directories therein. Looking up the entries will add these to the in-memory Node tree representation of the file system, so all we have to do is just that and then call the in-memory scanning function. """ try: flist = node.fs.listdir(node.abspath) except (IOError, OSError): return [] e = node.Entry for f in filter(do_not_scan, flist): # Add ./ to the beginning of the file name so if it begins with a # '#' we don't look it up relative to the top-level directory. e('./' + f) return scan_in_memory(node, env, path) def scan_in_memory(node, env, path=()): """ "Scans" a Node.FS.Dir for its in-memory entries. """ try: entries = node.entries except AttributeError: # It's not a Node.FS.Dir (or doesn't look enough like one for # our purposes), which can happen if a target list containing # mixed Node types (Dirs and Files, for example) has a Dir as # the first entry. return [] entry_list = filter(do_not_scan, entries.keys()) entry_list.sort() return map(lambda n, e=entries: e[n], entry_list) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 14, 0, 0.2162, 0.009, 0, 0.66, 0, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.2342, 0.009, 0, 0.66, 0.0909, 482, 0, 1, 0, 0, 482, 0, 0 ], [ 1, 0, 0.2432, 0.009, 0, 0.66...
[ "__revision__ = \"src/engine/SCons/Scanner/Dir.py 4720 2010/03/24 03:14:11 jars\"", "import SCons.Node.FS", "import SCons.Scanner", "def only_dirs(nodes):\n is_Dir = lambda n: isinstance(n.disambiguate(), SCons.Node.FS.Dir)\n return filter(is_Dir, nodes)", " is_Dir = lambda n: isinstance(n.disambig...
"""SCons.Scanner.IDL This module implements the depenency scanner for IDL (Interface Definition Language) files. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Scanner/IDL.py 4720 2010/03/24 03:14:11 jars" import SCons.Node.FS import SCons.Scanner def IDLScan(): """Return a prototype Scanner instance for scanning IDL source files""" cs = SCons.Scanner.ClassicCPP("IDLScan", "$IDLSUFFIXES", "CPPPATH", '^[ \t]*(?:#[ \t]*include|[ \t]*import)[ \t]+(<|")([^>"]+)(>|")') return cs # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0729, 0.125, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.6458, 0.0208, 0, 0.66, 0.25, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.6875, 0.0208, 0, 0.66, ...
[ "\"\"\"SCons.Scanner.IDL\n\nThis module implements the depenency scanner for IDL (Interface\nDefinition Language) files.\n\n\"\"\"", "__revision__ = \"src/engine/SCons/Scanner/IDL.py 4720 2010/03/24 03:14:11 jars\"", "import SCons.Node.FS", "import SCons.Scanner", "def IDLScan():\n \"\"\"Return a prototy...
# # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Sig.py 4720 2010/03/24 03:14:11 jars" __doc__ = """Place-holder for the old SCons.Sig module hierarchy This is no longer used, but code out there (such as the NSIS module on the SCons wiki) may try to import SCons.Sig. If so, we generate a warning that points them to the line that caused the import, and don't die. If someone actually tried to use the sub-modules or functions within the package (for example, SCons.Sig.MD5.signature()), then they'll still get an AttributeError, but at least they'll know where to start looking. """ import SCons.Util import SCons.Warnings msg = 'The SCons.Sig module no longer exists.\n' \ ' Remove the following "import SCons.Sig" line to eliminate this warning:' SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning, msg) default_calc = None default_module = None class MD5Null(SCons.Util.Null): def __repr__(self): return "MD5Null()" class TimeStampNull(SCons.Util.Null): def __repr__(self): return "TimeStampNull()" MD5 = MD5Null() TimeStamp = TimeStampNull() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 14, 0, 0.381, 0.0159, 0, 0.66, 0, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.4841, 0.1587, 0, 0.66, 0.0909, 155, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.5873, 0.0159, 0, 0.6...
[ "__revision__ = \"src/engine/SCons/Sig.py 4720 2010/03/24 03:14:11 jars\"", "__doc__ = \"\"\"Place-holder for the old SCons.Sig module hierarchy\n\nThis is no longer used, but code out there (such as the NSIS module on\nthe SCons wiki) may try to import SCons.Sig. If so, we generate a warning\nthat points them t...
"""SCons.Script This file implements the main() function used by the scons script. Architecturally, this *is* the scons script, and will likely only be called from the external "scons" wrapper. Consequently, anything here should not be, or be considered, part of the build engine. If it's something that we expect other software to want to use, it should go in some other module. If it's specific to the "scons" script invocation, it goes here. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Script/__init__.py 4720 2010/03/24 03:14:11 jars" import time start_time = time.time() import os import string import sys import UserList # Special chicken-and-egg handling of the "--debug=memoizer" flag: # # SCons.Memoize contains a metaclass implementation that affects how # the other classes are instantiated. The Memoizer may add shim methods # to classes that have methods that cache computed values in order to # count and report the hits and misses. # # If we wait to enable the Memoization until after we've parsed the # command line options normally, it will be too late, because the Memoizer # will have already analyzed the classes that it's Memoizing and decided # to not add the shims. So we use a special-case, up-front check for # the "--debug=memoizer" flag and enable Memoizer before we import any # of the other modules that use it. _args = sys.argv + string.split(os.environ.get('SCONSFLAGS', '')) if "--debug=memoizer" in _args: import SCons.Memoize import SCons.Warnings try: SCons.Memoize.EnableMemoization() except SCons.Warnings.Warning: # Some warning was thrown (inability to --debug=memoizer on # Python 1.5.2 because it doesn't have metaclasses). Arrange # for it to be displayed or not after warnings are configured. import Main exc_type, exc_value, tb = sys.exc_info() Main.delayed_warnings.append((exc_type, exc_value)) del _args import SCons.Action import SCons.Builder import SCons.Environment import SCons.Node.FS import SCons.Options import SCons.Platform import SCons.Scanner import SCons.SConf import SCons.Subst import SCons.Tool import SCons.Util import SCons.Variables import SCons.Defaults import Main main = Main.main # The following are global class definitions and variables that used to # live directly in this module back before 0.96.90, when it contained # a lot of code. Some SConscript files in widely-distributed packages # (Blender is the specific example) actually reached into SCons.Script # directly to use some of these. Rather than break those SConscript # files, we're going to propagate these names into the SCons.Script # namespace here. # # Some of these are commented out because it's *really* unlikely anyone # used them, but we're going to leave the comment here to try to make # it obvious what to do if the situation arises. BuildTask = Main.BuildTask CleanTask = Main.CleanTask QuestionTask = Main.QuestionTask #PrintHelp = Main.PrintHelp #SConscriptSettableOptions = Main.SConscriptSettableOptions AddOption = Main.AddOption GetOption = Main.GetOption SetOption = Main.SetOption Progress = Main.Progress GetBuildFailures = Main.GetBuildFailures #keep_going_on_error = Main.keep_going_on_error #print_dtree = Main.print_dtree #print_explanations = Main.print_explanations #print_includes = Main.print_includes #print_objects = Main.print_objects #print_time = Main.print_time #print_tree = Main.print_tree #memory_stats = Main.memory_stats #ignore_errors = Main.ignore_errors #sconscript_time = Main.sconscript_time #command_time = Main.command_time #exit_status = Main.exit_status #profiling = Main.profiling #repositories = Main.repositories # import SConscript _SConscript = SConscript call_stack = _SConscript.call_stack # Action = SCons.Action.Action AddMethod = SCons.Util.AddMethod AllowSubstExceptions = SCons.Subst.SetAllowableExceptions Builder = SCons.Builder.Builder Configure = _SConscript.Configure Environment = SCons.Environment.Environment #OptParser = SCons.SConsOptions.OptParser FindPathDirs = SCons.Scanner.FindPathDirs Platform = SCons.Platform.Platform Return = _SConscript.Return Scanner = SCons.Scanner.Base Tool = SCons.Tool.Tool WhereIs = SCons.Util.WhereIs # BoolVariable = SCons.Variables.BoolVariable EnumVariable = SCons.Variables.EnumVariable ListVariable = SCons.Variables.ListVariable PackageVariable = SCons.Variables.PackageVariable PathVariable = SCons.Variables.PathVariable # Deprecated names that will go away some day. BoolOption = SCons.Options.BoolOption EnumOption = SCons.Options.EnumOption ListOption = SCons.Options.ListOption PackageOption = SCons.Options.PackageOption PathOption = SCons.Options.PathOption # Action factories. Chmod = SCons.Defaults.Chmod Copy = SCons.Defaults.Copy Delete = SCons.Defaults.Delete Mkdir = SCons.Defaults.Mkdir Move = SCons.Defaults.Move Touch = SCons.Defaults.Touch # Pre-made, public scanners. CScanner = SCons.Tool.CScanner DScanner = SCons.Tool.DScanner DirScanner = SCons.Defaults.DirScanner ProgramScanner = SCons.Tool.ProgramScanner SourceFileScanner = SCons.Tool.SourceFileScanner # Functions we might still convert to Environment methods. CScan = SCons.Defaults.CScan DefaultEnvironment = SCons.Defaults.DefaultEnvironment # Other variables we provide. class TargetList(UserList.UserList): def _do_nothing(self, *args, **kw): pass def _add_Default(self, list): self.extend(list) def _clear(self): del self[:] ARGUMENTS = {} ARGLIST = [] BUILD_TARGETS = TargetList() COMMAND_LINE_TARGETS = [] DEFAULT_TARGETS = [] # BUILD_TARGETS can be modified in the SConscript files. If so, we # want to treat the modified BUILD_TARGETS list as if they specified # targets on the command line. To do that, though, we need to know if # BUILD_TARGETS was modified through "official" APIs or by hand. We do # this by updating two lists in parallel, the documented BUILD_TARGETS # list, above, and this internal _build_plus_default targets list which # should only have "official" API changes. Then Script/Main.py can # compare these two afterwards to figure out if the user added their # own targets to BUILD_TARGETS. _build_plus_default = TargetList() def _Add_Arguments(alist): for arg in alist: a, b = string.split(arg, '=', 1) ARGUMENTS[a] = b ARGLIST.append((a, b)) def _Add_Targets(tlist): if tlist: COMMAND_LINE_TARGETS.extend(tlist) BUILD_TARGETS.extend(tlist) BUILD_TARGETS._add_Default = BUILD_TARGETS._do_nothing BUILD_TARGETS._clear = BUILD_TARGETS._do_nothing _build_plus_default.extend(tlist) _build_plus_default._add_Default = _build_plus_default._do_nothing _build_plus_default._clear = _build_plus_default._do_nothing def _Set_Default_Targets_Has_Been_Called(d, fs): return DEFAULT_TARGETS def _Set_Default_Targets_Has_Not_Been_Called(d, fs): if d is None: d = [fs.Dir('.')] return d _Get_Default_Targets = _Set_Default_Targets_Has_Not_Been_Called def _Set_Default_Targets(env, tlist): global DEFAULT_TARGETS global _Get_Default_Targets _Get_Default_Targets = _Set_Default_Targets_Has_Been_Called for t in tlist: if t is None: # Delete the elements from the list in-place, don't # reassign an empty list to DEFAULT_TARGETS, so that the # variables will still point to the same object we point to. del DEFAULT_TARGETS[:] BUILD_TARGETS._clear() _build_plus_default._clear() elif isinstance(t, SCons.Node.Node): DEFAULT_TARGETS.append(t) BUILD_TARGETS._add_Default([t]) _build_plus_default._add_Default([t]) else: nodes = env.arg2nodes(t, env.fs.Entry) DEFAULT_TARGETS.extend(nodes) BUILD_TARGETS._add_Default(nodes) _build_plus_default._add_Default(nodes) # help_text = None def HelpFunction(text): global help_text if SCons.Script.help_text is None: SCons.Script.help_text = text else: help_text = help_text + text # # Will be non-zero if we are reading an SConscript file. sconscript_reading = 0 # def Variables(files=[], args=ARGUMENTS): return SCons.Variables.Variables(files, args) def Options(files=[], args=ARGUMENTS): return SCons.Options.Options(files, args) # The list of global functions to add to the SConscript name space # that end up calling corresponding methods or Builders in the # DefaultEnvironment(). GlobalDefaultEnvironmentFunctions = [ # Methods from the SConsEnvironment class, above. 'Default', 'EnsurePythonVersion', 'EnsureSConsVersion', 'Exit', 'Export', 'GetLaunchDir', 'Help', 'Import', #'SConscript', is handled separately, below. 'SConscriptChdir', # Methods from the Environment.Base class. 'AddPostAction', 'AddPreAction', 'Alias', 'AlwaysBuild', 'BuildDir', 'CacheDir', 'Clean', #The Command() method is handled separately, below. 'Decider', 'Depends', 'Dir', 'NoClean', 'NoCache', 'Entry', 'Execute', 'File', 'FindFile', 'FindInstalledFiles', 'FindSourceFiles', 'Flatten', 'GetBuildPath', 'Glob', 'Ignore', 'Install', 'InstallAs', 'Literal', 'Local', 'ParseDepends', 'Precious', 'Repository', 'Requires', 'SConsignFile', 'SideEffect', 'SourceCode', 'SourceSignatures', 'Split', 'Tag', 'TargetSignatures', 'Value', 'VariantDir', ] GlobalDefaultBuilders = [ # Supported builders. 'CFile', 'CXXFile', 'DVI', 'Jar', 'Java', 'JavaH', 'Library', 'M4', 'MSVSProject', 'Object', 'PCH', 'PDF', 'PostScript', 'Program', 'RES', 'RMIC', 'SharedLibrary', 'SharedObject', 'StaticLibrary', 'StaticObject', 'Tar', 'TypeLibrary', 'Zip', 'Package', ] for name in GlobalDefaultEnvironmentFunctions + GlobalDefaultBuilders: exec "%s = _SConscript.DefaultEnvironmentCall(%s)" % (name, repr(name)) del name # There are a handful of variables that used to live in the # Script/SConscript.py module that some SConscript files out there were # accessing directly as SCons.Script.SConscript.*. The problem is that # "SConscript" in this namespace is no longer a module, it's a global # function call--or more precisely, an object that implements a global # function call through the default Environment. Nevertheless, we can # maintain backwards compatibility for SConscripts that were reaching in # this way by hanging some attributes off the "SConscript" object here. SConscript = _SConscript.DefaultEnvironmentCall('SConscript') # Make SConscript look enough like the module it used to be so # that pychecker doesn't barf. SConscript.__name__ = 'SConscript' SConscript.Arguments = ARGUMENTS SConscript.ArgList = ARGLIST SConscript.BuildTargets = BUILD_TARGETS SConscript.CommandLineTargets = COMMAND_LINE_TARGETS SConscript.DefaultTargets = DEFAULT_TARGETS # The global Command() function must be handled differently than the # global functions for other construction environment methods because # we want people to be able to use Actions that must expand $TARGET # and $SOURCE later, when (and if) the Action is invoked to build # the target(s). We do this with the subst=1 argument, which creates # a DefaultEnvironmentCall instance that wraps up a normal default # construction environment that performs variable substitution, not a # proxy that doesn't. # # There's a flaw here, though, because any other $-variables on a command # line will *also* be expanded, each to a null string, but that should # only be a problem in the unusual case where someone was passing a '$' # on a command line and *expected* the $ to get through to the shell # because they were calling Command() and not env.Command()... This is # unlikely enough that we're going to leave this as is and cross that # bridge if someone actually comes to it. Command = _SConscript.DefaultEnvironmentCall('Command', subst=1) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0157, 0.029, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.0894, 0.0024, 0, 0.66, 0.0101, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.0942, 0.0024, 0, 0.66, ...
[ "\"\"\"SCons.Script\n\nThis file implements the main() function used by the scons script.\n\nArchitecturally, this *is* the scons script, and will likely only be\ncalled from the external \"scons\" wrapper. Consequently, anything here\nshould not be, or be considered, part of the build engine. If it's\nsomething ...
# # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Options/ListOption.py 4720 2010/03/24 03:14:11 jars" __doc__ = """Place-holder for the old SCons.Options module hierarchy This is for backwards compatibility. The new equivalent is the Variables/ class hierarchy. These will have deprecation warnings added (some day), and will then be removed entirely (some day). """ import SCons.Variables import SCons.Warnings warned = False def ListOption(*args, **kw): global warned if not warned: msg = "The ListOption() function is deprecated; use the ListVariable() function instead." SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) warned = True return apply(SCons.Variables.ListVariable, args, kw) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 14, 0, 0.48, 0.02, 0, 0.66, 0, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.57, 0.12, 0, 0.66, 0.2, 155, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.66, 0.02, 0, 0.66, 0.4, ...
[ "__revision__ = \"src/engine/SCons/Options/ListOption.py 4720 2010/03/24 03:14:11 jars\"", "__doc__ = \"\"\"Place-holder for the old SCons.Options module hierarchy\n\nThis is for backwards compatibility. The new equivalent is the Variables/\nclass hierarchy. These will have deprecation warnings added (some day)...
# # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Options/BoolOption.py 4720 2010/03/24 03:14:11 jars" __doc__ = """Place-holder for the old SCons.Options module hierarchy This is for backwards compatibility. The new equivalent is the Variables/ class hierarchy. These will have deprecation warnings added (some day), and will then be removed entirely (some day). """ import SCons.Variables import SCons.Warnings warned = False def BoolOption(*args, **kw): global warned if not warned: msg = "The BoolOption() function is deprecated; use the BoolVariable() function instead." SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) warned = True return apply(SCons.Variables.BoolVariable, args, kw) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 14, 0, 0.48, 0.02, 0, 0.66, 0, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.57, 0.12, 0, 0.66, 0.2, 155, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.66, 0.02, 0, 0.66, 0.4, ...
[ "__revision__ = \"src/engine/SCons/Options/BoolOption.py 4720 2010/03/24 03:14:11 jars\"", "__doc__ = \"\"\"Place-holder for the old SCons.Options module hierarchy\n\nThis is for backwards compatibility. The new equivalent is the Variables/\nclass hierarchy. These will have deprecation warnings added (some day)...
# # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Options/PathOption.py 4720 2010/03/24 03:14:11 jars" __doc__ = """Place-holder for the old SCons.Options module hierarchy This is for backwards compatibility. The new equivalent is the Variables/ class hierarchy. These will have deprecation warnings added (some day), and will then be removed entirely (some day). """ import SCons.Variables import SCons.Warnings warned = False class _PathOptionClass: def warn(self): global warned if not warned: msg = "The PathOption() function is deprecated; use the PathVariable() function instead." SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) warned = True def __call__(self, *args, **kw): self.warn() return apply(SCons.Variables.PathVariable, args, kw) def PathAccept(self, *args, **kw): self.warn() return apply(SCons.Variables.PathVariable.PathAccept, args, kw) def PathIsDir(self, *args, **kw): self.warn() return apply(SCons.Variables.PathVariable.PathIsDir, args, kw) def PathIsDirCreate(self, *args, **kw): self.warn() return apply(SCons.Variables.PathVariable.PathIsDirCreate, args, kw) def PathIsFile(self, *args, **kw): self.warn() return apply(SCons.Variables.PathVariable.PathIsFile, args, kw) def PathExists(self, *args, **kw): self.warn() return apply(SCons.Variables.PathVariable.PathExists, args, kw) PathOption = _PathOptionClass() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 14, 0, 0.3158, 0.0132, 0, 0.66, 0, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.375, 0.0789, 0, 0.66, 0.1667, 155, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.4342, 0.0132, 0, 0.6...
[ "__revision__ = \"src/engine/SCons/Options/PathOption.py 4720 2010/03/24 03:14:11 jars\"", "__doc__ = \"\"\"Place-holder for the old SCons.Options module hierarchy\n\nThis is for backwards compatibility. The new equivalent is the Variables/\nclass hierarchy. These will have deprecation warnings added (some day)...
# # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Options/__init__.py 4720 2010/03/24 03:14:11 jars" __doc__ = """Place-holder for the old SCons.Options module hierarchy This is for backwards compatibility. The new equivalent is the Variables/ class hierarchy. These will have deprecation warnings added (some day), and will then be removed entirely (some day). """ import SCons.Variables import SCons.Warnings from BoolOption import BoolOption # okay from EnumOption import EnumOption # okay from ListOption import ListOption # naja from PackageOption import PackageOption # naja from PathOption import PathOption # okay warned = False class Options(SCons.Variables.Variables): def __init__(self, *args, **kw): global warned if not warned: msg = "The Options class is deprecated; use the Variables class instead." SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) warned = True apply(SCons.Variables.Variables.__init__, (self,) + args, kw) def AddOptions(self, *args, **kw): return apply(SCons.Variables.Variables.AddVariables, (self,) + args, kw) def UnknownOptions(self, *args, **kw): return apply(SCons.Variables.Variables.UnknownVariables, (self,) + args, kw) def FormatOptionHelpText(self, *args, **kw): return apply(SCons.Variables.Variables.FormatVariableHelpText, (self,) + args, kw) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 14, 0, 0.3243, 0.0135, 0, 0.66, 0, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.3851, 0.0811, 0, 0.66, 0.1, 155, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.4459, 0.0135, 0, 0.66,...
[ "__revision__ = \"src/engine/SCons/Options/__init__.py 4720 2010/03/24 03:14:11 jars\"", "__doc__ = \"\"\"Place-holder for the old SCons.Options module hierarchy\n\nThis is for backwards compatibility. The new equivalent is the Variables/\nclass hierarchy. These will have deprecation warnings added (some day),\...
# # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Options/EnumOption.py 4720 2010/03/24 03:14:11 jars" __doc__ = """Place-holder for the old SCons.Options module hierarchy This is for backwards compatibility. The new equivalent is the Variables/ class hierarchy. These will have deprecation warnings added (some day), and will then be removed entirely (some day). """ import SCons.Variables import SCons.Warnings warned = False def EnumOption(*args, **kw): global warned if not warned: msg = "The EnumOption() function is deprecated; use the EnumVariable() function instead." SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) warned = True return apply(SCons.Variables.EnumVariable, args, kw) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 14, 0, 0.48, 0.02, 0, 0.66, 0, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.57, 0.12, 0, 0.66, 0.2, 155, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.66, 0.02, 0, 0.66, 0.4, ...
[ "__revision__ = \"src/engine/SCons/Options/EnumOption.py 4720 2010/03/24 03:14:11 jars\"", "__doc__ = \"\"\"Place-holder for the old SCons.Options module hierarchy\n\nThis is for backwards compatibility. The new equivalent is the Variables/\nclass hierarchy. These will have deprecation warnings added (some day)...
# # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Options/PackageOption.py 4720 2010/03/24 03:14:11 jars" __doc__ = """Place-holder for the old SCons.Options module hierarchy This is for backwards compatibility. The new equivalent is the Variables/ class hierarchy. These will have deprecation warnings added (some day), and will then be removed entirely (some day). """ import SCons.Variables import SCons.Warnings warned = False def PackageOption(*args, **kw): global warned if not warned: msg = "The PackageOption() function is deprecated; use the PackageVariable() function instead." SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg) warned = True return apply(SCons.Variables.PackageVariable, args, kw) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 14, 0, 0.48, 0.02, 0, 0.66, 0, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.57, 0.12, 0, 0.66, 0.2, 155, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.66, 0.02, 0, 0.66, 0.4, ...
[ "__revision__ = \"src/engine/SCons/Options/PackageOption.py 4720 2010/03/24 03:14:11 jars\"", "__doc__ = \"\"\"Place-holder for the old SCons.Options module hierarchy\n\nThis is for backwards compatibility. The new equivalent is the Variables/\nclass hierarchy. These will have deprecation warnings added (some d...
# # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # """SCons.Warnings This file implements the warnings framework for SCons. """ __revision__ = "src/engine/SCons/Warnings.py 4720 2010/03/24 03:14:11 jars" import string import sys import SCons.Errors class Warning(SCons.Errors.UserError): pass class MandatoryWarning(Warning): pass class FutureDeprecatedWarning(Warning): pass class DeprecatedWarning(Warning): pass class MandatoryDeprecatedWarning(MandatoryWarning): pass # NOTE: If you add a new warning class, add it to the man page, too! class CacheWriteErrorWarning(Warning): pass class CorruptSConsignWarning(Warning): pass class DependencyWarning(Warning): pass class DeprecatedCopyWarning(DeprecatedWarning): pass class DeprecatedOptionsWarning(DeprecatedWarning): pass class DeprecatedSourceSignaturesWarning(DeprecatedWarning): pass class DeprecatedTargetSignaturesWarning(DeprecatedWarning): pass class DuplicateEnvironmentWarning(Warning): pass class FutureReservedVariableWarning(Warning): pass class LinkWarning(Warning): pass class MisleadingKeywordsWarning(Warning): pass class MissingSConscriptWarning(Warning): pass class NoMD5ModuleWarning(Warning): pass class NoMetaclassSupportWarning(Warning): pass class NoObjectCountWarning(Warning): pass class NoParallelSupportWarning(Warning): pass class PythonVersionWarning(DeprecatedWarning): pass class ReservedVariableWarning(Warning): pass class StackSizeWarning(Warning): pass class TaskmasterNeedsExecuteWarning(FutureDeprecatedWarning): pass class VisualCMissingWarning(Warning): pass # Used when MSVC_VERSION and MSVS_VERSION do not point to the # same version (MSVS_VERSION is deprecated) class VisualVersionMismatch(Warning): pass class VisualStudioMissingWarning(Warning): pass class FortranCxxMixWarning(LinkWarning): pass _warningAsException = 0 # The below is a list of 2-tuples. The first element is a class object. # The second element is true if that class is enabled, false if it is disabled. _enabled = [] _warningOut = None def suppressWarningClass(clazz): """Suppresses all warnings that are of type clazz or derived from clazz.""" _enabled.insert(0, (clazz, 0)) def enableWarningClass(clazz): """Suppresses all warnings that are of type clazz or derived from clazz.""" _enabled.insert(0, (clazz, 1)) def warningAsException(flag=1): """Turn warnings into exceptions. Returns the old value of the flag.""" global _warningAsException old = _warningAsException _warningAsException = flag return old def warn(clazz, *args): global _enabled, _warningAsException, _warningOut warning = clazz(args) for clazz, flag in _enabled: if isinstance(warning, clazz): if flag: if _warningAsException: raise warning if _warningOut: _warningOut(warning) break def process_warn_strings(arguments): """Process string specifications of enabling/disabling warnings, as passed to the --warn option or the SetOption('warn') function. An argument to this option should be of the form <warning-class> or no-<warning-class>. The warning class is munged in order to get an actual class name from the classes above, which we need to pass to the {enable,disable}WarningClass() functions. The supplied <warning-class> is split on hyphens, each element is capitalized, then smushed back together. Then the string "Warning" is appended to get the class name. For example, 'deprecated' will enable the DeprecatedWarning class. 'no-dependency' will disable the .DependencyWarning class. As a special case, --warn=all and --warn=no-all will enable or disable (respectively) the base Warning class of all warnings. """ def _capitalize(s): if s[:5] == "scons": return "SCons" + s[5:] else: return string.capitalize(s) for arg in arguments: elems = string.split(string.lower(arg), '-') enable = 1 if elems[0] == 'no': enable = 0 del elems[0] if len(elems) == 1 and elems[0] == 'all': class_name = "Warning" else: class_name = string.join(map(_capitalize, elems), '') + "Warning" try: clazz = globals()[class_name] except KeyError: sys.stderr.write("No warning type: '%s'\n" % arg) else: if enable: enableWarningClass(clazz) elif issubclass(clazz, MandatoryDeprecatedWarning): fmt = "Can not disable mandataory warning: '%s'\n" sys.stderr.write(fmt % arg) else: suppressWarningClass(clazz) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.114, 0.0219, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.1316, 0.0044, 0, 0.66, 0.0244, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.1404, 0.0044, 0, 0.66, ...
[ "\"\"\"SCons.Warnings\n\nThis file implements the warnings framework for SCons.\n\n\"\"\"", "__revision__ = \"src/engine/SCons/Warnings.py 4720 2010/03/24 03:14:11 jars\"", "import string", "import sys", "import SCons.Errors", "class Warning(SCons.Errors.UserError):\n pass", "class MandatoryWarning(W...
"""SCons.exitfuncs Register functions which are executed when SCons exits for any reason. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/exitfuncs.py 4720 2010/03/24 03:14:11 jars" _exithandlers = [] def _run_exitfuncs(): """run any registered exit functions _exithandlers is traversed in reverse order so functions are executed last in, first out. """ while _exithandlers: func, targs, kargs = _exithandlers.pop() apply(func, targs, kargs) def register(func, *targs, **kargs): """register a function to be executed upon normal program termination func - function to be called at exit targs - optional arguments to pass to func kargs - optional keyword arguments to pass to func """ _exithandlers.append((func, targs, kargs)) import sys try: x = sys.exitfunc # if x isn't our own exit func executive, assume it's another # registered exit function - append it to our list... if x != _run_exitfuncs: register(x) except AttributeError: pass # make our exit function get run by python when it exits: sys.exitfunc = _run_exitfuncs del sys # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.039, 0.0649, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.3896, 0.013, 0, 0.66, 0.1429, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.4416, 0.013, 0, 0.66, ...
[ "\"\"\"SCons.exitfuncs\n\nRegister functions which are executed when SCons exits for any reason.\n\n\"\"\"", "__revision__ = \"src/engine/SCons/exitfuncs.py 4720 2010/03/24 03:14:11 jars\"", "_exithandlers = []", "def _run_exitfuncs():\n \"\"\"run any registered exit functions\n\n _exithandlers is trave...
"""engine.SCons.Variables.BoolVariable This file defines the option type for SCons implementing true/false values. Usage example: opts = Variables() opts.Add(BoolVariable('embedded', 'build for an embedded system', 0)) ... if env['embedded'] == 1: ... """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Variables/BoolVariable.py 4720 2010/03/24 03:14:11 jars" __all__ = ['BoolVariable',] import string import SCons.Errors __true_strings = ('y', 'yes', 'true', 't', '1', 'on' , 'all' ) __false_strings = ('n', 'no', 'false', 'f', '0', 'off', 'none') def _text2bool(val): """ Converts strings to True/False depending on the 'truth' expressed by the string. If the string can't be converted, the original value will be returned. See '__true_strings' and '__false_strings' for values considered 'true' or 'false respectivly. This is usable as 'converter' for SCons' Variables. """ lval = string.lower(val) if lval in __true_strings: return True if lval in __false_strings: return False raise ValueError("Invalid value for boolean option: %s" % val) def _validator(key, val, env): """ Validates the given value to be either '0' or '1'. This is usable as 'validator' for SCons' Variables. """ if not env[key] in (True, False): raise SCons.Errors.UserError( 'Invalid value for boolean option %s: %s' % (key, env[key])) def BoolVariable(key, help, default): """ The input parameters describe a boolen option, thus they are returned with the correct converter and validator appended. The 'help' text will by appended by '(yes|no) to show the valid valued. The result is usable for input to opts.Add(). """ return (key, '%s (yes|no)' % help, default, _validator, _text2bool) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0714, 0.1319, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.4066, 0.011, 0, 0.66, 0.1111, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.4286, 0.011, 0, 0.66, ...
[ "\"\"\"engine.SCons.Variables.BoolVariable\n\nThis file defines the option type for SCons implementing true/false values.\n\nUsage example:\n\n opts = Variables()\n opts.Add(BoolVariable('embedded', 'build for an embedded system', 0))", "__revision__ = \"src/engine/SCons/Variables/BoolVariable.py 4720 2010/03/2...
"""engine.SCons.Variables.PackageVariable This file defines the option type for SCons implementing 'package activation'. To be used whenever a 'package' may be enabled/disabled and the package path may be specified. Usage example: Examples: x11=no (disables X11 support) x11=yes (will search for the package installation dir) x11=/usr/local/X11 (will check this path for existance) To replace autoconf's --with-xxx=yyy opts = Variables() opts.Add(PackageVariable('x11', 'use X11 installed here (yes = search some places', 'yes')) ... if env['x11'] == True: dir = ... search X11 in some standard places ... env['x11'] = dir if env['x11']: ... build with x11 ... """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Variables/PackageVariable.py 4720 2010/03/24 03:14:11 jars" __all__ = ['PackageVariable',] import string import SCons.Errors __enable_strings = ('1', 'yes', 'true', 'on', 'enable', 'search') __disable_strings = ('0', 'no', 'false', 'off', 'disable') def _converter(val): """ """ lval = string.lower(val) if lval in __enable_strings: return True if lval in __disable_strings: return False #raise ValueError("Invalid value for boolean option: %s" % val) return val def _validator(key, val, env, searchfunc): # NB: searchfunc is currenty undocumented and unsupported """ """ # todo: write validator, check for path import os if env[key] is True: if searchfunc: env[key] = searchfunc(key, val) elif env[key] and not os.path.exists(val): raise SCons.Errors.UserError( 'Path does not exist for option %s: %s' % (key, val)) def PackageVariable(key, help, default, searchfunc=None): # NB: searchfunc is currenty undocumented and unsupported """ The input parameters describe a 'package list' option, thus they are returned with the correct converter and validator appended. The result is usable for input to opts.Add() . A 'package list' option may either be 'all', 'none' or a list of package names (seperated by space). """ help = string.join( (help, '( yes | no | /path/to/%s )' % key), '\n ') return (key, help, default, lambda k, v, e, f=searchfunc: _validator(k,v,e,f), _converter) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.133, 0.2569, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.4862, 0.0092, 0, 0.66, 0.1111, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.5046, 0.0092, 0, 0.66,...
[ "\"\"\"engine.SCons.Variables.PackageVariable\n\nThis file defines the option type for SCons implementing 'package\nactivation'.\n\nTo be used whenever a 'package' may be enabled/disabled and the\npackage path may be specified.", "__revision__ = \"src/engine/SCons/Variables/PackageVariable.py 4720 2010/03/24 03:1...
"""engine.SCons.Variables.EnumVariable This file defines the option type for SCons allowing only specified input-values. Usage example: opts = Variables() opts.Add(EnumVariable('debug', 'debug output and symbols', 'no', allowed_values=('yes', 'no', 'full'), map={}, ignorecase=2)) ... if env['debug'] == 'full': ... """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Variables/EnumVariable.py 4720 2010/03/24 03:14:11 jars" __all__ = ['EnumVariable',] import string import SCons.Errors def _validator(key, val, env, vals): if not val in vals: raise SCons.Errors.UserError( 'Invalid value for option %s: %s' % (key, val)) def EnumVariable(key, help, default, allowed_values, map={}, ignorecase=0): """ The input parameters describe a option with only certain values allowed. They are returned with an appropriate converter and validator appended. The result is usable for input to Variables.Add(). 'key' and 'default' are the values to be passed on to Variables.Add(). 'help' will be appended by the allowed values automatically 'allowed_values' is a list of strings, which are allowed as values for this option. The 'map'-dictionary may be used for converting the input value into canonical values (eg. for aliases). 'ignorecase' defines the behaviour of the validator: If ignorecase == 0, the validator/converter are case-sensitive. If ignorecase == 1, the validator/converter are case-insensitive. If ignorecase == 2, the validator/converter is case-insensitive and the converted value will always be lower-case. The 'validator' tests whether the value is in the list of allowed values. The 'converter' converts input values according to the given 'map'-dictionary (unmapped input values are returned unchanged). """ help = '%s (%s)' % (help, string.join(allowed_values, '|')) # define validator if ignorecase >= 1: validator = lambda key, val, env, vals=allowed_values: \ _validator(key, string.lower(val), env, vals) else: validator = lambda key, val, env, vals=allowed_values: \ _validator(key, val, env, vals) # define converter if ignorecase == 2: converter = lambda val, map=map: \ string.lower(map.get(string.lower(val), val)) elif ignorecase == 1: converter = lambda val, map=map: \ map.get(string.lower(val), val) else: converter = lambda val, map=map: \ map.get(val, val) return (key, help, default, validator, converter) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0748, 0.1402, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.3738, 0.0093, 0, 0.66, 0.1667, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.3925, 0.0093, 0, 0.66...
[ "\"\"\"engine.SCons.Variables.EnumVariable\n\nThis file defines the option type for SCons allowing only specified\ninput-values.\n\nUsage example:\n\n opts = Variables()", "__revision__ = \"src/engine/SCons/Variables/EnumVariable.py 4720 2010/03/24 03:14:11 jars\"", "__all__ = ['EnumVariable',]", "import str...
"""SCons.Variables.PathVariable This file defines an option type for SCons implementing path settings. To be used whenever a a user-specified path override should be allowed. Arguments to PathVariable are: option-name = name of this option on the command line (e.g. "prefix") option-help = help string for option option-dflt = default value for this option validator = [optional] validator for option value. Predefined validators are: PathAccept -- accepts any path setting; no validation PathIsDir -- path must be an existing directory PathIsDirCreate -- path must be a dir; will create PathIsFile -- path must be a file PathExists -- path must exist (any type) [default] The validator is a function that is called and which should return True or False to indicate if the path is valid. The arguments to the validator function are: (key, val, env). The key is the name of the option, the val is the path specified for the option, and the env is the env to which the Otions have been added. Usage example: Examples: prefix=/usr/local opts = Variables() opts = Variables() opts.Add(PathVariable('qtdir', 'where the root of Qt is installed', qtdir, PathIsDir)) opts.Add(PathVariable('qt_includes', 'where the Qt includes are installed', '$qtdir/includes', PathIsDirCreate)) opts.Add(PathVariable('qt_libraries', 'where the Qt library is installed', '$qtdir/lib')) """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Variables/PathVariable.py 4720 2010/03/24 03:14:11 jars" __all__ = ['PathVariable',] import os import os.path import SCons.Errors class _PathVariableClass: def PathAccept(self, key, val, env): """Accepts any path, no checking done.""" pass def PathIsDir(self, key, val, env): """Validator to check if Path is a directory.""" if not os.path.isdir(val): if os.path.isfile(val): m = 'Directory path for option %s is a file: %s' else: m = 'Directory path for option %s does not exist: %s' raise SCons.Errors.UserError(m % (key, val)) def PathIsDirCreate(self, key, val, env): """Validator to check if Path is a directory, creating it if it does not exist.""" if os.path.isfile(val): m = 'Path for option %s is a file, not a directory: %s' raise SCons.Errors.UserError(m % (key, val)) if not os.path.isdir(val): os.makedirs(val) def PathIsFile(self, key, val, env): """validator to check if Path is a file""" if not os.path.isfile(val): if os.path.isdir(val): m = 'File path for option %s is a directory: %s' else: m = 'File path for option %s does not exist: %s' raise SCons.Errors.UserError(m % (key, val)) def PathExists(self, key, val, env): """validator to check if Path exists""" if not os.path.exists(val): m = 'Path for option %s does not exist: %s' raise SCons.Errors.UserError(m % (key, val)) def __call__(self, key, help, default, validator=None): # NB: searchfunc is currenty undocumented and unsupported """ The input parameters describe a 'path list' option, thus they are returned with the correct converter and validator appended. The result is usable for input to opts.Add() . The 'default' option specifies the default path to use if the user does not specify an override with this option. validator is a validator, see this file for examples """ if validator is None: validator = self.PathExists if SCons.Util.is_List(key) or SCons.Util.is_Tuple(key): return (key, '%s ( /path/to/%s )' % (help, key[0]), default, validator, None) else: return (key, '%s ( /path/to/%s )' % (help, key), default, validator, None) PathVariable = _PathVariableClass() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.1599, 0.3129, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.483, 0.0068, 0, 0.66, 0.1429, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.4966, 0.0068, 0, 0.66,...
[ "\"\"\"SCons.Variables.PathVariable\n\nThis file defines an option type for SCons implementing path settings.\n\nTo be used whenever a a user-specified path override should be allowed.\n\nArguments to PathVariable are:\n option-name = name of this option on the command line (e.g. \"prefix\")", "__revision__ = \...
"""engine.SCons.Variables.ListVariable This file defines the option type for SCons implementing 'lists'. A 'list' option may either be 'all', 'none' or a list of names separated by comma. After the option has been processed, the option value holds either the named list elements, all list elemens or no list elements at all. Usage example: list_of_libs = Split('x11 gl qt ical') opts = Variables() opts.Add(ListVariable('shared', 'libraries to build as shared libraries', 'all', elems = list_of_libs)) ... for lib in list_of_libs: if lib in env['shared']: env.SharedObject(...) else: env.Object(...) """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Variables/ListVariable.py 4720 2010/03/24 03:14:11 jars" # Know Bug: This should behave like a Set-Type, but does not really, # since elements can occur twice. __all__ = ['ListVariable',] import string import UserList import SCons.Util class _ListVariable(UserList.UserList): def __init__(self, initlist=[], allowedElems=[]): UserList.UserList.__init__(self, filter(None, initlist)) self.allowedElems = allowedElems[:] self.allowedElems.sort() def __cmp__(self, other): raise NotImplementedError def __eq__(self, other): raise NotImplementedError def __ge__(self, other): raise NotImplementedError def __gt__(self, other): raise NotImplementedError def __le__(self, other): raise NotImplementedError def __lt__(self, other): raise NotImplementedError def __str__(self): if len(self) == 0: return 'none' self.data.sort() if self.data == self.allowedElems: return 'all' else: return string.join(self, ',') def prepare_to_store(self): return self.__str__() def _converter(val, allowedElems, mapdict): """ """ if val == 'none': val = [] elif val == 'all': val = allowedElems else: val = filter(None, string.split(val, ',')) val = map(lambda v, m=mapdict: m.get(v, v), val) notAllowed = filter(lambda v, aE=allowedElems: not v in aE, val) if notAllowed: raise ValueError("Invalid value(s) for option: %s" % string.join(notAllowed, ',')) return _ListVariable(val, allowedElems) ## def _validator(key, val, env): ## """ ## """ ## # todo: write validater for pgk list ## return 1 def ListVariable(key, help, default, names, map={}): """ The input parameters describe a 'package list' option, thus they are returned with the correct converter and validater appended. The result is usable for input to opts.Add() . A 'package list' option may either be 'all', 'none' or a list of package names (separated by space). """ names_str = 'allowed names: %s' % string.join(names, ' ') if SCons.Util.is_List(default): default = string.join(default, ',') help = string.join( (help, '(all|none|comma-separated list of names)', names_str), '\n ') return (key, help, default, None, #_validator, lambda val, elems=names, m=map: _converter(val, elems, m)) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0935, 0.1799, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.3597, 0.0072, 0, 0.66, 0.125, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.3957, 0.0072, 0, 0.66,...
[ "\"\"\"engine.SCons.Variables.ListVariable\n\nThis file defines the option type for SCons implementing 'lists'.\n\nA 'list' option may either be 'all', 'none' or a list of names\nseparated by comma. After the option has been processed, the option\nvalue holds either the named list elements, all list elemens or no\n...
"""SCons.Debug Code for debugging SCons internal things. Not everything here is guaranteed to work all the way back to Python 1.5.2, and shouldn't be needed by most users. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Debug.py 4720 2010/03/24 03:14:11 jars" import os import string import sys import time # Recipe 14.10 from the Python Cookbook. try: import weakref except ImportError: def logInstanceCreation(instance, name=None): pass else: def logInstanceCreation(instance, name=None): if name is None: name = instance.__class__.__name__ if not tracked_classes.has_key(name): tracked_classes[name] = [] tracked_classes[name].append(weakref.ref(instance)) tracked_classes = {} def string_to_classes(s): if s == '*': c = tracked_classes.keys() c.sort() return c else: return string.split(s) def fetchLoggedInstances(classes="*"): classnames = string_to_classes(classes) return map(lambda cn: (cn, len(tracked_classes[cn])), classnames) def countLoggedInstances(classes, file=sys.stdout): for classname in string_to_classes(classes): file.write("%s: %d\n" % (classname, len(tracked_classes[classname]))) def listLoggedInstances(classes, file=sys.stdout): for classname in string_to_classes(classes): file.write('\n%s:\n' % classname) for ref in tracked_classes[classname]: obj = ref() if obj is not None: file.write(' %s\n' % repr(obj)) def dumpLoggedInstances(classes, file=sys.stdout): for classname in string_to_classes(classes): file.write('\n%s:\n' % classname) for ref in tracked_classes[classname]: obj = ref() if obj is not None: file.write(' %s:\n' % obj) for key, value in obj.__dict__.items(): file.write(' %20s : %s\n' % (key, value)) if sys.platform[:5] == "linux": # Linux doesn't actually support memory usage stats from getrusage(). def memory(): mstr = open('/proc/self/stat').read() mstr = string.split(mstr)[22] return int(mstr) else: try: import resource except ImportError: try: import win32process import win32api except ImportError: def memory(): return 0 else: def memory(): process_handle = win32api.GetCurrentProcess() memory_info = win32process.GetProcessMemoryInfo( process_handle ) return memory_info['PeakWorkingSetSize'] else: def memory(): res = resource.getrusage(resource.RUSAGE_SELF) return res[4] # returns caller's stack def caller_stack(*backlist): import traceback if not backlist: backlist = [0] result = [] for back in backlist: tb = traceback.extract_stack(limit=3+back) key = tb[0][:3] result.append('%s:%d(%s)' % func_shorten(key)) return result caller_bases = {} caller_dicts = {} # trace a caller's stack def caller_trace(back=0): import traceback tb = traceback.extract_stack(limit=3+back) tb.reverse() callee = tb[1][:3] caller_bases[callee] = caller_bases.get(callee, 0) + 1 for caller in tb[2:]: caller = callee + caller[:3] try: entry = caller_dicts[callee] except KeyError: caller_dicts[callee] = entry = {} entry[caller] = entry.get(caller, 0) + 1 callee = caller # print a single caller and its callers, if any def _dump_one_caller(key, file, level=0): l = [] for c,v in caller_dicts[key].items(): l.append((-v,c)) l.sort() leader = ' '*level for v,c in l: file.write("%s %6d %s:%d(%s)\n" % ((leader,-v) + func_shorten(c[-3:]))) if caller_dicts.has_key(c): _dump_one_caller(c, file, level+1) # print each call tree def dump_caller_counts(file=sys.stdout): keys = caller_bases.keys() keys.sort() for k in keys: file.write("Callers of %s:%d(%s), %d calls:\n" % (func_shorten(k) + (caller_bases[k],))) _dump_one_caller(k, file) shorten_list = [ ( '/scons/SCons/', 1), ( '/src/engine/SCons/', 1), ( '/usr/lib/python', 0), ] if os.sep != '/': def platformize(t): return (string.replace(t[0], '/', os.sep), t[1]) shorten_list = map(platformize, shorten_list) del platformize def func_shorten(func_tuple): f = func_tuple[0] for t in shorten_list: i = string.find(f, t[0]) if i >= 0: if t[1]: i = i + len(t[0]) return (f[i:],)+func_tuple[1:] return func_tuple TraceFP = {} if sys.platform == 'win32': TraceDefault = 'con' else: TraceDefault = '/dev/tty' TimeStampDefault = None StartTime = time.time() PreviousTime = StartTime def Trace(msg, file=None, mode='w', tstamp=None): """Write a trace message to a file. Whenever a file is specified, it becomes the default for the next call to Trace().""" global TraceDefault global TimeStampDefault global PreviousTime if file is None: file = TraceDefault else: TraceDefault = file if tstamp is None: tstamp = TimeStampDefault else: TimeStampDefault = tstamp try: fp = TraceFP[file] except KeyError: try: fp = TraceFP[file] = open(file, mode) except TypeError: # Assume we were passed an open file pointer. fp = file if tstamp: now = time.time() fp.write('%8.4f %8.4f: ' % (now - StartTime, now - PreviousTime)) PreviousTime = now fp.write(msg) fp.flush() # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0169, 0.0295, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.135, 0.0042, 0, 0.66, 0.0357, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.1435, 0.0042, 0, 0.66, ...
[ "\"\"\"SCons.Debug\n\nCode for debugging SCons internal things. Not everything here is\nguaranteed to work all the way back to Python 1.5.2, and shouldn't be\nneeded by most users.\n\n\"\"\"", "__revision__ = \"src/engine/SCons/Debug.py 4720 2010/03/24 03:14:11 jars\"", "import os", "import string", "impor...
"""SCons The main package for the SCons software construction utility. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/__init__.py 4720 2010/03/24 03:14:11 jars" __version__ = "1.3.0" __build__ = "r4720" __buildsys__ = "jars-desktop" __date__ = "2010/03/24 03:14:11" __developer__ = "jars" # make sure compatibility is always in place import SCons.compat # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0612, 0.102, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.6122, 0.0204, 0, 0.66, 0.1429, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.6531, 0.0204, 0, 0.66,...
[ "\"\"\"SCons\n\nThe main package for the SCons software construction utility.\n\n\"\"\"", "__revision__ = \"src/engine/SCons/__init__.py 4720 2010/03/24 03:14:11 jars\"", "__version__ = \"1.3.0\"", "__build__ = \"r4720\"", "__buildsys__ = \"jars-desktop\"", "__date__ = \"2010/03/24 03:14:11\"", "__devel...
"""engine.SCons.Platform.darwin Platform-specific initialization for Mac OS X systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Platform/darwin.py 4720 2010/03/24 03:14:11 jars" import posix def generate(env): posix.generate(env) env['SHLIBSUFFIX'] = '.dylib' env['ENV']['PATH'] = env['ENV']['PATH'] + ':/sw/bin' # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0978, 0.1739, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.7174, 0.0217, 0, 0.66, 0.3333, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.7609, 0.0217, 0, 0.66,...
[ "\"\"\"engine.SCons.Platform.darwin\n\nPlatform-specific initialization for Mac OS X systems.\n\nThere normally shouldn't be any need to import this module directly. It\nwill usually be imported through the generic SCons.Platform.Platform()\nselection method.\n\"\"\"", "__revision__ = \"src/engine/SCons/Platform...
"""SCons.Platform.os2 Platform-specific initialization for OS/2 systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Platform/os2.py 4720 2010/03/24 03:14:11 jars" import win32 def generate(env): if not env.has_key('ENV'): env['ENV'] = {} env['OBJPREFIX'] = '' env['OBJSUFFIX'] = '.obj' env['SHOBJPREFIX'] = '$OBJPREFIX' env['SHOBJSUFFIX'] = '$OBJSUFFIX' env['PROGPREFIX'] = '' env['PROGSUFFIX'] = '.exe' env['LIBPREFIX'] = '' env['LIBSUFFIX'] = '.lib' env['SHLIBPREFIX'] = '' env['SHLIBSUFFIX'] = '.dll' env['LIBPREFIXES'] = '$LIBPREFIX' env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ] env['HOST_OS'] = 'os2' env['HOST_ARCH'] = win32.get_architecture().arch # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0776, 0.1379, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.569, 0.0172, 0, 0.66, 0.3333, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.5862, 0.0172, 0, 0.66, ...
[ "\"\"\"SCons.Platform.os2\n\nPlatform-specific initialization for OS/2 systems.\n\nThere normally shouldn't be any need to import this module directly. It\nwill usually be imported through the generic SCons.Platform.Platform()\nselection method.\n\"\"\"", "__revision__ = \"src/engine/SCons/Platform/os2.py 4720 2...
"""engine.SCons.Platform.aix Platform-specific initialization for IBM AIX systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Platform/aix.py 4720 2010/03/24 03:14:11 jars" import os import string import posix def get_xlc(env, xlc=None, xlc_r=None, packages=[]): # Use the AIX package installer tool lslpp to figure out where a # given xl* compiler is installed and what version it is. xlcPath = None xlcVersion = None if xlc is None: xlc = env.get('CC', 'xlc') if xlc_r is None: xlc_r = xlc + '_r' for package in packages: cmd = "lslpp -fc " + package + " 2>/dev/null | egrep '" + xlc + "([^-_a-zA-Z0-9].*)?$'" line = os.popen(cmd).readline() if line: v, p = string.split(line, ':')[1:3] xlcVersion = string.split(v)[1] xlcPath = string.split(p)[0] xlcPath = xlcPath[:xlcPath.rindex('/')] break return (xlcPath, xlc, xlc_r, xlcVersion) def generate(env): posix.generate(env) #Based on AIX 5.2: ARG_MAX=24576 - 3000 for environment expansion env['MAXLINELENGTH'] = 21576 # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0643, 0.1143, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.4714, 0.0143, 0, 0.66, 0.1667, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.5, 0.0143, 0, 0.66, ...
[ "\"\"\"engine.SCons.Platform.aix\n\nPlatform-specific initialization for IBM AIX systems.\n\nThere normally shouldn't be any need to import this module directly. It\nwill usually be imported through the generic SCons.Platform.Platform()\nselection method.\n\"\"\"", "__revision__ = \"src/engine/SCons/Platform/aix...
"""SCons.Platform.cygwin Platform-specific initialization for Cygwin systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Platform/cygwin.py 4720 2010/03/24 03:14:11 jars" import posix from SCons.Platform import TempFileMunge def generate(env): posix.generate(env) env['PROGPREFIX'] = '' env['PROGSUFFIX'] = '.exe' env['SHLIBPREFIX'] = '' env['SHLIBSUFFIX'] = '.dll' env['LIBPREFIXES'] = [ '$LIBPREFIX', '$SHLIBPREFIX' ] env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ] env['TEMPFILE'] = TempFileMunge env['TEMPFILEPREFIX'] = '@' env['MAXLINELENGTH'] = 2048 # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0818, 0.1455, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.6, 0.0182, 0, 0.66, 0.25, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.6364, 0.0182, 0, 0.66, ...
[ "\"\"\"SCons.Platform.cygwin\n\nPlatform-specific initialization for Cygwin systems.\n\nThere normally shouldn't be any need to import this module directly. It\nwill usually be imported through the generic SCons.Platform.Platform()\nselection method.\n\"\"\"", "__revision__ = \"src/engine/SCons/Platform/cygwin.p...
"""SCons.Platform.irix Platform-specific initialization for SGI IRIX systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Platform/irix.py 4720 2010/03/24 03:14:11 jars" import posix def generate(env): posix.generate(env) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.1023, 0.1818, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.75, 0.0227, 0, 0.66, 0.3333, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.7955, 0.0227, 0, 0.66, ...
[ "\"\"\"SCons.Platform.irix\n\nPlatform-specific initialization for SGI IRIX systems.\n\nThere normally shouldn't be any need to import this module directly. It\nwill usually be imported through the generic SCons.Platform.Platform()\nselection method.\n\"\"\"", "__revision__ = \"src/engine/SCons/Platform/irix.py ...
"""engine.SCons.Platform.hpux Platform-specific initialization for HP-UX systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Platform/hpux.py 4720 2010/03/24 03:14:11 jars" import posix def generate(env): posix.generate(env) #Based on HP-UX11i: ARG_MAX=2048000 - 3000 for environment expansion env['MAXLINELENGTH'] = 2045000 # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.0978, 0.1739, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.7174, 0.0217, 0, 0.66, 0.3333, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.7609, 0.0217, 0, 0.66,...
[ "\"\"\"engine.SCons.Platform.hpux\n\nPlatform-specific initialization for HP-UX systems.\n\nThere normally shouldn't be any need to import this module directly. It\nwill usually be imported through the generic SCons.Platform.Platform()\nselection method.\n\"\"\"", "__revision__ = \"src/engine/SCons/Platform/hpux...
"""engine.SCons.Platform.sunos Platform-specific initialization for Sun systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Platform/sunos.py 4720 2010/03/24 03:14:11 jars" import posix def generate(env): posix.generate(env) # Based on sunSparc 8:32bit # ARG_MAX=1048320 - 3000 for environment expansion env['MAXLINELENGTH'] = 1045320 env['PKGINFO'] = 'pkginfo' env['PKGCHK'] = '/usr/sbin/pkgchk' env['ENV']['PATH'] = env['ENV']['PATH'] + ':/opt/SUNWspro/bin:/usr/ccs/bin' # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 8, 0, 0.09, 0.16, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.66, 0.02, 0, 0.66, 0.3333, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.7, 0.02, 0, 0.66, 0.6667, ...
[ "\"\"\"engine.SCons.Platform.sunos\n\nPlatform-specific initialization for Sun systems.\n\nThere normally shouldn't be any need to import this module directly. It\nwill usually be imported through the generic SCons.Platform.Platform()\nselection method.\n\"\"\"", "__revision__ = \"src/engine/SCons/Platform/sunos...
# # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "src/engine/SCons/Memoize.py 4720 2010/03/24 03:14:11 jars" __doc__ = """Memoizer A metaclass implementation to count hits and misses of the computed values that various methods cache in memory. Use of this modules assumes that wrapped methods be coded to cache their values in a consistent way. Here is an example of wrapping a method that returns a computed value, with no input parameters: memoizer_counters = [] # Memoization memoizer_counters.append(SCons.Memoize.CountValue('foo')) # Memoization def foo(self): try: # Memoization return self._memo['foo'] # Memoization except KeyError: # Memoization pass # Memoization result = self.compute_foo_value() self._memo['foo'] = result # Memoization return result Here is an example of wrapping a method that will return different values based on one or more input arguments: def _bar_key(self, argument): # Memoization return argument # Memoization memoizer_counters.append(SCons.Memoize.CountDict('bar', _bar_key)) # Memoization def bar(self, argument): memo_key = argument # Memoization try: # Memoization memo_dict = self._memo['bar'] # Memoization except KeyError: # Memoization memo_dict = {} # Memoization self._memo['dict'] = memo_dict # Memoization else: # Memoization try: # Memoization return memo_dict[memo_key] # Memoization except KeyError: # Memoization pass # Memoization result = self.compute_bar_value(argument) memo_dict[memo_key] = result # Memoization return result At one point we avoided replicating this sort of logic in all the methods by putting it right into this module, but we've moved away from that at present (see the "Historical Note," below.). Deciding what to cache is tricky, because different configurations can have radically different performance tradeoffs, and because the tradeoffs involved are often so non-obvious. Consequently, deciding whether or not to cache a given method will likely be more of an art than a science, but should still be based on available data from this module. Here are some VERY GENERAL guidelines about deciding whether or not to cache return values from a method that's being called a lot: -- The first question to ask is, "Can we change the calling code so this method isn't called so often?" Sometimes this can be done by changing the algorithm. Sometimes the *caller* should be memoized, not the method you're looking at. -- The memoized function should be timed with multiple configurations to make sure it doesn't inadvertently slow down some other configuration. -- When memoizing values based on a dictionary key composed of input arguments, you don't need to use all of the arguments if some of them don't affect the return values. Historical Note: The initial Memoizer implementation actually handled the caching of values for the wrapped methods, based on a set of generic algorithms for computing hashable values based on the method's arguments. This collected caching logic nicely, but had two drawbacks: Running arguments through a generic key-conversion mechanism is slower (and less flexible) than just coding these things directly. Since the methods that need memoized values are generally performance-critical, slowing them down in order to collect the logic isn't the right tradeoff. Use of the memoizer really obscured what was being called, because all the memoized methods were wrapped with re-used generic methods. This made it more difficult, for example, to use the Python profiler to figure out how to optimize the underlying methods. """ import new # A flag controlling whether or not we actually use memoization. use_memoizer = None CounterList = [] class Counter: """ Base class for counting memoization hits and misses. We expect that the metaclass initialization will have filled in the .name attribute that represents the name of the function being counted. """ def __init__(self, method_name): """ """ self.method_name = method_name self.hit = 0 self.miss = 0 CounterList.append(self) def display(self): fmt = " %7d hits %7d misses %s()" print fmt % (self.hit, self.miss, self.name) def __cmp__(self, other): try: return cmp(self.name, other.name) except AttributeError: return 0 class CountValue(Counter): """ A counter class for simple, atomic memoized values. A CountValue object should be instantiated in a class for each of the class's methods that memoizes its return value by simply storing the return value in its _memo dictionary. We expect that the metaclass initialization will fill in the .underlying_method attribute with the method that we're wrapping. We then call the underlying_method method after counting whether its memoized value has already been set (a hit) or not (a miss). """ def __call__(self, *args, **kw): obj = args[0] if obj._memo.has_key(self.method_name): self.hit = self.hit + 1 else: self.miss = self.miss + 1 return apply(self.underlying_method, args, kw) class CountDict(Counter): """ A counter class for memoized values stored in a dictionary, with keys based on the method's input arguments. A CountDict object is instantiated in a class for each of the class's methods that memoizes its return value in a dictionary, indexed by some key that can be computed from one or more of its input arguments. We expect that the metaclass initialization will fill in the .underlying_method attribute with the method that we're wrapping. We then call the underlying_method method after counting whether the computed key value is already present in the memoization dictionary (a hit) or not (a miss). """ def __init__(self, method_name, keymaker): """ """ Counter.__init__(self, method_name) self.keymaker = keymaker def __call__(self, *args, **kw): obj = args[0] try: memo_dict = obj._memo[self.method_name] except KeyError: self.miss = self.miss + 1 else: key = apply(self.keymaker, args, kw) if memo_dict.has_key(key): self.hit = self.hit + 1 else: self.miss = self.miss + 1 return apply(self.underlying_method, args, kw) class Memoizer: """Object which performs caching of method calls for its 'primary' instance.""" def __init__(self): pass # Find out if we support metaclasses (Python 2.2 and later). class M: def __init__(cls, name, bases, cls_dict): cls.use_metaclass = 1 def fake_method(self): pass new.instancemethod(fake_method, None, cls) try: class A: __metaclass__ = M use_metaclass = A.use_metaclass except AttributeError: use_metaclass = None reason = 'no metaclasses' except TypeError: use_metaclass = None reason = 'new.instancemethod() bug' else: del A del M if not use_metaclass: def Dump(title): pass try: class Memoized_Metaclass(type): # Just a place-holder so pre-metaclass Python versions don't # have to have special code for the Memoized classes. pass except TypeError: class Memoized_Metaclass: # A place-holder so pre-metaclass Python versions don't # have to have special code for the Memoized classes. pass def EnableMemoization(): import SCons.Warnings msg = 'memoization is not supported in this version of Python (%s)' raise SCons.Warnings.NoMetaclassSupportWarning, msg % reason else: def Dump(title=None): if title: print title CounterList.sort() for counter in CounterList: counter.display() class Memoized_Metaclass(type): def __init__(cls, name, bases, cls_dict): super(Memoized_Metaclass, cls).__init__(name, bases, cls_dict) for counter in cls_dict.get('memoizer_counters', []): method_name = counter.method_name counter.name = cls.__name__ + '.' + method_name counter.underlying_method = cls_dict[method_name] replacement_method = new.instancemethod(counter, None, cls) setattr(cls, method_name, replacement_method) def EnableMemoization(): global use_memoizer use_memoizer = 1 # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
[ [ 14, 0, 0.0825, 0.0034, 0, 0.66, 0, 809, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.2509, 0.3265, 0, 0.66, 0.0909, 155, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.4192, 0.0034, 0, 0....
[ "__revision__ = \"src/engine/SCons/Memoize.py 4720 2010/03/24 03:14:11 jars\"", "__doc__ = \"\"\"Memoizer\n\nA metaclass implementation to count hits and misses of the computed\nvalues that various methods cache in memory.\n\nUse of this modules assumes that wrapped methods be coded to cache their\nvalues in a co...
"""Script to generate doxygen documentation. """ import re import os import os.path import sys import shutil from devtools import tarball def find_program(*filenames): """find a program in folders path_lst, and sets env[var] @param filenames: a list of possible names of the program to search for @return: the full path of the filename if found, or '' if filename could not be found """ paths = os.environ.get('PATH', '').split(os.pathsep) suffixes = ('win32' in sys.platform ) and '.exe .com .bat .cmd' or '' for filename in filenames: for name in [filename+ext for ext in suffixes.split()]: for directory in paths: full_path = os.path.join(directory, name) if os.path.isfile(full_path): return full_path return '' def do_subst_in_file(targetfile, sourcefile, dict): """Replace all instances of the keys of dict with their values. For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'}, then all instances of %VERSION% in the file will be replaced with 1.2345 etc. """ try: f = open(sourcefile, 'rb') contents = f.read() f.close() except: print "Can't read source file %s"%sourcefile raise for (k,v) in dict.items(): v = v.replace('\\','\\\\') contents = re.sub(k, v, contents) try: f = open(targetfile, 'wb') f.write(contents) f.close() except: print "Can't write target file %s"%targetfile raise def run_doxygen(doxygen_path, config_file, working_dir, is_silent): config_file = os.path.abspath( config_file ) doxygen_path = doxygen_path old_cwd = os.getcwd() try: os.chdir( working_dir ) cmd = [doxygen_path, config_file] print 'Running:', ' '.join( cmd ) try: import subprocess except: if os.system( ' '.join( cmd ) ) != 0: print 'Documentation generation failed' return False else: if is_silent: process = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) else: process = subprocess.Popen( cmd ) stdout, _ = process.communicate() if process.returncode: print 'Documentation generation failed:' print stdout return False return True finally: os.chdir( old_cwd ) def build_doc( options, make_release=False ): if make_release: options.make_tarball = True options.with_dot = True options.with_html_help = True options.with_uml_look = True options.open = False options.silent = True version = open('version','rt').read().strip() output_dir = 'dist/doxygen' # relative to doc/doxyfile location. if not os.path.isdir( output_dir ): os.makedirs( output_dir ) top_dir = os.path.abspath( '.' ) html_output_dirname = 'jsoncpp-api-html-' + version tarball_path = os.path.join( 'dist', html_output_dirname + '.tar.gz' ) warning_log_path = os.path.join( output_dir, '../jsoncpp-doxygen-warning.log' ) html_output_path = os.path.join( output_dir, html_output_dirname ) def yesno( bool ): return bool and 'YES' or 'NO' subst_keys = { '%JSONCPP_VERSION%': version, '%DOC_TOPDIR%': '', '%TOPDIR%': top_dir, '%HTML_OUTPUT%': os.path.join( '..', output_dir, html_output_dirname ), '%HAVE_DOT%': yesno(options.with_dot), '%DOT_PATH%': os.path.split(options.dot_path)[0], '%HTML_HELP%': yesno(options.with_html_help), '%UML_LOOK%': yesno(options.with_uml_look), '%WARNING_LOG_PATH%': os.path.join( '..', warning_log_path ) } if os.path.isdir( output_dir ): print 'Deleting directory:', output_dir shutil.rmtree( output_dir ) if not os.path.isdir( output_dir ): os.makedirs( output_dir ) do_subst_in_file( 'doc/doxyfile', 'doc/doxyfile.in', subst_keys ) ok = run_doxygen( options.doxygen_path, 'doc/doxyfile', 'doc', is_silent=options.silent ) if not options.silent: print open(warning_log_path, 'rb').read() index_path = os.path.abspath(os.path.join(subst_keys['%HTML_OUTPUT%'], 'index.html')) print 'Generated documentation can be found in:' print index_path if options.open: import webbrowser webbrowser.open( 'file://' + index_path ) if options.make_tarball: print 'Generating doc tarball to', tarball_path tarball_sources = [ output_dir, 'README.txt', 'version' ] tarball_basedir = os.path.join( output_dir, html_output_dirname ) tarball.make_tarball( tarball_path, tarball_sources, tarball_basedir, html_output_dirname ) return tarball_path, html_output_dirname def main(): usage = """%prog Generates doxygen documentation in build/doxygen. Optionaly makes a tarball of the documentation to dist/. Must be started in the project top directory. """ from optparse import OptionParser parser = OptionParser(usage=usage) parser.allow_interspersed_args = False parser.add_option('--with-dot', dest="with_dot", action='store_true', default=False, help="""Enable usage of DOT to generate collaboration diagram""") parser.add_option('--dot', dest="dot_path", action='store', default=find_program('dot'), help="""Path to GraphViz dot tool. Must be full qualified path. [Default: %default]""") parser.add_option('--doxygen', dest="doxygen_path", action='store', default=find_program('doxygen'), help="""Path to Doxygen tool. [Default: %default]""") parser.add_option('--with-html-help', dest="with_html_help", action='store_true', default=False, help="""Enable generation of Microsoft HTML HELP""") parser.add_option('--no-uml-look', dest="with_uml_look", action='store_false', default=True, help="""Generates DOT graph without UML look [Default: False]""") parser.add_option('--open', dest="open", action='store_true', default=False, help="""Open the HTML index in the web browser after generation""") parser.add_option('--tarball', dest="make_tarball", action='store_true', default=False, help="""Generates a tarball of the documentation in dist/ directory""") parser.add_option('-s', '--silent', dest="silent", action='store_true', default=False, help="""Hides doxygen output""") parser.enable_interspersed_args() options, args = parser.parse_args() build_doc( options ) if __name__ == '__main__': main()
[ [ 8, 0, 0.009, 0.012, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.024, 0.006, 0, 0.66, 0.0833, 540, 0, 1, 0, 0, 540, 0, 0 ], [ 1, 0, 0.0299, 0.006, 0, 0.66, ...
[ "\"\"\"Script to generate doxygen documentation.\n\"\"\"", "import re", "import os", "import os.path", "import sys", "import shutil", "from devtools import tarball", "def find_program(*filenames):\n \"\"\"find a program in folders path_lst, and sets env[var]\n @param filenames: a list of possibl...
# removes all files created during testing import glob import os paths = [] for pattern in [ '*.actual', '*.actual-rewrite', '*.rewrite', '*.process-output' ]: paths += glob.glob( 'data/' + pattern ) for path in paths: os.unlink( path )
[ [ 1, 0, 0.2, 0.1, 0, 0.66, 0, 958, 0, 1, 0, 0, 958, 0, 0 ], [ 1, 0, 0.3, 0.1, 0, 0.66, 0.25, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 14, 0, 0.5, 0.1, 0, 0.66, 0.5, ...
[ "import glob", "import os", "paths = []", "for pattern in [ '*.actual', '*.actual-rewrite', '*.rewrite', '*.process-output' ]:\n paths += glob.glob( 'data/' + pattern )", "for path in paths:\n os.unlink( path )", " os.unlink( path )" ]
import glob import os.path for path in glob.glob( '*.json' ): text = file(path,'rt').read() target = os.path.splitext(path)[0] + '.expected' if os.path.exists( target ): print 'skipping:', target else: print 'creating:', target file(target,'wt').write(text)
[ [ 1, 0, 0.0909, 0.0909, 0, 0.66, 0, 958, 0, 1, 0, 0, 958, 0, 0 ], [ 1, 0, 0.1818, 0.0909, 0, 0.66, 0.5, 79, 0, 1, 0, 0, 79, 0, 0 ], [ 6, 0, 0.5909, 0.7273, 0, 0.66,...
[ "import glob", "import os.path", "for path in glob.glob( '*.json' ):\n text = file(path,'rt').read()\n target = os.path.splitext(path)[0] + '.expected'\n if os.path.exists( target ):\n print('skipping:', target)\n else:\n print('creating:', target)\n file(target,'wt').write(text...
# Simple implementation of a json test runner to run the test against json-py. import sys import os.path import json import types if len(sys.argv) != 2: print "Usage: %s input-json-file", sys.argv[0] sys.exit(3) input_path = sys.argv[1] base_path = os.path.splitext(input_path)[0] actual_path = base_path + '.actual' rewrite_path = base_path + '.rewrite' rewrite_actual_path = base_path + '.actual-rewrite' def valueTreeToString( fout, value, path = '.' ): ty = type(value) if ty is types.DictType: fout.write( '%s={}\n' % path ) suffix = path[-1] != '.' and '.' or '' names = value.keys() names.sort() for name in names: valueTreeToString( fout, value[name], path + suffix + name ) elif ty is types.ListType: fout.write( '%s=[]\n' % path ) for index, childValue in zip( xrange(0,len(value)), value ): valueTreeToString( fout, childValue, path + '[%d]' % index ) elif ty is types.StringType: fout.write( '%s="%s"\n' % (path,value) ) elif ty is types.IntType: fout.write( '%s=%d\n' % (path,value) ) elif ty is types.FloatType: fout.write( '%s=%.16g\n' % (path,value) ) elif value is True: fout.write( '%s=true\n' % path ) elif value is False: fout.write( '%s=false\n' % path ) elif value is None: fout.write( '%s=null\n' % path ) else: assert False and "Unexpected value type" def parseAndSaveValueTree( input, actual_path ): root = json.loads( input ) fout = file( actual_path, 'wt' ) valueTreeToString( fout, root ) fout.close() return root def rewriteValueTree( value, rewrite_path ): rewrite = json.dumps( value ) #rewrite = rewrite[1:-1] # Somehow the string is quoted ! jsonpy bug ? file( rewrite_path, 'wt').write( rewrite + '\n' ) return rewrite input = file( input_path, 'rt' ).read() root = parseAndSaveValueTree( input, actual_path ) rewrite = rewriteValueTree( json.write( root ), rewrite_path ) rewrite_root = parseAndSaveValueTree( rewrite, rewrite_actual_path ) sys.exit( 0 )
[ [ 1, 0, 0.0469, 0.0156, 0, 0.66, 0, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 1, 0, 0.0625, 0.0156, 0, 0.66, 0.0588, 79, 0, 1, 0, 0, 79, 0, 0 ], [ 1, 0, 0.0781, 0.0156, 0, 0....
[ "import sys", "import os.path", "import json", "import types", "if len(sys.argv) != 2:\n print(\"Usage: %s input-json-file\", sys.argv[0])\n sys.exit(3)", " print(\"Usage: %s input-json-file\", sys.argv[0])", " sys.exit(3)", "input_path = sys.argv[1]", "base_path = os.path.splitext(input...
#! /usr/bin/env python # encoding: utf-8 # waf 1.6.10 VERSION='0.3.3' import sys APPNAME='p2t' top = '.' out = 'build' CPP_SOURCES = ['poly2tri/common/shapes.cc', 'poly2tri/sweep/cdt.cc', 'poly2tri/sweep/advancing_front.cc', 'poly2tri/sweep/sweep_context.cc', 'poly2tri/sweep/sweep.cc', 'testbed/main.cc'] from waflib.Tools.compiler_cxx import cxx_compiler cxx_compiler['win32'] = ['g++'] #Platform specific libs if sys.platform == 'win32': # MS Windows sys_libs = ['glfw', 'opengl32'] elif sys.platform == 'darwin': # Apple OSX sys_libs = ['glfw', 'OpenGL'] else: # GNU/Linux, BSD, etc sys_libs = ['glfw', 'GL'] def options(opt): print(' set_options') opt.load('compiler_cxx') def configure(conf): print(' calling the configuration') conf.load('compiler_cxx') conf.env.CXXFLAGS = ['-O3', '-ffast-math'] conf.env.DEFINES_P2T = ['P2T'] conf.env.LIB_P2T = sys_libs def build(bld): print(' building') bld.program(features = 'cxx cxxprogram', source=CPP_SOURCES, target = 'p2t', uselib = 'P2T')
[ [ 14, 0, 0.1111, 0.0222, 0, 0.66, 0, 557, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.1333, 0.0222, 0, 0.66, 0.0909, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 14, 0, 0.1556, 0.0222, 0, ...
[ "VERSION='0.3.3'", "import sys", "APPNAME='p2t'", "top = '.'", "out = 'build'", "CPP_SOURCES = ['poly2tri/common/shapes.cc',\n 'poly2tri/sweep/cdt.cc',\n 'poly2tri/sweep/advancing_front.cc',\n 'poly2tri/sweep/sweep_context.cc',\n 'poly2tri/sweep/swee...
#!/usr/bin/env python import time t = time.time() u = time.gmtime(t) s = time.strftime('%a, %e %b %Y %T GMT', u) print 'Content-Type: text/javascript' print 'Cache-Control: no-cache' print 'Date: ' + s print 'Expires: ' + s print '' print 'var timeskew = new Date().getTime() - ' + str(t*1000) + ';'
[ [ 1, 0, 0.1818, 0.0909, 0, 0.66, 0, 654, 0, 1, 0, 0, 654, 0, 0 ], [ 14, 0, 0.2727, 0.0909, 0, 0.66, 0.1111, 15, 3, 0, 0, 0, 654, 10, 1 ], [ 14, 0, 0.3636, 0.0909, 0, ...
[ "import time", "t = time.time()", "u = time.gmtime(t)", "s = time.strftime('%a, %e %b %Y %T GMT', u)", "print('Content-Type: text/javascript')", "print('Cache-Control: no-cache')", "print('Date: ' + s)", "print('Expires: ' + s)", "print('')", "print('var timeskew = new Date().getTime() - ' + str(t...
#!/usr/bin/python import sys, hashlib def write_file(fn, buf): fp = open(fn, "wb") fp.write(buf) fp.close() def usage(): print ("Usage: " + sys.argv[0] + " infile outfile label") def main(): if( len(sys.argv) != 4): usage() sys.exit() fp = open( sys.argv[1] , "rb") hash_str = hashlib.md5( fp.read() ).hexdigest() fp.close() out_str = "u8 " + sys.argv[3] + "[16] = { " i=0 for str in hash_str: if i % 2 == 0: out_str += "0x" + str else: out_str += str if i < 31: out_str += ", " i += 1 out_str += " };" print out_str write_file( sys.argv[2] , out_str ) if __name__ == "__main__": main()
[ [ 1, 0, 0.0714, 0.0238, 0, 0.66, 0, 509, 0, 2, 0, 0, 509, 0, 0 ], [ 2, 0, 0.1548, 0.0952, 0, 0.66, 0.25, 725, 0, 2, 0, 0, 0, 0, 3 ], [ 14, 1, 0.1429, 0.0238, 1, 0.8...
[ "import sys, hashlib", "def write_file(fn, buf):\n\tfp = open(fn, \"wb\")\n\tfp.write(buf)\n\tfp.close()", "\tfp = open(fn, \"wb\")", "\tfp.write(buf)", "\tfp.close()", "def usage():\n\tprint (\"Usage: \" + sys.argv[0] + \" infile outfile label\")", "\tprint (\"Usage: \" + sys.argv[0] + \" infile outfi...
#!/usr/bin/python import sys, re, os def write_file(fn, buf): fp = open(fn, "wb") fp.write(buf) fp.close() def usage(): print ("Usage: " + os.path.split(__file__)[1] + " version outfile") def crete_version_str(ver): base = list("0.00") version = str(ver) ret = [] base[0] = version[0] base[2] = version[1] base[3] = version[2] ret.append("".join(base)) version = str(int(ver) + 1) base[0] = version[0] base[2] = version[1] base[3] = version[2] ret.append("".join(base)) return ret def main(): if( len(sys.argv) != 3): usage() sys.exit() if len( sys.argv[1]) != 3: print sys.argv[1] + ":Version error." sys.exit() fp = open( os.path.dirname(os.path.abspath(__file__)) + "/update_base.sfo" , "rb") sfo_buf = fp.read() fp.close() after_str = crete_version_str(sys.argv[1]) print "Target version:" + after_str[0] sfo_buf = re.sub("X.YZ", after_str[0], sfo_buf ) sfo_buf = re.sub("Z.YX", after_str[1], sfo_buf ) write_file( sys.argv[2] , sfo_buf ) if __name__ == "__main__": main()
[ [ 1, 0, 0.0577, 0.0192, 0, 0.66, 0, 509, 0, 3, 0, 0, 509, 0, 0 ], [ 2, 0, 0.125, 0.0769, 0, 0.66, 0.2, 725, 0, 2, 0, 0, 0, 0, 3 ], [ 14, 1, 0.1154, 0.0192, 1, 0.68,...
[ "import sys, re, os", "def write_file(fn, buf):\n\tfp = open(fn, \"wb\")\n\tfp.write(buf)\n\tfp.close()", "\tfp = open(fn, \"wb\")", "\tfp.write(buf)", "\tfp.close()", "def usage():\n\tprint (\"Usage: \" + os.path.split(__file__)[1] + \" version outfile\")", "\tprint (\"Usage: \" + os.path.split(__file...
#!/usr/bin/python import os def main(): lists = [ "ISODrivers/Galaxy/galaxy.prx", "ISODrivers/March33/march33.prx", "ISODrivers/March33/march33_620.prx", "ISODrivers/March33/march33_660.prx", "ISODrivers/Inferno/inferno.prx", "Popcorn/popcorn.prx", "Satelite/satelite.prx", "Stargate/stargate.prx", "SystemControl/systemctrl.prx", "usbdevice/usbdevice.prx", "Vshctrl/vshctrl.prx", "Recovery/recovery.prx", ] for fn in lists: path = "../" + fn name=os.path.split(fn)[-1] name=os.path.splitext(name)[0] ret = os.system("bin2c %s %s.h %s"%(path, name, name)) assert(ret == 0) if __name__ == "__main__": main()
[ [ 1, 0, 0.1034, 0.0345, 0, 0.66, 0, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 2, 0, 0.5345, 0.7586, 0, 0.66, 0.5, 624, 0, 0, 0, 0, 0, 0, 3 ], [ 14, 1, 0.431, 0.4828, 1, 0.13,...
[ "import os", "def main():\n\tlists = [\n\t\t\t\"ISODrivers/Galaxy/galaxy.prx\",\n\t\t\t\"ISODrivers/March33/march33.prx\",\n\t\t\t\"ISODrivers/March33/march33_620.prx\",\n\t\t\t\"ISODrivers/March33/march33_660.prx\",\n\t\t\t\"ISODrivers/Inferno/inferno.prx\",\n\t\t\t\"Popcorn/popcorn.prx\",", "\tlists = [\n\t\t...
#!/usr/bin/python class FakeTime: def time(self): return 1225856967.109 import os, gzip, StringIO gzip.time = FakeTime() def create_gzip(input, output): f_in=open(input, 'rb') temp=StringIO.StringIO() f=gzip.GzipFile(fileobj=temp, mode='wb') f.writelines(f_in) f.close() f_in.close() fout=open(output, 'wb') temp.seek(0) fout.writelines(temp) fout.close() temp.close() def cleanup(): del_list = [ "installer.prx.gz", "Rebootex.prx.gz", ] for file in del_list: try: os.remove(file) except OSError: pass def main(): create_gzip("../../Installer/installer.prx", "installer.prx.gz") create_gzip("../../Rebootex/Rebootex.prx", "Rebootex.prx.gz") os.system("bin2c installer.prx.gz installer.h installer") os.system("bin2c Rebootex.prx.gz Rebootex_prx.h Rebootex_prx") cleanup() if __name__ == "__main__": main()
[ [ 3, 0, 0.0909, 0.0682, 0, 0.66, 0, 425, 0, 1, 0, 0, 0, 0, 0 ], [ 2, 1, 0.1023, 0.0455, 1, 0.75, 0, 654, 0, 1, 1, 0, 0, 0, 0 ], [ 13, 2, 0.1136, 0.0227, 2, 0.12, ...
[ "class FakeTime:\n def time(self):\n return 1225856967.109", " def time(self):\n return 1225856967.109", " return 1225856967.109", "import os, gzip, StringIO", "gzip.time = FakeTime()", "def create_gzip(input, output):\n\tf_in=open(input, 'rb')\n\ttemp=StringIO.StringIO()\n\tf=g...
#!/usr/bin/python import os, sys, getopt def usage(): print ("Usage: %s [-l size ] basefile input output" % (sys.argv[0])) def write_file(fn, buf): fp = open(fn, "wb") fp.write(buf) fp.close() def main(): inputsize = 0 try: optlist, args = getopt.getopt(sys.argv[1:], 'l:h') except getopt.GetoptError: usage() sys.exit(2) for o, a in optlist: if o == "-h": usage() sys.exit() if o == "-l": inputsize = int(a, 16) inputsize = max(inputsize, 0x4000); if len(args) < 3: usage() sys.exit(2) basefile = args[0] inputfile = args[1] outputfile = args[2] fp = open(basefile, "rb") buf = fp.read(0x1000) fp.close() if len(buf) < inputsize: buf += b'\0' * (inputsize - len(buf)) assert(len(buf) == inputsize) fp = open(inputfile, "rb") ins = fp.read(0x3000) fp.close() buf = buf[0:0x1000] + ins + buf[0x1000+len(ins):] assert(len(buf) == inputsize) write_file(outputfile, buf) if __name__ == "__main__": main()
[ [ 1, 0, 0.0536, 0.0179, 0, 0.66, 0, 688, 0, 3, 0, 0, 688, 0, 0 ], [ 2, 0, 0.0982, 0.0357, 0, 0.66, 0.25, 129, 0, 0, 0, 0, 0, 0, 1 ], [ 8, 1, 0.1071, 0.0179, 1, 0.36...
[ "import os, sys, getopt", "def usage():\n\tprint (\"Usage: %s [-l size ] basefile input output\" % (sys.argv[0]))", "\tprint (\"Usage: %s [-l size ] basefile input output\" % (sys.argv[0]))", "def write_file(fn, buf):\n\tfp = open(fn, \"wb\")\n\tfp.write(buf)\n\tfp.close()", "\tfp = open(fn, \"wb\")", "\t...
#!/usr/bin/python from hashlib import * import sys, struct def sha512(psid): if len(psid) != 16: return "".encode() for i in range(512): psid = sha1(psid).digest() return psid def get_psid(str): if len(str) != 32: return "".encode() b = "".encode() for i in range(0, len(str), 2): b += struct.pack('B', int(str[i] + str[i+1], 16)) return b def main(): if len(sys.argv) < 2: print ("Usage: sha512.py psid") exit(0) psid = get_psid(sys.argv[1]) xhash = sha512(psid) if len(xhash) == 0: print ("wrong PSID") exit(0) print ("{\n\t"), for i in range(len(xhash)): if i != 0 and i % 8 == 0: print ("\n\t"), print ("0x%02X, "%(struct.unpack('B', xhash[i])[0])), print ("\n},") if __name__ == "__main__": main()
[ [ 1, 0, 0.0652, 0.0217, 0, 0.66, 0, 154, 0, 1, 0, 0, 154, 0, 0 ], [ 1, 0, 0.087, 0.0217, 0, 0.66, 0.2, 509, 0, 2, 0, 0, 509, 0, 0 ], [ 2, 0, 0.2065, 0.1739, 0, 0.66...
[ "from hashlib import *", "import sys, struct", "def sha512(psid):\n\tif len(psid) != 16:\n\t\treturn \"\".encode()\n\n\tfor i in range(512):\n\t\tpsid = sha1(psid).digest()\n\n\treturn psid", "\tif len(psid) != 16:\n\t\treturn \"\".encode()", "\t\treturn \"\".encode()", "\tfor i in range(512):\n\t\tpsid =...
#!/usr/bin/python import sys, os, gzip, StringIO def dump_binary(fn, data): f = open(fn, "wb") f.write(data) f.close() def dec_prx(fn): f = open(fn, "rb") f.seek(0x150) dat = f.read() f.close() temp=StringIO.StringIO(dat) f=gzip.GzipFile(fileobj=temp, mode='rb') dec = f.read(f) f.close() fn = "%s.dec.prx" % os.path.splitext(fn)[0] print ("Decompressed to %s" %(fn)) dump_binary(fn, dec) def main(): if len(sys.argv) < 2: print ("Usage: %s <file>" % (sys.argv[0])) sys.exit(-1) dec_prx(sys.argv[1]) if __name__ == "__main__": main()
[ [ 1, 0, 0.0909, 0.0303, 0, 0.66, 0, 509, 0, 4, 0, 0, 509, 0, 0 ], [ 2, 0, 0.197, 0.1212, 0, 0.66, 0.25, 336, 0, 2, 0, 0, 0, 0, 3 ], [ 14, 1, 0.1818, 0.0303, 1, 0.57...
[ "import sys, os, gzip, StringIO", "def dump_binary(fn, data):\n\tf = open(fn, \"wb\")\n\tf.write(data)\n\tf.close()", "\tf = open(fn, \"wb\")", "\tf.write(data)", "\tf.close()", "def dec_prx(fn):\n\tf = open(fn, \"rb\")\n\tf.seek(0x150)\n\tdat = f.read()\n\tf.close()\n\n\ttemp=StringIO.StringIO(dat)\n\tf=...
#!/usr/bin/python import sys, hashlib def toNID(name): hashstr = hashlib.sha1(name.encode()).hexdigest().upper() return "0x" + hashstr[6:8] + hashstr[4:6] + hashstr[2:4] + hashstr[0:2] if __name__ == "__main__": assert(toNID("sceKernelCpuSuspendIntr") == "0x092968F4") for name in sys.argv[1:]: print ("%s: %s"%(name, toNID(name)))
[ [ 1, 0, 0.2308, 0.0769, 0, 0.66, 0, 509, 0, 2, 0, 0, 509, 0, 0 ], [ 2, 0, 0.4615, 0.2308, 0, 0.66, 0.5, 259, 0, 1, 1, 0, 0, 0, 4 ], [ 14, 1, 0.4615, 0.0769, 1, 0.41...
[ "import sys, hashlib", "def toNID(name):\n\thashstr = hashlib.sha1(name.encode()).hexdigest().upper()\n\treturn \"0x\" + hashstr[6:8] + hashstr[4:6] + hashstr[2:4] + hashstr[0:2]", "\thashstr = hashlib.sha1(name.encode()).hexdigest().upper()", "\treturn \"0x\" + hashstr[6:8] + hashstr[4:6] + hashstr[2:4] + ha...
#!/usr/bin/python """ pspbtcnf_editor: An script that add modules from pspbtcnf """ import sys, os, re from getopt import * from struct import * BTCNF_MAGIC=0x0F803001 verbose = False def print_usage(): print ("%s: pspbtcnf.bin [-o output.bin] [-a add_module_name:before_module_name:flag]" %(os.path.split(sys.argv[0]))[-1]) def replace_binary(data, offset, newdata): newdata = data[0:offset] + newdata + data[offset+len(newdata):] assert(len(data) == len(newdata)) return newdata def dump_binary(data, offset, size): newdata = data[offset:offset+size] assert(len(newdata) == size) return newdata def dump_binary_str(data, offset): ch = data[offset] tmp = b'' while ch != 0: tmp += pack('b', ch) offset += 1 ch = data[offset] return tmp.decode() def add_prx_to_bootconf(srcfn, before_modname, modname, modflag): "Return new bootconf data" fn=open(srcfn, "rb") bootconf = fn.read() fn.close() if len(bootconf) < 64: raise Exception("Bad bootconf") signature, devkit, modestart, nmodes, modulestart, nmodules, modnamestart, modnameend = unpack('LL8xLL8xLL8xLL8x', bootconf[:64]) if verbose: print ("Devkit: 0x%08X"%(devkit)) print ("modestart: 0x%08X"%(modestart)) print ("nmodes: %d"%(nmodes)) print ("modulestart: 0x%08X"%(modulestart)) print ("nmodules: 0x%08X"%(nmodules)) print ("modnamestart: 0x%08X"%(modnamestart)) print ("modnameend: 0x%08X"%(modnameend)) if signature != BTCNF_MAGIC or nmodules <= 0 or nmodes <= 0: raise Exception("Bad bootconf") bootconf = bootconf + modname.encode() + b'\0' modnameend += len(modname) + 1 i=0 while i < nmodules: module_path, module_flags = unpack('L4xL4x16x', bootconf[modulestart+i*32:modulestart+(i+1)*32]) module_name = dump_binary_str(bootconf, modnamestart+module_path) if verbose: print ("[%02d]: Module path: %s flag: 0x%08X"%(i, module_name, module_flags)) if before_modname == module_name: break i+=1 if i >= nmodules: raise Exception("module %s not found"%(before_modname)) module_path = modnameend - len(modname) - 1 - modnamestart module_flag = 0x80010000 | (modflag & 0xFFFF) newmod = dump_binary(bootconf, modulestart+i*32, 32) newmod = replace_binary(newmod, 0, pack('L', module_path)) newmod = replace_binary(newmod, 8, pack('L', module_flag)) bootconf = bootconf[0:modulestart+i*32] + newmod + bootconf[modulestart+i*32:] nmodules+=1 bootconf = replace_binary(bootconf, 0x24, pack('L', nmodules)) modnamestart += 32 bootconf = replace_binary(bootconf, 0x30, pack('L', modnamestart)) modnameend += 32 bootconf = replace_binary(bootconf, 0x34, pack('L', modnameend)) i = 0 while i < nmodes: num = unpack('H', bootconf[modestart+i*32:modestart+i*32+2])[0] num += 1 bootconf = replace_binary(bootconf, modestart + i * 32, pack('H', num)) i += 1 return bootconf def write_file(output_fn, data): fn = open(output_fn, "wb") fn.write(data) fn.close() def main(): global verbose try: optlist, args = gnu_getopt(sys.argv, "a:o:vh") except GetoptError as err: print(err) print_usage() sys.exit(1) # default configure verbose = False dst_filename = "-" add_module = "" for o, a in optlist: if o == "-v": verbose = True elif o == "-h": print_usage() sys.exit() elif o == "-o": dst_filename = a elif o == "-a": add_module = a else: assert False, "unhandled option" if verbose: print (optlist, args) if len(args) < 2: print ("Missing input pspbtcnf.bin") sys.exit(1) src_filename = args[1] if verbose: print ("src_filename: " + src_filename) print ("dst_filename: " + dst_filename) # check add_module if add_module != "": t = (re.split(":", add_module, re.I)) if len(t) != 3: print ("Bad add_module input") sys.exit(1) add_module, before_module, add_module_flag = (re.split(":", add_module, re.I)) if verbose: print ("add_module: " + add_module) print ("before_module: " + before_module) print ("add_module_flag: " + add_module_flag) if add_module != "": result = add_prx_to_bootconf(src_filename, before_module, add_module, int(add_module_flag, 16)) if dst_filename == "-": # print("Bootconf result:") # print(result) pass else: write_file(dst_filename, result) if __name__ == "__main__": main()
[ [ 8, 0, 0.022, 0.0165, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0385, 0.0055, 0, 0.66, 0.0769, 509, 0, 3, 0, 0, 509, 0, 0 ], [ 1, 0, 0.044, 0.0055, 0, 0.66, ...
[ "\"\"\"\npspbtcnf_editor: An script that add modules from pspbtcnf\n\"\"\"", "import sys, os, re", "from getopt import *", "from struct import *", "BTCNF_MAGIC=0x0F803001", "verbose = False", "def print_usage():\n\tprint (\"%s: pspbtcnf.bin [-o output.bin] [-a add_module_name:before_module_name:flag]\" ...
#!/usr/bin/python class FakeTime: def time(self): return 1225856967.109 import sys, os, struct, gzip, hashlib, StringIO gzip.time = FakeTime() def binary_replace(data, newdata, offset): return data[0:offset] + newdata + data[offset+len(newdata):] def prx_compress(output, hdr, input, mod_name="", mod_attr=0xFFFFFFFF): a=open(hdr, "rb") fileheader = a.read(); a.close() a=open(input, "rb") elf = a.read(4); a.close() if (elf != '\x7fELF'.encode()): print ("not a ELF/PRX file!") return -1 uncompsize = os.stat(input).st_size f_in=open(input, 'rb') temp=StringIO.StringIO() f=gzip.GzipFile(fileobj=temp, mode='wb') f.writelines(f_in) f.close() f_in.close() prx=temp.getvalue() temp.close() digest=hashlib.md5(prx).digest() filesize = len(fileheader) + len(prx) if mod_name != "": if len(mod_name) < 28: mod_name += "\x00" * (28-len(mod_name)) else: mod_name = mod_name[0:28] fileheader = binary_replace(fileheader, mod_name.encode(), 0xA) if mod_attr != 0xFFFFFFFF: fileheader = binary_replace(fileheader, struct.pack('H', mod_attr), 0x4) fileheader = binary_replace(fileheader, struct.pack('L', uncompsize), 0x28) fileheader = binary_replace(fileheader, struct.pack('L', filesize), 0x2c) fileheader = binary_replace(fileheader, struct.pack('L', len(prx)), 0xb0) fileheader = binary_replace(fileheader, digest, 0x140) a=open(output, "wb") assert(len(fileheader) == 0x150) a.write(fileheader) a.write(prx) a.close() try: os.remove("tmp.gz") except OSError: pass return 0 def main(): if len(sys.argv) < 4: print ("Usage: %s outfile prxhdr infile [modname] [modattr]\n"%(sys.argv[0])) exit(-1) if len(sys.argv) < 5: prx_compress(sys.argv[1], sys.argv[2], sys.argv[3]) elif len(sys.argv) < 6: prx_compress(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4]) else: prx_compress(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], int(sys.argv[5], 16)) if __name__ == "__main__": main()
[ [ 3, 0, 0.0488, 0.0366, 0, 0.66, 0, 425, 0, 1, 0, 0, 0, 0, 0 ], [ 2, 1, 0.0549, 0.0244, 1, 0.88, 0, 654, 0, 1, 1, 0, 0, 0, 0 ], [ 13, 2, 0.061, 0.0122, 2, 0.27, ...
[ "class FakeTime:\n def time(self):\n return 1225856967.109", " def time(self):\n return 1225856967.109", " return 1225856967.109", "import sys, os, struct, gzip, hashlib, StringIO", "gzip.time = FakeTime()", "def binary_replace(data, newdata, offset):\n\treturn data[0:offset] + ...
#!/usr/bin/python """ PRO build script""" import os, shutil, sys NIGHTLY=0 VERSION="B10" PRO_BUILD = [ { "fn": "620PRO-%s.rar", "config": "CONFIG_620=1" }, { "fn": "635PRO-%s.rar", "config": "CONFIG_635=1" }, { "fn": "639PRO-%s.rar", "config": "CONFIG_639=1" }, { "fn": "660PRO-%s.rar", "config": "CONFIG_660=1" }, # { "fn": "620PRO-%s.zip", "config": "CONFIG_620=1" }, # { "fn": "635PRO-%s.zip", "config": "CONFIG_635=1" }, # { "fn": "639PRO-%s.zip", "config": "CONFIG_639=1" }, # { "fn": "660PRO-%s.zip", "config": "CONFIG_660=1" }, # { "fn": "620PRO-%s.tar.gz", "config": "CONFIG_620=1" }, # { "fn": "635PRO-%s.tar.gz", "config": "CONFIG_635=1" }, # { "fn": "639PRO-%s.tar.gz", "config": "CONFIG_639=1" }, # { "fn": "660PRO-%s.tar.gz", "config": "CONFIG_660=1" }, # { "fn": "620PRO-%s.tar.bz2", "config": "CONFIG_620=1" }, # { "fn": "635PRO-%s.tar.bz2", "config": "CONFIG_635=1" }, # { "fn": "639PRO-%s.tar.bz2", "config": "CONFIG_639=1" }, # { "fn": "660PRO-%s.tar.bz2", "config": "CONFIG_660=1" }, ] OPT_FLAG = "" def build_pro(build_conf): global OPT_FLAG if NIGHTLY: build_conf += " " + "NIGHTLY=1" build_conf += " " + OPT_FLAG os.system("make clean %s" % (build_conf)) os.system("make deps %s" % (build_conf)) build_conf = "make " + build_conf os.system(build_conf) def copy_sdk(): try: os.mkdir("dist/sdk") os.mkdir("dist/sdk/lib") os.mkdir("dist/sdk/include") except OSError: pass shutil.copytree("kuBridgeTest", "dist/sdk/kuBridgeTest") shutil.copy("include/kubridge.h", "dist/sdk/include") shutil.copy("include/systemctrl.h", "dist/sdk/include") shutil.copy("include/systemctrl_se.h", "dist/sdk/include") shutil.copy("include/pspvshbridge.h", "dist/sdk/include") shutil.copy("libs/libpspkubridge.a", "dist/sdk/lib") shutil.copy("libs/libpspsystemctrl_kernel.a", "dist/sdk/lib") shutil.copy("libs/libpspsystemctrl_user.a", "dist/sdk/lib") def restore_chdir(): os.chdir(os.path.join(os.path.dirname(sys.argv[0]), "..")) def make_archive(fn): shutil.copy("credit.txt", "dist") copy_sdk() ext = os.path.splitext(fn)[-1].lower() try: os.remove(fn) except OSError: pass path = os.getcwd() os.chdir("dist"); if ext == ".rar": os.system("rar a -r ../%s ." % (fn)) elif ext == ".gz": os.system("tar -zcvf ../%s ." % (fn)) elif ext == ".bz2": os.system("tar -jcvf ../%s ." % (fn)) elif ext == ".zip": os.system("zip -r ../%s ." % (fn)) os.chdir(path) def main(): global OPT_FLAG OPT_FLAG = os.getenv("PRO_OPT_FLAG", "") restore_chdir() for conf in PRO_BUILD: build_pro(conf["config"]) make_archive(conf["fn"] % (VERSION)) if __name__ == "__main__": main()
[ [ 8, 0, 0.0297, 0.0099, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0495, 0.0099, 0, 0.66, 0.0909, 688, 0, 3, 0, 0, 688, 0, 0 ], [ 14, 0, 0.0693, 0.0099, 0, 0.6...
[ "\"\"\" PRO build script\"\"\"", "import os, shutil, sys", "NIGHTLY=0", "VERSION=\"B10\"", "PRO_BUILD = [\n\t\t\t{ \"fn\": \"620PRO-%s.rar\", \"config\": \"CONFIG_620=1\" },\n\t\t\t{ \"fn\": \"635PRO-%s.rar\", \"config\": \"CONFIG_635=1\" },\n\t\t\t{ \"fn\": \"639PRO-%s.rar\", \"config\": \"CONFIG_639=1\" }...
#!/usr/bin/python import sys, hashlib def write_file(fn, buf): fp = open(fn, "wb") fp.write(buf) fp.close() def usage(): print ("Usage: " + sys.argv[0] + " infile outfile label") def main(): if( len(sys.argv) != 4): usage() sys.exit() fp = open( sys.argv[1] , "rb") hash_str = hashlib.md5( fp.read() ).hexdigest() fp.close() out_str = "u8 " + sys.argv[3] + "[16] = { " i=0 for str in hash_str: if i % 2 == 0: out_str += "0x" + str else: out_str += str if i < 31: out_str += ", " i += 1 out_str += " };" print out_str write_file( sys.argv[2] , out_str ) if __name__ == "__main__": main()
[ [ 1, 0, 0.0714, 0.0238, 0, 0.66, 0, 509, 0, 2, 0, 0, 509, 0, 0 ], [ 2, 0, 0.1548, 0.0952, 0, 0.66, 0.25, 725, 0, 2, 0, 0, 0, 0, 3 ], [ 14, 1, 0.1429, 0.0238, 1, 0.8...
[ "import sys, hashlib", "def write_file(fn, buf):\n\tfp = open(fn, \"wb\")\n\tfp.write(buf)\n\tfp.close()", "\tfp = open(fn, \"wb\")", "\tfp.write(buf)", "\tfp.close()", "def usage():\n\tprint (\"Usage: \" + sys.argv[0] + \" infile outfile label\")", "\tprint (\"Usage: \" + sys.argv[0] + \" infile outfi...
#!/usr/bin/python import sys, re, os def write_file(fn, buf): fp = open(fn, "wb") fp.write(buf) fp.close() def usage(): print ("Usage: " + os.path.split(__file__)[1] + " version outfile") def crete_version_str(ver): base = list("0.00") version = str(ver) ret = [] base[0] = version[0] base[2] = version[1] base[3] = version[2] ret.append("".join(base)) version = str(int(ver) + 1) base[0] = version[0] base[2] = version[1] base[3] = version[2] ret.append("".join(base)) return ret def main(): if( len(sys.argv) != 3): usage() sys.exit() if len( sys.argv[1]) != 3: print sys.argv[1] + ":Version error." sys.exit() fp = open( os.path.dirname(os.path.abspath(__file__)) + "/update_base.sfo" , "rb") sfo_buf = fp.read() fp.close() after_str = crete_version_str(sys.argv[1]) print "Target version:" + after_str[0] sfo_buf = re.sub("X.YZ", after_str[0], sfo_buf ) sfo_buf = re.sub("Z.YX", after_str[1], sfo_buf ) write_file( sys.argv[2] , sfo_buf ) if __name__ == "__main__": main()
[ [ 1, 0, 0.0577, 0.0192, 0, 0.66, 0, 509, 0, 3, 0, 0, 509, 0, 0 ], [ 2, 0, 0.125, 0.0769, 0, 0.66, 0.2, 725, 0, 2, 0, 0, 0, 0, 3 ], [ 14, 1, 0.1154, 0.0192, 1, 0.69,...
[ "import sys, re, os", "def write_file(fn, buf):\n\tfp = open(fn, \"wb\")\n\tfp.write(buf)\n\tfp.close()", "\tfp = open(fn, \"wb\")", "\tfp.write(buf)", "\tfp.close()", "def usage():\n\tprint (\"Usage: \" + os.path.split(__file__)[1] + \" version outfile\")", "\tprint (\"Usage: \" + os.path.split(__file...
#!/usr/bin/python import os def main(): lists = [ "ISODrivers/Galaxy/galaxy.prx", "ISODrivers/March33/march33.prx", "ISODrivers/March33/march33_620.prx", "ISODrivers/March33/march33_660.prx", "ISODrivers/Inferno/inferno.prx", "Popcorn/popcorn.prx", "Satelite/satelite.prx", "Stargate/stargate.prx", "SystemControl/systemctrl.prx", "usbdevice/usbdevice.prx", "Vshctrl/vshctrl.prx", "Recovery/recovery.prx", ] for fn in lists: path = "../" + fn name=os.path.split(fn)[-1] name=os.path.splitext(name)[0] ret = os.system("bin2c %s %s.h %s"%(path, name, name)) assert(ret == 0) if __name__ == "__main__": main()
[ [ 1, 0, 0.1034, 0.0345, 0, 0.66, 0, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 2, 0, 0.5345, 0.7586, 0, 0.66, 0.5, 624, 0, 0, 0, 0, 0, 0, 3 ], [ 14, 1, 0.431, 0.4828, 1, 0.11,...
[ "import os", "def main():\n\tlists = [\n\t\t\t\"ISODrivers/Galaxy/galaxy.prx\",\n\t\t\t\"ISODrivers/March33/march33.prx\",\n\t\t\t\"ISODrivers/March33/march33_620.prx\",\n\t\t\t\"ISODrivers/March33/march33_660.prx\",\n\t\t\t\"ISODrivers/Inferno/inferno.prx\",\n\t\t\t\"Popcorn/popcorn.prx\",", "\tlists = [\n\t\t...
#!/usr/bin/python class FakeTime: def time(self): return 1225856967.109 import os, gzip, StringIO gzip.time = FakeTime() def create_gzip(input, output): f_in=open(input, 'rb') temp=StringIO.StringIO() f=gzip.GzipFile(fileobj=temp, mode='wb') f.writelines(f_in) f.close() f_in.close() fout=open(output, 'wb') temp.seek(0) fout.writelines(temp) fout.close() temp.close() def cleanup(): del_list = [ "installer.prx.gz", "Rebootex.prx.gz", ] for file in del_list: try: os.remove(file) except OSError: pass def main(): create_gzip("../../Installer/installer.prx", "installer.prx.gz") create_gzip("../../Rebootex/Rebootex.prx", "Rebootex.prx.gz") os.system("bin2c installer.prx.gz installer.h installer") os.system("bin2c Rebootex.prx.gz Rebootex_prx.h Rebootex_prx") cleanup() if __name__ == "__main__": main()
[ [ 3, 0, 0.0909, 0.0682, 0, 0.66, 0, 425, 0, 1, 0, 0, 0, 0, 0 ], [ 2, 1, 0.1023, 0.0455, 1, 0.8, 0, 654, 0, 1, 1, 0, 0, 0, 0 ], [ 13, 2, 0.1136, 0.0227, 2, 0.29, ...
[ "class FakeTime:\n def time(self):\n return 1225856967.109", " def time(self):\n return 1225856967.109", " return 1225856967.109", "import os, gzip, StringIO", "gzip.time = FakeTime()", "def create_gzip(input, output):\n\tf_in=open(input, 'rb')\n\ttemp=StringIO.StringIO()\n\tf=g...
#!/usr/bin/python import os, sys, getopt def usage(): print ("Usage: %s [-l size ] basefile input output" % (sys.argv[0])) def write_file(fn, buf): fp = open(fn, "wb") fp.write(buf) fp.close() def main(): inputsize = 0 try: optlist, args = getopt.getopt(sys.argv[1:], 'l:h') except getopt.GetoptError: usage() sys.exit(2) for o, a in optlist: if o == "-h": usage() sys.exit() if o == "-l": inputsize = int(a, 16) inputsize = max(inputsize, 0x4000); if len(args) < 3: usage() sys.exit(2) basefile = args[0] inputfile = args[1] outputfile = args[2] fp = open(basefile, "rb") buf = fp.read(0x1000) fp.close() if len(buf) < inputsize: buf += b'\0' * (inputsize - len(buf)) assert(len(buf) == inputsize) fp = open(inputfile, "rb") ins = fp.read(0x3000) fp.close() buf = buf[0:0x1000] + ins + buf[0x1000+len(ins):] assert(len(buf) == inputsize) write_file(outputfile, buf) if __name__ == "__main__": main()
[ [ 1, 0, 0.0536, 0.0179, 0, 0.66, 0, 688, 0, 3, 0, 0, 688, 0, 0 ], [ 2, 0, 0.0982, 0.0357, 0, 0.66, 0.25, 129, 0, 0, 0, 0, 0, 0, 1 ], [ 8, 1, 0.1071, 0.0179, 1, 0.87...
[ "import os, sys, getopt", "def usage():\n\tprint (\"Usage: %s [-l size ] basefile input output\" % (sys.argv[0]))", "\tprint (\"Usage: %s [-l size ] basefile input output\" % (sys.argv[0]))", "def write_file(fn, buf):\n\tfp = open(fn, \"wb\")\n\tfp.write(buf)\n\tfp.close()", "\tfp = open(fn, \"wb\")", "\t...
#!/usr/bin/python from hashlib import * import sys, struct def sha512(psid): if len(psid) != 16: return "".encode() for i in range(512): psid = sha1(psid).digest() return psid def get_psid(str): if len(str) != 32: return "".encode() b = "".encode() for i in range(0, len(str), 2): b += struct.pack('B', int(str[i] + str[i+1], 16)) return b def main(): if len(sys.argv) < 2: print ("Usage: sha512.py psid") exit(0) psid = get_psid(sys.argv[1]) xhash = sha512(psid) if len(xhash) == 0: print ("wrong PSID") exit(0) print ("{\n\t"), for i in range(len(xhash)): if i != 0 and i % 8 == 0: print ("\n\t"), print ("0x%02X, "%(struct.unpack('B', xhash[i])[0])), print ("\n},") if __name__ == "__main__": main()
[ [ 1, 0, 0.0652, 0.0217, 0, 0.66, 0, 154, 0, 1, 0, 0, 154, 0, 0 ], [ 1, 0, 0.087, 0.0217, 0, 0.66, 0.2, 509, 0, 2, 0, 0, 509, 0, 0 ], [ 2, 0, 0.2065, 0.1739, 0, 0.66...
[ "from hashlib import *", "import sys, struct", "def sha512(psid):\n\tif len(psid) != 16:\n\t\treturn \"\".encode()\n\n\tfor i in range(512):\n\t\tpsid = sha1(psid).digest()\n\n\treturn psid", "\tif len(psid) != 16:\n\t\treturn \"\".encode()", "\t\treturn \"\".encode()", "\tfor i in range(512):\n\t\tpsid =...
#!/usr/bin/python import sys, os, gzip, StringIO def dump_binary(fn, data): f = open(fn, "wb") f.write(data) f.close() def dec_prx(fn): f = open(fn, "rb") f.seek(0x150) dat = f.read() f.close() temp=StringIO.StringIO(dat) f=gzip.GzipFile(fileobj=temp, mode='rb') dec = f.read(f) f.close() fn = "%s.dec.prx" % os.path.splitext(fn)[0] print ("Decompressed to %s" %(fn)) dump_binary(fn, dec) def main(): if len(sys.argv) < 2: print ("Usage: %s <file>" % (sys.argv[0])) sys.exit(-1) dec_prx(sys.argv[1]) if __name__ == "__main__": main()
[ [ 1, 0, 0.0909, 0.0303, 0, 0.66, 0, 509, 0, 4, 0, 0, 509, 0, 0 ], [ 2, 0, 0.197, 0.1212, 0, 0.66, 0.25, 336, 0, 2, 0, 0, 0, 0, 3 ], [ 14, 1, 0.1818, 0.0303, 1, 0.98...
[ "import sys, os, gzip, StringIO", "def dump_binary(fn, data):\n\tf = open(fn, \"wb\")\n\tf.write(data)\n\tf.close()", "\tf = open(fn, \"wb\")", "\tf.write(data)", "\tf.close()", "def dec_prx(fn):\n\tf = open(fn, \"rb\")\n\tf.seek(0x150)\n\tdat = f.read()\n\tf.close()\n\n\ttemp=StringIO.StringIO(dat)\n\tf=...
#!/usr/bin/python import sys, hashlib def toNID(name): hashstr = hashlib.sha1(name.encode()).hexdigest().upper() return "0x" + hashstr[6:8] + hashstr[4:6] + hashstr[2:4] + hashstr[0:2] if __name__ == "__main__": assert(toNID("sceKernelCpuSuspendIntr") == "0x092968F4") for name in sys.argv[1:]: print ("%s: %s"%(name, toNID(name)))
[ [ 1, 0, 0.2308, 0.0769, 0, 0.66, 0, 509, 0, 2, 0, 0, 509, 0, 0 ], [ 2, 0, 0.4615, 0.2308, 0, 0.66, 0.5, 259, 0, 1, 1, 0, 0, 0, 4 ], [ 14, 1, 0.4615, 0.0769, 1, 0.02...
[ "import sys, hashlib", "def toNID(name):\n\thashstr = hashlib.sha1(name.encode()).hexdigest().upper()\n\treturn \"0x\" + hashstr[6:8] + hashstr[4:6] + hashstr[2:4] + hashstr[0:2]", "\thashstr = hashlib.sha1(name.encode()).hexdigest().upper()", "\treturn \"0x\" + hashstr[6:8] + hashstr[4:6] + hashstr[2:4] + ha...
#!/usr/bin/python """ pspbtcnf_editor: An script that add modules from pspbtcnf """ import sys, os, re from getopt import * from struct import * BTCNF_MAGIC=0x0F803001 verbose = False def print_usage(): print ("%s: pspbtcnf.bin [-o output.bin] [-a add_module_name:before_module_name:flag]" %(os.path.split(sys.argv[0]))[-1]) def replace_binary(data, offset, newdata): newdata = data[0:offset] + newdata + data[offset+len(newdata):] assert(len(data) == len(newdata)) return newdata def dump_binary(data, offset, size): newdata = data[offset:offset+size] assert(len(newdata) == size) return newdata def dump_binary_str(data, offset): ch = data[offset] tmp = b'' while ch != 0: tmp += pack('b', ch) offset += 1 ch = data[offset] return tmp.decode() def add_prx_to_bootconf(srcfn, before_modname, modname, modflag): "Return new bootconf data" fn=open(srcfn, "rb") bootconf = fn.read() fn.close() if len(bootconf) < 64: raise Exception("Bad bootconf") signature, devkit, modestart, nmodes, modulestart, nmodules, modnamestart, modnameend = unpack('LL8xLL8xLL8xLL8x', bootconf[:64]) if verbose: print ("Devkit: 0x%08X"%(devkit)) print ("modestart: 0x%08X"%(modestart)) print ("nmodes: %d"%(nmodes)) print ("modulestart: 0x%08X"%(modulestart)) print ("nmodules: 0x%08X"%(nmodules)) print ("modnamestart: 0x%08X"%(modnamestart)) print ("modnameend: 0x%08X"%(modnameend)) if signature != BTCNF_MAGIC or nmodules <= 0 or nmodes <= 0: raise Exception("Bad bootconf") bootconf = bootconf + modname.encode() + b'\0' modnameend += len(modname) + 1 i=0 while i < nmodules: module_path, module_flags = unpack('L4xL4x16x', bootconf[modulestart+i*32:modulestart+(i+1)*32]) module_name = dump_binary_str(bootconf, modnamestart+module_path) if verbose: print ("[%02d]: Module path: %s flag: 0x%08X"%(i, module_name, module_flags)) if before_modname == module_name: break i+=1 if i >= nmodules: raise Exception("module %s not found"%(before_modname)) module_path = modnameend - len(modname) - 1 - modnamestart module_flag = 0x80010000 | (modflag & 0xFFFF) newmod = dump_binary(bootconf, modulestart+i*32, 32) newmod = replace_binary(newmod, 0, pack('L', module_path)) newmod = replace_binary(newmod, 8, pack('L', module_flag)) bootconf = bootconf[0:modulestart+i*32] + newmod + bootconf[modulestart+i*32:] nmodules+=1 bootconf = replace_binary(bootconf, 0x24, pack('L', nmodules)) modnamestart += 32 bootconf = replace_binary(bootconf, 0x30, pack('L', modnamestart)) modnameend += 32 bootconf = replace_binary(bootconf, 0x34, pack('L', modnameend)) i = 0 while i < nmodes: num = unpack('H', bootconf[modestart+i*32:modestart+i*32+2])[0] num += 1 bootconf = replace_binary(bootconf, modestart + i * 32, pack('H', num)) i += 1 return bootconf def write_file(output_fn, data): fn = open(output_fn, "wb") fn.write(data) fn.close() def main(): global verbose try: optlist, args = gnu_getopt(sys.argv, "a:o:vh") except GetoptError as err: print(err) print_usage() sys.exit(1) # default configure verbose = False dst_filename = "-" add_module = "" for o, a in optlist: if o == "-v": verbose = True elif o == "-h": print_usage() sys.exit() elif o == "-o": dst_filename = a elif o == "-a": add_module = a else: assert False, "unhandled option" if verbose: print (optlist, args) if len(args) < 2: print ("Missing input pspbtcnf.bin") sys.exit(1) src_filename = args[1] if verbose: print ("src_filename: " + src_filename) print ("dst_filename: " + dst_filename) # check add_module if add_module != "": t = (re.split(":", add_module, re.I)) if len(t) != 3: print ("Bad add_module input") sys.exit(1) add_module, before_module, add_module_flag = (re.split(":", add_module, re.I)) if verbose: print ("add_module: " + add_module) print ("before_module: " + before_module) print ("add_module_flag: " + add_module_flag) if add_module != "": result = add_prx_to_bootconf(src_filename, before_module, add_module, int(add_module_flag, 16)) if dst_filename == "-": # print("Bootconf result:") # print(result) pass else: write_file(dst_filename, result) if __name__ == "__main__": main()
[ [ 8, 0, 0.022, 0.0165, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0385, 0.0055, 0, 0.66, 0.0769, 509, 0, 3, 0, 0, 509, 0, 0 ], [ 1, 0, 0.044, 0.0055, 0, 0.66, ...
[ "\"\"\"\npspbtcnf_editor: An script that add modules from pspbtcnf\n\"\"\"", "import sys, os, re", "from getopt import *", "from struct import *", "BTCNF_MAGIC=0x0F803001", "verbose = False", "def print_usage():\n\tprint (\"%s: pspbtcnf.bin [-o output.bin] [-a add_module_name:before_module_name:flag]\" ...
#!/usr/bin/python class FakeTime: def time(self): return 1225856967.109 import sys, os, struct, gzip, hashlib, StringIO gzip.time = FakeTime() def binary_replace(data, newdata, offset): return data[0:offset] + newdata + data[offset+len(newdata):] def prx_compress(output, hdr, input, mod_name="", mod_attr=0xFFFFFFFF): a=open(hdr, "rb") fileheader = a.read(); a.close() a=open(input, "rb") elf = a.read(4); a.close() if (elf != '\x7fELF'.encode()): print ("not a ELF/PRX file!") return -1 uncompsize = os.stat(input).st_size f_in=open(input, 'rb') temp=StringIO.StringIO() f=gzip.GzipFile(fileobj=temp, mode='wb') f.writelines(f_in) f.close() f_in.close() prx=temp.getvalue() temp.close() digest=hashlib.md5(prx).digest() filesize = len(fileheader) + len(prx) if mod_name != "": if len(mod_name) < 28: mod_name += "\x00" * (28-len(mod_name)) else: mod_name = mod_name[0:28] fileheader = binary_replace(fileheader, mod_name.encode(), 0xA) if mod_attr != 0xFFFFFFFF: fileheader = binary_replace(fileheader, struct.pack('H', mod_attr), 0x4) fileheader = binary_replace(fileheader, struct.pack('L', uncompsize), 0x28) fileheader = binary_replace(fileheader, struct.pack('L', filesize), 0x2c) fileheader = binary_replace(fileheader, struct.pack('L', len(prx)), 0xb0) fileheader = binary_replace(fileheader, digest, 0x140) a=open(output, "wb") assert(len(fileheader) == 0x150) a.write(fileheader) a.write(prx) a.close() try: os.remove("tmp.gz") except OSError: pass return 0 def main(): if len(sys.argv) < 4: print ("Usage: %s outfile prxhdr infile [modname] [modattr]\n"%(sys.argv[0])) exit(-1) if len(sys.argv) < 5: prx_compress(sys.argv[1], sys.argv[2], sys.argv[3]) elif len(sys.argv) < 6: prx_compress(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4]) else: prx_compress(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], int(sys.argv[5], 16)) if __name__ == "__main__": main()
[ [ 3, 0, 0.0488, 0.0366, 0, 0.66, 0, 425, 0, 1, 0, 0, 0, 0, 0 ], [ 2, 1, 0.0549, 0.0244, 1, 0.79, 0, 654, 0, 1, 1, 0, 0, 0, 0 ], [ 13, 2, 0.061, 0.0122, 2, 0.23, ...
[ "class FakeTime:\n def time(self):\n return 1225856967.109", " def time(self):\n return 1225856967.109", " return 1225856967.109", "import sys, os, struct, gzip, hashlib, StringIO", "gzip.time = FakeTime()", "def binary_replace(data, newdata, offset):\n\treturn data[0:offset] + ...
#!/usr/bin/python """ PRO build script""" import os, shutil, sys NIGHTLY=0 VERSION="B10" PRO_BUILD = [ { "fn": "620PRO-%s.rar", "config": "CONFIG_620=1" }, { "fn": "635PRO-%s.rar", "config": "CONFIG_635=1" }, { "fn": "639PRO-%s.rar", "config": "CONFIG_639=1" }, { "fn": "660PRO-%s.rar", "config": "CONFIG_660=1" }, # { "fn": "620PRO-%s.zip", "config": "CONFIG_620=1" }, # { "fn": "635PRO-%s.zip", "config": "CONFIG_635=1" }, # { "fn": "639PRO-%s.zip", "config": "CONFIG_639=1" }, # { "fn": "660PRO-%s.zip", "config": "CONFIG_660=1" }, # { "fn": "620PRO-%s.tar.gz", "config": "CONFIG_620=1" }, # { "fn": "635PRO-%s.tar.gz", "config": "CONFIG_635=1" }, # { "fn": "639PRO-%s.tar.gz", "config": "CONFIG_639=1" }, # { "fn": "660PRO-%s.tar.gz", "config": "CONFIG_660=1" }, # { "fn": "620PRO-%s.tar.bz2", "config": "CONFIG_620=1" }, # { "fn": "635PRO-%s.tar.bz2", "config": "CONFIG_635=1" }, # { "fn": "639PRO-%s.tar.bz2", "config": "CONFIG_639=1" }, # { "fn": "660PRO-%s.tar.bz2", "config": "CONFIG_660=1" }, ] OPT_FLAG = "" def build_pro(build_conf): global OPT_FLAG if NIGHTLY: build_conf += " " + "NIGHTLY=1" build_conf += " " + OPT_FLAG os.system("make clean %s" % (build_conf)) os.system("make deps %s" % (build_conf)) build_conf = "make " + build_conf os.system(build_conf) def copy_sdk(): try: os.mkdir("dist/sdk") os.mkdir("dist/sdk/lib") os.mkdir("dist/sdk/include") except OSError: pass shutil.copytree("kuBridgeTest", "dist/sdk/kuBridgeTest") shutil.copy("include/kubridge.h", "dist/sdk/include") shutil.copy("include/systemctrl.h", "dist/sdk/include") shutil.copy("include/systemctrl_se.h", "dist/sdk/include") shutil.copy("include/pspvshbridge.h", "dist/sdk/include") shutil.copy("libs/libpspkubridge.a", "dist/sdk/lib") shutil.copy("libs/libpspsystemctrl_kernel.a", "dist/sdk/lib") shutil.copy("libs/libpspsystemctrl_user.a", "dist/sdk/lib") def restore_chdir(): os.chdir(os.path.join(os.path.dirname(sys.argv[0]), "..")) def make_archive(fn): shutil.copy("credit.txt", "dist") copy_sdk() ext = os.path.splitext(fn)[-1].lower() try: os.remove(fn) except OSError: pass path = os.getcwd() os.chdir("dist"); if ext == ".rar": os.system("rar a -r ../%s ." % (fn)) elif ext == ".gz": os.system("tar -zcvf ../%s ." % (fn)) elif ext == ".bz2": os.system("tar -jcvf ../%s ." % (fn)) elif ext == ".zip": os.system("zip -r ../%s ." % (fn)) os.chdir(path) def main(): global OPT_FLAG OPT_FLAG = os.getenv("PRO_OPT_FLAG", "") restore_chdir() for conf in PRO_BUILD: build_pro(conf["config"]) make_archive(conf["fn"] % (VERSION)) if __name__ == "__main__": main()
[ [ 8, 0, 0.0297, 0.0099, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0495, 0.0099, 0, 0.66, 0.0909, 688, 0, 3, 0, 0, 688, 0, 0 ], [ 14, 0, 0.0693, 0.0099, 0, 0.6...
[ "\"\"\" PRO build script\"\"\"", "import os, shutil, sys", "NIGHTLY=0", "VERSION=\"B10\"", "PRO_BUILD = [\n\t\t\t{ \"fn\": \"620PRO-%s.rar\", \"config\": \"CONFIG_620=1\" },\n\t\t\t{ \"fn\": \"635PRO-%s.rar\", \"config\": \"CONFIG_635=1\" },\n\t\t\t{ \"fn\": \"639PRO-%s.rar\", \"config\": \"CONFIG_639=1\" }...
# -*- coding: utf-8 -*- ''' Created on 2014/01/03 @author: deadblue ''' import webapp2 import logging import template_wrapper class MainPage(webapp2.RequestHandler): def get(self): logging.info("hello!") data = { 'name' : 'world!' } template_wrapper.render_response(self.response, "index", data) app = webapp2.WSGIApplication([('/', MainPage)], debug=True)
[ [ 8, 0, 0.2, 0.25, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.4, 0.05, 0, 0.66, 0.2, 123, 0, 1, 0, 0, 123, 0, 0 ], [ 1, 0, 0.45, 0.05, 0, 0.66, 0.4, 71...
[ "'''\nCreated on 2014/01/03\n\n@author: deadblue\n'''", "import webapp2", "import logging", "import template_wrapper", "class MainPage(webapp2.RequestHandler):\n def get(self):\n logging.info(\"hello!\")\n data = {\n 'name' : 'world!'\n }\n template_wrapper.render_r...
print 'Content-Type: text/plain' print '' print 'Hello, world!'
[ [ 8, 0, 0.3333, 0.3333, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 0.6667, 0.3333, 0, 0.66, 0.5, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 1, 0.3333, 0, 0.66, 1,...
[ "print('Content-Type: text/plain')", "print('')", "print('Hello, world!')" ]
# -*- coding: utf-8 -*- ''' Created on 2014/01/03 @author: deadblue ''' import jinja2 import os template_ext = 'html' jinja2_env = jinja2.Environment(autoescape=True, extensions=['jinja2.ext.autoescape'], loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), 'template'))) def render(name, data): tpl_name = "%s.%s" % (name, template_ext) tpl = jinja2_env.get_template(tpl_name) return tpl.render(data) def render_response(response, name, data): response.headers['Content-Type'] = 'text/html' response.write(render(name, data)) pass
[ [ 8, 0, 0.1739, 0.2174, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.3043, 0.0435, 0, 0.66, 0.1667, 436, 0, 1, 0, 0, 436, 0, 0 ], [ 1, 0, 0.3478, 0.0435, 0, 0.66...
[ "'''\nCreated on 2014/01/03\n\n@author: deadblue\n'''", "import jinja2", "import os", "template_ext = 'html'", "jinja2_env = jinja2.Environment(autoescape=True, extensions=['jinja2.ext.autoescape'],\n loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), 'template')))", "def render(nam...
#! /usr/bin/env python # encoding: utf-8 # waf 1.6.10 VERSION='0.3.3' import sys APPNAME='p2t' top = '.' out = 'build' CPP_SOURCES = ['poly2tri/common/shapes.cc', 'poly2tri/sweep/cdt.cc', 'poly2tri/sweep/advancing_front.cc', 'poly2tri/sweep/sweep_context.cc', 'poly2tri/sweep/sweep.cc', 'testbed/main.cc'] from waflib.Tools.compiler_cxx import cxx_compiler cxx_compiler['win32'] = ['g++'] #Platform specific libs if sys.platform == 'win32': # MS Windows sys_libs = ['glfw', 'opengl32'] elif sys.platform == 'darwin': # Apple OSX sys_libs = ['glfw', 'OpenGL'] else: # GNU/Linux, BSD, etc sys_libs = ['glfw', 'GL'] def options(opt): print(' set_options') opt.load('compiler_cxx') def configure(conf): print(' calling the configuration') conf.load('compiler_cxx') conf.env.CXXFLAGS = ['-O3', '-ffast-math'] conf.env.DEFINES_P2T = ['P2T'] conf.env.LIB_P2T = sys_libs def build(bld): print(' building') bld.program(features = 'cxx cxxprogram', source=CPP_SOURCES, target = 'p2t', uselib = 'P2T')
[ [ 14, 0, 0.1111, 0.0222, 0, 0.66, 0, 557, 1, 0, 0, 0, 0, 3, 0 ], [ 1, 0, 0.1333, 0.0222, 0, 0.66, 0.0909, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 14, 0, 0.1556, 0.0222, 0, ...
[ "VERSION='0.3.3'", "import sys", "APPNAME='p2t'", "top = '.'", "out = 'build'", "CPP_SOURCES = ['poly2tri/common/shapes.cc',\n 'poly2tri/sweep/cdt.cc',\n 'poly2tri/sweep/advancing_front.cc',\n 'poly2tri/sweep/sweep_context.cc',\n 'poly2tri/sweep/swee...
#!/usr/bin/python import sys, hashlib def write_file(fn, buf): fp = open(fn, "wb") fp.write(buf) fp.close() def usage(): print ("Usage: " + sys.argv[0] + " infile outfile label") def main(): if( len(sys.argv) != 4): usage() sys.exit() fp = open( sys.argv[1] , "rb") hash_str = hashlib.md5( fp.read() ).hexdigest() fp.close() out_str = "u8 " + sys.argv[3] + "[16] = { " i=0 for str in hash_str: if i % 2 == 0: out_str += "0x" + str else: out_str += str if i < 31: out_str += ", " i += 1 out_str += " };" print out_str write_file( sys.argv[2] , out_str ) if __name__ == "__main__": main()
[ [ 1, 0, 0.0714, 0.0238, 0, 0.66, 0, 509, 0, 2, 0, 0, 509, 0, 0 ], [ 2, 0, 0.1548, 0.0952, 0, 0.66, 0.25, 725, 0, 2, 0, 0, 0, 0, 3 ], [ 14, 1, 0.1429, 0.0238, 1, 0.6...
[ "import sys, hashlib", "def write_file(fn, buf):\n\tfp = open(fn, \"wb\")\n\tfp.write(buf)\n\tfp.close()", "\tfp = open(fn, \"wb\")", "\tfp.write(buf)", "\tfp.close()", "def usage():\n\tprint (\"Usage: \" + sys.argv[0] + \" infile outfile label\")", "\tprint (\"Usage: \" + sys.argv[0] + \" infile outfi...
#!/usr/bin/python import sys, re, os def write_file(fn, buf): fp = open(fn, "wb") fp.write(buf) fp.close() def usage(): print ("Usage: " + os.path.split(__file__)[1] + " version outfile") def crete_version_str(ver): base = list("0.00") version = str(ver) ret = [] base[0] = version[0] base[2] = version[1] base[3] = version[2] ret.append("".join(base)) version = str(int(ver) + 1) base[0] = version[0] base[2] = version[1] base[3] = version[2] ret.append("".join(base)) return ret def main(): if( len(sys.argv) != 3): usage() sys.exit() if len( sys.argv[1]) != 3: print sys.argv[1] + ":Version error." sys.exit() fp = open( os.path.dirname(os.path.abspath(__file__)) + "/update_base.sfo" , "rb") sfo_buf = fp.read() fp.close() after_str = crete_version_str(sys.argv[1]) print "Target version:" + after_str[0] sfo_buf = re.sub("X.YZ", after_str[0], sfo_buf ) sfo_buf = re.sub("Z.YX", after_str[1], sfo_buf ) write_file( sys.argv[2] , sfo_buf ) if __name__ == "__main__": main()
[ [ 1, 0, 0.0577, 0.0192, 0, 0.66, 0, 509, 0, 3, 0, 0, 509, 0, 0 ], [ 2, 0, 0.125, 0.0769, 0, 0.66, 0.2, 725, 0, 2, 0, 0, 0, 0, 3 ], [ 14, 1, 0.1154, 0.0192, 1, 0.46,...
[ "import sys, re, os", "def write_file(fn, buf):\n\tfp = open(fn, \"wb\")\n\tfp.write(buf)\n\tfp.close()", "\tfp = open(fn, \"wb\")", "\tfp.write(buf)", "\tfp.close()", "def usage():\n\tprint (\"Usage: \" + os.path.split(__file__)[1] + \" version outfile\")", "\tprint (\"Usage: \" + os.path.split(__file...
#!/usr/bin/python import os def main(): lists = [ "ISODrivers/Galaxy/galaxy.prx", "ISODrivers/March33/march33.prx", "ISODrivers/March33/march33_620.prx", "ISODrivers/March33/march33_660.prx", "ISODrivers/Inferno/inferno.prx", "Popcorn/popcorn.prx", "Satelite/satelite.prx", "Stargate/stargate.prx", "SystemControl/systemctrl.prx", "usbdevice/usbdevice.prx", "Vshctrl/vshctrl.prx", "Recovery/recovery.prx", ] for fn in lists: path = "../" + fn name=os.path.split(fn)[-1] name=os.path.splitext(name)[0] ret = os.system("bin2c %s %s.h %s"%(path, name, name)) assert(ret == 0) if __name__ == "__main__": main()
[ [ 1, 0, 0.1034, 0.0345, 0, 0.66, 0, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 2, 0, 0.5345, 0.7586, 0, 0.66, 0.5, 624, 0, 0, 0, 0, 0, 0, 3 ], [ 14, 1, 0.431, 0.4828, 1, 0.84,...
[ "import os", "def main():\n\tlists = [\n\t\t\t\"ISODrivers/Galaxy/galaxy.prx\",\n\t\t\t\"ISODrivers/March33/march33.prx\",\n\t\t\t\"ISODrivers/March33/march33_620.prx\",\n\t\t\t\"ISODrivers/March33/march33_660.prx\",\n\t\t\t\"ISODrivers/Inferno/inferno.prx\",\n\t\t\t\"Popcorn/popcorn.prx\",", "\tlists = [\n\t\t...
#!/usr/bin/python class FakeTime: def time(self): return 1225856967.109 import os, gzip, StringIO gzip.time = FakeTime() def create_gzip(input, output): f_in=open(input, 'rb') temp=StringIO.StringIO() f=gzip.GzipFile(fileobj=temp, mode='wb') f.writelines(f_in) f.close() f_in.close() fout=open(output, 'wb') temp.seek(0) fout.writelines(temp) fout.close() temp.close() def cleanup(): del_list = [ "installer.prx.gz", "Rebootex.prx.gz", ] for file in del_list: try: os.remove(file) except OSError: pass def main(): create_gzip("../../Installer/installer.prx", "installer.prx.gz") create_gzip("../../Rebootex/Rebootex.prx", "Rebootex.prx.gz") os.system("bin2c installer.prx.gz installer.h installer") os.system("bin2c Rebootex.prx.gz Rebootex_prx.h Rebootex_prx") cleanup() if __name__ == "__main__": main()
[ [ 3, 0, 0.0909, 0.0682, 0, 0.66, 0, 425, 0, 1, 0, 0, 0, 0, 0 ], [ 2, 1, 0.1023, 0.0455, 1, 0.35, 0, 654, 0, 1, 1, 0, 0, 0, 0 ], [ 13, 2, 0.1136, 0.0227, 2, 0.09, ...
[ "class FakeTime:\n def time(self):\n return 1225856967.109", " def time(self):\n return 1225856967.109", " return 1225856967.109", "import os, gzip, StringIO", "gzip.time = FakeTime()", "def create_gzip(input, output):\n\tf_in=open(input, 'rb')\n\ttemp=StringIO.StringIO()\n\tf=g...
#!/usr/bin/python import os, sys, getopt def usage(): print ("Usage: %s [-l size ] basefile input output" % (sys.argv[0])) def write_file(fn, buf): fp = open(fn, "wb") fp.write(buf) fp.close() def main(): inputsize = 0 try: optlist, args = getopt.getopt(sys.argv[1:], 'l:h') except getopt.GetoptError: usage() sys.exit(2) for o, a in optlist: if o == "-h": usage() sys.exit() if o == "-l": inputsize = int(a, 16) inputsize = max(inputsize, 0x4000); if len(args) < 3: usage() sys.exit(2) basefile = args[0] inputfile = args[1] outputfile = args[2] fp = open(basefile, "rb") buf = fp.read(0x1000) fp.close() if len(buf) < inputsize: buf += b'\0' * (inputsize - len(buf)) assert(len(buf) == inputsize) fp = open(inputfile, "rb") ins = fp.read(0x3000) fp.close() buf = buf[0:0x1000] + ins + buf[0x1000+len(ins):] assert(len(buf) == inputsize) write_file(outputfile, buf) if __name__ == "__main__": main()
[ [ 1, 0, 0.0536, 0.0179, 0, 0.66, 0, 688, 0, 3, 0, 0, 688, 0, 0 ], [ 2, 0, 0.0982, 0.0357, 0, 0.66, 0.25, 129, 0, 0, 0, 0, 0, 0, 1 ], [ 8, 1, 0.1071, 0.0179, 1, 0.47...
[ "import os, sys, getopt", "def usage():\n\tprint (\"Usage: %s [-l size ] basefile input output\" % (sys.argv[0]))", "\tprint (\"Usage: %s [-l size ] basefile input output\" % (sys.argv[0]))", "def write_file(fn, buf):\n\tfp = open(fn, \"wb\")\n\tfp.write(buf)\n\tfp.close()", "\tfp = open(fn, \"wb\")", "\t...
#!/usr/bin/python from hashlib import * import sys, struct def sha512(psid): if len(psid) != 16: return "".encode() for i in range(512): psid = sha1(psid).digest() return psid def get_psid(str): if len(str) != 32: return "".encode() b = "".encode() for i in range(0, len(str), 2): b += struct.pack('B', int(str[i] + str[i+1], 16)) return b def main(): if len(sys.argv) < 2: print ("Usage: sha512.py psid") exit(0) psid = get_psid(sys.argv[1]) xhash = sha512(psid) if len(xhash) == 0: print ("wrong PSID") exit(0) print ("{\n\t"), for i in range(len(xhash)): if i != 0 and i % 8 == 0: print ("\n\t"), print ("0x%02X, "%(struct.unpack('B', xhash[i])[0])), print ("\n},") if __name__ == "__main__": main()
[ [ 1, 0, 0.0652, 0.0217, 0, 0.66, 0, 154, 0, 1, 0, 0, 154, 0, 0 ], [ 1, 0, 0.087, 0.0217, 0, 0.66, 0.2, 509, 0, 2, 0, 0, 509, 0, 0 ], [ 2, 0, 0.2065, 0.1739, 0, 0.66...
[ "from hashlib import *", "import sys, struct", "def sha512(psid):\n\tif len(psid) != 16:\n\t\treturn \"\".encode()\n\n\tfor i in range(512):\n\t\tpsid = sha1(psid).digest()\n\n\treturn psid", "\tif len(psid) != 16:\n\t\treturn \"\".encode()", "\t\treturn \"\".encode()", "\tfor i in range(512):\n\t\tpsid =...
#!/usr/bin/python import sys, os, gzip, StringIO def dump_binary(fn, data): f = open(fn, "wb") f.write(data) f.close() def dec_prx(fn): f = open(fn, "rb") f.seek(0x150) dat = f.read() f.close() temp=StringIO.StringIO(dat) f=gzip.GzipFile(fileobj=temp, mode='rb') dec = f.read(f) f.close() fn = "%s.dec.prx" % os.path.splitext(fn)[0] print ("Decompressed to %s" %(fn)) dump_binary(fn, dec) def main(): if len(sys.argv) < 2: print ("Usage: %s <file>" % (sys.argv[0])) sys.exit(-1) dec_prx(sys.argv[1]) if __name__ == "__main__": main()
[ [ 1, 0, 0.0909, 0.0303, 0, 0.66, 0, 509, 0, 4, 0, 0, 509, 0, 0 ], [ 2, 0, 0.197, 0.1212, 0, 0.66, 0.25, 336, 0, 2, 0, 0, 0, 0, 3 ], [ 14, 1, 0.1818, 0.0303, 1, 0.87...
[ "import sys, os, gzip, StringIO", "def dump_binary(fn, data):\n\tf = open(fn, \"wb\")\n\tf.write(data)\n\tf.close()", "\tf = open(fn, \"wb\")", "\tf.write(data)", "\tf.close()", "def dec_prx(fn):\n\tf = open(fn, \"rb\")\n\tf.seek(0x150)\n\tdat = f.read()\n\tf.close()\n\n\ttemp=StringIO.StringIO(dat)\n\tf=...
#!/usr/bin/python import sys, hashlib def toNID(name): hashstr = hashlib.sha1(name.encode()).hexdigest().upper() return "0x" + hashstr[6:8] + hashstr[4:6] + hashstr[2:4] + hashstr[0:2] if __name__ == "__main__": assert(toNID("sceKernelCpuSuspendIntr") == "0x092968F4") for name in sys.argv[1:]: print ("%s: %s"%(name, toNID(name)))
[ [ 1, 0, 0.2308, 0.0769, 0, 0.66, 0, 509, 0, 2, 0, 0, 509, 0, 0 ], [ 2, 0, 0.4615, 0.2308, 0, 0.66, 0.5, 259, 0, 1, 1, 0, 0, 0, 4 ], [ 14, 1, 0.4615, 0.0769, 1, 0.97...
[ "import sys, hashlib", "def toNID(name):\n\thashstr = hashlib.sha1(name.encode()).hexdigest().upper()\n\treturn \"0x\" + hashstr[6:8] + hashstr[4:6] + hashstr[2:4] + hashstr[0:2]", "\thashstr = hashlib.sha1(name.encode()).hexdigest().upper()", "\treturn \"0x\" + hashstr[6:8] + hashstr[4:6] + hashstr[2:4] + ha...
#!/usr/bin/python """ pspbtcnf_editor: An script that add modules from pspbtcnf """ import sys, os, re from getopt import * from struct import * BTCNF_MAGIC=0x0F803001 verbose = False def print_usage(): print ("%s: pspbtcnf.bin [-o output.bin] [-a add_module_name:before_module_name:flag]" %(os.path.split(sys.argv[0]))[-1]) def replace_binary(data, offset, newdata): newdata = data[0:offset] + newdata + data[offset+len(newdata):] assert(len(data) == len(newdata)) return newdata def dump_binary(data, offset, size): newdata = data[offset:offset+size] assert(len(newdata) == size) return newdata def dump_binary_str(data, offset): ch = data[offset] tmp = b'' while ch != 0: tmp += pack('b', ch) offset += 1 ch = data[offset] return tmp.decode() def add_prx_to_bootconf(srcfn, before_modname, modname, modflag): "Return new bootconf data" fn=open(srcfn, "rb") bootconf = fn.read() fn.close() if len(bootconf) < 64: raise Exception("Bad bootconf") signature, devkit, modestart, nmodes, modulestart, nmodules, modnamestart, modnameend = unpack('LL8xLL8xLL8xLL8x', bootconf[:64]) if verbose: print ("Devkit: 0x%08X"%(devkit)) print ("modestart: 0x%08X"%(modestart)) print ("nmodes: %d"%(nmodes)) print ("modulestart: 0x%08X"%(modulestart)) print ("nmodules: 0x%08X"%(nmodules)) print ("modnamestart: 0x%08X"%(modnamestart)) print ("modnameend: 0x%08X"%(modnameend)) if signature != BTCNF_MAGIC or nmodules <= 0 or nmodes <= 0: raise Exception("Bad bootconf") bootconf = bootconf + modname.encode() + b'\0' modnameend += len(modname) + 1 i=0 while i < nmodules: module_path, module_flags = unpack('L4xL4x16x', bootconf[modulestart+i*32:modulestart+(i+1)*32]) module_name = dump_binary_str(bootconf, modnamestart+module_path) if verbose: print ("[%02d]: Module path: %s flag: 0x%08X"%(i, module_name, module_flags)) if before_modname == module_name: break i+=1 if i >= nmodules: raise Exception("module %s not found"%(before_modname)) module_path = modnameend - len(modname) - 1 - modnamestart module_flag = 0x80010000 | (modflag & 0xFFFF) newmod = dump_binary(bootconf, modulestart+i*32, 32) newmod = replace_binary(newmod, 0, pack('L', module_path)) newmod = replace_binary(newmod, 8, pack('L', module_flag)) bootconf = bootconf[0:modulestart+i*32] + newmod + bootconf[modulestart+i*32:] nmodules+=1 bootconf = replace_binary(bootconf, 0x24, pack('L', nmodules)) modnamestart += 32 bootconf = replace_binary(bootconf, 0x30, pack('L', modnamestart)) modnameend += 32 bootconf = replace_binary(bootconf, 0x34, pack('L', modnameend)) i = 0 while i < nmodes: num = unpack('H', bootconf[modestart+i*32:modestart+i*32+2])[0] num += 1 bootconf = replace_binary(bootconf, modestart + i * 32, pack('H', num)) i += 1 return bootconf def write_file(output_fn, data): fn = open(output_fn, "wb") fn.write(data) fn.close() def main(): global verbose try: optlist, args = gnu_getopt(sys.argv, "a:o:vh") except GetoptError as err: print(err) print_usage() sys.exit(1) # default configure verbose = False dst_filename = "-" add_module = "" for o, a in optlist: if o == "-v": verbose = True elif o == "-h": print_usage() sys.exit() elif o == "-o": dst_filename = a elif o == "-a": add_module = a else: assert False, "unhandled option" if verbose: print (optlist, args) if len(args) < 2: print ("Missing input pspbtcnf.bin") sys.exit(1) src_filename = args[1] if verbose: print ("src_filename: " + src_filename) print ("dst_filename: " + dst_filename) # check add_module if add_module != "": t = (re.split(":", add_module, re.I)) if len(t) != 3: print ("Bad add_module input") sys.exit(1) add_module, before_module, add_module_flag = (re.split(":", add_module, re.I)) if verbose: print ("add_module: " + add_module) print ("before_module: " + before_module) print ("add_module_flag: " + add_module_flag) if add_module != "": result = add_prx_to_bootconf(src_filename, before_module, add_module, int(add_module_flag, 16)) if dst_filename == "-": # print("Bootconf result:") # print(result) pass else: write_file(dst_filename, result) if __name__ == "__main__": main()
[ [ 8, 0, 0.022, 0.0165, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0385, 0.0055, 0, 0.66, 0.0769, 509, 0, 3, 0, 0, 509, 0, 0 ], [ 1, 0, 0.044, 0.0055, 0, 0.66, ...
[ "\"\"\"\npspbtcnf_editor: An script that add modules from pspbtcnf\n\"\"\"", "import sys, os, re", "from getopt import *", "from struct import *", "BTCNF_MAGIC=0x0F803001", "verbose = False", "def print_usage():\n\tprint (\"%s: pspbtcnf.bin [-o output.bin] [-a add_module_name:before_module_name:flag]\" ...
#!/usr/bin/python class FakeTime: def time(self): return 1225856967.109 import sys, os, struct, gzip, hashlib, StringIO gzip.time = FakeTime() def binary_replace(data, newdata, offset): return data[0:offset] + newdata + data[offset+len(newdata):] def prx_compress(output, hdr, input, mod_name="", mod_attr=0xFFFFFFFF): a=open(hdr, "rb") fileheader = a.read(); a.close() a=open(input, "rb") elf = a.read(4); a.close() if (elf != '\x7fELF'.encode()): print ("not a ELF/PRX file!") return -1 uncompsize = os.stat(input).st_size f_in=open(input, 'rb') temp=StringIO.StringIO() f=gzip.GzipFile(fileobj=temp, mode='wb') f.writelines(f_in) f.close() f_in.close() prx=temp.getvalue() temp.close() digest=hashlib.md5(prx).digest() filesize = len(fileheader) + len(prx) if mod_name != "": if len(mod_name) < 28: mod_name += "\x00" * (28-len(mod_name)) else: mod_name = mod_name[0:28] fileheader = binary_replace(fileheader, mod_name.encode(), 0xA) if mod_attr != 0xFFFFFFFF: fileheader = binary_replace(fileheader, struct.pack('H', mod_attr), 0x4) fileheader = binary_replace(fileheader, struct.pack('L', uncompsize), 0x28) fileheader = binary_replace(fileheader, struct.pack('L', filesize), 0x2c) fileheader = binary_replace(fileheader, struct.pack('L', len(prx)), 0xb0) fileheader = binary_replace(fileheader, digest, 0x140) a=open(output, "wb") assert(len(fileheader) == 0x150) a.write(fileheader) a.write(prx) a.close() try: os.remove("tmp.gz") except OSError: pass return 0 def main(): if len(sys.argv) < 4: print ("Usage: %s outfile prxhdr infile [modname] [modattr]\n"%(sys.argv[0])) exit(-1) if len(sys.argv) < 5: prx_compress(sys.argv[1], sys.argv[2], sys.argv[3]) elif len(sys.argv) < 6: prx_compress(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4]) else: prx_compress(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], int(sys.argv[5], 16)) if __name__ == "__main__": main()
[ [ 3, 0, 0.0488, 0.0366, 0, 0.66, 0, 425, 0, 1, 0, 0, 0, 0, 0 ], [ 2, 1, 0.0549, 0.0244, 1, 0.38, 0, 654, 0, 1, 1, 0, 0, 0, 0 ], [ 13, 2, 0.061, 0.0122, 2, 0.09, ...
[ "class FakeTime:\n def time(self):\n return 1225856967.109", " def time(self):\n return 1225856967.109", " return 1225856967.109", "import sys, os, struct, gzip, hashlib, StringIO", "gzip.time = FakeTime()", "def binary_replace(data, newdata, offset):\n\treturn data[0:offset] + ...
#!/usr/bin/python """ PRO build script""" import os, shutil, sys NIGHTLY=0 VERSION="B10" PRO_BUILD = [ { "fn": "620PRO-%s.rar", "config": "CONFIG_620=1" }, { "fn": "635PRO-%s.rar", "config": "CONFIG_635=1" }, { "fn": "639PRO-%s.rar", "config": "CONFIG_639=1" }, { "fn": "660PRO-%s.rar", "config": "CONFIG_660=1" }, # { "fn": "620PRO-%s.zip", "config": "CONFIG_620=1" }, # { "fn": "635PRO-%s.zip", "config": "CONFIG_635=1" }, # { "fn": "639PRO-%s.zip", "config": "CONFIG_639=1" }, # { "fn": "660PRO-%s.zip", "config": "CONFIG_660=1" }, # { "fn": "620PRO-%s.tar.gz", "config": "CONFIG_620=1" }, # { "fn": "635PRO-%s.tar.gz", "config": "CONFIG_635=1" }, # { "fn": "639PRO-%s.tar.gz", "config": "CONFIG_639=1" }, # { "fn": "660PRO-%s.tar.gz", "config": "CONFIG_660=1" }, # { "fn": "620PRO-%s.tar.bz2", "config": "CONFIG_620=1" }, # { "fn": "635PRO-%s.tar.bz2", "config": "CONFIG_635=1" }, # { "fn": "639PRO-%s.tar.bz2", "config": "CONFIG_639=1" }, # { "fn": "660PRO-%s.tar.bz2", "config": "CONFIG_660=1" }, ] OPT_FLAG = "" def build_pro(build_conf): global OPT_FLAG if NIGHTLY: build_conf += " " + "NIGHTLY=1" build_conf += " " + OPT_FLAG os.system("make clean %s" % (build_conf)) os.system("make deps %s" % (build_conf)) build_conf = "make " + build_conf os.system(build_conf) def copy_sdk(): try: os.mkdir("dist/sdk") os.mkdir("dist/sdk/lib") os.mkdir("dist/sdk/include") except OSError: pass shutil.copytree("kuBridgeTest", "dist/sdk/kuBridgeTest") shutil.copy("include/kubridge.h", "dist/sdk/include") shutil.copy("include/systemctrl.h", "dist/sdk/include") shutil.copy("include/systemctrl_se.h", "dist/sdk/include") shutil.copy("include/pspvshbridge.h", "dist/sdk/include") shutil.copy("libs/libpspkubridge.a", "dist/sdk/lib") shutil.copy("libs/libpspsystemctrl_kernel.a", "dist/sdk/lib") shutil.copy("libs/libpspsystemctrl_user.a", "dist/sdk/lib") def restore_chdir(): os.chdir(os.path.join(os.path.dirname(sys.argv[0]), "..")) def make_archive(fn): shutil.copy("credit.txt", "dist") copy_sdk() ext = os.path.splitext(fn)[-1].lower() try: os.remove(fn) except OSError: pass path = os.getcwd() os.chdir("dist"); if ext == ".rar": os.system("rar a -r ../%s ." % (fn)) elif ext == ".gz": os.system("tar -zcvf ../%s ." % (fn)) elif ext == ".bz2": os.system("tar -jcvf ../%s ." % (fn)) elif ext == ".zip": os.system("zip -r ../%s ." % (fn)) os.chdir(path) def main(): global OPT_FLAG OPT_FLAG = os.getenv("PRO_OPT_FLAG", "") restore_chdir() for conf in PRO_BUILD: build_pro(conf["config"]) make_archive(conf["fn"] % (VERSION)) if __name__ == "__main__": main()
[ [ 8, 0, 0.0297, 0.0099, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0495, 0.0099, 0, 0.66, 0.0909, 688, 0, 3, 0, 0, 688, 0, 0 ], [ 14, 0, 0.0693, 0.0099, 0, 0.6...
[ "\"\"\" PRO build script\"\"\"", "import os, shutil, sys", "NIGHTLY=0", "VERSION=\"B10\"", "PRO_BUILD = [\n\t\t\t{ \"fn\": \"620PRO-%s.rar\", \"config\": \"CONFIG_620=1\" },\n\t\t\t{ \"fn\": \"635PRO-%s.rar\", \"config\": \"CONFIG_635=1\" },\n\t\t\t{ \"fn\": \"639PRO-%s.rar\", \"config\": \"CONFIG_639=1\" }...
#Boa:Frame:IncomingRequestFrame import wx from request import * import logging from request import * #get the logger instance for this app logger = logging.getLogger('provinci') def create(parent, request): return IncomingRequestFrame(parent, request) [wxID_INCOMINGREQUESTFRAME, wxID_INCOMINGREQUESTFRAMEACCEPTBUTTON, wxID_INCOMINGREQUESTFRAMEDECLINEBUTTON, wxID_INCOMINGREQUESTFRAMEFILESETLISTBOX, wxID_INCOMINGREQUESTFRAMEPANEL1, wxID_INCOMINGREQUESTFRAMESTATICTEXT1, wxID_INCOMINGREQUESTFRAMESTATICTEXT2, wxID_INCOMINGREQUESTFRAMEUSERTEXTCTRL, ] = [wx.NewId() for _init_ctrls in range(8)] class IncomingRequestFrame(wx.Frame): def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_INCOMINGREQUESTFRAME, name=u'IncomingRequestFrame', parent=prnt, pos=wx.Point(634, 225), size=wx.Size(578, 544), style=wx.DEFAULT_FRAME_STYLE, title=u'Incoming request') self.SetClientSize(wx.Size(570, 517)) self.panel1 = wx.Panel(id=wxID_INCOMINGREQUESTFRAMEPANEL1, name='panel1', parent=self, pos=wx.Point(0, 0), size=wx.Size(570, 517), style=wx.TAB_TRAVERSAL) self.userTextCtrl = wx.TextCtrl(id=wxID_INCOMINGREQUESTFRAMEUSERTEXTCTRL, name=u'userTextCtrl', parent=self.panel1, pos=wx.Point(64, 48), size=wx.Size(456, 128), style=wx.TE_MULTILINE, value=u'') self.userTextCtrl.SetEditable(False) self.acceptButton = wx.Button(id=wxID_INCOMINGREQUESTFRAMEACCEPTBUTTON, label=u'Accept...', name=u'acceptButton', parent=self.panel1, pos=wx.Point(64, 464), size=wx.Size(75, 23), style=0) self.acceptButton.Bind(wx.EVT_LEFT_UP, self.OnAcceptButtonLeftUp) self.declineButton = wx.Button(id=wxID_INCOMINGREQUESTFRAMEDECLINEBUTTON, label=u'Decline...', name=u'declineButton', parent=self.panel1, pos=wx.Point(448, 464), size=wx.Size(75, 23), style=0) self.declineButton.Bind(wx.EVT_LEFT_UP, self.OnDeclineButtonLeftUp) self.staticText1 = wx.StaticText(id=wxID_INCOMINGREQUESTFRAMESTATICTEXT1, label=u'User', name='staticText1', parent=self.panel1, pos=wx.Point(72, 32), size=wx.Size(22, 13), style=0) self.staticText2 = wx.StaticText(id=wxID_INCOMINGREQUESTFRAMESTATICTEXT2, label=u'Requested files', name='staticText2', parent=self.panel1, pos=wx.Point(72, 216), size=wx.Size(74, 13), style=0) self.filesetListBox = wx.ListBox(choices=[], id=wxID_INCOMINGREQUESTFRAMEFILESETLISTBOX, name=u'filesetListBox', parent=self.panel1, pos=wx.Point(64, 232), size=wx.Size(456, 224), style=0) def __init__(self, parent, request): self._init_ctrls(parent) self.parent = parent self.request = request self.userTextCtrl.Value = str(request.requester) self.filesetListBox.SetItems([str(fileset) for fileset in request.filesets]) self.Bind(wx.EVT_LISTBOX_DCLICK, self.filesetListBoxDoubleClick, self.filesetListBox) def filesetListBoxDoubleClick(self, event): index = self.filesetListBox.GetSelection() fileset = self.request.filesets[index] dlg = wx.MessageDialog(self, str(fileset), 'File request', wx.OK | wx.ICON_INFORMATION) dlg.ShowModal() dlg.Destroy() def OnAcceptButtonLeftUp(self, event): dlg = wx.TextEntryDialog(self, 'Please enter your response', 'Response', 'No comment') dlg.SetValue("No comment") if dlg.ShowModal() == wx.ID_OK: response = Response(self.request.guid, dlg.GetValue()) self.parent.sendResponse(response) self.Close() dlg.Destroy() event.Skip() def OnDeclineButtonLeftUp(self, event): event.Skip()
[ [ 1, 0, 0.0333, 0.0111, 0, 0.66, 0, 666, 0, 1, 0, 0, 666, 0, 0 ], [ 1, 0, 0.0444, 0.0111, 0, 0.66, 0.1429, 50, 0, 1, 0, 0, 50, 0, 0 ], [ 1, 0, 0.0556, 0.0111, 0, 0....
[ "import wx", "from request import *", "import logging", "from request import *", "logger = logging.getLogger('provinci')", "def create(parent, request):\n return IncomingRequestFrame(parent, request)", " return IncomingRequestFrame(parent, request)", "[wxID_INCOMINGREQUESTFRAME, wxID_INCOMINGREQ...
import yaml from datetime import datetime import logging import pythoncom #get the logger instance for this app logger = logging.getLogger('provinci') class Request(object): def __init__(self, requester): self.guid = str(pythoncom.CreateGuid()) self.timestamp = datetime.now() self.requester = requester self.filesets = [] def __str__(self): return '%s - %s: %s' % (self.timestamp, self.requester,self.filesets) class Requester(object): def __init__(self, given, family, address): self.given = given self.family = family self.address = address def __str__(self): return '%s %s, %s' % (self.given, self.family, self.address) class FileSet(object): def __init__(self, description, comment): self.description = description self.comment = comment def __str__(self): return '%s: %s' % (self.description, self.comment) class Response(object): def __init__(self, guid, response): self.guid = guid self.response = response def __str__(self): return '%s' % (self.response) if __name__ == '__main__': #TEST requester = Requester('berco', 'beute', 'marnelaan') fileset = FileSet('wicked discription', 'Some bogus comment') request = Request(requester) request.filesets.append(fileset) print yaml.dump(request, default_flow_style=False)
[ [ 1, 0, 0.0182, 0.0182, 0, 0.66, 0, 960, 0, 1, 0, 0, 960, 0, 0 ], [ 1, 0, 0.0364, 0.0182, 0, 0.66, 0.1111, 426, 0, 1, 0, 0, 426, 0, 0 ], [ 1, 0, 0.0545, 0.0182, 0, ...
[ "import yaml", "from datetime import datetime", "import logging", "import pythoncom", "logger = logging.getLogger('provinci')", "class Request(object):\n \n def __init__(self, requester):\n self.guid = str(pythoncom.CreateGuid())\n self.timestamp = datetime.now()\n self.requeste...
#!/usr/bin/env python #Boa:App:BoaApp import sys import wx import logging import MainFrame logger = logging.getLogger('provinci') modules ={u'IncomingRequestFrame': [0, '', u'IncomingRequestFrame.py'], u'MainFrame': [1, 'Main frame of Application', u'MainFrame.py'], u'RequestFrame': [0, '', u'RequestFrame.py']} class BoaApp(wx.App): def OnInit(self): self.setupLogging() self.main = MainFrame.create(None) self.main.Show() self.SetTopWindow(self.main) return True def setupLogging(self):# Set up logging formatter = logging.Formatter('=%(filename)-30s%(levelname)-10s%(message)s') consoleHandler = logging.StreamHandler() consoleHandler.setFormatter(formatter) logger.addHandler(consoleHandler) logger.setLevel(logging.DEBUG) logger.debug('Logging started...') def main(): application = BoaApp(0) application.MainLoop() if __name__ == '__main__': if len(sys.argv) > 0: logger.debug('======' + sys.argv[0]) username = sys.argv[0] main()
[ [ 1, 0, 0.1026, 0.0256, 0, 0.66, 0, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 1, 0, 0.1282, 0.0256, 0, 0.66, 0.125, 666, 0, 1, 0, 0, 666, 0, 0 ], [ 1, 0, 0.1538, 0.0256, 0, 0...
[ "import sys", "import wx", "import logging", "import MainFrame", "logger = logging.getLogger('provinci')", "modules ={u'IncomingRequestFrame': [0, '', u'IncomingRequestFrame.py'],\n u'MainFrame': [1, 'Main frame of Application', u'MainFrame.py'],\n u'RequestFrame': [0, '', u'RequestFrame.py']}", "class ...
#Boa:Frame:requestFrame import wx import logging from request import * #get the logger instance for this app logger = logging.getLogger('provinci') def create(parent): return requestFrame(parent) [wxID_REQUESTFRAME, wxID_REQUESTFRAMEADDBUTTON, wxID_REQUESTFRAMEADDRESSTEXTCTRL, wxID_REQUESTFRAMECANCELBUTTON, wxID_REQUESTFRAMECOMMENTTEXTCTRL, wxID_REQUESTFRAMEDESCRTEXTCTRL, wxID_REQUESTFRAMEEDITBUTTON, wxID_REQUESTFRAMEFAMILYNAMETEXTCTRL, wxID_REQUESTFRAMEFILESTATICBOX, wxID_REQUESTFRAMEGIVENTEXTCTRL, wxID_REQUESTFRAMELISTBOX, wxID_REQUESTFRAMEOKBUTTON, wxID_REQUESTFRAMEPANEL1, wxID_REQUESTFRAMEREMOVEBUTTON, wxID_REQUESTFRAMESTATICTEXT1, wxID_REQUESTFRAMESTATICTEXT2, wxID_REQUESTFRAMESTATICTEXT3, wxID_REQUESTFRAMESTATICTEXT4, wxID_REQUESTFRAMESTATICTEXT5, wxID_REQUESTFRAMEYOUSTATICBOX, ] = [wx.NewId() for _init_ctrls in range(20)] class requestFrame(wx.Frame): def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_REQUESTFRAME, name=u'requestFrame', parent=prnt, pos=wx.Point(685, 201), size=wx.Size(593, 785), style=wx.DEFAULT_FRAME_STYLE, title=u'Request') self.SetClientSize(wx.Size(585, 758)) self.panel1 = wx.Panel(id=wxID_REQUESTFRAMEPANEL1, name='panel1', parent=self, pos=wx.Point(0, 0), size=wx.Size(585, 758), style=wx.TAB_TRAVERSAL) self.staticText1 = wx.StaticText(id=wxID_REQUESTFRAMESTATICTEXT1, label=u'Comment', name='staticText1', parent=self.panel1, pos=wx.Point(48, 456), size=wx.Size(45, 13), style=0) self.staticText2 = wx.StaticText(id=wxID_REQUESTFRAMESTATICTEXT2, label=u'Address', name='staticText2', parent=self.panel1, pos=wx.Point(48, 120), size=wx.Size(39, 13), style=0) self.staticText4 = wx.StaticText(id=wxID_REQUESTFRAMESTATICTEXT4, label=u'Family name', name='staticText4', parent=self.panel1, pos=wx.Point(48, 88), size=wx.Size(59, 13), style=0) self.staticText3 = wx.StaticText(id=wxID_REQUESTFRAMESTATICTEXT3, label=u'Given name', name='staticText3', parent=self.panel1, pos=wx.Point(48, 64), size=wx.Size(56, 13), style=0) self.givenTextCtrl = wx.TextCtrl(id=wxID_REQUESTFRAMEGIVENTEXTCTRL, name=u'givenTextCtrl', parent=self.panel1, pos=wx.Point(120, 56), size=wx.Size(400, 21), style=0, value=u'') self.familyNameTextCtrl = wx.TextCtrl(id=wxID_REQUESTFRAMEFAMILYNAMETEXTCTRL, name=u'familyNameTextCtrl', parent=self.panel1, pos=wx.Point(120, 88), size=wx.Size(399, 21), style=0, value=u'') self.addressTextCtrl = wx.TextCtrl(id=wxID_REQUESTFRAMEADDRESSTEXTCTRL, name=u'addressTextCtrl', parent=self.panel1, pos=wx.Point(120, 120), size=wx.Size(400, 104), style=wx.TE_MULTILINE, value=u'') self.staticText5 = wx.StaticText(id=wxID_REQUESTFRAMESTATICTEXT5, label=u'Description', name='staticText5', parent=self.panel1, pos=wx.Point(48, 416), size=wx.Size(53, 13), style=0) self.descrTextCtrl = wx.TextCtrl(id=wxID_REQUESTFRAMEDESCRTEXTCTRL, name=u'descrTextCtrl', parent=self.panel1, pos=wx.Point(120, 416), size=wx.Size(400, 21), style=0, value=u'') self.commentTextCtrl = wx.TextCtrl(id=wxID_REQUESTFRAMECOMMENTTEXTCTRL, name=u'commentTextCtrl', parent=self.panel1, pos=wx.Point(120, 448), size=wx.Size(400, 152), style=wx.TE_MULTILINE, value=u'') self.addButton = wx.Button(id=wxID_REQUESTFRAMEADDBUTTON, label=u'add', name=u'addButton', parent=self.panel1, pos=wx.Point(448, 616), size=wx.Size(75, 23), style=0) self.addButton.Bind(wx.EVT_LEFT_UP, self.OnAddButtonLeftUp) self.editButton = wx.Button(id=wxID_REQUESTFRAMEEDITBUTTON, label=u'Edit', name=u'editButton', parent=self.panel1, pos=wx.Point(120, 352), size=wx.Size(75, 23), style=0) self.editButton.Bind(wx.EVT_LEFT_UP, self.OnEditButtonLeftUp) self.removeButton = wx.Button(id=wxID_REQUESTFRAMEREMOVEBUTTON, label=u'Remove', name=u'removeButton', parent=self.panel1, pos=wx.Point(448, 352), size=wx.Size(75, 23), style=0) self.removeButton.Bind(wx.EVT_LEFT_UP, self.OnRemoveButtonLeftUp) self.fileStaticBox = wx.StaticBox(id=wxID_REQUESTFRAMEFILESTATICBOX, label=u'Fileset', name=u'fileStaticBox', parent=self.panel1, pos=wx.Point(40, 392), size=wx.Size(496, 264), style=0) self.youStaticBox = wx.StaticBox(id=wxID_REQUESTFRAMEYOUSTATICBOX, label=u'You', name=u'youStaticBox', parent=self.panel1, pos=wx.Point(40, 32), size=wx.Size(496, 200), style=0) self.okButton = wx.Button(id=wxID_REQUESTFRAMEOKBUTTON, label=u'OK', name=u'okButton', parent=self.panel1, pos=wx.Point(200, 696), size=wx.Size(75, 23), style=0) self.okButton.Bind(wx.EVT_LEFT_UP, self.OnOkButtonLeftUp) self.cancelButton = wx.Button(id=wxID_REQUESTFRAMECANCELBUTTON, label=u'Cancel', name=u'cancelButton', parent=self.panel1, pos=wx.Point(304, 696), size=wx.Size(75, 23), style=0) self.cancelButton.Bind(wx.EVT_LEFT_UP, self.OnCancelButtonLeftUp) self.listBox = wx.ListBox(choices=[], id=wxID_REQUESTFRAMELISTBOX, name=u'listBox', parent=self.panel1, pos=wx.Point(120, 248), size=wx.Size(400, 96), style=wx.VSCROLL | wx.LB_SINGLE) self.listBox.SetLabel(u'File sets') self.listBox.SetSelection(-1) def __init__(self, parent): self._init_ctrls(parent) self.filesets = [] self.parent = parent def addFileSet(self, fileset): self.filesets.append(fileset) self.listBox.SetItems([str(fileset) for fileset in self.filesets]) def removeFileSet(self, index): del self.filesets[index] self.listBox.SetItems([fileset.description for fileset in self.filesets]) #---Event Handlers---------------------------------------------------------------------------- def OnOkButtonLeftUp(self, event): requester = Requester(self.givenTextCtrl.Value, self.familyNameTextCtrl.Value, self.addressTextCtrl.Value) request = Request(requester) request.filesets = self.filesets self.parent.sendRequest(request) self.Close() event.Skip() def OnCancelButtonLeftUp(self, event): self.Close() event.Skip() def OnAddButtonLeftUp(self, event): fileset = FileSet(self.descrTextCtrl.Value, self.commentTextCtrl.Value) self.descrTextCtrl.Clear() self.commentTextCtrl.Clear() self.addFileSet(fileset) event.Skip() def OnEditButtonLeftUp(self, event): index = self.listBox.GetSelection() fileset = self.filesets[index] self.descrTextCtrl.Value = fileset.description self.commentTextCtrl.Value = fileset.comment self.removeFileSet(index) event.Skip() def OnRemoveButtonLeftUp(self, event): selection = self.listBox.GetSelection() if selection >= 0: self.listBox.Delete(selection) event.Skip()
[ [ 1, 0, 0.0184, 0.0061, 0, 0.66, 0, 666, 0, 1, 0, 0, 666, 0, 0 ], [ 1, 0, 0.0245, 0.0061, 0, 0.66, 0.1667, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.0307, 0.0061, 0, ...
[ "import wx", "import logging", "from request import *", "logger = logging.getLogger('provinci')", "def create(parent):\n return requestFrame(parent)", " return requestFrame(parent)", "[wxID_REQUESTFRAME, wxID_REQUESTFRAMEADDBUTTON, \n wxID_REQUESTFRAMEADDRESSTEXTCTRL, wxID_REQUESTFRAMECANCELBUTTON...
#!/usr/bin/env python #Boa:App:BoaApp import sys import wx import logging import MainFrame logger = logging.getLogger('provinci') modules ={u'IncomingRequestFrame': [0, '', u'IncomingRequestFrame.py'], u'MainFrame': [1, 'Main frame of Application', u'MainFrame.py'], u'RequestFrame': [0, '', u'RequestFrame.py']} class BoaApp(wx.App): def OnInit(self): self.setupLogging() self.main = MainFrame.create(None) self.main.Show() self.SetTopWindow(self.main) return True def setupLogging(self):# Set up logging formatter = logging.Formatter('=%(filename)-30s%(levelname)-10s%(message)s') consoleHandler = logging.StreamHandler() consoleHandler.setFormatter(formatter) logger.addHandler(consoleHandler) logger.setLevel(logging.DEBUG) logger.debug('Logging started...') def main(): application = BoaApp(0) application.MainLoop() if __name__ == '__main__': if len(sys.argv) > 0: logger.debug('======' + sys.argv[0]) username = sys.argv[0] main()
[ [ 1, 0, 0.1026, 0.0256, 0, 0.66, 0, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 1, 0, 0.1282, 0.0256, 0, 0.66, 0.125, 666, 0, 1, 0, 0, 666, 0, 0 ], [ 1, 0, 0.1538, 0.0256, 0, 0...
[ "import sys", "import wx", "import logging", "import MainFrame", "logger = logging.getLogger('provinci')", "modules ={u'IncomingRequestFrame': [0, '', u'IncomingRequestFrame.py'],\n u'MainFrame': [1, 'Main frame of Application', u'MainFrame.py'],\n u'RequestFrame': [0, '', u'RequestFrame.py']}", "class ...
#This contains global definition of Browser class and other useful thing ####################################################################################### # # # File: browser_bogus.py # # Part of 2dgal-cheater # # Home: http://2dgal-cheater.googlecode.com # # # # The MIT License # # # # Copyright (c) 2010-2011 <araya.akashic@gmail.com> # # # # Permission is hereby granted, free of charge, to any person obtaining a copy # # of this software and associated documentation files (the "Software"), to deal # # in the Software without restriction, including without limitation the rights # # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # # copies of the Software, and to permit persons to whom the Software is # # furnished to do so, subject to the following conditions: # # # # The above copyright notice and this permission notice shall be included in # # all copies or substantial portions of the Software. # # # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # # THE SOFTWARE. # # # ####################################################################################### #Author: Araya import urllib2 import cookielib class Browser(): def __init__(self, user, passwd): self.username = user self.password = passwd self.cookie = cookielib.CookieJar() self.urlOpener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookie)) self.logout_URI = "" #ad link self.ad_link = ""
[ [ 1, 0, 0.75, 0.0227, 0, 0.66, 0, 345, 0, 1, 0, 0, 345, 0, 0 ], [ 1, 0, 0.7727, 0.0227, 0, 0.66, 0.5, 591, 0, 1, 0, 0, 591, 0, 0 ], [ 3, 0, 0.9091, 0.2045, 0, 0.66,...
[ "import urllib2", "import cookielib", "class Browser():\n def __init__(self, user, passwd):\n self.username = user\n self.password = passwd\n self.cookie = cookielib.CookieJar()\n self.urlOpener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookie))\n self.logout_...
#! /usr/bin/python ####################################################################################### # # # File: ad_auto.py # # Part of 2dgal-cheater # # Home: http://2dgal-cheater.googlecode.com # # # # The MIT License # # # # Copyright (c) 2010-2011 <araya.akashic@gmail.com> # # # # Permission is hereby granted, free of charge, to any person obtaining a copy # # of this software and associated documentation files (the "Software"), to deal # # in the Software without restriction, including without limitation the rights # # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # # copies of the Software, and to permit persons to whom the Software is # # furnished to do so, subject to the following conditions: # # # # The above copyright notice and this permission notice shall be included in # # all copies or substantial portions of the Software. # # # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # # THE SOFTWARE. # # # ####################################################################################### # This code is to automatically click ads on kf bbs # Author: Araya import time import urllib import urllib2 from browser_bogus import Browser #customized these #adding account as "username":"password" account_list = {"":"", "":""} #total attempts cycle = 1 #wait 1 hr 10 s before each attempt delay = 3600 * 5 #do not change below this siteurl = "http://bbs.2dgal.com" login_page = "login.php" star1_page = "kf_star_1.php" #ad link character ad_char = "diy_ad_move.php" #method login def login(user): logindata = {"pwuser":user.username, "pwpwd":user.password, "hideid":"0", "cktime":"0", "forward":"index.php", "jumpurl":"index.php", "step":"2"} en_logindata = urllib.urlencode(logindata) url = siteurl + "/" + login_page request = urllib2.Request(url) result = user.urlOpener.open(request) #print "Getting login page" url = url + "?" request = urllib2.Request(url, en_logindata) result = user.urlOpener.open(request) print "Login " + user.username #print cookie def ad_auto(user): question = [] answer = "" #print "Getting star 1 question" url = siteurl + "/" + star1_page request = urllib2.Request(url) result = user.urlOpener.open(request) pagelines = result.readlines() #print len(pagelines) #extracting logout URI line = pagelines[74] user.logout_URI = line.split("=\"")[-1].split("\"")[0] for line in pagelines: match = line.find(ad_char) if match >= 0: words = line.split("=\"") for word in words: if word.find(ad_char) >= 0: user.ad_link = word.split("\"")[0] print user.ad_link url = siteurl + "/" + user.ad_link request = urllib2.Request(url) result = user.urlOpener.open(request) print "Ad click sent" result_data = result.read() return result_data.find("<meta http-equiv=\"refresh\"") # return 1 def logout(user): url = siteurl + "/" + user.logout_URI request = urllib2.Request(url) result = user.urlOpener.open(request) print "Logout " + user.username def perform_ad_auto(): for n, p in account_list.iteritems(): user = Browser(n, p) submit_success = -1 try: login(user) while submit_success < 0: submit_success = ad_auto(user) print submit_success logout(user) except: pass if __name__ == "__main__": while cycle: print "------------------------------------------" print time.strftime("%a, %b %d %Y %H:%M:%S", time.localtime()) + "-----------------" perform_ad_auto() if cycle > 1: time.sleep(delay) cycle = cycle - 1
[ [ 1, 0, 0.2448, 0.007, 0, 0.66, 0, 654, 0, 1, 0, 0, 654, 0, 0 ], [ 1, 0, 0.2587, 0.007, 0, 0.66, 0.0667, 614, 0, 1, 0, 0, 614, 0, 0 ], [ 1, 0, 0.2657, 0.007, 0, 0.6...
[ "import time", "import urllib", "import urllib2", "from browser_bogus import Browser", "account_list = {\"\":\"\",\n \"\":\"\"}", "cycle = 1", "delay = 3600 * 5", "siteurl = \"http://bbs.2dgal.com\"", "login_page = \"login.php\"", "star1_page = \"kf_star_1.php\"", "ad_char = \"diy...
####################################################################################### # # # File: gojuon.py # # Part of 2dgal-cheater # # Home: http://2dgal-cheater.googlecode.com # # # # The MIT License # # # # Copyright (c) 2010-2011 <araya.akashic@gmail.com> # # # # Permission is hereby granted, free of charge, to any person obtaining a copy # # of this software and associated documentation files (the "Software"), to deal # # in the Software without restriction, including without limitation the rights # # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # # copies of the Software, and to permit persons to whom the Software is # # furnished to do so, subject to the following conditions: # # # # The above copyright notice and this permission notice shall be included in # # all copies or substantial portions of the Software. # # # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # # THE SOFTWARE. # # # ####################################################################################### #This is the library of encoded gojuon to phonetic symbol #Author: Araya gojuon = { "=%A4%A2":"a", "=%A5%A2":"a", "=%A4%A4":"i", "=%A5%A4":"i", "=%A4%A6":"u", "=%A5%A6":"u", "=%A4%A8":"e", "=%A5%A8":"e", "=%A4%AA":"o", "=%A5%AA":"o", "=%A4%AB":"ka", "=%A5%AB":"ka", "=%A4%AD":"ki", "=%A5%AD":"ki", "=%A4%AF":"ku", "=%A5%AF":"ku", "=%A4%B1":"ke", "=%A5%B1":"ke", "=%A4%B3":"ko", "=%A5%B3":"ko", "=%A4%B5":"sa", "=%A5%B5":"sa", "=%A4%B7":"shi", "=%A5%B7":"shi", "=%A4%B9":"su", "=%A5%B9":"su", "=%A4%BB":"se", "=%A5%BB":"se", "=%A4%BD":"so", "=%A5%BD":"so", "=%A4%BF":"ta", "=%A5%BF":"ta", "=%A4%C1":"chi", "=%A5%C1":"chi", "=%A4%C4":"tsu", "=%A5%C4":"tsu", "=%A4%C6":"te", "=%A5%C6":"te", "=%A4%C8":"to", "=%A5%C8":"to", "=%A4%CA":"na", "=%A5%CA":"na", "=%A4%CB":"ni", "=%A5%CB":"ni", "=%A4%CC":"nu", "=%A5%CC":"nu", "=%A4%CD":"ne", "=%A5%CD":"ne", "=%A4%CE":"no", "=%A5%CE":"no", "=%A4%CF":"ha", "=%A5%CF":"ha", "=%A4%D2":"hi", "=%A5%D2":"hi", "=%A4%D5":"fu", "=%A5%D5":"fu", "=%A4%D8":"he", "=%A5%D8":"he", "=%A4%DB":"ho", "=%A5%DB":"ho", "=%A4%DE":"ma", "=%A5%DE":"ma", "=%A4%DF":"mi", "=%A5%DF":"mi", "=%A4%E0":"mu", "=%A5%E0":"mu", "=%A4%E1":"me", "=%A5%E1":"me", "=%A4%E2":"mo", "=%A5%E2":"mo", "=%A4%E4":"ya", "=%A5%E4":"ya", "=%A4%E6":"yu", "=%A5%E6":"yu", "=%A4%E8":"yo", "=%A5%E8":"yo", "=%A4%E9":"ra", "=%A5%E9":"ra", "=%A4%EA":"ri", "=%A5%EA":"ri", "=%A4%EB":"ru", "=%A5%EB":"ru", "=%A4%EC":"re", "=%A5%EC":"re", "=%A4%ED":"ro", "=%A5%ED":"ro", "=%A4%EF":"wa", "=%A5%EF":"wa", "=%A4%F2":"o", "=%A5%F2":"o", "=%A4%F3":"n", "=%A5%F3":"n", "=":"", "=":"", "=%A4%AC":"ga", "=%A5%AC":"ga", "=%A4%AE":"gi", "=%A5%AE":"gi", "=%A4%B0":"gu", "=%A5%B0":"gu", "=%A4%B2":"ge", "=%A5%B2":"ge", "=%A4%B4":"go", "=%A5%B4":"go", "=%A4%B6":"za", "=%A5%B6":"za", "=%A4%B8":"ji", "=%A5%B8":"ji", "=%A4%BA":"zu", "=%A5%BA":"zu", "=%A4%BC":"ze", "=%A5%BC":"ze", "=%A4%BE":"zo", "=%A5%BE":"zo", "=%A4%C0":"da", "=%A5%C0":"da", "=%A4%C2":"ji", "=%A5%C2":"ji", "=%A4%C5":"zu", "=%A5%C5":"zu", "=%A4%C7":"de", "=%A5%C7":"de", "=%A4%C9":"do", "=%A5%C9":"do", "=%A4%D0":"ba", "=%A5%D0":"ba", "=%A4%D3":"bi", "=%A5%D3":"bi", "=%A4%D6":"bu", "=%A5%D6":"bu", "=%A4%D9":"be", "=%A5%D9":"be", "=%A4%DC":"bo", "=%A5%DC":"bo", "=%A4%D1":"pa", "=%A5%D1":"pa", "=%A4%D4":"pi", "=%A5%D4":"pi", "=%A4%D7":"pu", "=%A5%D7":"pu", "=%A4%DA":"pe", "=%A5%DA":"pe", "=%A4%DD":"po", "=%A5%DD":"po", "=%A4%AD%A4%E3":"kya", "=%A5%AD%A5%E3":"kya", "=%A4%AD%A4%E5":"jyu", "=%A5%AD%A5%E5":"jyu", "=%A4%AD%A4%E7":"kyo", "=%A5%AD%A5%E7":"kyo", "=%A4%B7%A4%E3":"sha", "=%A5%B7%A5%E3":"sha", "=%A4%B7%A4%E5":"shu", "=%A5%B7%A5%E5":"shu", "=%A4%B7%A4%E7":"sho", "=%A5%B7%A5%E7":"sho", "=%A4%C1%A4%E3":"cha", "=%A5%C1%A5%E3":"cha", "=%A4%C1%A4%E5":"chu", "=%A5%C1%A5%E5":"chu", "=%A4%C1%A4%E7":"cho", "=%A5%C1%A5%E7":"cho", "=%A4%CB%A4%E3":"nya", "=%A5%CB%A5%E3":"nya", "=%A4%CB%A4%E5":"nyu", "=%A5%CB%A5%E5":"nyu", "=%A4%CB%A4%E7":"nyo", "=%A5%CB%A5%E7":"nyo", "=%A4%D2%A4%E3":"hya", "=%A5%D2%A5%E3":"hya", "=%A4%D2%A4%E5":"hyu", "=%A5%D2%A5%E5":"hyu", "=%A4%D2%A4%E7":"hyo", "=%A5%D2%A5%E7":"hyo", "=%A4%DF%A4%E3":"mya", "=%A5%DF%A5%E3":"mya", "=%A4%DF%A4%E5":"mya", "=%A5%DF%A5%E5":"mya", "=%A4%DF%A4%E7":"myo", "=%A5%DF%A5%E7":"myo", "=%A4%EA%A4%E3":"rya", "=%A5%EA%A5%E3":"rya", "=%A4%EA%A4%E5":"ryu", "=%A5%EA%A5%E5":"ryu", "=%A4%EA%A4%E7":"ryo", "=%A5%EA%A5%E7":"ryo", "=%A4%AE%A4%E3":"gya", "=%A5%AE%A5%E3":"gya", "=%A4%AE%A4%E5":"gyu", "=%A5%AE%A5%E5":"gyu", "=%A4%AE%A4%E7":"gyo", "=%A5%AE%A5%E7":"gyo", "=%A4%B8%A4%E3":"ja", "=%A5%B8%A5%E3":"ja", "=%A4%B8%A4%E5":"ju", "=%A5%B8%A5%E5":"ju", "=%A4%B8%A4%E7":"jo", "=%A5%B8%A5%E7":"jo", "=%A4%C2%A4%E3":"ja", "=%A5%C2%A5%E3":"ja", "=%A4%C2%A4%E5":"ju", "=%A5%C2%A5%E5":"ju", "=%A4%C2%A4%E7":"jo", "=%A5%C2%A5%E7":"jo", "=%A4%D3%A4%E3":"bya", "=%A5%D3%A5%E3":"bya", "=%A4%D3%A4%E5":"byu", "=%A5%D3%A5%E5":"byu", "=%A4%D3%A4%E7":"byo", "=%A5%D3%A5%E7":"byo", "=%A4%D4%A4%E3":"pya", "=%A5%D4%A5%E3":"pya", "=%A4%D4%A4%E5":"pyu", "=%A5%D4%A5%E5":"pyu", "=%A4%D4%A4%E7":"pyo", "=%A5%D4%A5%E7":"pyo"}
[ [ 14, 0, 0.568, 0.868, 0, 0.66, 0, 833, 0, 0, 0, 0, 0, 6, 0 ] ]
[ "gojuon = {\n\t\"=%A4%A2\":\"a\",\n\t\"=%A5%A2\":\"a\",\n\t\"=%A4%A4\":\"i\",\n\t\"=%A5%A4\":\"i\",\n\t\"=%A4%A6\":\"u\",\n\t\"=%A5%A6\":\"u\",\n\t\"=%A4%A8\":\"e\"," ]
#! /usr/bin/python ####################################################################################### # # # File: ad_auto.py # # Part of 2dgal-cheater # # Home: http://2dgal-cheater.googlecode.com # # # # The MIT License # # # # Copyright (c) 2010-2011 <araya.akashic@gmail.com> # # # # Permission is hereby granted, free of charge, to any person obtaining a copy # # of this software and associated documentation files (the "Software"), to deal # # in the Software without restriction, including without limitation the rights # # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # # copies of the Software, and to permit persons to whom the Software is # # furnished to do so, subject to the following conditions: # # # # The above copyright notice and this permission notice shall be included in # # all copies or substantial portions of the Software. # # # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # # THE SOFTWARE. # # # ####################################################################################### # This code is to automatically click ads on kf bbs # Author: Araya import time import urllib import urllib2 from browser_bogus import Browser #customized these #adding account as "username":"password" account_list = {"":"", "":""} #total attempts cycle = 1 #wait 1 hr 10 s before each attempt delay = 3600 * 5 #do not change below this siteurl = "http://bbs.2dgal.com" login_page = "login.php" star1_page = "kf_star_1.php" #ad link character ad_char = "diy_ad_move.php" #method login def login(user): logindata = {"pwuser":user.username, "pwpwd":user.password, "hideid":"0", "cktime":"0", "forward":"index.php", "jumpurl":"index.php", "step":"2"} en_logindata = urllib.urlencode(logindata) url = siteurl + "/" + login_page request = urllib2.Request(url) result = user.urlOpener.open(request) #print "Getting login page" url = url + "?" request = urllib2.Request(url, en_logindata) result = user.urlOpener.open(request) print "Login " + user.username #print cookie def ad_auto(user): question = [] answer = "" #print "Getting star 1 question" url = siteurl + "/" + star1_page request = urllib2.Request(url) result = user.urlOpener.open(request) pagelines = result.readlines() #print len(pagelines) #extracting logout URI line = pagelines[74] user.logout_URI = line.split("=\"")[-1].split("\"")[0] for line in pagelines: match = line.find(ad_char) if match >= 0: words = line.split("=\"") for word in words: if word.find(ad_char) >= 0: user.ad_link = word.split("\"")[0] print user.ad_link url = siteurl + "/" + user.ad_link request = urllib2.Request(url) result = user.urlOpener.open(request) print "Ad click sent" result_data = result.read() return result_data.find("<meta http-equiv=\"refresh\"") # return 1 def logout(user): url = siteurl + "/" + user.logout_URI request = urllib2.Request(url) result = user.urlOpener.open(request) print "Logout " + user.username def perform_ad_auto(): for n, p in account_list.iteritems(): user = Browser(n, p) submit_success = -1 try: login(user) while submit_success < 0: submit_success = ad_auto(user) print submit_success logout(user) except: pass if __name__ == "__main__": while cycle: print "------------------------------------------" print time.strftime("%a, %b %d %Y %H:%M:%S", time.localtime()) + "-----------------" perform_ad_auto() if cycle > 1: time.sleep(delay) cycle = cycle - 1
[ [ 1, 0, 0.2448, 0.007, 0, 0.66, 0, 654, 0, 1, 0, 0, 654, 0, 0 ], [ 1, 0, 0.2587, 0.007, 0, 0.66, 0.0667, 614, 0, 1, 0, 0, 614, 0, 0 ], [ 1, 0, 0.2657, 0.007, 0, 0.6...
[ "import time", "import urllib", "import urllib2", "from browser_bogus import Browser", "account_list = {\"\":\"\",\n \"\":\"\"}", "cycle = 1", "delay = 3600 * 5", "siteurl = \"http://bbs.2dgal.com\"", "login_page = \"login.php\"", "star1_page = \"kf_star_1.php\"", "ad_char = \"diy...
#! /usr/bin/python ####################################################################################### # # # File: gojuon_gen.py # # Part of 2dgal-cheater # # Home: http://2dgal-cheater.googlecode.com # # # # The MIT License # # # # Copyright (c) 2010-2011 <araya.akashic@gmail.com> # # # # Permission is hereby granted, free of charge, to any person obtaining a copy # # of this software and associated documentation files (the "Software"), to deal # # in the Software without restriction, including without limitation the rights # # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # # copies of the Software, and to permit persons to whom the Software is # # furnished to do so, subject to the following conditions: # # # # The above copyright notice and this permission notice shall be included in # # all copies or substantial portions of the Software. # # # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # # THE SOFTWARE. # # # ####################################################################################### #This is to generate the library of encoded gojuon to phonetic symbol #Author: Araya import urllib file = open("gojuon.csv", "r") lines = file.readlines() file.close() file = open("gojuon.py", "w") for line in lines: items = line.strip().split(",") hiragana = urllib.urlencode({"":items[0]}) katakana = urllib.urlencode({"":items[1]}) phonetic = urllib.urlencode({"":items[2]}) output_line = "\t\"" + hiragana + "\":\"" + items[2] + "\",\n" file.write(output_line) #print output_line output_line = "\t\"" + katakana + "\":\"" + items[2] + "\",\n" file.write(output_line) #print output_line file.close()
[ [ 1, 0, 0.6364, 0.0182, 0, 0.66, 0, 614, 0, 1, 0, 0, 614, 0, 0 ], [ 14, 0, 0.6727, 0.0182, 0, 0.66, 0.1667, 107, 3, 2, 0, 0, 693, 10, 1 ], [ 14, 0, 0.6909, 0.0182, 0, ...
[ "import urllib", "file = open(\"gojuon.csv\", \"r\")", "lines = file.readlines()", "file.close()", "file = open(\"gojuon.py\", \"w\")", "for line in lines:\n items = line.strip().split(\",\")\n hiragana = urllib.urlencode({\"\":items[0]})\n katakana = urllib.urlencode({\"\":items[1]})\n phonet...
#! /usr/bin/python ####################################################################################### # # # File: gojuon_gen.py # # Part of 2dgal-cheater # # Home: http://2dgal-cheater.googlecode.com # # # # The MIT License # # # # Copyright (c) 2010-2011 <araya.akashic@gmail.com> # # # # Permission is hereby granted, free of charge, to any person obtaining a copy # # of this software and associated documentation files (the "Software"), to deal # # in the Software without restriction, including without limitation the rights # # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # # copies of the Software, and to permit persons to whom the Software is # # furnished to do so, subject to the following conditions: # # # # The above copyright notice and this permission notice shall be included in # # all copies or substantial portions of the Software. # # # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # # THE SOFTWARE. # # # ####################################################################################### #This is to generate the library of encoded gojuon to phonetic symbol #Author: Araya import urllib file = open("gojuon.csv", "r") lines = file.readlines() file.close() file = open("gojuon.py", "w") for line in lines: items = line.strip().split(",") hiragana = urllib.urlencode({"":items[0]}) katakana = urllib.urlencode({"":items[1]}) phonetic = urllib.urlencode({"":items[2]}) output_line = "\t\"" + hiragana + "\":\"" + items[2] + "\",\n" file.write(output_line) #print output_line output_line = "\t\"" + katakana + "\":\"" + items[2] + "\",\n" file.write(output_line) #print output_line file.close()
[ [ 1, 0, 0.6364, 0.0182, 0, 0.66, 0, 614, 0, 1, 0, 0, 614, 0, 0 ], [ 14, 0, 0.6727, 0.0182, 0, 0.66, 0.1667, 107, 3, 2, 0, 0, 693, 10, 1 ], [ 14, 0, 0.6909, 0.0182, 0, ...
[ "import urllib", "file = open(\"gojuon.csv\", \"r\")", "lines = file.readlines()", "file.close()", "file = open(\"gojuon.py\", \"w\")", "for line in lines:\n items = line.strip().split(\",\")\n hiragana = urllib.urlencode({\"\":items[0]})\n katakana = urllib.urlencode({\"\":items[1]})\n phonet...