From 23b44a39cec5ccebb6c6eb1e94eccbd6e8ce758e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Fri, 24 Oct 2003 20:09:23 +0000 Subject: Patch #812378: Normalize white space. --- Lib/distutils/sysconfig.py | 6 +- Tools/faqwiz/faqconf.py | 64 +++++----- Tools/framer/framer/template.py | 8 +- Tools/modulator/EXAMPLE.py | 2 +- Tools/modulator/ScrolledListbox.py | 40 +++---- Tools/pynche/PyncheWidget.py | 2 +- Tools/pynche/StripViewer.py | 226 +++++++++++++++++------------------ Tools/versioncheck/_checkversion.py | 6 +- Tools/versioncheck/checkversions.py | 52 ++++---- Tools/versioncheck/pyversioncheck.py | 11 +- 10 files changed, 208 insertions(+), 209 deletions(-) diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 67353a8..46d1acb 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -70,9 +70,9 @@ def get_python_inc(plat_specific=0, prefix=None): return os.path.join(prefix, "include") elif os.name == "mac": if plat_specific: - return os.path.join(prefix, "Mac", "Include") + return os.path.join(prefix, "Mac", "Include") else: - return os.path.join(prefix, "Include") + return os.path.join(prefix, "Include") elif os.name == "os2": return os.path.join(prefix, "Include") else: @@ -160,7 +160,7 @@ def customize_compiler(compiler): if os.environ.has_key('LDFLAGS'): ldshared = ldshared + ' ' + os.environ['LDFLAGS'] if basecflags: - opt = basecflags + ' ' + opt + opt = basecflags + ' ' + opt if os.environ.has_key('CFLAGS'): opt = opt + ' ' + os.environ['CFLAGS'] ldshared = ldshared + ' ' + os.environ['CFLAGS'] diff --git a/Tools/faqwiz/faqconf.py b/Tools/faqwiz/faqconf.py index 9b5b8af..ef01aa0 100644 --- a/Tools/faqwiz/faqconf.py +++ b/Tools/faqwiz/faqconf.py @@ -15,20 +15,20 @@ SECTION_TITLES = { # Parameters you definitely want to change -SHORTNAME = "Generic" # FAQ name with "FAQ" omitted -PASSWORD = "" # Password for editing -OWNERNAME = "FAQ owner" # Name for feedback -OWNEREMAIL = "nobody@anywhere.org" # Email for feedback -HOMEURL = "http://www.python.org" # Related home page -HOMENAME = "Python home" # Name of related home page -RCSBINDIR = "/usr/local/bin/" # Directory containing RCS commands - # (must end in a slash) +SHORTNAME = "Generic" # FAQ name with "FAQ" omitted +PASSWORD = "" # Password for editing +OWNERNAME = "FAQ owner" # Name for feedback +OWNEREMAIL = "nobody@anywhere.org" # Email for feedback +HOMEURL = "http://www.python.org" # Related home page +HOMENAME = "Python home" # Name of related home page +RCSBINDIR = "/usr/local/bin/" # Directory containing RCS commands + # (must end in a slash) # Parameters you can normally leave alone -MAXHITS = 10 # Max #hits to be shown directly -COOKIE_LIFETIME = 28*24*3600 # Cookie expiration in seconds - # (28*24*3600 = 28 days = 4 weeks) +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 # HTML links @@ -36,10 +36,10 @@ PROCESS_PREFORMAT = 1 # toggle whether preformatted text # Markers appended to title to indicate recently change # (may contain HTML, e.g. ); and corresponding -MARK_VERY_RECENT = " **" # Changed very recently -MARK_RECENT = " *" # Changed recently -DT_VERY_RECENT = 24*3600 # 24 hours -DT_RECENT = 7*24*3600 # 7 days +MARK_VERY_RECENT = " **" # Changed very recently +MARK_RECENT = " *" # Changed recently +DT_VERY_RECENT = 24*3600 # 24 hours +DT_RECENT = 7*24*3600 # 7 days EXPLAIN_MARKS = """

