__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import os.path
import UserDict
import UserList
IDLSuffixes = [".idl", ".IDL"]
+# cleanup
+del suffix
+
# Actions for common languages.
CAction = SCons.Action.Action("$CCCOM")
DAction = SCons.Action.Action("$DCOM")
import os
import os.path
import string
-import re
-import shutil
from UserDict import UserDict
import SCons.Action
def scanner_map_delete(self, kw=None):
"""Delete the cached scanner map (if we need to).
"""
- if not kw is None:
- try:
- kw['SCANNERS']
- except KeyError:
- return
+ if not kw is None and not kw.has_key('SCANNERS'):
+ return
try:
del self.scanner_map
except AttributeError:
# Create worker threads
for i in range(num):
- worker = Worker(self.requestQueue, self.resultsQueue)
+ Worker(self.requestQueue, self.resultsQueue)
def put(self, obj):
"""Put task into request queue."""
"""A null "builder" for directories."""
return []
- def build(self):
+ def build(self, **kw):
"""A null "builder" for directories."""
pass
if calc.max_drift >= 0 and (time.time() - mtime) > calc.max_drift:
try:
- self.binfo
+ binfo = self.binfo
except AttributeError:
- self.binfo = self.new_binfo()
- self.binfo.csig = csig
- self.binfo.timestamp = mtime
- self.store_info(self.binfo)
+ binfo = self.binfo = self.new_binfo()
+ binfo.csig = csig
+ binfo.timestamp = mtime
+ self.store_info(binfo)
return csig
timestamp, we get to ignore the calculator and just use the
value contents."""
try:
- self.binfo
+ binfo = self.binfo
except:
- self.binfo = self.new_binfo()
+ binfo = self.binfo = self.new_binfo()
try:
- return self.binfo.csig
+ return binfo.csig
except AttributeError:
- self.binfo.csig = self.get_contents()
- self.store_info(self.binfo)
- return self.binfo.csig
+ binfo.csig = self.get_contents()
+ self.store_info(binfo)
+ return binfo.csig
def calc_csig(self, calc):
try:
- self.binfo
- except:
- self.binfo = self.new_binfo()
+ binfo = self.binfo
+ except AttributeError:
+ binfo = self.binfo = self.new_binfo()
try:
- return self.binfo.csig
+ return binfo.csig
except AttributeError:
- self.binfo.csig = calc.module.signature(self)
- self.store_info(self.binfo)
- return self.binfo.csig
+ binfo.csig = calc.module.signature(self)
+ self.store_info(binfo)
+ return binfo.csig
def store_info(self, obj):
"""Make the build signature permanent (that is, store it in the
parent = None
self.eval_func(node, parent)
return node
+ return None
def is_done(self):
return not self.stack
import sys
import SCons.Errors
+import SCons.Tool
def platform_default():
"""Return the platform string for our execution environment.
xlcPath = None
xlcVersion = None
- try:
- xlc = env['CC']
- except KeyError:
- xlc = 'xlc'
+ xlc = env.get('CC', 'xlc')
for package in packages:
cmd = "lslpp -fc " + package + " 2>/dev/null | egrep '" + xlc + "([^-_a-zA-Z0-9].*)?$'"
line = os.popen(cmd).readline()
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-import re
-
import SCons.Node
import SCons.Node.FS
import SCons.Scanner
def __init__(self, *args, **kw):
def current_check(node, env):
- calc = env.get_calculator()
c = not node.has_builder() or node.current(env.get_calculator())
return c
kw['scan_check'] = current_check
def opt_debug(option, opt, value, parser, debug_options=debug_options):
if value in debug_options:
- setattr(parser.values, 'debug', value)
+ #setattr(parser.values, 'debug', value)
+ parser.values.debug = value
else:
raise OptionValueError("Warning: %s is not a valid debug type" % value)
self.add_option('--debug', action="callback", type="string",
def opt_duplicate(option, opt, value, parser):
if not value in SCons.Node.FS.Valid_Duplicates:
raise OptionValueError("`%s' is not a valid duplication style." % value)
- setattr(parser.values, 'duplicate', value)
+ #setattr(parser.values, 'duplicate', value)
+ parser.values.duplicate = value
# Set the duplicate style right away so it can affect linking
# of SConscript files.
SCons.Node.FS.set_duplicate(value)
def opt_j(option, opt, value, parser):
value = int(value)
- setattr(parser.values, 'num_jobs', value)
+ #setattr(parser.values, 'num_jobs', value)
+ parser.values.num_jobs = value
self.add_option('-j', '--jobs', action="callback", type="int",
callback=opt_j, metavar="N",
help="Allow N jobs at once.")
value = int(value)
if value < 1:
raise ValueError
- except ValueError, x:
+ except ValueError:
raise SCons.Errors.UserError, "A positive integer is required: %s"%repr(value)
elif name == 'max_drift':
try:
value = int(value)
- except ValueError, x:
+ except ValueError:
raise SCons.Errors.UserError, "An integer is required: %s"%repr(value)
elif name == 'duplicate':
try:
""" """
return SCons.Builder.Builder(action = "$BITKEEPERCOM", env = env)
- setattr(env, 'BitKeeper', BitKeeperFactory)
+ #setattr(env, 'BitKeeper', BitKeeperFactory)
+ env.BitKeeper = BitKeeperFactory
env['BITKEEPER'] = 'bk'
env['BITKEEPERGET'] = '$BITKEEPER get'
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import os.path
-
import SCons.Builder
import SCons.Util
CVSREPOSITORY = repos,
CVSMODULE = module)
- setattr(env, 'CVS', CVSFactory)
+ #setattr(env, 'CVS', CVSFactory)
+ env.CVS = CVSFactory
env['CVS'] = 'cvs'
env['CVSFLAGS'] = SCons.Util.CLVar('-d $CVSREPOSITORY')
return SCons.Builder.Builder(action = '$P4COM',
env = env)
- setattr(env, 'Perforce', PerforceFactory)
+ #setattr(env, 'Perforce', PerforceFactory)
+ env.Perforce = PerforceFactory
env['P4'] = 'p4'
env['P4FLAGS'] = SCons.Util.CLVar('')
""" """
return SCons.Builder.Builder(action = '$RCS_COCOM', env = env)
- setattr(env, 'RCS', RCSFactory)
+ #setattr(env, 'RCS', RCSFactory)
+ env.RCS = RCSFactory
env['RCS'] = 'rcs'
env['RCS_CO'] = 'co'
""" """
return SCons.Builder.Builder(action = '$SCCSCOM', env = env)
- setattr(env, 'SCCS', SCCSFactory)
+ #setattr(env, 'SCCS', SCCSFactory)
+ env.SCCS = SCCSFactory
env['SCCS'] = 'sccs'
env['SCCSFLAGS'] = SCons.Util.CLVar('')
SVNREPOSITORY = repos,
SVNMODULE = module)
- setattr(env, 'Subversion', SubversionFactory)
+ #setattr(env, 'Subversion', SubversionFactory)
+ env.Subversion = SubversionFactory
env['SVN'] = 'svn'
env['SVNFLAGS'] = SCons.Util.CLVar('')
import os.path
-import SCons.Platform.aix
+#import SCons.Platform.aix
import f77
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import os.path
-
import SCons.Defaults
import SCons.Tool
import SCons.Util
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import os.path
-
import SCons.Tool
import SCons.Defaults
import SCons.Util
env['DLINKFLAGPREFIX'] = '-'
env['DLINKFLAGSUFFIX'] = ''
- static_lib = SCons.Tool.createStaticLibBuilder(env)
+ SCons.Tool.createStaticLibBuilder(env)
# Basically, we hijack the link and ar builders with our own.
# these builders check for the presence of D source, and swap out
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import os.path
-
import SCons.Defaults
import SCons.Tool
import SCons.Util
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import SCons.Util
-
import cc
def generate(env):
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
-import string
import SCons.Tool.msvc
import SCons.Util
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import glob
-import os.path
-
import SCons.Builder
import SCons.Util
'-C <dir>' to Jar."""
if env.has_key('JARCHDIR'):
return [ '-C', '$JARCHDIR' ]
- return ''
+ return []
JarBuilder = SCons.Builder.Builder(action = '$JARCOM',
source_factory = SCons.Node.FS.default_fs.Entry,
def generate(env):
"""Add Builders and construction variables for jar to an Environment."""
try:
- bld = env['BUILDERS']['Jar']
+ env['BUILDERS']['Jar']
except KeyError:
env['BUILDERS']['Jar'] = JarBuilder
import os
import os.path
-import re
import string
import SCons.Builder
os.path.walk(sdir.rdir().get_abspath(), visit, slist)
tlist = []
- for file in slist:
- pkg_dir, classes = parse_java_file(file.get_abspath())
+ for f in slist:
+ pkg_dir, classes = parse_java_file(f.get_abspath())
if pkg_dir:
for c in classes:
t = target[0].Dir(pkg_dir).File(c+class_suffix)
else:
# This is an odd end case: no package and no classes.
# Just do our best based on the source file name.
- base = str(file)[:-len(java_suffix)]
+ base = str(f)[:-len(java_suffix)]
t = target[0].File(base + class_suffix)
t.attributes.java_classdir = target[0]
t.attributes.java_classname = classname(base)
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
-import re
import string
import SCons.Builder
if not isinstance(target[0], SCons.Node.FS.Dir):
target[0].__class__ = SCons.Node.FS.Dir
target[0]._morph()
- File = SCons.Node.FS.default_fs.File
tlist = []
for s in source:
fname = string.replace(s.attributes.java_classname, '.', '_') + '.h'
def JavaHOutFlagGenerator(target, source, env, for_signature):
try:
t = target[0]
- except AttributeError, TypeError:
+ except (AttributeError, TypeError):
t = target
try:
return '-d ' + str(t.attributes.java_lookupdir)
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import os.path
-
import SCons.Defaults
import SCons.Tool
import SCons.Util
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import os.path
-
import SCons.Defaults
import SCons.Scanner.IDL
import SCons.Util
if target and env.has_key('PDB') and env['PDB']:
return ['/PDB:%s'%target[0].File(env['PDB']).get_string(for_signature),
'/DEBUG']
+ return None
def win32ShlinkTargets(target, source, env, for_signature):
listCmd = []
import os.path
import re
import string
-import types
import SCons.Action
import SCons.Builder
self.file.write(' <Configurations>\n')
- first = 1
confkeys = self.configs.keys()
confkeys.sort()
for kind in confkeys:
# entries are MSDN entries, not MSVS ('7.1',
# notably), and we want to skip those too.
try:
- tst = SCons.Util.RegOpenKeyEx(HLM, K + '\\' + p + '\\Setup')
+ SCons.Util.RegOpenKeyEx(HLM, K + '\\' + p + '\\Setup')
except SCons.Util.RegError:
continue
"""Add Builders and construction variables for Microsoft Visual
Studio project files to an Environment."""
try:
- bld = env['BUILDERS']['MSVSProject']
+ env['BUILDERS']['MSVSProject']
except KeyError:
env['BUILDERS']['MSVSProject'] = projectBuilder
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import os.path
-
import SCons.Defaults
import SCons.Tool
import SCons.Util
import os.path
import re
-import sys
import SCons.Defaults
import SCons.Tool
env.Depends(cpp, ui_h)
if (h and q_object_search.search(h.get_contents())) or ui:
# h file with the Q_OBJECT macro found -> add moc_cpp
- dir,base = os.path.split(prefix)
+ d,base = os.path.split(prefix)
src_ext = splitext(str(h))[1]
- moc_cpp = FS.File(os.path.join(dir,
+ moc_cpp = FS.File(os.path.join(d,
env['QT_MOCNAMEGENERATOR'](base, src_ext, env)))
objBuilder = getattr(env, self.objBuilderName)
if env.get('QT_AUTOBUILD_MOC_SOURCES'):
if cpp and q_object_search.search(cpp.get_contents()):
# cpp file with Q_OBJECT macro found -> add moc
# (to be included in cpp)
- dir,base = os.path.split(prefix)
+ d,base = os.path.split(prefix)
src_ext = splitext(str(cpp))[1]
- moc = FS.File(os.path.join(dir,
+ moc = FS.File(os.path.join(d,
env['QT_MOCNAMEGENERATOR'](base, src_ext, env)))
self.mocFromCppBld(env, moc, cpp)
env.Ignore(moc, moc)
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
-import re
import string
import SCons.Builder
s.attributes.java_classname = classname
slist.append(s)
- File = SCons.Node.FS.default_fs.File
tlist = []
for s in source:
for suff in ['_Skel', '_Stub']:
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import os.path
-
import SCons.Util
cplusplus = __import__('c++', globals(), locals(), [])
__revision__ = ""
import os.path
-import string
cplusplus = __import__('c++', globals(), locals(), [])
# use the package installer tool lslpp to figure out where cppc and what
# version of it is installed
def get_cppc(env):
- cppcPath = None
+ cppcPath = env.get('CXX', None)
cppcVersion = None
- try:
- cppc = env['CXX']
- except KeyError:
- cppc = 'cppc'
for package in ['SPROcpl']:
cmd = "pkginfo -l " + package + " 2>/dev/null | grep '^ *VERSION:'"
line = os.popen(cmd).readline()
except OSError:
dirs = []
-for dir in dirs:
- linker = '/opt/' + dir + '/bin/CC'
+for d in dirs:
+ linker = '/opt/' + d + '/bin/CC'
if os.path.exists(linker):
ccLinker = linker
break
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import os.path
-
import SCons.Defaults
import SCons.Tool
import SCons.Util
path = string.split(path, os.pathsep)
if not is_List(reject):
reject = [reject]
- for dir in path:
- f = os.path.join(dir, file)
+ for d in path:
+ f = os.path.join(d, file)
if os.path.isfile(f):
try:
st = os.stat(f)
orig = oldpath
is_list = 1
paths = orig
- if not SCons.Util.is_List(orig):
+ if not is_List(orig):
paths = string.split(paths, sep)
is_list = 0
- if SCons.Util.is_List(newpath):
+ if is_List(newpath):
newpaths = newpath
else:
newpaths = string.split(newpath, sep)
orig = oldpath
is_list = 1
paths = orig
- if not SCons.Util.is_List(orig):
+ if not is_List(orig):
paths = string.split(paths, sep)
is_list = 0
- if SCons.Util.is_List(newpath):
+ if is_List(newpath):
newpaths = newpath
else:
newpaths = string.split(newpath, sep)
def dir_index(directory):
files = []
- for file in os.listdir(directory):
- fullname = os.path.join(directory, file)
+ for f in os.listdir(directory):
+ fullname = os.path.join(directory, f)
files.append(fullname)
# os.listdir() isn't guaranteed to return files in any specific order,
def case_sensitive_suffixes(s1, s2):
return (os.path.normcase(s1) != os.path.normcase(s2))
-def adjustixes(file, pre, suf):
+def adjustixes(fname, pre, suf):
if pre:
- path, fn = os.path.split(os.path.normpath(file))
+ path, fn = os.path.split(os.path.normpath(fname))
if fn[:len(pre)] != pre:
- file = os.path.join(path, pre + fn)
+ fname = os.path.join(path, pre + fn)
# Only append a suffix if the file does not have one.
- if suf and not splitext(file)[1] and file[-len(suf):] != suf:
- file = file + suf
- return file
+ if suf and not splitext(fname)[1] and fname[-len(suf):] != suf:
+ fname = fname + suf
+ return fname