summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-07-18 06:16:08 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-07-18 06:16:08 (GMT)
commit182b5aca27d376b08a2904bed42b751496f932f3 (patch)
treedf13115820dbc879c0fe2eae488c9f8c0215a7da /Tools
parente6ddc8b20b493fef2e7cffb2e1351fe1d238857e (diff)
downloadcpython-182b5aca27d376b08a2904bed42b751496f932f3.zip
cpython-182b5aca27d376b08a2904bed42b751496f932f3.tar.gz
cpython-182b5aca27d376b08a2904bed42b751496f932f3.tar.bz2
Whitespace normalization, via reindent.py.
Diffstat (limited to 'Tools')
-rw-r--r--Tools/bgen/bgen/bgenBuffer.py66
-rw-r--r--Tools/bgen/bgen/bgenGenerator.py14
-rw-r--r--Tools/bgen/bgen/bgenHeapBuffer.py14
-rw-r--r--Tools/bgen/bgen/bgenModule.py2
-rw-r--r--Tools/bgen/bgen/bgenObjectDefinition.py98
-rw-r--r--Tools/bgen/bgen/bgenOutput.py18
-rw-r--r--Tools/bgen/bgen/bgenStringBuffer.py6
-rw-r--r--Tools/bgen/bgen/bgenType.py6
-rw-r--r--Tools/bgen/bgen/macsupport.py6
-rw-r--r--Tools/bgen/bgen/scantools.py25
-rw-r--r--Tools/compiler/astgen.py4
-rw-r--r--Tools/compiler/compile.py2
-rwxr-xr-xTools/compiler/demo.py6
-rw-r--r--Tools/faqwiz/faqconf.py4
-rw-r--r--Tools/faqwiz/faqwiz.py6
-rw-r--r--Tools/framer/example.py9
-rw-r--r--Tools/framer/framer/__init__.py2
-rw-r--r--Tools/framer/framer/bases.py11
-rw-r--r--Tools/framer/framer/function.py10
-rw-r--r--Tools/framer/framer/struct.py2
-rw-r--r--Tools/framer/framer/structparse.py2
-rw-r--r--Tools/framer/framer/template.py6
-rw-r--r--Tools/freeze/bkfile.py82
-rw-r--r--Tools/freeze/checkextensions.py146
-rw-r--r--Tools/freeze/checkextensions_win32.py250
-rwxr-xr-xTools/freeze/freeze.py12
-rw-r--r--Tools/freeze/makeconfig.py92
-rw-r--r--Tools/freeze/makefreeze.py2
-rw-r--r--Tools/freeze/makemakefile.py2
-rw-r--r--Tools/freeze/parsesetup.py162
-rwxr-xr-xTools/i18n/msgfmt.py4
-rwxr-xr-xTools/modulator/Tkextra.py4
-rwxr-xr-xTools/modulator/genmodule.py4
-rwxr-xr-xTools/modulator/modulator.py26
-rw-r--r--Tools/modulator/varsubst.py2
-rw-r--r--Tools/pynche/ChipViewer.py2
-rw-r--r--Tools/pynche/DetailsViewer.py4
-rw-r--r--Tools/pynche/StripViewer.py6
-rw-r--r--Tools/unicode/mkstringprep.py1
-rw-r--r--Tools/versioncheck/checkversions.py6
-rw-r--r--Tools/versioncheck/pyversioncheck.py1
-rwxr-xr-xTools/webchecker/wcgui.py10
-rwxr-xr-xTools/webchecker/webchecker.py8
43 files changed, 566 insertions, 579 deletions
diff --git a/Tools/bgen/bgen/bgenBuffer.py b/Tools/bgen/bgen/bgenBuffer.py
index 4b888d7..ca7e026 100644
--- a/Tools/bgen/bgen/bgenBuffer.py
+++ b/Tools/bgen/bgen/bgenBuffer.py
@@ -27,7 +27,7 @@ type2format = {
class FixedInputOutputBufferType(InputOnlyType):
-
+
"""Fixed buffer -- passed as (inbuffer, outbuffer)."""
def __init__(self, size, datatype = 'char', sizetype = 'int', sizeformat = None):
@@ -41,14 +41,14 @@ class FixedInputOutputBufferType(InputOnlyType):
def declare(self, name):
self.declareBuffer(name)
self.declareSize(name)
-
+
def declareBuffer(self, name):
self.declareInputBuffer(name)
self.declareOutputBuffer(name)
-
+
def declareInputBuffer(self, name):
Output("%s *%s__in__;", self.datatype, name)
-
+
def declareOutputBuffer(self, name):
Output("%s %s__out__[%s];", self.datatype, name, self.size)
@@ -61,7 +61,7 @@ class FixedInputOutputBufferType(InputOnlyType):
def getargsArgs(self, name):
return "&%s__in__, &%s__in_len__" % (name, name)
-
+
def getargsCheck(self, name):
Output("if (%s__in_len__ != %s)", name, self.size)
OutLbrace()
@@ -71,19 +71,19 @@ class FixedInputOutputBufferType(InputOnlyType):
self.label_needed = 1
OutRbrace()
self.transferSize(name)
-
+
def transferSize(self, name):
Output("%s__len__ = %s__in_len__;", name, name)
def passOutput(self, name):
return "%s__in__, %s__out__" % (name, name)
-
+
def mkvalueFormat(self):
return "s#"
def mkvalueArgs(self, name):
return "%s__out__, (int)%s" % (name, self.size)
-
+
def cleanup(self, name):
if self.label_needed:
DedentLevel()
@@ -92,9 +92,9 @@ class FixedInputOutputBufferType(InputOnlyType):
class FixedCombinedInputOutputBufferType(FixedInputOutputBufferType):
-
+
"""Like fixed buffer -- but same parameter is input and output."""
-
+
def passOutput(self, name):
return "(%s *)memcpy(%s__out__, %s__in__, %s)" % \
(self.datatype, name, name, self.size)
@@ -112,10 +112,10 @@ class OutputOnlyBufferMixIn(OutputOnlyMixIn):
pass
class OptionalInputBufferMixIn:
-
+
"""Add to input buffers if the buffer may be omitted: pass None in Python
and the C code will get a NULL pointer and zero size"""
-
+
def getargsFormat(self):
return "z#"
@@ -147,63 +147,63 @@ class FixedOutputBufferType(OutputOnlyBufferMixIn, FixedInputOutputBufferType):
class VarInputBufferType(FixedInputBufferType):
"""Variable size input buffer -- passed as (buffer, size).
-
+
Instantiate without size parameter.
"""
-
+
def __init__(self, datatype = 'char', sizetype = 'int', sizeformat = None):
FixedInputBufferType.__init__(self, "0", datatype, sizetype, sizeformat)
-
+
def getargsCheck(self, name):
Output("%s__len__ = %s__in_len__;", name, name)
-
+
def passInput(self, name):
return "%s__in__, %s__len__" % (name, name)
-
+
class ReverseInputBufferMixin:
""" Mixin for input buffers that are passed as (size, buffer) """
-
+
def passInput(self, name):
return "%s__len__, %s__in__" % (name, name)
-
+
class OptionalVarInputBufferType(OptionalInputBufferMixIn, VarInputBufferType):
pass
-
+
# ----- PART 2: Structure buffers -----
class StructInputOutputBufferType(FixedInputOutputBufferType):
-
+
"""Structure buffer -- passed as a structure pointer.
Instantiate with the struct type as parameter.
"""
-
+
def __init__(self, type):
FixedInputOutputBufferType.__init__(self, "sizeof(%s)" % type)
self.typeName = self.type = type
-
+
def declareInputBuffer(self, name):
Output("%s *%s__in__;", self.type, name)
-
+
def declareSize(self, name):
Output("int %s__in_len__;", name)
-
+
def declareOutputBuffer(self, name):
Output("%s %s__out__;", self.type, name)
-
+
def getargsArgs(self, name):
return "(char **)&%s__in__, &%s__in_len__" % (name, name)
-
+
def transferSize(self, name):
pass
-
+
def passInput(self, name):
return "%s__in__" % name
-
+
def passOutput(self, name):
return "%s__in__, &%s__out__" % (name, name)
-
+
def mkvalueArgs(self, name):
return "(char *)&%s__out__, (int)%s" % (name, self.size)
@@ -211,7 +211,7 @@ class StructInputOutputBufferType(FixedInputOutputBufferType):
class StructCombinedInputOutputBufferType(StructInputOutputBufferType):
"""Like structure buffer -- but same parameter is input and output."""
-
+
def passOutput(self, name):
return "(%s *)memcpy((char *)%s__out__, (char *)%s__in__, %s)" % \
(self.type, name, name, self.size)
@@ -242,7 +242,7 @@ class StructOutputBufferType(OutputOnlyBufferMixIn, StructInputOutputBufferType)
Instantiate with the struct type as parameter.
"""
-
+
def declareSize(self, name):
pass
@@ -256,7 +256,7 @@ class ArrayOutputBufferType(OutputOnlyBufferMixIn, StructInputOutputBufferType):
Instantiate with the struct type as parameter.
"""
-
+
def declareSize(self, name):
pass
diff --git a/Tools/bgen/bgen/bgenGenerator.py b/Tools/bgen/bgen/bgenGenerator.py
index f3cdfce..e1f240c 100644
--- a/Tools/bgen/bgen/bgenGenerator.py
+++ b/Tools/bgen/bgen/bgenGenerator.py
@@ -55,7 +55,7 @@ class BaseFunctionGenerator:
docstring = self.docstring()
if self.condition:
Output()
- Output(self.condition)
+ Output(self.condition)
Output("{\"%s\", (PyCFunction)%s_%s, 1,", name, self.prefix, self.name)
Output(" PyDoc_STR(%s)},", stringify(docstring))
if self.condition:
@@ -91,7 +91,7 @@ class ManualGenerator(BaseFunctionGenerator):
def functionbody(self):
Output("%s", self.body)
-
+
def setselftype(self, selftype, itselftype):
self.objecttype = selftype
self.itselftype = itselftype
@@ -114,7 +114,7 @@ class FunctionGenerator(BaseFunctionGenerator):
self.argumentList.append(self.rv)
else:
self.rv = None
-
+
def makereturnvar(self):
return Variable(self.returntype, "_rv", OutMode)
@@ -129,7 +129,7 @@ class FunctionGenerator(BaseFunctionGenerator):
if name is None: name = "_arg%d" % iarg
arg = Variable(type, name, mode)
self.argumentList.append(arg)
-
+
def docstring(self):
input = []
output = []
@@ -146,7 +146,7 @@ class FunctionGenerator(BaseFunctionGenerator):
else:
typeName = "?"
print "Nameless type", arg.type
-
+
str = typeName + ' ' + arg.name
if arg.mode in (InMode, InOutMode):
input.append(str)
@@ -161,7 +161,7 @@ class FunctionGenerator(BaseFunctionGenerator):
else:
outstr = "(%s)" % ", ".join(output)
return instr + " -> " + outstr
-
+
def functionbody(self):
self.declarations()
self.precheck()
@@ -195,7 +195,7 @@ class FunctionGenerator(BaseFunctionGenerator):
continue
if arg.mode in (InMode, InOutMode):
arg.getargsCheck()
-
+
def precheck(self):
pass
diff --git a/Tools/bgen/bgen/bgenHeapBuffer.py b/Tools/bgen/bgen/bgenHeapBuffer.py
index 9bfc5a1..64cf2a4 100644
--- a/Tools/bgen/bgen/bgenHeapBuffer.py
+++ b/Tools/bgen/bgen/bgenHeapBuffer.py
@@ -43,7 +43,7 @@ class HeapInputOutputBufferType(FixedInputOutputBufferType):
class VarHeapInputOutputBufferType(HeapInputOutputBufferType):
"""same as base class, but passed as (inbuffer, outbuffer, &size)"""
-
+
def passOutput(self, name):
return "%s__in__, %s__out__, &%s__len__" % (name, name, name)
@@ -51,7 +51,7 @@ class VarHeapInputOutputBufferType(HeapInputOutputBufferType):
class HeapCombinedInputOutputBufferType(HeapInputOutputBufferType):
"""same as base class, but passed as (inoutbuffer, size)"""
-
+
def passOutput(self, name):
return "(%s *)memcpy(%s__out__, %s__in__, %s__len__)" % \
(self.datatype, name, name, name)
@@ -60,7 +60,7 @@ class HeapCombinedInputOutputBufferType(HeapInputOutputBufferType):
class VarHeapCombinedInputOutputBufferType(HeapInputOutputBufferType):
"""same as base class, but passed as (inoutbuffer, &size)"""
-
+
def passOutput(self, name):
return "(%s *)memcpy(%s__out__, %s__in__, &%s__len__)" % \
(self.datatype, name, name, name)
@@ -73,16 +73,16 @@ class HeapOutputBufferType(OutputOnlyMixIn, HeapInputOutputBufferType):
Instantiate without parameters.
Call from Python with buffer size.
"""
-
+
def declareInputBuffer(self, name):
pass
-
+
def getargsFormat(self):
return "i"
-
+
def getargsArgs(self, name):
return "&%s__in_len__" % name
-
+
def passOutput(self, name):
return "%s__out__, %s__len__" % (name, name)
diff --git a/Tools/bgen/bgen/bgenModule.py b/Tools/bgen/bgen/bgenModule.py
index 3e26b16..d41aa05 100644
--- a/Tools/bgen/bgen/bgenModule.py
+++ b/Tools/bgen/bgen/bgenModule.py
@@ -38,7 +38,7 @@ class Module(GeneratorGroup):
self.declareModuleVariables()
GeneratorGroup.generate(self)
-
+
if self.finalstuff:
Output()
Output("%s", self.finalstuff)
diff --git a/Tools/bgen/bgen/bgenObjectDefinition.py b/Tools/bgen/bgen/bgenObjectDefinition.py
index 9c205e3..72e2678 100644
--- a/Tools/bgen/bgen/bgenObjectDefinition.py
+++ b/Tools/bgen/bgen/bgenObjectDefinition.py
@@ -9,14 +9,14 @@ class ObjectDefinition(GeneratorGroup):
def __init__(self, name, prefix, itselftype):
"""ObjectDefinition constructor. May be extended, but do not override.
-
+
- name: the object's official name, e.g. 'SndChannel'.
- prefix: the prefix used for the object's functions and data, e.g. 'SndCh'.
- itselftype: the C type actually contained in the object, e.g. 'SndChannelPtr'.
-
+
XXX For official Python data types, rules for the 'Py' prefix are a problem.
"""
-
+
GeneratorGroup.__init__(self, prefix or name)
self.name = name
self.itselftype = itselftype
@@ -35,7 +35,7 @@ class ObjectDefinition(GeneratorGroup):
def reference(self):
# In case we are referenced from a module
pass
-
+
def setmodulename(self, name):
self.modulename = name
@@ -58,7 +58,7 @@ class ObjectDefinition(GeneratorGroup):
Output("} %s;", self.objecttype)
self.outputNew()
-
+
self.outputConvert()
self.outputDealloc()
@@ -71,19 +71,19 @@ class ObjectDefinition(GeneratorGroup):
self.outputGetattr()
self.outputSetattr()
-
+
self.outputCompare()
-
+
self.outputRepr()
-
+
self.outputHash()
-
+
self.outputPEP253Hooks()
-
+
self.outputTypeObject()
OutHeader2("End object type " + self.name)
-
+
def outputMethodChain(self):
Output("%sPyMethodChain %s_chain = { %s_methods, %s };",
self.static, self.prefix, self.prefix, self.basechain)
@@ -108,10 +108,10 @@ class ObjectDefinition(GeneratorGroup):
def outputInitStructMembers(self):
Output("it->ob_itself = %sitself;", self.argref)
-
+
def outputCheckNewArg(self):
- "Override this method to apply additional checks/conversions"
-
+ "Override this method to apply additional checks/conversions"
+
def outputConvert(self):
Output("%sint %s_Convert(PyObject *v, %s *p_itself)", self.static, self.prefix,
self.itselftype)
@@ -206,7 +206,7 @@ class ObjectDefinition(GeneratorGroup):
Output("(hashfunc) %s_hash, /*tp_hash*/", self.prefix)
DedentLevel()
Output("};")
-
+
def outputTypeObjectInitializer(self):
Output("""%s.ob_type = &PyType_Type;""", self.typename)
if self.basetype:
@@ -220,10 +220,10 @@ class ObjectDefinition(GeneratorGroup):
def outputPEP253Hooks(self):
pass
-
+
class PEP252Mixin:
getsetlist = []
-
+
def assertions(self):
# Check that various things aren't overridden. If they are it could
# signify a bgen-client that has been partially converted to PEP252.
@@ -232,21 +232,21 @@ class PEP252Mixin:
assert self.outputGetattrBody == None
assert self.outputGetattrHook == None
assert self.basechain == "NULL"
-
+
def outputGetattr(self):
pass
-
+
outputGetattrBody = None
outputGetattrHook = None
def outputSetattr(self):
pass
-
+
def outputMethodChain(self):
# This is a good place to output the getters and setters
self.outputGetSetList()
-
+
def outputHook(self, name):
methodname = "outputHook_" + name
if hasattr(self, methodname):
@@ -254,7 +254,7 @@ class PEP252Mixin:
func()
else:
Output("0, /*%s*/", name)
-
+
def outputTypeObject(self):
sf = self.static and "static "
Output()
@@ -268,7 +268,7 @@ class PEP252Mixin:
Output("\"%s\", /*tp_name*/", self.name)
Output("sizeof(%s), /*tp_basicsize*/", self.objecttype)
Output("0, /*tp_itemsize*/")
-
+
Output("/* methods */")
Output("(destructor) %s_dealloc, /*tp_dealloc*/", self.prefix)
Output("0, /*tp_print*/")
@@ -276,17 +276,17 @@ class PEP252Mixin:
Output("(setattrfunc)0, /*tp_setattr*/")
Output("(cmpfunc) %s_compare, /*tp_compare*/", self.prefix)
Output("(reprfunc) %s_repr, /*tp_repr*/", self.prefix)
-
+
Output("(PyNumberMethods *)0, /* tp_as_number */")
Output("(PySequenceMethods *)0, /* tp_as_sequence */")
Output("(PyMappingMethods *)0, /* tp_as_mapping */")
-
+
Output("(hashfunc) %s_hash, /*tp_hash*/", self.prefix)
self.outputHook("tp_call")
Output("0, /*tp_str*/")
Output("PyObject_GenericGetAttr, /*tp_getattro*/")
Output("PyObject_GenericSetAttr, /*tp_setattro */")
-
+
self.outputHook("tp_as_buffer")
Output("%s, /* tp_flags */", self.tp_flags)
self.outputHook("tp_doc")
@@ -310,7 +310,7 @@ class PEP252Mixin:
self.outputHook("tp_free")
DedentLevel()
Output("};")
-
+
def outputGetSetList(self):
if self.getsetlist:
for name, get, set, doc in self.getsetlist:
@@ -324,7 +324,7 @@ class PEP252Mixin:
else:
Output("#define %s_set_%s NULL", self.prefix, name)
Output()
-
+
Output("static PyGetSetDef %s_getsetlist[] = {", self.prefix)
IndentLevel()
for name, get, set, doc in self.getsetlist:
@@ -332,7 +332,7 @@ class PEP252Mixin:
doc = '"' + doc + '"'
else:
doc = "NULL"
- Output("{\"%s\", (getter)%s_get_%s, (setter)%s_set_%s, %s},",
+ Output("{\"%s\", (getter)%s_get_%s, (setter)%s_set_%s, %s},",
name, self.prefix, name, self.prefix, name, doc)
Output("{NULL, NULL, NULL, NULL},")
DedentLevel()
@@ -340,7 +340,7 @@ class PEP252Mixin:
else:
Output("#define %s_getsetlist NULL", self.prefix)
Output()
-
+
def outputGetter(self, name, code):
Output("static PyObject *%s_get_%s(%s *self, void *closure)",
self.prefix, name, self.objecttype)
@@ -348,7 +348,7 @@ class PEP252Mixin:
Output(code)
OutRbrace()
Output()
-
+
def outputSetter(self, name, code):
Output("static int %s_set_%s(%s *self, PyObject *v, void *closure)",
self.prefix, name, self.objecttype)
@@ -357,24 +357,24 @@ class PEP252Mixin:
Output("return 0;")
OutRbrace()
Output()
-
+
class PEP253Mixin(PEP252Mixin):
tp_flags = "Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE"
-
+
def outputHook_tp_init(self):
Output("%s_tp_init, /* tp_init */", self.prefix)
-
+
def outputHook_tp_alloc(self):
Output("%s_tp_alloc, /* tp_alloc */", self.prefix)
-
+
def outputHook_tp_new(self):
Output("%s_tp_new, /* tp_new */", self.prefix)
-
+
def outputHook_tp_free(self):
Output("%s_tp_free, /* tp_free */", self.prefix)
-
+
output_tp_initBody = None
-
+
def output_tp_init(self):
if self.output_tp_initBody:
Output("static int %s_tp_init(PyObject *self, PyObject *args, PyObject *kwds)", self.prefix)
@@ -384,9 +384,9 @@ class PEP253Mixin(PEP252Mixin):
else:
Output("#define %s_tp_init 0", self.prefix)
Output()
-
+
output_tp_allocBody = None
-
+
def output_tp_alloc(self):
if self.output_tp_allocBody:
Output("static PyObject *%s_tp_alloc(PyTypeObject *type, int nitems)",
@@ -397,7 +397,7 @@ class PEP253Mixin(PEP252Mixin):
else:
Output("#define %s_tp_alloc PyType_GenericAlloc", self.prefix)
Output()
-
+
def output_tp_newBody(self):
Output("PyObject *self;");
Output("%s itself;", self.itselftype);
@@ -408,7 +408,7 @@ class PEP253Mixin(PEP252Mixin):
Output("if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;")
Output("((%s *)self)->ob_itself = itself;", self.objecttype)
Output("return self;")
-
+
def output_tp_new(self):
if self.output_tp_newBody:
Output("static PyObject *%s_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)", self.prefix)
@@ -418,9 +418,9 @@ class PEP253Mixin(PEP252Mixin):
else:
Output("#define %s_tp_new PyType_GenericNew", self.prefix)
Output()
-
+
output_tp_freeBody = None
-
+
def output_tp_free(self):
if self.output_tp_freeBody:
Output("static void %s_tp_free(PyObject *self)", self.prefix)
@@ -430,7 +430,7 @@ class PEP253Mixin(PEP252Mixin):
else:
Output("#define %s_tp_free PyObject_Del", self.prefix)
Output()
-
+
def outputPEP253Hooks(self):
self.output_tp_init()
self.output_tp_alloc()
@@ -439,7 +439,7 @@ class PEP253Mixin(PEP252Mixin):
class GlobalObjectDefinition(ObjectDefinition):
"""Like ObjectDefinition but exports some parts.
-
+
XXX Should also somehow generate a .h file for them.
"""
@@ -453,7 +453,7 @@ class ObjectIdentityMixin:
be returned by library calls and it is difficult (or impossible) to find
the corresponding Python objects. With this you can create Python object
wrappers on the fly"""
-
+
def outputCompare(self):
Output()
Output("static int %s_compare(%s *self, %s *other)", self.prefix, self.objecttype,
@@ -475,12 +475,10 @@ class ObjectIdentityMixin:
Output("if( v > w ) return 1;")
Output("return 0;")
OutRbrace()
-
+
def outputHash(self):
Output()
Output("static long %s_hash(%s *self)", self.prefix, self.objecttype)
OutLbrace()
Output("return (long)self->ob_itself;")
OutRbrace()
-
-
diff --git a/Tools/bgen/bgen/bgenOutput.py b/Tools/bgen/bgen/bgenOutput.py
index 304a52d..53d4f55 100644
--- a/Tools/bgen/bgen/bgenOutput.py
+++ b/Tools/bgen/bgen/bgenOutput.py
@@ -30,7 +30,7 @@ def SetOutputFile(file = None, needclose = 0):
def SetOutputFileName(filename = None):
"""Call this with a filename to make it the output file.
-
+
Call it without arguments to close the current file (if necessary)
and reset it to sys.stdout.
"""
@@ -95,7 +95,7 @@ def DedentLevel(by = 1):
def OutIndent(format = "", *args):
"""Combine Output() followed by IndentLevel().
-
+
If no text is given, acts like lone IndentLevel().
"""
if format: VaOutput(format, args)
@@ -103,7 +103,7 @@ def OutIndent(format = "", *args):
def OutDedent(format = "", *args):
"""Combine Output() followed by DedentLevel().
-
+
If no text is given, acts like loneDedentLevel().
"""
if format: VaOutput(format, args)
@@ -111,7 +111,7 @@ def OutDedent(format = "", *args):
def OutLbrace(format = "", *args):
"""Like Output, but add a '{' and increase the indentation level.
-
+
If no text is given a lone '{' is output.
"""
if format:
@@ -143,13 +143,13 @@ def OutHeader2(text):
def Out(text):
"""Output multiline text that's internally indented.
-
+
Pass this a multiline character string. The whitespace before the
first nonblank line of the string will be subtracted from all lines.
The lines are then output using Output(), but without interpretation
of formatting (if you need formatting you can do it before the call).
Recommended use:
-
+
Out('''
int main(argc, argv)
int argc;
@@ -159,14 +159,14 @@ def Out(text):
exit(0);
}
''')
-
+
Caveat: the indentation must be consistent -- if you use three tabs
in the first line, (up to) three tabs are removed from following lines,
but a line beginning with 24 spaces is not trimmed at all. Don't use
this as a feature.
"""
# (Don't you love using triple quotes *inside* triple quotes? :-)
-
+
lines = text.split('\n')
indent = ""
for line in lines:
@@ -193,7 +193,7 @@ def _test():
Out("""
#include <Python.h>
#include <stdio.h>
-
+
main(argc, argv)
int argc;
char **argv;
diff --git a/Tools/bgen/bgen/bgenStringBuffer.py b/Tools/bgen/bgen/bgenStringBuffer.py
index 39c8cf9..683bc0f 100644
--- a/Tools/bgen/bgen/bgenStringBuffer.py
+++ b/Tools/bgen/bgen/bgenStringBuffer.py
@@ -22,13 +22,13 @@ class StringBufferMixIn:
pointer is returned. These are actually easier (no allocation) but far
less common. I'll write the classes when there is demand.)
"""
-
+
def declareSize(self, name):
pass
-
+
def getargsFormat(self):
return "s"
-
+
def getargsArgs(self, name):
return "&%s__in__" % name
diff --git a/Tools/bgen/bgen/bgenType.py b/Tools/bgen/bgen/bgenType.py
index aa87aee..4f3026a 100644
--- a/Tools/bgen/bgen/bgenType.py
+++ b/Tools/bgen/bgen/bgenType.py
@@ -204,8 +204,8 @@ class OpaqueType(Type):
self.convert = arg + '_Convert'
else:
# Three arguments (name, new, convert)
- self.new = arg
- self.convert = extra
+ self.new = arg
+ self.convert = extra
def getargsFormat(self):
return "O&"
@@ -236,7 +236,7 @@ class OpaqueByValueType(OpaqueType):
def mkvalueArgs(self, name):
return "%s, %s" % (self.new, name)
-
+
class OpaqueByValueStructType(OpaqueByValueType):
"""Similar to OpaqueByValueType, but we also pass this to mkvalue by
address, in stead of by value.
diff --git a/Tools/bgen/bgen/macsupport.py b/Tools/bgen/bgen/macsupport.py
index eef6db8..7cd2b81 100644
--- a/Tools/bgen/bgen/macsupport.py
+++ b/Tools/bgen/bgen/macsupport.py
@@ -129,10 +129,10 @@ class VarUnicodeInputBufferType(VarInputBufferType):
def getargsFormat(self):
return "u#"
-
+
class VarUnicodeReverseInputBufferType(ReverseInputBufferMixin, VarUnicodeInputBufferType):
pass
-
+
UnicodeInBuffer = VarUnicodeInputBufferType('UniChar', 'UniCharCount', 'l')
UnicodeReverseInBuffer = VarUnicodeReverseInputBufferType('UniChar', 'UniCharCount', 'l')
UniChar_ptr = InputOnlyType("UniCharPtr", "u")
@@ -180,7 +180,7 @@ class OSErrMethodGenerator(OSErrMixIn, MethodGenerator): pass
class WeakLinkMixIn:
"Mix-in to test the function actually exists (!= NULL) before calling"
-
+
def precheck(self):
Output('#ifndef %s', self.name)
Output('PyMac_PRECHECK(%s);', self.name)
diff --git a/Tools/bgen/bgen/scantools.py b/Tools/bgen/bgen/scantools.py
index 4afd7c8..df7ddfb 100644
--- a/Tools/bgen/bgen/scantools.py
+++ b/Tools/bgen/bgen/scantools.py
@@ -51,15 +51,15 @@ class Scanner:
self.setoutput(output, defsoutput)
if input:
self.setinput(input)
-
+
def initusedtypes(self):
self.usedtypes = {}
-
+
def typeused(self, type, mode):
if not self.usedtypes.has_key(type):
self.usedtypes[type] = {}
self.usedtypes[type][mode] = None
-
+
def reportusedtypes(self):
types = self.usedtypes.keys()
types.sort()
@@ -100,12 +100,12 @@ if missing: raise "Missing Types"
def writeinitialdefs(self):
pass
-
+
def initblacklists(self):
self.blacklistnames = self.makeblacklistnames()
self.blacklisttypes = ["unknown", "-"] + self.makeblacklisttypes()
self.greydictnames = self.greylist2dict(self.makegreylist())
-
+
def greylist2dict(self, list):
rv = {}
for define, namelist in list:
@@ -118,7 +118,7 @@ if missing: raise "Missing Types"
def makeblacklisttypes(self):
return []
-
+
def makegreylist(self):
return []
@@ -128,7 +128,7 @@ if missing: raise "Missing Types"
def makerepairinstructions(self):
"""Parse the repair file into repair instructions.
-
+
The file format is simple:
1) use \ to split a long logical line in multiple physical lines
2) everything after the first # on a line is ignored (as comment)
@@ -216,10 +216,10 @@ if missing: raise "Missing Types"
replacements.append(replacement)
list.append((fpat, patterns, replacements))
return list
-
+
def makeinherentpointertypes(self):
return []
-
+
def openrepairfile(self, filename = "REPAIR"):
try:
return open(filename, "rU")
@@ -337,7 +337,7 @@ if missing: raise "Missing Types"
scan = [scan]
self.allscaninputs = scan
self._nextinput()
-
+
def _nextinput(self):
if not self.allscaninputs:
return 0
@@ -526,7 +526,7 @@ if missing: raise "Missing Types"
type = type.strip()
type = re.sub("[ \t]+", "_", type)
return self.modifyarg(type, name, mode)
-
+
def modifyarg(self, type, name, mode):
if type[:6] == "const_":
type = type[6:]
@@ -567,7 +567,7 @@ if missing: raise "Missing Types"
else: # No patterns match
i = i+1
return arglist
-
+
def matcharg(self, patarg, arg):
return len(filter(None, map(fnmatch.fnmatchcase, arg, patarg))) == 3
@@ -666,4 +666,3 @@ def test():
if __name__ == '__main__':
test()
-
diff --git a/Tools/compiler/astgen.py b/Tools/compiler/astgen.py
index 90201d3..08d501b 100644
--- a/Tools/compiler/astgen.py
+++ b/Tools/compiler/astgen.py
@@ -88,7 +88,7 @@ class NodeInfo:
self.args = self.args.replace('*', '')
self.args = self.args.replace('!', '')
self.args = self.args.replace('&', '')
-
+
return d
def gen_source(self):
@@ -158,7 +158,7 @@ class NodeInfo:
template = " nodes.%s(%sself.%s%s)"
for name in self.argnames:
if self.argprops[name] == P_NONE:
- tmp = (" if self.%s is not None:"
+ tmp = (" if self.%s is not None:"
" nodes.append(self.%s)")
print >> buf, tmp % (name, name)
elif self.argprops[name] == P_NESTED:
diff --git a/Tools/compiler/compile.py b/Tools/compiler/compile.py
index c1483c5..9d50425 100644
--- a/Tools/compiler/compile.py
+++ b/Tools/compiler/compile.py
@@ -39,7 +39,7 @@ def main():
filename + ".prof")
else:
compileFile(filename, DISPLAY)
-
+
except SyntaxError, err:
print err
if err.lineno is not None:
diff --git a/Tools/compiler/demo.py b/Tools/compiler/demo.py
index e9ada5a..61c54ee 100755
--- a/Tools/compiler/demo.py
+++ b/Tools/compiler/demo.py
@@ -14,7 +14,7 @@ class MethodFinder:
Each visit method takes two arguments, the node and its current
scope. The scope is the name of the current class or None.
"""
-
+
def visitClass(self, node, scope=None):
self.visit(node.code, node.name)
@@ -22,7 +22,7 @@ class MethodFinder:
if scope is not None:
print "%s.%s" % (scope, node.name)
self.visit(node.code, None)
-
+
def main(files):
mf = MethodFinder()
for file in files:
@@ -34,5 +34,5 @@ def main(files):
if __name__ == "__main__":
import sys
-
+
main(sys.argv[1:])
diff --git a/Tools/faqwiz/faqconf.py b/Tools/faqwiz/faqconf.py
index ef01aa0..0057a93 100644
--- a/Tools/faqwiz/faqconf.py
+++ b/Tools/faqwiz/faqconf.py
@@ -30,11 +30,11 @@ MAXHITS = 10 # Max #hits to be shown directly
COOKIE_LIFETIME = 28*24*3600 # Cookie expiration in seconds
# (28*24*3600 = 28 days = 4 weeks)
PROCESS_PREFORMAT = 1 # toggle whether preformatted text
- # will replace urls and emails with
+ # will replace urls and emails with
# HTML links
# Markers appended to title to indicate recently change
-# (may contain HTML, e.g. <IMG>); and corresponding
+# (may contain HTML, e.g. <IMG>); and corresponding
MARK_VERY_RECENT = " **" # Changed very recently
MARK_RECENT = " *" # Changed recently
diff --git a/Tools/faqwiz/faqwiz.py b/Tools/faqwiz/faqwiz.py
index a44da12..00cc65c 100644
--- a/Tools/faqwiz/faqwiz.py
+++ b/Tools/faqwiz/faqwiz.py
@@ -583,7 +583,7 @@ class FaqWizard:
def do_roulette(self):
import random
files = self.dir.list()
- if not files:
+ if not files:
self.error("No entries.")
return
file = random.choice(files)
@@ -732,7 +732,7 @@ class FaqWizard:
emit(VERSIONCONFLICT, entry, self.ui)
return
commit_ok = ((not PASSWORD
- or self.ui.password == PASSWORD)
+ or self.ui.password == PASSWORD)
and self.ui.author
and '@' in self.ui.email
and self.ui.log)
@@ -820,7 +820,7 @@ class FaqWizard:
log("output: " + output)
log("done: " + str(sts))
log("TempFile:\n" + tf.read() + "end")
-
+
if not sts:
self.prologue(T_COMMITTED)
emit(COMMITTED)
diff --git a/Tools/framer/example.py b/Tools/framer/example.py
index b77f475..96f6278 100644
--- a/Tools/framer/example.py
+++ b/Tools/framer/example.py
@@ -11,7 +11,7 @@ class cStringIO(Module):
generality of StringIO, but it provides enough for most
applications and is especially useful in conjunction with the
pickle module.
-
+
Usage:
from cStringIO import StringIO
@@ -20,7 +20,7 @@ class cStringIO(Module):
an_output_stream.write(some_stuff)
...
value = an_output_stream.getvalue()
-
+
an_input_stream = StringIO(a_string)
spam = an_input_stream.readline()
spam = an_input_stream.read(5)
@@ -36,7 +36,7 @@ class cStringIO(Module):
class InputType(Type):
"Simple type for treating strings as input file streams"
-
+
abbrev = "input"
struct = """\
@@ -121,7 +121,6 @@ class cStringIO(Module):
def writelines(self, lines):
"""Write each string in lines."""
-
-cStringIO.gen()
+cStringIO.gen()
diff --git a/Tools/framer/framer/__init__.py b/Tools/framer/framer/__init__.py
index ab73a30..d8f9058 100644
--- a/Tools/framer/framer/__init__.py
+++ b/Tools/framer/framer/__init__.py
@@ -4,5 +4,3 @@ The basic ideas is the same as modulator, but the code generates code
using many of the new features introduced in Python 2.2. It also
takes a more declarative approach to generating code.
"""
-
-
diff --git a/Tools/framer/framer/bases.py b/Tools/framer/framer/bases.py
index 61052ab..fb3cb03 100644
--- a/Tools/framer/framer/bases.py
+++ b/Tools/framer/framer/bases.py
@@ -64,7 +64,7 @@ class ModuleMetaclass(BaseMetaclass):
self.__types[name] = obj
if obj.has_members():
self.__members = True
-
+
def initvars(self):
v = self.__vars = {}
filename = getattr(self, "__file__", None)
@@ -83,7 +83,7 @@ class ModuleMetaclass(BaseMetaclass):
if self.__members:
p(template.member_include)
print >> f
-
+
if self.__doc__:
p(template.module_doc)
@@ -98,7 +98,7 @@ class ModuleMetaclass(BaseMetaclass):
p(template.module_init_start)
for name, type in sortitems(self.__types):
type.dump_init(f)
-
+
p("}")
class Module:
@@ -121,7 +121,7 @@ class TypeMetaclass(BaseMetaclass):
for name, func in sortitems(self.__methods):
func.dump(f)
-
+
self.dump_methoddef(f, self.__methods, self.__vars)
self.dump_memberdef(f)
self.dump_slots(f)
@@ -199,7 +199,7 @@ class TypeMetaclass(BaseMetaclass):
print >> f, templ % vars
if self.struct:
- p(template.dealloc_func, {"name" : self.__slots[TP_DEALLOC]})
+ p(template.dealloc_func, {"name" : self.__slots[TP_DEALLOC]})
p(template.type_struct_start)
for s in Slots[:-5]: # XXX
@@ -218,4 +218,3 @@ class TypeMetaclass(BaseMetaclass):
class Type:
__metaclass__ = TypeMetaclass
-
diff --git a/Tools/framer/framer/function.py b/Tools/framer/framer/function.py
index 595cc8d..306f7e9 100644
--- a/Tools/framer/framer/function.py
+++ b/Tools/framer/framer/function.py
@@ -55,7 +55,7 @@ class _ArgumentList(object):
def dump_decls(self, f):
pass
-
+
class NoArgs(_ArgumentList):
def __init__(self, args):
@@ -67,7 +67,7 @@ class NoArgs(_ArgumentList):
return "PyObject *self"
class OneArg(_ArgumentList):
-
+
def __init__(self, args):
assert len(args) == 1
super(OneArg, self).__init__(args)
@@ -139,7 +139,7 @@ class Function:
if self.__doc__:
p(template.docstring)
-
+
d = {"name" : self.vars["CName"],
"args" : self.args.c_args(),
}
@@ -149,13 +149,13 @@ class Function:
if self.args.ml_meth == METH_VARARGS:
p(template.varargs)
-
+
p(template.funcdef_end)
def analyze(self):
self.__doc__ = self._func.__doc__
self.args = ArgumentList(self._func, self.method)
-
+
def initvars(self):
v = self.vars = {}
v["PythonName"] = self._func.__name__
diff --git a/Tools/framer/framer/struct.py b/Tools/framer/framer/struct.py
index 3948740..12ea8d7 100644
--- a/Tools/framer/framer/struct.py
+++ b/Tools/framer/framer/struct.py
@@ -35,7 +35,7 @@ def parse(s):
line = line.strip()
if line.startswith("}"):
break
-
+
assert line.endswith(";")
line = line[:-1]
words = line.split()
diff --git a/Tools/framer/framer/structparse.py b/Tools/framer/framer/structparse.py
index 419228a..f24c0da 100644
--- a/Tools/framer/framer/structparse.py
+++ b/Tools/framer/framer/structparse.py
@@ -29,7 +29,7 @@ def parse(s):
line = line.strip()
if line.startswith("}"):
break
-
+
assert line.endswith(";")
line = line[:-1]
words = line.split()
diff --git a/Tools/framer/framer/template.py b/Tools/framer/framer/template.py
index 8d16204..41f9537 100644
--- a/Tools/framer/framer/template.py
+++ b/Tools/framer/framer/template.py
@@ -20,11 +20,11 @@ static struct PyMethodDef %(MethodDefName)s[] = {"""
methoddef_def = """\
{"%(PythonName)s", (PyCFunction)%(CName)s, %(MethType)s},"""
-
+
methoddef_def_doc = """\
{"%(PythonName)s", (PyCFunction)%(CName)s, %(MethType)s,
%(DocstringVar)s},"""
-
+
methoddef_end = """\
{NULL, NULL}
};
@@ -96,7 +96,7 @@ module_add_type = """\
type_struct_start = """\
static PyTypeObject %(CTypeName)s = {
PyObject_HEAD_INIT(0)"""
-
+
type_struct_end = """\
};
"""
diff --git a/Tools/freeze/bkfile.py b/Tools/freeze/bkfile.py
index d29716a..54af2fa 100644
--- a/Tools/freeze/bkfile.py
+++ b/Tools/freeze/bkfile.py
@@ -1,47 +1,47 @@
_orig_open = open
class _BkFile:
- def __init__(self, file, mode, bufsize):
- import os
- self.__filename = file
- self.__backup = file + '~'
- try:
- os.unlink(self.__backup)
- except os.error:
- pass
- try:
- os.rename(file, self.__backup)
- except os.error:
- self.__backup = None
- self.__file = _orig_open(file, mode, bufsize)
- self.closed = self.__file.closed
- self.fileno = self.__file.fileno
- self.flush = self.__file.flush
- self.isatty = self.__file.isatty
- self.mode = self.__file.mode
- self.name = self.__file.name
- self.read = self.__file.read
- self.readinto = self.__file.readinto
- self.readline = self.__file.readline
- self.readlines = self.__file.readlines
- self.seek = self.__file.seek
- self.softspace = self.__file.softspace
- self.tell = self.__file.tell
- self.truncate = self.__file.truncate
- self.write = self.__file.write
- self.writelines = self.__file.writelines
+ def __init__(self, file, mode, bufsize):
+ import os
+ self.__filename = file
+ self.__backup = file + '~'
+ try:
+ os.unlink(self.__backup)
+ except os.error:
+ pass
+ try:
+ os.rename(file, self.__backup)
+ except os.error:
+ self.__backup = None
+ self.__file = _orig_open(file, mode, bufsize)
+ self.closed = self.__file.closed
+ self.fileno = self.__file.fileno
+ self.flush = self.__file.flush
+ self.isatty = self.__file.isatty
+ self.mode = self.__file.mode
+ self.name = self.__file.name
+ self.read = self.__file.read
+ self.readinto = self.__file.readinto
+ self.readline = self.__file.readline
+ self.readlines = self.__file.readlines
+ self.seek = self.__file.seek
+ self.softspace = self.__file.softspace
+ self.tell = self.__file.tell
+ self.truncate = self.__file.truncate
+ self.write = self.__file.write
+ self.writelines = self.__file.writelines
- def close(self):
- self.__file.close()
- if self.__backup is None:
- return
- import filecmp
- if filecmp.cmp(self.__backup, self.__filename, shallow = 0):
- import os
- os.unlink(self.__filename)
- os.rename(self.__backup, self.__filename)
+ def close(self):
+ self.__file.close()
+ if self.__backup is None:
+ return
+ import filecmp
+ if filecmp.cmp(self.__backup, self.__filename, shallow = 0):
+ import os
+ os.unlink(self.__filename)
+ os.rename(self.__backup, self.__filename)
def open(file, mode = 'r', bufsize = -1):
- if 'w' not in mode:
- return _orig_open(file, mode, bufsize)
- return _BkFile(file, mode, bufsize)
+ if 'w' not in mode:
+ return _orig_open(file, mode, bufsize)
+ return _BkFile(file, mode, bufsize)
diff --git a/Tools/freeze/checkextensions.py b/Tools/freeze/checkextensions.py
index 584f8a6..334521f 100644
--- a/Tools/freeze/checkextensions.py
+++ b/Tools/freeze/checkextensions.py
@@ -6,85 +6,85 @@ import os
import parsesetup
def checkextensions(unknown, extensions):
- files = []
- modules = []
- edict = {}
- for e in extensions:
- setup = os.path.join(e, 'Setup')
- liba = os.path.join(e, 'lib.a')
- if not os.path.isfile(liba):
- liba = None
- edict[e] = parsesetup.getsetupinfo(setup), liba
- for mod in unknown:
- for e in extensions:
- (mods, vars), liba = edict[e]
- if not mods.has_key(mod):
- continue
- modules.append(mod)
- if liba:
- # If we find a lib.a, use it, ignore the
- # .o files, and use *all* libraries for
- # *all* modules in the Setup file
- if liba in files:
- break
- files.append(liba)
- for m in mods.keys():
- files = files + select(e, mods, vars,
- m, 1)
- break
- files = files + select(e, mods, vars, mod, 0)
- break
- return files, modules
+ files = []
+ modules = []
+ edict = {}
+ for e in extensions:
+ setup = os.path.join(e, 'Setup')
+ liba = os.path.join(e, 'lib.a')
+ if not os.path.isfile(liba):
+ liba = None
+ edict[e] = parsesetup.getsetupinfo(setup), liba
+ for mod in unknown:
+ for e in extensions:
+ (mods, vars), liba = edict[e]
+ if not mods.has_key(mod):
+ continue
+ modules.append(mod)
+ if liba:
+ # If we find a lib.a, use it, ignore the
+ # .o files, and use *all* libraries for
+ # *all* modules in the Setup file
+ if liba in files:
+ break
+ files.append(liba)
+ for m in mods.keys():
+ files = files + select(e, mods, vars,
+ m, 1)
+ break
+ files = files + select(e, mods, vars, mod, 0)
+ break
+ return files, modules
def select(e, mods, vars, mod, skipofiles):
- files = []
- for w in mods[mod]:
- w = treatword(w)
- if not w:
- continue
- w = expandvars(w, vars)
- for w in w.split():
- if skipofiles and w[-2:] == '.o':
- continue
- # Assume $var expands to absolute pathname
- if w[0] not in ('-', '$') and w[-2:] in ('.o', '.a'):
- w = os.path.join(e, w)
- if w[:2] in ('-L', '-R') and w[2:3] != '$':
- w = w[:2] + os.path.join(e, w[2:])
- files.append(w)
- return files
+ files = []
+ for w in mods[mod]:
+ w = treatword(w)
+ if not w:
+ continue
+ w = expandvars(w, vars)
+ for w in w.split():
+ if skipofiles and w[-2:] == '.o':
+ continue
+ # Assume $var expands to absolute pathname
+ if w[0] not in ('-', '$') and w[-2:] in ('.o', '.a'):
+ w = os.path.join(e, w)
+ if w[:2] in ('-L', '-R') and w[2:3] != '$':
+ w = w[:2] + os.path.join(e, w[2:])
+ files.append(w)
+ return files
cc_flags = ['-I', '-D', '-U']
cc_exts = ['.c', '.C', '.cc', '.c++']
def treatword(w):
- if w[:2] in cc_flags:
- return None
- if w[:1] == '-':
- return w # Assume loader flag
- head, tail = os.path.split(w)
- base, ext = os.path.splitext(tail)
- if ext in cc_exts:
- tail = base + '.o'
- w = os.path.join(head, tail)
- return w
+ if w[:2] in cc_flags:
+ return None
+ if w[:1] == '-':
+ return w # Assume loader flag
+ head, tail = os.path.split(w)
+ base, ext = os.path.splitext(tail)
+ if ext in cc_exts:
+ tail = base + '.o'
+ w = os.path.join(head, tail)
+ return w
def expandvars(str, vars):
- i = 0
- while i < len(str):
- i = k = str.find('$', i)
- if i < 0:
- break
- i = i+1
- var = str[i:i+1]
- i = i+1
- if var == '(':
- j = str.find(')', i)
- if j < 0:
- break
- var = str[i:j]
- i = j+1
- if vars.has_key(var):
- str = str[:k] + vars[var] + str[i:]
- i = k
- return str
+ i = 0
+ while i < len(str):
+ i = k = str.find('$', i)
+ if i < 0:
+ break
+ i = i+1
+ var = str[i:i+1]
+ i = i+1
+ if var == '(':
+ j = str.find(')', i)
+ if j < 0:
+ break
+ var = str[i:j]
+ i = j+1
+ if vars.has_key(var):
+ str = str[:k] + vars[var] + str[i:]
+ i = k
+ return str
diff --git a/Tools/freeze/checkextensions_win32.py b/Tools/freeze/checkextensions_win32.py
index 9a7a6dc..a198ecf 100644
--- a/Tools/freeze/checkextensions_win32.py
+++ b/Tools/freeze/checkextensions_win32.py
@@ -24,142 +24,142 @@ but an obvious enhancement would be to provide command line options.
import os, sys
try:
- import win32api
+ import win32api
except ImportError:
- win32api = None # User has already been warned
+ win32api = None # User has already been warned
class CExtension:
- """An abstraction of an extension implemented in C/C++
- """
- def __init__(self, name, sourceFiles):
- self.name = name
- # A list of strings defining additional compiler options.
- self.sourceFiles = sourceFiles
- # A list of special compiler options to be applied to
- # all source modules in this extension.
- self.compilerOptions = []
- # A list of .lib files the final .EXE will need.
- self.linkerLibs = []
-
- def GetSourceFiles(self):
- return self.sourceFiles
-
- def AddCompilerOption(self, option):
- self.compilerOptions.append(option)
- def GetCompilerOptions(self):
- return self.compilerOptions
-
- def AddLinkerLib(self, lib):
- self.linkerLibs.append(lib)
- def GetLinkerLibs(self):
- return self.linkerLibs
+ """An abstraction of an extension implemented in C/C++
+ """
+ def __init__(self, name, sourceFiles):
+ self.name = name
+ # A list of strings defining additional compiler options.
+ self.sourceFiles = sourceFiles
+ # A list of special compiler options to be applied to
+ # all source modules in this extension.
+ self.compilerOptions = []
+ # A list of .lib files the final .EXE will need.
+ self.linkerLibs = []
+
+ def GetSourceFiles(self):
+ return self.sourceFiles
+
+ def AddCompilerOption(self, option):
+ self.compilerOptions.append(option)
+ def GetCompilerOptions(self):
+ return self.compilerOptions
+
+ def AddLinkerLib(self, lib):
+ self.linkerLibs.append(lib)
+ def GetLinkerLibs(self):
+ return self.linkerLibs
def checkextensions(unknown, extra_inis, prefix):
- # Create a table of frozen extensions
-
- defaultMapName = os.path.join( os.path.split(sys.argv[0])[0], "extensions_win32.ini")
- if not os.path.isfile(defaultMapName):
- sys.stderr.write("WARNING: %s can not be found - standard extensions may not be found\n" % defaultMapName)
- else:
- # must go on end, so other inis can override.
- extra_inis.append(defaultMapName)
-
- ret = []
- for mod in unknown:
- for ini in extra_inis:
-# print "Looking for", mod, "in", win32api.GetFullPathName(ini),"...",
- defn = get_extension_defn( mod, ini, prefix )
- if defn is not None:
-# print "Yay - found it!"
- ret.append( defn )
- break
-# print "Nope!"
- else: # For not broken!
- sys.stderr.write("No definition of module %s in any specified map file.\n" % (mod))
-
- return ret
+ # Create a table of frozen extensions
+
+ defaultMapName = os.path.join( os.path.split(sys.argv[0])[0], "extensions_win32.ini")
+ if not os.path.isfile(defaultMapName):
+ sys.stderr.write("WARNING: %s can not be found - standard extensions may not be found\n" % defaultMapName)
+ else:
+ # must go on end, so other inis can override.
+ extra_inis.append(defaultMapName)
+
+ ret = []
+ for mod in unknown:
+ for ini in extra_inis:
+# print "Looking for", mod, "in", win32api.GetFullPathName(ini),"...",
+ defn = get_extension_defn( mod, ini, prefix )
+ if defn is not None:
+# print "Yay - found it!"
+ ret.append( defn )
+ break
+# print "Nope!"
+ else: # For not broken!
+ sys.stderr.write("No definition of module %s in any specified map file.\n" % (mod))
+
+ return ret
def get_extension_defn(moduleName, mapFileName, prefix):
- if win32api is None: return None
- os.environ['PYTHONPREFIX'] = prefix
- dsp = win32api.GetProfileVal(moduleName, "dsp", "", mapFileName)
- if dsp=="":
- return None
-
- # We allow environment variables in the file name
- dsp = win32api.ExpandEnvironmentStrings(dsp)
- # If the path to the .DSP file is not absolute, assume it is relative
- # to the description file.
- if not os.path.isabs(dsp):
- dsp = os.path.join( os.path.split(mapFileName)[0], dsp)
- # Parse it to extract the source files.
- sourceFiles = parse_dsp(dsp)
- if sourceFiles is None:
- return None
-
- module = CExtension(moduleName, sourceFiles)
- # Put the path to the DSP into the environment so entries can reference it.
- os.environ['dsp_path'] = os.path.split(dsp)[0]
- os.environ['ini_path'] = os.path.split(mapFileName)[0]
-
- cl_options = win32api.GetProfileVal(moduleName, "cl", "", mapFileName)
- if cl_options:
- module.AddCompilerOption(win32api.ExpandEnvironmentStrings(cl_options))
-
- exclude = win32api.GetProfileVal(moduleName, "exclude", "", mapFileName)
- exclude = exclude.split()
-
- if win32api.GetProfileVal(moduleName, "Unicode", 0, mapFileName):
- module.AddCompilerOption('/D UNICODE /D _UNICODE')
-
- libs = win32api.GetProfileVal(moduleName, "libs", "", mapFileName).split()
- for lib in libs:
- module.AddLinkerLib(win32api.ExpandEnvironmentStrings(lib))
-
- for exc in exclude:
- if exc in module.sourceFiles:
- modules.sourceFiles.remove(exc)
-
- return module
+ if win32api is None: return None
+ os.environ['PYTHONPREFIX'] = prefix
+ dsp = win32api.GetProfileVal(moduleName, "dsp", "", mapFileName)
+ if dsp=="":
+ return None
+
+ # We allow environment variables in the file name
+ dsp = win32api.ExpandEnvironmentStrings(dsp)
+ # If the path to the .DSP file is not absolute, assume it is relative
+ # to the description file.
+ if not os.path.isabs(dsp):
+ dsp = os.path.join( os.path.split(mapFileName)[0], dsp)
+ # Parse it to extract the source files.
+ sourceFiles = parse_dsp(dsp)
+ if sourceFiles is None:
+ return None
+
+ module = CExtension(moduleName, sourceFiles)
+ # Put the path to the DSP into the environment so entries can reference it.
+ os.environ['dsp_path'] = os.path.split(dsp)[0]
+ os.environ['ini_path'] = os.path.split(mapFileName)[0]
+
+ cl_options = win32api.GetProfileVal(moduleName, "cl", "", mapFileName)
+ if cl_options:
+ module.AddCompilerOption(win32api.ExpandEnvironmentStrings(cl_options))
+
+ exclude = win32api.GetProfileVal(moduleName, "exclude", "", mapFileName)
+ exclude = exclude.split()
+
+ if win32api.GetProfileVal(moduleName, "Unicode", 0, mapFileName):
+ module.AddCompilerOption('/D UNICODE /D _UNICODE')
+
+ libs = win32api.GetProfileVal(moduleName, "libs", "", mapFileName).split()
+ for lib in libs:
+ module.AddLinkerLib(win32api.ExpandEnvironmentStrings(lib))
+
+ for exc in exclude:
+ if exc in module.sourceFiles:
+ modules.sourceFiles.remove(exc)
+
+ return module
# Given an MSVC DSP file, locate C source files it uses
# returns a list of source files.
def parse_dsp(dsp):
-# print "Processing", dsp
- # For now, only support
- ret = []
- dsp_path, dsp_name = os.path.split(dsp)
- try:
- lines = open(dsp, "r").readlines()
- except IOError, msg:
- sys.stderr.write("%s: %s\n" % (dsp, msg))
- return None
- for line in lines:
- fields = line.strip().split("=", 2)
- if fields[0]=="SOURCE":
- if os.path.splitext(fields[1])[1].lower() in ['.cpp', '.c']:
- ret.append( win32api.GetFullPathName(os.path.join(dsp_path, fields[1] ) ) )
- return ret
+# print "Processing", dsp
+ # For now, only support
+ ret = []
+ dsp_path, dsp_name = os.path.split(dsp)
+ try:
+ lines = open(dsp, "r").readlines()
+ except IOError, msg:
+ sys.stderr.write("%s: %s\n" % (dsp, msg))
+ return None
+ for line in lines:
+ fields = line.strip().split("=", 2)
+ if fields[0]=="SOURCE":
+ if os.path.splitext(fields[1])[1].lower() in ['.cpp', '.c']:
+ ret.append( win32api.GetFullPathName(os.path.join(dsp_path, fields[1] ) ) )
+ return ret
def write_extension_table(fname, modules):
- fp = open(fname, "w")
- try:
- fp.write (ext_src_header)
- # Write fn protos
- for module in modules:
- # bit of a hack for .pyd's as part of packages.
- name = module.name.split('.')[-1]
- fp.write('extern void init%s(void);\n' % (name) )
- # Write the table
- fp.write (ext_tab_header)
- for module in modules:
- name = module.name.split('.')[-1]
- fp.write('\t{"%s", init%s},\n' % (name, name) )
-
- fp.write (ext_tab_footer)
- fp.write(ext_src_footer)
- finally:
- fp.close()
+ fp = open(fname, "w")
+ try:
+ fp.write (ext_src_header)
+ # Write fn protos
+ for module in modules:
+ # bit of a hack for .pyd's as part of packages.
+ name = module.name.split('.')[-1]
+ fp.write('extern void init%s(void);\n' % (name) )
+ # Write the table
+ fp.write (ext_tab_header)
+ for module in modules:
+ name = module.name.split('.')[-1]
+ fp.write('\t{"%s", init%s},\n' % (name, name) )
+
+ fp.write (ext_tab_footer)
+ fp.write(ext_src_footer)
+ finally:
+ fp.close()
ext_src_header = """\
@@ -182,9 +182,7 @@ extern DL_IMPORT(int) PyImport_ExtendInittab(struct _inittab *newtab);
int PyInitFrozenExtensions()
{
- return PyImport_ExtendInittab(extensions);
+ return PyImport_ExtendInittab(extensions);
}
"""
-
-
diff --git a/Tools/freeze/freeze.py b/Tools/freeze/freeze.py
index c2c3c2e..836f532 100755
--- a/Tools/freeze/freeze.py
+++ b/Tools/freeze/freeze.py
@@ -57,15 +57,15 @@ Options:
are read and the -i option replaced with the parsed
params (note - quoting args in this file is NOT supported)
--s subsystem: Specify the subsystem (For Windows only.);
+-s subsystem: Specify the subsystem (For Windows only.);
'console' (default), 'windows', 'service' or 'com_dll'
-
+
-w: Toggle Windows (NT or 95) behavior.
(For debugging only -- on a win32 platform, win32 behavior
is automatic.)
-r prefix=f: Replace path prefix.
- Replace prefix with f in the source path references
+ Replace prefix with f in the source path references
contained in the resulting binary.
Arguments:
@@ -335,7 +335,7 @@ def main():
winmakemakefile.get_custom_entry_point(subsystem)
except ValueError, why:
usage(why)
-
+
# Actual work starts here...
@@ -343,7 +343,7 @@ def main():
dir = os.path.dirname(scriptfile)
path[0] = dir
mf = modulefinder.ModuleFinder(path, debug, exclude, replace_paths)
-
+
if win and subsystem=='service':
# If a Windows service, then add the "built-in" module.
mod = mf.add_module("servicemanager")
@@ -411,7 +411,7 @@ def main():
else:
# Do the windows thang...
import checkextensions_win32
- # Get a list of CExtension instances, each describing a module
+ # Get a list of CExtension instances, each describing a module
# (including its source files)
frozen_extensions = checkextensions_win32.checkextensions(
unknown, extensions, prefix)
diff --git a/Tools/freeze/makeconfig.py b/Tools/freeze/makeconfig.py
index 2f04ac7..7cd9b78 100644
--- a/Tools/freeze/makeconfig.py
+++ b/Tools/freeze/makeconfig.py
@@ -6,56 +6,56 @@ import re
never = ['marshal', '__main__', '__builtin__', 'sys', 'exceptions']
def makeconfig(infp, outfp, modules, with_ifdef=0):
- m1 = re.compile('-- ADDMODULE MARKER 1 --')
- m2 = re.compile('-- ADDMODULE MARKER 2 --')
- while 1:
- line = infp.readline()
- if not line: break
- outfp.write(line)
- if m1 and m1.search(line):
- m1 = None
- for mod in modules:
- if mod in never:
- continue
- if with_ifdef:
- outfp.write("#ifndef init%s\n"%mod)
- outfp.write('extern void init%s(void);\n' % mod)
- if with_ifdef:
- outfp.write("#endif\n")
- elif m2 and m2.search(line):
- m2 = None
- for mod in modules:
- if mod in never:
- continue
- outfp.write('\t{"%s", init%s},\n' %
- (mod, mod))
- if m1:
- sys.stderr.write('MARKER 1 never found\n')
- elif m2:
- sys.stderr.write('MARKER 2 never found\n')
+ m1 = re.compile('-- ADDMODULE MARKER 1 --')
+ m2 = re.compile('-- ADDMODULE MARKER 2 --')
+ while 1:
+ line = infp.readline()
+ if not line: break
+ outfp.write(line)
+ if m1 and m1.search(line):
+ m1 = None
+ for mod in modules:
+ if mod in never:
+ continue
+ if with_ifdef:
+ outfp.write("#ifndef init%s\n"%mod)
+ outfp.write('extern void init%s(void);\n' % mod)
+ if with_ifdef:
+ outfp.write("#endif\n")
+ elif m2 and m2.search(line):
+ m2 = None
+ for mod in modules:
+ if mod in never:
+ continue
+ outfp.write('\t{"%s", init%s},\n' %
+ (mod, mod))
+ if m1:
+ sys.stderr.write('MARKER 1 never found\n')
+ elif m2:
+ sys.stderr.write('MARKER 2 never found\n')
# Test program.
def test():
- import sys
- if not sys.argv[3:]:
- print 'usage: python makeconfig.py config.c.in outputfile',
- print 'modulename ...'
- sys.exit(2)
- if sys.argv[1] == '-':
- infp = sys.stdin
- else:
- infp = open(sys.argv[1])
- if sys.argv[2] == '-':
- outfp = sys.stdout
- else:
- outfp = open(sys.argv[2], 'w')
- makeconfig(infp, outfp, sys.argv[3:])
- if outfp != sys.stdout:
- outfp.close()
- if infp != sys.stdin:
- infp.close()
+ import sys
+ if not sys.argv[3:]:
+ print 'usage: python makeconfig.py config.c.in outputfile',
+ print 'modulename ...'
+ sys.exit(2)
+ if sys.argv[1] == '-':
+ infp = sys.stdin
+ else:
+ infp = open(sys.argv[1])
+ if sys.argv[2] == '-':
+ outfp = sys.stdout
+ else:
+ outfp = open(sys.argv[2], 'w')
+ makeconfig(infp, outfp, sys.argv[3:])
+ if outfp != sys.stdout:
+ outfp.close()
+ if infp != sys.stdin:
+ infp.close()
if __name__ == '__main__':
- test()
+ test()
diff --git a/Tools/freeze/makefreeze.py b/Tools/freeze/makefreeze.py
index 9ff348c..1208b67 100644
--- a/Tools/freeze/makefreeze.py
+++ b/Tools/freeze/makefreeze.py
@@ -19,7 +19,7 @@ default_entry_point = """
int
main(int argc, char **argv)
{
- extern int Py_FrozenMain(int, char **);
+ extern int Py_FrozenMain(int, char **);
""" + ((not __debug__ and """
Py_OptimizeFlag++;
""") or "") + """
diff --git a/Tools/freeze/makemakefile.py b/Tools/freeze/makemakefile.py
index b8b99b8..ff8b15a 100644
--- a/Tools/freeze/makemakefile.py
+++ b/Tools/freeze/makemakefile.py
@@ -23,7 +23,7 @@ def makemakefile(outfp, makevars, files, target):
deps.append(dest)
outfp.write("\n%s: %s\n" % (target, ' '.join(deps)))
- outfp.write("\t$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) %s -o %s $(LDLAST)\n" %
+ outfp.write("\t$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) %s -o %s $(LDLAST)\n" %
(' '.join(files), target))
outfp.write("\nclean:\n\t-rm -f *.o %s\n" % target)
diff --git a/Tools/freeze/parsesetup.py b/Tools/freeze/parsesetup.py
index 2b9123e..856234d 100644
--- a/Tools/freeze/parsesetup.py
+++ b/Tools/freeze/parsesetup.py
@@ -10,32 +10,32 @@ import re
makevardef = re.compile('^([a-zA-Z0-9_]+)[ \t]*=(.*)')
def getmakevars(filename):
- variables = {}
- fp = open(filename)
- pendingline = ""
- try:
- while 1:
- line = fp.readline()
- if pendingline:
- line = pendingline + line
- pendingline = ""
- if not line:
- break
- if line.endswith('\\\n'):
- pendingline = line[:-2]
- matchobj = makevardef.match(line)
- if not matchobj:
- continue
- (name, value) = matchobj.group(1, 2)
- # Strip trailing comment
- i = value.find('#')
- if i >= 0:
- value = value[:i]
- value = value.strip()
- variables[name] = value
- finally:
- fp.close()
- return variables
+ variables = {}
+ fp = open(filename)
+ pendingline = ""
+ try:
+ while 1:
+ line = fp.readline()
+ if pendingline:
+ line = pendingline + line
+ pendingline = ""
+ if not line:
+ break
+ if line.endswith('\\\n'):
+ pendingline = line[:-2]
+ matchobj = makevardef.match(line)
+ if not matchobj:
+ continue
+ (name, value) = matchobj.group(1, 2)
+ # Strip trailing comment
+ i = value.find('#')
+ if i >= 0:
+ value = value[:i]
+ value = value.strip()
+ variables[name] = value
+ finally:
+ fp.close()
+ return variables
# Parse a Python Setup(.in) file.
@@ -46,67 +46,67 @@ def getmakevars(filename):
setupvardef = re.compile('^([a-zA-Z0-9_]+)=(.*)')
def getsetupinfo(filename):
- modules = {}
- variables = {}
- fp = open(filename)
- pendingline = ""
- try:
- while 1:
- line = fp.readline()
- if pendingline:
- line = pendingline + line
- pendingline = ""
- if not line:
- break
- # Strip comments
- i = line.find('#')
- if i >= 0:
- line = line[:i]
- if line.endswith('\\\n'):
- pendingline = line[:-2]
- continue
- matchobj = setupvardef.match(line)
- if matchobj:
- (name, value) = matchobj.group(1, 2)
- variables[name] = value.strip()
- else:
- words = line.split()
- if words:
- modules[words[0]] = words[1:]
- finally:
- fp.close()
- return modules, variables
+ modules = {}
+ variables = {}
+ fp = open(filename)
+ pendingline = ""
+ try:
+ while 1:
+ line = fp.readline()
+ if pendingline:
+ line = pendingline + line
+ pendingline = ""
+ if not line:
+ break
+ # Strip comments
+ i = line.find('#')
+ if i >= 0:
+ line = line[:i]
+ if line.endswith('\\\n'):
+ pendingline = line[:-2]
+ continue
+ matchobj = setupvardef.match(line)
+ if matchobj:
+ (name, value) = matchobj.group(1, 2)
+ variables[name] = value.strip()
+ else:
+ words = line.split()
+ if words:
+ modules[words[0]] = words[1:]
+ finally:
+ fp.close()
+ return modules, variables
# Test the above functions.
def test():
- import sys
- import os
- if not sys.argv[1:]:
- print 'usage: python parsesetup.py Makefile*|Setup* ...'
- sys.exit(2)
- for arg in sys.argv[1:]:
- base = os.path.basename(arg)
- if base[:8] == 'Makefile':
- print 'Make style parsing:', arg
- v = getmakevars(arg)
- prdict(v)
- elif base[:5] == 'Setup':
- print 'Setup style parsing:', arg
- m, v = getsetupinfo(arg)
- prdict(m)
- prdict(v)
- else:
- print arg, 'is neither a Makefile nor a Setup file'
- print '(name must begin with "Makefile" or "Setup")'
+ import sys
+ import os
+ if not sys.argv[1:]:
+ print 'usage: python parsesetup.py Makefile*|Setup* ...'
+ sys.exit(2)
+ for arg in sys.argv[1:]:
+ base = os.path.basename(arg)
+ if base[:8] == 'Makefile':
+ print 'Make style parsing:', arg
+ v = getmakevars(arg)
+ prdict(v)
+ elif base[:5] == 'Setup':
+ print 'Setup style parsing:', arg
+ m, v = getsetupinfo(arg)
+ prdict(m)
+ prdict(v)
+ else:
+ print arg, 'is neither a Makefile nor a Setup file'
+ print '(name must begin with "Makefile" or "Setup")'
def prdict(d):
- keys = d.keys()
- keys.sort()
- for key in keys:
- value = d[key]
- print "%-15s" % key, str(value)
+ keys = d.keys()
+ keys.sort()
+ for key in keys:
+ value = d[key]
+ print "%-15s" % key, str(value)
if __name__ == '__main__':
- test()
+ test()
diff --git a/Tools/i18n/msgfmt.py b/Tools/i18n/msgfmt.py
index 8a2d4e6..b4ae3e9 100755
--- a/Tools/i18n/msgfmt.py
+++ b/Tools/i18n/msgfmt.py
@@ -113,7 +113,7 @@ def make(filename, outfile):
except IOError, msg:
print >> sys.stderr, msg
sys.exit(1)
-
+
section = None
fuzzy = 0
@@ -169,7 +169,7 @@ def make(filename, outfile):
open(outfile,"wb").write(output)
except IOError,msg:
print >> sys.stderr, msg
-
+
def main():
diff --git a/Tools/modulator/Tkextra.py b/Tools/modulator/Tkextra.py
index 00ed5eb..8f55728 100755
--- a/Tools/modulator/Tkextra.py
+++ b/Tools/modulator/Tkextra.py
@@ -105,7 +105,7 @@ def strdialog(master, title, text, bitmap, default, *args):
{'width': '3i',
'text': text,
'font': '-Adobe-Times-Medium-R-Normal-*-180-*',
- Pack: {'side': 'left',
+ Pack: {'side': 'left',
'fill': 'both',
'padx': '3m', 'pady': '3m'}})
@@ -187,7 +187,7 @@ def askstr(str):
def askfile(str): # XXXX For now...
i = strdialog(mainWidget, 'Question', str, '', 0)
return i
-
+
# The rest is the test program.
def _go():
diff --git a/Tools/modulator/genmodule.py b/Tools/modulator/genmodule.py
index 5788b95..da30684 100755
--- a/Tools/modulator/genmodule.py
+++ b/Tools/modulator/genmodule.py
@@ -65,7 +65,7 @@ class writer:
return open(fn, 'r')
raise error, 'Template '+name+' not found for '+self._type+' '+ \
self.name
-
+
class module(writer):
_type = 'module'
@@ -116,7 +116,7 @@ class object(writer):
# Add getattr if we have methods
if self.methodlist and not 'tp_getattr' in self.funclist:
self.funclist.insert(0, 'tp_getattr')
-
+
for fn in FUNCLIST:
setattr(self, fn, '0')
diff --git a/Tools/modulator/modulator.py b/Tools/modulator/modulator.py
index 4828743..3e06bc2 100755
--- a/Tools/modulator/modulator.py
+++ b/Tools/modulator/modulator.py
@@ -49,7 +49,7 @@ def getlistlist(list):
for i in range(n):
rv.append(list.get(i))
return rv
-
+
class UI:
def __init__(self):
self.main = Frame()
@@ -97,7 +97,7 @@ class UI:
o.synchronize()
except oops:
pass
-
+
def cb_save(self, *args):
try:
pycode = self.module.gencode('m', self.objects)
@@ -177,12 +177,12 @@ class UI_module:
'command':self.cb_newobj,
Pack:{'side':'left',
'padx':'0.5m'}})
-
+
def cb_delmethod(self, *args):
list = self.method_list.curselection()
for i in list:
self.method_list.delete(i)
-
+
def cb_newobj(self, *arg):
self.parent.objects.append(UI_object(self.parent))
@@ -208,7 +208,7 @@ class UI_module:
if not checkid(n):
message('Method name not an identifier:\n'+n)
raise oops
-
+
def gencode(self, name, objects):
rv = ''
self.synchronize()
@@ -226,7 +226,7 @@ class UI_module:
rv = rv + '%s.objects = [%s]\n' % (name, ','.join(onames))
rv = rv + '\n'
return rv
-
+
object_number = 0
class UI_object:
@@ -250,7 +250,7 @@ class UI_object:
'fill':'x'}})
self.f4 = Frame(self.frame, {Pack:{'side':'top', 'pady':'0.5m',
'fill':'x'}})
-
+
self.l1 = Label(self.f1, {'text':'Object:', Pack:{'side':'left',
'padx':'0.5m'}})
@@ -305,7 +305,7 @@ class UI_object:
Pack:{'side':'top', 'pady':'0.5m',
'anchor':'w'}})
self.types[i] = b
-
+
def cb_method(self, *arg):
name = self.method_entry.get()
if not name:
@@ -317,7 +317,7 @@ class UI_object:
list = self.method_list.curselection()
for i in list:
self.method_list.delete(i)
-
+
def synchronize(self):
n = self.name_entry.get()
if not n:
@@ -337,7 +337,7 @@ class UI_object:
if m:
self.f5.setvar(self.vpref+'tp_getattr', 1)
pass
-
+
def gencode(self, name):
rv = ''
rv = rv + '%s = genmodule.object()\n' % (name,)
@@ -356,12 +356,12 @@ class UI_object:
vname = self.vpref + fn
if self.f5.getvar(vname) == '1':
fl.append(fn)
-
+
rv = rv + '%s.typelist = %r\n' % (name, fl)
rv = rv + '\n'
return rv
-
+
def main():
if len(sys.argv) < 2:
@@ -379,5 +379,5 @@ def main():
else:
sys.stderr.write('Usage: modulator [file]\n')
sys.exit(1)
-
+
main()
diff --git a/Tools/modulator/varsubst.py b/Tools/modulator/varsubst.py
index 5516be2..3b33950 100644
--- a/Tools/modulator/varsubst.py
+++ b/Tools/modulator/varsubst.py
@@ -13,7 +13,7 @@ class Varsubst:
def useindent(self, onoff):
self.do_useindent = onoff
-
+
def subst(self, s):
rv = ''
while 1:
diff --git a/Tools/pynche/ChipViewer.py b/Tools/pynche/ChipViewer.py
index faa6948..05412ce 100644
--- a/Tools/pynche/ChipViewer.py
+++ b/Tools/pynche/ChipViewer.py
@@ -101,7 +101,7 @@ class ChipViewer:
# shows the name of the nearest color in the database. BAW: should
# an exact match be indicated in some way?
#
- # Always use the #rrggbb style to actually set the color, since we may
+ # Always use the #rrggbb style to actually set the color, since we may
# not be using X color names (e.g. "web-safe" names)
colordb = self.__sb.colordb()
rgbtuple = (red, green, blue)
diff --git a/Tools/pynche/DetailsViewer.py b/Tools/pynche/DetailsViewer.py
index 07f5acd..11a99a6 100644
--- a/Tools/pynche/DetailsViewer.py
+++ b/Tools/pynche/DetailsViewer.py
@@ -2,13 +2,13 @@
This class implements a pure input window which allows you to meticulously
edit the current color. You have both mouse control of the color (via the
-buttons along the bottom row), and there are keyboard bindings for each of the
+buttons along the bottom row), and there are keyboard bindings for each of the
increment/decrement buttons.
The top three check buttons allow you to specify which of the three color
variations are tied together when incrementing and decrementing. Red, green,
and blue are self evident. By tying together red and green, you can modify
-the yellow level of the color. By tying together red and blue, you can modify
+the yellow level of the color. By tying together red and blue, you can modify
the magenta level of the color. By tying together green and blue, you can
modify the cyan level, and by tying all three together, you can modify the
grey level.
diff --git a/Tools/pynche/StripViewer.py b/Tools/pynche/StripViewer.py
index 429cc78..f7da479 100644
--- a/Tools/pynche/StripViewer.py
+++ b/Tools/pynche/StripViewer.py
@@ -1,6 +1,6 @@
"""Strip viewer and related widgets.
-The classes in this file implement the StripViewer shown in the top two thirds
+The classes in this file implement the StripViewer shown in the top two thirds
of the main Pynche window. It consists of three StripWidgets which display
the variations in red, green, and blue respectively of the currently selected
r/g/b color value.
@@ -182,7 +182,7 @@ class StripWidget:
# the last chip selected
self.__lastchip = None
self.__sb = switchboard
-
+
canvaswidth = numchips * (chipwidth + 1)
canvasheight = chipheight + 43 # BAW: Kludge
@@ -372,7 +372,7 @@ class StripViewer:
hexbtn.grid(row=1, column=1, sticky=W)
# XXX: ignore this feature for now; it doesn't work quite right yet
-
+
## gentypevar = self.__gentypevar = IntVar()
## self.__variations = Radiobutton(frame,
## text='Variations',
diff --git a/Tools/unicode/mkstringprep.py b/Tools/unicode/mkstringprep.py
index c621967..2525f9e 100644
--- a/Tools/unicode/mkstringprep.py
+++ b/Tools/unicode/mkstringprep.py
@@ -429,4 +429,3 @@ print """
def in_table_d2(code):
return unicodedata.bidirectional(code) == "L"
"""
-
diff --git a/Tools/versioncheck/checkversions.py b/Tools/versioncheck/checkversions.py
index 956f553..fd128b6 100644
--- a/Tools/versioncheck/checkversions.py
+++ b/Tools/versioncheck/checkversions.py
@@ -1,4 +1,4 @@
-"""Checkversions - recursively search a directory (default: sys.prefix)
+"""Checkversions - recursively search a directory (default: sys.prefix)
for _checkversion.py files, and run each of them. This will tell you of
new versions available for any packages you have installed."""
@@ -29,7 +29,7 @@ def check1dir(dummy, dir, files):
execfile(fullname)
except:
print '** Exception in', fullname
-
+
def walk1tree(tree):
os.path.walk(tree, check1dir, None)
@@ -50,5 +50,3 @@ def main():
if __name__ == '__main__':
main()
-
-
diff --git a/Tools/versioncheck/pyversioncheck.py b/Tools/versioncheck/pyversioncheck.py
index 6ac34c8..1446653 100644
--- a/Tools/versioncheck/pyversioncheck.py
+++ b/Tools/versioncheck/pyversioncheck.py
@@ -96,4 +96,3 @@ def _test():
if __name__ == '__main__':
_test()
-
diff --git a/Tools/webchecker/wcgui.py b/Tools/webchecker/wcgui.py
index e467d92..96aed0a 100755
--- a/Tools/webchecker/wcgui.py
+++ b/Tools/webchecker/wcgui.py
@@ -10,17 +10,17 @@ Checkpoints are not (yet??? ever???) supported.
User interface:
-Enter a root to check in the text entry box. To enter more than one root,
+Enter a root to check in the text entry box. To enter more than one root,
enter them one at a time and press <Return> for each one.
-Command buttons Start, Stop and "Check one" govern the checking process in
-the obvious way. Start and "Check one" also enter the root from the text
+Command buttons Start, Stop and "Check one" govern the checking process in
+the obvious way. Start and "Check one" also enter the root from the text
entry box if one is present. There's also a check box (enabled by default)
to decide whether actually to follow external links (since this can slow
the checking down considerably). Finally there's a Quit button.
-A series of checkbuttons determines whether the corresponding output panel
-is shown. List panels are also automatically shown or hidden when their
+A series of checkbuttons determines whether the corresponding output panel
+is shown. List panels are also automatically shown or hidden when their
status changes between empty to non-empty. There are six panels:
Log -- raw output from the checker (-v, -q affect this)
diff --git a/Tools/webchecker/webchecker.py b/Tools/webchecker/webchecker.py
index 9113c4b..d918a0c 100755
--- a/Tools/webchecker/webchecker.py
+++ b/Tools/webchecker/webchecker.py
@@ -297,7 +297,7 @@ class Checker:
def message(self, format, *args):
if args:
format = format%args
- print format
+ print format
def __getstate__(self):
return (self.roots, self.todo, self.done, self.bad, self.round)
@@ -380,7 +380,7 @@ class Checker:
# triples is now a (URL, fragment) pair. The value
# of the "source" variable comes from the list of
# origins, and is a URL, not a pair.
- for url, rawlink, msg in triples:
+ for url, rawlink, msg in triples:
if rawlink != self.format_url(url): s = " (%s)" % rawlink
else: s = ""
self.message(" HREF %s%s\n msg %s",
@@ -462,7 +462,7 @@ class Checker:
self.todo[url] = [origin]
self.note(3, " New todo link %s", self.format_url(url))
- def format_url(self, url):
+ def format_url(self, url):
link, fragment = url
if fragment: return link + "#" + fragment
else: return link
@@ -716,7 +716,7 @@ class Page:
t = t[:-1] + ('',)
rawlink = urlparse.urlunparse(t)
link = urlparse.urljoin(base, rawlink)
- infos.append((link, rawlink, fragment))
+ infos.append((link, rawlink, fragment))
return infos