(Entries marked with ** were changed within the last 24 hours; @@ -49,18 +49,18 @@ entries marked with * were changed within the last 7 days.) # Version -- don't change unless you edit faqwiz.py -WIZVERSION = "1.0.4" # FAQ Wizard version +WIZVERSION = "1.0.4" # FAQ Wizard version import os, sys if os.name in ['nt',]: # On NT we'll probably be running python from a batch file, # so sys.argv[0] is not helpful - FAQCGI = 'faq.bat' # Relative URL of the FAQ cgi script + FAQCGI = 'faq.bat' # Relative URL of the FAQ cgi script # LOGNAME is not typically set on NT os.environ[ 'LOGNAME' ] = "FAQWizard" else: # This parameter is normally overwritten with a dynamic value - FAQCGI = 'faqw.py' # Relative URL of the FAQ cgi script + FAQCGI = 'faqw.py' # Relative URL of the FAQ cgi script FAQCGI = os.path.basename(sys.argv[0]) or FAQCGI del os, sys @@ -84,8 +84,8 @@ except ImportError: # Calculated parameter names -COOKIE_NAME = SHORTNAME + "-FAQ-Wizard" # Name used for Netscape cookie -FAQNAME = SHORTNAME + " FAQ" # Name of the FAQ +COOKIE_NAME = SHORTNAME + "-FAQ-Wizard" # Name used for Netscape cookie +FAQNAME = SHORTNAME + " FAQ" # Name of the FAQ # ---------------------------------------------------------------------- @@ -175,22 +175,22 @@ HOME = """
Simple string - / + / Regular expression - /
+ /
Keywords (any) - / + / Keywords (all) -
+
Fold case - / + / Case sensitive -
+
@@ -362,14 +362,14 @@ Log message (reason for the change):
Please provide the following information for logging purposes: - - -
Name: - + Name: +
Email: - + Email: +
Password: - + Password: +
diff --git a/Tools/framer/framer/template.py b/Tools/framer/framer/template.py index 70e2591..8d16204 100644 --- a/Tools/framer/framer/template.py +++ b/Tools/framer/framer/template.py @@ -19,14 +19,14 @@ methoddef_start = """\ static struct PyMethodDef %(MethodDefName)s[] = {""" methoddef_def = """\ - {"%(PythonName)s", (PyCFunction)%(CName)s, %(MethType)s},""" + {"%(PythonName)s", (PyCFunction)%(CName)s, %(MethType)s},""" methoddef_def_doc = """\ - {"%(PythonName)s", (PyCFunction)%(CName)s, %(MethType)s, + {"%(PythonName)s", (PyCFunction)%(CName)s, %(MethType)s, %(DocstringVar)s},""" methoddef_end = """\ - {NULL, NULL} + {NULL, NULL} }; """ @@ -43,7 +43,7 @@ memberdef_def = """\ {"%(PythonName)s", %(Type)s, OFF(%(CName)s), %(Flags)s},""" memberdef_end = """\ - {NULL} + {NULL} }; #undef OFF diff --git a/Tools/modulator/EXAMPLE.py b/Tools/modulator/EXAMPLE.py index d4b254a..b36a5a7 100644 --- a/Tools/modulator/EXAMPLE.py +++ b/Tools/modulator/EXAMPLE.py @@ -34,7 +34,7 @@ o3.name = 'over-the-top object' o3.abbrev = 'ot' o3.methodlist = ['method1', 'method2'] o3.funclist = ['new', 'tp_dealloc', 'tp_print', 'tp_getattr', 'tp_setattr', - 'tp_compare', 'tp_repr', 'tp_hash'] + 'tp_compare', 'tp_repr', 'tp_hash'] o3.typelist = ['tp_as_sequence', 'structure'] # diff --git a/Tools/modulator/ScrolledListbox.py b/Tools/modulator/ScrolledListbox.py index 89686ef..8bb5738 100644 --- a/Tools/modulator/ScrolledListbox.py +++ b/Tools/modulator/ScrolledListbox.py @@ -14,24 +14,24 @@ from Tkinter import * from Tkinter import _cnfmerge class ScrolledListbox(Listbox): - def __init__(self, master=None, cnf={}): - cnf = _cnfmerge(cnf) - fcnf = {} - vcnf = {'name': 'vbar', - Pack: {'side': 'right', 'fill': 'y'},} - for k in cnf.keys(): - if type(k) == ClassType or k == 'name': - fcnf[k] = cnf[k] - del cnf[k] - self.frame = Frame(master, fcnf) - self.vbar = Scrollbar(self.frame, vcnf) - cnf[Pack] = {'side': 'left', 'fill': 'both', 'expand': 'yes'} - cnf['name'] = 'list' - Listbox.__init__(self, self.frame, cnf) - self['yscrollcommand'] = (self.vbar, 'set') - self.vbar['command'] = (self, 'yview') + def __init__(self, master=None, cnf={}): + cnf = _cnfmerge(cnf) + fcnf = {} + vcnf = {'name': 'vbar', + Pack: {'side': 'right', 'fill': 'y'},} + for k in cnf.keys(): + if type(k) == ClassType or k == 'name': + fcnf[k] = cnf[k] + del cnf[k] + self.frame = Frame(master, fcnf) + self.vbar = Scrollbar(self.frame, vcnf) + cnf[Pack] = {'side': 'left', 'fill': 'both', 'expand': 'yes'} + cnf['name'] = 'list' + Listbox.__init__(self, self.frame, cnf) + self['yscrollcommand'] = (self.vbar, 'set') + self.vbar['command'] = (self, 'yview') - # Copy Pack methods of self.frame -- hack! - for m in Pack.__dict__.keys(): - if m[0] != '_' and m != 'config': - setattr(self, m, getattr(self.frame, m)) + # Copy Pack methods of self.frame -- hack! + for m in Pack.__dict__.keys(): + if m[0] != '_' and m != 'config': + setattr(self, m, getattr(self.frame, m)) diff --git a/Tools/pynche/PyncheWidget.py b/Tools/pynche/PyncheWidget.py index 8550078..fcfe7ce 100644 --- a/Tools/pynche/PyncheWidget.py +++ b/Tools/pynche/PyncheWidget.py @@ -75,7 +75,7 @@ class PyncheWidget: # Help menu # helpmenu = Menu(menubar, name='help', tearoff=0) - helpmenu.add_command(label='About Pynche...', + helpmenu.add_command(label='About Pynche...', command=self.__popup_about, underline=0) helpmenu.add_command(label='Help...', diff --git a/Tools/pynche/StripViewer.py b/Tools/pynche/StripViewer.py index b190482..429cc78 100644 --- a/Tools/pynche/StripViewer.py +++ b/Tools/pynche/StripViewer.py @@ -35,7 +35,7 @@ proc setcolor {canv colors} { set i 1 foreach c $colors { $canv itemconfigure $i -fill $c -outline $c - incr i + incr i } } ''' @@ -54,9 +54,9 @@ def constant(numchips): start = 0.0 seq = [] while numchips > 0: - seq.append(int(start)) - start = start + step - numchips = numchips - 1 + seq.append(int(start)) + start = start + step + numchips = numchips - 1 return seq # red variations, green+blue = cyan constant @@ -99,61 +99,61 @@ class LeftArrow: _TAG = ('leftarrow',) def __init__(self, canvas, x): - self._canvas = canvas - self.__arrow, self.__text = self._create(x) - self.move_to(x) + self._canvas = canvas + self.__arrow, self.__text = self._create(x) + self.move_to(x) def _create(self, x): - arrow = self._canvas.create_line( - x, self._ARROWHEIGHT + self._YOFFSET, - x, self._YOFFSET, - x + self._ARROWWIDTH, self._YOFFSET, - arrow='first', - width=3.0, - tags=self._TAG) - text = self._canvas.create_text( - x + self._ARROWWIDTH + 13, - self._ARROWHEIGHT - self._TEXTYOFFSET, - tags=self._TAG, - text='128') - return arrow, text + arrow = self._canvas.create_line( + x, self._ARROWHEIGHT + self._YOFFSET, + x, self._YOFFSET, + x + self._ARROWWIDTH, self._YOFFSET, + arrow='first', + width=3.0, + tags=self._TAG) + text = self._canvas.create_text( + x + self._ARROWWIDTH + 13, + self._ARROWHEIGHT - self._TEXTYOFFSET, + tags=self._TAG, + text='128') + return arrow, text def _x(self): - coords = self._canvas.coords(self._TAG) - assert coords - return coords[0] + coords = self._canvas.coords(self._TAG) + assert coords + return coords[0] def move_to(self, x): - deltax = x - self._x() - self._canvas.move(self._TAG, deltax, 0) + deltax = x - self._x() + self._canvas.move(self._TAG, deltax, 0) def set_text(self, text): - self._canvas.itemconfigure(self.__text, text=text) + self._canvas.itemconfigure(self.__text, text=text) class RightArrow(LeftArrow): _TAG = ('rightarrow',) def _create(self, x): - arrow = self._canvas.create_line( - x, self._YOFFSET, - x + self._ARROWWIDTH, self._YOFFSET, - x + self._ARROWWIDTH, self._ARROWHEIGHT + self._YOFFSET, - arrow='last', - width=3.0, - tags=self._TAG) - text = self._canvas.create_text( - x - self._ARROWWIDTH + 15, # BAW: kludge - self._ARROWHEIGHT - self._TEXTYOFFSET, + arrow = self._canvas.create_line( + x, self._YOFFSET, + x + self._ARROWWIDTH, self._YOFFSET, + x + self._ARROWWIDTH, self._ARROWHEIGHT + self._YOFFSET, + arrow='last', + width=3.0, + tags=self._TAG) + text = self._canvas.create_text( + x - self._ARROWWIDTH + 15, # BAW: kludge + self._ARROWHEIGHT - self._TEXTYOFFSET, justify=RIGHT, - text='128', - tags=self._TAG) - return arrow, text + text='128', + tags=self._TAG) + return arrow, text def _x(self): - coords = self._canvas.bbox(self._TAG) - assert coords - return coords[2] - 6 # BAW: kludge + coords = self._canvas.bbox(self._TAG) + assert coords + return coords[2] - 6 # BAW: kludge @@ -173,68 +173,68 @@ class StripWidget: uwdvar = None, hexvar = None): # instance variables - self.__generator = generator - self.__axis = axis + self.__generator = generator + self.__axis = axis self.__numchips = numchips - assert self.__axis in (0, 1, 2) - self.__uwd = uwdvar + assert self.__axis in (0, 1, 2) + self.__uwd = uwdvar self.__hexp = hexvar # the last chip selected self.__lastchip = None self.__sb = switchboard - canvaswidth = numchips * (chipwidth + 1) - canvasheight = chipheight + 43 # BAW: Kludge + canvaswidth = numchips * (chipwidth + 1) + canvasheight = chipheight + 43 # BAW: Kludge - # create the canvas and pack it - canvas = self.__canvas = Canvas(master, + # create the canvas and pack it + canvas = self.__canvas = Canvas(master, width=canvaswidth, height=canvasheight, ## borderwidth=2, ## relief=GROOVE ) - canvas.pack() - canvas.bind('', self.__select_chip) - canvas.bind('', self.__select_chip) - canvas.bind('', self.__select_chip) - - # Load a proc into the Tcl interpreter. This is used in the - # set_color() method to speed up setting the chip colors. - canvas.tk.eval(TCLPROC) - - # create the color strip - chips = self.__chips = [] - x = 1 - y = 30 - tags = ('chip',) - for c in range(self.__numchips): - color = 'grey' - canvas.create_rectangle( - x, y, x+chipwidth, y+chipheight, - fill=color, outline=color, - tags=tags) - x = x + chipwidth + 1 # for outline - chips.append(color) - - # create the strip label - self.__label = canvas.create_text( - 3, y + chipheight + 8, - text=label, - anchor=W) - - # create the arrow and text item - chipx = self.__arrow_x(0) - self.__leftarrow = LeftArrow(canvas, chipx) - - chipx = self.__arrow_x(len(chips) - 1) - self.__rightarrow = RightArrow(canvas, chipx) + canvas.pack() + canvas.bind('', self.__select_chip) + canvas.bind('', self.__select_chip) + canvas.bind('', self.__select_chip) + + # Load a proc into the Tcl interpreter. This is used in the + # set_color() method to speed up setting the chip colors. + canvas.tk.eval(TCLPROC) + + # create the color strip + chips = self.__chips = [] + x = 1 + y = 30 + tags = ('chip',) + for c in range(self.__numchips): + color = 'grey' + canvas.create_rectangle( + x, y, x+chipwidth, y+chipheight, + fill=color, outline=color, + tags=tags) + x = x + chipwidth + 1 # for outline + chips.append(color) + + # create the strip label + self.__label = canvas.create_text( + 3, y + chipheight + 8, + text=label, + anchor=W) + + # create the arrow and text item + chipx = self.__arrow_x(0) + self.__leftarrow = LeftArrow(canvas, chipx) + + chipx = self.__arrow_x(len(chips) - 1) + self.__rightarrow = RightArrow(canvas, chipx) def __arrow_x(self, chipnum): - coords = self.__canvas.coords(chipnum+1) - assert coords - x0, y0, x1, y1 = coords - return (x1 + x0) / 2.0 + coords = self.__canvas.coords(chipnum+1) + assert coords + x0, y0, x1, y1 = coords + return (x1 + x0) / 2.0 # Invoked when one of the chips is clicked. This should just tell the # switchboard to set the color on all the output components @@ -260,40 +260,40 @@ class StripWidget: color = self.__canvas.itemcget(self.__lastchip, 'fill') self.__canvas.itemconfigure(self.__lastchip, outline=color) self.__lastchip = chip - # get the arrow's text - coloraxis = rgbtuple[self.__axis] + # get the arrow's text + coloraxis = rgbtuple[self.__axis] if self.__hexp.get(): # hex text = hex(coloraxis) else: # decimal text = repr(coloraxis) - # move the arrow, and set it's text - if coloraxis <= 128: - # use the left arrow - self.__leftarrow.set_text(text) - self.__leftarrow.move_to(self.__arrow_x(chip-1)) - self.__rightarrow.move_to(-100) - else: - # use the right arrow - self.__rightarrow.set_text(text) - self.__rightarrow.move_to(self.__arrow_x(chip-1)) - self.__leftarrow.move_to(-100) - # and set the chip's outline + # move the arrow, and set it's text + if coloraxis <= 128: + # use the left arrow + self.__leftarrow.set_text(text) + self.__leftarrow.move_to(self.__arrow_x(chip-1)) + self.__rightarrow.move_to(-100) + else: + # use the right arrow + self.__rightarrow.set_text(text) + self.__rightarrow.move_to(self.__arrow_x(chip-1)) + self.__leftarrow.move_to(-100) + # and set the chip's outline brightness = ColorDB.triplet_to_brightness(rgbtuple) - if brightness <= 128: - outline = 'white' - else: - outline = 'black' - self.__canvas.itemconfigure(chip, outline=outline) + if brightness <= 128: + outline = 'white' + else: + outline = 'black' + self.__canvas.itemconfigure(chip, outline=outline) def update_yourself(self, red, green, blue): - assert self.__generator - i = 1 - chip = 0 - chips = self.__chips = [] - tk = self.__canvas.tk + assert self.__generator + i = 1 + chip = 0 + chips = self.__chips = [] + tk = self.__canvas.tk # get the red, green, and blue components for all chips for t in self.__generator(self.__numchips, red, green, blue): rrggbb = ColorDB.triplet_to_rrggbb(t) diff --git a/Tools/versioncheck/_checkversion.py b/Tools/versioncheck/_checkversion.py index a103bf9..7b3bb50 100644 --- a/Tools/versioncheck/_checkversion.py +++ b/Tools/versioncheck/_checkversion.py @@ -9,8 +9,8 @@ _VERSION="1.0" _URL="http://www.cwi.nl/~jack/versioncheck/curversion.txt" try: - _myverbose=VERBOSE + _myverbose=VERBOSE except NameError: - _myverbose=1 - + _myverbose=1 + pyversioncheck.versioncheck(_PACKAGE, _URL, _VERSION, verbose=_myverbose) diff --git a/Tools/versioncheck/checkversions.py b/Tools/versioncheck/checkversions.py index dcc56d3..956f553 100644 --- a/Tools/versioncheck/checkversions.py +++ b/Tools/versioncheck/checkversions.py @@ -23,32 +23,32 @@ Values for verboselevel: 3 - Check every URL for packages with multiple locations""" def check1dir(dummy, dir, files): - if CHECKNAME in files: - fullname = os.path.join(dir, CHECKNAME) - try: - execfile(fullname) - except: - print '** Exception in', fullname - + if CHECKNAME in files: + fullname = os.path.join(dir, CHECKNAME) + try: + execfile(fullname) + except: + print '** Exception in', fullname + def walk1tree(tree): - os.path.walk(tree, check1dir, None) - + os.path.walk(tree, check1dir, None) + def main(): - global VERBOSE - try: - options, arguments = getopt.getopt(sys.argv[1:], 'v:') - except getopt.error: - print USAGE - sys.exit(1) - for o, a in options: - if o == '-v': - VERBOSE = int(a) - if not arguments: - arguments = [sys.prefix] - for dir in arguments: - walk1tree(dir) - + global VERBOSE + try: + options, arguments = getopt.getopt(sys.argv[1:], 'v:') + except getopt.error: + print USAGE + sys.exit(1) + for o, a in options: + if o == '-v': + VERBOSE = int(a) + if not arguments: + arguments = [sys.prefix] + for dir in arguments: + walk1tree(dir) + if __name__ == '__main__': - main() - - + main() + + diff --git a/Tools/versioncheck/pyversioncheck.py b/Tools/versioncheck/pyversioncheck.py index 51bdd68..6ac34c8 100644 --- a/Tools/versioncheck/pyversioncheck.py +++ b/Tools/versioncheck/pyversioncheck.py @@ -5,10 +5,10 @@ import urllib import sys # Verbose options -VERBOSE_SILENT=0 # Single-line reports per package -VERBOSE_NORMAL=1 # Single-line reports per package, more info if outdated -VERBOSE_EACHFILE=2 # Report on each URL checked -VERBOSE_CHECKALL=3 # Check each URL for each package +VERBOSE_SILENT=0 # Single-line reports per package +VERBOSE_NORMAL=1 # Single-line reports per package, more info if outdated +VERBOSE_EACHFILE=2 # Report on each URL checked +VERBOSE_CHECKALL=3 # Check each URL for each package # Test directory ## urllib bug: _TESTDIR="ftp://ftp.cwi.nl/pub/jack/python/versiontestdir/" @@ -96,5 +96,4 @@ def _test(): if __name__ == '__main__': _test() - - + -- cgit v0.12