diff options
author | Steven Knight <knight@baldmt.com> | 2004-06-01 04:41:58 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-06-01 04:41:58 (GMT) |
commit | c642fca37d45da3f01c892b1518ce42ef8abbb6e (patch) | |
tree | 6483b18f10e11a46357d385fae5d023c25ce58b8 /src | |
parent | 78b110985d41c80a1803e95f3f9fe7280a0c1cb1 (diff) | |
download | SCons-c642fca37d45da3f01c892b1518ce42ef8abbb6e.zip SCons-c642fca37d45da3f01c892b1518ce42ef8abbb6e.tar.gz SCons-c642fca37d45da3f01c892b1518ce42ef8abbb6e.tar.bz2 |
Remove dead imports and other things found by PyChecker.
Diffstat (limited to 'src')
41 files changed, 80 insertions, 115 deletions
diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py index 4aa518f..733a26a 100644 --- a/src/engine/SCons/Builder.py +++ b/src/engine/SCons/Builder.py @@ -119,7 +119,6 @@ There are the following methods for internal use within this module: __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os.path import UserDict import UserList diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 4c42f28..fb3669a 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -124,6 +124,9 @@ for suffix in FortranSuffixes: IDLSuffixes = [".idl", ".IDL"] +# cleanup +del suffix + # Actions for common languages. CAction = SCons.Action.Action("$CCCOM") DAction = SCons.Action.Action("$DCOM") diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index d43a99f..5766523 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -39,8 +39,6 @@ import copy import os import os.path import string -import re -import shutil from UserDict import UserDict import SCons.Action @@ -417,11 +415,8 @@ class Base: 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: diff --git a/src/engine/SCons/Job.py b/src/engine/SCons/Job.py index 1ba7d62..e5f9a71 100644 --- a/src/engine/SCons/Job.py +++ b/src/engine/SCons/Job.py @@ -168,7 +168,7 @@ else: # 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.""" diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 13a2f52..1863d93 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1243,7 +1243,7 @@ class Dir(Base): """A null "builder" for directories.""" return [] - def build(self): + def build(self, **kw): """A null "builder" for directories.""" pass @@ -1673,12 +1673,12 @@ class File(Base): 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 diff --git a/src/engine/SCons/Node/Python.py b/src/engine/SCons/Node/Python.py index a2537ae..e15888b 100644 --- a/src/engine/SCons/Node/Python.py +++ b/src/engine/SCons/Node/Python.py @@ -67,12 +67,12 @@ class Value(SCons.Node.Node): 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 diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index 66e1420..24c70b8 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -549,15 +549,15 @@ class Node: 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 @@ -930,6 +930,7 @@ class Walker: parent = None self.eval_func(node, parent) return node + return None def is_done(self): return not self.stack diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py index 84fe208..e8a4a19 100644 --- a/src/engine/SCons/Platform/__init__.py +++ b/src/engine/SCons/Platform/__init__.py @@ -50,6 +50,7 @@ import string import sys import SCons.Errors +import SCons.Tool def platform_default(): """Return the platform string for our execution environment. diff --git a/src/engine/SCons/Platform/aix.py b/src/engine/SCons/Platform/aix.py index 727aa9b..e0d2e76 100644 --- a/src/engine/SCons/Platform/aix.py +++ b/src/engine/SCons/Platform/aix.py @@ -43,10 +43,7 @@ def get_xlc(env, xlc, xlc_r, packages): 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() diff --git a/src/engine/SCons/Scanner/Fortran.py b/src/engine/SCons/Scanner/Fortran.py index c29eec5..9e9a990 100644 --- a/src/engine/SCons/Scanner/Fortran.py +++ b/src/engine/SCons/Scanner/Fortran.py @@ -29,9 +29,6 @@ This module implements the dependency scanner for Fortran code. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -import re - import SCons.Node import SCons.Node.FS import SCons.Scanner diff --git a/src/engine/SCons/Scanner/__init__.py b/src/engine/SCons/Scanner/__init__.py index 8432638..8ea4223 100644 --- a/src/engine/SCons/Scanner/__init__.py +++ b/src/engine/SCons/Scanner/__init__.py @@ -234,7 +234,6 @@ class Current(Base): 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 diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index db2b7c4..d4650d2 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -528,7 +528,8 @@ class OptParser(OptionParser): 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", @@ -540,7 +541,8 @@ class OptParser(OptionParser): 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) @@ -582,7 +584,8 @@ class OptParser(OptionParser): 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.") @@ -750,12 +753,12 @@ class SConscriptSettableOptions: 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: diff --git a/src/engine/SCons/Tool/BitKeeper.py b/src/engine/SCons/Tool/BitKeeper.py index 2983c14..c4c1940 100644 --- a/src/engine/SCons/Tool/BitKeeper.py +++ b/src/engine/SCons/Tool/BitKeeper.py @@ -47,7 +47,8 @@ def generate(env): """ """ 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' diff --git a/src/engine/SCons/Tool/CVS.py b/src/engine/SCons/Tool/CVS.py index 20bbb6a..3822b3b 100644 --- a/src/engine/SCons/Tool/CVS.py +++ b/src/engine/SCons/Tool/CVS.py @@ -33,8 +33,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os.path - import SCons.Builder import SCons.Util @@ -55,7 +53,8 @@ def generate(env): 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') diff --git a/src/engine/SCons/Tool/Perforce.py b/src/engine/SCons/Tool/Perforce.py index 3813d99..0c6796c 100644 --- a/src/engine/SCons/Tool/Perforce.py +++ b/src/engine/SCons/Tool/Perforce.py @@ -55,7 +55,8 @@ def generate(env): 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('') diff --git a/src/engine/SCons/Tool/RCS.py b/src/engine/SCons/Tool/RCS.py index a8f9168..ce7ba3a 100644 --- a/src/engine/SCons/Tool/RCS.py +++ b/src/engine/SCons/Tool/RCS.py @@ -44,7 +44,8 @@ def generate(env): """ """ 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' diff --git a/src/engine/SCons/Tool/SCCS.py b/src/engine/SCons/Tool/SCCS.py index 8230241..d15b49f 100644 --- a/src/engine/SCons/Tool/SCCS.py +++ b/src/engine/SCons/Tool/SCCS.py @@ -44,7 +44,8 @@ def generate(env): """ """ 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('') diff --git a/src/engine/SCons/Tool/Subversion.py b/src/engine/SCons/Tool/Subversion.py index 85e032b..23dbd97 100644 --- a/src/engine/SCons/Tool/Subversion.py +++ b/src/engine/SCons/Tool/Subversion.py @@ -52,7 +52,8 @@ def generate(env): SVNREPOSITORY = repos, SVNMODULE = module) - setattr(env, 'Subversion', SubversionFactory) + #setattr(env, 'Subversion', SubversionFactory) + env.Subversion = SubversionFactory env['SVN'] = 'svn' env['SVNFLAGS'] = SCons.Util.CLVar('') diff --git a/src/engine/SCons/Tool/aixf77.py b/src/engine/SCons/Tool/aixf77.py index 81db28b..8e612cd 100644 --- a/src/engine/SCons/Tool/aixf77.py +++ b/src/engine/SCons/Tool/aixf77.py @@ -34,7 +34,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path -import SCons.Platform.aix +#import SCons.Platform.aix import f77 diff --git a/src/engine/SCons/Tool/as.py b/src/engine/SCons/Tool/as.py index 3d630e3..6cd4184 100644 --- a/src/engine/SCons/Tool/as.py +++ b/src/engine/SCons/Tool/as.py @@ -33,8 +33,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os.path - import SCons.Defaults import SCons.Tool import SCons.Util diff --git a/src/engine/SCons/Tool/cc.py b/src/engine/SCons/Tool/cc.py index f096065..4c19c69 100644 --- a/src/engine/SCons/Tool/cc.py +++ b/src/engine/SCons/Tool/cc.py @@ -32,8 +32,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os.path - import SCons.Tool import SCons.Defaults import SCons.Util diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index cf0e050..758ed73 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -136,7 +136,7 @@ def generate(env): 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 diff --git a/src/engine/SCons/Tool/f77.py b/src/engine/SCons/Tool/f77.py index 83941f1..f05a410 100644 --- a/src/engine/SCons/Tool/f77.py +++ b/src/engine/SCons/Tool/f77.py @@ -33,8 +33,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os.path - import SCons.Defaults import SCons.Tool import SCons.Util diff --git a/src/engine/SCons/Tool/icc.py b/src/engine/SCons/Tool/icc.py index 4a553a0..20bf17c 100644 --- a/src/engine/SCons/Tool/icc.py +++ b/src/engine/SCons/Tool/icc.py @@ -33,8 +33,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import SCons.Util - import cc def generate(env): diff --git a/src/engine/SCons/Tool/icl.py b/src/engine/SCons/Tool/icl.py index d59647c..eeed447 100644 --- a/src/engine/SCons/Tool/icl.py +++ b/src/engine/SCons/Tool/icl.py @@ -34,7 +34,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path -import string import SCons.Tool.msvc import SCons.Util diff --git a/src/engine/SCons/Tool/jar.py b/src/engine/SCons/Tool/jar.py index 7934ed2..5a74a40 100644 --- a/src/engine/SCons/Tool/jar.py +++ b/src/engine/SCons/Tool/jar.py @@ -33,9 +33,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import glob -import os.path - import SCons.Builder import SCons.Util @@ -79,7 +76,7 @@ def jarChdir(target, source, env, for_signature): '-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, @@ -88,7 +85,7 @@ JarBuilder = SCons.Builder.Builder(action = '$JARCOM', 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 diff --git a/src/engine/SCons/Tool/javac.py b/src/engine/SCons/Tool/javac.py index b4a5ce9..e16f6d0 100644 --- a/src/engine/SCons/Tool/javac.py +++ b/src/engine/SCons/Tool/javac.py @@ -35,7 +35,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path -import re import string import SCons.Builder @@ -67,8 +66,8 @@ def emit_java_classes(target, source, env): 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) @@ -84,7 +83,7 @@ def emit_java_classes(target, source, env): 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) diff --git a/src/engine/SCons/Tool/javah.py b/src/engine/SCons/Tool/javah.py index c35f909..8f69a46 100644 --- a/src/engine/SCons/Tool/javah.py +++ b/src/engine/SCons/Tool/javah.py @@ -34,7 +34,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path -import re import string import SCons.Builder @@ -87,7 +86,6 @@ def emit_java_headers(target, source, env): 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' @@ -100,7 +98,7 @@ def emit_java_headers(target, source, env): 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) diff --git a/src/engine/SCons/Tool/masm.py b/src/engine/SCons/Tool/masm.py index 1bb9f95..9fa3354 100644 --- a/src/engine/SCons/Tool/masm.py +++ b/src/engine/SCons/Tool/masm.py @@ -33,8 +33,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os.path - import SCons.Defaults import SCons.Tool import SCons.Util diff --git a/src/engine/SCons/Tool/midl.py b/src/engine/SCons/Tool/midl.py index d02f23a..843d31b 100644 --- a/src/engine/SCons/Tool/midl.py +++ b/src/engine/SCons/Tool/midl.py @@ -33,8 +33,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os.path - import SCons.Defaults import SCons.Scanner.IDL import SCons.Util diff --git a/src/engine/SCons/Tool/mslink.py b/src/engine/SCons/Tool/mslink.py index 5ff8a01..5347606 100644 --- a/src/engine/SCons/Tool/mslink.py +++ b/src/engine/SCons/Tool/mslink.py @@ -48,6 +48,7 @@ def pdbGenerator(env, target, source, for_signature): 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 = [] diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index 17da702..f8d234b 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -36,7 +36,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path import re import string -import types import SCons.Action import SCons.Builder diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index 06f850e..ead57f2 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -407,7 +407,6 @@ class _GenerateV7DSP(_DSPGenerator): self.file.write(' <Configurations>\n') - first = 1 confkeys = self.configs.keys() confkeys.sort() for kind in confkeys: @@ -799,7 +798,7 @@ def get_visualstudio_versions(): # 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 @@ -1082,7 +1081,7 @@ def generate(env): """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 diff --git a/src/engine/SCons/Tool/nasm.py b/src/engine/SCons/Tool/nasm.py index 84075ba..6b74341 100644 --- a/src/engine/SCons/Tool/nasm.py +++ b/src/engine/SCons/Tool/nasm.py @@ -33,8 +33,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os.path - import SCons.Defaults import SCons.Tool import SCons.Util diff --git a/src/engine/SCons/Tool/qt.py b/src/engine/SCons/Tool/qt.py index a0dfed8..01a5cf6 100644 --- a/src/engine/SCons/Tool/qt.py +++ b/src/engine/SCons/Tool/qt.py @@ -36,7 +36,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path import re -import sys import SCons.Defaults import SCons.Tool @@ -106,9 +105,9 @@ class _Automoc: 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'): @@ -120,9 +119,9 @@ class _Automoc: 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) diff --git a/src/engine/SCons/Tool/rmic.py b/src/engine/SCons/Tool/rmic.py index 565dc9e..465bd68 100644 --- a/src/engine/SCons/Tool/rmic.py +++ b/src/engine/SCons/Tool/rmic.py @@ -34,7 +34,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path -import re import string import SCons.Builder @@ -79,7 +78,6 @@ def emit_rmic_classes(target, source, env): 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']: diff --git a/src/engine/SCons/Tool/sgic++.py b/src/engine/SCons/Tool/sgic++.py index 9081044..5461c4d 100644 --- a/src/engine/SCons/Tool/sgic++.py +++ b/src/engine/SCons/Tool/sgic++.py @@ -33,8 +33,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os.path - import SCons.Util cplusplus = __import__('c++', globals(), locals(), []) diff --git a/src/engine/SCons/Tool/sunc++.py b/src/engine/SCons/Tool/sunc++.py index 230c92b..673949b 100644 --- a/src/engine/SCons/Tool/sunc++.py +++ b/src/engine/SCons/Tool/sunc++.py @@ -10,20 +10,15 @@ selection method. __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() diff --git a/src/engine/SCons/Tool/sunlink.py b/src/engine/SCons/Tool/sunlink.py index 88624ca..4767559 100644 --- a/src/engine/SCons/Tool/sunlink.py +++ b/src/engine/SCons/Tool/sunlink.py @@ -48,8 +48,8 @@ try: 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 diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py index b58fadc..66e6011 100644 --- a/src/engine/SCons/Tool/swig.py +++ b/src/engine/SCons/Tool/swig.py @@ -33,8 +33,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os.path - import SCons.Defaults import SCons.Tool import SCons.Util diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 8b7207c..636a74f 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -1052,8 +1052,8 @@ else: 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) @@ -1085,11 +1085,11 @@ def PrependPath(oldpath, newpath, sep = os.pathsep): 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) @@ -1128,11 +1128,11 @@ def AppendPath(oldpath, newpath, sep = os.pathsep): 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) @@ -1159,8 +1159,8 @@ def AppendPath(oldpath, newpath, sep = os.pathsep): 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, @@ -1265,12 +1265,12 @@ else: 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 |