diff options
Diffstat (limited to '3rdparty/jsoncpp/scons-tools')
-rw-r--r-- | 3rdparty/jsoncpp/scons-tools/globtool.py | 33 | ||||
-rw-r--r-- | 3rdparty/jsoncpp/scons-tools/srcdist.py | 20 | ||||
-rw-r--r-- | 3rdparty/jsoncpp/scons-tools/substinfile.py | 7 | ||||
-rw-r--r-- | 3rdparty/jsoncpp/scons-tools/targz.py | 21 |
4 files changed, 50 insertions, 31 deletions
diff --git a/3rdparty/jsoncpp/scons-tools/globtool.py b/3rdparty/jsoncpp/scons-tools/globtool.py index 811140e8aab..890f1b7b1f4 100644 --- a/3rdparty/jsoncpp/scons-tools/globtool.py +++ b/3rdparty/jsoncpp/scons-tools/globtool.py @@ -1,9 +1,14 @@ +# Copyright 2009 Baptiste Lepilleur +# Distributed under MIT license, or public domain if desired and +# recognized in your jurisdiction. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + import fnmatch import os -def generate( env ): - def Glob( env, includes = None, excludes = None, dir = '.' ): - """Adds Glob( includes = Split( '*' ), excludes = None, dir = '.') +def generate(env): + def Glob(env, includes = None, excludes = None, dir = '.'): + """Adds Glob(includes = Split('*'), excludes = None, dir = '.') helper function to environment. Glob both the file-system files. @@ -12,36 +17,36 @@ def generate( env ): excludes: list of file name pattern exluced from the return list. Example: - sources = env.Glob( ("*.cpp", '*.h'), "~*.cpp", "#src" ) + sources = env.Glob(("*.cpp", '*.h'), "~*.cpp", "#src") """ def filterFilename(path): - abs_path = os.path.join( dir, path ) + abs_path = os.path.join(dir, path) if not os.path.isfile(abs_path): return 0 fn = os.path.basename(path) match = 0 for include in includes: - if fnmatch.fnmatchcase( fn, include ): + if fnmatch.fnmatchcase(fn, include): match = 1 break if match == 1 and not excludes is None: for exclude in excludes: - if fnmatch.fnmatchcase( fn, exclude ): + if fnmatch.fnmatchcase(fn, exclude): match = 0 break return match if includes is None: includes = ('*',) - elif type(includes) in ( type(''), type(u'') ): + elif type(includes) in (type(''), type(u'')): includes = (includes,) - if type(excludes) in ( type(''), type(u'') ): + if type(excludes) in (type(''), type(u'')): excludes = (excludes,) dir = env.Dir(dir).abspath - paths = os.listdir( dir ) - def makeAbsFileNode( path ): - return env.File( os.path.join( dir, path ) ) - nodes = filter( filterFilename, paths ) - return map( makeAbsFileNode, nodes ) + paths = os.listdir(dir) + def makeAbsFileNode(path): + return env.File(os.path.join(dir, path)) + nodes = filter(filterFilename, paths) + return map(makeAbsFileNode, nodes) from SCons.Script import Environment Environment.Glob = Glob diff --git a/3rdparty/jsoncpp/scons-tools/srcdist.py b/3rdparty/jsoncpp/scons-tools/srcdist.py index 864ff408158..fe1d74695a2 100644 --- a/3rdparty/jsoncpp/scons-tools/srcdist.py +++ b/3rdparty/jsoncpp/scons-tools/srcdist.py @@ -1,3 +1,8 @@ +# Copyright 2007 Baptiste Lepilleur +# Distributed under MIT license, or public domain if desired and +# recognized in your jurisdiction. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + import os import os.path from fnmatch import fnmatch @@ -47,7 +52,7 @@ import targz ## elif token == "=": ## data[key] = list() ## else: -## append_data( data, key, new_data, token ) +## append_data(data, key, new_data, token) ## new_data = True ## ## last_token = token @@ -55,7 +60,7 @@ import targz ## ## if last_token == '\\' and token != '\n': ## new_data = False -## append_data( data, key, new_data, '\\' ) +## append_data(data, key, new_data, '\\') ## ## # compress lists of len 1 into single strings ## for (k, v) in data.items(): @@ -116,7 +121,7 @@ import targz ## else: ## for pattern in file_patterns: ## sources.extend(glob.glob("/".join([node, pattern]))) -## sources = map( lambda path: env.File(path), sources ) +## sources = map(lambda path: env.File(path), sources) ## return sources ## ## @@ -143,7 +148,7 @@ def srcDistEmitter(source, target, env): ## # add our output locations ## for (k, v) in output_formats.items(): ## if data.get("GENERATE_" + k, v[0]) == "YES": -## targets.append(env.Dir( os.path.join(out_dir, data.get(k + "_OUTPUT", v[1]))) ) +## targets.append(env.Dir(os.path.join(out_dir, data.get(k + "_OUTPUT", v[1])))) ## ## # don't clobber targets ## for node in targets: @@ -161,14 +166,13 @@ def generate(env): Add builders and construction variables for the SrcDist tool. """ -## doxyfile_scanner = env.Scanner( -## DoxySourceScan, +## doxyfile_scanner = env.Scanner(## DoxySourceScan, ## "DoxySourceScan", ## scan_check = DoxySourceScanCheck, -## ) +##) if targz.exists(env): - srcdist_builder = targz.makeBuilder( srcDistEmitter ) + srcdist_builder = targz.makeBuilder(srcDistEmitter) env['BUILDERS']['SrcDist'] = srcdist_builder diff --git a/3rdparty/jsoncpp/scons-tools/substinfile.py b/3rdparty/jsoncpp/scons-tools/substinfile.py index ef18b4edbcb..c620442d572 100644 --- a/3rdparty/jsoncpp/scons-tools/substinfile.py +++ b/3rdparty/jsoncpp/scons-tools/substinfile.py @@ -1,3 +1,8 @@ +# Copyright 2010 Baptiste Lepilleur +# Distributed under MIT license, or public domain if desired and +# recognized in your jurisdiction. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + import re from SCons.Script import * # the usual scons stuff you get in a SConscript import collections @@ -70,7 +75,7 @@ def generate(env): return target, source ## env.Append(TOOLS = 'substinfile') # this should be automaticaly done by Scons ?!? - subst_action = SCons.Action.Action( subst_in_file, subst_in_file_string ) + subst_action = SCons.Action.Action(subst_in_file, subst_in_file_string) env['BUILDERS']['SubstInFile'] = Builder(action=subst_action, emitter=subst_emitter) def exists(env): diff --git a/3rdparty/jsoncpp/scons-tools/targz.py b/3rdparty/jsoncpp/scons-tools/targz.py index f5432003df7..8e5ba83003b 100644 --- a/3rdparty/jsoncpp/scons-tools/targz.py +++ b/3rdparty/jsoncpp/scons-tools/targz.py @@ -1,3 +1,8 @@ +# Copyright 2007 Baptiste Lepilleur +# Distributed under MIT license, or public domain if desired and +# recognized in your jurisdiction. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + """tarball Tool-specific initialization for tarball. @@ -27,9 +32,9 @@ TARGZ_DEFAULT_COMPRESSION_LEVEL = 9 if internal_targz: def targz(target, source, env): - def archive_name( path ): - path = os.path.normpath( os.path.abspath( path ) ) - common_path = os.path.commonprefix( (base_dir, path) ) + def archive_name(path): + path = os.path.normpath(os.path.abspath(path)) + common_path = os.path.commonprefix((base_dir, path)) archive_name = path[len(common_path):] return archive_name @@ -37,23 +42,23 @@ if internal_targz: for name in names: path = os.path.join(dirname, name) if os.path.isfile(path): - tar.add(path, archive_name(path) ) + tar.add(path, archive_name(path)) compression = env.get('TARGZ_COMPRESSION_LEVEL',TARGZ_DEFAULT_COMPRESSION_LEVEL) - base_dir = os.path.normpath( env.get('TARGZ_BASEDIR', env.Dir('.')).abspath ) + base_dir = os.path.normpath(env.get('TARGZ_BASEDIR', env.Dir('.')).abspath) target_path = str(target[0]) - fileobj = gzip.GzipFile( target_path, 'wb', compression ) + fileobj = gzip.GzipFile(target_path, 'wb', compression) tar = tarfile.TarFile(os.path.splitext(target_path)[0], 'w', fileobj) for source in source: source_path = str(source) if source.isdir(): os.path.walk(source_path, visit, tar) else: - tar.add(source_path, archive_name(source_path) ) # filename, arcname + tar.add(source_path, archive_name(source_path)) # filename, arcname tar.close() targzAction = SCons.Action.Action(targz, varlist=['TARGZ_COMPRESSION_LEVEL','TARGZ_BASEDIR']) - def makeBuilder( emitter = None ): + def makeBuilder(emitter = None): return SCons.Builder.Builder(action = SCons.Action.Action('$TARGZ_COM', '$TARGZ_COMSTR'), source_factory = SCons.Node.FS.Entry, source_scanner = SCons.Defaults.DirScanner, |