From 8c1f8a2450ae1dafadd9255bfb2c3aa8e651932a Mon Sep 17 00:00:00 2001 From: stevenknight Date: Sun, 12 Jan 2003 19:11:26 +0000 Subject: [PATCH] Fix small problems found by PyChecker. (Steve Leblanc) git-svn-id: http://scons.tigris.org/svn/scons/trunk@544 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- bin/check | 26 ++++++++++++++ bin/files | 55 +++++++++++++++++++++++++++++ bin/makedocs | 18 ++++++++++ src/CHANGES.txt | 6 ++++ src/engine/SCons/Action.py | 3 -- src/engine/SCons/Builder.py | 2 -- src/engine/SCons/Defaults.py | 2 -- src/engine/SCons/Environment.py | 4 --- src/engine/SCons/Node/FS.py | 2 -- src/engine/SCons/Node/__init__.py | 3 +- src/engine/SCons/Platform/cygwin.py | 1 - src/engine/SCons/Platform/os2.py | 2 -- src/engine/SCons/Scanner/C.py | 2 -- src/engine/SCons/Scanner/Fortran.py | 2 -- src/engine/SCons/Scanner/Prog.py | 1 - src/engine/SCons/Script/__init__.py | 1 - src/engine/SCons/Sig/__init__.py | 6 ++-- src/engine/SCons/Taskmaster.py | 1 - src/engine/SCons/Tool/__init__.py | 1 - src/engine/SCons/Tool/icc.py | 3 -- src/engine/SCons/Util.py | 2 +- src/engine/SCons/Warnings.py | 4 --- 22 files changed, 110 insertions(+), 37 deletions(-) create mode 100644 bin/check create mode 100644 bin/files create mode 100644 bin/makedocs diff --git a/bin/check b/bin/check new file mode 100644 index 00000000..f32494e4 --- /dev/null +++ b/bin/check @@ -0,0 +1,26 @@ +#! /bin/sh + +# This script runs pychecker on the SCons source and creates a file called +# checks.txt with the results. It must be run in the src/engine directory. + +base=`basename $PWD` +if [ "$base" != "engine" ]; then + echo "You must run this script from the engine directory." + exit +fi + +DEVDIR=../../doc/developer +SRCFILE=../../bin/files +CHKFILE=checks.txt + +rm -f $CHKFILE +for f in `cat $SRCFILE` ; do + echo >> $CHKFILE + echo " --- $f ---" >> $CHKFILE + env PYTHONPATH=. pychecker -T -z -Z --deprecated $f >> $CHKFILE +done + +if [ -e $CHKFILE ]; then + sed -e "s|$PWD/||" $CHKFILE > /tmp/tmpchk + mv -f /tmp/tmpchk $CHKFILE +fi diff --git a/bin/files b/bin/files new file mode 100644 index 00000000..d4ec77ab --- /dev/null +++ b/bin/files @@ -0,0 +1,55 @@ +./SCons/Action.py +./SCons/Builder.py +./SCons/Defaults.py +./SCons/Environment.py +./SCons/Errors.py +./SCons/Job.py +./SCons/Node/Alias.py +./SCons/Node/FS.py +./SCons/Node/__init__.py +./SCons/Options.py +./SCons/Platform/__init__.py +./SCons/Platform/cygwin.py +./SCons/Platform/os2.py +./SCons/Platform/posix.py +./SCons/Platform/win32.py +./SCons/Scanner/C.py +./SCons/Scanner/Fortran.py +./SCons/Scanner/Prog.py +./SCons/Scanner/__init__.py +./SCons/Script/SConscript.py +./SCons/Script/__init__.py +./SCons/Sig/MD5.py +./SCons/Sig/TimeStamp.py +./SCons/Sig/__init__.py +./SCons/Taskmaster.py +./SCons/Tool/__init__.py +./SCons/Tool/ar.py +./SCons/Tool/default.py +./SCons/Tool/dvipdf.py +./SCons/Tool/dvips.py +./SCons/Tool/g++.py +./SCons/Tool/g77.py +./SCons/Tool/gas.py +./SCons/Tool/gcc.py +./SCons/Tool/gnulink.py +./SCons/Tool/icc.py +./SCons/Tool/ifl.py +./SCons/Tool/ilink.py +./SCons/Tool/latex.py +./SCons/Tool/lex.py +./SCons/Tool/masm.py +./SCons/Tool/mingw.py +./SCons/Tool/mslib.py +./SCons/Tool/mslink.py +./SCons/Tool/msvc.py +./SCons/Tool/nasm.py +./SCons/Tool/pdflatex.py +./SCons/Tool/pdftex.py +./SCons/Tool/tar.py +./SCons/Tool/tex.py +./SCons/Tool/yacc.py +./SCons/Util.py +./SCons/Warnings.py +./SCons/__init__.py +./SCons/exitfuncs.py diff --git a/bin/makedocs b/bin/makedocs new file mode 100644 index 00000000..2278a97f --- /dev/null +++ b/bin/makedocs @@ -0,0 +1,18 @@ +#! /bin/sh + +# This script uses HappyDoc to create the HTML class documentation for +# SCons. It must be run from the src/engine directory. + +base=`basename $PWD` +if [ "$base" != "engine" ]; then + echo "You must run this script from the engine directory." + exit +fi + +DEVDIR=../../doc/developer +if [ ! -d $DEVDIR ]; then + mkdir $DEVDIR +fi + +SRCFILE=../../bin/files +happydoc -d $DEVDIR `cat $SRCFILE` diff --git a/src/CHANGES.txt b/src/CHANGES.txt index bc885f7a..f74cb921 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -56,6 +56,12 @@ RELEASE 0.10 - XXX - Add a Clean() method to support removing user-specified targets when using the -c option. + - Add a development script for running SCons through PyChecker. + + - Clean up things found by PyChecker (mostly unnecessary imports). + + - Add a script to use HappyDoc to create HTML class documentation. + From Lachlan O'Dea: - Make the Environment.get() method return None by default. diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index d8a08be5..61a799c2 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -29,13 +29,10 @@ XXX __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import copy import os import os.path import re import string -import sys -import UserDict import SCons.Errors import SCons.Util diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py index 9c91c011..122ee498 100644 --- a/src/engine/SCons/Builder.py +++ b/src/engine/SCons/Builder.py @@ -46,8 +46,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path -import string -import copy from SCons.Errors import UserError import SCons.Action diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 20166945..bfda9fe2 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -37,9 +37,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os -import stat import string -import sys import os.path import SCons.Action diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 5ebf64c6..d731eb30 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -34,10 +34,6 @@ import copy import os import os.path import re -import shutil -import string -import sys -import types from UserDict import UserDict import SCons.Action diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 1b627fd9..eb23cd8f 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -39,8 +39,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path import string -import sys -import types from UserDict import UserDict import SCons.Action diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index bac547c2..14f99edc 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -47,7 +47,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import copy -import types import SCons.Sig import SCons.Util @@ -457,7 +456,7 @@ class Node: def get_state(self): return self.state - def current(self): + def current(self, calc=None): return None def rfile(self): diff --git a/src/engine/SCons/Platform/cygwin.py b/src/engine/SCons/Platform/cygwin.py index fe5a8186..bda1c909 100644 --- a/src/engine/SCons/Platform/cygwin.py +++ b/src/engine/SCons/Platform/cygwin.py @@ -32,7 +32,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import SCons.Util import posix def generate(env): diff --git a/src/engine/SCons/Platform/os2.py b/src/engine/SCons/Platform/os2.py index c3895219..631952a1 100644 --- a/src/engine/SCons/Platform/os2.py +++ b/src/engine/SCons/Platform/os2.py @@ -32,8 +32,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import SCons.Util - def generate(env): if not env.has_key('ENV'): env['ENV'] = {} diff --git a/src/engine/SCons/Scanner/C.py b/src/engine/SCons/Scanner/C.py index b9f2d8f0..5a58d126 100644 --- a/src/engine/SCons/Scanner/C.py +++ b/src/engine/SCons/Scanner/C.py @@ -30,8 +30,6 @@ This module implements the depenency scanner for C/C++ code. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import copy -import os.path import re import SCons.Node diff --git a/src/engine/SCons/Scanner/Fortran.py b/src/engine/SCons/Scanner/Fortran.py index 034d5ac5..a47e02f2 100644 --- a/src/engine/SCons/Scanner/Fortran.py +++ b/src/engine/SCons/Scanner/Fortran.py @@ -30,8 +30,6 @@ This module implements the dependency scanner for Fortran code. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import copy -import os.path import re import SCons.Node diff --git a/src/engine/SCons/Scanner/Prog.py b/src/engine/SCons/Scanner/Prog.py index 081fd5cb..b2eb1214 100644 --- a/src/engine/SCons/Scanner/Prog.py +++ b/src/engine/SCons/Scanner/Prog.py @@ -23,7 +23,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import copy import string import SCons.Node diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index ca6536fb..a33e373e 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -44,7 +44,6 @@ import os.path import string import sys import traceback -import copy # Strip the script directory from sys.path() so on case-insensitive # (WIN32) systems Python doesn't think that the "scons" script is the diff --git a/src/engine/SCons/Sig/__init__.py b/src/engine/SCons/Sig/__init__.py index 4fe94231..1fd88a4d 100644 --- a/src/engine/SCons/Sig/__init__.py +++ b/src/engine/SCons/Sig/__init__.py @@ -29,13 +29,13 @@ The Signature package for the scons software construction utility. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import cPickle import os import os.path -import string -import SCons.Node import time + +import SCons.Node import SCons.Warnings -import cPickle try: import MD5 diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py index 74703f2b..dea07391 100644 --- a/src/engine/SCons/Taskmaster.py +++ b/src/engine/SCons/Taskmaster.py @@ -29,7 +29,6 @@ Generic Taskmaster. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import copy import string import sys diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index f5cea7ee..fbb09aff 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -39,7 +39,6 @@ tool definition. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import imp -import os import sys import SCons.Errors diff --git a/src/engine/SCons/Tool/icc.py b/src/engine/SCons/Tool/icc.py index b21069a0..1d64dcb8 100644 --- a/src/engine/SCons/Tool/icc.py +++ b/src/engine/SCons/Tool/icc.py @@ -33,9 +33,6 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os.path -import string - import SCons.Action import SCons.Tool import SCons.Errors diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 5a1c0784..c89e8e6b 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -764,6 +764,6 @@ def fs_delete(path, remove=1): if remove: os.rmdir(path) display("Removed directory " + path) except OSError, e: - print "scons: Could not remove '%s':" % str(t), e.strerror + print "scons: Could not remove '%s':" % str(path), e.strerror display = DisplayEngine() diff --git a/src/engine/SCons/Warnings.py b/src/engine/SCons/Warnings.py index bf18ba5a..070db263 100644 --- a/src/engine/SCons/Warnings.py +++ b/src/engine/SCons/Warnings.py @@ -29,10 +29,6 @@ This file implements the warnings framework for SCons. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import sys -import copy -import traceback - import SCons.Errors class Warning(SCons.Errors.UserError): -- 2.26.2