From bckfnn@users.sourceforge.net Fri Nov 1 11:33:03 2002 From: bckfnn@users.sourceforge.net (bckfnn@users.sourceforge.net) Date: Fri, 01 Nov 2002 03:33:03 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_frozen.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19735/Lib/test Modified Files: test_frozen.py Log Message: [SF bug 631713] use the import exeption message in the TestFailed exception. Index: test_frozen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_frozen.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_frozen.py 30 Jul 2002 23:26:01 -0000 1.2 --- test_frozen.py 1 Nov 2002 11:33:00 -0000 1.3 *************** *** 7,21 **** import __hello__ except ImportError, x: ! raise TestFailed, "import __hello__ failed:", x try: import __phello__ except ImportError, x: ! raise TestFailed, "import __phello__ failed:", x try: import __phello__.spam except ImportError, x: ! raise TestFailed, "import __phello__.spam failed:", x try: --- 7,21 ---- import __hello__ except ImportError, x: ! raise TestFailed, "import __hello__ failed:" + str(x) try: import __phello__ except ImportError, x: ! raise TestFailed, "import __phello__ failed:" + str(x) try: import __phello__.spam except ImportError, x: ! raise TestFailed, "import __phello__.spam failed:" + str(x) try: From effbot@users.sourceforge.net Fri Nov 1 17:14:19 2002 From: effbot@users.sourceforge.net (effbot@users.sourceforge.net) Date: Fri, 01 Nov 2002 09:14:19 -0800 Subject: [Python-checkins] python/dist/src/Lib xmlrpclib.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15732/Lib Modified Files: xmlrpclib.py Log Message: patch #624180 (part 2 of 2): use unquote on authentication strings, to allow users to embed @ and : in user names and passwords (from Phillip Eby) Index: xmlrpclib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xmlrpclib.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** xmlrpclib.py 22 Oct 2002 18:23:00 -0000 1.21 --- xmlrpclib.py 1 Nov 2002 17:14:16 -0000 1.22 *************** *** 1066,1070 **** if auth: import base64 ! auth = base64.encodestring(auth) auth = string.join(string.split(auth), "") # get rid of whitespace extra_headers = [ --- 1066,1070 ---- if auth: import base64 ! auth = base64.encodestring(urllib.unquote(auth)) auth = string.join(string.split(auth), "") # get rid of whitespace extra_headers = [ From bckfnn@users.sourceforge.net Fri Nov 1 18:02:07 2002 From: bckfnn@users.sourceforge.net (bckfnn@users.sourceforge.net) Date: Fri, 01 Nov 2002 10:02:07 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_support.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv3851 Modified Files: test_support.py Log Message: Patch #631972: Adds an is_jython flag. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** test_support.py 30 Jul 2002 23:26:01 -0000 1.42 --- test_support.py 1 Nov 2002 18:02:03 -0000 1.43 *************** *** 82,85 **** --- 82,87 ---- have_unicode = 0 + is_jython = sys.platform.startswith('java') + import os # Filename used for testing From bckfnn@users.sourceforge.net Fri Nov 1 19:12:57 2002 From: bckfnn@users.sourceforge.net (bckfnn@users.sourceforge.net) Date: Fri, 01 Nov 2002 11:12:57 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_support.py,1.40,1.40.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv30697 Modified Files: Tag: release22-maint test_support.py Log Message: Patch #631972: Adds an is_jython flag. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.40 retrieving revision 1.40.8.1 diff -C2 -d -r1.40 -r1.40.8.1 *** test_support.py 30 Oct 2001 23:20:46 -0000 1.40 --- test_support.py 1 Nov 2002 19:12:55 -0000 1.40.8.1 *************** *** 79,82 **** --- 79,84 ---- have_unicode = 0 + is_jython = sys.platform.startswith('java') + import os # Filename used for testing From fdrake@users.sourceforge.net Fri Nov 1 21:33:49 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 01 Nov 2002 13:33:49 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.118,1.119 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv17429 Modified Files: libfuncs.tex Log Message: Update example for the type() function to use the currently accepted preference of using "is" instead of "==" to compare types, use built-in names where available, and point to the isinstance() function. Closes SF bug #632196. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** libfuncs.tex 22 Oct 2002 20:31:22 -0000 1.118 --- libfuncs.tex 1 Nov 2002 21:33:44 -0000 1.119 *************** *** 837,847 **** type\obindex{type} object. The standard module \module{types}\refstmodindex{types} defines names for all built-in ! types. For instance: \begin{verbatim} >>> import types ! >>> if type(x) == types.StringType: print "It's a string" \end{verbatim} \end{funcdesc} --- 837,858 ---- type\obindex{type} object. The standard module \module{types}\refstmodindex{types} defines names for all built-in ! types that don't already have built-in names. For instance: \begin{verbatim} >>> import types ! >>> x = 'abc' ! >>> if type(x) is str: print "It's a string" ! ... ! It's a string ! >>> def f(): pass ! ... ! >>> if type(f) is types.FunctionType: print "It's a function" ! ... ! It's a function \end{verbatim} + + The \function{isinstance()} built-in function is recommended for + testing the type of an object. \end{funcdesc} From fdrake@users.sourceforge.net Fri Nov 1 21:34:41 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 01 Nov 2002 13:34:41 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.100.4.12,1.100.4.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv17933 Modified Files: Tag: release22-maint libfuncs.tex Log Message: Update example for the type() function to use the currently accepted preference of using "is" instead of "==" to compare types, use built-in names where available, and point to the isinstance() function. Closes SF bug #632196. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.100.4.12 retrieving revision 1.100.4.13 diff -C2 -d -r1.100.4.12 -r1.100.4.13 *** libfuncs.tex 6 Oct 2002 02:16:52 -0000 1.100.4.12 --- libfuncs.tex 1 Nov 2002 21:34:39 -0000 1.100.4.13 *************** *** 800,810 **** type\obindex{type} object. The standard module \module{types}\refstmodindex{types} defines names for all built-in ! types. For instance: \begin{verbatim} >>> import types ! >>> if type(x) == types.StringType: print "It's a string" \end{verbatim} \end{funcdesc} --- 800,821 ---- type\obindex{type} object. The standard module \module{types}\refstmodindex{types} defines names for all built-in ! types that don't already have built-in names. For instance: \begin{verbatim} >>> import types ! >>> x = 'abc' ! >>> if type(x) is str: print "It's a string" ! ... ! It's a string ! >>> def f(): pass ! ... ! >>> if type(f) is types.FunctionType: print "It's a function" ! ... ! It's a function \end{verbatim} + + The \function{isinstance()} built-in function is recommended for + testing the type of an object. \end{funcdesc} From rhettinger@users.sourceforge.net Sat Nov 2 02:02:50 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 01 Nov 2002 18:02:50 -0800 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14738 Modified Files: pydoc.py Log Message: Correct erroneous parenthesis placement in the delta from 1.63 to 1.64. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** pydoc.py 30 Oct 2002 05:21:00 -0000 1.72 --- pydoc.py 2 Nov 2002 02:02:46 -0000 1.73 *************** *** 824,829 **** def found(name, ispackage, modpkgs=modpkgs, shadowed=shadowed, seen=seen): ! if not name in seen: ! modpkgs.append((name, '', ispackage, name)) in shadowed seen[name] = 1 shadowed[name] = 1 --- 824,829 ---- def found(name, ispackage, modpkgs=modpkgs, shadowed=shadowed, seen=seen): ! if name not in seen: ! modpkgs.append((name, '', ispackage, name in shadowed)) seen[name] = 1 shadowed[name] = 1 From gvanrossum@users.sourceforge.net Sat Nov 2 06:25:53 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 01 Nov 2002 22:25:53 -0800 Subject: [Python-checkins] python/dist/src/Demo/tkinter/guido ss1.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/tkinter/guido In directory usw-pr-cvs1:/tmp/cvs-serv14901 Modified Files: ss1.py Log Message: Major breakthrough in selection -- drag-select multiple cells now works. Also row and column selection works (sort of). The DEL key deletes the selected rectangle. sys.argv[1] used by test_gui(). Index: ss1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/tkinter/guido/ss1.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ss1.py 28 Oct 2002 01:06:37 -0000 1.1 --- ss1.py 2 Nov 2002 06:25:51 -0000 1.2 *************** *** 402,406 **** if self.value is None: try: ! self.value = rexec.r_eval(self.translated) except: exc = sys.exc_info()[0] --- 402,409 ---- if self.value is None: try: ! # A hack to evaluate expressions using true division ! rexec.r_exec("from __future__ import division\n" + ! "__value__ = eval(%s)" % repr(self.translated)) ! self.value = rexec.r_eval("__value__") except: exc = sys.exc_info()[0] *************** *** 491,495 **** TO DO: - clear multiple cells - - Select rows or columns - Insert, clear, remove rows or columns - Show new contents while typing --- 494,497 ---- *************** *** 536,539 **** --- 538,542 ---- self.entry.bind("", self.tab_event) self.entry.bind("", self.shift_tab_event) + self.entry.bind("", self.delete_event) # Now create the cell grid self.makegrid(rows, columns) *************** *** 545,548 **** --- 548,560 ---- self.sync() + def delete_event(self, event): + if self.cornerxy != self.currentxy and self.cornerxy is not None: + self.sheet.clearcells(*(self.currentxy + self.cornerxy)) + else: + self.sheet.clearcell(*self.currentxy) + self.sync() + self.entry.delete(0, 'end') + return "break" + def makegrid(self, rows, columns): """Helper to create the grid of GUI cells. *************** *** 550,553 **** --- 562,567 ---- The edge (x==0 or y==0) is filled with labels; the rest is real cells. """ + self.rows = rows + self.columns = columns self.gridcells = {} # Create the top row of labels *************** *** 557,560 **** --- 571,580 ---- cell.grid_configure(column=x, row=0, sticky='WE') self.gridcells[x, 0] = cell + cell.__x = x + cell.__y = 0 + cell.bind("", self.selectcolumn) + cell.bind("", self.extendcolumn) + cell.bind("", self.extendcolumn) + cell.bind("", self.extendcolumn) # Create the leftmost column of labels for y in range(1, rows+1): *************** *** 562,565 **** --- 582,591 ---- cell.grid_configure(column=0, row=y, sticky='WE') self.gridcells[0, y] = cell + cell.__x = 0 + cell.__y = y + cell.bind("", self.selectrow) + cell.bind("", self.extendrow) + cell.bind("", self.extendrow) + cell.bind("", self.extendrow) # Create the real cells for x in range(1, columns+1): *************** *** 569,578 **** cell.grid_configure(column=x, row=y, sticky='NWSE') self.gridcells[x, y] = cell ! def helper(event, self=self, x=x, y=y): ! self.setcurrent(x, y) ! cell.bind("", helper) ! def shelper(event, self=self, x=x, y=y): ! self.setcorner(x, y) ! cell.bind("", shelper) def save(self): --- 595,648 ---- cell.grid_configure(column=x, row=y, sticky='NWSE') self.gridcells[x, y] = cell ! cell.__x = x ! cell.__y = y ! # Bind mouse events ! cell.bind("", self.press) ! cell.bind("", self.motion) ! cell.bind("", self.release) ! cell.bind("", self.release) ! ! def selectcolumn(self, event): ! x, y = self.whichxy(event) ! self.setcurrent(x, 1) ! self.setcorner(x, self.rows) ! ! def extendcolumn(self, event): ! x, y = self.whichxy(event) ! if x > 0: ! self.setcurrent(self.currentxy[0], 1) ! self.setcorner(x, self.rows) ! ! def selectrow(self, event): ! x, y = self.whichxy(event) ! self.setcurrent(1, y) ! self.setcorner(self.columns, y) ! ! def extendrow(self, event): ! x, y = self.whichxy(event) ! if y > 0: ! self.setcurrent(1, self.currentxy[1]) ! self.setcorner(self.columns, y) ! ! def press(self, event): ! x, y = self.whichxy(event) ! if x > 0 and y > 0: ! self.setcurrent(x, y) ! ! def motion(self, event): ! x, y = self.whichxy(event) ! if x > 0 and y > 0: ! self.setcorner(x, y) ! ! release = motion ! ! def whichxy(self, event): ! w = self.cellgrid.winfo_containing(event.x_root, event.y_root) ! if w is not None and isinstance(w, Tk.Label): ! try: ! return w.__x, w.__y ! except AttributeError: ! pass ! return 0, 0 def save(self): *************** *** 601,605 **** gridcell = self.gridcells.get(self.currentxy) if gridcell is not None: ! gridcell['bg'] = 'lightBlue' def setcorner(self, x, y): --- 671,675 ---- gridcell = self.gridcells.get(self.currentxy) if gridcell is not None: ! gridcell['bg'] = 'yellow' def setcorner(self, x, y): *************** *** 620,623 **** --- 690,696 ---- if gridcell is not None: gridcell['bg'] = 'lightBlue' + gridcell = self.gridcells.get(self.currentxy) + if gridcell is not None: + gridcell['bg'] = 'yellow' name1 = cellname(*self.currentxy) name2 = cellname(*self.cornerxy) *************** *** 733,737 **** def test_gui(): "GUI test." ! g = SheetGUI() g.root.mainloop() --- 806,814 ---- def test_gui(): "GUI test." ! if sys.argv[1:]: ! filename = sys.argv[1] ! else: ! filename = "sheet1.xml" ! g = SheetGUI(filename) g.root.mainloop() From gvanrossum@users.sourceforge.net Sat Nov 2 06:50:08 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 01 Nov 2002 22:50:08 -0800 Subject: [Python-checkins] python/dist/src/Demo/tkinter/guido ss1.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/tkinter/guido In directory usw-pr-cvs1:/tmp/cvs-serv20561 Modified Files: ss1.py Log Message: Add ESC key binding -- undo current cell editing. Index: ss1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/tkinter/guido/ss1.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ss1.py 2 Nov 2002 06:25:51 -0000 1.2 --- ss1.py 2 Nov 2002 06:50:05 -0000 1.3 *************** *** 539,542 **** --- 539,543 ---- self.entry.bind("", self.shift_tab_event) self.entry.bind("", self.delete_event) + self.entry.bind("", self.escape_event) # Now create the cell grid self.makegrid(rows, columns) *************** *** 557,560 **** --- 558,577 ---- return "break" + def escape_event(self, event): + x, y = self.currentxy + self.load_entry(x, y) + + def load_entry(self, x, y): + cell = self.sheet.getcell(x, y) + if cell is None: + text = "" + elif isinstance(cell, FormulaCell): + text = '=' + cell.formula + else: + text, alignment = cell.format() + self.entry.delete(0, 'end') + self.entry.insert(0, text) + self.entry.selection_range(0, 'end') + def makegrid(self, rows, columns): """Helper to create the grid of GUI cells. *************** *** 654,669 **** self.change_cell() self.clearfocus() ! name = cellname(x, y) ! cell = self.sheet.getcell(x, y) ! if cell is None: ! text = "" ! elif isinstance(cell, FormulaCell): ! text = '=' + cell.formula ! else: ! text, alignment = cell.format() ! self.beacon['text'] = name ! self.entry.delete(0, 'end') ! self.entry.insert(0, text) ! self.entry.selection_range(0, 'end') self.entry.focus_set() self.currentxy = x, y --- 671,676 ---- self.change_cell() self.clearfocus() ! self.beacon['text'] = cellname(x, y) ! self.load_entry(x, y) self.entry.focus_set() self.currentxy = x, y From doerwalter@users.sourceforge.net Sat Nov 2 13:32:09 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Sat, 02 Nov 2002 05:32:09 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libcodecs.tex,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv11454 Modified Files: libcodecs.tex Log Message: Move introductory sentence to where it belongs. Index: libcodecs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodecs.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** libcodecs.tex 8 Sep 2002 22:26:13 -0000 1.12 --- libcodecs.tex 2 Nov 2002 13:32:07 -0000 1.13 *************** *** 96,102 **** \end{funcdesc} - To simplify working with encoded files or stream, the module - also defines these utility functions: - \begin{funcdesc}{register_error}{name, error_handler} Register the error handling function \var{error_handler} under the --- 96,99 ---- *************** *** 135,138 **** --- 132,138 ---- Implements the \code{backslashreplace} error handling. \end{funcdesc} + + To simplify working with encoded files or stream, the module + also defines these utility functions: \begin{funcdesc}{open}{filename, mode\optional{, encoding\optional{, From nnorwitz@users.sourceforge.net Sat Nov 2 16:58:09 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 02 Nov 2002 08:58:09 -0800 Subject: [Python-checkins] python/dist/src configure,1.350,1.351 configure.in,1.361,1.362 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv10867 Modified Files: configure configure.in Log Message: Need to quote test for posix_threads on HPUX11 Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.350 retrieving revision 1.351 diff -C2 -d -r1.350 -r1.351 *** configure 29 Oct 2002 10:07:39 -0000 1.350 --- configure 2 Nov 2002 16:58:03 -0000 1.351 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.360 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.361 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 11215,11219 **** ! if test $posix_threads != "yes"; then echo "$as_me:$LINENO: checking for thr_create in -lthread" >&5 echo $ECHO_N "checking for thr_create in -lthread... $ECHO_C" >&6 --- 11215,11219 ---- ! if test "$posix_threads" != "yes"; then echo "$as_me:$LINENO: checking for thr_create in -lthread" >&5 echo $ECHO_N "checking for thr_create in -lthread... $ECHO_C" >&6 Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.361 retrieving revision 1.362 diff -C2 -d -r1.361 -r1.362 *** configure.in 29 Oct 2002 10:07:43 -0000 1.361 --- configure.in 2 Nov 2002 16:58:05 -0000 1.362 *************** *** 1361,1365 **** USE_THREAD_MODULE=""]) ! if test $posix_threads != "yes"; then AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) LIBS="$LIBS -lthread" --- 1361,1365 ---- USE_THREAD_MODULE=""]) ! if test "$posix_threads" != "yes"; then AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) LIBS="$LIBS -lthread" From nnorwitz@users.sourceforge.net Sat Nov 2 18:25:10 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 02 Nov 2002 10:25:10 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_dbm.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14438/Lib/test Modified Files: test_dbm.py Log Message: Skip test_dbm if we can't write to the file Cleanup (remove) the file(s) after we are done with the test. (Fixes problem on snake farm) Index: test_dbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dbm.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_dbm.py 23 Jul 2002 19:03:47 -0000 1.8 --- test_dbm.py 2 Nov 2002 18:25:08 -0000 1.9 *************** *** 3,43 **** Roger E. Masse """ import dbm from dbm import error ! from test.test_support import verbose, verify ! filename = '/tmp/delete_me' ! d = dbm.open(filename, 'c') ! verify(d.keys() == []) ! d['a'] = 'b' ! d['12345678910'] = '019237410982340912840198242' ! d.keys() ! if d.has_key('a'): ! if verbose: ! print 'Test dbm keys: ', d.keys() ! d.close() ! d = dbm.open(filename, 'r') ! d.close() ! d = dbm.open(filename, 'rw') ! d.close() ! d = dbm.open(filename, 'w') ! d.close() ! d = dbm.open(filename, 'n') ! d.close() try: ! import os ! if dbm.library == "ndbm": ! # classic dbm ! os.unlink(filename + '.dir') ! os.unlink(filename + '.pag') ! elif dbm.library == "BSD db": ! # BSD DB's compatibility layer ! os.unlink(filename + '.db') ! else: ! # GNU gdbm compatibility layer ! os.unlink(filename) except: ! pass --- 3,55 ---- Roger E. Masse """ + import os + import random import dbm from dbm import error ! from test.test_support import verbose, verify, TestSkipped ! # make filename unique to allow multiple concurrent tests ! # and to minimize the likelihood of a problem from an old file ! filename = '/tmp/delete_me_' + str(random.random())[-6:] ! def cleanup(): ! for suffix in ['', '.pag', '.dir', '.db']: ! try: ! os.unlink(filename + suffix) ! except OSError, (errno, strerror): ! # if we can't delete the file because of permissions, ! # nothing will work, so skip the test ! if errno == 1: ! raise TestSkipped, 'unable to remove: ' + filename + suffix ! def test_keys(): ! d = dbm.open(filename, 'c') ! verify(d.keys() == []) ! d['a'] = 'b' ! d['12345678910'] = '019237410982340912840198242' ! d.keys() ! if d.has_key('a'): ! if verbose: ! print 'Test dbm keys: ', d.keys() ! ! d.close() + def test_modes(): + d = dbm.open(filename, 'r') + d.close() + d = dbm.open(filename, 'rw') + d.close() + d = dbm.open(filename, 'w') + d.close() + d = dbm.open(filename, 'n') + d.close() + + cleanup() try: ! test_keys() ! test_modes() except: ! cleanup() ! raise ! ! cleanup() From nnorwitz@users.sourceforge.net Sat Nov 2 17:46:26 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 02 Nov 2002 09:46:26 -0800 Subject: [Python-checkins] python/dist/src/Modules resource.c,2.27,2.28 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv24457/Modules Modified Files: resource.c Log Message: Fix SF #632624, test_resource failure on alpha/64bit Return PyLongs instead ot PyInts. On alphas, 9223372036854775807 became -1. Index: resource.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/resource.c,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** resource.c 2 Aug 2002 02:27:13 -0000 2.27 --- resource.c 2 Nov 2002 17:46:24 -0000 2.28 *************** *** 133,137 **** } #endif ! return Py_BuildValue("ii", (long) rl.rlim_cur, (long) rl.rlim_max); } --- 133,137 ---- } #endif ! return Py_BuildValue("ll", (long) rl.rlim_cur, (long) rl.rlim_max); } From nnorwitz@users.sourceforge.net Sat Nov 2 17:46:26 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 02 Nov 2002 09:46:26 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.504,1.505 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv24457/Misc Modified Files: NEWS Log Message: Fix SF #632624, test_resource failure on alpha/64bit Return PyLongs instead ot PyInts. On alphas, 9223372036854775807 became -1. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.504 retrieving revision 1.505 diff -C2 -d -r1.504 -r1.505 *** NEWS 26 Oct 2002 14:50:45 -0000 1.504 --- NEWS 2 Nov 2002 17:46:24 -0000 1.505 *************** *** 293,296 **** --- 293,298 ---- ----------------- + - resource.getrlimit() now returns longs instead of ints. + - readline now dynamically adjusts its input/output stream if sys.stdin/stdout changes. From loewis@users.sourceforge.net Sat Nov 2 17:42:35 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 02 Nov 2002 09:42:35 -0800 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.269,2.270 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv21338/Modules Modified Files: posixmodule.c Log Message: Remove extra argument in mknod. Fixes #632628. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.269 retrieving revision 2.270 diff -C2 -d -r2.269 -r2.270 *** posixmodule.c 16 Oct 2002 20:28:24 -0000 2.269 --- posixmodule.c 2 Nov 2002 17:42:33 -0000 2.270 *************** *** 5170,5174 **** int device = 0; int res; ! if (!PyArg_ParseTuple(args, "s|iii:mknod", &filename, &mode, &device)) return NULL; Py_BEGIN_ALLOW_THREADS --- 5170,5174 ---- int device = 0; int res; ! if (!PyArg_ParseTuple(args, "s|ii:mknod", &filename, &mode, &device)) return NULL; Py_BEGIN_ALLOW_THREADS From nnorwitz@users.sourceforge.net Sat Nov 2 19:55:23 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 02 Nov 2002 11:55:23 -0800 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.245,1.246 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv20418 Modified Files: socketmodule.c Log Message: Use O_NONBLOCK rather than O_NDELAY, so we get POSIX non-blocking I/O. On HPUX, Solaris, Tru64 (Dec UNIX), and IRIX (I think), O_NONBLOCK is the POSIX version of non-blocking I/O which is what we want. On Linux and FreeBSD (at least), O_NONBLOCK and O_NDELAY are the same. So this change should have no negative effect on those platforms. Tested on Linux, Solaris, HPUX. Thanks to Anders Qvist for diagnosing this problem. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.245 retrieving revision 1.246 diff -C2 -d -r1.245 -r1.246 *** socketmodule.c 19 Sep 2002 08:03:21 -0000 1.245 --- socketmodule.c 2 Nov 2002 19:55:21 -0000 1.246 *************** *** 212,217 **** #endif ! #ifndef O_NDELAY ! # define O_NDELAY O_NONBLOCK /* For QNX only? */ #endif --- 212,217 ---- #endif ! #ifndef O_NONBLOCK ! # define O_NONBLOCK O_NDELAY #endif *************** *** 489,495 **** delay_flag = fcntl(s->sock_fd, F_GETFL, 0); if (block) ! delay_flag &= (~O_NDELAY); else ! delay_flag |= O_NDELAY; fcntl(s->sock_fd, F_SETFL, delay_flag); #endif /* !PYOS_OS2 */ --- 489,495 ---- delay_flag = fcntl(s->sock_fd, F_GETFL, 0); if (block) ! delay_flag &= (~O_NONBLOCK); else ! delay_flag |= O_NONBLOCK; fcntl(s->sock_fd, F_SETFL, delay_flag); #endif /* !PYOS_OS2 */ From nnorwitz@users.sourceforge.net Sat Nov 2 20:43:28 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 02 Nov 2002 12:43:28 -0800 Subject: [Python-checkins] python/dist/src/Parser tokenizer.c,2.68,2.69 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv6822/Parser Modified Files: tokenizer.c Log Message: Fix compiler warning on HP-UX. Cast param to isalnum() to int. Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.68 retrieving revision 2.69 diff -C2 -d -r2.68 -r2.69 *** tokenizer.c 26 Oct 2002 14:39:09 -0000 2.68 --- tokenizer.c 2 Nov 2002 20:43:25 -0000 2.69 *************** *** 229,234 **** begin = t; ! while (isalnum(t[0]) || t[0] == '-' || t[0] == '_' || ! t[0] == '.') t++; --- 229,234 ---- begin = t; ! while (isalnum((int)t[0]) || ! t[0] == '-' || t[0] == '_' || t[0] == '.') t++; From nnorwitz@users.sourceforge.net Sat Nov 2 20:58:08 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 02 Nov 2002 12:58:08 -0800 Subject: [Python-checkins] python/dist/src/Python dynload_hpux.c,2.7,2.8 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv12089/Python Modified Files: dynload_hpux.c Log Message: Fix SF # 551504, python -v sometimes fails to find init (HPUX) Joseph Winston recommends removing DYNAMIC_PATH, since it can cause some dynamic libraries to not load on HP-UX 11. Index: dynload_hpux.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/dynload_hpux.c,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -d -r2.7 -r2.8 *** dynload_hpux.c 26 Jan 2002 20:03:48 -0000 2.7 --- dynload_hpux.c 2 Nov 2002 20:58:05 -0000 2.8 *************** *** 30,34 **** flags = BIND_FIRST | BIND_DEFERRED; if (Py_VerboseFlag) { ! flags = DYNAMIC_PATH | BIND_FIRST | BIND_IMMEDIATE | BIND_NONFATAL | BIND_VERBOSE; printf("shl_load %s\n",pathname); --- 30,34 ---- flags = BIND_FIRST | BIND_DEFERRED; if (Py_VerboseFlag) { ! flags = BIND_FIRST | BIND_IMMEDIATE | BIND_NONFATAL | BIND_VERBOSE; printf("shl_load %s\n",pathname); From gvanrossum@users.sourceforge.net Sat Nov 2 22:18:49 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 02 Nov 2002 14:18:49 -0800 Subject: [Python-checkins] python/dist/src/Demo/tkinter/guido ss1.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/tkinter/guido In directory usw-pr-cvs1:/tmp/cvs-serv11803 Modified Files: ss1.py Log Message: Add "select all" by clicking on (0,0) cell. Redo setting the selection and setting the beacon to deal better with rows or columns -- these are now expressed by range (1, sys.maxint). Index: ss1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/tkinter/guido/ss1.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ss1.py 2 Nov 2002 06:50:05 -0000 1.3 --- ss1.py 2 Nov 2002 22:18:46 -0000 1.4 *************** *** 582,586 **** self.columns = columns self.gridcells = {} ! # Create the top row of labels for x in range(1, columns+1): self.cellgrid.grid_columnconfigure(x, minsize=64) --- 582,590 ---- self.columns = columns self.gridcells = {} ! # Create the top left corner cell (which selects all) ! cell = Tk.Label(self.cellgrid, relief='raised') ! cell.grid_configure(column=0, row=0, sticky='NSWE') ! cell.bind("", self.selectall) ! # Create the top row of labels, and confiure the grid columns for x in range(1, columns+1): self.cellgrid.grid_columnconfigure(x, minsize=64) *************** *** 610,614 **** cell = Tk.Label(self.cellgrid, relief='sunken', bg='white', fg='black') ! cell.grid_configure(column=x, row=y, sticky='NWSE') self.gridcells[x, y] = cell cell.__x = x --- 614,618 ---- cell = Tk.Label(self.cellgrid, relief='sunken', bg='white', fg='black') ! cell.grid_configure(column=x, row=y, sticky='NSWE') self.gridcells[x, y] = cell cell.__x = x *************** *** 620,627 **** cell.bind("", self.release) def selectcolumn(self, event): x, y = self.whichxy(event) self.setcurrent(x, 1) ! self.setcorner(x, self.rows) def extendcolumn(self, event): --- 624,635 ---- cell.bind("", self.release) + def selectall(self, event): + self.setcurrent(1, 1) + self.setcorner(sys.maxint, sys.maxint) + def selectcolumn(self, event): x, y = self.whichxy(event) self.setcurrent(x, 1) ! self.setcorner(x, sys.maxint) def extendcolumn(self, event): *************** *** 629,638 **** if x > 0: self.setcurrent(self.currentxy[0], 1) ! self.setcorner(x, self.rows) def selectrow(self, event): x, y = self.whichxy(event) self.setcurrent(1, y) ! self.setcorner(self.columns, y) def extendrow(self, event): --- 637,646 ---- if x > 0: self.setcurrent(self.currentxy[0], 1) ! self.setcorner(x, sys.maxint) def selectrow(self, event): x, y = self.whichxy(event) self.setcurrent(1, y) ! self.setcorner(sys.maxint, y) def extendrow(self, event): *************** *** 640,644 **** if y > 0: self.setcurrent(1, self.currentxy[1]) ! self.setcorner(self.columns, y) def press(self, event): --- 648,652 ---- if y > 0: self.setcurrent(1, self.currentxy[1]) ! self.setcorner(sys.maxint, y) def press(self, event): *************** *** 692,706 **** if y1 > y2: y1, y2 = y2, y1 ! for x in range(x1, x2+1): ! for y in range(y1, y2+1): ! gridcell = self.gridcells.get((x, y)) ! if gridcell is not None: ! gridcell['bg'] = 'lightBlue' gridcell = self.gridcells.get(self.currentxy) if gridcell is not None: gridcell['bg'] = 'yellow' ! name1 = cellname(*self.currentxy) ! name2 = cellname(*self.cornerxy) ! self.beacon['text'] = "%s:%s" % (name1, name2) --- 700,729 ---- if y1 > y2: y1, y2 = y2, y1 ! for (x, y), cell in self.gridcells.iteritems(): ! if x1 <= x <= x2 and y1 <= y <= y2: ! cell['bg'] = 'lightBlue' gridcell = self.gridcells.get(self.currentxy) if gridcell is not None: gridcell['bg'] = 'yellow' ! self.setbeacon(x1, y1, x2, y2) ! ! def setbeacon(self, x1, y1, x2, y2): ! if x1 == y1 == 1 and x2 == y2 == sys.maxint: ! name = ":" ! elif (x1, x2) == (1, sys.maxint): ! if y1 == y2: ! name = "%d" % y1 ! else: ! name = "%d:%d" % (y1, y2) ! elif (y1, y2) == (1, sys.maxint): ! if x1 == x2: ! name = "%s" % colnum2name(x1) ! else: ! name = "%s:%s" % (colnum2name(x1), colnum2name(x2)) ! else: ! name1 = cellname(*self.currentxy) ! name2 = cellname(*self.cornerxy) ! name = "%s:%s" % (name1, name2) ! self.beacon['text'] = name *************** *** 713,721 **** if y1 > y2: y1, y2 = y2, y1 ! for x in range(x1, x2+1): ! for y in range(y1, y2+1): ! gridcell = self.gridcells.get((x, y)) ! if gridcell is not None: ! gridcell['bg'] = 'white' def return_event(self, event): --- 736,742 ---- if y1 > y2: y1, y2 = y2, y1 ! for (x, y), cell in self.gridcells.iteritems(): ! if x1 <= x <= x2 and y1 <= y <= y2: ! cell['bg'] = 'white' def return_event(self, event): From nnorwitz@users.sourceforge.net Sun Nov 3 00:13:44 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 02 Nov 2002 16:13:44 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libcalendar.tex,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23819/Doc/lib Modified Files: libcalendar.tex Log Message: Fix SF #618146, overflow error in calendar module Will backport. Index: libcalendar.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcalendar.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** libcalendar.tex 13 Jun 2002 01:34:50 -0000 1.15 --- libcalendar.tex 3 Nov 2002 00:13:42 -0000 1.16 *************** *** 16,19 **** --- 16,24 ---- dates are given as integers. + Most of these functions rely on the platform provided \function{mktime()}. + Therefore, valid argument values may vary from system to system. + On Unix, valid years are typically between \code{1970} and \code{2037}, + but may be work between \code{1902} and \code{2037}. + \begin{funcdesc}{setfirstweekday}{weekday} Sets the weekday (\code{0} is Monday, \code{6} is Sunday) to start From nnorwitz@users.sourceforge.net Sun Nov 3 00:15:48 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 02 Nov 2002 16:15:48 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libcalendar.tex,1.14.6.1,1.14.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv25047/Doc/lib Modified Files: Tag: release22-maint libcalendar.tex Log Message: Fix SF #618146, overflow error in calendar module Index: libcalendar.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcalendar.tex,v retrieving revision 1.14.6.1 retrieving revision 1.14.6.2 diff -C2 -d -r1.14.6.1 -r1.14.6.2 *** libcalendar.tex 13 Jun 2002 01:35:19 -0000 1.14.6.1 --- libcalendar.tex 3 Nov 2002 00:15:46 -0000 1.14.6.2 *************** *** 16,19 **** --- 16,24 ---- dates are given as integers. + Most of these functions rely on the platform provided \function{mktime()}. + Therefore, valid argument values may vary from system to system. + On Unix, valid years are typically between \code{1970} and \code{2037}, + but may be work between \code{1902} and \code{2037}. + \begin{funcdesc}{setfirstweekday}{weekday} Sets the weekday (\code{0} is Monday, \code{6} is Sunday) to start From nnorwitz@users.sourceforge.net Sun Nov 3 00:35:57 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 02 Nov 2002 16:35:57 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_support.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv32337/Lib/test Modified Files: test_support.py Log Message: Fix SF # 631066, running regrtest in user mode fails Try to write to TESTFN, if that fails, try TESTFN in /tmp If that fails, print a warning and go on. Will backport. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** test_support.py 1 Nov 2002 18:02:03 -0000 1.43 --- test_support.py 3 Nov 2002 00:35:53 -0000 1.44 *************** *** 98,102 **** else: TESTFN = 'test' ! del os from os import unlink --- 98,122 ---- else: TESTFN = 'test' ! ! # Make sure we can write to TESTFN, try in /tmp if we can't ! fp = None ! try: ! fp = open(TESTFN, 'w+') ! except IOError: ! TMP_TESTFN = os.path.join('/tmp', TESTFN) ! try: ! fp = open(TMP_TESTFN, 'w+') ! TESTFN = TMP_TESTFN ! del TMP_TESTFN ! except IOError: ! print ('WARNING: tests will fail, unable to write to: %s or %s' % ! (TESTFN, TMP_TESTFN)) ! if fp is not None: ! fp.close() ! try: ! os.unlink(TESTFN) ! except: ! pass ! del os, fp from os import unlink From nnorwitz@users.sourceforge.net Sun Nov 3 00:37:59 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 02 Nov 2002 16:37:59 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_support.py,1.40.8.1,1.40.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv1148/Lib/test Modified Files: Tag: release22-maint test_support.py Log Message: Fix SF # 631066, running regrtest in user mode fails Try to write to TESTFN, if that fails, try TESTFN in /tmp If that fails, print a warning and go on. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.40.8.1 retrieving revision 1.40.8.2 diff -C2 -d -r1.40.8.1 -r1.40.8.2 *** test_support.py 1 Nov 2002 19:12:55 -0000 1.40.8.1 --- test_support.py 3 Nov 2002 00:37:57 -0000 1.40.8.2 *************** *** 95,99 **** else: TESTFN = 'test' ! del os from os import unlink --- 95,119 ---- else: TESTFN = 'test' ! ! # Make sure we can write to TESTFN, try in /tmp if we can't ! fp = None ! try: ! fp = open(TESTFN, 'w+') ! except IOError: ! TMP_TESTFN = os.path.join('/tmp', TESTFN) ! try: ! fp = open(TMP_TESTFN, 'w+') ! TESTFN = TMP_TESTFN ! del TMP_TESTFN ! except IOError: ! print ('WARNING: tests will fail, unable to write to: %s or %s' % ! (TESTFN, TMP_TESTFN)) ! if fp is not None: ! fp.close() ! try: ! os.unlink(TESTFN) ! except: ! pass ! del os, fp from os import unlink From nnorwitz@users.sourceforge.net Sun Nov 3 02:56:29 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 02 Nov 2002 18:56:29 -0800 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv11503/Doc/api Modified Files: newtypes.tex Log Message: Fix SF # 518775, buffer object API description truncated Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** newtypes.tex 10 Sep 2002 13:48:01 -0000 1.16 --- newtypes.tex 3 Nov 2002 02:56:27 -0000 1.17 *************** *** 1503,1507 **** \begin{ctypedesc}[getcharbufferproc]{int (*getcharbufferproc) (PyObject *self, int segment, const char **ptrptr)} ! [Guido: the description is missing!] \end{ctypedesc} --- 1503,1508 ---- \begin{ctypedesc}[getcharbufferproc]{int (*getcharbufferproc) (PyObject *self, int segment, const char **ptrptr)} ! Return the size of the memory buffer in ptrptr at the segment index. ! \code{\var{ptrptr}} is set to the memory buffer. \end{ctypedesc} From nnorwitz@users.sourceforge.net Sun Nov 3 02:57:26 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 02 Nov 2002 18:57:26 -0800 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.3,1.3.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv11690/Doc/api Modified Files: Tag: release22-maint newtypes.tex Log Message: Fix SF # 518775, buffer object API description truncated Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.3 retrieving revision 1.3.6.1 diff -C2 -d -r1.3 -r1.3.6.1 *** newtypes.tex 3 Dec 2001 17:32:27 -0000 1.3 --- newtypes.tex 3 Nov 2002 02:57:24 -0000 1.3.6.1 *************** *** 344,347 **** --- 344,349 ---- \begin{ctypedesc}[getcharbufferproc]{int (*getcharbufferproc) (PyObject *self, int segment, const char **ptrptr)} + Return the size of the memory buffer in ptrptr at the segment index. + \code{\var{ptrptr}} is set to the memory buffer. \end{ctypedesc} From nnorwitz@users.sourceforge.net Sun Nov 3 13:13:22 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 03 Nov 2002 05:13:22 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib tkinter.tex,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv8245/Doc/lib Modified Files: tkinter.tex Log Message: Fix SF #632864, Typo string instead of sting in LibDoc. Will backport. Index: tkinter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tkinter.tex 12 Oct 2002 15:02:46 -0000 1.15 --- tkinter.tex 3 Nov 2002 13:13:20 -0000 1.16 *************** *** 693,697 **** \item[boolean] ! You can pass integers 0 or 1 or the stings \code{"yes"} or \code{"no"} . \item[callback] --- 693,697 ---- \item[boolean] ! You can pass integers 0 or 1 or the strings \code{"yes"} or \code{"no"} . \item[callback] From nnorwitz@users.sourceforge.net Sun Nov 3 13:13:56 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 03 Nov 2002 05:13:56 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib tkinter.tex,1.10.6.5,1.10.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv8368/Doc/lib Modified Files: Tag: release22-maint tkinter.tex Log Message: Fix SF #632864, Typo string instead of sting in LibDoc. Index: tkinter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v retrieving revision 1.10.6.5 retrieving revision 1.10.6.6 diff -C2 -d -r1.10.6.5 -r1.10.6.6 *** tkinter.tex 12 Oct 2002 15:03:24 -0000 1.10.6.5 --- tkinter.tex 3 Nov 2002 13:13:54 -0000 1.10.6.6 *************** *** 693,697 **** \item[boolean] ! You can pass integers 0 or 1 or the stings \code{"yes"} or \code{"no"} . \item[callback] --- 693,697 ---- \item[boolean] ! You can pass integers 0 or 1 or the strings \code{"yes"} or \code{"no"} . \item[callback] From loewis@users.sourceforge.net Sun Nov 3 17:20:14 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 03 Nov 2002 09:20:14 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.505,1.506 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv11450/Misc Modified Files: NEWS Log Message: Add getpreferredencoding. Support @euro modifiers. Fixes #554676. The @euro part is backported to 2.2.3. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.505 retrieving revision 1.506 diff -C2 -d -r1.505 -r1.506 *** NEWS 2 Nov 2002 17:46:24 -0000 1.505 --- NEWS 3 Nov 2002 17:20:09 -0000 1.506 *************** *** 326,330 **** added where available. ! - The locale module now exposes the C library's gettext interface. - A security hole ("double free") was found in zlib-1.1.3, a popular --- 326,331 ---- added where available. ! - The locale module now exposes the C library's gettext interface. It ! also has a new function getpreferredencoding. - A security hole ("double free") was found in zlib-1.1.3, a popular From loewis@users.sourceforge.net Sun Nov 3 17:20:14 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 03 Nov 2002 09:20:14 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib liblocale.tex,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv11450/Doc/lib Modified Files: liblocale.tex Log Message: Add getpreferredencoding. Support @euro modifiers. Fixes #554676. The @euro part is backported to 2.2.3. Index: liblocale.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblocale.tex,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** liblocale.tex 13 Jun 2002 17:54:06 -0000 1.30 --- liblocale.tex 3 Nov 2002 17:20:12 -0000 1.31 *************** *** 156,159 **** --- 156,173 ---- \end{funcdesc} + \begin{funcdesc}{getpreferredencoding}{\optional{do_setlocale}} + Return the encoding used for text data, according to user + preferences. User preferences are expressed differently on + different systems, and might not be available programmatically on + some systems, so this function only returns a guess. + + On some systems, it is necessary to invoke \function{setlocale} + to obtain the user preferences, so this function is not thread-safe. + If invoking setlocale is not necessary or desired, \var{do_setlocale} + should be set to \code{False}. + + \versionadded{2.3} + \end{funcdesc} + \begin{funcdesc}{normalize}{localename} Returns a normalized locale code for the given locale name. The From loewis@users.sourceforge.net Sun Nov 3 17:20:41 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 03 Nov 2002 09:20:41 -0800 Subject: [Python-checkins] python/dist/src/Lib locale.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv11450/Lib Modified Files: locale.py Log Message: Add getpreferredencoding. Support @euro modifiers. Fixes #554676. The @euro part is backported to 2.2.3. Index: locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/locale.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** locale.py 19 Oct 2002 20:19:10 -0000 1.21 --- locale.py 3 Nov 2002 17:20:08 -0000 1.22 *************** *** 265,268 **** --- 265,277 ---- """ code = normalize(localename) + if '@' in localename: + # Deal with locale modifiers + code, modifier = code.split('@') + if modifier == 'euro' and '.' not in code: + # Assume Latin-9 for @euro locales. This is bogus, + # since some systems may use other encodings for these + # locales. Also, we ignore other modifiers. + return code, 'iso-8859-15' + if '.' in code: return code.split('.')[:2] *************** *** 381,384 **** --- 390,425 ---- """ _setlocale(category, _build_localename(getdefaultlocale())) + + if sys.platform in ('win32', 'darwin', 'mac'): + # On Win32, this will return the ANSI code page + # On the Mac, it should return the system encoding; + # it might return "ascii" instead + def getpreferredencoding(do_setlocale = True): + """Return the charset that the user is likely using.""" + import _locale + return _locale.getdefaultlocale()[1] + else: + # On Unix, if CODESET is available, use that. + try: + CODESET + except NameError: + # Fall back to parsing environment variables :-( + def getpreferredencoding(do_setlocale = True): + """Return the charset that the user is likely using, + by looking at environment variables.""" + return getdefaultlocale()[1] + else: + def getpreferredencoding(do_setlocale = True): + """Return the charset that the user is likely using, + according to the system configuration.""" + if do_setlocale: + oldloc = setlocale(LC_CTYPE) + setlocale(LC_CTYPE, "") + result = nl_langinfo(CODESET) + setlocale(LC_CTYPE, oldloc) + return result + else: + return nl_langinfo(CODESET) + ### Database From loewis@users.sourceforge.net Sun Nov 3 17:20:41 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 03 Nov 2002 09:20:41 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_locale.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11450/Lib/test Modified Files: test_locale.py Log Message: Add getpreferredencoding. Support @euro modifiers. Fixes #554676. The @euro part is backported to 2.2.3. Index: test_locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_locale.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_locale.py 23 Jul 2002 19:03:56 -0000 1.4 --- test_locale.py 3 Nov 2002 17:20:09 -0000 1.5 *************** *** 39,42 **** --- 39,44 ---- testformat("%+10.f", -4200, grouping=1, output=' -4,200') testformat("%-10.f", 4200, grouping=1, output='4,200 ') + # Invoke getpreferredencoding to make sure it does not cause exceptions, + locale.getpreferredencoding() finally: locale.setlocale(locale.LC_NUMERIC, oldlocale) From loewis@users.sourceforge.net Sun Nov 3 17:23:16 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 03 Nov 2002 09:23:16 -0800 Subject: [Python-checkins] python/dist/src/Lib locale.py,1.19,1.19.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12649 Modified Files: Tag: release22-maint locale.py Log Message: Support @euro modifiers. Fixes #554676. Index: locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/locale.py,v retrieving revision 1.19 retrieving revision 1.19.16.1 diff -C2 -d -r1.19 -r1.19.16.1 *** locale.py 13 Aug 2001 14:50:44 -0000 1.19 --- locale.py 3 Nov 2002 17:23:14 -0000 1.19.16.1 *************** *** 265,268 **** --- 265,277 ---- """ code = normalize(localename) + if '@' in localename: + # Deal with locale modifiers + code, modifier = code.split('@') + if modifier == 'euro' and '.' not in code: + # Assume Latin-9 for @euro locales. This is bogus, + # since some systems may use other encodings for these + # locales. Also, we ignore other modifiers. + return code, 'iso-8859-15' + if '.' in code: return code.split('.')[:2] From loewis@users.sourceforge.net Mon Nov 4 09:56:02 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 04 Nov 2002 01:56:02 -0800 Subject: [Python-checkins] python/dist/src/Lib telnetlib.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv6075/Lib Modified Files: telnetlib.py Log Message: Patch #630829: Don't block on IAC, process suboptions. Index: telnetlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/telnetlib.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** telnetlib.py 2 Jun 2002 03:04:51 -0000 1.19 --- telnetlib.py 4 Nov 2002 09:56:00 -0000 1.20 *************** *** 26,32 **** when it is closed). - Bugs: - - may hang when connection is slow in the middle of an IAC sequence - To do: - option negotiation --- 26,29 ---- *************** *** 57,60 **** --- 54,59 ---- WILL = chr(251) theNULL = chr(0) + SB = chr(250) + SE = chr(240) # Telnet protocol options code (don't change) *************** *** 118,121 **** --- 117,121 ---- PRAGMA_HEARTBEAT = chr(140) # TELOPT PRAGMA HEARTBEAT EXOPL = chr(255) # Extended-Options-List + NOOPT = chr(0) class Telnet: *************** *** 162,169 **** I/O. set_option_negotiation_callback(callback) Each time a telnet option is read on the input flow, this callback (if set) is called with the following parameters : ! callback(telnet socket, command (DO/DONT/WILL/WONT), option) No other action is done afterwards by telnetlib. --- 162,173 ---- I/O. + read_sb_data() + Reads available data between SB ... SE sequence. Don't block. + set_option_negotiation_callback(callback) Each time a telnet option is read on the input flow, this callback (if set) is called with the following parameters : ! callback(telnet socket, command, option) ! option will be chr(0) when there is no option. No other action is done afterwards by telnetlib. *************** *** 186,189 **** --- 190,196 ---- self.cookedq = '' self.eof = 0 + self.iacseq = '' # Buffer for IAC sequence. + self.sb = 0 # flag for SB and SE sequence. + self.sbdataq = '' self.option_callback = None if host is not None: *************** *** 251,254 **** --- 258,263 ---- self.sock = 0 self.eof = 1 + self.iacseq = '' + self.sb = 0 def get_socket(self): *************** *** 380,383 **** --- 389,404 ---- raise EOFError, 'telnet connection closed' return buf + + def read_sb_data(self): + """Return any data available in the SB ... SE queue. + + Return '' if no SB ... SE available. Should only be called + after seeing a SB or SE command. When a new SB command is + found, old unread SB data will be discarded. Don't block. + + """ + buf = self.sbdataq + self.sbdataq = '' + return buf def set_option_negotiation_callback(self, callback): *************** *** 392,429 **** """ ! buf = '' try: while self.rawq: c = self.rawq_getchar() ! if c == theNULL: ! continue ! if c == "\021": ! continue ! if c != IAC: ! buf = buf + c ! continue ! c = self.rawq_getchar() ! if c == IAC: ! buf = buf + c ! elif c in (DO, DONT): ! opt = self.rawq_getchar() ! self.msg('IAC %s %d', c == DO and 'DO' or 'DONT', ord(opt)) ! if self.option_callback: ! self.option_callback(self.sock, c, opt) else: ! self.sock.sendall(IAC + WONT + opt) ! elif c in (WILL, WONT): ! opt = self.rawq_getchar() ! self.msg('IAC %s %d', ! c == WILL and 'WILL' or 'WONT', ord(opt)) ! if self.option_callback: ! self.option_callback(self.sock, c, opt) else: ! self.sock.sendall(IAC + DONT + opt) ! else: ! self.msg('IAC %d not recognized' % ord(c)) except EOFError: # raised by self.rawq_getchar() pass ! self.cookedq = self.cookedq + buf def rawq_getchar(self): --- 413,480 ---- """ ! buf = ['', ''] try: while self.rawq: c = self.rawq_getchar() ! if not self.iacseq: ! if c == theNULL: ! continue ! if c == "\021": ! continue ! if c != IAC: ! buf[self.sb] = buf[self.sb] + c ! continue else: ! self.iacseq += c ! elif len(self.iacseq) == 1: ! 'IAC: IAC CMD [OPTION only for WILL/WONT/DO/DONT]' ! if c in (DO, DONT, WILL, WONT): ! self.iacseq += c ! continue ! ! self.iacseq = '' ! if c == IAC: ! buf[self.sb] = buf[self.sb] + c else: ! if c == SB: # SB ... SE start. ! self.sb = 1 ! self.sbdataq = '' ! elif c == SE: ! self.sb = 0 ! self.sbdataq = self.sbdataq + buf[1] ! buf[1] = '' ! if self.option_callback: ! # Callback is supposed to look into ! # the sbdataq ! self.option_callback(self.sock, c, NOOPT) ! else: ! # We can't offer automatic processing of ! # suboptions. Alas, we should not get any ! # unless we did a WILL/DO before. ! self.msg('IAC %d not recognized' % ord(c)) ! elif len(self.iacseq) == 2: ! cmd = self.iacseq[1] ! self.iacseq = '' ! opt = c ! if cmd in (DO, DONT): ! self.msg('IAC %s %d', ! cmd == DO and 'DO' or 'DONT', ord(opt)) ! if self.option_callback: ! self.option_callback(self.sock, cmd, opt) ! else: ! self.sock.sendall(IAC + WONT + opt) ! elif cmd in (WILL, WONT): ! self.msg('IAC %s %d', ! cmd == WILL and 'WILL' or 'WONT', ord(opt)) ! if self.option_callback: ! self.option_callback(self.sock, cmd, opt) ! else: ! self.sock.sendall(IAC + DONT + opt) except EOFError: # raised by self.rawq_getchar() + self.iacseq = '' # Reset on EOF + self.sb = 0 pass ! self.cookedq = self.cookedq + buf[0] ! self.sbdataq = self.sbdataq + buf[1] def rawq_getchar(self): From loewis@users.sourceforge.net Mon Nov 4 09:56:03 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 04 Nov 2002 01:56:03 -0800 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.213,1.214 NEWS,1.506,1.507 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv6075/Misc Modified Files: ACKS NEWS Log Message: Patch #630829: Don't block on IAC, process suboptions. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.213 retrieving revision 1.214 diff -C2 -d -r1.213 -r1.214 *** ACKS 26 Oct 2002 14:50:45 -0000 1.213 --- ACKS 4 Nov 2002 09:56:00 -0000 1.214 *************** *** 466,469 **** --- 466,470 ---- Fred Sells Denis Severson + Ha Shao Bruce Sherwood Pete Shinners Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.506 retrieving revision 1.507 diff -C2 -d -r1.506 -r1.507 *** NEWS 3 Nov 2002 17:20:09 -0000 1.506 --- NEWS 4 Nov 2002 09:56:00 -0000 1.507 *************** *** 1708,1712 **** - telnetlib includes symbolic names for the options, and support for ! setting an option negotiation callback. - The new C standard no longer requires that math libraries set errno to --- 1708,1713 ---- - telnetlib includes symbolic names for the options, and support for ! setting an option negotiation callback. It also supports processing ! of suboptions. - The new C standard no longer requires that math libraries set errno to From loewis@users.sourceforge.net Mon Nov 4 09:56:02 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 04 Nov 2002 01:56:02 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libtelnetlib.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv6075/Doc/lib Modified Files: libtelnetlib.tex Log Message: Patch #630829: Don't block on IAC, process suboptions. Index: libtelnetlib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtelnetlib.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** libtelnetlib.tex 28 Nov 2001 07:26:15 -0000 1.9 --- libtelnetlib.tex 4 Nov 2002 09:55:59 -0000 1.10 *************** *** 97,100 **** --- 97,108 ---- \end{methoddesc} + \begin{methoddesc}{read_sb_data}{} + Return the data collected between a SB/SE pair (suboption begin/end). + The callback should access these data when it was invoked with a + \code{SE} command. This method never blocks. + + \versionadded{2.3} + \end{methoddesc} + \begin{methoddesc}{open}{host\optional{, port}} Connect to a host. From akuchling@users.sourceforge.net Mon Nov 4 13:33:09 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 04 Nov 2002 05:33:09 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_rpm.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv17243 Modified Files: bdist_rpm.py Log Message: [Bug #570655] Fix misleading option text Index: bdist_rpm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_rpm.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** bdist_rpm.py 7 Oct 2002 05:57:21 -0000 1.32 --- bdist_rpm.py 4 Nov 2002 13:33:07 -0000 1.33 *************** *** 69,73 **** "list of documentation files (space or comma-separated)"), ('changelog=', None, ! "path to RPM changelog"), ('icon=', None, "name of icon file"), --- 69,73 ---- "list of documentation files (space or comma-separated)"), ('changelog=', None, ! "RPM changelog"), ('icon=', None, "name of icon file"), From akuchling@users.sourceforge.net Mon Nov 4 13:33:49 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 04 Nov 2002 05:33:49 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_rpm.py,1.27.6.2,1.27.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv17578 Modified Files: Tag: release22-maint bdist_rpm.py Log Message: Backport to 2.2: [Bug #570655] Fix misleading option text Index: bdist_rpm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_rpm.py,v retrieving revision 1.27.6.2 retrieving revision 1.27.6.3 diff -C2 -d -r1.27.6.2 -r1.27.6.3 *** bdist_rpm.py 7 Oct 2002 05:56:42 -0000 1.27.6.2 --- bdist_rpm.py 4 Nov 2002 13:33:47 -0000 1.27.6.3 *************** *** 67,71 **** "list of documentation files (space or comma-separated)"), ('changelog=', None, ! "path to RPM changelog"), ('icon=', None, "name of icon file"), --- 67,71 ---- "list of documentation files (space or comma-separated)"), ('changelog=', None, ! "RPM changelog"), ('icon=', None, "name of icon file"), From akuchling@users.sourceforge.net Mon Nov 4 13:45:18 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 04 Nov 2002 05:45:18 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils core.py,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv20944 Modified Files: core.py Log Message: Add get_distutil_options(); future setup.py files can use this to check whether the Distutils being used supports a particularly capability. (This idea was originally suggested by Juergen Hermann as a method on the Distribution class. I think it makes more sense as a function in core.py, and that's what this patch implements.) Index: core.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/core.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** core.py 11 Sep 2002 16:31:52 -0000 1.51 --- core.py 4 Nov 2002 13:45:15 -0000 1.52 *************** *** 228,229 **** --- 228,238 ---- # run_setup () + + def get_distutil_options (): + """Returns a list of strings recording changes to the Distutils. + + setup.py files can then do: + if 'optional-thing' in get_distutil_options(): + ... + """ + return [] From akuchling@users.sourceforge.net Mon Nov 4 14:27:45 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 04 Nov 2002 06:27:45 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils log.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv5757 Modified Files: log.py Log Message: [Bug #620630] Flush stdout after logging every message. Without it, when output is redirected to a file, compiler error messages show up before Distutils prints the command being invoked. Index: log.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/log.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** log.py 4 Jun 2002 20:00:26 -0000 1.1 --- log.py 4 Nov 2002 14:27:43 -0000 1.2 *************** *** 10,13 **** --- 10,15 ---- FATAL = 5 + import sys + class Log: *************** *** 18,21 **** --- 20,24 ---- if level >= self.threshold: print msg % args + sys.stdout.flush() def log(self, level, msg, *args): From fdrake@users.sourceforge.net Mon Nov 4 16:29:34 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 04 Nov 2002 08:29:34 -0800 Subject: [Python-checkins] python/dist/src/Doc/texinputs python.sty,1.99,1.100 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv26189 Modified Files: python.sty Log Message: Thinking on comp.text.tex seems to be that it's better to override \@makefntext than \@footnotetext, so we'll do that instead. Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** python.sty 31 Oct 2002 21:04:34 -0000 1.99 --- python.sty 4 Nov 2002 16:29:31 -0000 1.100 *************** *** 138,146 **** % work even in footnote context. \newif\ifpy@infootnote \py@infootnotefalse ! \let\py@oldfootnotetext\@footnotetext ! \def\@footnotetext#1{% \bgroup% \py@infootnotetrue ! \py@oldfootnotetext{#1}% \egroup% } --- 138,146 ---- % work even in footnote context. \newif\ifpy@infootnote \py@infootnotefalse ! \let\py@oldmakefntext\@makefntext ! \def\@makefntext#1{% \bgroup% \py@infootnotetrue ! \py@oldmakefntext{#1}% \egroup% } From loewis@users.sourceforge.net Mon Nov 4 17:34:10 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 04 Nov 2002 09:34:10 -0800 Subject: [Python-checkins] python/dist/src/Lib telnetlib.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19420 Modified Files: telnetlib.py Log Message: Patch #625823: Add symbolic constants for more commands. Index: telnetlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/telnetlib.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** telnetlib.py 4 Nov 2002 09:56:00 -0000 1.20 --- telnetlib.py 4 Nov 2002 17:34:07 -0000 1.21 *************** *** 54,59 **** WILL = chr(251) theNULL = chr(0) ! SB = chr(250) ! SE = chr(240) # Telnet protocol options code (don't change) --- 54,70 ---- WILL = chr(251) theNULL = chr(0) ! ! SE = chr(240) # Subnegotiation End ! NOP = chr(241) # No Operation ! DM = chr(242) # Data Mark ! BRK = chr(243) # Break ! IP = chr(244) # Interrupt process ! AO = chr(245) # Abort output ! AYT = chr(246) # Are You There ! EC = chr(247) # Erase Character ! EL = chr(248) # Erase Line ! GA = chr(249) # Go Ahead ! SB = chr(250) # Subnegotiation Begin ! # Telnet protocol options code (don't change) From loewis@users.sourceforge.net Mon Nov 4 17:41:20 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 04 Nov 2002 09:41:20 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libtelnetlib.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv22767 Modified Files: libtelnetlib.tex Log Message: Document symbolic constants for commands. Index: libtelnetlib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtelnetlib.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** libtelnetlib.tex 4 Nov 2002 09:55:59 -0000 1.10 --- libtelnetlib.tex 4 Nov 2002 17:41:18 -0000 1.11 *************** *** 11,19 **** implements the Telnet protocol. See \rfc{854} for details about the protocol. In addition, it provides symbolic constants for the protocol ! characters (IAC/DONT/DO/WONT/WILL), and for the telnet options. The symbolic names of the telnet options follow the definitions in \code{arpa/telnet.h}, with the leading \code{TELOPT_} removed. For symbolic names of options which are traditionally not included in \code{arpa/telnet.h}, see the module source itself. --- 11,25 ---- implements the Telnet protocol. See \rfc{854} for details about the protocol. In addition, it provides symbolic constants for the protocol ! characters (see below), and for the telnet options. The symbolic names of the telnet options follow the definitions in \code{arpa/telnet.h}, with the leading \code{TELOPT_} removed. For symbolic names of options which are traditionally not included in \code{arpa/telnet.h}, see the module source itself. + + The symbolic constants for the telnet commands are: IAC, DONT, DO, + WONT, WILL, SE (Subnegotiation End), NOP (No Operation), DM (Data + Mark), BRK (Break), IP (Interrupt process), AO (Abort output), AYT + (Are You There), EC (Erase Character), EL (Erase Line), GA (Go Ahead), + SB (Subnegotiation Begin). From akuchling@users.sourceforge.net Mon Nov 4 19:50:05 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 04 Nov 2002 11:50:05 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command build_ext.py,1.86,1.87 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv10250 Modified Files: build_ext.py Log Message: [Patch #588809] Remove check of environment variables; sysconfig.py will do that now Index: build_ext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_ext.py,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** build_ext.py 31 Oct 2002 14:26:37 -0000 1.86 --- build_ext.py 4 Nov 2002 19:50:03 -0000 1.87 *************** *** 452,463 **** macros.append((undef,)) - # XXX and if we support CFLAGS, why not CC (compiler - # executable), CPPFLAGS (pre-processor options), and LDFLAGS - # (linker options) too? - # XXX should we use shlex to properly parse CFLAGS? - - if os.environ.has_key('CFLAGS'): - extra_args.extend(string.split(os.environ['CFLAGS'])) - objects = self.compiler.compile(sources, output_dir=self.build_temp, --- 452,455 ---- *************** *** 485,489 **** objects.extend(ext.extra_objects) extra_args = ext.extra_link_args or [] - self.compiler.link_shared_object( --- 477,480 ---- From tim_one@users.sourceforge.net Mon Nov 4 19:50:13 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 04 Nov 2002 11:50:13 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.507,1.508 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv8265/python/Misc Modified Files: NEWS Log Message: Related to SF patch 618135: gzip.py and files > 2G. Fixed the signed/unsigned confusions when dealing with files >= 2GB. 4GB is still a hard limitation of the gzip file format, though. Testing this was a bitch on Win98SE due to frequent system freezes. It didn't freeze while running gzip, it kept freezing while trying to *create* a > 2GB test file! This wasn't Python's doing. I don't know of a reasonable way to test this functionality in regrtest.py, so I'm not checking in a test case (a test case would necessarily require creating a 2GB+ file first, using gzip to zip it, using gzip to unzip it again, and then compare before-and-after; so >4GB free space would be required, and a loooong time; I did all this "by hand" once). Bugfix candidate, I guess. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.507 retrieving revision 1.508 diff -C2 -d -r1.507 -r1.508 *** NEWS 4 Nov 2002 09:56:00 -0000 1.507 --- NEWS 4 Nov 2002 19:50:11 -0000 1.508 *************** *** 356,359 **** --- 356,363 ---- ------- + - gzip.py now handles files exceeding 2GB. Note that 4GB is still a + fundamental limitation of the underlying gzip file format (it only + has 32 bits to record the file size). + - xml.sax.saxutils.unescape has been added, to replace entity references with their entity value. *************** *** 366,370 **** - Various configure methods of Tkinter have been stream-lined, so that tag_configure, image_configure, window_configure now return a ! dictionary when invoked with no argument. - Importing the readline module now no longer has the side effect of --- 370,374 ---- - Various configure methods of Tkinter have been stream-lined, so that tag_configure, image_configure, window_configure now return a ! dictionary when invoked with no argument. - Importing the readline module now no longer has the side effect of From tim_one@users.sourceforge.net Mon Nov 4 19:50:13 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 04 Nov 2002 11:50:13 -0800 Subject: [Python-checkins] python/dist/src/Lib gzip.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8265/python/Lib Modified Files: gzip.py Log Message: Related to SF patch 618135: gzip.py and files > 2G. Fixed the signed/unsigned confusions when dealing with files >= 2GB. 4GB is still a hard limitation of the gzip file format, though. Testing this was a bitch on Win98SE due to frequent system freezes. It didn't freeze while running gzip, it kept freezing while trying to *create* a > 2GB test file! This wasn't Python's doing. I don't know of a reasonable way to test this functionality in regrtest.py, so I'm not checking in a test case (a test case would necessarily require creating a 2GB+ file first, using gzip to zip it, using gzip to unzip it again, and then compare before-and-after; so >4GB free space would be required, and a loooong time; I did all this "by hand" once). Bugfix candidate, I guess. Index: gzip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gzip.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** gzip.py 6 Aug 2002 17:03:25 -0000 1.35 --- gzip.py 4 Nov 2002 19:50:11 -0000 1.36 *************** *** 16,25 **** READ, WRITE = 1, 2 def write32(output, value): output.write(struct.pack("= 2GB when viewed as a 32-bit unsigned int, return a long. + """ + if i < 0: + i += 1L << 32 + return i + def write32(output, value): output.write(struct.pack(" 0: line = self.readline() ! if line == "": break L.append(line) sizehint = sizehint - len(line) --- 394,404 ---- def readlines(self, sizehint=0): # Negative numbers result in reading all the lines ! if sizehint <= 0: ! sizehint = sys.maxint L = [] while sizehint > 0: line = self.readline() ! if line == "": ! break L.append(line) sizehint = sizehint - len(line) From akuchling@users.sourceforge.net Mon Nov 4 19:53:26 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 04 Nov 2002 11:53:26 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils sysconfig.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv10816 Modified Files: sysconfig.py Log Message: [Patch #588809] LDFLAGS support for build_ext.py, from Robert Weber customize_compiler() now looks at various environment variables and uses their values to override the configured C compiler/preprocessor/linker binary and flags. Index: sysconfig.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/sysconfig.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** sysconfig.py 12 Jul 2002 09:16:44 -0000 1.50 --- sysconfig.py 4 Nov 2002 19:53:24 -0000 1.51 *************** *** 143,149 **** get_config_vars('CC', 'OPT', 'CCSHARED', 'LDSHARED', 'SO') cc_cmd = cc + ' ' + opt compiler.set_executables( ! preprocessor=cc + " -E", # not always! compiler=cc_cmd, compiler_so=cc_cmd + ' ' + ccshared, --- 143,165 ---- get_config_vars('CC', 'OPT', 'CCSHARED', 'LDSHARED', 'SO') + if os.environ.has_key('CC'): + cc = os.environ['CC'] + if os.environ.has_key('CPP'): + cpp = os.environ['CPP'] + else: + cpp = cc + " -E" # not always + if os.environ.has_key('LDFLAGS'): + ldshared = ldshared + ' ' + os.environ['LDFLAGS'] + if os.environ.has_key('CFLAGS'): + opt = opt + ' ' + os.environ['CFLAGS'] + ldshared = ldshared + ' ' + os.environ['CFLAGS'] + if os.environ.has_key('CPPFLAGS'): + cpp = cpp + ' ' + os.environ['CPPFLAGS'] + opt = opt + ' ' + os.environ['CPPFLAGS'] + ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] + cc_cmd = cc + ' ' + opt compiler.set_executables( ! preprocessor=cpp, compiler=cc_cmd, compiler_so=cc_cmd + ' ' + ccshared, From akuchling@users.sourceforge.net Mon Nov 4 20:05:14 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 04 Nov 2002 12:05:14 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.60,1.61 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv16294 Modified Files: whatsnew23.tex Log Message: Mention distutil changes Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** whatsnew23.tex 16 Oct 2002 18:27:38 -0000 1.60 --- whatsnew23.tex 4 Nov 2002 20:05:10 -0000 1.61 *************** *** 903,906 **** --- 903,913 ---- (Contributed by Jeremy Hylton.) + \item Other minor changes to Distutils: + it now checks for the \envvar{CC}, \envvar{CFLAGS}, \envvar{CPP}, + \envvar{LDFLAGS}, and \envvar{CPPFLAGS} environment variables, using + them to override the settings in Python's configuration (contributed + by Robert Weber); the \function{get_distutils_option()} method lists + recently-added extensions to Distutils. + \item The \module{getopt} module gained a new function, \function{gnu_getopt()}, that supports the same arguments as the existing From akuchling@users.sourceforge.net Mon Nov 4 20:17:26 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 04 Nov 2002 12:17:26 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.61,1.62 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv20916 Modified Files: whatsnew23.tex Log Message: Bring back the patch/bug count paragraph. Correct source of *strip() changes Small rewrites. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** whatsnew23.tex 4 Nov 2002 20:05:10 -0000 1.61 --- whatsnew23.tex 4 Nov 2002 20:17:24 -0000 1.62 *************** *** 15,20 **** % MacOS framework-related changes (section of its own, probably) % - % New sorting code - % % xreadlines obsolete; files are their own iterator --- 15,18 ---- *************** *** 701,705 **** (Patch contributed by Raymond Hettinger.) ! \item The \keyword{assert} statement no longer checks the \code{__debug__} flag, so you can no longer disable assertions by assigning to \code{__debug__}. Running Python with the \programopt{-O} switch will still generate --- 699,703 ---- (Patch contributed by Raymond Hettinger.) ! \item The \keyword{assert} statement no longer checks the \code{__debug__} flag, so you can no longer disable assertions by assigning to \code{__debug__}. Running Python with the \programopt{-O} switch will still generate *************** *** 805,809 **** \end{verbatim} ! (Contributed by Simon Brunning.) \item The \method{startswith()} and \method{endswith()} --- 803,807 ---- \end{verbatim} ! (Suggested by Simon Brunning, and implemented by Walter D\"orwald.) \item The \method{startswith()} and \method{endswith()} *************** *** 1302,1306 **** \section{Other Changes and Fixes} ! Finally, there are various miscellaneous fixes: \begin{itemize} --- 1300,1309 ---- \section{Other Changes and Fixes} ! As usual, there were a bunch of other improvements and bugfixes ! scattered throughout the source tree. A search through the CVS change ! logs finds there were 289 patches applied and 323 bugs fixed between ! Python 2.2 and 2.3. Both figures are likely to be underestimates. ! ! Some of the more notable changes are: \begin{itemize} *************** *** 1318,1323 **** entirely. ! Python code will be hard pushed to notice a difference from this ! change, apart from a slight speed up when python is run without \programopt{-O}. --- 1321,1326 ---- entirely. ! It would be difficult to detect any resulting difference from Python ! code, apart from a slight speed up when Python is run without \programopt{-O}. *************** *** 1341,1345 **** The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this ! article: Michael Chermside, Scott David Daniels, Fred~L. Drake, Jr., Michael Hudson, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, Lalo Martins, Gustavo Niemeyer, Neal Norwitz, Jason Tishler. --- 1344,1348 ---- The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this ! article: Simon Brunning, Michael Chermside, Scott David Daniels, Fred~L. Drake, Jr., Michael Hudson, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, Lalo Martins, Gustavo Niemeyer, Neal Norwitz, Jason Tishler. From fdrake@users.sourceforge.net Mon Nov 4 20:49:49 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 04 Nov 2002 12:49:49 -0800 Subject: [Python-checkins] python/dist/src README,1.155,1.156 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv1664 Modified Files: README Log Message: Update config.h to pyconfig.h. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -d -r1.155 -r1.156 *** README 14 Oct 2002 18:15:35 -0000 1.155 --- README 4 Nov 2002 20:49:45 -0000 1.156 *************** *** 306,310 **** OPT variable in the top-level Makefile; reported by Pat Knight, this seems to make a difference (at least for HP-UX 10.20) ! even though config.h defines it. HP PA-RISC 2.0: A recent bug report (http://www.python.org/sf/546117) --- 306,310 ---- OPT variable in the top-level Makefile; reported by Pat Knight, this seems to make a difference (at least for HP-UX 10.20) ! even though pyconfig.h defines it. HP PA-RISC 2.0: A recent bug report (http://www.python.org/sf/546117) From fdrake@users.sourceforge.net Mon Nov 4 20:50:43 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 04 Nov 2002 12:50:43 -0800 Subject: [Python-checkins] python/dist/src README,1.136.4.11,1.136.4.12 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv2159 Modified Files: Tag: release22-maint README Log Message: Update config.h to pyconfig.h and config.h.in to pyconfig.h.in. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.136.4.11 retrieving revision 1.136.4.12 diff -C2 -d -r1.136.4.11 -r1.136.4.12 *** README 14 Oct 2002 18:13:24 -0000 1.136.4.11 --- README 4 Nov 2002 20:50:39 -0000 1.136.4.12 *************** *** 305,309 **** OPT variable in the top-level Makefile; reported by Pat Knight, this seems to make a difference (at least for HP-UX 10.20) ! even though config.h defines it. Minix: When using ack, use "CC=cc AR=aal RANLIB=: ./configure"! --- 305,309 ---- OPT variable in the top-level Makefile; reported by Pat Knight, this seems to make a difference (at least for HP-UX 10.20) ! even though pyconfig.h defines it. Minix: When using ack, use "CC=cc AR=aal RANLIB=: ./configure"! *************** *** 906,910 **** effect of running the configure script manually (for Mac and PC, this has already been done for you). A good start is to copy the file ! config.h.in to config.h and edit the latter to reflect the actual configuration of your system. Most symbols must simply be defined as 1 only if the corresponding feature is present and can be left alone --- 906,910 ---- effect of running the configure script manually (for Mac and PC, this has already been done for you). A good start is to copy the file ! pyconfig.h.in to pyconfig.h and edit the latter to reflect the actual configuration of your system. Most symbols must simply be defined as 1 only if the corresponding feature is present and can be left alone *************** *** 988,992 **** Tools/ Some useful programs written in Python acconfig.h Additional input for the GNU autoheader program ! config.h.in Source from which config.h is created (GNU autoheader output) configure Configuration shell script (GNU autoconf output) configure.in Configuration specification (input for GNU autoconf) --- 988,992 ---- Tools/ Some useful programs written in Python acconfig.h Additional input for the GNU autoheader program ! pyconfig.h.in Source from which pyconfig.h is created (GNU autoheader output) configure Configuration shell script (GNU autoconf output) configure.in Configuration specification (input for GNU autoconf) *************** *** 1000,1004 **** buildno Keeps track of the build number config.cache Cache of configuration variables ! config.h Configuration header config.log Log from last configure run config.status Status from last run of the configure script --- 1000,1004 ---- buildno Keeps track of the build number config.cache Cache of configuration variables ! pyconfig.h Configuration header config.log Log from last configure run config.status Status from last run of the configure script From nnorwitz@users.sourceforge.net Mon Nov 4 23:21:12 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 04 Nov 2002 15:21:12 -0800 Subject: [Python-checkins] python/dist/src/Modules nismodule.c,2.23,2.24 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv11311/Modules Modified Files: nismodule.c Log Message: SF #633013, Fix NIS causing interpreter core dump Prevent the lengths passed to PyString_FromStringAndSize() from being negative in some cases. Index: nismodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/nismodule.c,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -d -r2.23 -r2.24 *** nismodule.c 31 Mar 2002 15:27:00 -0000 2.23 --- nismodule.c 4 Nov 2002 23:21:09 -0000 2.24 *************** *** 86,91 **** if (indata->fix) { ! inkeylen--; ! invallen--; } key = PyString_FromStringAndSize(inkey, inkeylen); --- 86,93 ---- if (indata->fix) { ! if (inkeylen > 0 && inkey[inkeylen-1] == '\0') ! inkeylen--; ! if (invallen > 0 && inval[invallen-1] == '\0') ! invallen--; } key = PyString_FromStringAndSize(inkey, inkeylen); From nnorwitz@users.sourceforge.net Mon Nov 4 23:40:49 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 04 Nov 2002 15:40:49 -0800 Subject: [Python-checkins] python/dist/src/Modules nismodule.c,2.21,2.21.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv24338/Modules Modified Files: Tag: release22-maint nismodule.c Log Message: Backport last checkin: SF #633013, Fix NIS causing interpreter core dump Prevent the lengths passed to PyString_FromStringAndSize() from being negative in some cases. Index: nismodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/nismodule.c,v retrieving revision 2.21 retrieving revision 2.21.24.1 diff -C2 -d -r2.21 -r2.21.24.1 *** nismodule.c 21 Jan 2001 23:34:12 -0000 2.21 --- nismodule.c 4 Nov 2002 23:40:47 -0000 2.21.24.1 *************** *** 86,91 **** if (indata->fix) { ! inkeylen--; ! invallen--; } key = PyString_FromStringAndSize(inkey, inkeylen); --- 86,93 ---- if (indata->fix) { ! if (inkeylen > 0 && inkey[inkeylen-1] == '\0') ! inkeylen--; ! if (invallen > 0 && inval[invallen-1] == '\0') ! invallen--; } key = PyString_FromStringAndSize(inkey, inkeylen); From akuchling@users.sourceforge.net Tue Nov 5 00:26:35 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 04 Nov 2002 16:26:35 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.62,1.63 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv15725 Modified Files: whatsnew23.tex Log Message: Use personal e-mail address; update date; various small edits; add a name to acks Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** whatsnew23.tex 4 Nov 2002 20:17:24 -0000 1.62 --- whatsnew23.tex 5 Nov 2002 00:26:33 -0000 1.63 *************** *** 5,9 **** \release{0.03} \author{A.M. Kuchling} ! \authoraddress{\email{akuchlin@mems-exchange.org}} \begin{document} --- 5,9 ---- \release{0.03} \author{A.M. Kuchling} ! \authoraddress{\email{amk@amk.ca}} \begin{document} *************** *** 20,24 **** {\large This article is a draft, and is currently up to date for some ! random version of the CVS tree around mid-July 2002. Please send any additions, comments or errata to the author.} --- 20,24 ---- {\large This article is a draft, and is currently up to date for some ! random version of the CVS tree from early November 2002. Please send any additions, comments or errata to the author.} *************** *** 1073,1088 **** the \method{toxml()} and \method{toprettyxml()} methods of DOM nodes. ! \item The \function{stat} family of functions can now report fractions ! of a second in a time stamp. Similar to \function{time.time}, such ! time stamps are represented as floats. ! During testing, it was found that some applications break if time ! stamps are floats. For compatibility, when using the tuple interface of the \class{stat_result}, time stamps are represented as integers. ! When using named fields (first introduced in Python 2.2), time stamps ! are still represented as ints, unless \function{os.stat_float_times} ! is invoked: \begin{verbatim} >>> os.stat_float_times(True) >>> os.stat("/tmp").st_mtime --- 1073,1091 ---- the \method{toxml()} and \method{toprettyxml()} methods of DOM nodes. ! \item The \function{*stat()} family of functions can now report ! fractions of a second in a timestamp. Such time stamps are ! represented as floats, similar to \function{time.time()}. ! During testing, it was found that some applications will break if time ! stamps are floats. For compatibility, when using the tuple interface of the \class{stat_result}, time stamps are represented as integers. ! When using named fields (a feature first introduced in Python 2.2), ! time stamps are still represented as ints, unless ! \function{os.stat_float_times()} is invoked to enable float return ! values: \begin{verbatim} + >>> os.stat("/tmp").st_mtime + 1034791200 >>> os.stat_float_times(True) >>> os.stat("/tmp").st_mtime *************** *** 1090,1099 **** \end{verbatim} ! In Python 2.4, the default will change to return floats. Application developers should use this feature only if all their libraries work properly when confronted with floating point time ! stamps (or use the tuple API). If used, the feature should be ! activated on application level, instead of trying to activate it on a per-use basis. --- 1093,1102 ---- \end{verbatim} ! In Python 2.4, the default will change to always returning floats. Application developers should use this feature only if all their libraries work properly when confronted with floating point time ! stamps, or if they use the tuple API. If used, the feature should be ! activated on an application level instead of trying to enable it on a per-use basis. *************** *** 1346,1350 **** article: Simon Brunning, Michael Chermside, Scott David Daniels, Fred~L. Drake, Jr., Michael Hudson, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, ! Lalo Martins, Gustavo Niemeyer, Neal Norwitz, Jason Tishler. \end{document} --- 1349,1354 ---- article: Simon Brunning, Michael Chermside, Scott David Daniels, Fred~L. Drake, Jr., Michael Hudson, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, ! Lalo Martins, Gustavo Niemeyer, Neal Norwitz, Neil Schemenauer, Jason ! Tishler. \end{document} From tim_one@users.sourceforge.net Tue Nov 5 03:49:11 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 04 Nov 2002 19:49:11 -0800 Subject: [Python-checkins] python/dist/src/Lib locale.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28962/python/Lib Modified Files: locale.py Log Message: This stopped working on Windows, due to a reference to the non-existent _locale.getdefaultlocale. Guessing a leading underscore was intended, but don't really understood this stuff (locale looks like Spanish for the opposite of global to me ). Index: locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/locale.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** locale.py 3 Nov 2002 17:20:08 -0000 1.22 --- locale.py 5 Nov 2002 03:49:09 -0000 1.23 *************** *** 398,402 **** """Return the charset that the user is likely using.""" import _locale ! return _locale.getdefaultlocale()[1] else: # On Unix, if CODESET is available, use that. --- 398,402 ---- """Return the charset that the user is likely using.""" import _locale ! return _locale._getdefaultlocale()[1] else: # On Unix, if CODESET is available, use that. From rhettinger@users.sourceforge.net Tue Nov 5 06:06:05 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 04 Nov 2002 22:06:05 -0800 Subject: [Python-checkins] python/dist/src/Lib tokenize.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28248 Modified Files: tokenize.py Log Message: SF 633560: tokenize.__all__ needs "generate_tokens" Index: tokenize.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tokenize.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tokenize.py 24 Aug 2002 06:54:19 -0000 1.33 --- tokenize.py 5 Nov 2002 06:06:02 -0000 1.34 *************** *** 31,35 **** import token ! __all__ = [x for x in dir(token) if x[0] != '_'] + ["COMMENT", "tokenize", "NL"] del x del token --- 31,36 ---- import token ! __all__ = [x for x in dir(token) if x[0] != '_'] + ["COMMENT", "tokenize", ! "generate_tokens", "NL"] del x del token From rhettinger@users.sourceforge.net Tue Nov 5 06:08:14 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 04 Nov 2002 22:08:14 -0800 Subject: [Python-checkins] python/dist/src/Lib tokenize.py,1.28.14.2,1.28.14.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28885 Modified Files: Tag: release22-maint tokenize.py Log Message: SF 633560: tokenize.__all__ needs "generate_tokens" Index: tokenize.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tokenize.py,v retrieving revision 1.28.14.2 retrieving revision 1.28.14.3 diff -C2 -d -r1.28.14.2 -r1.28.14.3 *** tokenize.py 7 Oct 2002 01:18:17 -0000 1.28.14.2 --- tokenize.py 5 Nov 2002 06:08:11 -0000 1.28.14.3 *************** *** 33,37 **** import token ! __all__ = [x for x in dir(token) if x[0] != '_'] + ["COMMENT", "tokenize", "NL"] del token --- 33,38 ---- import token ! __all__ = [x for x in dir(token) if x[0] != '_'] + ["COMMENT", "tokenize", ! "generate_tokens", "NL"] del token From theller@users.sourceforge.net Tue Nov 5 10:02:08 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 05 Nov 2002 02:02:08 -0800 Subject: [Python-checkins] distutils/misc install.c,1.20,1.21 Message-ID: Update of /cvsroot/python/distutils/misc In directory usw-pr-cvs1:/tmp/cvs-serv10691a/misc Modified Files: install.c Log Message: Fixed the error handling of the run_installscript function. Index: install.c =================================================================== RCS file: /cvsroot/python/distutils/misc/install.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** install.c 16 Oct 2002 17:48:58 -0000 1.20 --- install.c 5 Nov 2002 10:02:03 -0000 1.21 *************** *** 328,345 **** --- 328,359 ---- char *name; } csidl_names[] = { + /* Startup menu for all users. + NT only */ DEF_CSIDL(CSIDL_COMMON_STARTMENU), + /* Startup menu. */ DEF_CSIDL(CSIDL_STARTMENU), /* DEF_CSIDL(CSIDL_COMMON_APPDATA), */ /* DEF_CSIDL(CSIDL_LOCAL_APPDATA), */ + /* Repository for application-specific data. + Needs Internet Explorer 4.0 */ DEF_CSIDL(CSIDL_APPDATA), + /* The desktop for all users. + NT only */ DEF_CSIDL(CSIDL_COMMON_DESKTOPDIRECTORY), + /* The desktop. */ DEF_CSIDL(CSIDL_DESKTOPDIRECTORY), + /* Startup folder for all users. + NT only */ DEF_CSIDL(CSIDL_COMMON_STARTUP), + /* Startup folder. */ DEF_CSIDL(CSIDL_STARTUP), + /* Programs item in the start menu for all users. + NT only */ DEF_CSIDL(CSIDL_COMMON_PROGRAMS), + /* Program item in the user's start menu. */ DEF_CSIDL(CSIDL_PROGRAMS), *************** *** 347,350 **** --- 361,365 ---- /* DEF_CSIDL(CSIDL_PROGRAM_FILES), */ + /* Virtual folder containing fonts. */ DEF_CSIDL(CSIDL_FONTS), }; *************** *** 523,526 **** --- 538,551 ---- }; + /* + * This function returns one of the following error codes: + * 1 if the Python-dll does not export the functions we need + * 2 if no install-script is specified in pathname + * 3 if the install-script file could not be opened + * the return value of PyRun_SimpleFile() otherwise, + * which is 0 if everything is ok, -1 if an exception had occurred + * in the install-script. + */ + static int run_installscript(HINSTANCE hPython, char *pathname, int argc, char **argv) { *************** *** 543,557 **** if (!Py_Initialize || !PySys_SetArgv || !PyRun_SimpleFile || !Py_Finalize) ! return 0x80000000; if (!PyImport_ImportModule || !PyObject_SetAttrString || !Py_BuildValue) ! return 0x80000000; if (!PyCFunction_New || !PyArg_ParseTuple || !PyErr_Format) ! return 0x80000000; if (!PyObject_GetAttrString) ! return 0x80000000; ! g_Py_BuildValue = Py_BuildValue; --- 568,581 ---- if (!Py_Initialize || !PySys_SetArgv || !PyRun_SimpleFile || !Py_Finalize) ! return 1; if (!PyImport_ImportModule || !PyObject_SetAttrString || !Py_BuildValue) ! return 1; if (!PyCFunction_New || !PyArg_ParseTuple || !PyErr_Format) ! return 1; if (!PyObject_GetAttrString) ! return 1; g_Py_BuildValue = Py_BuildValue; *************** *** 560,568 **** if (pathname == NULL || pathname[0] == '\0') ! return 0x80000000; fp = fopen(pathname, "r"); if (!fp) { ! return 0x80000000; } --- 584,593 ---- if (pathname == NULL || pathname[0] == '\0') ! return 2; fp = fopen(pathname, "r"); if (!fp) { ! fprintf(stderr, "Could not open postinstall-script %s\n", pathname); ! return 3; } *************** *** 1648,1654 **** hPython = LoadLibrary(pythondll); if (hPython) { ! if (0x80000000 == run_installscript(hPython, fname, 2, argv)) ! fprintf(stderr, "*** Could not load Python ***"); FreeLibrary(hPython); } fflush(stderr); --- 1673,1684 ---- hPython = LoadLibrary(pythondll); if (hPython) { ! int result; ! result = run_installscript(hPython, fname, 2, argv); ! if (result) { ! fprintf(stderr, "*** run_installscript: internal error 0x%X ***\n", result); ! } FreeLibrary(hPython); + } else { + fprintf(stderr, "*** Could not load Python ***"); } fflush(stderr); From theller@users.sourceforge.net Tue Nov 5 10:03:30 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 05 Nov 2002 02:03:30 -0800 Subject: [Python-checkins] distutils/misc wininst.exe,1.16,1.17 Message-ID: Update of /cvsroot/python/distutils/misc In directory usw-pr-cvs1:/tmp/cvs-serv11231/misc Modified Files: wininst.exe Log Message: Recompiled after source changes: Fixed the error handling of the run_installscript function. Index: wininst.exe =================================================================== RCS file: /cvsroot/python/distutils/misc/wininst.exe,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 Binary files /tmp/cvsh5JI4J and /tmp/cvsAATfTj differ From theller@users.sourceforge.net Tue Nov 5 10:06:22 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 05 Nov 2002 02:06:22 -0800 Subject: [Python-checkins] distutils/distutils/command bdist_wininst.py,1.38,1.39 Message-ID: Update of /cvsroot/python/distutils/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv12864/distutils/command Modified Files: bdist_wininst.py Log Message: Must now give the basename - not including directories - of the install-script on the command line. Recreated after recompilation of wininst.exe. Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/command/bdist_wininst.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** bdist_wininst.py 16 Oct 2002 17:51:38 -0000 1.38 --- bdist_wininst.py 5 Nov 2002 10:06:19 -0000 1.39 *************** *** 42,47 **** "skip rebuilding everything (for testing/debugging)"), ('install-script=', None, ! "installation script to be run after installation" ! " or before deinstallation"), ] --- 42,47 ---- "skip rebuilding everything (for testing/debugging)"), ('install-script=', None, ! "basename of installation script to be run after" ! "installation or before deinstallation"), ] *************** *** 79,87 **** self.set_undefined_options('bdist', ('dist_dir', 'dist_dir')) ! if self.install_script and \ ! self.install_script not in self.distribution.scripts: ! raise DistutilsOptionError, \ ! "install_script '%s' not found in scripts" % self.install_script ! # finalize_options() --- 79,90 ---- self.set_undefined_options('bdist', ('dist_dir', 'dist_dir')) ! if self.install_script: ! for script in self.distribution.scripts: ! if self.install_script == os.path.basename(script): ! break ! else: ! raise DistutilsOptionError, \ ! "install_script '%s' not found in scripts" % \ ! self.install_script # finalize_options() *************** *** 265,275 **** ZGUuDQ0KJAAAAAAAAAAtOHsRaVkVQmlZFUJpWRVCEkUZQmpZFUIGRh9CYlkVQupFG0JrWRVCBkYR QmtZFUJpWRVCZlkVQmlZFELjWRVCC0YGQmRZFUJveh9Ca1kVQq5fE0JoWRVCUmljaGlZFUIAAAAA ! AAAAAAAAAAAAAAAAUEUAAEwBAwCepq09AAAAAAAAAADgAA8BCwEGAABQAAAAEAAAALAAAIAGAQAA wAAAABABAAAAQAAAEAAAAAIAAAQAAAAAAAAABAAAAAAAAAAAIAEAAAQAAAAAAAACAAAAAAAQAAAQ AAAAABAAABAAAAAAAAAQAAAAAAAAAAAAAAAwEQEA5AEAAAAQAQAwAQAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ! AAAAAAAAAAAAAAAAAAAAAA== """ From mwh@users.sourceforge.net Tue Nov 5 15:28:53 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 05 Nov 2002 07:28:53 -0800 Subject: [Python-checkins] python/dist/src/Objects sliceobject.c,2.18,2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7435/Objects Modified Files: sliceobject.c Log Message: Some days, I think my comment of /* this is harder to get right than you might think */ angered some God somewhere. After noticing >>> range(5000000)[slice(96360, None, 439)] [] I found that my cute test for the slice being empty failed due to overflow. Fixed, and added simple test (not the above!). Index: sliceobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/sliceobject.c,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** sliceobject.c 12 Sep 2002 09:31:30 -0000 2.18 --- sliceobject.c 5 Nov 2002 15:28:51 -0000 2.19 *************** *** 115,123 **** { /* this is harder to get right than you might think */ int defstart, defstop; if (r->step == Py_None) { *step = 1; ! } else { *step = PyInt_AsLong(r->step); if (*step == -1 && PyErr_Occurred()) { --- 115,125 ---- { /* this is harder to get right than you might think */ + int defstart, defstop; if (r->step == Py_None) { *step = 1; ! } ! else { *step = PyInt_AsLong(r->step); if (*step == -1 && PyErr_Occurred()) { *************** *** 136,140 **** if (r->start == Py_None) { *start = defstart; ! } else { if (!_PyEval_SliceIndex(r->start, start)) return -1; if (*start < 0) *start += length; --- 138,143 ---- if (r->start == Py_None) { *start = defstart; ! } ! else { if (!_PyEval_SliceIndex(r->start, start)) return -1; if (*start < 0) *start += length; *************** *** 146,150 **** if (r->stop == Py_None) { *stop = defstop; ! } else { if (!_PyEval_SliceIndex(r->stop, stop)) return -1; if (*stop < 0) *stop += length; --- 149,154 ---- if (r->stop == Py_None) { *stop = defstop; ! } ! else { if (!_PyEval_SliceIndex(r->stop, stop)) return -1; if (*stop < 0) *stop += length; *************** *** 152,162 **** if (*stop > length) *stop = length; } ! ! if ((*stop - *start)*(*step) <= 0) { *slicelength = 0; } else if (*step < 0) { *slicelength = (*stop-*start+1)/(*step)+1; ! } else { *slicelength = (*stop-*start-1)/(*step)+1; } --- 156,168 ---- if (*stop > length) *stop = length; } ! ! if ((*step < 0 && *stop >= *start) ! || (*step > 0 && *start >= *stop)) { *slicelength = 0; } else if (*step < 0) { *slicelength = (*stop-*start+1)/(*step)+1; ! } ! else { *slicelength = (*stop-*start-1)/(*step)+1; } From mwh@users.sourceforge.net Tue Nov 5 15:28:53 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 05 Nov 2002 07:28:53 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_slice.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7435/Lib/test Modified Files: test_slice.py Log Message: Some days, I think my comment of /* this is harder to get right than you might think */ angered some God somewhere. After noticing >>> range(5000000)[slice(96360, None, 439)] [] I found that my cute test for the slice being empty failed due to overflow. Fixed, and added simple test (not the above!). Index: test_slice.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_slice.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_slice.py 8 Aug 2002 20:19:19 -0000 1.3 --- test_slice.py 5 Nov 2002 15:28:50 -0000 1.4 *************** *** 2,5 **** --- 2,6 ---- from test.test_support import vereq + import sys vereq(slice(None ).indices(10), (0, 10, 1)) *************** *** 12,13 **** --- 13,16 ---- vereq(slice(100, -100, -1).indices(10), slice(None, None, -1).indices(10)) vereq(slice(-100L, 100L, 2L).indices(10), (0, 10, 2)) + + vereq(range(10)[::sys.maxint - 1], [0]) From niemeyer@users.sourceforge.net Tue Nov 5 16:12:07 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Tue, 05 Nov 2002 08:12:07 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command build_ext.py,1.87,1.88 config.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv27486/command Modified Files: build_ext.py config.py Log Message: This patch fixes the following bugs: [#413582] g++ must be called for c++ extensions [#454030] distutils cannot link C++ code with GCC topdir = "Lib/distutils" * bcppcompiler.py (BCPPCompiler.create_static_lib): Fixed prototype, removing extra_preargs and extra_postargs parameters. Included target_lang parameter. (BCPPCompiler.link): Included target_lang parameter. * msvccompiler.py (MSVCCompiler.create_static_lib): Fixed prototype, removing extra_preargs and extra_postargs parameters. Included target_lang parameter. (MSVCCompiler.link): Included target_lang parameter. * ccompiler.py (CCompiler): New language_map and language_order attributes, used by CCompiler.detect_language(). (CCompiler.detect_language): New method, will return the language of a given source, or list of sources. Individual source language is detected using the language_map dict. When mixed sources are used, language_order will stablish the language precedence. (CCompiler.create_static_lib, CCompiler.link, CCompiler.link_executable, CCompiler.link_shared_object, CCompiler.link_shared_lib): Inlcuded target_lang parameter. * cygwinccompiler.py (CygwinCCompiler.link): Included target_lang parameter. * emxccompiler.py (EMXCCompiler.link): Included target_lang parameter. * mwerkscompiler.py (MWerksCompiler.link): Included target_lang parameter. * extension.py (Extension.__init__): New 'language' parameter/attribute, initialized to None by default. If provided will overlap the automatic detection made by CCompiler.detect_language(), in build_ext command. * sysconfig.py (customize_compiler): Check Makefile for CXX option, and also the environment variable CXX. Use the resulting value in the 'compiler_cxx' parameter of compiler.set_executables(). * unixccompiler.py (UnixCCompiler): Included 'compiler_cxx' in executables dict, defaulting to 'cc'. (UnixCCompiler.create_static_lib): Included target_lang parameter. (UnixCCompiler.link): Included target_lang parameter, and made linker command use compiler_cxx, if target_lang is 'c++'. * command/build_ext.py (build_ext.build_extension): Pass new ext.language attribute to compiler.link_shared_object()'s target_lang parameter. If ext.language is not provided, detect language using compiler.detect_language(sources) instead. * command/config.py (config._link): Pass already available lang parameter as target_lang parameter of compiler.link_executable(). Index: build_ext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_ext.py,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** build_ext.py 4 Nov 2002 19:50:03 -0000 1.87 --- build_ext.py 5 Nov 2002 16:12:01 -0000 1.88 *************** *** 478,481 **** --- 478,484 ---- extra_args = ext.extra_link_args or [] + # Detect target language, if not provided + language = ext.language or self.compiler.detect_language(sources) + self.compiler.link_shared_object( objects, ext_filename, *************** *** 486,490 **** export_symbols=self.get_export_symbols(ext), debug=self.debug, ! build_temp=self.build_temp) --- 489,494 ---- export_symbols=self.get_export_symbols(ext), debug=self.debug, ! build_temp=self.build_temp, ! target_lang=language) Index: config.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/config.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** config.py 9 Sep 2002 12:10:00 -0000 1.12 --- config.py 5 Nov 2002 16:12:02 -0000 1.13 *************** *** 149,153 **** self.compiler.link_executable([obj], prog, libraries=libraries, ! library_dirs=library_dirs) prog = prog + self.compiler.exe_extension --- 149,154 ---- self.compiler.link_executable([obj], prog, libraries=libraries, ! library_dirs=library_dirs, ! target_lang=lang) prog = prog + self.compiler.exe_extension From niemeyer@users.sourceforge.net Tue Nov 5 16:12:37 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Tue, 05 Nov 2002 08:12:37 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils bcppcompiler.py,1.13,1.14 ccompiler.py,1.49,1.50 cygwinccompiler.py,1.18,1.19 emxccompiler.py,1.8,1.9 extension.py,1.12,1.13 msvccompiler.py,1.49,1.50 mwerkscompiler.py,1.10,1.11 sysconfig.py,1.51,1.52 unixccompiler.py,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv27486 Modified Files: bcppcompiler.py ccompiler.py cygwinccompiler.py emxccompiler.py extension.py msvccompiler.py mwerkscompiler.py sysconfig.py unixccompiler.py Log Message: This patch fixes the following bugs: [#413582] g++ must be called for c++ extensions [#454030] distutils cannot link C++ code with GCC topdir = "Lib/distutils" * bcppcompiler.py (BCPPCompiler.create_static_lib): Fixed prototype, removing extra_preargs and extra_postargs parameters. Included target_lang parameter. (BCPPCompiler.link): Included target_lang parameter. * msvccompiler.py (MSVCCompiler.create_static_lib): Fixed prototype, removing extra_preargs and extra_postargs parameters. Included target_lang parameter. (MSVCCompiler.link): Included target_lang parameter. * ccompiler.py (CCompiler): New language_map and language_order attributes, used by CCompiler.detect_language(). (CCompiler.detect_language): New method, will return the language of a given source, or list of sources. Individual source language is detected using the language_map dict. When mixed sources are used, language_order will stablish the language precedence. (CCompiler.create_static_lib, CCompiler.link, CCompiler.link_executable, CCompiler.link_shared_object, CCompiler.link_shared_lib): Inlcuded target_lang parameter. * cygwinccompiler.py (CygwinCCompiler.link): Included target_lang parameter. * emxccompiler.py (EMXCCompiler.link): Included target_lang parameter. * mwerkscompiler.py (MWerksCompiler.link): Included target_lang parameter. * extension.py (Extension.__init__): New 'language' parameter/attribute, initialized to None by default. If provided will overlap the automatic detection made by CCompiler.detect_language(), in build_ext command. * sysconfig.py (customize_compiler): Check Makefile for CXX option, and also the environment variable CXX. Use the resulting value in the 'compiler_cxx' parameter of compiler.set_executables(). * unixccompiler.py (UnixCCompiler): Included 'compiler_cxx' in executables dict, defaulting to 'cc'. (UnixCCompiler.create_static_lib): Included target_lang parameter. (UnixCCompiler.link): Included target_lang parameter, and made linker command use compiler_cxx, if target_lang is 'c++'. * command/build_ext.py (build_ext.build_extension): Pass new ext.language attribute to compiler.link_shared_object()'s target_lang parameter. If ext.language is not provided, detect language using compiler.detect_language(sources) instead. * command/config.py (config._link): Pass already available lang parameter as target_lang parameter of compiler.link_executable(). Index: bcppcompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/bcppcompiler.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** bcppcompiler.py 13 Jun 2002 17:28:18 -0000 1.13 --- bcppcompiler.py 5 Nov 2002 16:11:52 -0000 1.14 *************** *** 147,152 **** output_dir=None, debug=0, ! extra_preargs=None, ! extra_postargs=None): (objects, output_dir) = self._fix_object_args (objects, output_dir) --- 147,151 ---- output_dir=None, debug=0, ! target_lang=None): (objects, output_dir) = self._fix_object_args (objects, output_dir) *************** *** 158,165 **** if debug: pass # XXX what goes here? - if extra_preargs: - lib_args[:0] = extra_preargs - if extra_postargs: - lib_args.extend (extra_postargs) try: self.spawn ([self.lib] + lib_args) --- 157,160 ---- *************** *** 184,188 **** extra_preargs=None, extra_postargs=None, ! build_temp=None): # XXX this ignores 'build_temp'! should follow the lead of --- 179,184 ---- extra_preargs=None, extra_postargs=None, ! build_temp=None, ! target_lang=None): # XXX this ignores 'build_temp'! should follow the lead of Index: ccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/ccompiler.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** ccompiler.py 1 Oct 2002 17:39:59 -0000 1.49 --- ccompiler.py 5 Nov 2002 16:11:53 -0000 1.50 *************** *** 75,78 **** --- 75,91 ---- exe_extension = None # string + # Default language settings. language_map is used to detect a source + # file or Extension target language, checking source filenames. + # language_order is used to detect the language precedence, when deciding + # what language to use when mixing source types. For example, if some + # extension has two files with ".c" extension, and one with ".cpp", it + # is still linked as c++. + language_map = {".c" : "c", + ".cc" : "c++", + ".cpp" : "c++", + ".cxx" : "c++", + ".m" : "objc", + } + language_order = ["c++", "objc", "c"] def __init__ (self, *************** *** 573,576 **** --- 586,610 ---- # _need_link () + def detect_language (self, sources): + """Detect the language of a given file, or list of files. Uses + language_map, and language_order to do the job. + """ + if type(sources) is not ListType: + sources = [sources] + lang = None + index = len(self.language_order) + for source in sources: + base, ext = os.path.splitext(source) + extlang = self.language_map.get(ext) + try: + extindex = self.language_order.index(extlang) + if extindex < index: + lang = extlang + index = extindex + except ValueError: + pass + return lang + + # detect_language () # -- Worker methods ------------------------------------------------ *************** *** 672,676 **** output_libname, output_dir=None, ! debug=0): """Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied --- 706,711 ---- output_libname, output_dir=None, ! debug=0, ! target_lang=None): """Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied *************** *** 689,692 **** --- 724,731 ---- just for consistency). + 'target_lang' is the target language for which the given objects + are being compiled. This allows specific linkage time treatment of + certain languages. + Raises LibError on failure. """ *************** *** 711,715 **** extra_preargs=None, extra_postargs=None, ! build_temp=None): """Link a bunch of stuff together to create an executable or shared library file. --- 750,755 ---- extra_preargs=None, extra_postargs=None, ! build_temp=None, ! target_lang=None): """Link a bunch of stuff together to create an executable or shared library file. *************** *** 749,752 **** --- 789,796 ---- particular linker being used). + 'target_lang' is the target language for which the given objects + are being compiled. This allows specific linkage time treatment of + certain languages. + Raises LinkError on failure. """ *************** *** 767,771 **** extra_preargs=None, extra_postargs=None, ! build_temp=None): self.link(CCompiler.SHARED_LIBRARY, objects, self.library_filename(output_libname, lib_type='shared'), --- 811,816 ---- extra_preargs=None, extra_postargs=None, ! build_temp=None, ! target_lang=None): self.link(CCompiler.SHARED_LIBRARY, objects, self.library_filename(output_libname, lib_type='shared'), *************** *** 773,777 **** libraries, library_dirs, runtime_library_dirs, export_symbols, debug, ! extra_preargs, extra_postargs, build_temp) --- 818,822 ---- libraries, library_dirs, runtime_library_dirs, export_symbols, debug, ! extra_preargs, extra_postargs, build_temp, target_lang) *************** *** 787,796 **** extra_preargs=None, extra_postargs=None, ! build_temp=None): self.link(CCompiler.SHARED_OBJECT, objects, output_filename, output_dir, libraries, library_dirs, runtime_library_dirs, export_symbols, debug, ! extra_preargs, extra_postargs, build_temp) --- 832,842 ---- extra_preargs=None, extra_postargs=None, ! build_temp=None, ! target_lang=None): self.link(CCompiler.SHARED_OBJECT, objects, output_filename, output_dir, libraries, library_dirs, runtime_library_dirs, export_symbols, debug, ! extra_preargs, extra_postargs, build_temp, target_lang) *************** *** 804,812 **** debug=0, extra_preargs=None, ! extra_postargs=None): self.link(CCompiler.EXECUTABLE, objects, self.executable_filename(output_progname), output_dir, libraries, library_dirs, runtime_library_dirs, None, ! debug, extra_preargs, extra_postargs, None) --- 850,859 ---- debug=0, extra_preargs=None, ! extra_postargs=None, ! target_lang=None): self.link(CCompiler.EXECUTABLE, objects, self.executable_filename(output_progname), output_dir, libraries, library_dirs, runtime_library_dirs, None, ! debug, extra_preargs, extra_postargs, None, target_lang) Index: cygwinccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cygwinccompiler.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** cygwinccompiler.py 18 Jun 2002 18:48:55 -0000 1.18 --- cygwinccompiler.py 5 Nov 2002 16:11:54 -0000 1.19 *************** *** 141,145 **** extra_preargs=None, extra_postargs=None, ! build_temp=None): # use separate copies, so we can modify the lists --- 141,146 ---- extra_preargs=None, extra_postargs=None, ! build_temp=None, ! target_lang=None): # use separate copies, so we can modify the lists *************** *** 219,223 **** extra_preargs, extra_postargs, ! build_temp) # link () --- 220,225 ---- extra_preargs, extra_postargs, ! build_temp, ! target_lang) # link () Index: emxccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/emxccompiler.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** emxccompiler.py 29 Sep 2002 00:25:51 -0000 1.8 --- emxccompiler.py 5 Nov 2002 16:11:54 -0000 1.9 *************** *** 103,107 **** extra_preargs=None, extra_postargs=None, ! build_temp=None): # use separate copies, so we can modify the lists --- 103,108 ---- extra_preargs=None, extra_postargs=None, ! build_temp=None, ! target_lang=None): # use separate copies, so we can modify the lists *************** *** 172,176 **** extra_preargs, extra_postargs, ! build_temp) # link () --- 173,178 ---- extra_preargs, extra_postargs, ! build_temp, ! target_lang) # link () Index: extension.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/extension.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** extension.py 12 Jun 2002 20:08:56 -0000 1.12 --- extension.py 5 Nov 2002 16:11:56 -0000 1.13 *************** *** 76,79 **** --- 76,82 ---- depends : [string] list of files that the extension depends on + language : string + extension language (i.e. "c", "c++", "objc"). Will be detected + from the source extensions if not provided. """ *************** *** 90,93 **** --- 93,97 ---- export_symbols=None, depends=None, + language=None, ): *************** *** 110,113 **** --- 114,118 ---- self.export_symbols = export_symbols or [] self.depends = depends or [] + self.language = language # class Extension Index: msvccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/msvccompiler.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** msvccompiler.py 18 Jun 2002 19:08:40 -0000 1.49 --- msvccompiler.py 5 Nov 2002 16:11:56 -0000 1.50 *************** *** 368,373 **** output_dir=None, debug=0, ! extra_preargs=None, ! extra_postargs=None): (objects, output_dir) = self._fix_object_args (objects, output_dir) --- 368,372 ---- output_dir=None, debug=0, ! target_lang=None): (objects, output_dir) = self._fix_object_args (objects, output_dir) *************** *** 379,386 **** if debug: pass # XXX what goes here? - if extra_preargs: - lib_args[:0] = extra_preargs - if extra_postargs: - lib_args.extend (extra_postargs) try: self.spawn ([self.lib] + lib_args) --- 378,381 ---- *************** *** 405,409 **** extra_preargs=None, extra_postargs=None, ! build_temp=None): (objects, output_dir) = self._fix_object_args (objects, output_dir) --- 400,405 ---- extra_preargs=None, extra_postargs=None, ! build_temp=None, ! target_lang=None): (objects, output_dir) = self._fix_object_args (objects, output_dir) Index: mwerkscompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/mwerkscompiler.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mwerkscompiler.py 27 Jun 2002 22:10:19 -0000 1.10 --- mwerkscompiler.py 5 Nov 2002 16:11:57 -0000 1.11 *************** *** 85,89 **** extra_preargs=None, extra_postargs=None, ! build_temp=None): # First fixup. (objects, output_dir) = self._fix_object_args (objects, output_dir) --- 85,90 ---- extra_preargs=None, extra_postargs=None, ! build_temp=None, ! target_lang=None): # First fixup. (objects, output_dir) = self._fix_object_args (objects, output_dir) Index: sysconfig.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/sysconfig.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** sysconfig.py 4 Nov 2002 19:53:24 -0000 1.51 --- sysconfig.py 5 Nov 2002 16:11:59 -0000 1.52 *************** *** 140,148 **** """ if compiler.compiler_type == "unix": ! (cc, opt, ccshared, ldshared, so_ext) = \ ! get_config_vars('CC', 'OPT', 'CCSHARED', 'LDSHARED', 'SO') if os.environ.has_key('CC'): cc = os.environ['CC'] if os.environ.has_key('CPP'): cpp = os.environ['CPP'] --- 140,150 ---- """ if compiler.compiler_type == "unix": ! (cc, cxx, opt, ccshared, ldshared, so_ext) = \ ! get_config_vars('CC', 'CXX', 'OPT', 'CCSHARED', 'LDSHARED', 'SO') if os.environ.has_key('CC'): cc = os.environ['CC'] + if os.environ.has_key('CXX'): + cxx = os.environ['CXX'] if os.environ.has_key('CPP'): cpp = os.environ['CPP'] *************** *** 164,167 **** --- 166,170 ---- compiler=cc_cmd, compiler_so=cc_cmd + ' ' + ccshared, + compiler_cxx=cxx, linker_so=ldshared, linker_exe=cc) Index: unixccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/unixccompiler.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** unixccompiler.py 9 Oct 2002 21:37:18 -0000 1.48 --- unixccompiler.py 5 Nov 2002 16:11:59 -0000 1.49 *************** *** 58,61 **** --- 58,62 ---- 'compiler' : ["cc"], 'compiler_so' : ["cc"], + 'compiler_cxx' : ["cc"], 'linker_so' : ["cc", "-shared"], 'linker_exe' : ["cc"], *************** *** 115,119 **** def create_static_lib(self, objects, output_libname, ! output_dir=None, debug=0): objects, output_dir = self._fix_object_args(objects, output_dir) --- 116,120 ---- def create_static_lib(self, objects, output_libname, ! output_dir=None, debug=0, target_lang=None): objects, output_dir = self._fix_object_args(objects, output_dir) *************** *** 144,148 **** library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, ! extra_postargs=None, build_temp=None): objects, output_dir = self._fix_object_args(objects, output_dir) libraries, library_dirs, runtime_library_dirs = \ --- 145,149 ---- library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, ! extra_postargs=None, build_temp=None, target_lang=None): objects, output_dir = self._fix_object_args(objects, output_dir) libraries, library_dirs, runtime_library_dirs = \ *************** *** 168,174 **** try: if target_desc == CCompiler.EXECUTABLE: ! self.spawn(self.linker_exe + ld_args) else: ! self.spawn(self.linker_so + ld_args) except DistutilsExecError, msg: raise LinkError, msg --- 169,178 ---- try: if target_desc == CCompiler.EXECUTABLE: ! linker = self.linker_exe[:] else: ! linker = self.linker_so[:] ! if target_lang == "c++" and self.compiler_cxx: ! linker[0] = self.compiler_cxx[0] ! self.spawn(linker + ld_args) except DistutilsExecError, msg: raise LinkError, msg From niemeyer@users.sourceforge.net Tue Nov 5 16:50:06 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Tue, 05 Nov 2002 08:50:06 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.112,1.113 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv13902 Modified Files: setup.py Log Message: Patch implementing bz2 module. * setup.py (PyBuildExt.detect_modules): Included bz2 module detection. * Modules/bz2module.c * Lib/test/test_bz2.py * Doc/lib/libbz2.tex Included files implementing, testing, and documenting bz2 module. * Doc/Makefile.deps * Doc/lib/lib.tex Include references to libbz2.tex. * Misc/NEWS (Library): Mention distutils' c++ linkage patch, and new bz2 module. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** setup.py 14 Oct 2002 20:48:09 -0000 1.112 --- setup.py 5 Nov 2002 16:50:04 -0000 1.113 *************** *** 703,706 **** --- 703,711 ---- libraries = ['z']) ) + # Gustavo Niemeyer's bz2 module. + if (self.compiler.find_library_file(lib_dirs, 'bz2')): + exts.append( Extension('bz2', ['bz2module.c'], + libraries = ['bz2']) ) + # Interface to the Expat XML parser # From niemeyer@users.sourceforge.net Tue Nov 5 16:50:06 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Tue, 05 Nov 2002 08:50:06 -0800 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.89,1.90 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv13902/Doc Modified Files: Makefile.deps Log Message: Patch implementing bz2 module. * setup.py (PyBuildExt.detect_modules): Included bz2 module detection. * Modules/bz2module.c * Lib/test/test_bz2.py * Doc/lib/libbz2.tex Included files implementing, testing, and documenting bz2 module. * Doc/Makefile.deps * Doc/lib/lib.tex Include references to libbz2.tex. * Misc/NEWS (Library): Mention distutils' c++ linkage patch, and new bz2 module. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** Makefile.deps 23 Aug 2002 15:38:02 -0000 1.89 --- Makefile.deps 5 Nov 2002 16:50:04 -0000 1.90 *************** *** 228,231 **** --- 228,232 ---- lib/libcmath.tex \ lib/libgzip.tex \ + lib/libbz2.tex \ lib/libzipfile.tex \ lib/libpprint.tex \ From niemeyer@users.sourceforge.net Tue Nov 5 16:50:07 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Tue, 05 Nov 2002 08:50:07 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libbz2.tex,NONE,1.1 lib.tex,1.204,1.205 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv13902/Doc/lib Modified Files: lib.tex Added Files: libbz2.tex Log Message: Patch implementing bz2 module. * setup.py (PyBuildExt.detect_modules): Included bz2 module detection. * Modules/bz2module.c * Lib/test/test_bz2.py * Doc/lib/libbz2.tex Included files implementing, testing, and documenting bz2 module. * Doc/Makefile.deps * Doc/lib/lib.tex Include references to libbz2.tex. * Misc/NEWS (Library): Mention distutils' c++ linkage patch, and new bz2 module. --- NEW FILE: libbz2.tex --- \section{\module{bz2} --- Compression compatible with \program{bzip2}} \declaremodule{builtin}{bz2} \modulesynopsis{Interface to compression and decompression routines compatible with \program{bzip2}.} \moduleauthor{Gustavo Niemeyer}{niemeyer@conectiva.com} \sectionauthor{Gustavo Niemeyer}{niemeyer@conectiva.com} \versionadded{2.3} This module provides a comprehensive interface for the bz2 compression library. It implements a complete file interface, one-shot (de)compression functions, and types for sequential (de)compression. Here is a resume of the features offered by the bz2 module: \begin{itemize} \item \class{BZ2File} class implements a complete file interface, including \method{readline()}, \method{readlines()}, \method{xreadlines()}, \method{writelines()}, \method{seek()}, etc; \item \class{BZ2File} class implements emulated \method{seek()} support; \item \class{BZ2File} class implements universal newline support; \item \class{BZ2File} class offers an optimized line iteration using the readahead algorithm borrowed from file objects; \item \class{BZ2File} class developed inheriting builtin file type (\code{isinstance(BZ2File(), file) == 1}); \item Sequential (de)compression supported by \class{BZ2Compressor} and \class{BZ2Decompressor} classes; \item One-shot (de)compression supported by \function{compress()} and \function{decompress()} functions; \item Thread safety uses individual locking mechanism; \item Complete inline documentation; \end{itemize} \subsection{(De)compression of files} Handling of compressed files is offered by the \class{BZ2File} class. \begin{classdesc}{BZ2File}{filename \optional{, mode='r'\optional{, buffering=0\optional{, compresslevel=9}}}} Open a bz2 file. Mode can be either \code{'r'} or \code{'w'}, for reading (default) or writing. When opened for writing, the file will be created if it doesn't exist, and truncated otherwise. If the buffering argument is given, \code{0} means unbuffered, and larger numbers specify the buffer size. If compresslevel is given, must be a number between \code{1} and \code{9}. Add a \code{'U'} to mode to open the file for input with universal newline support. Any line ending in the input file will be seen as a \code{'\textbackslash n'} in Python. Also, a file so opened gains the attribute \member{newlines}; the value for this attribute is one of \code{None} (no newline read yet), \code{'\textbackslash r'}, \code{'\textbackslash n'}, \code{'\textbackslash r\textbackslash n'} or a tuple containing all the newline types seen. Universal newlines are available only when reading. \end{classdesc} \begin{methoddesc}[BZ2File]{close}{} Close the file. Sets data attribute \member{closed} to true. A closed file cannot be used for further I/O operations. \method{close()} may be called more than once without error. \end{methoddesc} \begin{methoddesc}[BZ2File]{read}{\optional{size}} Read at most \var{size} uncompressed bytes, returned as a string. If the \var{size} argument is negative or omitted, read until EOF is reached. \end{methoddesc} \begin{methoddesc}[BZ2File]{readline}{\optional{size}} Return the next line from the file, as a string, retaining newline. A non-negative \var{size} argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty string at EOF. \end{methoddesc} \begin{methoddesc}[BZ2File]{readlines}{\optional{size}} Return a list of lines read. The optional \var{size} argument, if given, is an approximate bound on the total number of bytes in the lines returned. \end{methoddesc} \begin{methoddesc}[BZ2File]{xreadlines}{} For backward compatibility. \class{BZ2File} objects now include the performance optimizations previously implemented in the \module{xreadlines} module. \end{methoddesc} \begin{methoddesc}[BZ2File]{\_\_iter\_\_}{} Iterate trough the file lines. Iteration optimization is implemented using the same readahead algorithm available in \class{file} objects. \end{methoddesc} \begin{methoddesc}[BZ2File]{seek}{offset \optional{, whence}} Move to new file position. Argument \var{offset} is a byte count. Optional argument \var{whence} defaults to \code{0} (offset from start of file, offset should be \code{>= 0}); other values are \code{1} (move relative to current position, positive or negative), and \code{2} (move relative to end of file, usually negative, although many platforms allow seeking beyond the end of a file). Note that seeking of bz2 files is emulated, and depending on the parameters the operation may be extremely slow. \end{methoddesc} \begin{methoddesc}[BZ2File]{tell}{} Return the current file position, an integer (may be a long integer). \end{methoddesc} \begin{methoddesc}[BZ2File]{write}{data} Write string \var{data} to file. Note that due to buffering, \method{close()} may be needed before the file on disk reflects the data written. \end{methoddesc} \begin{methoddesc}[BZ2File]{writelines}{sequence_of_strings} Write the sequence of strings to the file. Note that newlines are not added. The sequence can be any iterable object producing strings. This is equivalent to calling write() for each string. \end{methoddesc} \subsection{Sequential (de)compression} Sequential compression and decompression is done using the classes \class{BZ2Compressor} and \class{BZ2Decompressor}. \begin{classdesc}{BZ2Compressor}{\optional{compresslevel=9}} Create a new compressor object. This object may be used to compress data sequentially. If you want to compress data in one shot, use the \function{compress()} function instead. The \var{compresslevel} parameter, if given, must be a number between \code{1} and \code{9}. \end{classdesc} \begin{methoddesc}[BZ2Compressor]{compress}{data} Provide more data to the compressor object. It will return chunks of compressed data whenever possible. When you've finished providing data to compress, call the \method{flush()} method to finish the compression process, and return what is left in internal buffers. \end{methoddesc} \begin{methoddesc}[BZ2Compressor]{flush}{} Finish the compression process and return what is left in internal buffers. You must not use the compressor object after calling this method. \end{methoddesc} \begin{classdesc}{BZ2Decompressor}{} Create a new decompressor object. This object may be used to decompress data sequentially. If you want to decompress data in one shot, use the \function{decompress()} function instead. \end{classdesc} \begin{methoddesc}[BZ2Decompressor]{decompress}{data} Provide more data to the decompressor object. It will return chunks of decompressed data whenever possible. If you try to decompress data after the end of stream is found, \exception{EOFError} will be raised. If any data was found after the end of stream, it'll be ignored and saved in \member{unused\_data} attribute. \end{methoddesc} \subsection{One-shot (de)compression} One-shot compression and decompression is provided trough the \function{compress()} and \function{decompress()} functions. \begin{funcdesc}{compress}{data\optional{, compresslevel=9}} Compress \var{data} in one shot. If you want to compress data sequentially, use an instance of \class{BZ2Compressor} instead. The \var{compresslevel} parameter, if given, must be a number between \code{1} and \code{9}. \end{funcdesc} \begin{funcdesc}{decompress}{} Decompress \var{data} in one shot. If you want to decompress data sequentially, use an instance of \class{BZ2Decompressor} instead. \end{funcdesc} Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.204 retrieving revision 1.205 diff -C2 -d -r1.204 -r1.205 *** lib.tex 23 Aug 2002 15:18:37 -0000 1.204 --- lib.tex 5 Nov 2002 16:50:04 -0000 1.205 *************** *** 170,173 **** --- 170,174 ---- \input{libzlib} \input{libgzip} + \input{libbz2} \input{libzipfile} \input{libreadline} From niemeyer@users.sourceforge.net Tue Nov 5 16:50:07 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Tue, 05 Nov 2002 08:50:07 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.508,1.509 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv13902/Misc Modified Files: NEWS Log Message: Patch implementing bz2 module. * setup.py (PyBuildExt.detect_modules): Included bz2 module detection. * Modules/bz2module.c * Lib/test/test_bz2.py * Doc/lib/libbz2.tex Included files implementing, testing, and documenting bz2 module. * Doc/Makefile.deps * Doc/lib/lib.tex Include references to libbz2.tex. * Misc/NEWS (Library): Mention distutils' c++ linkage patch, and new bz2 module. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.508 retrieving revision 1.509 diff -C2 -d -r1.508 -r1.509 *** NEWS 4 Nov 2002 19:50:11 -0000 1.508 --- NEWS 5 Nov 2002 16:50:05 -0000 1.509 *************** *** 535,538 **** --- 535,546 ---- honored. + - distutils' build_ext command now links c++ extensions with the c++ + compiler available in the Makefile or CXX environment variable, if + running under *nix. + + - New module bz2: provides a comprehensive interface for the bz2 compression + library. It implements a complete file interface, one-shot (de)compression + functions, and types for sequential (de)compression. + Tools/Demos ----------- From niemeyer@users.sourceforge.net Tue Nov 5 16:50:07 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Tue, 05 Nov 2002 08:50:07 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_bz2.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13902/Lib/test Added Files: test_bz2.py Log Message: Patch implementing bz2 module. * setup.py (PyBuildExt.detect_modules): Included bz2 module detection. * Modules/bz2module.c * Lib/test/test_bz2.py * Doc/lib/libbz2.tex Included files implementing, testing, and documenting bz2 module. * Doc/Makefile.deps * Doc/lib/lib.tex Include references to libbz2.tex. * Misc/NEWS (Library): Mention distutils' c++ linkage patch, and new bz2 module. --- NEW FILE: test_bz2.py --- #!/usr/bin/python import unittest from cStringIO import StringIO import os import popen2 import tempfile from bz2 import * from test import test_support class BaseTest(unittest.TestCase): "Base for other testcases." TEXT = 'root:x:0:0:root:/root:/bin/bash\nbin:x:1:1:bin:/bin:\ndaemon:x:2:2:daemon:/sbin:\nadm:x:3:4:adm:/var/adm:\nlp:x:4:7:lp:/var/spool/lpd:\nsync:x:5:0:sync:/sbin:/bin/sync\nshutdown:x:6:0:shutdown:/sbin:/sbin/shutdown\nhalt:x:7:0:halt:/sbin:/sbin/halt\nmail:x:8:12:mail:/var/spool/mail:\nnews:x:9:13:news:/var/spool/news:\nuucp:x:10:14:uucp:/var/spool/uucp:\noperator:x:11:0:operator:/root:\ngames:x:12:100:games:/usr/games:\ngopher:x:13:30:gopher:/usr/lib/gopher-data:\nftp:x:14:50:FTP User:/var/ftp:/bin/bash\nnobody:x:65534:65534:Nobody:/home:\npostfix:x:100:101:postfix:/var/spool/postfix:\nniemeyer:x:500:500::/home/niemeyer:/bin/bash\npostgres:x:101:102:PostgreSQL Server:/var/lib/pgsql:/bin/bash\nmysql:x:102:103:MySQL server:/var/lib/mysql:/bin/bash\nwww:x:103:104::/var/www:/bin/false\n' DATA = 'BZh91AY&SY.\xc8N\x18\x00\x01>_\x80\x00\x10@\x02\xff\xf0\x01\x07n\x00?\xe7\xff\xe00\x01\x99\xaa\x00\xc0\x03F\x86\x8c#&\x83F\x9a\x03\x06\xa6\xd0\xa6\x93M\x0fQ\xa7\xa8\x06\x804hh\x12$\x11\xa4i4\xf14S\xd2\x88\xe5\xcd9gd6\x0b\n\xe9\x9b\xd5\x8a\x99\xf7\x08.K\x8ev\xfb\xf7xw\xbb\xdf\xa1\x92\xf1\xdd|/";\xa2\xba\x9f\xd5\xb1#A\xb6\xf6\xb3o\xc9\xc5y\\\xebO\xe7\x85\x9a\xbc\xb6f8\x952\xd5\xd7"%\x89>V,\xf7\xa6z\xe2\x9f\xa3\xdf\x11\x11"\xd6E)I\xa9\x13^\xca\xf3r\xd0\x03U\x922\xf26\xec\xb6\xed\x8b\xc3U\x13\x9d\xc5\x170\xa4\xfa^\x92\xacDF\x8a\x97\xd6\x19\xfe\xdd\xb8\xbd\x1a\x9a\x19\xa3\x80ankR\x8b\xe5\xd83]\xa9\xc6\x08\x82f\xf6\xb9"6l$\xb8j@\xc0\x8a\xb0l1..\xbak\x83ls\x15\xbc\xf4\xc1\x13\xbe\xf8E\xb8\x9d\r\xa8\x9dk\x84\xd3n\xfa\xacQ\x07\xb1%y\xaav\xb4\x08\xe0z\x1b\x16\xf5\x04\xe9\xcc\xb9\x08z\x1en7.G\xfc]\xc9\x14\xe1B@\xbb!8`' DATA_CRLF = 'BZh91AY&SY\xaez\xbbN\x00\x01H\xdf\x80\x00\x12@\x02\xff\xf0\x01\x07n\x00?\xe7\xff\xe0@\x01\xbc\xc6`\x86*\x8d=M\xa9\x9a\x86\xd0L@\x0fI\xa6!\xa1\x13\xc8\x88jdi\x8d@\x03@\x1a\x1a\x0c\x0c\x83 \x00\xc4h2\x19\x01\x82D\x84e\t\xe8\x99\x89\x19\x1ah\x00\r\x1a\x11\xaf\x9b\x0fG\xf5(\x1b\x1f?\t\x12\xcf\xb5\xfc\x95E\x00ps\x89\x12^\xa4\xdd\xa2&\x05(\x87\x04\x98\x89u\xe40%\xb6\x19\'\x8c\xc4\x89\xca\x07\x0e\x1b!\x91UIFU%C\x994!DI\xd2\xfa\xf0\xf1N8W\xde\x13A\xf5\x9cr%?\x9f3;I45A\xd1\x8bT\xb1\xa4\xc7\x8d\x1a\\"\xad\xa1\xabyBg\x15\xb9l\x88\x88\x91k"\x94\xa4\xd4\x89\xae*\xa6\x0b\x10\x0c\xd6\xd4m\xe86\xec\xb5j\x8a\x86j\';\xca.\x01I\xf2\xaaJ\xe8\x88\x8cU+t3\xfb\x0c\n\xa33\x13r2\r\x16\xe0\xb3(\xbf\x1d\x83r\xe7M\xf0D\x1365\xd8\x88\xd3\xa4\x92\xcb2\x06\x04\\\xc1\xb0\xea//\xbek&\xd8\xe6+t\xe5\xa1\x13\xada\x16\xder5"w]\xa2i\xb7[\x97R \xe2IT\xcd;Z\x04dk4\xad\x8a\t\xd3\x81z\x10\xf1:^`\xab\x1f\xc5\xdc\x91N\x14$+\x9e\xae\xd3\x80' def decompress(self, data): pop = popen2.Popen3("bunzip2", capturestderr=1) pop.tochild.write(data) pop.tochild.close() ret = pop.fromchild.read() pop.fromchild.close() if pop.wait() != 0: ret = decompress(data) return ret class BZ2FileTest(BaseTest): "Test MCRYPT type miscelaneous methods." def setUp(self): self.filename = tempfile.mktemp("bz2") def tearDown(self): if os.path.isfile(self.filename): os.unlink(self.filename) def createTempFile(self, crlf=0): f = open(self.filename, "w") if crlf: data = self.DATA_CRLF else: data = self.DATA f.write(data) f.close() def testRead(self): "Test BZ2File.read()" self.createTempFile() bz2f = BZ2File(self.filename) self.assertEqual(bz2f.read(), self.TEXT) bz2f.close() def testReadChunk10(self): "Test BZ2File.read() in chunks of 10 bytes" self.createTempFile() bz2f = BZ2File(self.filename) text = '' while 1: str = bz2f.read(10) if not str: break text += str self.assertEqual(text, text) bz2f.close() def testRead100(self): "Test BZ2File.read(100)" self.createTempFile() bz2f = BZ2File(self.filename) self.assertEqual(bz2f.read(100), self.TEXT[:100]) bz2f.close() def testReadLine(self): "Test BZ2File.readline()" self.createTempFile() bz2f = BZ2File(self.filename) sio = StringIO(self.TEXT) for line in sio.readlines(): self.assertEqual(bz2f.readline(), line) bz2f.close() def testReadLines(self): "Test BZ2File.readlines()" self.createTempFile() bz2f = BZ2File(self.filename) sio = StringIO(self.TEXT) self.assertEqual(bz2f.readlines(), sio.readlines()) bz2f.close() def testIterator(self): "Test iter(BZ2File)" self.createTempFile() bz2f = BZ2File(self.filename) sio = StringIO(self.TEXT) self.assertEqual(list(iter(bz2f)), sio.readlines()) bz2f.close() def testXReadLines(self): "Test BZ2File.xreadlines()" self.createTempFile() bz2f = BZ2File(self.filename) sio = StringIO(self.TEXT) self.assertEqual(list(bz2f.xreadlines()), sio.readlines()) bz2f.close() def testUniversalNewlinesLF(self): "Test BZ2File.read() with universal newlines (\\n)" self.createTempFile() bz2f = BZ2File(self.filename, "rU") self.assertEqual(bz2f.read(), self.TEXT) self.assertEqual(bz2f.newlines, "\n") bz2f.close() def testUniversalNewlinesCRLF(self): "Test BZ2File.read() with universal newlines (\\r\\n)" self.createTempFile(crlf=1) bz2f = BZ2File(self.filename, "rU") self.assertEqual(bz2f.read(), self.TEXT) self.assertEqual(bz2f.newlines, "\r\n") bz2f.close() def testWrite(self): "Test BZ2File.write()" bz2f = BZ2File(self.filename, "w") bz2f.write(self.TEXT) bz2f.close() f = open(self.filename) self.assertEqual(self.decompress(f.read()), self.TEXT) f.close() def testWriteChunks10(self): "Test BZ2File.write() with chunks of 10 bytes" bz2f = BZ2File(self.filename, "w") n = 0 while 1: str = self.TEXT[n*10:(n+1)*10] if not str: break bz2f.write(str) n += 1 bz2f.close() f = open(self.filename) self.assertEqual(self.decompress(f.read()), self.TEXT) f.close() def testWriteLines(self): "Test BZ2File.writelines()" bz2f = BZ2File(self.filename, "w") sio = StringIO(self.TEXT) bz2f.writelines(sio.readlines()) bz2f.close() f = open(self.filename) self.assertEqual(self.decompress(f.read()), self.TEXT) f.close() def testSeekForward(self): "Test BZ2File.seek(150, 0)" self.createTempFile() bz2f = BZ2File(self.filename) bz2f.seek(150) self.assertEqual(bz2f.read(), self.TEXT[150:]) def testSeekBackwards(self): "Test BZ2File.seek(-150, 1)" self.createTempFile() bz2f = BZ2File(self.filename) bz2f.read(500) bz2f.seek(-150, 1) self.assertEqual(bz2f.read(), self.TEXT[500-150:]) def testSeekBackwardsFromEnd(self): "Test BZ2File.seek(-150, 2)" self.createTempFile() bz2f = BZ2File(self.filename) bz2f.seek(-150, 2) self.assertEqual(bz2f.read(), self.TEXT[len(self.TEXT)-150:]) def testSeekPostEnd(self): "Test BZ2File.seek(150000)" self.createTempFile() bz2f = BZ2File(self.filename) bz2f.seek(150000) self.assertEqual(bz2f.tell(), len(self.TEXT)) self.assertEqual(bz2f.read(), "") def testSeekPostEndTwice(self): "Test BZ2File.seek(150000) twice" self.createTempFile() bz2f = BZ2File(self.filename) bz2f.seek(150000) bz2f.seek(150000) self.assertEqual(bz2f.tell(), len(self.TEXT)) self.assertEqual(bz2f.read(), "") def testSeekPreStart(self): "Test BZ2File.seek(-150, 0)" self.createTempFile() bz2f = BZ2File(self.filename) bz2f.seek(-150) self.assertEqual(bz2f.tell(), 0) self.assertEqual(bz2f.read(), self.TEXT) class BZ2CompressorTest(BaseTest): def testCompress(self): "Test BZ2Compressor.compress()/flush()" bz2c = BZ2Compressor() data = bz2c.compress(self.TEXT) data += bz2c.flush() self.assertEqual(self.decompress(data), self.TEXT) def testCompressChunks10(self): "Test BZ2Compressor.compress()/flush() with chunks of 10 bytes" bz2c = BZ2Compressor() n = 0 data = '' while 1: str = self.TEXT[n*10:(n+1)*10] if not str: break data += bz2c.compress(str) n += 1 data += bz2c.flush() self.assertEqual(self.decompress(data), self.TEXT) class BZ2DecompressorTest(BaseTest): def testDecompress(self): "Test BZ2Decompressor.decompress()" bz2d = BZ2Decompressor() text = bz2d.decompress(self.DATA) self.assertEqual(text, self.TEXT) def testDecompressChunks10(self): "Test BZ2Decompressor.decompress() with chunks of 10 bytes" bz2d = BZ2Decompressor() text = '' n = 0 while 1: str = self.DATA[n*10:(n+1)*10] if not str: break text += bz2d.decompress(str) n += 1 self.assertEqual(text, self.TEXT) def testDecompressUnusedData(self): "Test BZ2Decompressor.decompress() with unused data" bz2d = BZ2Decompressor() unused_data = "this is unused data" text = bz2d.decompress(self.DATA+unused_data) self.assertEqual(text, self.TEXT) self.assertEqual(bz2d.unused_data, unused_data) def testEOFError(self): "Calling BZ2Decompressor.decompress() after EOS must raise EOFError" bz2d = BZ2Decompressor() text = bz2d.decompress(self.DATA) self.assertRaises(EOFError, bz2d.decompress, "anything") class FuncTest(BaseTest): "Test module functions" def testCompress(self): "Test compress() function" data = compress(self.TEXT) self.assertEqual(self.decompress(data), self.TEXT) def testDecompress(self): "Test decompress() function" text = decompress(self.DATA) self.assertEqual(text, self.TEXT) def testDecompressEmpty(self): "Test decompress() function with empty string" text = decompress("") self.assertEqual(text, "") def testDecompressIncomplete(self): "Test decompress() function with incomplete data" self.assertRaises(ValueError, decompress, self.DATA[:-10]) def test_main(): test_support.run_unittest(BZ2FileTest) test_support.run_unittest(BZ2CompressorTest) test_support.run_unittest(BZ2DecompressorTest) test_support.run_unittest(FuncTest) if __name__ == '__main__': test_main() # vim:ts=4:sw=4 From niemeyer@users.sourceforge.net Tue Nov 5 16:50:08 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Tue, 05 Nov 2002 08:50:08 -0800 Subject: [Python-checkins] python/dist/src/Modules bz2module.c,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13902/Modules Added Files: bz2module.c Log Message: Patch implementing bz2 module. * setup.py (PyBuildExt.detect_modules): Included bz2 module detection. * Modules/bz2module.c * Lib/test/test_bz2.py * Doc/lib/libbz2.tex Included files implementing, testing, and documenting bz2 module. * Doc/Makefile.deps * Doc/lib/lib.tex Include references to libbz2.tex. * Misc/NEWS (Library): Mention distutils' c++ linkage patch, and new bz2 module. --- NEW FILE: bz2module.c --- /* python-bz2 - python bz2 library interface Copyright (c) 2002 Gustavo Niemeyer Copyright (c) 2002 Python Software Foundation; All Rights Reserved */ #include #include #include "Python.h" #include "structmember.h" #ifdef WITH_THREAD #include "pythread.h" #endif static char __author__[] = [...2060 lines suppressed...] BZ2File_Type.ob_type = &PyType_Type; BZ2File_Type.tp_base = &PyFile_Type; BZ2File_Type.tp_new = PyFile_Type.tp_new; BZ2Comp_Type.ob_type = &PyType_Type; BZ2Decomp_Type.ob_type = &PyType_Type; m = Py_InitModule3("bz2", bz2_methods, bz2__doc__); PyModule_AddObject(m, "__author__", PyString_FromString(__author__)); Py_INCREF(&BZ2File_Type); PyModule_AddObject(m, "BZ2File", (PyObject *)&BZ2File_Type); Py_INCREF(&BZ2Comp_Type); PyModule_AddObject(m, "BZ2Compressor", (PyObject *)&BZ2Comp_Type); Py_INCREF(&BZ2Decomp_Type); PyModule_AddObject(m, "BZ2Decompressor", (PyObject *)&BZ2Decomp_Type); } From fdrake@users.sourceforge.net Tue Nov 5 16:52:53 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 05 Nov 2002 08:52:53 -0800 Subject: [Python-checkins] python/dist/src/Doc/ext windows.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv16483 Modified Files: windows.tex Log Message: Fix minor markup nits. Index: windows.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/windows.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** windows.tex 4 Jul 2002 08:36:53 -0000 1.7 --- windows.tex 5 Nov 2002 16:52:50 -0000 1.8 *************** *** 193,197 **** library:'' dropdown list. ! You should now create the file spam.def as instructed in the previous section. Then chose the \menuselection{Insert \sub Files into Project} dialog. Set the pattern to \code{*.*} and select --- 193,197 ---- library:'' dropdown list. ! You should now create the file \file{spam.def} as instructed in the previous section. Then chose the \menuselection{Insert \sub Files into Project} dialog. Set the pattern to \code{*.*} and select *************** *** 219,223 **** \end{verbatim} ! Refer to section 3 of the \citetitle[http://www.python.org/doc/FAQ.html]{Python FAQ} for details on why you must do this. --- 219,223 ---- \end{verbatim} ! Refer to section~3 of the \citetitle[http://www.python.org/doc/FAQ.html]{Python FAQ} for details on why you must do this. From fdrake@users.sourceforge.net Tue Nov 5 16:53:17 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 05 Nov 2002 08:53:17 -0800 Subject: [Python-checkins] python/dist/src/Doc/ext windows.tex,1.3.6.3,1.3.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv16718 Modified Files: Tag: release22-maint windows.tex Log Message: Fix minor markup nits. Index: windows.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/windows.tex,v retrieving revision 1.3.6.3 retrieving revision 1.3.6.4 diff -C2 -d -r1.3.6.3 -r1.3.6.4 *** windows.tex 5 Oct 2002 15:52:38 -0000 1.3.6.3 --- windows.tex 5 Nov 2002 16:53:15 -0000 1.3.6.4 *************** *** 193,197 **** library:'' dropdown list. ! You should now create the file spam.def as instructed in the previous section. Then chose the \menuselection{Insert \sub Files into Project} dialog. Set the pattern to \code{*.*} and select --- 193,197 ---- library:'' dropdown list. ! You should now create the file \file{spam.def} as instructed in the previous section. Then chose the \menuselection{Insert \sub Files into Project} dialog. Set the pattern to \code{*.*} and select *************** *** 219,223 **** \end{verbatim} ! Refer to section 3 of the \citetitle[http://www.python.org/doc/FAQ.html]{Python FAQ} for details on why you must do this. --- 219,223 ---- \end{verbatim} ! Refer to section~3 of the \citetitle[http://www.python.org/doc/FAQ.html]{Python FAQ} for details on why you must do this. From mwh@users.sourceforge.net Tue Nov 5 17:38:07 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 05 Nov 2002 09:38:07 -0800 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.138,2.139 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3659/Objects Modified Files: listobject.c Log Message: This is Alex Martelli's patch [ 633870 ] allow any seq assignment to a list slice plus a very silly little test case of my own. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.138 retrieving revision 2.139 diff -C2 -d -r2.138 -r2.139 *** listobject.c 11 Oct 2002 23:39:35 -0000 2.138 --- listobject.c 5 Nov 2002 17:38:05 -0000 2.139 *************** *** 449,452 **** --- 449,453 ---- PyObject **recycle, **p; PyObject **item; + PyObject *v_as_SF = NULL; /* PySequence_Fast(v) */ int n; /* Size of replacement list */ int d; /* Change in size */ *************** *** 455,460 **** if (v == NULL) n = 0; ! else if (PyList_Check(v)) { ! n = b->ob_size; if (a == b) { /* Special case "a[i:j] = a" -- copy b first */ --- 456,468 ---- if (v == NULL) n = 0; ! else { ! char msg[256]; ! sprintf(msg, "must assign sequence (not \"%.200s\") to slice", ! v->ob_type->tp_name); ! v_as_SF = PySequence_Fast(v, msg); ! if(v_as_SF == NULL) ! return -1; ! n = PySequence_Fast_GET_SIZE(v_as_SF); ! if (a == b) { /* Special case "a[i:j] = a" -- copy b first */ *************** *** 466,475 **** } } - else { - PyErr_Format(PyExc_TypeError, - "must assign list (not \"%.200s\") to slice", - v->ob_type->tp_name); - return -1; - } if (ilow < 0) ilow = 0; --- 474,477 ---- *************** *** 513,517 **** } for (k = 0; k < n; k++, ilow++) { ! PyObject *w = b->ob_item[k]; Py_XINCREF(w); item[ilow] = w; --- 515,519 ---- } for (k = 0; k < n; k++, ilow++) { ! PyObject *w = PySequence_Fast_GET_ITEM(v_as_SF, k); Py_XINCREF(w); item[ilow] = w; *************** *** 526,529 **** --- 528,532 ---- a->ob_item = NULL; } + Py_XDECREF(v_as_SF); return 0; #undef b From mwh@users.sourceforge.net Tue Nov 5 17:38:07 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 05 Nov 2002 09:38:07 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_types.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv3659/Lib/test Modified Files: test_types.py Log Message: This is Alex Martelli's patch [ 633870 ] allow any seq assignment to a list slice plus a very silly little test case of my own. Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** test_types.py 29 Jul 2002 14:35:03 -0000 1.37 --- test_types.py 5 Nov 2002 17:38:05 -0000 1.38 *************** *** 298,301 **** --- 298,305 ---- raise TestFailed, "list inplace repeat" + a = [] + a[:] = tuple(range(10)) + if a != range(10): + raise TestFailed, "assigning tuple to slice" print '6.5.3a Additional list operations' From fdrake@users.sourceforge.net Tue Nov 5 17:54:04 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 05 Nov 2002 09:54:04 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libbz2.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv9751 Modified Files: libbz2.tex Log Message: Fix a few minor nits. Still need to actually proofread this. Index: libbz2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbz2.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libbz2.tex 5 Nov 2002 16:50:05 -0000 1.1 --- libbz2.tex 5 Nov 2002 17:54:02 -0000 1.2 *************** *** 25,29 **** the readahead algorithm borrowed from file objects; \item \class{BZ2File} class developed inheriting builtin file type ! (\code{isinstance(BZ2File(), file) == 1}); \item Sequential (de)compression supported by \class{BZ2Compressor} and \class{BZ2Decompressor} classes; --- 25,29 ---- the readahead algorithm borrowed from file objects; \item \class{BZ2File} class developed inheriting builtin file type ! (\code{issubclass(BZ2File, file)} is \code{True}); \item Sequential (de)compression supported by \class{BZ2Compressor} and \class{BZ2Decompressor} classes; *************** *** 39,52 **** Handling of compressed files is offered by the \class{BZ2File} class. ! \begin{classdesc}{BZ2File}{filename \optional{, mode='r'\optional{, ! buffering=0\optional{, compresslevel=9}}}} ! Open a bz2 file. Mode can be either \code{'r'} or \code{'w'}, for reading (default) or writing. When opened for writing, the file will be created if ! it doesn't exist, and truncated otherwise. If the buffering argument is given, ! \code{0} means unbuffered, and larger numbers specify the buffer size. If ! compresslevel is given, must be a number between \code{1} and \code{9}. Add a \code{'U'} to mode to open the file for input with universal newline support. Any line ending in the input file will be seen as a ! \code{'\textbackslash n'} in Python. Also, a file so opened gains the attribute \member{newlines}; the value for this attribute is one of \code{None} (no newline read yet), --- 39,54 ---- Handling of compressed files is offered by the \class{BZ2File} class. ! \begin{classdesc}{BZ2File}{filename\optional{, mode\optional{, ! buffering\optional{, compresslevel}}}} ! Open a bz2 file. Mode can be either \code{'r'} or \code{'w'}, for reading (default) or writing. When opened for writing, the file will be created if ! it doesn't exist, and truncated otherwise. If \var{buffering} is given, ! \code{0} means unbuffered, and larger numbers specify the buffer size; ! the default is \code{0}. If ! \var{compresslevel} is given, must be a number between \code{1} and ! \code{9}; the default is \code{9}. Add a \code{'U'} to mode to open the file for input with universal newline support. Any line ending in the input file will be seen as a ! \character{\textbackslash n} in Python. Also, a file so opened gains the attribute \member{newlines}; the value for this attribute is one of \code{None} (no newline read yet), *************** *** 90,94 **** \end{methoddesc} ! \begin{methoddesc}[BZ2File]{seek}{offset \optional{, whence}} Move to new file position. Argument \var{offset} is a byte count. Optional argument \var{whence} defaults to \code{0} (offset from start of file, --- 92,96 ---- \end{methoddesc} ! \begin{methoddesc}[BZ2File]{seek}{offset\optional{, whence}} Move to new file position. Argument \var{offset} is a byte count. Optional argument \var{whence} defaults to \code{0} (offset from start of file, *************** *** 123,131 **** \class{BZ2Compressor} and \class{BZ2Decompressor}. ! \begin{classdesc}{BZ2Compressor}{\optional{compresslevel=9}} Create a new compressor object. This object may be used to compress data sequentially. If you want to compress data in one shot, use the \function{compress()} function instead. The \var{compresslevel} parameter, ! if given, must be a number between \code{1} and \code{9}. \end{classdesc} --- 125,134 ---- \class{BZ2Compressor} and \class{BZ2Decompressor}. ! \begin{classdesc}{BZ2Compressor}{\optional{compresslevel}} Create a new compressor object. This object may be used to compress data sequentially. If you want to compress data in one shot, use the \function{compress()} function instead. The \var{compresslevel} parameter, ! if given, must be a number between \code{1} and \code{9}; the default ! is \code{9}. \end{classdesc} *************** *** 162,174 **** \function{compress()} and \function{decompress()} functions. ! \begin{funcdesc}{compress}{data\optional{, compresslevel=9}} Compress \var{data} in one shot. If you want to compress data sequentially, use an instance of \class{BZ2Compressor} instead. The \var{compresslevel} ! parameter, if given, must be a number between \code{1} and \code{9}. \end{funcdesc} ! \begin{funcdesc}{decompress}{} Decompress \var{data} in one shot. If you want to decompress data sequentially, use an instance of \class{BZ2Decompressor} instead. \end{funcdesc} - --- 165,177 ---- \function{compress()} and \function{decompress()} functions. ! \begin{funcdesc}{compress}{data\optional{, compresslevel}} Compress \var{data} in one shot. If you want to compress data sequentially, use an instance of \class{BZ2Compressor} instead. The \var{compresslevel} ! parameter, if given, must be a number between \code{1} and \code{9}; ! the default is \code{9}. \end{funcdesc} ! \begin{funcdesc}{decompress}{data} Decompress \var{data} in one shot. If you want to decompress data sequentially, use an instance of \class{BZ2Decompressor} instead. \end{funcdesc} From mwh@users.sourceforge.net Tue Nov 5 18:05:54 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 05 Nov 2002 10:05:54 -0800 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.105,2.106 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv14221 Modified Files: abstract.c Log Message: Use PyList_CheckExact and PyTuple_CheckExact for checking whether PySequence_Fast needs to do anything siginificant. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.105 retrieving revision 2.106 diff -C2 -d -r2.105 -r2.106 *** abstract.c 16 Aug 2002 17:01:08 -0000 2.105 --- abstract.c 5 Nov 2002 18:05:49 -0000 2.106 *************** *** 1437,1441 **** return null_error(); ! if (PyList_Check(v) || PyTuple_Check(v)) { Py_INCREF(v); return v; --- 1437,1441 ---- return null_error(); ! if (PyList_CheckExact(v) || PyTuple_CheckExact(v)) { Py_INCREF(v); return v; From nnorwitz@users.sourceforge.net Tue Nov 5 18:17:36 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 05 Nov 2002 10:17:36 -0800 Subject: [Python-checkins] python/dist/src/Modules bz2module.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv18699/Modules Modified Files: bz2module.c Log Message: Fix SF #633935, test_bz2 fails Needed to init ret since it was Py_XDECREF()d on error. All regressions pass in debug build for me. Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bz2module.c 5 Nov 2002 16:50:05 -0000 1.1 --- bz2module.c 5 Nov 2002 18:17:32 -0000 1.2 *************** *** 1702,1706 **** int bufsize = SMALLCHUNK; long totalout; ! PyObject *ret; bz_stream *bzs = &self->bzs; int bzerror; --- 1702,1706 ---- int bufsize = SMALLCHUNK; long totalout; ! PyObject *ret = NULL; bz_stream *bzs = &self->bzs; int bzerror; From gvanrossum@users.sourceforge.net Tue Nov 5 18:41:23 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 05 Nov 2002 10:41:23 -0800 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30449 Modified Files: asyncore.py Log Message: Fix an old bug in poll(). When a signal is handled while we're blocked in select(), this will raise select.error with errno set to EINTR. The except clauses correctly ignores this error, but the rest of the logic will then call read() for all objects in select's *input* list of read file descriptors. Then when an object's read_handler() is naive, it will call recv() on its socket, which will raise an IOError, and then asyncore decides to close the socket. To fix this, we simply return in this case. Backport candidate. Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** asyncore.py 26 Sep 2002 13:19:48 -0000 1.37 --- asyncore.py 5 Nov 2002 18:41:20 -0000 1.38 *************** *** 110,113 **** --- 110,115 ---- if err[0] != EINTR: raise + else: + return for fd in r: From niemeyer@users.sourceforge.net Tue Nov 5 18:41:55 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Tue, 05 Nov 2002 10:41:55 -0800 Subject: [Python-checkins] python/dist/src/Modules bz2module.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29909 Modified Files: bz2module.c Log Message: * bzmodule.c More fixes of XDECREF'd values not initialized. Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** bz2module.c 5 Nov 2002 18:17:32 -0000 1.2 --- bz2module.c 5 Nov 2002 18:41:53 -0000 1.3 *************** *** 1427,1431 **** int bufsize = SMALLCHUNK; long totalout; ! PyObject *ret; bz_stream *bzs = &self->bzs; int bzerror; --- 1427,1431 ---- int bufsize = SMALLCHUNK; long totalout; ! PyObject *ret = NULL; bz_stream *bzs = &self->bzs; int bzerror; *************** *** 1496,1500 **** { int bufsize = SMALLCHUNK; ! PyObject *ret; bz_stream *bzs = &self->bzs; int totalout; --- 1496,1500 ---- { int bufsize = SMALLCHUNK; ! PyObject *ret = NULL; bz_stream *bzs = &self->bzs; int totalout; *************** *** 1906,1910 **** int datasize; int bufsize; ! PyObject *ret; bz_stream _bzs; bz_stream *bzs = &_bzs; --- 1906,1910 ---- int datasize; int bufsize; ! PyObject *ret = NULL; bz_stream _bzs; bz_stream *bzs = &_bzs; From bwarsaw@users.sourceforge.net Tue Nov 5 19:54:23 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 05 Nov 2002 11:54:23 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Utils.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv29137 Modified Files: Utils.py Log Message: Jason Mastaler's patch to break the dependence on rfc822.py for the address parsing routines. Closes SF patch #613434. Index: Utils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Utils.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Utils.py 1 Oct 2002 00:44:13 -0000 1.20 --- Utils.py 5 Nov 2002 19:54:21 -0000 1.21 *************** *** 14,24 **** from types import ListType ! from rfc822 import quote ! from rfc822 import AddressList as _AddressList ! from rfc822 import mktime_tz # We need wormarounds for bugs in these methods in older Pythons (see below) ! from rfc822 import parsedate as _parsedate ! from rfc822 import parsedate_tz as _parsedate_tz try: --- 14,24 ---- from types import ListType ! from email._parseaddr import quote ! from email._parseaddr import AddressList as _AddressList ! from email._parseaddr import mktime_tz # We need wormarounds for bugs in these methods in older Pythons (see below) ! from email._parseaddr import parsedate as _parsedate ! from email._parseaddr import parsedate_tz as _parsedate_tz try: From bwarsaw@users.sourceforge.net Tue Nov 5 19:54:55 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 05 Nov 2002 11:54:55 -0800 Subject: [Python-checkins] python/dist/src/Lib/email _parseaddr.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv29454 Added Files: _parseaddr.py Log Message: Jason Mastaler's patch to break the dependence on rfc822.py for the address parsing routines. Closes SF patch #613434. --- NEW FILE: _parseaddr.py --- # Copyright (C) 2002 Python Software Foundation """Email address parsing code. Lifted directly from rfc822.py. This should eventually be rewritten. """ import time # Parse a date field _monthnames = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec', 'january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'] _daynames = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] # The timezone table does not include the military time zones defined # in RFC822, other than Z. According to RFC1123, the description in # RFC822 gets the signs wrong, so we can't rely on any such time # zones. RFC1123 recommends that numeric timezone indicators be used # instead of timezone names. _timezones = {'UT':0, 'UTC':0, 'GMT':0, 'Z':0, 'AST': -400, 'ADT': -300, # Atlantic (used in Canada) 'EST': -500, 'EDT': -400, # Eastern 'CST': -600, 'CDT': -500, # Central 'MST': -700, 'MDT': -600, # Mountain 'PST': -800, 'PDT': -700 # Pacific } def parsedate_tz(data): """Convert a date string to a time tuple. Accounts for military timezones. """ data = data.split() if data[0][-1] in (',', '.') or data[0].lower() in _daynames: # There's a dayname here. Skip it del data[0] if len(data) == 3: # RFC 850 date, deprecated stuff = data[0].split('-') if len(stuff) == 3: data = stuff + data[1:] if len(data) == 4: s = data[3] i = s.find('+') if i > 0: data[3:] = [s[:i], s[i+1:]] else: data.append('') # Dummy tz if len(data) < 5: return None data = data[:5] [dd, mm, yy, tm, tz] = data mm = mm.lower() if not mm in _monthnames: dd, mm = mm, dd.lower() if not mm in _monthnames: return None mm = _monthnames.index(mm)+1 if mm > 12: mm = mm - 12 if dd[-1] == ',': dd = dd[:-1] i = yy.find(':') if i > 0: yy, tm = tm, yy if yy[-1] == ',': yy = yy[:-1] if not yy[0].isdigit(): yy, tz = tz, yy if tm[-1] == ',': tm = tm[:-1] tm = tm.split(':') if len(tm) == 2: [thh, tmm] = tm tss = '0' elif len(tm) == 3: [thh, tmm, tss] = tm else: return None try: yy = int(yy) dd = int(dd) thh = int(thh) tmm = int(tmm) tss = int(tss) except ValueError: return None tzoffset = None tz = tz.upper() if _timezones.has_key(tz): tzoffset = _timezones[tz] else: try: tzoffset = int(tz) except ValueError: pass # Convert a timezone offset into seconds ; -0500 -> -18000 if tzoffset: if tzoffset < 0: tzsign = -1 tzoffset = -tzoffset else: tzsign = 1 tzoffset = tzsign * ( (tzoffset/100)*3600 + (tzoffset % 100)*60) tuple = (yy, mm, dd, thh, tmm, tss, 0, 0, 0, tzoffset) return tuple def parsedate(data): """Convert a time string to a time tuple.""" t = parsedate_tz(data) if type(t) == type( () ): return t[:9] else: return t def mktime_tz(data): """Turn a 10-tuple as returned by parsedate_tz() into a UTC timestamp.""" if data[9] is None: # No zone info, so localtime is better assumption than GMT return time.mktime(data[:8] + (-1,)) else: t = time.mktime(data[:8] + (0,)) return t - data[9] - time.timezone def quote(str): """Add quotes around a string.""" return str.replace('\\', '\\\\').replace('"', '\\"') class AddrlistClass: """Address parser class by Ben Escoto. To understand what this class does, it helps to have a copy of RFC-822 in front of you. Note: this class interface is deprecated and may be removed in the future. Use rfc822.AddressList instead. """ def __init__(self, field): """Initialize a new instance. `field' is an unparsed address header field, containing one or more addresses. """ self.specials = '()<>@,:;.\"[]' self.pos = 0 self.LWS = ' \t' self.CR = '\r\n' self.atomends = self.specials + self.LWS + self.CR self.field = field self.commentlist = [] def gotonext(self): """Parse up to the start of the next address.""" while self.pos < len(self.field): if self.field[self.pos] in self.LWS + '\n\r': self.pos = self.pos + 1 elif self.field[self.pos] == '(': self.commentlist.append(self.getcomment()) else: break def getaddrlist(self): """Parse all addresses. Returns a list containing all of the addresses. """ ad = self.getaddress() if ad: return ad + self.getaddrlist() else: return [] def getaddress(self): """Parse the next address.""" self.commentlist = [] self.gotonext() oldpos = self.pos oldcl = self.commentlist plist = self.getphraselist() self.gotonext() returnlist = [] if self.pos >= len(self.field): # Bad email address technically, no domain. if plist: returnlist = [(' '.join(self.commentlist), plist[0])] elif self.field[self.pos] in '.@': # email address is just an addrspec # this isn't very efficient since we start over self.pos = oldpos self.commentlist = oldcl addrspec = self.getaddrspec() returnlist = [(' '.join(self.commentlist), addrspec)] elif self.field[self.pos] == ':': # address is a group returnlist = [] fieldlen = len(self.field) self.pos = self.pos + 1 while self.pos < len(self.field): self.gotonext() if self.pos < fieldlen and self.field[self.pos] == ';': self.pos = self.pos + 1 break returnlist = returnlist + self.getaddress() elif self.field[self.pos] == '<': # Address is a phrase then a route addr routeaddr = self.getrouteaddr() if self.commentlist: returnlist = [(' '.join(plist) + ' (' + \ ' '.join(self.commentlist) + ')', routeaddr)] else: returnlist = [(' '.join(plist), routeaddr)] else: if plist: returnlist = [(' '.join(self.commentlist), plist[0])] elif self.field[self.pos] in self.specials: self.pos = self.pos + 1 self.gotonext() if self.pos < len(self.field) and self.field[self.pos] == ',': self.pos = self.pos + 1 return returnlist def getrouteaddr(self): """Parse a route address (Return-path value). This method just skips all the route stuff and returns the addrspec. """ if self.field[self.pos] != '<': return expectroute = 0 self.pos = self.pos + 1 self.gotonext() adlist = "" while self.pos < len(self.field): if expectroute: self.getdomain() expectroute = 0 elif self.field[self.pos] == '>': self.pos = self.pos + 1 break elif self.field[self.pos] == '@': self.pos = self.pos + 1 expectroute = 1 elif self.field[self.pos] == ':': self.pos = self.pos + 1 expectaddrspec = 1 else: adlist = self.getaddrspec() self.pos = self.pos + 1 break self.gotonext() return adlist def getaddrspec(self): """Parse an RFC-822 addr-spec.""" aslist = [] self.gotonext() while self.pos < len(self.field): if self.field[self.pos] == '.': aslist.append('.') self.pos = self.pos + 1 elif self.field[self.pos] == '"': aslist.append('"%s"' % self.getquote()) elif self.field[self.pos] in self.atomends: break else: aslist.append(self.getatom()) self.gotonext() if self.pos >= len(self.field) or self.field[self.pos] != '@': return ''.join(aslist) aslist.append('@') self.pos = self.pos + 1 self.gotonext() return ''.join(aslist) + self.getdomain() def getdomain(self): """Get the complete domain name from an address.""" sdlist = [] while self.pos < len(self.field): if self.field[self.pos] in self.LWS: self.pos = self.pos + 1 elif self.field[self.pos] == '(': self.commentlist.append(self.getcomment()) elif self.field[self.pos] == '[': sdlist.append(self.getdomainliteral()) elif self.field[self.pos] == '.': self.pos = self.pos + 1 sdlist.append('.') elif self.field[self.pos] in self.atomends: break else: sdlist.append(self.getatom()) return ''.join(sdlist) def getdelimited(self, beginchar, endchars, allowcomments = 1): """Parse a header fragment delimited by special characters. `beginchar' is the start character for the fragment. If self is not looking at an instance of `beginchar' then getdelimited returns the empty string. `endchars' is a sequence of allowable end-delimiting characters. Parsing stops when one of these is encountered. If `allowcomments' is non-zero, embedded RFC-822 comments are allowed within the parsed fragment. """ if self.field[self.pos] != beginchar: return '' slist = [''] quote = 0 self.pos = self.pos + 1 while self.pos < len(self.field): if quote == 1: slist.append(self.field[self.pos]) quote = 0 elif self.field[self.pos] in endchars: self.pos = self.pos + 1 break elif allowcomments and self.field[self.pos] == '(': slist.append(self.getcomment()) elif self.field[self.pos] == '\\': quote = 1 else: slist.append(self.field[self.pos]) self.pos = self.pos + 1 return ''.join(slist) def getquote(self): """Get a quote-delimited fragment from self's field.""" return self.getdelimited('"', '"\r', 0) def getcomment(self): """Get a parenthesis-delimited fragment from self's field.""" return self.getdelimited('(', ')\r', 1) def getdomainliteral(self): """Parse an RFC-822 domain-literal.""" return '[%s]' % self.getdelimited('[', ']\r', 0) def getatom(self): """Parse an RFC-822 atom.""" atomlist = [''] while self.pos < len(self.field): if self.field[self.pos] in self.atomends: break else: atomlist.append(self.field[self.pos]) self.pos = self.pos + 1 return ''.join(atomlist) def getphraselist(self): """Parse a sequence of RFC-822 phrases. A phrase is a sequence of words, which are in turn either RFC-822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space. """ plist = [] while self.pos < len(self.field): if self.field[self.pos] in self.LWS: self.pos = self.pos + 1 elif self.field[self.pos] == '"': plist.append(self.getquote()) elif self.field[self.pos] == '(': self.commentlist.append(self.getcomment()) elif self.field[self.pos] in self.atomends: break else: plist.append(self.getatom()) return plist class AddressList(AddrlistClass): """An AddressList encapsulates a list of parsed RFC822 addresses.""" def __init__(self, field): AddrlistClass.__init__(self, field) if field: self.addresslist = self.getaddrlist() else: self.addresslist = [] def __len__(self): return len(self.addresslist) def __str__(self): return ", ".join(map(dump_address_pair, self.addresslist)) def __add__(self, other): # Set union newaddr = AddressList(None) newaddr.addresslist = self.addresslist[:] for x in other.addresslist: if not x in self.addresslist: newaddr.addresslist.append(x) return newaddr def __iadd__(self, other): # Set union, in-place for x in other.addresslist: if not x in self.addresslist: self.addresslist.append(x) return self def __sub__(self, other): # Set difference newaddr = AddressList(None) for x in self.addresslist: if not x in other.addresslist: newaddr.addresslist.append(x) return newaddr def __isub__(self, other): # Set difference, in-place for x in other.addresslist: if x in self.addresslist: self.addresslist.remove(x) return self def __getitem__(self, index): # Make indexing, slices, and 'in' work return self.addresslist[index] From bwarsaw@users.sourceforge.net Tue Nov 5 19:56:49 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 05 Nov 2002 11:56:49 -0800 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv30543 Modified Files: __init__.py Log Message: Bump __version__ (yes, to 2.5 "minus") Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** __init__.py 14 Oct 2002 15:24:18 -0000 1.20 --- __init__.py 5 Nov 2002 19:56:47 -0000 1.21 *************** *** 5,9 **** """ ! __version__ = '2.4.3' __all__ = [ --- 5,9 ---- """ ! __version__ = '2.5-' __all__ = [ From jhylton@users.sourceforge.net Tue Nov 5 20:11:11 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 05 Nov 2002 12:11:11 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils sysconfig.py,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv4183 Modified Files: sysconfig.py Log Message: Remove use of string module and reflow a couple of long lines. Index: sysconfig.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/sysconfig.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** sysconfig.py 5 Nov 2002 16:11:59 -0000 1.52 --- sysconfig.py 5 Nov 2002 20:11:08 -0000 1.53 *************** *** 15,19 **** import os import re - import string import sys --- 15,18 ---- *************** *** 214,218 **** if m: n, v = m.group(1, 2) ! try: v = string.atoi(v) except ValueError: pass g[n] = v --- 213,217 ---- if m: n, v = m.group(1, 2) ! try: v = int(v) except ValueError: pass g[n] = v *************** *** 252,260 **** if m: n, v = m.group(1, 2) ! v = string.strip(v) if "$" in v: notdone[n] = v else: ! try: v = string.atoi(v) except ValueError: pass done[n] = v --- 251,259 ---- if m: n, v = m.group(1, 2) ! v = v.strip() if "$" in v: notdone[n] = v else: ! try: v = int(v) except ValueError: pass done[n] = v *************** *** 273,279 **** notdone[name] = value else: ! try: value = string.atoi(value) except ValueError: ! done[name] = string.strip(value) else: done[name] = value --- 272,278 ---- notdone[name] = value else: ! try: value = int(value) except ValueError: ! done[name] = value.strip() else: done[name] = value *************** *** 289,295 **** notdone[name] = value else: ! try: value = string.atoi(value) except ValueError: ! done[name] = string.strip(value) else: done[name] = value --- 288,294 ---- notdone[name] = value else: ! try: value = int(value) except ValueError: ! done[name] = value.strip() else: done[name] = value *************** *** 370,375 **** # sense. python_lib = get_python_lib(standard_lib=1) ! linkerscript_name = os.path.basename(string.split(g['LDSHARED'])[0]) ! linkerscript = os.path.join(python_lib, 'config', linkerscript_name) # XXX this isn't the right place to do this: adding the Python --- 369,375 ---- # sense. python_lib = get_python_lib(standard_lib=1) ! linkerscript_name = os.path.basename(g['LDSHARED'].split()[0]) ! linkerscript = os.path.join(python_lib, 'config', ! linkerscript_name) # XXX this isn't the right place to do this: adding the Python From jhylton@users.sourceforge.net Tue Nov 5 20:27:21 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 05 Nov 2002 12:27:21 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils ccompiler.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv9713 Modified Files: ccompiler.py Log Message: Repair inconsistent use of tabs and spaces. Index: ccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/ccompiler.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** ccompiler.py 5 Nov 2002 16:11:53 -0000 1.50 --- ccompiler.py 5 Nov 2002 20:27:17 -0000 1.51 *************** *** 590,594 **** language_map, and language_order to do the job. """ ! if type(sources) is not ListType: sources = [sources] lang = None --- 590,594 ---- language_map, and language_order to do the job. """ ! if type(sources) is not ListType: sources = [sources] lang = None From tim_one@users.sourceforge.net Tue Nov 5 20:38:58 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 05 Nov 2002 12:38:58 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.509,1.510 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv13195/python/Misc Modified Files: NEWS Log Message: Another round on SF patch 618135: gzip.py and files > 2G The last round boosted "the limit" from 2GB to 4GB. This round gets rid of the 4GB limit. For files > 4GB, gzip stores just the last 32 bits of the file size, and now we play along with that too. Tested by hand (on a 6+GB file) on Win2K. Boosting from 2GB to 4GB was arguably enough "a bugfix". Going beyond that smells more like "new feature" to me. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.509 retrieving revision 1.510 diff -C2 -d -r1.509 -r1.510 *** NEWS 5 Nov 2002 16:50:05 -0000 1.509 --- NEWS 5 Nov 2002 20:38:55 -0000 1.510 *************** *** 356,362 **** ------- ! - gzip.py now handles files exceeding 2GB. Note that 4GB is still a ! fundamental limitation of the underlying gzip file format (it only ! has 32 bits to record the file size). - xml.sax.saxutils.unescape has been added, to replace entity references --- 356,365 ---- ------- ! - gzip.py now handles files exceeding 2GB. Files over 4GB also work ! now (provided the OS supports it, and Python is configured with large ! file support), but in that case the underlying gzip file format can ! record only the least-significant 32 bits of the file size, so that ! some tools working with gzipped files may report an incorrect file ! size. - xml.sax.saxutils.unescape has been added, to replace entity references From tim_one@users.sourceforge.net Tue Nov 5 20:38:57 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 05 Nov 2002 12:38:57 -0800 Subject: [Python-checkins] python/dist/src/Lib gzip.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13195/python/Lib Modified Files: gzip.py Log Message: Another round on SF patch 618135: gzip.py and files > 2G The last round boosted "the limit" from 2GB to 4GB. This round gets rid of the 4GB limit. For files > 4GB, gzip stores just the last 32 bits of the file size, and now we play along with that too. Tested by hand (on a 6+GB file) on Win2K. Boosting from 2GB to 4GB was arguably enough "a bugfix". Going beyond that smells more like "new feature" to me. Index: gzip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gzip.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** gzip.py 4 Nov 2002 19:50:11 -0000 1.36 --- gzip.py 5 Nov 2002 20:38:54 -0000 1.37 *************** *** 25,28 **** --- 25,32 ---- return i + def LOWU32(i): + """Return the low-order 32 bits of an int, as a non-negative int.""" + return i & 0xFFFFFFFFL + def write32(output, value): output.write(struct.pack(" References: Message-ID: <20021105205040.GA25678@ute.mems-exchange.org> On Tue, Nov 05, 2002 at 12:11:11PM -0800, jhylton@users.sourceforge.net wrote: >Remove use of string module and reflow a couple of long lines. Note that the use of string methods means the end of 1.5.2 compatibility. If we're doing that, then there are many more modernizations that can be done to the Distutils code. --amk From bwarsaw@users.sourceforge.net Tue Nov 5 20:53:20 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 05 Nov 2002 12:53:20 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test/data msg_34.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory usw-pr-cvs1:/tmp/cvs-serv19837 Added Files: msg_34.txt Log Message: Test case, distilled from SF bug #631350, where a subobject in a multipart/digest isn't a message/rfc822. This is legal, but counter to recommended practice in RFC 2046, $5.1.5. --- NEW FILE: msg_34.txt --- From: aperson@dom.ain To: bperson@dom.ain Content-Type: multipart/digest; boundary=XYZ --XYZ Content-Type: text/plain This is a text plain part that is counter to recommended practice in RFC 2046, $5.1.5, but is not illegal --XYZ From: cperson@dom.ain To: dperson@dom.ain A submessage --XYZ-- From fdrake@acm.org Tue Nov 5 20:53:56 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Tue, 5 Nov 2002 15:53:56 -0500 Subject: [Python-checkins] python/dist/src/Lib/distutils sysconfig.py,1.52,1.53 In-Reply-To: <20021105205040.GA25678@ute.mems-exchange.org> References: <20021105205040.GA25678@ute.mems-exchange.org> Message-ID: <15816.12260.81426.176165@grendel.zope.com> Andrew Kuchling writes: > Note that the use of string methods means the end of 1.5.2 > compatibility. If we're doing that, then there are many more > modernizations that can be done to the Distutils code. I think dropping 1.5. support is fine, and that's what I told Jeremy before he made that change. ;-) -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From bwarsaw@users.sourceforge.net Tue Nov 5 20:54:39 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 05 Nov 2002 12:54:39 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv20317 Modified Files: Parser.py Log Message: _parsebody(): A fix for SF bug #631350, where a subobject in a multipart/digest isn't a message/rfc822. This is legal, but counter to recommended practice in RFC 2046, $5.1.5. The fix is to look at the content type after setting the default content type. If the maintype is then message or multipart, attach the parsed subobject, otherwise use set_payload() to set the data of the other object. Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Parser.py 7 Oct 2002 17:27:35 -0000 1.17 --- Parser.py 5 Nov 2002 20:54:37 -0000 1.18 *************** *** 222,228 **** msgobj = self.parsestr(parthdrs, headersonly=1) # while submsgobj is the message itself - submsgobj = self.parsestr(part) - msgobj.attach(submsgobj) msgobj.set_default_type('message/rfc822') else: msgobj = self.parsestr(part) --- 222,232 ---- msgobj = self.parsestr(parthdrs, headersonly=1) # while submsgobj is the message itself msgobj.set_default_type('message/rfc822') + maintype = msgobj.get_content_maintype() + if maintype in ('message', 'multipart'): + submsgobj = self.parsestr(part) + msgobj.attach(submsgobj) + else: + msgobj.set_payload(part) else: msgobj = self.parsestr(part) From bwarsaw@users.sourceforge.net Tue Nov 5 21:04:54 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 05 Nov 2002 13:04:54 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv24473 Modified Files: test_email.py Log Message: test_text_plain_in_a_multipart_digest(): A test of the fix for SF bug #631350, where a subobject in a multipart/digest isn't a message/rfc822. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** test_email.py 21 Oct 2002 05:43:58 -0000 1.22 --- test_email.py 5 Nov 2002 21:04:52 -0000 1.23 *************** *** 1495,1498 **** --- 1495,1502 ---- self._idempotent(msg, text) + def test_text_plain_in_a_multipart_digest(self): + msg, text = self._msgobj('msg_34.txt') + self._idempotent(msg, text) + def test_content_type(self): eq = self.assertEquals From guido@python.org Tue Nov 5 21:06:24 2002 From: guido@python.org (Guido van Rossum) Date: Tue, 05 Nov 2002 16:06:24 -0500 Subject: [Python-checkins] python/dist/src/Lib/distutils sysconfig.py,1.52,1.53 In-Reply-To: Your message of "Tue, 05 Nov 2002 15:50:40 EST." <20021105205040.GA25678@ute.mems-exchange.org> References: <20021105205040.GA25678@ute.mems-exchange.org> Message-ID: <200211052106.gA5L6Px24258@odiug.zope.com> > >Remove use of string module and reflow a couple of long lines. > > Note that the use of string methods means the end of 1.5.2 > compatibility. Do we still care about that? I thought that was given up long ago? > If we're doing that, then there are many more > modernizations that can be done to the Distutils code. Agreed -- though I suppose that's all low priority. --Guido van Rossum (home page: http://www.python.org/~guido/) From bwarsaw@users.sourceforge.net Tue Nov 5 21:29:49 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 05 Nov 2002 13:29:49 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test/data msg_35.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test/data In directory usw-pr-cvs1:/tmp/cvs-serv1716 Added Files: msg_35.txt Log Message: A message with no separating blank line between the headers and the body. A test message for SF bug #633527. --- NEW FILE: msg_35.txt --- From: aperson@dom.ain To: bperson@dom.ain Subject: here's something interesting counter to RFC 2822, there's no separating newline here From bwarsaw@users.sourceforge.net Tue Nov 5 21:36:23 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 05 Nov 2002 13:36:23 -0800 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory usw-pr-cvs1:/tmp/cvs-serv4388 Modified Files: test_email.py Log Message: test_no_separating_blank_line(): A test for SF bug #633527, no separating blank line between a header block and body text. Tests both lax and strict parsing. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** test_email.py 5 Nov 2002 21:04:52 -0000 1.23 --- test_email.py 5 Nov 2002 21:36:17 -0000 1.24 *************** *** 43,46 **** --- 43,52 ---- warnings.filterwarnings('ignore', '', DeprecationWarning, __name__) + try: + True, False + except NameError: + True = 1 + False = 0 + *************** *** 68,75 **** ndiffAssertEqual = unittest.TestCase.assertEqual ! def _msgobj(self, filename): fp = openfile(findfile(filename)) try: ! msg = email.message_from_file(fp) finally: fp.close() --- 74,81 ---- ndiffAssertEqual = unittest.TestCase.assertEqual ! def _msgobj(self, filename, strict=False): fp = openfile(findfile(filename)) try: ! msg = email.message_from_file(fp, strict=strict) finally: fp.close() *************** *** 185,200 **** msg = self._msgobj('msg_10.txt') # The outer message is a multipart ! eq(msg.get_payload(decode=1), None) # Subpart 1 is 7bit encoded ! eq(msg.get_payload(0).get_payload(decode=1), 'This is a 7bit encoded message.\n') # Subpart 2 is quopri ! eq(msg.get_payload(1).get_payload(decode=1), '\xa1This is a Quoted Printable encoded message!\n') # Subpart 3 is base64 ! eq(msg.get_payload(2).get_payload(decode=1), 'This is a Base64 encoded message.') # Subpart 4 has no Content-Transfer-Encoding: header. ! eq(msg.get_payload(3).get_payload(decode=1), 'This has no Content-Transfer-Encoding: header.\n') --- 191,206 ---- msg = self._msgobj('msg_10.txt') # The outer message is a multipart ! eq(msg.get_payload(decode=True), None) # Subpart 1 is 7bit encoded ! eq(msg.get_payload(0).get_payload(decode=True), 'This is a 7bit encoded message.\n') # Subpart 2 is quopri ! eq(msg.get_payload(1).get_payload(decode=True), '\xa1This is a Quoted Printable encoded message!\n') # Subpart 3 is base64 ! eq(msg.get_payload(2).get_payload(decode=True), 'This is a Base64 encoded message.') # Subpart 4 has no Content-Transfer-Encoding: header. ! eq(msg.get_payload(3).get_payload(decode=True), 'This has no Content-Transfer-Encoding: header.\n') *************** *** 311,319 **** msg.set_param('importance', 'high value') eq(msg.get_param('importance'), 'high value') ! eq(msg.get_param('importance', unquote=0), '"high value"') eq(msg.get_params(), [('text/plain', ''), ('charset', 'iso-2022-jp'), ('importance', 'high value')]) ! eq(msg.get_params(unquote=0), [('text/plain', ''), ('charset', '"iso-2022-jp"'), ('importance', '"high value"')]) --- 317,325 ---- msg.set_param('importance', 'high value') eq(msg.get_param('importance'), 'high value') ! eq(msg.get_param('importance', unquote=False), '"high value"') eq(msg.get_params(), [('text/plain', ''), ('charset', 'iso-2022-jp'), ('importance', 'high value')]) ! eq(msg.get_params(unquote=False), [('text/plain', ''), ('charset', '"iso-2022-jp"'), ('importance', '"high value"')]) *************** *** 739,743 **** def test_mangled_from(self): s = StringIO() ! g = Generator(s, mangle_from_=1) g.flatten(self.msg) self.assertEqual(s.getvalue(), """\ --- 745,749 ---- def test_mangled_from(self): s = StringIO() ! g = Generator(s, mangle_from_=True) g.flatten(self.msg) self.assertEqual(s.getvalue(), """\ *************** *** 750,754 **** def test_dont_mangle_from(self): s = StringIO() ! g = Generator(s, mangle_from_=0) g.flatten(self.msg) self.assertEqual(s.getvalue(), """\ --- 756,760 ---- def test_dont_mangle_from(self): s = StringIO() ! g = Generator(s, mangle_from_=False) g.flatten(self.msg) self.assertEqual(s.getvalue(), """\ *************** *** 1049,1053 **** finally: fp.close() ! p = Parser(strict=1) # Note, under a future non-strict parsing mode, this would parse the # message into the intended message tree. --- 1055,1059 ---- finally: fp.close() ! p = Parser(strict=True) # Note, under a future non-strict parsing mode, this would parse the # message into the intended message tree. *************** *** 1100,1103 **** --- 1106,1123 ---- """) + def test_no_separating_blank_line(self): + eq = self.ndiffAssertEqual + msg = self._msgobj('msg_35.txt') + eq(msg.as_string(), """\ + From: aperson@dom.ain + To: bperson@dom.ain + Subject: here's something interesting + + counter to RFC 2822, there's no separating newline here + """) + # strict=True should raise an exception + self.assertRaises(Errors.HeaderParseError, + self._msgobj, 'msg_35.txt', True) + *************** *** 1645,1649 **** now = time.time() self.assertEqual( ! Utils.parsedate(Utils.formatdate(now, localtime=1))[:6], time.localtime(now)[:6]) --- 1665,1669 ---- now = time.time() self.assertEqual( ! Utils.parsedate(Utils.formatdate(now, localtime=True))[:6], time.localtime(now)[:6]) *************** *** 1952,1956 **** eq(he('hello', charset='iso-8859-2'), '=?iso-8859-2?b?aGVsbG8=?=') # Test the keep_eols flag ! eq(he('hello\nworld', keep_eols=1), '=?iso-8859-1?b?aGVsbG8Kd29ybGQ=?=') # Test the maxlinelen argument --- 1972,1976 ---- eq(he('hello', charset='iso-8859-2'), '=?iso-8859-2?b?aGVsbG8=?=') # Test the keep_eols flag ! eq(he('hello\nworld', keep_eols=True), '=?iso-8859-1?b?aGVsbG8Kd29ybGQ=?=') # Test the maxlinelen argument *************** *** 2031,2035 **** eq(he('hello', charset='iso-8859-2'), '=?iso-8859-2?q?hello?=') # Test the keep_eols flag ! eq(he('hello\nworld', keep_eols=1), '=?iso-8859-1?q?hello=0Aworld?=') # Test a non-ASCII character eq(he('hello\xc7there'), '=?iso-8859-1?q?hello=C7there?=') --- 2051,2055 ---- eq(he('hello', charset='iso-8859-2'), '=?iso-8859-2?q?hello?=') # Test the keep_eols flag ! eq(he('hello\nworld', keep_eols=True), '=?iso-8859-1?q?hello=0Aworld?=') # Test a non-ASCII character eq(he('hello\xc7there'), '=?iso-8859-1?q?hello=C7there?=') *************** *** 2278,2282 **** eq(msg.get_param('title'), ('us-ascii', 'en', 'This is even more ***fun*** isn\'t it!')) ! eq(msg.get_param('title', unquote=0), ('us-ascii', 'en', '"This is even more ***fun*** isn\'t it!"')) --- 2298,2302 ---- eq(msg.get_param('title'), ('us-ascii', 'en', 'This is even more ***fun*** isn\'t it!')) ! eq(msg.get_param('title', unquote=False), ('us-ascii', 'en', '"This is even more ***fun*** isn\'t it!"')) From bwarsaw@users.sourceforge.net Tue Nov 5 21:44:08 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 05 Nov 2002 13:44:08 -0800 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory usw-pr-cvs1:/tmp/cvs-serv7523 Modified Files: Parser.py Log Message: parse(), _parseheaders(), _parsebody(): A fix for SF bug #633527, where in lax parsing, the first non-header line after a header block (e.g. the first line not containing a colon, and not a continuation), can be treated as the first body line, even without the RFC mandated blank line separator. rfc822 had this behavior, and I vaguely remember problems with this, but can't remember details. In any event, all the tests still pass, so I guess we'll find out. ;/ This patch works by returning the non-header, non-continuation line from _parseheader() and using that as the first header line prepended to fp.read() if given. It's usually None. We use this approach instead of trying to seek/tell the file-like object. Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Parser.py 5 Nov 2002 20:54:37 -0000 1.18 --- Parser.py 5 Nov 2002 21:44:06 -0000 1.19 *************** *** 60,66 **** """ root = self._class() ! self._parseheaders(root, fp) if not headersonly: ! self._parsebody(root, fp) return root --- 60,66 ---- """ root = self._class() ! firstbodyline = self._parseheaders(root, fp) if not headersonly: ! self._parsebody(root, fp, firstbodyline) return root *************** *** 81,84 **** --- 81,85 ---- lastvalue = [] lineno = 0 + firstbodyline = None while True: # Don't strip the line before we test for the end condition, *************** *** 121,131 **** if self._strict: raise Errors.HeaderParseError( ! "Not a header, not a continuation: ``%s''"%line) elif lineno == 1 and line.startswith('--'): # allow through duplicate boundary tags. continue else: ! raise Errors.HeaderParseError( ! "Not a header, not a continuation: ``%s''"%line) if lastheader: container[lastheader] = NL.join(lastvalue) --- 122,135 ---- if self._strict: raise Errors.HeaderParseError( ! "Not a header, not a continuation: ``%s''" % line) elif lineno == 1 and line.startswith('--'): # allow through duplicate boundary tags. continue else: ! # There was no separating blank line as mandated by RFC ! # 2822, but we're in non-strict mode. So just offer up ! # this current line as the first body line. ! firstbodyline = line ! break if lastheader: container[lastheader] = NL.join(lastvalue) *************** *** 135,140 **** if lastheader: container[lastheader] = NL.join(lastvalue) ! def _parsebody(self, container, fp): # Parse the body, but first split the payload on the content-type # boundary if present. --- 139,145 ---- if lastheader: container[lastheader] = NL.join(lastvalue) + return firstbodyline ! def _parsebody(self, container, fp, firstbodyline=None): # Parse the body, but first split the payload on the content-type # boundary if present. *************** *** 153,156 **** --- 158,163 ---- separator = '--' + boundary payload = fp.read() + if firstbodyline is not None: + payload = firstbodyline + '\n' + payload # We use an RE here because boundaries can have trailing # whitespace. *************** *** 261,265 **** container.attach(msg) else: ! container.set_payload(fp.read()) --- 268,275 ---- container.attach(msg) else: ! text = fp.read() ! if firstbodyline is not None: ! text = firstbodyline + '\n' + text ! container.set_payload(text) *************** *** 275,279 **** interested in is the message headers. """ ! def _parsebody(self, container, fp): # Consume but do not parse, the body ! container.set_payload(fp.read()) --- 285,292 ---- interested in is the message headers. """ ! def _parsebody(self, container, fp, firstbodyline=None): # Consume but do not parse, the body ! text = fp.read() ! if firstbodyline is not None: ! text = firstbodyline + '\n' + text ! container.set_payload(text) From loewis@users.sourceforge.net Tue Nov 5 22:11:52 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 05 Nov 2002 14:11:52 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib tkinter.tex,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv19596 Modified Files: tkinter.tex Log Message: Document that images go away when they go away. Fixes #632323. Index: tkinter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tkinter.tex 3 Nov 2002 13:13:20 -0000 1.16 --- tkinter.tex 5 Nov 2002 22:11:50 -0000 1.17 *************** *** 882,885 **** --- 882,903 ---- \end{description} + \subsubsection{Images} + + Bitmap/Pixelmap images can be created through the subclasses of + \class{Tkinter.Image}: + + \begin{itemize} + \item \class{BitmapImage} can be used for X11 bitmap data. + \item \class{PhotoImage} can be used for GIF and PPM/PGM color bitmaps. + \end{itemize} + + Either type of image is created through either the \code{file} or the + \code{data} option (other options are available as well). + + The image object can then be used whereever an \code{image} option is + supported by some widget (e.g. labels, buttons, menus). In these + cases, Tk will not keep a reference to the image. When the last Python + reference to the image object is deleted, the image data is deleted as + well, and Tk will display an empty box wheerever the image was used. \section{\module{Tix} --- From fdrake@users.sourceforge.net Tue Nov 5 22:19:29 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 05 Nov 2002 14:19:29 -0800 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.3.6.1,1.3.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv23640 Modified Files: Tag: release22-maint newtypes.tex Log Message: Minor cleanups, markup. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.3.6.1 retrieving revision 1.3.6.2 diff -C2 -d -r1.3.6.1 -r1.3.6.2 *** newtypes.tex 3 Nov 2002 02:57:24 -0000 1.3.6.1 --- newtypes.tex 5 Nov 2002 22:19:27 -0000 1.3.6.2 *************** *** 344,349 **** \begin{ctypedesc}[getcharbufferproc]{int (*getcharbufferproc) (PyObject *self, int segment, const char **ptrptr)} ! Return the size of the memory buffer in ptrptr at the segment index. ! \code{\var{ptrptr}} is set to the memory buffer. \end{ctypedesc} --- 344,349 ---- \begin{ctypedesc}[getcharbufferproc]{int (*getcharbufferproc) (PyObject *self, int segment, const char **ptrptr)} ! Return the size of the memory buffer in \var{ptrptr} for segment ! \var{segment}. \code{*\var{ptrptr}} is set to the memory buffer. \end{ctypedesc} From fdrake@users.sourceforge.net Tue Nov 5 22:19:47 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 05 Nov 2002 14:19:47 -0800 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv23762 Modified Files: newtypes.tex Log Message: Minor cleanups, markup. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** newtypes.tex 3 Nov 2002 02:56:27 -0000 1.17 --- newtypes.tex 5 Nov 2002 22:19:45 -0000 1.18 *************** *** 1503,1508 **** \begin{ctypedesc}[getcharbufferproc]{int (*getcharbufferproc) (PyObject *self, int segment, const char **ptrptr)} ! Return the size of the memory buffer in ptrptr at the segment index. ! \code{\var{ptrptr}} is set to the memory buffer. \end{ctypedesc} --- 1503,1508 ---- \begin{ctypedesc}[getcharbufferproc]{int (*getcharbufferproc) (PyObject *self, int segment, const char **ptrptr)} ! Return the size of the memory buffer in \var{ptrptr} for segment ! \var{segment}. \code{*\var{ptrptr}} is set to the memory buffer. \end{ctypedesc} From nnorwitz@users.sourceforge.net Tue Nov 5 22:38:00 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 05 Nov 2002 14:38:00 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib tkinter.tex,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv30773/Doc/lib Modified Files: tkinter.tex Log Message: Fix minor typos Index: tkinter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tkinter.tex 5 Nov 2002 22:11:50 -0000 1.17 --- tkinter.tex 5 Nov 2002 22:37:58 -0000 1.18 *************** *** 895,903 **** \code{data} option (other options are available as well). ! The image object can then be used whereever an \code{image} option is supported by some widget (e.g. labels, buttons, menus). In these cases, Tk will not keep a reference to the image. When the last Python reference to the image object is deleted, the image data is deleted as ! well, and Tk will display an empty box wheerever the image was used. \section{\module{Tix} --- --- 895,903 ---- \code{data} option (other options are available as well). ! The image object can then be used where ever an \code{image} option is supported by some widget (e.g. labels, buttons, menus). In these cases, Tk will not keep a reference to the image. When the last Python reference to the image object is deleted, the image data is deleted as ! well, and Tk will display an empty box where ever the image was used. \section{\module{Tix} --- From bwarsaw@users.sourceforge.net Tue Nov 5 22:40:23 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 05 Nov 2002 14:40:23 -0800 Subject: [Python-checkins] python/dist/src/Lib pdb.py,1.57,1.58 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv31684 Modified Files: pdb.py Log Message: Implement a `pp' command, which is like `p' except that it pretty-prints the value of its expression argument. Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** pdb.py 10 Sep 2002 21:57:14 -0000 1.57 --- pdb.py 5 Nov 2002 22:40:20 -0000 1.58 *************** *** 12,15 **** --- 12,16 ---- import os import re + import pprint # Create a custom safe Repr instance and increase its maxstring. *************** *** 533,549 **** do_rv = do_retval ! def do_p(self, arg): try: ! value = eval(arg, self.curframe.f_globals, ! self.curframe.f_locals) except: t, v = sys.exc_info()[:2] ! if type(t) == type(''): exc_type_name = t else: exc_type_name = t.__name__ print '***', exc_type_name + ':', `v` ! return ! print `value` def do_list(self, arg): --- 534,560 ---- do_rv = do_retval ! def _getval(self, arg): try: ! return eval(arg, self.curframe.f_globals, ! self.curframe.f_locals) except: t, v = sys.exc_info()[:2] ! if isinstance(t, str): exc_type_name = t else: exc_type_name = t.__name__ print '***', exc_type_name + ':', `v` ! raise ! def do_p(self, arg): ! try: ! print repr(self._getval(arg)) ! except: ! pass ! ! def do_pp(self, arg): ! try: ! pprint.pprint(self._getval(arg)) ! except: ! pass def do_list(self, arg): *************** *** 817,820 **** --- 828,835 ---- print """p expression Print the value of the expression.""" + + def help_pp(self): + print """pp expression + Pretty-print the value of the expression.""" def help_exec(self): From bwarsaw@users.sourceforge.net Tue Nov 5 22:41:18 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 05 Nov 2002 14:41:18 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libpdb.tex,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv32123 Modified Files: libpdb.tex Log Message: Document the new `pp' command. Index: libpdb.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpdb.tex,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** libpdb.tex 13 Sep 2001 16:56:43 -0000 1.32 --- libpdb.tex 5 Nov 2002 22:41:16 -0000 1.33 *************** *** 274,277 **** --- 274,282 ---- command --- this executes the Python \keyword{print} statement.) + \item[pp \var{expression}] + + Like the \samp{p} command, except the value of the exception is + pretty-printed using the \module{pprint} module. + \item[alias \optional{\var{name} \optional{command}}] From bwarsaw@users.sourceforge.net Tue Nov 5 22:41:36 2002 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 05 Nov 2002 14:41:36 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.510,1.511 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv32234 Modified Files: NEWS Log Message: Add an entry for pdb's new `pp' command. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.510 retrieving revision 1.511 diff -C2 -d -r1.510 -r1.511 *** NEWS 5 Nov 2002 20:38:55 -0000 1.510 --- NEWS 5 Nov 2002 22:41:33 -0000 1.511 *************** *** 546,549 **** --- 546,552 ---- functions, and types for sequential (de)compression. + - New pdb command `pp' which is like `p' except that it pretty-prints + the value of its expression argument. + Tools/Demos ----------- From nnorwitz@users.sourceforge.net Tue Nov 5 22:41:40 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 05 Nov 2002 14:41:40 -0800 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.139,2.140 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv32254/Objects Modified Files: listobject.c Log Message: Use PyOS_snprintf() instead of sprintf and wrap the long line Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.139 retrieving revision 2.140 diff -C2 -d -r2.139 -r2.140 *** listobject.c 5 Nov 2002 17:38:05 -0000 2.139 --- listobject.c 5 Nov 2002 22:41:37 -0000 2.140 *************** *** 458,463 **** else { char msg[256]; ! sprintf(msg, "must assign sequence (not \"%.200s\") to slice", ! v->ob_type->tp_name); v_as_SF = PySequence_Fast(v, msg); if(v_as_SF == NULL) --- 458,465 ---- else { char msg[256]; ! PyOS_snprintf(msg, sizeof(msg), ! "must assign sequence" ! " (not \"%.200s\") to slice", ! v->ob_type->tp_name); v_as_SF = PySequence_Fast(v, msg); if(v_as_SF == NULL) From nnorwitz@users.sourceforge.net Tue Nov 5 22:46:42 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 05 Nov 2002 14:46:42 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib tkinter.tex,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv1889/Doc/lib Modified Files: tkinter.tex Log Message: Whoops, fix the typo correctly this time Index: tkinter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tkinter.tex 5 Nov 2002 22:37:58 -0000 1.18 --- tkinter.tex 5 Nov 2002 22:46:39 -0000 1.19 *************** *** 895,903 **** \code{data} option (other options are available as well). ! The image object can then be used where ever an \code{image} option is supported by some widget (e.g. labels, buttons, menus). In these cases, Tk will not keep a reference to the image. When the last Python reference to the image object is deleted, the image data is deleted as ! well, and Tk will display an empty box where ever the image was used. \section{\module{Tix} --- --- 895,903 ---- \code{data} option (other options are available as well). ! The image object can then be used wherever an \code{image} option is supported by some widget (e.g. labels, buttons, menus). In these cases, Tk will not keep a reference to the image. When the last Python reference to the image object is deleted, the image data is deleted as ! well, and Tk will display an empty box wherever the image was used. \section{\module{Tix} --- From loewis@users.sourceforge.net Tue Nov 5 23:01:53 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 05 Nov 2002 15:01:53 -0800 Subject: [Python-checkins] python/dist/src/Tools/idle MANIFEST.in,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv11423 Added Files: MANIFEST.in Log Message: Support sdist. --- NEW FILE: MANIFEST.in --- include *.txt include idle include MANIFEST.in include MANIFEST From nnorwitz@users.sourceforge.net Tue Nov 5 23:55:30 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 05 Nov 2002 15:55:30 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libbz2.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv3259/lib Modified Files: libbz2.tex Log Message: Fix minor wording and 2 typos Index: libbz2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbz2.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libbz2.tex 5 Nov 2002 17:54:02 -0000 1.2 --- libbz2.tex 5 Nov 2002 23:55:27 -0000 1.3 *************** *** 24,28 **** \item \class{BZ2File} class offers an optimized line iteration using the readahead algorithm borrowed from file objects; ! \item \class{BZ2File} class developed inheriting builtin file type (\code{issubclass(BZ2File, file)} is \code{True}); \item Sequential (de)compression supported by \class{BZ2Compressor} and --- 24,28 ---- \item \class{BZ2File} class offers an optimized line iteration using the readahead algorithm borrowed from file objects; ! \item \class{BZ2File} class inherits from the builtin file type (\code{issubclass(BZ2File, file)} is \code{True}); \item Sequential (de)compression supported by \class{BZ2Compressor} and *************** *** 88,92 **** \begin{methoddesc}[BZ2File]{\_\_iter\_\_}{} ! Iterate trough the file lines. Iteration optimization is implemented using the same readahead algorithm available in \class{file} objects. \end{methoddesc} --- 88,92 ---- \begin{methoddesc}[BZ2File]{\_\_iter\_\_}{} ! Iterate through the file lines. Iteration optimization is implemented using the same readahead algorithm available in \class{file} objects. \end{methoddesc} *************** *** 162,166 **** \subsection{One-shot (de)compression} ! One-shot compression and decompression is provided trough the \function{compress()} and \function{decompress()} functions. --- 162,166 ---- \subsection{One-shot (de)compression} ! One-shot compression and decompression is provided through the \function{compress()} and \function{decompress()} functions. From goodger@users.sourceforge.net Wed Nov 6 05:38:58 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Tue, 05 Nov 2002 21:38:58 -0800 Subject: [Python-checkins] python/nondist/peps pep-0001.txt,1.38,1.39 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv5253 Modified Files: pep-0001.txt Log Message: updated Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** pep-0001.txt 26 Aug 2002 16:19:25 -0000 1.38 --- pep-0001.txt 6 Nov 2002 05:38:56 -0000 1.39 *************** *** 43,48 **** PEP Work Flow ! The PEP editor, Barry Warsaw , assigns numbers ! for each PEP and changes its status. The PEP process begins with a new idea for Python. It is highly --- 43,49 ---- PEP Work Flow ! The PEP editors assign PEP numbers and change their status. The ! current PEP editors are David Goodger and Barry Warsaw. Please ! send all PEP-related email to . The PEP process begins with a new idea for Python. It is highly *************** *** 232,236 **** Author: * Discussions-To: ! Status: Type: * Content-Type: --- 233,238 ---- Author: * Discussions-To: ! Status: Type: * Content-Type: From goodger@users.sourceforge.net Wed Nov 6 05:40:41 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Tue, 05 Nov 2002 21:40:41 -0800 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.217,1.218 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv5748 Modified Files: pep-0000.txt Log Message: Officially take office. Reject PEP 270. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.217 retrieving revision 1.218 diff -C2 -d -r1.217 -r1.218 *** pep-0000.txt 31 Oct 2002 01:35:08 -0000 1.217 --- pep-0000.txt 6 Nov 2002 05:40:39 -0000 1.218 *************** *** 3,7 **** Version: $Revision$ Last-Modified: $Date$ ! Author: Barry A. Warsaw Status: Active Type: Informational --- 3,8 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: David Goodger , ! Barry A. Warsaw Status: Active Type: Informational *************** *** 29,33 **** Meta-PEPs (PEPs about PEPs or Process) ! I 0 Index of Python Enhancement Proposals Warsaw I 1 PEP Guidelines Warsaw, Hylton I 2 Procedure for Adding New Modules Faassen --- 30,34 ---- Meta-PEPs (PEPs about PEPs or Process) ! I 0 Index of Python Enhancement Proposals Goodger, Warsaw I 1 PEP Guidelines Warsaw, Hylton I 2 Procedure for Adding New Modules Faassen *************** *** 82,86 **** S 268 Extended HTTP functionality and WebDAV Stein S 269 Pgen Module for Python Riehl - S 270 uniq method for list objects Petrone S 273 Import Modules from Zip Archives Ahlstrom S 274 Dict Comprehensions Warsaw --- 83,86 ---- *************** *** 161,164 **** --- 161,165 ---- SR 259 Omit printing newline after newline van Rossum SD 262 Database of Installed Python Packages Kuchling + SR 270 uniq method for list objects Petrone SR 271 Prefixing sys.path by command line option Giacometti SD 288 Generators Attributes and Exceptions Hettinger *************** *** 262,266 **** S 268 Extended HTTP functionality and WebDAV Stein S 269 Pgen Module for Python Riehl ! S 270 uniq method for list objects Petrone SR 271 Prefixing sys.path by command line option Giacometti IF 272 API for Block Encryption Algorithms v1.0 Kuchling --- 263,267 ---- S 268 Extended HTTP functionality and WebDAV Stein S 269 Pgen Module for Python Riehl ! SR 270 uniq method for list objects Petrone SR 271 Prefixing sys.path by command line option Giacometti IF 272 API for Block Encryption Algorithms v1.0 Kuchling From goodger@users.sourceforge.net Wed Nov 6 05:41:34 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Tue, 05 Nov 2002 21:41:34 -0800 Subject: [Python-checkins] python/nondist/peps pep-0270.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv5974 Modified Files: pep-0270.txt Log Message: Withdrawn by author; marked rejected. Index: pep-0270.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0270.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0270.txt 7 Sep 2001 22:40:38 -0000 1.1 --- pep-0270.txt 6 Nov 2002 05:41:32 -0000 1.2 *************** *** 4,12 **** Last-Modified: $Date$ Author: jp@demonseed.net (Jason Petrone) ! Status: Draft Type: Standards Track Created: 21-Aug-2001 Python-Version: 2.2 Post-History: --- 4,29 ---- Last-Modified: $Date$ Author: jp@demonseed.net (Jason Petrone) ! Status: Rejected Type: Standards Track Created: 21-Aug-2001 Python-Version: 2.2 Post-History: + + + Notice + + This PEP is withdrawn by the author. He writes: + + Removing duplicate elements from a list is a common task, but + there are only two reasons I can see for making it a built-in. + The first is if it could be done much faster, which isn't the + case. The second is if it makes it significantly easier to + write code. The introduction of sets.py eliminates this + situation since creating a sequence without duplicates is just + a matter of choosing a different data structure: a set instead + of a list. + + As described in PEP 218, sets are being added to the standard + library for Python 2.3. From bckfnn@users.sourceforge.net Wed Nov 6 11:37:59 2002 From: bckfnn@users.sourceforge.net (bckfnn@users.sourceforge.net) Date: Wed, 06 Nov 2002 03:37:59 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_atexit.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12033 Modified Files: test_atexit.py Log Message: Make the test pass for jython where there are no sys.executable. Index: test_atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_atexit.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_atexit.py 30 Jul 2002 23:26:01 -0000 1.8 --- test_atexit.py 6 Nov 2002 11:37:57 -0000 1.9 *************** *** 1,8 **** # Test the atexit module. ! from test.test_support import TESTFN, vereq import atexit from os import popen, unlink import sys input = """\ import atexit --- 1,12 ---- # Test the atexit module. ! from test.test_support import TESTFN, vereq, is_jython import atexit from os import popen, unlink import sys + executable = sys.executable + if is_jython: + executable = "jython" + input = """\ import atexit *************** *** 24,28 **** f.close() ! p = popen("%s %s" % (sys.executable, fname)) output = p.read() p.close() --- 28,32 ---- f.close() ! p = popen("%s %s" % (executable, fname)) output = p.read() p.close() *************** *** 52,56 **** f.close() ! p = popen("%s %s" % (sys.executable, fname)) output = p.read() p.close() --- 56,60 ---- f.close() ! p = popen("%s %s" % (executable, fname)) output = p.read() p.close() From bckfnn@users.sourceforge.net Wed Nov 6 11:41:51 2002 From: bckfnn@users.sourceforge.net (bckfnn@users.sourceforge.net) Date: Wed, 06 Nov 2002 03:41:51 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_atexit.py,1.3.24.3,1.3.24.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14524 Modified Files: Tag: release22-maint test_atexit.py Log Message: Backport 1.8->1.9: Make the test pass for jython where there are no sys.executable. Index: test_atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_atexit.py,v retrieving revision 1.3.24.3 retrieving revision 1.3.24.4 diff -C2 -d -r1.3.24.3 -r1.3.24.4 *** test_atexit.py 10 Oct 2002 20:46:33 -0000 1.3.24.3 --- test_atexit.py 6 Nov 2002 11:41:48 -0000 1.3.24.4 *************** *** 1,8 **** # Test the atexit module. ! from test_support import TESTFN, vereq import atexit from os import popen, unlink import sys input = """\ import atexit --- 1,12 ---- # Test the atexit module. ! from test_support import TESTFN, vereq, is_jython import atexit from os import popen, unlink import sys + executable = sys.executable + if is_jython: + executable = "jython" + input = """\ import atexit *************** *** 24,28 **** f.close() ! p = popen("%s %s" % (sys.executable, fname)) output = p.read() p.close() --- 28,32 ---- f.close() ! p = popen("%s %s" % (executable, fname)) output = p.read() p.close() *************** *** 52,56 **** f.close() ! p = popen("%s %s" % (sys.executable, fname)) output = p.read() p.close() --- 56,60 ---- f.close() ! p = popen("%s %s" % (executable, fname)) output = p.read() p.close() From bckfnn@users.sourceforge.net Wed Nov 6 11:45:17 2002 From: bckfnn@users.sourceforge.net (bckfnn@users.sourceforge.net) Date: Wed, 06 Nov 2002 03:45:17 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_traceback.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16162 Modified Files: test_traceback.py Log Message: Skip the test_nocaret test when running as jython. Jython happens to add a caret in this case too. Index: test_traceback.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_traceback.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_traceback.py 30 Jul 2002 23:27:12 -0000 1.6 --- test_traceback.py 6 Nov 2002 11:45:15 -0000 1.7 *************** *** 2,6 **** import unittest ! from test.test_support import run_unittest import traceback --- 2,6 ---- import unittest ! from test.test_support import run_unittest, is_jython import traceback *************** *** 33,36 **** --- 33,39 ---- def test_nocaret(self): + if is_jython: + # jython adds a caret in this case (why shouldn't it?) + return err = self.get_exception_format(self.syntax_error_without_caret, SyntaxError) From bckfnn@users.sourceforge.net Wed Nov 6 11:45:54 2002 From: bckfnn@users.sourceforge.net (bckfnn@users.sourceforge.net) Date: Wed, 06 Nov 2002 03:45:54 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_traceback.py,1.4,1.4.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16836 Modified Files: Tag: release22-maint test_traceback.py Log Message: Backport 1.6->1.7: Skip the test_nocaret test when running as jython. Jython happens to add a caret in this case too. Index: test_traceback.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_traceback.py,v retrieving revision 1.4 retrieving revision 1.4.12.1 diff -C2 -d -r1.4 -r1.4.12.1 *** test_traceback.py 20 Sep 2001 21:33:42 -0000 1.4 --- test_traceback.py 6 Nov 2002 11:45:51 -0000 1.4.12.1 *************** *** 2,6 **** import unittest ! from test_support import run_unittest import traceback --- 2,6 ---- import unittest ! from test_support import run_unittest, is_jython import traceback *************** *** 33,36 **** --- 33,39 ---- def test_nocaret(self): + if is_jython: + # jython adds a caret in this case (why shouldn't it?) + return err = self.get_exception_format(self.syntax_error_without_caret, SyntaxError) From jackjansen@users.sourceforge.net Wed Nov 6 13:33:35 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 06 Nov 2002 05:33:35 -0800 Subject: [Python-checkins] python/dist/src configure,1.351,1.352 configure.in,1.362,1.363 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv28490 Modified Files: configure configure.in Log Message: Fix for bug 631247: configure should test the build directory for being on a case-insensitive filesystem, not the source directory. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.351 retrieving revision 1.352 diff -C2 -d -r1.351 -r1.352 *** configure 2 Nov 2002 16:58:03 -0000 1.351 --- configure 6 Nov 2002 13:33:30 -0000 1.352 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.361 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.362 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 3000,3004 **** echo "$as_me:$LINENO: checking for case-insensitive build directory" >&5 echo $ECHO_N "checking for case-insensitive build directory... $ECHO_C" >&6 ! if test -d "${srcdir}/python" then echo "$as_me:$LINENO: result: yes" >&5 --- 3000,3008 ---- echo "$as_me:$LINENO: checking for case-insensitive build directory" >&5 echo $ECHO_N "checking for case-insensitive build directory... $ECHO_C" >&6 ! if test ! -d CaseSensitiveTestDir; then ! mkdir CaseSensitiveTestDir ! fi ! ! if test -d casesensitivetestdir then echo "$as_me:$LINENO: result: yes" >&5 *************** *** 3010,3013 **** --- 3014,3018 ---- BUILDEXEEXT=$EXEEXT fi + rmdir CaseSensitiveTestDir case $MACHDEP in Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.362 retrieving revision 1.363 diff -C2 -d -r1.362 -r1.363 *** configure.in 2 Nov 2002 16:58:05 -0000 1.362 --- configure.in 6 Nov 2002 13:33:32 -0000 1.363 *************** *** 254,258 **** AC_SUBST(BUILDEXEEXT) AC_MSG_CHECKING(for case-insensitive build directory) ! if test -d "${srcdir}/python" then AC_MSG_RESULT(yes) --- 254,262 ---- AC_SUBST(BUILDEXEEXT) AC_MSG_CHECKING(for case-insensitive build directory) ! if test ! -d CaseSensitiveTestDir; then ! mkdir CaseSensitiveTestDir ! fi ! ! if test -d casesensitivetestdir then AC_MSG_RESULT(yes) *************** *** 262,265 **** --- 266,270 ---- BUILDEXEEXT=$EXEEXT fi + rmdir CaseSensitiveTestDir case $MACHDEP in From niemeyer@users.sourceforge.net Wed Nov 6 14:06:55 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Wed, 06 Nov 2002 06:06:55 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.511,1.512 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv9767/Misc Modified Files: NEWS Log Message: Fixed bug #470582, using a modified version of patch #527371, from Greg Chapman. * Modules/_sre.c (lastmark_restore): New function, implementing algorithm to restore a state to a given lastmark. In addition to the similar algorithm used in a few places of SRE_MATCH, restore lastindex when restoring lastmark. (SRE_MATCH): Replace lastmark inline restoring by lastmark_restore(), function. Also include it where missing. In SRE_OP_MARK, set lastindex only if i > lastmark. * Lib/test/re_tests.py * Lib/test/test_sre.py Included regression tests for the fixed bugs. * Misc/NEWS Mention fixes. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.511 retrieving revision 1.512 diff -C2 -d -r1.511 -r1.512 *** NEWS 5 Nov 2002 22:41:33 -0000 1.511 --- NEWS 6 Nov 2002 14:06:53 -0000 1.512 *************** *** 353,356 **** --- 353,363 ---- interpreter was compiled. + - Fixed bug #470582: sre module would return a tuple (None, 'a', 'ab') + when applying the regular expression '^((a)c)?(ab)$' on 'ab'. It now + returns (None, None, 'ab'), as expected. Also fixed handling of + lastindex/lastgroup match attributes in a similar cases. For example, + when running the expression r'(a)(b)?b' over 'ab', lastindex must be + 1, not 2. + Library ------- From niemeyer@users.sourceforge.net Wed Nov 6 14:06:55 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Wed, 06 Nov 2002 06:06:55 -0800 Subject: [Python-checkins] python/dist/src/Lib/test re_tests.py,1.30,1.31 test_sre.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv9767/Lib/test Modified Files: re_tests.py test_sre.py Log Message: Fixed bug #470582, using a modified version of patch #527371, from Greg Chapman. * Modules/_sre.c (lastmark_restore): New function, implementing algorithm to restore a state to a given lastmark. In addition to the similar algorithm used in a few places of SRE_MATCH, restore lastindex when restoring lastmark. (SRE_MATCH): Replace lastmark inline restoring by lastmark_restore(), function. Also include it where missing. In SRE_OP_MARK, set lastindex only if i > lastmark. * Lib/test/re_tests.py * Lib/test/test_sre.py Included regression tests for the fixed bugs. * Misc/NEWS Mention fixes. Index: re_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/re_tests.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** re_tests.py 9 Dec 2001 16:13:15 -0000 1.30 --- re_tests.py 6 Nov 2002 14:06:52 -0000 1.31 *************** *** 647,650 **** --- 647,652 ---- # bug 490573: minimizing repeat problem (r'^a*?$', 'foo', FAIL), + # bug 470582: nested groups problem + (r'^((a)c)?(ab)$', 'ab', SUCCEED, 'g1+"-"+g2+"-"+g3', 'None-None-ab'), ] Index: test_sre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sre.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** test_sre.py 30 Jul 2002 23:27:12 -0000 1.37 --- test_sre.py 6 Nov 2002 14:06:52 -0000 1.38 *************** *** 79,82 **** --- 79,87 ---- test(r"""sre.match(r'(a)|(b)', 'b').span(1)""", (-1, -1)) + # bug described in patch 527371 + test(r"""sre.match(r'(a)?a','a').lastindex""", None) + test(r"""sre.match(r'(a)(b)?b','ab').lastindex""", 1) + test(r"""sre.match(r'(?Pa)(?Pb)?b','ab').lastgroup""", 'a') + if verbose: print 'Running tests on sre.sub' From niemeyer@users.sourceforge.net Wed Nov 6 14:06:55 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Wed, 06 Nov 2002 06:06:55 -0800 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.83,2.84 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv9767/Modules Modified Files: _sre.c Log Message: Fixed bug #470582, using a modified version of patch #527371, from Greg Chapman. * Modules/_sre.c (lastmark_restore): New function, implementing algorithm to restore a state to a given lastmark. In addition to the similar algorithm used in a few places of SRE_MATCH, restore lastindex when restoring lastmark. (SRE_MATCH): Replace lastmark inline restoring by lastmark_restore(), function. Also include it where missing. In SRE_OP_MARK, set lastindex only if i > lastmark. * Lib/test/re_tests.py * Lib/test/test_sre.py Included regression tests for the fixed bugs. * Misc/NEWS Mention fixes. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.83 retrieving revision 2.84 diff -C2 -d -r2.83 -r2.84 *** _sre.c 31 Jul 2002 09:54:24 -0000 2.83 --- _sre.c 6 Nov 2002 14:06:53 -0000 2.84 *************** *** 354,357 **** --- 354,369 ---- } + void lastmark_restore(SRE_STATE *state, int lastmark) + { + if (state->lastmark > lastmark) { + memset( + state->mark + lastmark + 1, 0, + (state->lastmark - lastmark) * sizeof(void*) + ); + state->lastmark = lastmark; + state->lastindex = (lastmark == 0) ? -1 : (lastmark-1)/2+1; + } + } + /* generate 8-bit version */ *************** *** 861,868 **** TRACE(("|%p|%p|MARK %d\n", pattern, ptr, pattern[0])); i = pattern[0]; ! if (i & 1) ! state->lastindex = i/2 + 1; ! if (i > state->lastmark) state->lastmark = i; state->mark[i] = ptr; pattern++; --- 873,881 ---- TRACE(("|%p|%p|MARK %d\n", pattern, ptr, pattern[0])); i = pattern[0]; ! if (i > state->lastmark) { state->lastmark = i; + if (i & 1) + state->lastindex = i/2 + 1; + } state->mark[i] = ptr; pattern++; *************** *** 921,931 **** if (i) return i; ! if (state->lastmark > lastmark) { ! memset( ! state->mark + lastmark + 1, 0, ! (state->lastmark - lastmark) * sizeof(void*) ! ); ! state->lastmark = lastmark; ! } } return 0; --- 934,938 ---- if (i) return i; ! lastmark_restore(state, lastmark); } return 0; *************** *** 998,1008 **** ptr--; count--; ! if (state->lastmark > lastmark) { ! memset( ! state->mark + lastmark + 1, 0, ! (state->lastmark - lastmark) * sizeof(void*) ! ); ! state->lastmark = lastmark; ! } } } --- 1005,1009 ---- ptr--; count--; ! lastmark_restore(state, lastmark); } } *************** *** 1072,1078 **** return i; i = mark_restore(state, 0, lastmark); - state->lastmark = lastmark; if (i < 0) return i; rp->count = count - 1; state->ptr = ptr; --- 1073,1079 ---- return i; i = mark_restore(state, 0, lastmark); if (i < 0) return i; + lastmark_restore(state, lastmark); rp->count = count - 1; state->ptr = ptr; From akuchling@users.sourceforge.net Wed Nov 6 14:15:39 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 06 Nov 2002 06:15:39 -0800 Subject: [Python-checkins] python/dist/src/Modules _cursesmodule.c,2.69,2.70 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13699 Modified Files: _cursesmodule.c Log Message: [Patch #633635 from David M. Cooke] Make keyname raise ValueError if passed -1, avoiding a segfault Make getkey() match the docs and raise an exception in nodelay mode The return type of getch() is int, not chtype Index: _cursesmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_cursesmodule.c,v retrieving revision 2.69 retrieving revision 2.70 diff -C2 -d -r2.69 -r2.70 *** _cursesmodule.c 30 Oct 2002 21:08:34 -0000 2.69 --- _cursesmodule.c 6 Nov 2002 14:15:36 -0000 2.70 *************** *** 733,737 **** { int x, y; ! chtype rtn; switch (PyTuple_Size(args)) { --- 733,737 ---- { int x, y; ! int rtn; switch (PyTuple_Size(args)) { *************** *** 759,763 **** { int x, y; ! chtype rtn; switch (PyTuple_Size(args)) { --- 759,763 ---- { int x, y; ! int rtn; switch (PyTuple_Size(args)) { *************** *** 778,782 **** return NULL; } ! if (rtn<=255) return Py_BuildValue("c", rtn); else --- 778,786 ---- return NULL; } ! if (rtn == ERR) { ! /* getch() returns ERR in nodelay mode */ ! PyErr_SetString(PyCursesError, "no input"); ! return NULL; ! } else if (rtn<=255) return Py_BuildValue("c", rtn); else *************** *** 1954,1957 **** --- 1958,1965 ---- if (!PyArg_ParseTuple(args,"i",&ch)) return NULL; + if (ch < 0) { + PyErr_SetString(PyExc_ValueError, "invalid key number"); + return NULL; + } knp = keyname(ch); *************** *** 2348,2352 **** { PyObject *temp; ! chtype ch; PyCursesInitialised --- 2356,2360 ---- { PyObject *temp; ! int ch; PyCursesInitialised *************** *** 2355,2361 **** if (PyInt_Check(temp)) ! ch = (chtype) PyInt_AsLong(temp); else if (PyString_Check(temp)) ! ch = (chtype) *PyString_AsString(temp); else { PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int"); --- 2363,2369 ---- if (PyInt_Check(temp)) ! ch = (int) PyInt_AsLong(temp); else if (PyString_Check(temp)) ! ch = (int) *PyString_AsString(temp); else { PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int"); From akuchling@users.sourceforge.net Wed Nov 6 14:17:24 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 06 Nov 2002 06:17:24 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libcurses.tex,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv14725 Modified Files: libcurses.tex Log Message: [Patch #633635 from David M. Cooke] Make docs accurate; getch() in nodelay mode returns -1 Index: libcurses.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcurses.tex,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** libcurses.tex 27 Jun 2002 18:30:34 -0000 1.39 --- libcurses.tex 6 Nov 2002 14:17:21 -0000 1.40 *************** *** 702,706 **** Get a character. Note that the integer returned does \emph{not} have to be in \ASCII{} range: function keys, keypad keys and so on return numbers ! higher than 256. In no-delay mode, an exception is raised if there is no input. \end{methoddesc} --- 702,706 ---- Get a character. Note that the integer returned does \emph{not} have to be in \ASCII{} range: function keys, keypad keys and so on return numbers ! higher than 256. In no-delay mode, -1 is returned if there is no input. \end{methoddesc} From akuchling@users.sourceforge.net Wed Nov 6 14:34:53 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 06 Nov 2002 06:34:53 -0800 Subject: [Python-checkins] python/dist/src/Doc/inst inst.tex,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/inst In directory usw-pr-cvs1:/tmp/cvs-serv23969 Modified Files: inst.tex Log Message: Old change (probably suggested by Jason Tishler) The GNU/Windows compiler is now called MinGW Index: inst.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/inst/inst.tex,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** inst.tex 31 Oct 2002 20:46:20 -0000 1.42 --- inst.tex 6 Nov 2002 14:34:50 -0000 1.43 *************** *** 990,1005 **** ! \subsubsection{GNU C / Cygwin / MinGW32} This section describes the necessary steps to use Distutils with the ! GNU C/\Cpp{} compilers in their Cygwin and MinGW32 distributions.\footnote{Check \url{http://sources.redhat.com/cygwin/} and \url{http://www.mingw.org/} for more information} ! \XXX{For a Python which was built with Cygwin, all should work without ! any of these following steps.} ! ! These compilers also require some special libraries. This task is more complex than for Borland's \Cpp, because there is no program to convert the library. --- 990,1004 ---- ! \subsubsection{GNU C / Cygwin / MinGW} This section describes the necessary steps to use Distutils with the ! GNU C/\Cpp{} compilers in their Cygwin and MinGW distributions.\footnote{Check \url{http://sources.redhat.com/cygwin/} and \url{http://www.mingw.org/} for more information} + For a Python interpreter that was built with Cygwin, everything should + work without any of these following steps. ! These compilers require some special libraries. This task is more complex than for Borland's \Cpp, because there is no program to convert the library. *************** *** 1039,1043 **** and for Cygwin in no-cygwin mode\footnote{Then you have no \POSIX{} emulation available, but you also don't need ! \file{cygwin1.dll}.} or for MinGW32 type: \begin{verbatim} --- 1038,1042 ---- and for Cygwin in no-cygwin mode\footnote{Then you have no \POSIX{} emulation available, but you also don't need ! \file{cygwin1.dll}.} or for MinGW type: \begin{verbatim} *************** *** 1051,1060 **** \begin{seealso} \seetitle[http://www.zope.org/Members/als/tips/win32_mingw_modules] ! {Building Python modules on MS Windows platform with MinGW32} ! {Information about building the required libraries for the MinGW32 environment.} \seeurl{http://pyopengl.sourceforge.net/ftp/win32-stuff/} ! {Converted import libraries in Cygwin/MinGW32 and Borland format, and a script to create the registry entries needed for Distutils to locate the built Python.} --- 1050,1059 ---- \begin{seealso} \seetitle[http://www.zope.org/Members/als/tips/win32_mingw_modules] ! {Building Python modules on MS Windows platform with MinGW} ! {Information about building the required libraries for the MinGW environment.} \seeurl{http://pyopengl.sourceforge.net/ftp/win32-stuff/} ! {Converted import libraries in Cygwin/MinGW and Borland format, and a script to create the registry entries needed for Distutils to locate the built Python.} From akuchling@users.sourceforge.net Wed Nov 6 14:51:22 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 06 Nov 2002 06:51:22 -0800 Subject: [Python-checkins] python/dist/src/Lib ConfigParser.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv31881 Modified Files: ConfigParser.py Log Message: Fix docstring typos Index: ConfigParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** ConfigParser.py 25 Oct 2002 21:52:00 -0000 1.50 --- ConfigParser.py 6 Nov 2002 14:51:20 -0000 1.51 *************** *** 386,392 **** indicated by a name in square brackets (`[]'), plus key/value options lines, indicated by `name: value' format lines. ! Continuation are represented by an embedded newline then leading whitespace. Blank lines, lines beginning with a '#', ! and just about everything else is ignored. """ cursect = None # None, or a dictionary --- 386,392 ---- indicated by a name in square brackets (`[]'), plus key/value options lines, indicated by `name: value' format lines. ! Continuations are represented by an embedded newline then leading whitespace. Blank lines, lines beginning with a '#', ! and just about everything else are ignored. """ cursect = None # None, or a dictionary From mwh@users.sourceforge.net Wed Nov 6 15:17:34 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 06 Nov 2002 07:17:34 -0800 Subject: [Python-checkins] python/dist/src/Objects sliceobject.c,2.19,2.20 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv11986/Objects Modified Files: sliceobject.c Log Message: Handle really big steps in extended slices. Fixes a test failure on 64 bit platforms (I hope). Index: sliceobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/sliceobject.c,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** sliceobject.c 5 Nov 2002 15:28:51 -0000 2.19 --- sliceobject.c 6 Nov 2002 15:17:31 -0000 2.20 *************** *** 122,130 **** } else { ! *step = PyInt_AsLong(r->step); ! if (*step == -1 && PyErr_Occurred()) { ! return -1; ! } ! else if (*step == 0) { PyErr_SetString(PyExc_ValueError, "slice step cannot be zero"); --- 122,127 ---- } else { ! if (!_PyEval_SliceIndex(r->step, step)) return -1; ! if (*step == 0) { PyErr_SetString(PyExc_ValueError, "slice step cannot be zero"); From mwh@users.sourceforge.net Wed Nov 6 15:17:34 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 06 Nov 2002 07:17:34 -0800 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.338,2.339 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv11986/Python Modified Files: ceval.c Log Message: Handle really big steps in extended slices. Fixes a test failure on 64 bit platforms (I hope). Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.338 retrieving revision 2.339 diff -C2 -d -r2.338 -r2.339 *** ceval.c 3 Oct 2002 09:53:11 -0000 2.338 --- ceval.c 6 Nov 2002 15:17:32 -0000 2.339 *************** *** 3508,3512 **** x = INT_MAX; else if (x < -INT_MAX) ! x = 0; *pi = x; } --- 3508,3512 ---- x = INT_MAX; else if (x < -INT_MAX) ! x = -INT_MAX; *pi = x; } From akuchling@users.sourceforge.net Wed Nov 6 15:40:08 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 06 Nov 2002 07:40:08 -0800 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23650 Modified Files: urllib2.py Log Message: Fix NameError exception ('name' undefined) Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** urllib2.py 11 Oct 2002 17:27:55 -0000 1.37 --- urllib2.py 6 Nov 2002 15:40:05 -0000 1.38 *************** *** 772,775 **** --- 772,776 ---- h.putheader('Host', sel_host or host) for args in self.parent.addheaders: + name, value = args if name not in req.headers: h.putheader(*args) From doerwalter@users.sourceforge.net Wed Nov 6 16:15:18 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 06 Nov 2002 08:15:18 -0800 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.93,2.94 longobject.c,1.143,1.144 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9395/Objects Modified Files: intobject.c longobject.c Log Message: Make int("...") return a long if an int would overflow. Also remove the 512 character limitation for int(u"...") and long(u"..."). This closes SF bug #629989. Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.93 retrieving revision 2.94 diff -C2 -d -r2.93 -r2.94 *** intobject.c 11 Sep 2002 19:00:52 -0000 2.93 --- intobject.c 6 Nov 2002 16:15:12 -0000 2.94 *************** *** 209,216 **** } else if (errno != 0) { ! PyOS_snprintf(buffer, sizeof(buffer), ! "int() literal too large: %.200s", s); ! PyErr_SetString(PyExc_ValueError, buffer); ! return NULL; } if (pend) --- 209,215 ---- } else if (errno != 0) { ! if (err_ovf("string/unicode conversion")) ! return NULL; ! return PyLong_FromString(s, pend, base); } if (pend) *************** *** 223,236 **** PyInt_FromUnicode(Py_UNICODE *s, int length, int base) { ! char buffer[256]; ! if (length >= sizeof(buffer)) { ! PyErr_SetString(PyExc_ValueError, ! "int() literal too large to convert"); return NULL; ! } ! if (PyUnicode_EncodeDecimal(s, length, buffer, NULL)) return NULL; ! return PyInt_FromString(buffer, NULL, base); } #endif --- 222,238 ---- PyInt_FromUnicode(Py_UNICODE *s, int length, int base) { ! PyObject *result; ! char *buffer = PyMem_MALLOC(length+1); ! if (buffer == NULL) return NULL; ! ! if (PyUnicode_EncodeDecimal(s, length, buffer, NULL)) { ! PyMem_FREE(buffer); return NULL; ! } ! result = PyInt_FromString(buffer, NULL, base); ! PyMem_FREE(buffer); ! return result; } #endif Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -d -r1.143 -r1.144 *** longobject.c 3 Sep 2002 20:10:45 -0000 1.143 --- longobject.c 6 Nov 2002 16:15:14 -0000 1.144 *************** *** 1124,1138 **** PyLong_FromUnicode(Py_UNICODE *u, int length, int base) { ! char buffer[256]; ! if (length >= sizeof(buffer)) { ! PyErr_SetString(PyExc_ValueError, ! "long() literal too large to convert"); ! return NULL; ! } ! if (PyUnicode_EncodeDecimal(u, length, buffer, NULL)) return NULL; ! return PyLong_FromString(buffer, NULL, base); } #endif --- 1124,1140 ---- PyLong_FromUnicode(Py_UNICODE *u, int length, int base) { ! PyObject *result; ! char *buffer = PyMem_MALLOC(length+1); ! if (buffer == NULL) return NULL; ! if (PyUnicode_EncodeDecimal(u, length, buffer, NULL)) { ! PyMem_FREE(buffer); ! return NULL; ! } ! result = PyLong_FromString(buffer, NULL, base); ! PyMem_FREE(buffer); ! return result; } #endif From doerwalter@users.sourceforge.net Wed Nov 6 16:15:44 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 06 Nov 2002 08:15:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_b1.py,1.55,1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv9395/Lib/test Modified Files: test_b1.py Log Message: Make int("...") return a long if an int would overflow. Also remove the 512 character limitation for int(u"...") and long(u"..."). This closes SF bug #629989. Index: test_b1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** test_b1.py 8 Oct 2002 21:01:07 -0000 1.55 --- test_b1.py 6 Nov 2002 16:15:10 -0000 1.56 *************** *** 436,443 **** try: int(s[1:]) ! except ValueError: ! pass ! else: ! raise TestFailed, "int(%s)" % `s[1:]` + " should raise ValueError" try: int(1e100) --- 436,441 ---- try: int(s[1:]) ! except: ! raise TestFailed, "int(%s)" % `s[1:]` + " should return long" try: int(1e100) *************** *** 469,475 **** else: raise TestFailed("int('53', 40) didn't raise ValueError") ! try: int('1' * 512) ! except ValueError: pass ! else: raise TestFailed("int('1' * 512) didn't raise ValueError") try: int(1, 12) --- 467,476 ---- else: raise TestFailed("int('53', 40) didn't raise ValueError") ! try: int('1' * 600) ! except: raise TestFailed("int('1' * 600) didn't return long") ! ! if have_unicode: ! try: int(unichr(0x661) * 600) ! except: raise TestFailed("int('\\u0661' * 600) didn't return long") try: int(1, 12) From doerwalter@users.sourceforge.net Wed Nov 6 16:53:46 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 06 Nov 2002 08:53:46 -0800 Subject: [Python-checkins] python/dist/src/Lib codecs.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32434/Lib Modified Files: codecs.py Log Message: Add next() and __iter__() methods to StreamReader, StreamReaderWriter and StreamRecoder. This closes SF bug #634246. Index: codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/codecs.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** codecs.py 2 Sep 2002 13:14:30 -0000 1.27 --- codecs.py 6 Nov 2002 16:53:44 -0000 1.28 *************** *** 300,303 **** --- 300,314 ---- pass + def next(self): + + """ Return the next decoded line from the input stream.""" + line = self.readline() + if line: + return line + raise StopIteration + + def __iter__(self): + return self + def __getattr__(self, name, getattr=getattr): *************** *** 352,355 **** --- 363,374 ---- return self.reader.readlines(sizehint) + def next(self): + + """ Return the next decoded line from the input stream.""" + return self.reader.next() + + def __iter__(self): + return self + def write(self, data): *************** *** 451,454 **** --- 470,481 ---- data, bytesencoded = self.encode(data, self.errors) return data.splitlines(1) + + def next(self): + + """ Return the next decoded line from the input stream.""" + return self.reader.next() + + def __iter__(self): + return self def write(self, data): From doerwalter@users.sourceforge.net Wed Nov 6 16:53:46 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 06 Nov 2002 08:53:46 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.512,1.513 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv32434/Misc Modified Files: NEWS Log Message: Add next() and __iter__() methods to StreamReader, StreamReaderWriter and StreamRecoder. This closes SF bug #634246. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.512 retrieving revision 1.513 diff -C2 -d -r1.512 -r1.513 *** NEWS 6 Nov 2002 14:06:53 -0000 1.512 --- NEWS 6 Nov 2002 16:53:44 -0000 1.513 *************** *** 363,366 **** --- 363,369 ---- ------- + - StreamReader, StreamReaderWriter and StreamRecoder in the codecs + modules are iterators now. + - gzip.py now handles files exceeding 2GB. Files over 4GB also work now (provided the OS supports it, and Python is configured with large From niemeyer@users.sourceforge.net Wed Nov 6 18:44:28 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Wed, 06 Nov 2002 10:44:28 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_rpm.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv20788/Lib/distutils/command Modified Files: bdist_rpm.py Log Message: Fixed bug "[#466200] ability to specify a 'verify' script". * Lib/distutils/command/bdist_rpm.py (bdist_rpm.initialize_options): Included verify_script attribute. (bdist_rpm.finalize_package_data): Ensure that verify_script is a filename. (bdist_rpm._make_spec_file): Included verify_script in script_options tuple. * Misc/NEWS Mention change. Index: bdist_rpm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_rpm.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** bdist_rpm.py 4 Nov 2002 13:33:07 -0000 1.33 --- bdist_rpm.py 6 Nov 2002 18:44:26 -0000 1.34 *************** *** 130,133 **** --- 130,134 ---- self.install_script = None self.clean_script = None + self.verify_script = None self.pre_install = None self.post_install = None *************** *** 209,212 **** --- 210,214 ---- self.ensure_filename('install_script') self.ensure_filename('clean_script') + self.ensure_filename('verify_script') self.ensure_filename('pre_install') self.ensure_filename('post_install') *************** *** 425,428 **** --- 427,431 ---- "--record=INSTALLED_FILES") % self.python), ('clean', 'clean_script', "rm -rf $RPM_BUILD_ROOT"), + ('verifyscript', 'verify_script', None), ('pre', 'pre_install', None), ('post', 'post_install', None), From niemeyer@users.sourceforge.net Wed Nov 6 18:44:29 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Wed, 06 Nov 2002 10:44:29 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.513,1.514 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv20788/Misc Modified Files: NEWS Log Message: Fixed bug "[#466200] ability to specify a 'verify' script". * Lib/distutils/command/bdist_rpm.py (bdist_rpm.initialize_options): Included verify_script attribute. (bdist_rpm.finalize_package_data): Ensure that verify_script is a filename. (bdist_rpm._make_spec_file): Included verify_script in script_options tuple. * Misc/NEWS Mention change. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.513 retrieving revision 1.514 diff -C2 -d -r1.513 -r1.514 *** NEWS 6 Nov 2002 16:53:44 -0000 1.513 --- NEWS 6 Nov 2002 18:44:26 -0000 1.514 *************** *** 356,360 **** when applying the regular expression '^((a)c)?(ab)$' on 'ab'. It now returns (None, None, 'ab'), as expected. Also fixed handling of ! lastindex/lastgroup match attributes in a similar cases. For example, when running the expression r'(a)(b)?b' over 'ab', lastindex must be 1, not 2. --- 356,360 ---- when applying the regular expression '^((a)c)?(ab)$' on 'ab'. It now returns (None, None, 'ab'), as expected. Also fixed handling of ! lastindex/lastgroup match attributes in similar cases. For example, when running the expression r'(a)(b)?b' over 'ab', lastindex must be 1, not 2. *************** *** 558,561 **** --- 558,565 ---- - New pdb command `pp' which is like `p' except that it pretty-prints the value of its expression argument. + + - Now bdist_rpm distutils command understands a verify_script option in + the config file, including the contents of the referred filename in + the "%verifyscript" section of the rpm spec file. Tools/Demos From gvanrossum@users.sourceforge.net Wed Nov 6 19:00:34 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 06 Nov 2002 11:00:34 -0800 Subject: [Python-checkins] python/dist/src/Tools/idle SearchDialogBase.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv30676 Modified Files: SearchDialogBase.py Log Message: Use column= rather than col=; with Tk 8.4 col= no longer works. [SF patch 634250 -- that was an IDLEFORK patch.] Index: SearchDialogBase.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/SearchDialogBase.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SearchDialogBase.py 11 Sep 2002 20:36:01 -0000 1.2 --- SearchDialogBase.py 6 Nov 2002 19:00:30 -0000 1.3 *************** *** 49,55 **** def make_entry(self, label, var): l = Label(self.top, text=label) ! l.grid(row=self.row, col=0, sticky="w") e = Entry(self.top, textvariable=var, exportselection=0) ! e.grid(row=self.row, col=1, sticky="we") self.row = self.row + 1 return e --- 49,55 ---- def make_entry(self, label, var): l = Label(self.top, text=label) ! l.grid(row=self.row, column=0, sticky="w") e = Entry(self.top, textvariable=var, exportselection=0) ! e.grid(row=self.row, column=1, sticky="we") self.row = self.row + 1 return e *************** *** 57,61 **** def make_frame(self): f = Frame(self.top) ! f.grid(row=self.row, col=0, columnspan=2, sticky="we") self.row = self.row + 1 return f --- 57,61 ---- def make_frame(self): f = Frame(self.top) ! f.grid(row=self.row, column=0, columnspan=2, sticky="we") self.row = self.row + 1 return f From loewis@users.sourceforge.net Wed Nov 6 21:59:35 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 06 Nov 2002 13:59:35 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.514,1.515 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv5208/Misc Modified Files: NEWS Log Message: Add --check-tkinter to setup.py. Install IDLE. Fixes #634078. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.514 retrieving revision 1.515 diff -C2 -d -r1.514 -r1.515 *** NEWS 6 Nov 2002 18:44:26 -0000 1.514 --- NEWS 6 Nov 2002 21:59:31 -0000 1.515 *************** *** 583,586 **** --- 583,588 ---- ----- + - On Unix, IDLE is now installed automatically. + - The fpectl module is not built by default; it's dangerous or useless except in the hands of experts. From loewis@users.sourceforge.net Wed Nov 6 21:59:35 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 06 Nov 2002 13:59:35 -0800 Subject: [Python-checkins] python/dist/src/Tools/idle setup.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv5208/Tools/idle Modified Files: setup.py Log Message: Add --check-tkinter to setup.py. Install IDLE. Fixes #634078. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/setup.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** setup.py 8 Aug 2001 20:26:14 -0000 1.3 --- setup.py 6 Nov 2002 21:59:33 -0000 1.4 *************** *** 1,3 **** ! import os,glob from distutils.core import setup from distutils.command.build_py import build_py --- 1,3 ---- ! import os, glob, sys from distutils.core import setup from distutils.command.build_py import build_py *************** *** 5,8 **** --- 5,25 ---- import idlever + try: + pos = sys.argv.index("--check-tkinter") + except ValueError: + pass + else: + del sys.argv[pos] + try: + import _tkinter + except ImportError: + print >>sys.stderr, "Cannot install IDLE without _tkinter" + raise SystemExit + + try: + package_dir = os.path.join(os.environ["SRCDIR"], "Tools", "idle") + except KeyError: + package_dir = "." + # name of idle package idlelib = "idlelib" *************** *** 25,29 **** dir = os.path.dirname(outfile) self.mkpath(dir) ! self.copy_file(name, outfile, preserve_mode = 0) for name in Icons: outfile = self.get_plain_outfile(self.build_lib, --- 42,47 ---- dir = os.path.dirname(outfile) self.mkpath(dir) ! self.copy_file(os.path.join(package_dir, name), outfile, ! preserve_mode = 0) for name in Icons: outfile = self.get_plain_outfile(self.build_lib, *************** *** 36,40 **** def get_source_files(self): # returns the .py files, the .txt files, and the icons ! icons = [os.path.join("Icons",name) for name in Icons] return build_py.get_source_files(self)+txt_files+icons --- 54,59 ---- def get_source_files(self): # returns the .py files, the .txt files, and the icons ! icons = [os.path.join(package_dir, "Icons",name) for name in Icons] ! txts = [os.path.join(package_dir, name) for name in txt_files] return build_py.get_source_files(self)+txt_files+icons *************** *** 76,81 **** cmdclass = {'build_py':idle_build_py, 'install_lib':idle_install_lib}, ! package_dir = {idlelib:'.'}, packages = [idlelib], ! scripts = ['idle'] ) --- 95,100 ---- cmdclass = {'build_py':idle_build_py, 'install_lib':idle_install_lib}, ! package_dir = {idlelib: package_dir}, packages = [idlelib], ! scripts = [os.path.join(package_dir, 'idle')] ) From loewis@users.sourceforge.net Wed Nov 6 22:00:03 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 06 Nov 2002 14:00:03 -0800 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.100,1.101 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv5208 Modified Files: Makefile.pre.in Log Message: Add --check-tkinter to setup.py. Install IDLE. Fixes #634078. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** Makefile.pre.in 10 Oct 2002 15:04:04 -0000 1.100 --- Makefile.pre.in 6 Nov 2002 21:59:30 -0000 1.101 *************** *** 531,535 **** # Install everything ! install: altinstall bininstall maninstall # Install almost everything without disturbing previous versions --- 531,535 ---- # Install everything ! install: altinstall bininstall maninstall idleinstall # Install almost everything without disturbing previous versions *************** *** 826,829 **** --- 826,833 ---- $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installunixtools \ srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../.. + + # This installs IDLE + idleinstall: + SRCDIR=$(srcdir) ./$(BUILDPYTHON) $(srcdir)/Tools/idle/setup.py install --check-tkinter # Build the toplevel Makefile From jackjansen@users.sourceforge.net Wed Nov 6 23:15:54 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 06 Nov 2002 15:15:54 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts buildappbundle.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv30371 Added Files: buildappbundle.py Log Message: Script to create .app bundles. Largely untested. --- NEW FILE: buildappbundle.py --- import sys import os import shutil import getopt def buildappbundle(executable, output=None, copyfunc=None, creator=None, plist=None, nib=None, resources=None): if not output: output = os.path.split(executable)[1] + '.app' if not copyfunc: copyfunc = shutil.copy2 if not creator: creator='????' if not resources: resources = [] if nib: resources = resources + [nib] # # Create the main directory structure # if not os.path.isdir(output): os.mkdir(output) contents = os.path.join(output, 'Contents') if not os.path.isdir(contents): os.mkdir(contents) macos = os.path.join(contents, 'MacOS') if not os.path.isdir(macos): os.mkdir(macos) # # Create the executable # shortname = os.path.split(executable)[1] execname = os.path.join(macos, shortname) try: os.remove(execname) except OSError: pass copyfunc(executable, execname) # # Create the PkgInfo file # pkginfo = os.path.join(contents, 'PkgInfo') open(pkginfo, 'wb').write('APPL'+creator) if plist: # A plist file is specified. Read it. plistdata = open(plist).read() else: # # If we have a main NIB we create the extra Cocoa specific info for the plist file # if not nib: nibname = "" else: nibname, ext = os.path.splitext(os.path.split(nib)[1]) if ext == '.lproj': # Special case: if the main nib is a .lproj we assum a directory # and use the first nib from there files = os.listdir(nib) for f in files: if f[-4:] == '.nib': nibname = os.path.split(f)[1][:-4] break else: nibname = "" if nibname: cocoainfo = """ NSMainNibFile %s NSPrincipalClass NSApplication""" % nibname else: cocoainfo = "" plistdata = \ """ CFBundleDevelopmentRegion English CFBundleExecutable %s CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType APPL CFBundleSignature %s CFBundleVersion 0.1 %s """ % (shortname, creator, cocoainfo) # # Next, we create the plist file # infoplist = os.path.join(contents, 'Info.plist') open(infoplist, 'w').write(plistdata) # # Finally, if there are nibs or other resources to copy we do so. # if resources: resdir = os.path.join(contents, 'Resources') for src in resources: dst = os.path.join(resdir, os.path.split(src)[1]) if os.path.isdir(src): shutil.copytree(src, dst) else: shutil.copy2(src, dst) def usage(): print "buildappbundle creates an application bundle" print "Usage:" print " buildappbundle [options] executable" print "Options:" print " --output o Output file; default executable with .app appended, short -o" print " --link Symlink the executable (default: copy), short -l" print " --plist file Plist file (default: generate one), short -p" print " --nib file Main nib file or lproj folder for Cocoa program, short -n" print " --resource r Extra resource file to be copied to Resources, short -r" print " --creator c 4-char creator code (default: ????), short -c" print " --help This message, short -?" sys.exit(1) def main(): output=None copyfunc=None creator=None plist=None nib=None resources=[] SHORTOPTS = "o:ln:r:p:c:?" LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) except getopt.error: usage() if len(args) != 1: usage() for opt, arg in options: if opt in ('-o', '--output'): output = arg elif opt in ('-l', '--link'): copyfunc = os.symlink elif opt in ('-n', '--nib'): nib = arg elif opt in ('-r', '--resource'): resources.append(arg) elif opt in ('-c', '--creator'): creator = arg elif opt in ('-p', '--plist'): plist = arg elif opt in ('-?', '--help'): usage() buildappbundle(args[0], output=output, copyfunc=copyfunc, creator=creator, plist=plist, resources=resources) if __name__ == '__main__': main() From nnorwitz@users.sourceforge.net Thu Nov 7 00:22:56 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 06 Nov 2002 16:22:56 -0800 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.124.6.17,2.124.6.18 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv14659/Objects Modified Files: Tag: release22-maint unicodeobject.c Log Message: Backport 2.173: Fix for bug #626172: crash using unicode latin1 single char Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.124.6.17 retrieving revision 2.124.6.18 diff -C2 -d -r2.124.6.17 -r2.124.6.18 *** unicodeobject.c 11 Oct 2002 00:47:20 -0000 2.124.6.17 --- unicodeobject.c 7 Nov 2002 00:22:53 -0000 2.124.6.18 *************** *** 3821,3828 **** } u = (PyUnicodeObject *)PyUnicode_FromObject(container); ! if (u == NULL) { ! Py_DECREF(v); goto onError; - } /* Check v in u */ --- 3821,3826 ---- } u = (PyUnicodeObject *)PyUnicode_FromObject(container); ! if (u == NULL) goto onError; /* Check v in u */ From nnorwitz@users.sourceforge.net Thu Nov 7 00:23:40 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 06 Nov 2002 16:23:40 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.47.6.7,1.47.6.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15389/Lib/test Modified Files: Tag: release22-maint test_unicode.py Log Message: Backport 1.72: Fix for bug #626172: crash using unicode latin1 single char Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.47.6.7 retrieving revision 1.47.6.8 diff -C2 -d -r1.47.6.7 -r1.47.6.8 *** test_unicode.py 7 Oct 2002 12:32:56 -0000 1.47.6.7 --- test_unicode.py 7 Nov 2002 00:23:38 -0000 1.47.6.8 *************** *** 416,419 **** --- 416,425 ---- verify(('a' in ('x',1,u'y')) == 0) verify(('a' in ('x',1,None)) == 0) + try: + u'\xe2' in 'g\xe2teau' + except UnicodeError: + pass + else: + print '*** contains operator does not propagate UnicodeErrors' print 'done.' From nnorwitz@users.sourceforge.net Thu Nov 7 00:28:57 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 06 Nov 2002 16:28:57 -0800 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.56.8.6,1.56.8.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19319/Lib Modified Files: Tag: release22-maint pydoc.py Log Message: Backport 1.72: SF bug 630824: pydoc Helper keywords missing 'yield' Wow, what a brittle subsystem! Fixed, maybe, provided Fred doesn't shuffle the docs around. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.56.8.6 retrieving revision 1.56.8.7 diff -C2 -d -r1.56.8.6 -r1.56.8.7 *** pydoc.py 7 Oct 2002 17:09:25 -0000 1.56.8.6 --- pydoc.py 7 Nov 2002 00:28:54 -0000 1.56.8.7 *************** *** 1405,1408 **** --- 1405,1409 ---- 'try': ('ref/try', 'EXCEPTIONS'), 'while': ('ref/while', 'break continue if TRUTHVALUE'), + 'yield': ('ref/yield', ''), } From niemeyer@users.sourceforge.net Thu Nov 7 03:28:58 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Wed, 06 Nov 2002 19:28:58 -0800 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.84,2.85 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv8064/Modules Modified Files: _sre.c Log Message: Fixed sre bug "[#581080] Provoking infinite scanner loops". This bug happened because: 1) the scanner_search and scanner_match methods were not checking the buffer limits before increasing the current pointer; and 2) SRE_SEARCH was using "if (ptr == end)" as a loop break, instead of "if (ptr >= end)". * Modules/_sre.c (SRE_SEARCH): Check for "ptr >= end" to break loops, so that we don't hang forever if a pointer passing the buffer limit is used. (scanner_search,scanner_match): Don't increment the current pointer if we're going to pass the buffer limit. * Misc/NEWS Mention the fix. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.84 retrieving revision 2.85 diff -C2 -d -r2.84 -r2.85 *** _sre.c 6 Nov 2002 14:06:53 -0000 2.84 --- _sre.c 7 Nov 2002 03:28:56 -0000 2.85 *************** *** 1238,1242 **** while (ptr < end && (SRE_CODE) ptr[0] != chr) ptr++; ! if (ptr == end) return 0; TRACE(("|%p|%p|SEARCH LITERAL\n", pattern, ptr)); --- 1238,1242 ---- while (ptr < end && (SRE_CODE) ptr[0] != chr) ptr++; ! if (ptr >= end) return 0; TRACE(("|%p|%p|SEARCH LITERAL\n", pattern, ptr)); *************** *** 1255,1259 **** while (ptr < end && !SRE_CHARSET(charset, ptr[0])) ptr++; ! if (ptr == end) return 0; TRACE(("|%p|%p|SEARCH CHARSET\n", pattern, ptr)); --- 1255,1259 ---- while (ptr < end && !SRE_CHARSET(charset, ptr[0])) ptr++; ! if (ptr >= end) return 0; TRACE(("|%p|%p|SEARCH CHARSET\n", pattern, ptr)); *************** *** 2897,2901 **** state, status); ! if (status == 0 || state->ptr == state->start) state->start = (void*) ((char*) state->ptr + state->charsize); else --- 2897,2902 ---- state, status); ! if ((status == 0 || state->ptr == state->start) && ! state->ptr < state->end) state->start = (void*) ((char*) state->ptr + state->charsize); else *************** *** 2928,2932 **** state, status); ! if (status == 0 || state->ptr == state->start) state->start = (void*) ((char*) state->ptr + state->charsize); else --- 2929,2934 ---- state, status); ! if ((status == 0 || state->ptr == state->start) && ! state->ptr < state->end) state->start = (void*) ((char*) state->ptr + state->charsize); else From niemeyer@users.sourceforge.net Thu Nov 7 03:28:58 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Wed, 06 Nov 2002 19:28:58 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.515,1.516 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv8064/Misc Modified Files: NEWS Log Message: Fixed sre bug "[#581080] Provoking infinite scanner loops". This bug happened because: 1) the scanner_search and scanner_match methods were not checking the buffer limits before increasing the current pointer; and 2) SRE_SEARCH was using "if (ptr == end)" as a loop break, instead of "if (ptr >= end)". * Modules/_sre.c (SRE_SEARCH): Check for "ptr >= end" to break loops, so that we don't hang forever if a pointer passing the buffer limit is used. (scanner_search,scanner_match): Don't increment the current pointer if we're going to pass the buffer limit. * Misc/NEWS Mention the fix. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.515 retrieving revision 1.516 diff -C2 -d -r1.515 -r1.516 *** NEWS 6 Nov 2002 21:59:31 -0000 1.515 --- NEWS 7 Nov 2002 03:28:55 -0000 1.516 *************** *** 360,363 **** --- 360,368 ---- 1, not 2. + - Fixed bug #581080: sre scanner was not checking the buffer limit + before increasing the current pointer. This was creating an infinite + loop in the search function, once the pointer exceeded the buffer + limit. + Library ------- From loewis@users.sourceforge.net Thu Nov 7 07:42:32 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 06 Nov 2002 23:42:32 -0800 Subject: [Python-checkins] python/dist/src configure,1.352,1.353 configure.in,1.363,1.364 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv4103 Modified Files: configure configure.in Log Message: Try linking the major/minor test program. Fixes #634444. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.352 retrieving revision 1.353 diff -C2 -d -r1.352 -r1.353 *** configure 6 Nov 2002 13:33:30 -0000 1.352 --- configure 7 Nov 2002 07:42:28 -0000 1.353 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.362 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.363 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 909,913 **** # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` --- 909,913 ---- # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` *************** *** 12833,12843 **** } _ACEOF ! rm -f conftest.$ac_objext ! if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ! (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && ! { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 --- 12833,12843 ---- } _ACEOF ! rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ! (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && ! { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 *************** *** 12862,12866 **** fi ! rm -f conftest.$ac_objext conftest.$ac_ext # On OSF/1 V5.1, getaddrinfo is available, but a define --- 12862,12866 ---- fi ! rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext # On OSF/1 V5.1, getaddrinfo is available, but a define *************** *** 17196,17200 **** # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` --- 17196,17200 ---- # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.363 retrieving revision 1.364 diff -C2 -d -r1.363 -r1.364 *** configure.in 6 Nov 2002 13:33:32 -0000 1.363 --- configure.in 7 Nov 2002 07:42:30 -0000 1.364 *************** *** 1754,1758 **** AC_MSG_CHECKING(for major, minor, and makedev) ! AC_TRY_COMPILE([ #if defined(MAJOR_IN_MKDEV) #include --- 1754,1758 ---- AC_MSG_CHECKING(for major, minor, and makedev) ! AC_TRY_LINK([ #if defined(MAJOR_IN_MKDEV) #include From gvanrossum@users.sourceforge.net Thu Nov 7 15:41:21 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 07 Nov 2002 07:41:21 -0800 Subject: [Python-checkins] python/nondist/peps pep-0237.txt,1.15,1.16 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv7536 Modified Files: pep-0237.txt Log Message: Delete stage 2 (turn on warnings for long literals). This seems to have caused some concern on c.l.py. These weill be illegal in Python 3.0, but there's no need to warn about them earlier. Index: pep-0237.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0237.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pep-0237.txt 12 Aug 2002 00:55:43 -0000 1.15 --- pep-0237.txt 7 Nov 2002 15:41:19 -0000 1.16 *************** *** 213,217 **** option, but it is off by default. ! B2. The warning for long literals is turned on by default. B3. The warnings about operations that give different results than --- 213,217 ---- option, but it is off by default. ! B2. (This stage is deleted.) B3. The warnings about operations that give different results than *************** *** 227,231 **** B1. Python 2.4. ! B2. Python 2.5. B3. The rest of the Python 2.x line. --- 227,231 ---- B1. Python 2.4. ! B2. (Not applicable.) B3. The rest of the Python 2.x line. From theller@users.sourceforge.net Thu Nov 7 16:01:06 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 07 Nov 2002 08:01:06 -0800 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.270,2.271 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv19146 Modified Files: posixmodule.c Log Message: Enforce valid filemode. Fixes SF Bug #623464. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.270 retrieving revision 2.271 diff -C2 -d -r2.270 -r2.271 *** posixmodule.c 2 Nov 2002 17:42:33 -0000 2.270 --- posixmodule.c 7 Nov 2002 16:00:59 -0000 2.271 *************** *** 5049,5052 **** --- 5049,5058 ---- return NULL; + if (mode[0] != 'r' && mode[0] != 'w' && mode[0] != 'a') { + PyErr_Format(PyExc_ValueError, + "invalid file mode '%s'", mode); + return NULL; + } + Py_BEGIN_ALLOW_THREADS fp = fdopen(fd, mode); From theller@python.net Thu Nov 7 16:08:53 2002 From: theller@python.net (Thomas Heller) Date: 07 Nov 2002 17:08:53 +0100 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.270,2.271 In-Reply-To: References: Message-ID: Forgot to say: bugfix candidate. > Update of /cvsroot/python/python/dist/src/Modules > In directory usw-pr-cvs1:/tmp/cvs-serv19146 > > Modified Files: > posixmodule.c > Log Message: > Enforce valid filemode. Fixes SF Bug #623464. > > > Index: posixmodule.c > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v > retrieving revision 2.270 > retrieving revision 2.271 > diff -C2 -d -r2.270 -r2.271 > *** posixmodule.c 2 Nov 2002 17:42:33 -0000 2.270 > --- posixmodule.c 7 Nov 2002 16:00:59 -0000 2.271 > *************** > *** 5049,5052 **** > --- 5049,5058 ---- > return NULL; > > + if (mode[0] != 'r' && mode[0] != 'w' && mode[0] != 'a') { > + PyErr_Format(PyExc_ValueError, > + "invalid file mode '%s'", mode); > + return NULL; > + } > + > Py_BEGIN_ALLOW_THREADS > fp = fdopen(fd, mode); > > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://mail.python.org/mailman/listinfo/python-checkins From gvanrossum@users.sourceforge.net Thu Nov 7 16:20:40 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 07 Nov 2002 08:20:40 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.py,1.60,1.61 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory usw-pr-cvs1:/tmp/cvs-serv30855 Modified Files: datetime.py Log Message: Get rid of __slots__; it doesn't help. Index: datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** datetime.py 12 Sep 2002 22:15:25 -0000 1.60 --- datetime.py 7 Nov 2002 16:20:36 -0000 1.61 *************** *** 256,261 **** """ - __slots__ = [] - def timetuple(self): raise NotImplementedError --- 256,259 ---- From theller@users.sourceforge.net Thu Nov 7 16:24:00 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 07 Nov 2002 08:24:00 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.516,1.517 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv939 Modified Files: NEWS Log Message: NEWS entry for the changed fdopen function. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.516 retrieving revision 1.517 diff -C2 -d -r1.516 -r1.517 *** NEWS 7 Nov 2002 03:28:55 -0000 1.516 --- NEWS 7 Nov 2002 16:23:55 -0000 1.517 *************** *** 365,368 **** --- 365,372 ---- limit. + - The os.fdopen function now enforces a file mode starting with the + letter 'r', 'w' or 'a', otherwise a ValueError is raised. This fixes + bug #623464. + Library ------- From theller@users.sourceforge.net Thu Nov 7 16:33:46 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 07 Nov 2002 08:33:46 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.100,1.101 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv6391 Modified Files: libos.tex Log Message: Document the changed fdopen behaviour. (Hope the markup is ok). Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** libos.tex 16 Oct 2002 18:27:38 -0000 1.100 --- libos.tex 7 Nov 2002 16:33:44 -0000 1.101 *************** *** 299,302 **** --- 299,306 ---- function. Availability: Macintosh, \UNIX, Windows. + + \versionchanged[When specified, the \var{mode} argument must now start + with one of the letters \code{'r'}, \code{'w'}, or \code{'a'}, + otherwise a \exception{ValueError} is raised. ]{2.3} \end{funcdesc} From theller@python.net Thu Nov 7 16:35:36 2002 From: theller@python.net (Thomas Heller) Date: 07 Nov 2002 17:35:36 +0100 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.270,2.271 In-Reply-To: References: Message-ID: <65v91go7.fsf@python.net> No, *not* a bugfix candidate, because it changes the behaviour. > Forgot to say: > > bugfix candidate. > > > Update of /cvsroot/python/python/dist/src/Modules > > In directory usw-pr-cvs1:/tmp/cvs-serv19146 > > > > Modified Files: > > posixmodule.c > > Log Message: > > Enforce valid filemode. Fixes SF Bug #623464. > > > > > > Index: posixmodule.c > > =================================================================== > > RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v > > retrieving revision 2.270 > > retrieving revision 2.271 > > diff -C2 -d -r2.270 -r2.271 > > *** posixmodule.c 2 Nov 2002 17:42:33 -0000 2.270 > > --- posixmodule.c 7 Nov 2002 16:00:59 -0000 2.271 > > *************** > > *** 5049,5052 **** > > --- 5049,5058 ---- > > return NULL; > > > > + if (mode[0] != 'r' && mode[0] != 'w' && mode[0] != 'a') { > > + PyErr_Format(PyExc_ValueError, > > + "invalid file mode '%s'", mode); > > + return NULL; > > + } > > + > > Py_BEGIN_ALLOW_THREADS > > fp = fdopen(fd, mode); > > > > > > > > _______________________________________________ > > Python-checkins mailing list > > Python-checkins@python.org > > http://mail.python.org/mailman/listinfo/python-checkins From theller@users.sourceforge.net Thu Nov 7 16:41:41 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 07 Nov 2002 08:41:41 -0800 Subject: [Python-checkins] distutils/distutils core.py,1.52,1.53 Message-ID: Update of /cvsroot/python/distutils/distutils In directory usw-pr-cvs1:/tmp/cvs-serv11038 Modified Files: core.py Log Message: Fix a small bug when sys.argv[0] has an absolute path. See http://mail.python.org/pipermail/distutils-sig/2002-November/003039.html Index: core.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/core.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** core.py 4 Nov 2002 13:45:15 -0000 1.52 --- core.py 7 Nov 2002 16:41:38 -0000 1.53 *************** *** 88,92 **** if not attrs.has_key('script_name'): ! attrs['script_name'] = sys.argv[0] if not attrs.has_key('script_args'): attrs['script_args'] = sys.argv[1:] --- 88,92 ---- if not attrs.has_key('script_name'): ! attrs['script_name'] = os.path.basename(sys.argv[0]) if not attrs.has_key('script_args'): attrs['script_args'] = sys.argv[1:] From theller@users.sourceforge.net Thu Nov 7 16:46:23 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 07 Nov 2002 08:46:23 -0800 Subject: [Python-checkins] distutils/misc install.c,1.21,1.22 wininst.exe,1.17,1.18 Message-ID: Update of /cvsroot/python/distutils/misc In directory usw-pr-cvs1:/tmp/cvs-serv13413/misc Modified Files: install.c wininst.exe Log Message: Use dynamic linking for the SHGetSpecialFolderPath function, it is not always available on Windows NT. When the function cannot be loaded, get_special_folder_path raises OSError, "function not available". Compiled the exe, and rebuilt bdist_wininst.py. Index: install.c =================================================================== RCS file: /cvsroot/python/distutils/misc/install.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** install.c 5 Nov 2002 10:02:03 -0000 1.21 --- install.c 7 Nov 2002 16:46:20 -0000 1.22 *************** *** 390,403 **** char lpszPath[MAX_PATH]; int i; if (!g_PyArg_ParseTuple(args, "s", &name)) return NULL; for (i = 0; i < DIM(csidl_names); ++i) { if (0 == strcmpi(csidl_names[i].name, name)) { int nFolder; nFolder = csidl_names[i].nFolder; ! if (SHGetSpecialFolderPath(NULL, lpszPath, nFolder, 0)) ! return g_Py_BuildValue("s", lpszPath); else { g_PyErr_Format(g_PyExc_OSError, "no such folder (%s)", name); --- 390,423 ---- char lpszPath[MAX_PATH]; int i; + static HRESULT (WINAPI *My_SHGetSpecialFolderPath)(HWND hwnd, + LPTSTR lpszPath, + int nFolder, + BOOL fCreate); + + if (!My_SHGetSpecialFolderPath) { + HINSTANCE hLib = LoadLibrary("shell32.dll"); + if (!hLib) { + g_PyErr_Format(g_PyExc_OSError, "function not available"); + return NULL; + } + My_SHGetSpecialFolderPath = (BOOL (WINAPI *)(HWND, LPTSTR, int, BOOL)) + GetProcAddress(hLib, + "SHGetSpecialFolderPathA"); + } if (!g_PyArg_ParseTuple(args, "s", &name)) return NULL; + if (!My_SHGetSpecialFolderPath) { + g_PyErr_Format(g_PyExc_OSError, "function not available"); + return NULL; + } + for (i = 0; i < DIM(csidl_names); ++i) { if (0 == strcmpi(csidl_names[i].name, name)) { int nFolder; nFolder = csidl_names[i].nFolder; ! if (My_SHGetSpecialFolderPath(NULL, lpszPath, nFolder, 0)) ! return g_Py_BuildValue("s", lpszPath); else { g_PyErr_Format(g_PyExc_OSError, "no such folder (%s)", name); *************** *** 1675,1679 **** int result; result = run_installscript(hPython, fname, 2, argv); ! if (result) { fprintf(stderr, "*** run_installscript: internal error 0x%X ***\n", result); } --- 1695,1699 ---- int result; result = run_installscript(hPython, fname, 2, argv); ! if (-1 == result) { fprintf(stderr, "*** run_installscript: internal error 0x%X ***\n", result); } Index: wininst.exe =================================================================== RCS file: /cvsroot/python/distutils/misc/wininst.exe,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 Binary files /tmp/cvsbJ0yLZ and /tmp/cvsihHZxR differ From theller@users.sourceforge.net Thu Nov 7 16:46:22 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 07 Nov 2002 08:46:22 -0800 Subject: [Python-checkins] distutils/distutils/command bdist_wininst.py,1.39,1.40 Message-ID: Update of /cvsroot/python/distutils/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv13413/distutils/command Modified Files: bdist_wininst.py Log Message: Use dynamic linking for the SHGetSpecialFolderPath function, it is not always available on Windows NT. When the function cannot be loaded, get_special_folder_path raises OSError, "function not available". Compiled the exe, and rebuilt bdist_wininst.py. Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/command/bdist_wininst.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** bdist_wininst.py 5 Nov 2002 10:06:19 -0000 1.39 --- bdist_wininst.py 7 Nov 2002 16:46:19 -0000 1.40 *************** *** 266,274 **** TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA8AAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1v ! ZGUuDQ0KJAAAAAAAAAAtOHsRaVkVQmlZFUJpWRVCEkUZQmpZFUIGRh9CYlkVQupFG0JrWRVCBkYR ! QmtZFUJpWRVCZlkVQmlZFELjWRVCC0YGQmRZFUJveh9Ca1kVQq5fE0JoWRVCUmljaGlZFUIAAAAA ! AAAAAAAAAAAAAAAAUEUAAEwBAwAvl8c9AAAAAAAAAADgAA8BCwEGAABQAAAAEAAAALAAAMAGAQAA wAAAABABAAAAQAAAEAAAAAIAAAQAAAAAAAAABAAAAAAAAAAAIAEAAAQAAAAAAAACAAAAAAAQAAAQ ! AAAAABAAABAAAAAAAAAQAAAAAAAAAAAAAAAwEQEA5AEAAAAQAQAwAQAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVUFgwAAAAAACwAAAAEAAAAAAAAAAEAAAA --- 266,274 ---- TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA8AAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCB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AAAA ! AAAAAAAAAAAAAAABAAkEAAAgAQAAQOEAABQBAAAAAAAAAAAAAAAAAAAAAAAAAAAAABASAQDQEQEA ! AAAAAAAAAAAAAAAAHRIBAOARAQAAAAAAAAAAAAAAAAAqEgEA6BEBAAAAAAAAAAAAAAAAADcSAQDw ! EQEAAAAAAAAAAAAAAAAAQRIBAPgRAQAAAAAAAAAAAAAAAABMEgEAABIBAAAAAAAAAAAAAAAAAFYS ! AQAIEgEAAAAAAAAAAAAAAAAAAAAAAAAAAABgEgEAbhIBAH4SAQAAAAAAjBIBAAAAAACaEgEAAAAA ! AKoSAQAAAAAAtBIBAAAAAAC6EgEAAAAAAMgSAQAAAAAAS0VSTkVMMzIuRExMAEFEVkFQSTMyLmRs ! bABDT01DVEwzMi5kbGwAR0RJMzIuZGxsAE1TVkNSVC5kbGwAb2xlMzIuZGxsAFVTRVIzMi5kbGwA ! AExvYWRMaWJyYXJ5QQAAR2V0UHJvY0FkZHJlc3MAAEV4aXRQcm9jZXNzAAAAUmVnQ2xvc2VLZXkA ! AABQcm9wZXJ0eVNoZWV0QQAAVGV4dE91dEEAAGZyZWUAAENvSW5pdGlhbGl6ZQAAR2V0REMAAAAA ! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA From theller@users.sourceforge.net Thu Nov 7 16:46:49 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 07 Nov 2002 08:46:49 -0800 Subject: [Python-checkins] distutils/build - New directory Message-ID: Update of /cvsroot/python/distutils/build In directory usw-pr-cvs1:/tmp/cvs-serv13627/build Log Message: Directory /cvsroot/python/distutils/build added to the repository From theller@users.sourceforge.net Thu Nov 7 16:49:30 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 07 Nov 2002 08:49:30 -0800 Subject: [Python-checkins] distutils .cvsignore,1.1,1.2 Message-ID: Update of /cvsroot/python/distutils In directory usw-pr-cvs1:/tmp/cvs-serv14953 Modified Files: .cvsignore Log Message: Ignore the dist and build directories. Index: .cvsignore =================================================================== RCS file: /cvsroot/python/distutils/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 13 May 2000 03:37:27 -0000 1.1 --- .cvsignore 7 Nov 2002 16:49:27 -0000 1.2 *************** *** 1,5 **** ! MANIFEST *.tar.gz *.zip ! *.rpm ! *.deb --- 1,7 ---- ! *.deb ! *.rpm *.tar.gz *.zip ! MANIFEST ! build ! dist From theller@users.sourceforge.net Thu Nov 7 16:51:39 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 07 Nov 2002 08:51:39 -0800 Subject: [Python-checkins] distutils/misc .cvsignore,1.1,1.2 Message-ID: Update of /cvsroot/python/distutils/misc In directory usw-pr-cvs1:/tmp/cvs-serv16093/misc Modified Files: .cvsignore Log Message: Ignore MSVC build by-products. Index: .cvsignore =================================================================== RCS file: /cvsroot/python/distutils/misc/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 15 Oct 2002 15:02:00 -0000 1.1 --- .cvsignore 7 Nov 2002 16:51:36 -0000 1.2 *************** *** 2,4 **** --- 2,5 ---- temp-release wininst.ncb + wininst.opt wininst.plg From rhettinger@users.sourceforge.net Thu Nov 7 16:55:56 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 07 Nov 2002 08:55:56 -0800 Subject: [Python-checkins] python/dist/src/Objects rangeobject.c,2.44,2.45 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv16919 Modified Files: rangeobject.c Log Message: Restore attribute access so that the following work again: dir(xrange(10)) xrange(10).__getitem__(4) Index: rangeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/rangeobject.c,v retrieving revision 2.44 retrieving revision 2.45 diff -C2 -d -r2.44 -r2.45 *** rangeobject.c 11 Sep 2002 15:55:48 -0000 2.44 --- rangeobject.c 7 Nov 2002 16:55:54 -0000 2.45 *************** *** 191,195 **** 0, /* tp_call */ 0, /* tp_str */ ! 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 191,195 ---- 0, /* tp_call */ 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ From fdrake@users.sourceforge.net Thu Nov 7 17:13:07 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 07 Nov 2002 09:13:07 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.101,1.102 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv24815 Modified Files: libos.tex Log Message: Minor markup adjustments. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** libos.tex 7 Nov 2002 16:33:44 -0000 1.101 --- libos.tex 7 Nov 2002 17:13:03 -0000 1.102 *************** *** 301,306 **** \versionchanged[When specified, the \var{mode} argument must now start ! with one of the letters \code{'r'}, \code{'w'}, or \code{'a'}, ! otherwise a \exception{ValueError} is raised. ]{2.3} \end{funcdesc} --- 301,306 ---- \versionchanged[When specified, the \var{mode} argument must now start ! with one of the letters \character{r}, \character{w}, or \character{a}, ! otherwise a \exception{ValueError} is raised]{2.3} \end{funcdesc} From doerwalter@users.sourceforge.net Thu Nov 7 22:33:19 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 07 Nov 2002 14:33:19 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libcodecs.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv26602/Doc/lib Modified Files: libcodecs.tex Log Message: Add documentation for the PEP 293 functionality: The errors attribute can be changed after the reader/writer is created. For encoding there are two additional errors values: "xmlcharrefreplace" and "backslashreplace". These values can be extended via register_error(). Index: libcodecs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodecs.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** libcodecs.tex 2 Nov 2002 13:32:07 -0000 1.13 --- libcodecs.tex 7 Nov 2002 22:33:17 -0000 1.14 *************** *** 228,239 **** \begin{tableii}{l|l}{code}{Value}{Meaning} ! \lineii{'strict'}{Raise \exception{ValueError} (or a subclass); this is the default.} \lineii{'ignore'}{Ignore the character and continue with the next.} \lineii{'replace'}{Replace with a suitable replacement character; Python will use the official U+FFFD REPLACEMENT ! CHARACTER for the built-in Unicode codecs.} \end{tableii} \subsubsection{Codec Objects \label{codec-objects}} --- 228,246 ---- \begin{tableii}{l|l}{code}{Value}{Meaning} ! \lineii{'strict'}{Raise \exception{UnicodeError} (or a subclass); this is the default.} \lineii{'ignore'}{Ignore the character and continue with the next.} \lineii{'replace'}{Replace with a suitable replacement character; Python will use the official U+FFFD REPLACEMENT ! CHARACTER for the built-in Unicode codecs on ! decoding and '?' on encoding.} ! \lineii{'xmlcharrefreplace'}{Replace with the appropriate XML ! character reference (only for encoding).} ! \lineii{'backslashreplace'}{Replace with backslashed escape sequences ! (only for encoding).} \end{tableii} + The set of allowed values can be extended via \method{register_error}. + \subsubsection{Codec Objects \label{codec-objects}} *************** *** 304,308 **** The \class{StreamWriter} may implement different error handling schemes by providing the \var{errors} keyword argument. These ! parameters are defined: \begin{itemize} --- 311,315 ---- The \class{StreamWriter} may implement different error handling schemes by providing the \var{errors} keyword argument. These ! parameters are predefined: \begin{itemize} *************** *** 311,315 **** --- 318,333 ---- \item \code{'ignore'} Ignore the character and continue with the next. \item \code{'replace'} Replace with a suitable replacement character + \item \code{'xmlcharrefreplace'} Replace with the appropriate XML + character reference + \item \code{'backslashreplace'} Replace with backslashed escape sequences. \end{itemize} + + The \var{errors} argument will be assigned to an attribute of the + same name. Assigning to this attribute makes it possible to switch + between different error handling strategies during the lifetime + of the \class{StreamWriter} object. + + The set of allowed values for the \var{errors} argument can + be extended with \function{register_error()}. \end{classdesc} *************** *** 361,364 **** --- 379,390 ---- \item \code{'replace'} Replace with a suitable replacement character. \end{itemize} + + The \var{errors} argument will be assigned to an attribute of the + same name. Assigning to this attribute makes it possible to switch + between different error handling strategies during the lifetime + of the \class{StreamReader} object. + + The set of allowed values for the \var{errors} argument can + be extended with \function{register_error()}. \end{classdesc} From jackjansen@users.sourceforge.net Thu Nov 7 23:07:06 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 07 Nov 2002 15:07:06 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv8033/Mac/OSX Modified Files: Makefile Log Message: Got rid of the python.rsrc resource file. The error message strings and dialogs are now stored in Mac/Lib, and loaded on demand through macresource. Not only does this simplify a MacPython based on Apple's Python, but it also makes Mac error codes come out symbolically when running command line python (if you have Mac/Lib in your path). The resource files are copied from Mac/Resources. The old ones will disappear after the OS9 build procedure has been adjusted. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Makefile 12 Sep 2002 22:19:23 -0000 1.27 --- Makefile 7 Nov 2002 23:07:04 -0000 1.28 *************** *** 38,43 **** CC=cc LD=cc - REZ=/Developer/Tools/Rez - DEREZ=/Developer/Tools/DeRez CPMAC=/Developer/Tools/CpMac --- 38,41 ---- *************** *** 45,51 **** APPTEMPLATE=$(srcdir)/Mac/OSXResources/app APPSUBDIRS=MacOS Resources Resources/English.lproj - RESOURCEDIR=$(srcdir)/Mac/Resources - RESOURCEFILE=python.rsrc - RFCONVERTER=$(srcdir)/Mac/Lib/applesingle.py CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py --- 43,46 ---- *************** *** 95,121 **** done $(INSTALL_PROGRAM) $(STRIPFLAG) $(PYTHON) $(APPINSTALLDIR)/Contents/MacOS/python - # Create a temporary version of the resources here - # Note that the resource files can either be real 2-fork resource files - # or AppleSingle encoded files. - @if test -s $(RESOURCEDIR)/dialogs.rsrc; then \ - echo $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/dialogs.rsrc dialogs.rsrc ;\ - $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/dialogs.rsrc dialogs.rsrc ; \ - echo $(DEREZ) -useDF -skip ckid dialogs.rsrc > dialogs.r ; \ - $(DEREZ) -useDF -skip ckid dialogs.rsrc > dialogs.r ; \ - else \ - echo $(DEREZ) -skip ckid $(RESOURCEDIR)/dialogs.rsrc > dialogs.r ; \ - $(DEREZ) -skip ckid $(RESOURCEDIR)/dialogs.rsrc > dialogs.r ; \ - fi - @if test -s $(RESOURCEDIR)/errors.rsrc; then \ - echo $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/errors.rsrc errors.rsrc ;\ - $(PYTHON) $(RFCONVERTER) -r $(RESOURCEDIR)/errors.rsrc errors.rsrc ; \ - echo $(DEREZ) -useDF -skip ckid errors.rsrc > errors.r ; \ - $(DEREZ) -useDF -skip ckid errors.rsrc > errors.r ; \ - else \ - echo $(DEREZ) -skip ckid $(RESOURCEDIR)/errors.rsrc > errors.r ; \ - $(DEREZ) -skip ckid $(RESOURCEDIR)/errors.rsrc > errors.r ; \ - fi - $(REZ) -useDF -o $(RESOURCEFILE) dialogs.r errors.r - $(INSTALL_DATA) $(RESOURCEFILE) $(APPINSTALLDIR)/Contents/Resources/$(RESOURCEFILE) # Finally create the documentation symlink $(LN) -fsn ../../../../English.lproj/Documentation $(APPINSTALLDIR)/Contents/Resources/English.lproj/Documentation --- 90,93 ---- *************** *** 206,214 **** fi; \ done ! ## @for i in $(MACLIBSRC)/*.rsrc; \ ! ## do \ ! ## echo $(CPMAC) $$i $$b ; \ ! ## $(CPMAC) $$i $$b ; \ ! ## done @for d in $(MACLIBSUBDIRS); \ do \ --- 178,186 ---- fi; \ done ! @for i in $(MACLIBSRC)/*.rsrc; \ ! do \ ! echo $(CPMAC) $$i $(MACLIBDEST) ; \ ! $(CPMAC) $$i $(MACLIBDEST) ; \ ! done @for d in $(MACLIBSUBDIRS); \ do \ From jackjansen@users.sourceforge.net Thu Nov 7 23:07:08 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 07 Nov 2002 15:07:08 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib dialogs.rsrc,NONE,1.1 errors.rsrc,NONE,1.1 EasyDialogs.py,1.38,1.39 buildtools.py,1.18,1.19 macresource.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8033/Mac/Lib Modified Files: EasyDialogs.py buildtools.py macresource.py Added Files: dialogs.rsrc errors.rsrc Log Message: Got rid of the python.rsrc resource file. The error message strings and dialogs are now stored in Mac/Lib, and loaded on demand through macresource. Not only does this simplify a MacPython based on Apple's Python, but it also makes Mac error codes come out symbolically when running command line python (if you have Mac/Lib in your path). The resource files are copied from Mac/Resources. The old ones will disappear after the OS9 build procedure has been adjusted. --- NEW FILE: dialogs.rsrc --- (This appears to be a binary file; contents omitted.) --- NEW FILE: errors.rsrc --- (This appears to be a binary file; contents omitted.) Index: EasyDialogs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/EasyDialogs.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** EasyDialogs.py 2 Aug 2002 11:03:19 -0000 1.38 --- EasyDialogs.py 7 Nov 2002 23:07:04 -0000 1.39 *************** *** 28,31 **** --- 28,40 ---- from Carbon.ControlAccessor import * # Also import Controls constants import macfs + import macresource + + _initialized = 0 + + def _initialize(): + global _initialized + if _initialized: return + macresource.need("DLOG", 260, "dialogs.rsrc", __name__) + def cr2lf(text): *************** *** 48,52 **** The MESSAGE string can be at most 255 characters long. """ ! d = GetNewDialog(id, -1) if not d: --- 57,61 ---- The MESSAGE string can be at most 255 characters long. """ ! _initialize() d = GetNewDialog(id, -1) if not d: *************** *** 80,83 **** --- 89,93 ---- """ + _initialize() d = GetNewDialog(id, -1) if not d: *************** *** 120,123 **** --- 130,134 ---- can be at most 255 characters long. """ + _initialize() d = GetNewDialog(id, -1) if not d: *************** *** 162,165 **** --- 173,177 ---- """ + _initialize() d = GetNewDialog(id, -1) if not d: *************** *** 222,225 **** --- 234,238 ---- self.w = None self.d = None + _initialize() self.d = GetNewDialog(id, -1) self.w = self.d.GetDialogWindow() *************** *** 392,395 **** --- 405,409 ---- def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfolder=1, id=ARGV_ID): + _initialize() d = GetNewDialog(id, -1) if not d: Index: buildtools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/buildtools.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** buildtools.py 29 Aug 2002 20:20:24 -0000 1.18 --- buildtools.py 7 Nov 2002 23:07:04 -0000 1.19 *************** *** 354,371 **** - if progress: - progress.label("Copy resources...") - progress.set(20) - resfilename = 'python.rsrc' # XXXX later: '%s.rsrc' % shortname - try: - output = Res.FSOpenResourceFile( - os.path.join(destname, 'Contents', 'Resources', resfilename), - u'', WRITE) - except MacOS.Error: - fsr, dummy = Res.FSCreateResourceFile( - os.path.join(destname, 'Contents', 'Resources'), - unicode(resfilename), '') - output = Res.FSOpenResourceFile(fsr, u'', WRITE) - # Copy the resources from the target specific resource template, if any typesfound, ownertype = [], None --- 354,357 ---- *************** *** 373,409 **** input = macresource.open_pathname(rsrcname) except (MacOS.Error, ValueError): - pass if progress: progress.inc(50) else: typesfound, ownertype = copyres(input, output, [], 0, progress) Res.CloseResFile(input) ! ! # Check which resource-types we should not copy from the template ! skiptypes = [] ! ## if 'vers' in typesfound: skiptypes.append('vers') ! ## if 'SIZE' in typesfound: skiptypes.append('SIZE') ! ## if 'BNDL' in typesfound: skiptypes = skiptypes + ['BNDL', 'FREF', 'icl4', ! ## 'icl8', 'ics4', 'ics8', 'ICN#', 'ics#'] ! ## if not copy_codefragment: ! ## skiptypes.append('cfrg') ! ## skipowner = (ownertype <> None) ! ! # Copy the resources from the template ! ! input = Res.FSOpenResourceFile( ! os.path.join(template, 'Contents', 'Resources', 'python.rsrc'), u'', READ) ! if progress: ! progress.label("Copy standard resources...") ! progress.inc(0) ! ## dummy, tmplowner = copyres(input, output, skiptypes, 1, progress) ! dummy, tmplowner = copyres(input, output, skiptypes, 1, None) ! ! Res.CloseResFile(input) ! ## if ownertype == None: ! ## raise BuildError, "No owner resource found in either resource file or template" ! # Make sure we're manipulating the output resource file now ! ! Res.CloseResFile(output) if code: --- 359,382 ---- input = macresource.open_pathname(rsrcname) except (MacOS.Error, ValueError): if progress: progress.inc(50) else: + if progress: + progress.label("Copy resources...") + progress.set(20) + resfilename = 'python.rsrc' # XXXX later: '%s.rsrc' % shortname + try: + output = Res.FSOpenResourceFile( + os.path.join(destname, 'Contents', 'Resources', resfilename), + u'', WRITE) + except MacOS.Error: + fsr, dummy = Res.FSCreateResourceFile( + os.path.join(destname, 'Contents', 'Resources'), + unicode(resfilename), '') + output = Res.FSOpenResourceFile(fsr, u'', WRITE) + typesfound, ownertype = copyres(input, output, [], 0, progress) Res.CloseResFile(input) ! Res.CloseResFile(output) if code: Index: macresource.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/macresource.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** macresource.py 9 Aug 2002 13:44:03 -0000 1.8 --- macresource.py 7 Nov 2002 23:07:05 -0000 1.9 *************** *** 96,99 **** --- 96,104 ---- return refno + def open_error_resource(): + """Open the resource file containing the error code to error message + mapping.""" + need('Estr', 1, filename="errors.rsrc", modname=__name__) + def _decode(pathname, verbose=0): # Decode an AppleSingle resource file, return the new pathname. From jackjansen@users.sourceforge.net Thu Nov 7 23:07:36 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 07 Nov 2002 15:07:36 -0800 Subject: [Python-checkins] python/dist/src/Python mactoolboxglue.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv8033/Python Modified Files: mactoolboxglue.c Log Message: Got rid of the python.rsrc resource file. The error message strings and dialogs are now stored in Mac/Lib, and loaded on demand through macresource. Not only does this simplify a MacPython based on Apple's Python, but it also makes Mac error codes come out symbolically when running command line python (if you have Mac/Lib in your path). The resource files are copied from Mac/Resources. The old ones will disappear after the OS9 build procedure has been adjusted. Index: mactoolboxglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/mactoolboxglue.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mactoolboxglue.c 19 Oct 2002 22:02:21 -0000 1.11 --- mactoolboxglue.c 7 Nov 2002 23:07:03 -0000 1.12 *************** *** 82,87 **** --- 82,121 ---- Handle h; char *str; + static int errors_loaded; h = GetResource('Estr', err); + if (!h && !errors_loaded) { + /* + ** Attempt to open the resource file containing the + ** Estr resources. We ignore all errors. We also try + ** this only once. + */ + errors_loaded = 1; + PyObject *m, *rv; + + m = PyImport_ImportModule("macresource"); + if (!m) { + if (Py_VerboseFlag) + PyErr_Print(); + PyErr_Clear(); + } else { + rv = PyObject_CallMethod(m, "open_error_resource", ""); + if (!rv) { + if (Py_VerboseFlag) + PyErr_Print(); + PyErr_Clear(); + } else { + Py_DECREF(rv); + /* And try again... */ + h = GetResource('Estr', err); + } + } + } + /* + ** Whether the code above succeeded or not, we won't try + ** again. + */ + errors_loaded = 1; + if ( h ) { HLock(h); From goodger@users.sourceforge.net Fri Nov 8 02:59:20 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 07 Nov 2002 18:59:20 -0800 Subject: [Python-checkins] python/nondist/peps pep-0301.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv20259 Added Files: pep-0301.txt Log Message: Package Index and Metadata for Distutils, by Richard Jones --- NEW FILE: pep-0301.txt --- PEP: 301 Title: Package Index and Metadata for Distutils Version: $Revision: 1.1 $ Last-Modified: $Date: 2002/11/08 02:59:18 $ Author: Richard Jones Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 24-Oct-2002 Python-Version: 2.3 Post-History: Abstract ======== This PEP proposes several extensions to the Distutils packaging system [1]_. These enhancements include a central package index server, tools for submitting package information to the index and extensions to the package metadata to include Trove [2]_ information. This PEP does not address issues of package dependency. It also does not address storage and download of packages as described in PEP 243 [6]_. Nor is it proposing a local database of packages as described in PEP 262 [7]_. Existing package repositories such as the Vaults of Parnassus [3]_, CPAN [4]_ and PAUSE [5]_ will be investigated as prior art in this field. Rationale ========= Python programmers have long needed a simple method of discovering existing modules and systems available for their use. It is arguable that the existence of these systems for other languages have been a significant contribution to their popularity. The existence of the Catalog-SIG, and the many discussions there indicate that there is a large population of users who recognise this need. The introduction of the Distutils packaging system to Python simplified the process of distributing shareable code, and included mechanisms for the capture of package metadata, but did little with the metadata save ship it with the package. An interface to the index should be hosted in the python.org domain, giving it an air of legitimacy that existing catalog efforts do not have. The interface for submitting information to the catalog should be as simple as possible - hopefully just a one-line command for most users. Issues of package dependency are not addressed due to the complexity of such a system. The original proposal for such a system, PEP 262, was dropped as the author realised that platform packaging systems (RPM, apt, etc) already handle dependencies, installation and removal. Issues of package dissemination (storage on a central server) are not addressed because they require assumptions about availability of storage and bandwidth that I am not in a position to make. PEP 243, which is still being developed, is tackling these issues and many more. This proposal is considered compatible with, and adjunct to the proposal in PEP 243. Specification ============= The specification takes three parts, the `web interface`_, the `Distutils register command`_ and the `Distutils Trove categorisation`_. Web Interface ------------- A web interface is implemented over a simple store. The interface is available through the python.org domain, either directly or as packages.python.org. The store has columns for all metadata fields. The (name, version) double is used as a uniqueness key. Additional submissions for an existing (name, version) will result in an *update* operation. The web interface implements the following commands/interfaces: **index** Lists known packages, optionally filtered. An additional HTML page, **search**, presents a form to the user which is used to customise the index view. The index will include a browsing interface like that presented in the Trove interface design section 4.3. The results will be paginated, sorted alphabetically and only showing the most recent version. The most recent version information will be determined using the Distutils LooseVersion class. **display** Displays information about the package. All fields are displayed as plain text. The "url" (or "home_page") field is hyperlinked. **submit** Accepts a POST form submission of metadata about a package. The "name" and "version" fields are mandatory, as they uniquely identify an entry in the index. **Submit** will automatically determine whether to create a new entry or updating an existing entry. The metadata is checked for correctness where appropriate - specifically the Trove discriminators are compared with the allowed set. An update will update all information about the package based on the new submitted information. There will also be a submit/edit form that will allow manual submission and updating for those who do not use Distutils. **user** Registers a new user with the index. Requires username, password and email address. Passwords will be stored in the index database as SHA hashes. If the username already exists in the database: 1. If valid HTTP Basic authentication is provided, the password and email address are updated with the submission information, or 2. If no valid authentication is provided, the user is informed that the login is already taken. Registration will be a three-step process, involving: 1. User submission of details via the Distutils *register* command, 2. Index server sending email to the user's email address with a URL to visit to confirm registration with a random one-time key, and 3. User visits URL with the key and confirms registration. Several user Roles will exist: Admin Can assign Owner Role - they decide who may submit for a given package name. Owner Owns a package name, may assign Maintainer Role for that name Maintainer Can submit and update info for a particular package name Manual (through-the-web) user registration is also available through an HTML form. **roles** An interface for changing user Role assignments. **password_reset** Using a supplied email address as the key, this resets a user's password and sends an email with the new password to the user. The **submit** command will require HTTP Basic authentication, preferably over an HTTPS connection. Distutils *register* Command ---------------------------- An additional Distutils command, ``register``, is implemented which posts the package metadata to the central index. The *register* command automatically handles user registration; the user is presented with three options: 1. login and submit package information 2. register as a new packager 3. send password reminder email On systems where the ``$HOME`` environment variable is set, the user will be prompted at exit to save their username/password to a file in their ``$HOME`` directory in the file ``.pythonpackagerc``. Notification of changes to a package entry will be sent to all users who have submitted information about the package. That is, the original submitter and any subsequent updaters. The *register* command will include a ``--verify`` option which performs a test submission to the index without actually committing the data. The index will perform its submission verification checks as usual and report any errors it would have reported during a normal submission. This is useful for verifying correctness of Trove discriminators. The index server will return custom headers (inspired by PEP 243) which the *register* command will use to give feedback to the user: **X-Pypi-Status** Either "success" or "fail". **X-Pypi-Reason** A description of the reason for failure, or additional information in the case of a success. Distutils Trove Categorisation ------------------------------ The Trove concept of *discrimination* will be added to the metadata set available to package authors through the new attribute "classifiers". The list of classifiers will be available through the web, and added to the package like so:: setup( name = "roundup", version = __version__, classifiers = [ 'Development Status :: 4 - Beta', 'Environment :: Console (Text Based)', 'Environment :: Web Environment', 'Intended Audience :: End Users/Desktop', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'License :: OSI Approved :: Python License', 'Operating System :: MacOS X', 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', 'Programming Language :: Python', 'Topic :: Communications :: Email', 'Topic :: Office/Business', 'Topic :: Software Development :: Bug Tracking', ], url = 'http://sourceforge.net/projects/roundup/', ... ) It was decided that strings would be used for the classification entries due to the deep nesting that would be involved in a more formal Python structure. The original Trove specification that classification namespaces be separated by slashes ("/") unfortunately collides with many of the names having slashes in them (e.g. "OS/2"). The double-colon solution (" :: ") implemented by SourceForge and FreshMeat gets around this limitation. The list of classification values on the module index has been merged from FreshMeat and SourceForge (with their permission). This list will be made available through the web interface as a text list which may then be copied to the ``setup.py`` file. The *register* command's ``--verify`` option will also check classifiers values. Unfortunately, the addition of the "classifiers" property is not backwards-compatible. A setup.py file using it will not work under Python 2.1.3. It is hoped that a bugfix release of Python 2.2 will relax the argument checking of the setup() command to allow new keywords, even if they're not actually used. It is preferable that a warning be produced, rather than a show-stopping error. Reference Implementation ======================== Reference code is available from the SourceForge project: http://sourceforge.net/projects/pypi/ A demonstration will be available at: http://www.amk.ca/cgi-bin/pypi.cgi ===== =================================================== Done Feature ===== =================================================== Y Submission Y Index Y Display Y Search Y User registration Y User verification Y Password reset Y Admin interfaces for user/package maintenance N Trove ===== =================================================== In the two days of the 22nd and 23rd October 2002, after the first announcement to the Catalog-SIG (22nd) and Distutils-SIG (23rd), the initial prototype had 45 visitors (not including myself), two of whom used the *register* command to submit package information. References ========== .. [1] Distutils packaging system (http://www.python.org/doc/current/lib/module-distutils.html) .. [2] Trove (http://tuxedo.org/~esr/trove/) .. [3] Vaults of Parnassus (http://www.vex.net/parnassus/) .. [4] CPAN (http://www.cpan.org/) .. [5] PAUSE (http://pause.cpan.org/) .. [6] PEP 243, Module Repository Upload Mechanism (http://www.python.org/peps/pep-0243.html) .. [7] PEP 262, A Database of Installed Python Packages (http://www.python.org/peps/pep-0262.html) Copyright ========= This document has been placed in the public domain. Acknowledgements ================ Anthony Baxter and Martin v. Loewis for encouragement and feedback during initial drafting. A.M. Kuchling for support including hosting the second prototype. The many participants of the Distutils and Catalog SIGs for their ideas over the years. .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: From goodger@users.sourceforge.net Fri Nov 8 03:02:28 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 07 Nov 2002 19:02:28 -0800 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.218,1.219 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv21367 Modified Files: pep-0000.txt Log Message: Added PEP 301. Updated my email address. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.218 retrieving revision 1.219 diff -C2 -d -r1.218 -r1.219 *** pep-0000.txt 6 Nov 2002 05:40:39 -0000 1.218 --- pep-0000.txt 8 Nov 2002 03:02:26 -0000 1.219 *************** *** 102,105 **** --- 102,106 ---- S 298 The Locked Buffer Interface Heller S 299 Special __main__() function in modules Epler + S 301 Package Index and Metadata for Distutils Jones Finished PEPs (done, implemented in CVS) *************** *** 293,296 **** --- 294,298 ---- S 298 The Locked Buffer Interface Heller S 299 Special __main__() function in modules Epler + S 301 Package Index and Metadata for Distutils Jones SR 666 Reject Foolish Indentation Creighton *************** *** 328,332 **** Giacometti, Frédéric B. fred@arakne.com Gilbert, Scott xscottg at yahoo.com ! Goodger, David goodger@users.sourceforge.net Griffin, Grant g2@iowegian.com Heller, Thomas theller@python.net --- 330,334 ---- Giacometti, Frédéric B. fred@arakne.com Gilbert, Scott xscottg at yahoo.com ! Goodger, David goodger@python.org Griffin, Grant g2@iowegian.com Heller, Thomas theller@python.net *************** *** 337,340 **** --- 339,343 ---- Hylton, Jeremy jeremy@zope.com Jansen, Jack jack@cwi.nl + Jones, Richard rjones@ekit-inc.com Koltsov, Stepan yozh@mx1.ru Kuchling, A.M. amk@amk.ca From goodger@users.sourceforge.net Fri Nov 8 03:43:50 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 07 Nov 2002 19:43:50 -0800 Subject: [Python-checkins] python/nondist/peps pep-html-template,1.2,1.3 pep2html.py,1.46,1.47 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv26830 Modified Files: pep-html-template pep2html.py Log Message: Added "DO NOT EDIT" comment. Updated from Docutils. Index: pep-html-template =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-html-template,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-html-template 12 Sep 2002 02:30:51 -0000 1.2 --- pep-html-template 8 Nov 2002 03:43:48 -0000 1.3 *************** *** 1,8 **** ! ! PEP %(pep)s -- %(title)s %(stylesheet)s --- 1,13 ---- ! ! ! PEP %(pep)s -- %(title)s %(stylesheet)s Index: pep2html.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** pep2html.py 19 Oct 2002 01:33:12 -0000 1.46 --- pep2html.py 8 Nov 2002 03:43:48 -0000 1.47 *************** *** 55,58 **** --- 55,64 ---- LOCALVARS = "Local Variables:" + COMMENT = """""" + # The generated HTML doesn't validate -- you cannot use
and

inside #
 tags.  But if I change that, the result doesn't look very nice...
***************
*** 133,136 ****
--- 139,143 ----
      infile = iter(input_lines)
      # convert plaintext pep to minimal XHTML markup
+     print >> outfile, COMMENT
      print >> outfile, DTD
      print >> outfile, ''
***************
*** 237,242 ****
              break
          if line[0].strip():
-             if line.strip() == LOCALVARS:
-                 break
              if not need_pre:
                  print >> outfile, '
' --- 244,247 ---- *************** *** 286,290 **** def fix_rst_pep(inpath, input_lines, outfile): ! from docutils import core, io output = core.publish_string( source=''.join(input_lines), --- 291,295 ---- def fix_rst_pep(inpath, input_lines, outfile): ! from docutils import core output = core.publish_string( source=''.join(input_lines), From goodger@users.sourceforge.net Fri Nov 8 03:44:22 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 07 Nov 2002 19:44:22 -0800 Subject: [Python-checkins] python/nondist/peps pep.css,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv26979 Modified Files: pep.css Log Message: Updated from Docutils. Index: pep.css =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep.css,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep.css 18 Oct 2002 05:19:39 -0000 1.3 --- pep.css 8 Nov 2002 03:44:20 -0000 1.4 *************** *** 43,47 **** text-align: left } ! .rfc2822 th { text-align: right ; font-family: sans-serif ; --- 43,47 ---- text-align: left } ! .rfc2822 th.field-name { text-align: right ; font-family: sans-serif ; *************** *** 49,55 **** font-weight: bold ; margin-bottom: 0em } - - a.target { - color: blue } a.toc-backref { --- 49,52 ---- From goodger@users.sourceforge.net Fri Nov 8 04:26:59 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 07 Nov 2002 20:26:59 -0800 Subject: [Python-checkins] python/nondist/peps pep-0256.txt,1.4,1.5 pep-0258.txt,1.4,1.5 pep-0287.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv4279 Modified Files: pep-0256.txt pep-0258.txt pep-0287.txt Log Message: Updated Index: pep-0256.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0256.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0256.txt 30 Aug 2002 03:10:51 -0000 1.4 --- pep-0256.txt 8 Nov 2002 04:26:56 -0000 1.5 *************** *** 35,40 **** ! Roadmap to the Doctring PEPs ! ============================ There are many aspects to docstring processing. The "Docstring PEPs" --- 35,40 ---- ! Road Map to the Doctring PEPs ! ============================= There are many aspects to docstring processing. The "Docstring PEPs" *************** *** 185,189 **** - Docstring extraction rules. ! - Readers, which encapsulate the input context . - Parsers. --- 185,189 ---- - Docstring extraction rules. ! - Readers, which encapsulate the input context. - Parsers. Index: pep-0258.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0258.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0258.txt 30 Aug 2002 03:10:51 -0000 1.4 --- pep-0258.txt 8 Nov 2002 04:26:56 -0000 1.5 *************** *** 21,25 **** and high-level concepts of a DPS are documented in PEP 256, "Docstring Processing System Framework" [#PEP-256]_. Also see PEP 256 for a ! "Roadmap to the Doctring PEPs". Docutils is being designed modularly so that any of its components can --- 21,25 ---- and high-level concepts of a DPS are documented in PEP 256, "Docstring Processing System Framework" [#PEP-256]_. Also see PEP 256 for a ! "Road Map to the Docstring PEPs". [...1130 lines suppressed...] ! Stylist transforms are specialized transforms specific to a Reader. ! The PySource Reader doesn't have to make any decisions as to style; it ! just produces a logically constructed document tree, parsed and ! linked, including custom node types. Stylist transforms understand ! the custom nodes created by the Reader and convert them into standard ! Docutils nodes. Multiple Stylist transforms may be implemented and one can be chosen --- 889,898 ---- ------------------ ! Stylist transforms are specialized transforms specific to the PySource ! Reader. The PySource Reader doesn't have to make any decisions as to ! style; it just produces a logically constructed document tree, parsed ! and linked, including custom node types. Stylist transforms ! understand the custom nodes created by the Reader and convert them ! into standard Docutils nodes. Multiple Stylist transforms may be implemented and one can be chosen Index: pep-0287.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0287.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0287.txt 30 Aug 2002 03:10:51 -0000 1.4 --- pep-0287.txt 8 Nov 2002 04:26:56 -0000 1.5 *************** *** 26,30 **** Only the low-level syntax of docstrings is addressed here. This PEP is not concerned with docstring semantics or processing at all (see ! PEP 256 for a "Roadmap to the Doctring PEPs"). Nor is it an attempt to deprecate pure plaintext docstrings, which are always going to be legitimate. The reStructuredText markup is an alternative for those --- 26,30 ---- Only the low-level syntax of docstrings is addressed here. This PEP is not concerned with docstring semantics or processing at all (see ! PEP 256 for a "Road Map to the Doctring PEPs"). Nor is it an attempt to deprecate pure plaintext docstrings, which are always going to be legitimate. The reStructuredText markup is an alternative for those From goodger@users.sourceforge.net Fri Nov 8 04:48:18 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu, 07 Nov 2002 20:48:18 -0800 Subject: [Python-checkins] python/nondist/peps pep-0001.txt,1.39,1.40 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv8988 Modified Files: pep-0001.txt Log Message: corrected URL Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** pep-0001.txt 6 Nov 2002 05:38:56 -0000 1.39 --- pep-0001.txt 8 Nov 2002 04:48:16 -0000 1.40 *************** *** 380,384 **** [8] PEP 12, Sample reStructuredText PEP Template, Goodger, Warsaw ! http://www.python.org/peps/pep-0009.html [9] http://docutils.sourceforge.net/ --- 380,384 ---- [8] PEP 12, Sample reStructuredText PEP Template, Goodger, Warsaw ! http://www.python.org/peps/pep-0012.html [9] http://docutils.sourceforge.net/ From rhettinger@users.sourceforge.net Fri Nov 8 05:03:23 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 07 Nov 2002 21:03:23 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11467/test Modified Files: test_sets.py Log Message: Closes SF bug #628246. The _update method detected mutable elements by trapping TypeErrors. Unfortunately, this masked useful TypeErrors raised by the iterable itself. For cases where it is possible for an iterable to raise a TypeError, the iterable is pre-converted to a list outside the try/except so that any TypeErrors propagate through. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_sets.py 25 Aug 2002 18:43:10 -0000 1.13 --- test_sets.py 8 Nov 2002 05:03:21 -0000 1.14 *************** *** 133,136 **** --- 133,160 ---- #============================================================================== + def baditer(): + raise TypeError + yield True + + def gooditer(): + yield True + + class TestExceptionPropagation(unittest.TestCase): + """SF 628246: Set constructor should not trap iterator TypeErrors""" + + def test_instanceWithException(self): + self.assertRaises(TypeError, Set, baditer()) + + def test_instancesWithoutException(self): + """All of these iterables should load without exception.""" + Set([1,2,3]) + Set((1,2,3)) + Set({'one':1, 'two':2, 'three':3}) + Set(xrange(3)) + Set('abc') + Set(gooditer()) + + #============================================================================== + class TestSetOfSets(unittest.TestCase): def test_constructor(self): *************** *** 605,608 **** --- 629,633 ---- suite = unittest.TestSuite() for klass in (TestSetOfSets, + TestExceptionPropagation, TestBasicOpsEmpty, TestBasicOpsSingleton, From rhettinger@users.sourceforge.net Fri Nov 8 05:03:23 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 07 Nov 2002 21:03:23 -0800 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv11467 Modified Files: sets.py Log Message: Closes SF bug #628246. The _update method detected mutable elements by trapping TypeErrors. Unfortunately, this masked useful TypeErrors raised by the iterable itself. For cases where it is possible for an iterable to raise a TypeError, the iterable is pre-converted to a list outside the try/except so that any TypeErrors propagate through. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** sets.py 4 Oct 2002 20:01:48 -0000 1.31 --- sets.py 8 Nov 2002 05:03:21 -0000 1.32 *************** *** 321,324 **** --- 321,326 ---- value = True + if type(iterable) not in (list, tuple, dict, file, xrange, str): + iterable = list(iterable) it = iter(iterable) while True: From tim_one@users.sourceforge.net Fri Nov 8 05:26:54 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 07 Nov 2002 21:26:54 -0800 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17545/Lib Modified Files: sets.py Log Message: _update(): Commented the new obscurity. Materialized into a tuple instead of into a list for a bit of speed/space savings. Reopened the bug report too (628246), as I'm unclear on why we don't sort out the cause of the TypeError instead. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** sets.py 8 Nov 2002 05:03:21 -0000 1.32 --- sets.py 8 Nov 2002 05:26:52 -0000 1.33 *************** *** 320,327 **** return ! value = True if type(iterable) not in (list, tuple, dict, file, xrange, str): ! iterable = list(iterable) it = iter(iterable) while True: try: --- 320,333 ---- return ! # If the mere process of iterating may raise TypeError, materialize ! # the iterable into a tuple first. Then the TypeError will get ! # raised here and propagated back to the caller. Once we get into ! # the loop following, TypeError is assumed to mean that element ! # can't be used as a dict key. if type(iterable) not in (list, tuple, dict, file, xrange, str): ! iterable = tuple(iterable) ! it = iter(iterable) + value = True while True: try: From rhettinger@users.sourceforge.net Fri Nov 8 05:30:25 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 07 Nov 2002 21:30:25 -0800 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.66,1.67 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv18317 Modified Files: ref5.tex Log Message: Closes SF bug #634069 reporting the docs on the ** operator were out of date and did not reflect the current CPython implementation. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** ref5.tex 11 Oct 2002 21:08:02 -0000 1.66 --- ref5.tex 8 Nov 2002 05:30:23 -0000 1.67 *************** *** 600,607 **** its left argument raised to the power of its right argument. The numeric arguments are first converted to a common type. The result ! type is that of the arguments after coercion; if the result is not ! expressible in that type (as in raising an integer to a negative ! power, or a negative floating point number to a broken power), a ! \exception{TypeError} exception is raised. --- 600,617 ---- its left argument raised to the power of its right argument. The numeric arguments are first converted to a common type. The result ! type is that of the arguments after coercion. ! ! With mixed operand types, the coercion rules for binary arithmetic ! operators apply. For int and long int operands, the result has the ! same type as the operands (after coercion) unless the second argument ! is negative; in that case, all arguments are converted to float and a ! float result is delivered. For example, \code{10**2} returns \code{100}, ! but \code{10**-2} returns \code{0.01}. (This last feature was added in ! Python 2.2. In Python 2.1 and before, if both arguments were of integer ! types and the second argument was negative, an exception was raised). ! ! Raising \code{0.0} to a negative power results in a ! \exception{ZeroDivisionError}. Raising a negative number to a ! fractional power results in a \exception{ValueError}. From rhettinger@users.sourceforge.net Fri Nov 8 05:48:13 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 07 Nov 2002 21:48:13 -0800 Subject: [Python-checkins] python/dist/src/Tools/idle README.txt,1.8,1.8.26.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv22630 Modified Files: Tag: release22-maint README.txt Log Message: Clarify what it means to require Python 1.5.2. Index: README.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/README.txt,v retrieving revision 1.8 retrieving revision 1.8.26.1 diff -C2 -d -r1.8 -r1.8.26.1 *** README.txt 15 Feb 2000 19:11:26 -0000 1.8 --- README.txt 8 Nov 2002 05:48:11 -0000 1.8.26.1 *************** *** 36,42 **** Try "./idle.py -h" to see other command line options. ! IDLE requires Python 1.5.2, so it is currently only usable with a ! Python 1.5.2 distribution. (An older version of IDLE is distributed ! with Python 1.5.2; you can drop this version on top of it.) COPYRIGHT --- 36,42 ---- Try "./idle.py -h" to see other command line options. ! IDLE requires Python 1.5.2 or late, so it is currently only usable with ! a Python 1.5.2 distribution or later. (An older version of IDLE is ! distributed with Python 1.5.2; you can drop this version on top of it.) COPYRIGHT From rhettinger@users.sourceforge.net Fri Nov 8 05:49:49 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 07 Nov 2002 21:49:49 -0800 Subject: [Python-checkins] python/dist/src/Tools/idle README.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv23020 Modified Files: README.txt Log Message: Clarify the meaning of "requires Python 1.5.2". Index: README.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/README.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** README.txt 15 Feb 2000 19:11:26 -0000 1.8 --- README.txt 8 Nov 2002 05:49:47 -0000 1.9 *************** *** 36,42 **** Try "./idle.py -h" to see other command line options. ! IDLE requires Python 1.5.2, so it is currently only usable with a ! Python 1.5.2 distribution. (An older version of IDLE is distributed ! with Python 1.5.2; you can drop this version on top of it.) COPYRIGHT --- 36,43 ---- Try "./idle.py -h" to see other command line options. ! IDLE requires Python 1.5.2 or later, so it is currently only usable ! with a Python 1.5.2 (or later) distribution. (An older version of ! IDLE is distributed with Python 1.5.2; you can drop this version on ! top of it.) COPYRIGHT From fdrake@users.sourceforge.net Fri Nov 8 07:43:00 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 07 Nov 2002 23:43:00 -0800 Subject: [Python-checkins] python/dist/src/Tools/idle README.txt,1.8.26.1,1.8.26.2 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv18453 Modified Files: Tag: release22-maint README.txt Log Message: Fix typo only present in the r22-maint branch. Index: README.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/README.txt,v retrieving revision 1.8.26.1 retrieving revision 1.8.26.2 diff -C2 -d -r1.8.26.1 -r1.8.26.2 *** README.txt 8 Nov 2002 05:48:11 -0000 1.8.26.1 --- README.txt 8 Nov 2002 07:42:58 -0000 1.8.26.2 *************** *** 36,40 **** Try "./idle.py -h" to see other command line options. ! IDLE requires Python 1.5.2 or late, so it is currently only usable with a Python 1.5.2 distribution or later. (An older version of IDLE is distributed with Python 1.5.2; you can drop this version on top of it.) --- 36,40 ---- Try "./idle.py -h" to see other command line options. ! IDLE requires Python 1.5.2 or later, so it is currently only usable with a Python 1.5.2 distribution or later. (An older version of IDLE is distributed with Python 1.5.2; you can drop this version on top of it.) From walter@livinglogic.de Fri Nov 8 10:40:58 2002 From: walter@livinglogic.de (=?ISO-8859-15?Q?Walter_D=F6rwald?=) Date: Fri, 08 Nov 2002 11:40:58 +0100 Subject: [Python-checkins] python/nondist/peps pep-html-template,1.2,1.3 pep2html.py,1.46,1.47 In-Reply-To: References: Message-ID: <3DCB94BA.40904@livinglogic.de> goodger@users.sourceforge.net wrote: > [...] > Index: pep-html-template > =================================================================== > RCS file: /cvsroot/python/python/nondist/peps/pep-html-template,v > [...] > > ! > ! > > > > ! > PEP %(pep)s -- %(title)s > %(stylesheet)s If this file claims to be XML shouldn't it include proper empty tags? I.e. all empty tags should include a / at the end like this: Bye, Walter Dörwald From loewis@users.sourceforge.net Fri Nov 8 12:10:02 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 08 Nov 2002 04:10:02 -0800 Subject: [Python-checkins] python/dist/src/Lib string.py,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13180/Lib Modified Files: string.py Log Message: Make strip behave as documented. Will backport to 2.2.3. Index: string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/string.py,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** string.py 14 Oct 2002 20:03:40 -0000 1.65 --- string.py 8 Nov 2002 12:09:59 -0000 1.66 *************** *** 75,79 **** # Strip leading and trailing tabs and spaces ! def strip(s): """strip(s) -> string --- 75,79 ---- # Strip leading and trailing tabs and spaces ! def strip(s, chars=None): """strip(s) -> string *************** *** 82,86 **** """ ! return s.strip() # Strip leading tabs and spaces --- 82,86 ---- """ ! return s.strip(chars) # Strip leading tabs and spaces From loewis@users.sourceforge.net Fri Nov 8 12:11:05 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 08 Nov 2002 04:11:05 -0800 Subject: [Python-checkins] python/dist/src/Lib string.py,1.60.16.2,1.60.16.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13570 Modified Files: Tag: release22-maint string.py Log Message: Make strip work as documented. Index: string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/string.py,v retrieving revision 1.60.16.2 retrieving revision 1.60.16.3 diff -C2 -d -r1.60.16.2 -r1.60.16.3 *** string.py 22 Apr 2002 11:57:05 -0000 1.60.16.2 --- string.py 8 Nov 2002 12:11:03 -0000 1.60.16.3 *************** *** 74,78 **** # Strip leading and trailing tabs and spaces ! def strip(s): """strip(s) -> string --- 74,78 ---- # Strip leading and trailing tabs and spaces ! def strip(s, chars=None): """strip(s) -> string *************** *** 81,85 **** """ ! return s.strip() # Strip leading tabs and spaces --- 81,85 ---- """ ! return s.strip(chars) # Strip leading tabs and spaces From gvanrossum@users.sourceforge.net Fri Nov 8 12:15:46 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 08 Nov 2002 04:15:46 -0800 Subject: [Python-checkins] python/nondist/peps pep-0256.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv15841 Modified Files: pep-0256.txt Log Message: Typo. Index: pep-0256.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0256.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0256.txt 8 Nov 2002 04:26:56 -0000 1.5 --- pep-0256.txt 8 Nov 2002 12:15:44 -0000 1.6 *************** *** 35,40 **** ! Road Map to the Doctring PEPs ! ============================= There are many aspects to docstring processing. The "Docstring PEPs" --- 35,40 ---- ! Road Map to the Docstring PEPs ! ============================== There are many aspects to docstring processing. The "Docstring PEPs" From mwh@users.sourceforge.net Fri Nov 8 12:53:12 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 08 Nov 2002 04:53:12 -0800 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.75,2.76 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv5667/Modules Modified Files: pyexpat.c Log Message: Assorted patches from Armin Rigo: [ 617309 ] getframe hook (Psyco #1) [ 617311 ] Tiny profiling info (Psyco #2) [ 617312 ] debugger-controlled jumps (Psyco #3) These are forward ports from 2.2.2. Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.75 retrieving revision 2.76 diff -C2 -d -r2.75 -r2.76 *** pyexpat.c 24 Sep 2002 16:24:54 -0000 2.75 --- pyexpat.c 8 Nov 2002 12:53:10 -0000 2.76 *************** *** 305,309 **** tstate, /*back*/ c, /*code*/ ! tstate->frame->f_globals, /*globals*/ NULL /*locals*/ ); --- 305,309 ---- tstate, /*back*/ c, /*code*/ ! PyEval_GetGlobals(), /*globals*/ NULL /*locals*/ ); From mwh@users.sourceforge.net Fri Nov 8 12:53:12 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 08 Nov 2002 04:53:12 -0800 Subject: [Python-checkins] python/dist/src/Include pystate.h,2.20,2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv5667/Include Modified Files: pystate.h Log Message: Assorted patches from Armin Rigo: [ 617309 ] getframe hook (Psyco #1) [ 617311 ] Tiny profiling info (Psyco #2) [ 617312 ] debugger-controlled jumps (Psyco #3) These are forward ports from 2.2.2. Index: pystate.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pystate.h,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** pystate.h 3 Sep 2002 20:10:44 -0000 2.20 --- pystate.h 8 Nov 2002 12:53:10 -0000 2.21 *************** *** 68,71 **** --- 68,73 ---- PyObject *dict; + int tick_counter; + /* XXX signal handlers should also be here */ *************** *** 105,108 **** --- 107,113 ---- PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); + + /* hook for PyEval_GetFrame(), requested for Psyco */ + PyAPI_DATA(unaryfunc) _PyThreadState_GetFrame; #ifdef __cplusplus From mwh@users.sourceforge.net Fri Nov 8 12:53:13 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 08 Nov 2002 04:53:13 -0800 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.339,2.340 pystate.c,2.21,2.22 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv5667/Python Modified Files: ceval.c pystate.c Log Message: Assorted patches from Armin Rigo: [ 617309 ] getframe hook (Psyco #1) [ 617311 ] Tiny profiling info (Psyco #2) [ 617312 ] debugger-controlled jumps (Psyco #3) These are forward ports from 2.2.2. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.339 retrieving revision 2.340 diff -C2 -d -r2.339 -r2.340 *** ceval.c 6 Nov 2002 15:17:32 -0000 2.339 --- ceval.c 8 Nov 2002 12:53:10 -0000 2.340 *************** *** 52,56 **** PyFrameObject *, int); static void call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *); ! static void maybe_call_line_trace(int, Py_tracefunc, PyObject *, PyFrameObject *, int *, int *); --- 52,56 ---- PyFrameObject *, int); static void call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *); ! static void maybe_call_line_trace(Py_tracefunc, PyObject *, PyFrameObject *, int *, int *); *************** *** 600,621 **** tstate->frame = f; - co = f->f_code; - names = co->co_names; - consts = co->co_consts; - fastlocals = f->f_localsplus; - freevars = f->f_localsplus + f->f_nlocals; - _PyCode_GETCODEPTR(co, &first_instr); - /* An explanation is in order for the next line. - - f->f_lasti now refers to the index of the last instruction - executed. You might think this was obvious from the name, but - this wasn't always true before 2.3! PyFrame_New now sets - f->f_lasti to -1 (i.e. the index *before* the first instruction) - and YIELD_VALUE doesn't fiddle with f_lasti any more. So this - does work. Promise. */ - next_instr = first_instr + f->f_lasti + 1; - stack_pointer = f->f_stacktop; - assert(stack_pointer != NULL); - f->f_stacktop = NULL; /* remains NULL unless yield suspends frame */ if (tstate->use_tracing) { --- 600,603 ---- *************** *** 656,659 **** --- 638,660 ---- } + co = f->f_code; + names = co->co_names; + consts = co->co_consts; + fastlocals = f->f_localsplus; + freevars = f->f_localsplus + f->f_nlocals; + _PyCode_GETCODEPTR(co, &first_instr); + /* An explanation is in order for the next line. + + f->f_lasti now refers to the index of the last instruction + executed. You might think this was obvious from the name, but + this wasn't always true before 2.3! PyFrame_New now sets + f->f_lasti to -1 (i.e. the index *before* the first instruction) + and YIELD_VALUE doesn't fiddle with f_lasti any more. So this + does work. Promise. */ + next_instr = first_instr + f->f_lasti + 1; + stack_pointer = f->f_stacktop; + assert(stack_pointer != NULL); + f->f_stacktop = NULL; /* remains NULL unless yield suspends frame */ + #ifdef LLTRACE lltrace = PyDict_GetItemString(f->f_globals,"__lltrace__") != NULL; *************** *** 682,685 **** --- 683,687 ---- if (--_Py_Ticker < 0) { _Py_Ticker = _Py_CheckInterval; + tstate->tick_counter++; if (things_to_do) { if (Py_MakePendingCalls() < 0) { *************** *** 717,724 **** fast_next_opcode: - /* Extract opcode and argument */ - f->f_lasti = INSTR_OFFSET(); opcode = NEXTOP(); if (HAS_ARG(opcode)) --- 719,742 ---- fast_next_opcode: f->f_lasti = INSTR_OFFSET(); + /* line-by-line tracing support */ + + if (tstate->c_tracefunc != NULL && !tstate->tracing) { + /* see maybe_call_line_trace + for expository comments */ + f->f_stacktop = stack_pointer; + maybe_call_line_trace(tstate->c_tracefunc, + tstate->c_traceobj, + f, &instr_lb, &instr_ub); + /* Reload possibly changed frame fields */ + JUMPTO(f->f_lasti); + stack_pointer = f->f_stacktop; + assert(stack_pointer != NULL); + f->f_stacktop = NULL; + } + + /* Extract opcode and argument */ + opcode = NEXTOP(); if (HAS_ARG(opcode)) *************** *** 748,762 **** #endif - /* line-by-line tracing support */ - - if (tstate->c_tracefunc != NULL && !tstate->tracing) { - /* see maybe_call_line_trace - for expository comments */ - maybe_call_line_trace(opcode, - tstate->c_tracefunc, - tstate->c_traceobj, - f, &instr_lb, &instr_ub); - } - /* Main switch on opcode */ --- 766,769 ---- *************** *** 2867,2871 **** static void ! maybe_call_line_trace(int opcode, Py_tracefunc func, PyObject *obj, PyFrameObject *frame, int *instr_lb, int *instr_ub) { --- 2874,2878 ---- static void ! maybe_call_line_trace(Py_tracefunc func, PyObject *obj, PyFrameObject *frame, int *instr_lb, int *instr_ub) { *************** *** 3026,3033 **** PyEval_GetBuiltins(void) { ! PyThreadState *tstate = PyThreadState_Get(); ! PyFrameObject *current_frame = tstate->frame; if (current_frame == NULL) ! return tstate->interp->builtins; else return current_frame->f_builtins; --- 3033,3039 ---- PyEval_GetBuiltins(void) { ! PyFrameObject *current_frame = (PyFrameObject *)PyEval_GetFrame(); if (current_frame == NULL) ! return PyThreadState_Get()->interp->builtins; else return current_frame->f_builtins; *************** *** 3037,3041 **** PyEval_GetLocals(void) { ! PyFrameObject *current_frame = PyThreadState_Get()->frame; if (current_frame == NULL) return NULL; --- 3043,3047 ---- PyEval_GetLocals(void) { ! PyFrameObject *current_frame = (PyFrameObject *)PyEval_GetFrame(); if (current_frame == NULL) return NULL; *************** *** 3047,3051 **** PyEval_GetGlobals(void) { ! PyFrameObject *current_frame = PyThreadState_Get()->frame; if (current_frame == NULL) return NULL; --- 3053,3057 ---- PyEval_GetGlobals(void) { ! PyFrameObject *current_frame = (PyFrameObject *)PyEval_GetFrame(); if (current_frame == NULL) return NULL; *************** *** 3057,3062 **** PyEval_GetFrame(void) { ! PyFrameObject *current_frame = PyThreadState_Get()->frame; ! return (PyObject *)current_frame; } --- 3063,3068 ---- PyEval_GetFrame(void) { ! PyThreadState *tstate = PyThreadState_Get(); ! return _PyThreadState_GetFrame((PyObject *)tstate); } *************** *** 3064,3068 **** PyEval_GetRestricted(void) { ! PyFrameObject *current_frame = PyThreadState_Get()->frame; return current_frame == NULL ? 0 : current_frame->f_restricted; } --- 3070,3074 ---- PyEval_GetRestricted(void) { ! PyFrameObject *current_frame = (PyFrameObject *)PyEval_GetFrame(); return current_frame == NULL ? 0 : current_frame->f_restricted; } *************** *** 3071,3075 **** PyEval_MergeCompilerFlags(PyCompilerFlags *cf) { ! PyFrameObject *current_frame = PyThreadState_Get()->frame; int result = 0; --- 3077,3081 ---- PyEval_MergeCompilerFlags(PyCompilerFlags *cf) { ! PyFrameObject *current_frame = (PyFrameObject *)PyEval_GetFrame(); int result = 0; Index: pystate.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pystate.c,v retrieving revision 2.21 retrieving revision 2.22 diff -C2 -d -r2.21 -r2.22 *** pystate.c 3 Sep 2002 20:24:31 -0000 2.21 --- pystate.c 8 Nov 2002 12:53:11 -0000 2.22 *************** *** 36,39 **** --- 36,40 ---- PyThreadState *_PyThreadState_Current = NULL; + unaryfunc _PyThreadState_GetFrame = NULL; *************** *** 114,121 **** --- 115,131 ---- + /* Default implementation for _PyThreadState_GetFrame */ + static struct _frame * + threadstate_getframe(PyThreadState *self) + { + return self->frame; + } + PyThreadState * PyThreadState_New(PyInterpreterState *interp) { PyThreadState *tstate = PyMem_NEW(PyThreadState, 1); + if (_PyThreadState_GetFrame == NULL) + _PyThreadState_GetFrame = (unaryfunc)threadstate_getframe; if (tstate != NULL) { *************** *** 126,129 **** --- 136,140 ---- tstate->tracing = 0; tstate->use_tracing = 0; + tstate->tick_counter = 0; tstate->dict = NULL; From mwh@users.sourceforge.net Fri Nov 8 13:08:48 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 08 Nov 2002 05:08:48 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_trace.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14898/Lib/test Modified Files: test_trace.py Log Message: This is Richie Hindle's patch: [ 631276 ] Exceptions raised by line trace function It conflicted with the patches from Armin I just checked it, so I had to so some bits by hand. Index: test_trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_trace.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_trace.py 2 Oct 2002 13:13:46 -0000 1.4 --- test_trace.py 8 Nov 2002 13:08:45 -0000 1.5 *************** *** 179,192 **** class RaisingTraceFuncTestCase(unittest.TestCase): ! def test_it(self): ! def tr(frame, event, arg): raise ValueError # just something that isn't RuntimeError ! def f(): return 1 try: for i in xrange(sys.getrecursionlimit() + 1): ! sys.settrace(tr) try: ! f() except ValueError: pass --- 179,208 ---- class RaisingTraceFuncTestCase(unittest.TestCase): ! def trace(self, frame, event, arg): ! """A trace function that raises an exception in response to a ! specific trace event.""" ! if event == self.raiseOnEvent: raise ValueError # just something that isn't RuntimeError ! else: ! return self.trace ! ! def f(self): ! """The function to trace; raises an exception if that's the case ! we're testing, so that the 'exception' trace event fires.""" ! if self.raiseOnEvent == 'exception': ! x = 0 ! y = 1/x ! else: return 1 + + def run_test_for_event(self, event): + """Tests that an exception raised in response to the given event is + handled OK.""" + self.raiseOnEvent = event try: for i in xrange(sys.getrecursionlimit() + 1): ! sys.settrace(self.trace) try: ! self.f() except ValueError: pass *************** *** 195,199 **** except RuntimeError: self.fail("recursion counter not reset") ! def test_main(): --- 211,224 ---- except RuntimeError: self.fail("recursion counter not reset") ! ! # Test the handling of exceptions raised by each kind of trace event. ! def test_call(self): ! self.run_test_for_event('call') ! def test_line(self): ! self.run_test_for_event('line') ! def test_return(self): ! self.run_test_for_event('return') ! def test_exception(self): ! self.run_test_for_event('exception') def test_main(): From mwh@users.sourceforge.net Fri Nov 8 13:08:50 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 08 Nov 2002 05:08:50 -0800 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.340,2.341 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv14898/Python Modified Files: ceval.c Log Message: This is Richie Hindle's patch: [ 631276 ] Exceptions raised by line trace function It conflicted with the patches from Armin I just checked it, so I had to so some bits by hand. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.340 retrieving revision 2.341 diff -C2 -d -r2.340 -r2.341 *** ceval.c 8 Nov 2002 12:53:10 -0000 2.340 --- ceval.c 8 Nov 2002 13:08:46 -0000 2.341 *************** *** 52,56 **** PyFrameObject *, int); static void call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *); ! static void maybe_call_line_trace(Py_tracefunc, PyObject *, PyFrameObject *, int *, int *); --- 52,56 ---- PyFrameObject *, int); static void call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *); ! static int maybe_call_line_trace(Py_tracefunc, PyObject *, PyFrameObject *, int *, int *); *************** *** 727,733 **** for expository comments */ f->f_stacktop = stack_pointer; ! maybe_call_line_trace(tstate->c_tracefunc, ! tstate->c_traceobj, ! f, &instr_lb, &instr_ub); /* Reload possibly changed frame fields */ JUMPTO(f->f_lasti); --- 727,738 ---- for expository comments */ f->f_stacktop = stack_pointer; ! ! if (maybe_call_line_trace(tstate->c_tracefunc, ! tstate->c_traceobj, ! f, &instr_lb, &instr_ub)) { ! /* trace function raised an exception */ ! why = WHY_EXCEPTION; ! goto on_error; ! } /* Reload possibly changed frame fields */ JUMPTO(f->f_lasti); *************** *** 2873,2877 **** } ! static void maybe_call_line_trace(Py_tracefunc func, PyObject *obj, PyFrameObject *frame, int *instr_lb, int *instr_ub) --- 2878,2882 ---- } ! static int maybe_call_line_trace(Py_tracefunc func, PyObject *obj, PyFrameObject *frame, int *instr_lb, int *instr_ub) *************** *** 2948,2951 **** --- 2953,2958 ---- */ + int result = 0; + if ((frame->f_lasti < *instr_lb || frame->f_lasti >= *instr_ub)) { PyCodeObject* co = frame->f_code; *************** *** 2981,2986 **** if (addr == frame->f_lasti) { frame->f_lineno = line; ! call_trace(func, obj, frame, ! PyTrace_LINE, Py_None); } --- 2988,2993 ---- if (addr == frame->f_lasti) { frame->f_lineno = line; ! result = call_trace(func, obj, frame, ! PyTrace_LINE, Py_None); } *************** *** 2997,3000 **** --- 3004,3009 ---- } } + + return result; } From mwh@users.sourceforge.net Fri Nov 8 13:09:41 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 08 Nov 2002 05:09:41 -0800 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.214,1.215 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv15910/Misc Modified Files: ACKS Log Message: Richie Hindle Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.214 retrieving revision 1.215 diff -C2 -d -r1.214 -r1.215 *** ACKS 4 Nov 2002 09:56:00 -0000 1.214 --- ACKS 8 Nov 2002 13:09:39 -0000 1.215 *************** *** 227,230 **** --- 227,231 ---- Kevan Heydon Jason Hildebrand + Richie Hindle Konrad Hinsen David Hobley From akuchling@users.sourceforge.net Fri Nov 8 13:11:53 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri, 08 Nov 2002 05:11:53 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.113,1.114 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv17113 Modified Files: setup.py Log Message: Simply delete the fpectl module, instead of leaving it commented out; if people want to compile it, they should edit Modules/Setup, not setup.py Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** setup.py 5 Nov 2002 16:50:04 -0000 1.113 --- setup.py 8 Nov 2002 13:11:50 -0000 1.114 *************** *** 651,676 **** - - # Lee Busby's SIGFPE modules. - # The library to link fpectl with is platform specific. - # Choose *one* of the options below for fpectl: - - # Disabled; it's dangerous or useless except in the hands of experts. - ## if platform == 'irix5': - ## # For SGI IRIX (tested on 5.3): - ## exts.append( Extension('fpectl', ['fpectlmodule.c'], - ## libraries=['fpe']) ) - ## elif 0: # XXX how to detect SunPro? - ## # For Solaris with SunPro compiler (tested on Solaris 2.5 - ## # with SunPro C 4.2): (Without the compiler you don't have - ## # -lsunmath.) - ## #fpectl fpectlmodule.c -R/opt/SUNWspro/lib -lsunmath -lm - ## pass - ## else: - ## # For other systems: see instructions in fpectlmodule.c. - ## #fpectl fpectlmodule.c ... - ## exts.append( Extension('fpectl', ['fpectlmodule.c']) ) - - # Andrew Kuchling's zlib module. Note that some versions of zlib # 1.1.3 have security problems. See CERT Advisory CA-2002-07: --- 651,654 ---- From niemeyer@users.sourceforge.net Fri Nov 8 14:31:51 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Fri, 08 Nov 2002 06:31:51 -0800 Subject: [Python-checkins] python/dist/src/Modules bz2module.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv634/Modules Modified Files: bz2module.c Log Message: * Modules/bz2module.c (BZ2File_dealloc): Call Util_DropReadAhead(). (*): Included aesthetic changes by Neal Norwitz. Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** bz2module.c 5 Nov 2002 18:41:53 -0000 1.3 --- bz2module.c 8 Nov 2002 14:31:49 -0000 1.4 *************** *** 212,216 **** if (bzerror != BZ_OK || buf == end) break; ! if (skipnextlf ) { skipnextlf = 0; if (c == '\n') { --- 212,216 ---- if (bzerror != BZ_OK || buf == end) break; ! if (skipnextlf) { skipnextlf = 0; if (c == '\n') { *************** *** 499,503 **** if (buffersize > INT_MAX) { PyErr_SetString(PyExc_OverflowError, ! "requested number of bytes is more than a Python string can hold"); goto cleanup; } --- 499,504 ---- if (buffersize > INT_MAX) { PyErr_SetString(PyExc_OverflowError, ! "requested number of bytes is " ! "more than a Python string can hold"); goto cleanup; } *************** *** 1224,1234 **** default: error = 1; } if (error) { ! PyErr_SetString(PyExc_ValueError, "invalid mode"); return -1; } mode++; ! if (*mode == 0) break; } --- 1225,1237 ---- default: error = 1; + break; } if (error) { ! PyErr_Format(PyExc_ValueError, ! "invalid mode char %c", *mode); return -1; } mode++; ! if (*mode == '\0') break; } *************** *** 1241,1245 **** file_args = Py_BuildValue("(ssi)", name, mode, buffering); if (!file_args) ! goto error; if (PyFile_Type.tp_init((PyObject *)self, file_args, NULL) < 0) --- 1244,1251 ---- file_args = Py_BuildValue("(ssi)", name, mode, buffering); if (!file_args) ! return -1; ! ! /* From now on, we have stuff to dealloc, so jump to error label ! * instead of returning */ if (PyFile_Type.tp_init((PyObject *)self, file_args, NULL) < 0) *************** *** 1300,1303 **** --- 1306,1310 ---- break; } + Util_DropReadAhead(self); ((PyObject*)self)->ob_type->tp_free((PyObject *)self); } *************** *** 1363,1367 **** ; ! statichere PyTypeObject BZ2File_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ --- 1370,1374 ---- ; ! static PyTypeObject BZ2File_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ *************** *** 1436,1441 **** ACQUIRE_LOCK(self); if (!self->running) { ! PyErr_SetString(PyExc_ValueError, "this object was already " ! "flushed"); goto error; } --- 1443,1448 ---- ACQUIRE_LOCK(self); if (!self->running) { ! PyErr_SetString(PyExc_ValueError, ! "this object was already flushed"); goto error; } *************** *** 1552,1557 **** static PyMethodDef BZ2Comp_methods[] = { ! {"compress", (PyCFunction)BZ2Comp_compress, METH_VARARGS, BZ2Comp_compress__doc__}, ! {"flush", (PyCFunction)BZ2Comp_flush, METH_NOARGS, BZ2Comp_flush__doc__}, {NULL, NULL} /* sentinel */ }; --- 1559,1566 ---- static PyMethodDef BZ2Comp_methods[] = { ! {"compress", (PyCFunction)BZ2Comp_compress, METH_VARARGS, ! BZ2Comp_compress__doc__}, ! {"flush", (PyCFunction)BZ2Comp_flush, METH_NOARGS, ! BZ2Comp_flush__doc__}, {NULL, NULL} /* sentinel */ }; *************** *** 1626,1630 **** "); ! statichere PyTypeObject BZ2Comp_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ --- 1635,1639 ---- "); ! static PyTypeObject BZ2Comp_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ *************** *** 1843,1847 **** "); ! statichere PyTypeObject BZ2Decomp_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ --- 1852,1856 ---- "); ! static PyTypeObject BZ2Decomp_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ From akuchling@users.sourceforge.net Fri Nov 8 15:11:45 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri, 08 Nov 2002 07:11:45 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_rpm.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv27494 Modified Files: bdist_rpm.py Log Message: Fix comment typo Index: bdist_rpm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_rpm.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** bdist_rpm.py 6 Nov 2002 18:44:26 -0000 1.34 --- bdist_rpm.py 8 Nov 2002 15:11:42 -0000 1.35 *************** *** 435,439 **** for (rpm_opt, attr, default) in script_options: ! # Insert contents of file referred to, if no file is refered to # use 'default' as contents of script val = getattr(self, attr) --- 435,439 ---- for (rpm_opt, attr, default) in script_options: ! # Insert contents of file referred to, if no file is referred to # use 'default' as contents of script val = getattr(self, attr) From akuchling@users.sourceforge.net Fri Nov 8 16:18:26 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri, 08 Nov 2002 08:18:26 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils core.py,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv6391 Modified Files: core.py Log Message: [Bug #233259] Ugly traceback for DistutilsPlatformError Fixed by catching all exceptions that are subclasses of DistutilsError, so only the error message will be printed. You can still get the whole traceback by enabling the Distutils debugging mode. Index: core.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/core.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** core.py 7 Nov 2002 16:41:38 -0000 1.53 --- core.py 8 Nov 2002 16:18:24 -0000 1.54 *************** *** 146,152 **** raise SystemExit, error ! except (DistutilsExecError, ! DistutilsFileError, ! DistutilsOptionError, CCompilerError), msg: if DEBUG: --- 146,150 ---- raise SystemExit, error ! except (DistutilsError, CCompilerError), msg: if DEBUG: From gvanrossum@users.sourceforge.net Fri Nov 8 17:03:38 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 08 Nov 2002 09:03:38 -0800 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3971 Modified Files: sets.py Log Message: Another attempt at making the set constructor both safe and fast. [SF bug 628246] Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** sets.py 8 Nov 2002 05:26:52 -0000 1.33 --- sets.py 8 Nov 2002 17:03:36 -0000 1.34 *************** *** 320,343 **** return - # If the mere process of iterating may raise TypeError, materialize - # the iterable into a tuple first. Then the TypeError will get - # raised here and propagated back to the caller. Once we get into - # the loop following, TypeError is assumed to mean that element - # can't be used as a dict key. - if type(iterable) not in (list, tuple, dict, file, xrange, str): - iterable = tuple(iterable) - - it = iter(iterable) value = True ! while True: ! try: ! for element in it: data[element] = value ! return ! except TypeError: ! transform = getattr(element, "_as_immutable", None) ! if transform is None: ! raise # re-raise the TypeError exception we caught ! data[transform()] = value --- 320,349 ---- return value = True ! ! if type(iterable) in (list, tuple, xrange): ! # Optimized: we know that __iter__() and next() can't ! # raise TypeError, so we can move 'try:' out of the loop. ! it = iter(iterable) ! while True: ! try: ! for element in it: ! data[element] = value ! return ! except TypeError: ! transform = getattr(element, "_as_immutable", None) ! if transform is None: ! raise # re-raise the TypeError exception we caught ! data[transform()] = value ! else: ! # Safe: only catch TypeError where intended ! for element in iterable: ! try: data[element] = value ! except TypeError: ! transform = getattr(element, "_as_immutable", None) ! if transform is None: ! raise # re-raise the TypeError exception we caught ! data[transform()] = value From goodger@users.sourceforge.net Fri Nov 8 22:12:33 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 14:12:33 -0800 Subject: [Python-checkins] python/nondist/peps pep-html-template,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv9440 Modified Files: pep-html-template Log Message: fixed meta tags Index: pep-html-template =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-html-template,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-html-template 8 Nov 2002 03:43:48 -0000 1.3 --- pep-html-template 8 Nov 2002 22:12:30 -0000 1.4 *************** *** 8,13 **** ! ! PEP %(pep)s -- %(title)s %(stylesheet)s --- 8,13 ---- ! ! PEP %(pep)s -- %(title)s %(stylesheet)s From goodger@users.sourceforge.net Fri Nov 8 22:22:57 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 14:22:57 -0800 Subject: [Python-checkins] python/nondist/peps pep-0301.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv13425 Modified Files: pep-0301.txt Log Message: update from Richard Jones Index: pep-0301.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0301.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0301.txt 8 Nov 2002 02:59:18 -0000 1.1 --- pep-0301.txt 8 Nov 2002 22:22:55 -0000 1.2 *************** *** 9,13 **** Created: 24-Oct-2002 Python-Version: 2.3 ! Post-History: --- 9,13 ---- Created: 24-Oct-2002 Python-Version: 2.3 ! Post-History: 8-Nov-2002 *************** *** 136,140 **** Owner ! Owns a package name, may assign Maintainer Role for that name Maintainer --- 136,142 ---- Owner ! Owns a package name, may assign Maintainer Role for that name. The ! first user to register information about a package is deemed owner ! of the package name. The Admin user may change this if necessary. Maintainer *************** *** 313,318 **** ================ ! Anthony Baxter and Martin v. Loewis for encouragement and feedback ! during initial drafting. A.M. Kuchling for support including hosting the second prototype. --- 315,320 ---- ================ ! Anthony Baxter, Martin v. Loewis and David Goodger for encouragement ! and feedback during initial drafting. A.M. Kuchling for support including hosting the second prototype. From goodger@users.sourceforge.net Fri Nov 8 23:42:22 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:42:22 -0800 Subject: [Python-checkins] python/nondist/peps/docutils - New directory Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils In directory usw-pr-cvs1:/tmp/cvs-serv6920/docutils Log Message: Directory /cvsroot/python/python/nondist/peps/docutils added to the repository From goodger@users.sourceforge.net Fri Nov 8 23:44:36 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:44:36 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/languages - New directory Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/languages In directory usw-pr-cvs1:/tmp/cvs-serv7454/languages Log Message: Directory /cvsroot/python/python/nondist/peps/docutils/languages added to the repository From goodger@users.sourceforge.net Fri Nov 8 23:44:36 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:44:36 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/writers - New directory Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/writers In directory usw-pr-cvs1:/tmp/cvs-serv7454/writers Log Message: Directory /cvsroot/python/python/nondist/peps/docutils/writers added to the repository From goodger@users.sourceforge.net Fri Nov 8 23:44:36 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:44:36 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/transforms - New directory Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/transforms In directory usw-pr-cvs1:/tmp/cvs-serv7454/transforms Log Message: Directory /cvsroot/python/python/nondist/peps/docutils/transforms added to the repository From goodger@users.sourceforge.net Fri Nov 8 23:44:36 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:44:36 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/parsers - New directory Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/parsers In directory usw-pr-cvs1:/tmp/cvs-serv7454/parsers Log Message: Directory /cvsroot/python/python/nondist/peps/docutils/parsers added to the repository From goodger@users.sourceforge.net Fri Nov 8 23:44:36 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:44:36 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/readers - New directory Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/readers In directory usw-pr-cvs1:/tmp/cvs-serv7454/readers Log Message: Directory /cvsroot/python/python/nondist/peps/docutils/readers added to the repository From goodger@users.sourceforge.net Fri Nov 8 23:45:23 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:45:23 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/parsers/rst - New directory Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/parsers/rst In directory usw-pr-cvs1:/tmp/cvs-serv7705/rst Log Message: Directory /cvsroot/python/python/nondist/peps/docutils/parsers/rst added to the repository From goodger@users.sourceforge.net Fri Nov 8 23:45:33 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:45:33 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/parsers/rst/directives - New directory Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/parsers/rst/directives In directory usw-pr-cvs1:/tmp/cvs-serv7746/directives Log Message: Directory /cvsroot/python/python/nondist/peps/docutils/parsers/rst/directives added to the repository From goodger@users.sourceforge.net Fri Nov 8 23:45:33 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:45:33 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/parsers/rst/languages - New directory Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/parsers/rst/languages In directory usw-pr-cvs1:/tmp/cvs-serv7746/languages Log Message: Directory /cvsroot/python/python/nondist/peps/docutils/parsers/rst/languages added to the repository From goodger@users.sourceforge.net Fri Nov 8 23:47:54 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:47:54 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/parsers .cvsignore,NONE,1.1 __init__.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/parsers In directory usw-pr-cvs1:/tmp/cvs-serv8387/docutils/parsers Added Files: .cvsignore __init__.py Log Message: local copy of Docutils for PEP processing --- NEW FILE: .cvsignore --- *.pyc --- NEW FILE: __init__.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ This package contains Docutils parser modules. """ __docformat__ = 'reStructuredText' from docutils import Component class Parser(Component): component_type = 'parser' def parse(self, inputstring, document): """Override to parse `inputstring` into document tree `document`.""" raise NotImplementedError('subclass must override this method') def setup_parse(self, inputstring, document): """Initial parse setup. Call at start of `self.parse()`.""" self.inputstring = inputstring self.document = document document.reporter.attach_observer(document.note_parse_message) def finish_parse(self): """Finalize parse details. Call at end of `self.parse()`.""" self.document.reporter.detach_observer( self.document.note_parse_message) _parser_aliases = { 'restructuredtext': 'rst', 'rest': 'rst', 'restx': 'rst', 'rtxt': 'rst',} def get_parser_class(parser_name): """Return the Parser class from the `parser_name` module.""" parser_name = parser_name.lower() if _parser_aliases.has_key(parser_name): parser_name = _parser_aliases[parser_name] module = __import__(parser_name, globals(), locals()) return module.Parser From goodger@users.sourceforge.net Fri Nov 8 23:47:54 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:47:54 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/languages .cvsignore,NONE,1.1 __init__.py,NONE,1.1 de.py,NONE,1.1 en.py,NONE,1.1 fr.py,NONE,1.1 sk.py,NONE,1.1 sv.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/languages In directory usw-pr-cvs1:/tmp/cvs-serv8387/docutils/languages Added Files: .cvsignore __init__.py de.py en.py fr.py sk.py sv.py Log Message: local copy of Docutils for PEP processing --- NEW FILE: .cvsignore --- *.pyc --- NEW FILE: __init__.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:51 $ # Copyright: This module has been placed in the public domain. """ This package contains modules for language-dependent features of Docutils. """ __docformat__ = 'reStructuredText' _languages = {} def get_language(language_code): if _languages.has_key(language_code): return _languages[language_code] module = __import__(language_code, globals(), locals()) _languages[language_code] = module return module --- NEW FILE: de.py --- # Authors: David Goodger; Gunnar Schwant # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:51 $ # Copyright: This module has been placed in the public domain. """ German language mappings for language-dependent features of Docutils. """ __docformat__ = 'reStructuredText' from docutils import nodes labels = { 'author': 'Autor', 'authors': 'Autoren', 'organization': 'Organisation', 'address': 'Adresse', 'contact': 'Kontakt', 'version': 'Version', 'revision': 'Revision', 'status': 'Status', 'date': 'Datum', 'dedication': 'Widmung', 'copyright': 'Copyright', 'abstract': 'Zusammenfassung', 'attention': 'Achtung!', 'caution': 'Vorsicht!', 'danger': '!GEFAHR!', 'error': 'Fehler', 'hint': 'Hinweis', 'important': 'Wichtig', 'note': 'Bemerkung', 'tip': 'Tipp', 'warning': 'Warnung', 'contents': 'Inhalt'} """Mapping of node class name to label text.""" bibliographic_fields = { 'autor': nodes.author, 'autoren': nodes.authors, 'organisation': nodes.organization, 'adresse': nodes.address, 'kontakt': nodes.contact, 'version': nodes.version, 'revision': nodes.revision, 'status': nodes.status, 'datum': nodes.date, 'copyright': nodes.copyright, 'widmung': nodes.topic, 'zusammenfassung': nodes.topic} """Field name (lowcased) to node class name mapping for bibliographic fields (field_list).""" author_separators = [';', ','] """List of separator strings for the 'Authors' bibliographic field. Tried in order.""" --- NEW FILE: en.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:51 $ # Copyright: This module has been placed in the public domain. """ English-language mappings for language-dependent features of Docutils. """ __docformat__ = 'reStructuredText' from docutils import nodes labels = { 'author': 'Author', 'authors': 'Authors', 'organization': 'Organization', 'address': 'Address', 'contact': 'Contact', 'version': 'Version', 'revision': 'Revision', 'status': 'Status', 'date': 'Date', 'copyright': 'Copyright', 'dedication': 'Dedication', 'abstract': 'Abstract', 'attention': 'Attention!', 'caution': 'Caution!', 'danger': '!DANGER!', 'error': 'Error', 'hint': 'Hint', 'important': 'Important', 'note': 'Note', 'tip': 'Tip', 'warning': 'Warning', 'contents': 'Contents'} """Mapping of node class name to label text.""" bibliographic_fields = { 'author': nodes.author, 'authors': nodes.authors, 'organization': nodes.organization, 'address': nodes.address, 'contact': nodes.contact, 'version': nodes.version, 'revision': nodes.revision, 'status': nodes.status, 'date': nodes.date, 'copyright': nodes.copyright, 'dedication': nodes.topic, 'abstract': nodes.topic} """Field name (lowcased) to node class name mapping for bibliographic fields (field_list).""" author_separators = [';', ','] """List of separator strings for the 'Authors' bibliographic field. Tried in order.""" --- NEW FILE: fr.py --- # Author: Stefane Fermigier # Contact: sf@fermigier.com # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:51 $ # Copyright: This module has been placed in the public domain. """ French-language mappings for language-dependent features of Docutils. """ __docformat__ = 'reStructuredText' from docutils import nodes labels = { 'author': 'Auteur', 'authors': 'Auteurs', 'organization': 'Organisation', 'address': 'Adresse', 'contact': 'Contact', 'version': 'Version', 'revision': 'R\u00e9vision', 'status': 'Statut', 'date': 'Date', 'copyright': 'Copyright', 'dedication': 'D\u00e9dicace', 'abstract': 'R\u00e9sum\u00e9', 'attention': 'Attention!', 'caution': 'Avertissement!', 'danger': '!DANGER!', 'error': 'Erreur', 'hint': 'Indication', 'important': 'Important', 'note': 'Note', 'tip': 'Astuce', 'warning': 'Avertissement', 'contents': 'Contenu'} """Mapping of node class name to label text.""" bibliographic_fields = { 'auteur': nodes.author, 'auteurs': nodes.authors, 'organisation': nodes.organization, 'adresse': nodes.address, 'contact': nodes.contact, 'version': nodes.version, 'r\u00e9vision': nodes.revision, 'status': nodes.status, 'date': nodes.date, 'copyright': nodes.copyright, 'd\u00e9dicace': nodes.topic, 'r\u00e9sum\u00e9': nodes.topic} """Field name (lowcased) to node class name mapping for bibliographic fields (field_list).""" author_separators = [';', ','] """List of separator strings for the 'Authors' bibliographic field. Tried in order.""" --- NEW FILE: sk.py --- # :Author: Miroslav Vasko # :Contact: zemiak@zoznam.sk # :Revision: $Revision: 1.1 $ # :Date: $Date: 2002/11/08 23:47:51 $ # :Copyright: This module has been placed in the public domain. """ Slovak-language mappings for language-dependent features of Docutils. """ __docformat__ = 'reStructuredText' from docutils import nodes labels = { 'author': u'Autor', 'authors': u'Autori', 'organization': u'Organiz\u00E1cia', 'address': u'Adresa', 'contact': u'Kontakt', 'version': u'Verzia', 'revision': u'Rev\u00EDzia', 'status': u'Stav', 'date': u'D\u00E1tum', 'copyright': u'Copyright', 'dedication': u'Venovanie', 'abstract': u'Abstraktne', 'attention': u'Pozor!', 'caution': u'Opatrne!', 'danger': u'!NEBEZPE\u010cENSTVO!', 'error': u'Chyba', 'hint': u'Rada', 'important': u'D\u00F4le\u017Eit\u00E9', 'note': u'Pozn\u00E1mka', 'tip': u'Tip', 'warning': u'Varovanie', 'contents': u'Obsah'} """Mapping of node class name to label text.""" bibliographic_fields = { u'autor': nodes.author, u'autori': nodes.authors, u'organiz\u00E1cia': nodes.organization, u'adresa': nodes.address, u'kontakt': nodes.contact, u'verzia': nodes.version, u'rev\u00EDzia': nodes.revision, u'stav': nodes.status, u'D\u00E1tum': nodes.date, u'copyright': nodes.copyright, u'venovanie': nodes.topic, u'abstraktne': nodes.topic} """Field name (lowcased) to node class name mapping for bibliographic fields (field_list).""" author_separators = [';', ','] """List of separator strings for the 'Authors' bibliographic field. Tried in order.""" --- NEW FILE: sv.py --- # Author: Adam Chodorowski # Contact: chodorowski@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:51 $ # Copyright: This module has been placed in the public domain. """ Swedish language mappings for language-dependent features of Docutils. """ __docformat__ = 'reStructuredText' from docutils import nodes labels = { 'author': u'F\u00f6rfattare', 'authors': u'F\u00f6rfattare', 'organization': u'Organisation', 'address': u'Adress', 'contact': u'Kontakt', 'version': u'Version', 'revision': u'Revision', 'status': u'Status', 'date': u'Datum', 'copyright': u'Copyright', 'dedication': u'Dedikation', 'abstract': u'Sammanfattning', 'attention': u'Observera!', 'caution': u'Varning!', 'danger': u'FARA!', 'error': u'Fel', 'hint': u'V\u00e4gledning', 'important': u'Viktigt', 'note': u'Notera', 'tip': u'Tips', 'warning': u'Varning', 'contents': u'Inneh\u00e5ll' } """Mapping of node class name to label text.""" bibliographic_fields = { # 'Author' and 'Authors' identical in Swedish; assume the plural: u'f\u00f6rfattare': nodes.authors, u'organisation': nodes.organization, u'adress': nodes.address, u'kontakt': nodes.contact, u'version': nodes.version, u'revision': nodes.revision, u'status': nodes.status, u'datum': nodes.date, u'copyright': nodes.copyright, u'dedikation': nodes.topic, u'sammanfattning': nodes.topic } """Field name (lowcased) to node class name mapping for bibliographic fields (field_list).""" author_separators = [';', ','] """List of separator strings for the 'Authors' bibliographic field. Tried in order.""" From goodger@users.sourceforge.net Fri Nov 8 23:47:54 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:47:54 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/readers .cvsignore,NONE,1.1 __init__.py,NONE,1.1 pep.py,NONE,1.1 standalone.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/readers In directory usw-pr-cvs1:/tmp/cvs-serv8387/docutils/readers Added Files: .cvsignore __init__.py pep.py standalone.py Log Message: local copy of Docutils for PEP processing --- NEW FILE: .cvsignore --- *.pyc --- NEW FILE: __init__.py --- # Authors: David Goodger; Ueli Schlaepfer # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ This package contains Docutils Reader modules. """ __docformat__ = 'reStructuredText' import sys from docutils import utils, parsers, Component from docutils.transforms import universal class Reader(Component): """ Abstract base class for docutils Readers. Each reader module or package must export a subclass also called 'Reader'. The three steps of a Reader's responsibility are defined: `scan()`, `parse()`, and `transform()`. Call `read()` to process a document. """ component_type = 'reader' def __init__(self, parser=None, parser_name='restructuredtext'): """ Initialize the Reader instance. Several instance attributes are defined with dummy initial values. Subclasses may use these attributes as they wish. """ self.parser = parser """A `parsers.Parser` instance shared by all doctrees. May be left unspecified if the document source determines the parser.""" if parser is None and parser_name: self.set_parser(parser_name) self.source = None """`docutils.io` IO object, source of input data.""" self.input = None """Raw text input; either a single string or, for more complex cases, a collection of strings.""" def set_parser(self, parser_name): """Set `self.parser` by name.""" parser_class = parsers.get_parser_class(parser_name) self.parser = parser_class() def read(self, source, parser, settings): self.source = source if not self.parser: self.parser = parser self.settings = settings # May modify self.parser, depending on input: self.input = self.source.read(self) self.parse() return self.document def parse(self): """Parse `self.input` into a document tree.""" self.document = document = self.new_document() self.parser.parse(self.input, document) document.current_source = document.current_line = None def new_document(self): """Create and return a new empty document tree (root node).""" document = utils.new_document(self.source.source_path, self.settings) return document _reader_aliases = {} def get_reader_class(reader_name): """Return the Reader class from the `reader_name` module.""" reader_name = reader_name.lower() if _reader_aliases.has_key(reader_name): reader_name = _reader_aliases[reader_name] module = __import__(reader_name, globals(), locals()) return module.Reader --- NEW FILE: pep.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ Python Enhancement Proposal (PEP) Reader. """ __docformat__ = 'reStructuredText' import sys import os import re from docutils import nodes from docutils.readers import standalone from docutils.transforms import peps, references from docutils.parsers import rst class Reader(standalone.Reader): supported = ('pep',) """Contexts this reader supports.""" settings_spec = ( 'PEP Reader Option Defaults', 'The --pep-references and --rfc-references options (for the ' 'reStructuredText parser) are on by default.', ()) default_transforms = (references.Substitutions, peps.Headers, peps.Contents, references.ChainedTargets, references.AnonymousHyperlinks, references.IndirectHyperlinks, peps.TargetNotes, references.Footnotes, references.ExternalTargets, references.InternalTargets,) settings_default_overrides = {'pep_references': 1, 'rfc_references': 1} def __init__(self, parser=None, parser_name=None): """`parser` should be ``None``.""" if parser is None: parser = rst.Parser(rfc2822=1, inliner=Inliner()) standalone.Reader.__init__(self, parser, '') class Inliner(rst.states.Inliner): """ Extend `rst.Inliner` to for local PEP references. """ pep_url = rst.states.Inliner.pep_url_local --- NEW FILE: standalone.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ Standalone file Reader for the reStructuredText markup syntax. """ __docformat__ = 'reStructuredText' import sys from docutils import readers from docutils.transforms import frontmatter, references from docutils.parsers.rst import Parser class Reader(readers.Reader): supported = ('standalone',) """Contexts this reader supports.""" document = None """A single document tree.""" default_transforms = (references.Substitutions, frontmatter.DocTitle, frontmatter.DocInfo, references.ChainedTargets, references.AnonymousHyperlinks, references.IndirectHyperlinks, references.Footnotes, references.ExternalTargets, references.InternalTargets,) From goodger@users.sourceforge.net Fri Nov 8 23:47:54 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:47:54 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/parsers/rst/languages .cvsignore,NONE,1.1 __init__.py,NONE,1.1 de.py,NONE,1.1 en.py,NONE,1.1 sv.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/parsers/rst/languages In directory usw-pr-cvs1:/tmp/cvs-serv8387/docutils/parsers/rst/languages Added Files: .cvsignore __init__.py de.py en.py sv.py Log Message: local copy of Docutils for PEP processing --- NEW FILE: .cvsignore --- *.pyc --- NEW FILE: __init__.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ This package contains modules for language-dependent features of reStructuredText. """ __docformat__ = 'reStructuredText' _languages = {} def get_language(language_code): if _languages.has_key(language_code): return _languages[language_code] module = __import__(language_code, globals(), locals()) _languages[language_code] = module return module --- NEW FILE: de.py --- # Author: Engelbert Gruber # Contact: grubert@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ German-language mappings for language-dependent features of reStructuredText. """ __docformat__ = 'reStructuredText' directives = { 'achtung': 'attention', 'vorsicht': 'caution', 'gefahr': 'danger', 'fehler': 'error', 'hinweis': 'hint', 'wichtig': 'important', 'notiz': 'note', 'tip': 'tip', 'warnung': 'warning', 'topic': 'topic', # Überbegriff 'line-block': 'line-block', 'parsed-literal': 'parsed-literal', #'questions': 'questions', #'qa': 'questions', #'faq': 'questions', 'meta': 'meta', #'imagemap': 'imagemap', 'bild': 'image', 'abbildung': 'figure', 'raw': 'raw', # unbearbeitet 'include': 'include', # einfügen, "füge ein" would be more like a command. # einfügung would be the noun. 'replace': 'replace', # ersetzen, ersetze 'inhalt': 'contents', 'sectnum': 'sectnum', 'section-numbering': 'sectnum', 'target-notes': 'target-notes', #'footnotes': 'footnotes', #'citations': 'citations', 'restructuredtext-test-directive': 'restructuredtext-test-directive'} """English name to registered (in directives/__init__.py) directive name mapping.""" --- NEW FILE: en.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ English-language mappings for language-dependent features of reStructuredText. """ __docformat__ = 'reStructuredText' directives = { 'attention': 'attention', 'caution': 'caution', 'danger': 'danger', 'error': 'error', 'hint': 'hint', 'important': 'important', 'note': 'note', 'tip': 'tip', 'warning': 'warning', 'topic': 'topic', 'line-block': 'line-block', 'parsed-literal': 'parsed-literal', #'questions': 'questions', #'qa': 'questions', #'faq': 'questions', 'meta': 'meta', #'imagemap': 'imagemap', 'image': 'image', 'figure': 'figure', 'include': 'include', 'raw': 'raw', 'replace': 'replace', 'contents': 'contents', 'sectnum': 'sectnum', 'section-numbering': 'sectnum', 'target-notes': 'target-notes', #'footnotes': 'footnotes', #'citations': 'citations', 'restructuredtext-test-directive': 'restructuredtext-test-directive'} """English name to registered (in directives/__init__.py) directive name mapping.""" --- NEW FILE: sv.py --- # Author: Adam Chodorowski # Contact: chodorowski@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ Swedish language mappings for language-dependent features of reStructuredText. """ __docformat__ = 'reStructuredText' directives = { u'observera': 'attention', u'varning': 'caution', u'fara': 'danger', u'fel': 'error', u'v\u00e4gledning': 'hint', u'viktigt': 'important', u'notera': 'note', u'tips': 'tip', u'varning': 'warning', u'fr\u00e5gor': 'questions', # NOTE: A bit long, but recommended by http://www.nada.kth.se/dataterm/: u'fr\u00e5gor-och-svar': 'questions', u'vanliga-fr\u00e5gor': 'questions', u'meta': 'meta', # u'bildkarta': 'imagemap', # FIXME: Translation might be too literal. u'bild': 'image', u'figur': 'figure', # u'r\u00e5': 'raw', # FIXME: Translation might be too literal. u'inneh\u00e5ll': 'contents', # u'fotnoter': 'footnotes', # u'citeringar': 'citations', # u'\u00e4mne': 'topic', u'restructuredtext-test-directive': 'restructuredtext-test-directive' } """Swedish name to registered (in directives/__init__.py) directive name mapping.""" From goodger@users.sourceforge.net Fri Nov 8 23:47:55 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:47:55 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/writers .cvsignore,NONE,1.1 __init__.py,NONE,1.1 docutils_xml.py,NONE,1.1 html4css1.py,NONE,1.1 pep_html.py,NONE,1.1 pseudoxml.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/writers In directory usw-pr-cvs1:/tmp/cvs-serv8387/docutils/writers Added Files: .cvsignore __init__.py docutils_xml.py html4css1.py pep_html.py pseudoxml.py Log Message: local copy of Docutils for PEP processing --- NEW FILE: .cvsignore --- *.pyc --- NEW FILE: __init__.py --- # Authors: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:53 $ # Copyright: This module has been placed in the public domain. """ This package contains Docutils Writer modules. """ __docformat__ = 'reStructuredText' import sys import docutils from docutils import languages, Component from docutils.transforms import universal class Writer(Component): """ Abstract base class for docutils Writers. Each writer module or package must export a subclass also called 'Writer'. Each writer must support all standard node types listed in `docutils.nodes.node_class_names`. Call `write()` to process a document. """ component_type = 'writer' document = None """The document to write.""" language = None """Language module for the document.""" destination = None """`docutils.io` IO object; where to write the document.""" def __init__(self): """Initialize the Writer instance.""" def write(self, document, destination): self.document = document self.language = languages.get_language( document.settings.language_code) self.destination = destination self.translate() output = self.destination.write(self.output) return output def translate(self): """ Override to do final document tree translation. This is usually done with a `docutils.nodes.NodeVisitor` subclass, in combination with a call to `docutils.nodes.Node.walk()` or `docutils.nodes.Node.walkabout()`. The ``NodeVisitor`` subclass must support all standard elements (listed in `docutils.nodes.node_class_names`) and possibly non-standard elements used by the current Reader as well. """ raise NotImplementedError('subclass must override this method') _writer_aliases = { 'html': 'html4css1', 'pprint': 'pseudoxml', 'pformat': 'pseudoxml', 'pdf': 'rlpdf', 'xml': 'docutils_xml',} def get_writer_class(writer_name): """Return the Writer class from the `writer_name` module.""" writer_name = writer_name.lower() if _writer_aliases.has_key(writer_name): writer_name = _writer_aliases[writer_name] module = __import__(writer_name, globals(), locals()) return module.Writer --- NEW FILE: docutils_xml.py --- # Authors: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:53 $ # Copyright: This module has been placed in the public domain. """ Simple internal document tree Writer, writes Docutils XML. """ __docformat__ = 'reStructuredText' import docutils from docutils import writers class Writer(writers.Writer): supported = ('xml',) """Formats this writer supports.""" settings_spec = ( '"Docutils XML" Writer Options', 'Warning: these options may adversely affect whitespace; use them ' 'only for reading convenience.', (('Generate XML with newlines before and after tags.', ['--newlines'], {'action': 'store_true'}), ('Generate XML with indents and newlines.', ['--indents'], {'action': 'store_true'}),),) output = None """Final translated form of `document`.""" xml_declaration = '\n' #xml_stylesheet = '\n' doctype = ( '\n') generator = '\n' def translate(self): settings = self.document.settings indent = newline = '' if settings.newlines: newline = '\n' if settings.indents: newline = '\n' indent = ' ' output_prefix = [self.xml_declaration % settings.output_encoding, self.doctype, self.generator % docutils.__version__] docnode = self.document.asdom().childNodes[0] self.output = (''.join(output_prefix) + docnode.toprettyxml(indent, newline)) --- NEW FILE: html4css1.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:53 $ # Copyright: This module has been placed in the public domain. """ Simple HyperText Markup Language document tree Writer. The output conforms to the HTML 4.01 Transitional DTD and to the Extensible HTML version 1.0 Transitional DTD (*almost* strict). The output contains a minimum of formatting information. A cascading style sheet ("default.css" by default) is required for proper viewing with a modern graphical browser. """ __docformat__ = 'reStructuredText' import sys [...1106 lines suppressed...] if (children and isinstance(children[0], nodes.paragraph) and (isinstance(children[-1], nodes.bullet_list) or isinstance(children[-1], nodes.enumerated_list))): children.pop() if len(children) <= 1: return else: raise nodes.NodeFound def visit_paragraph(self, node): raise nodes.SkipNode def invisible_visit(self, node): """Invisible nodes should be ignored.""" pass visit_comment = invisible_visit visit_substitution_definition = invisible_visit visit_target = invisible_visit visit_pending = invisible_visit --- NEW FILE: pep_html.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:53 $ # Copyright: This module has been placed in the public domain. """ PEP HTML Writer. """ __docformat__ = 'reStructuredText' import sys import docutils from docutils import nodes, optik, utils from docutils.writers import html4css1 class Writer(html4css1.Writer): settings_spec = html4css1.Writer.settings_spec + ( 'PEP/HTML-Specific Options', 'The HTML --footnote-references option is set to "brackets" by ' 'default.', (('Specify a PEP stylesheet URL, used verbatim. Default is ' '--stylesheet\'s value. If given, --pep-stylesheet overrides ' '--stylesheet.', ['--pep-stylesheet'], {'metavar': ''}), ('Specify a PEP stylesheet file, relative to the current working ' 'directory. The path is adjusted relative to the output HTML ' 'file. Overrides --pep-stylesheet and --stylesheet-path.', ['--pep-stylesheet-path'], {'metavar': ''}), ('Specify a template file. Default is "pep-html-template".', ['--pep-template'], {'default': 'pep-html-template', 'metavar': ''}), ('Python\'s home URL. Default is ".." (parent directory).', ['--python-home'], {'default': '..', 'metavar': ''}), ('Home URL prefix for PEPs. Default is "." (current directory).', ['--pep-home'], {'default': '.', 'metavar': ''}), # Workaround for SourceForge's broken Python # (``import random`` causes a segfault). (optik.SUPPRESS_HELP, ['--no-random'], {'action': 'store_true'}),)) settings_default_overrides = {'footnote_references': 'brackets'} relative_path_settings = ('pep_stylesheet_path', 'pep_template') def __init__(self): html4css1.Writer.__init__(self) self.translator_class = HTMLTranslator def translate(self): html4css1.Writer.translate(self) settings = self.document.settings template = open(settings.pep_template).read() # Substitutions dict for template: subs = {} subs['encoding'] = settings.output_encoding subs['version'] = docutils.__version__ subs['stylesheet'] = ''.join(self.stylesheet) pyhome = settings.python_home subs['pyhome'] = pyhome subs['pephome'] = settings.pep_home if pyhome == '..': subs['pepindex'] = '.' else: subs['pepindex'] = pyhome + '/peps/' index = self.document.first_child_matching_class(nodes.field_list) header = self.document[index] pepnum = header[0][1].astext() subs['pep'] = pepnum if settings.no_random: subs['banner'] = 0 else: import random subs['banner'] = random.randrange(64) try: subs['pepnum'] = '%04i' % int(pepnum) except: subs['pepnum'] = pepnum subs['title'] = header[1][1].astext() subs['body'] = ''.join( self.body_pre_docinfo + self.docinfo + self.body) subs['body_suffix'] = ''.join(self.body_suffix) self.output = template % subs class HTMLTranslator(html4css1.HTMLTranslator): def get_stylesheet_reference(self, relative_to=None): settings = self.settings if relative_to == None: relative_to = settings._destination if settings.pep_stylesheet_path: return utils.relative_path(relative_to, settings.pep_stylesheet_path) elif settings.pep_stylesheet: return settings.pep_stylesheet elif settings._stylesheet_path: return utils.relative_path(relative_to, settings.stylesheet_path) else: return settings.stylesheet def depart_field_list(self, node): html4css1.HTMLTranslator.depart_field_list(self, node) if node.get('class') == 'rfc2822': self.body.append('
\n') --- NEW FILE: pseudoxml.py --- # Authors: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:53 $ # Copyright: This module has been placed in the public domain. """ Simple internal document tree Writer, writes indented pseudo-XML. """ __docformat__ = 'reStructuredText' from docutils import writers class Writer(writers.Writer): supported = ('pprint', 'pformat', 'pseudoxml') """Formats this writer supports.""" output = None """Final translated form of `document`.""" def translate(self): self.output = self.document.pformat() def supports(self, format): """This writer supports all format-specific elements.""" return 1 From goodger@users.sourceforge.net Fri Nov 8 23:47:54 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:47:54 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/parsers/rst .cvsignore,NONE,1.1 __init__.py,NONE,1.1 states.py,NONE,1.1 tableparser.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/parsers/rst In directory usw-pr-cvs1:/tmp/cvs-serv8387/docutils/parsers/rst Added Files: .cvsignore __init__.py states.py tableparser.py Log Message: local copy of Docutils for PEP processing --- NEW FILE: .cvsignore --- *.pyc --- NEW FILE: __init__.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ This is ``docutils.parsers.rst`` package. It exports a single class, `Parser`, the reStructuredText parser. Usage ===== 1. Create a parser:: parser = docutils.parsers.restructuredtext.Parser() Several optional arguments may be passed to modify the parser's behavior. Please see `docutils.parsers.Parser` for details. 2. Gather input (a multi-line string), by reading a file or the standard input:: input = sys.stdin.read() 3. Create a new empty `docutils.nodes.document` tree:: document = docutils.utils.new_document(source) See `docutils.utils.new_document()` for parameter details. 4. Run the parser, populating the document tree:: parser.parse(input, document) Parser Overview =============== The reStructuredText parser is implemented as a state machine, examining its input one line at a time. To understand how the parser works, please first become familiar with the `docutils.statemachine` module, then see the `states` module. """ __docformat__ = 'reStructuredText' import docutils.parsers import docutils.statemachine from docutils.parsers.rst import states class Parser(docutils.parsers.Parser): """The reStructuredText parser.""" supported = ('restructuredtext', 'rst', 'rest', 'restx', 'rtxt', 'rstx') """Aliases this parser supports.""" settings_spec = ( 'reStructuredText Parser Options', None, (('Recognize and link to PEP references (like "PEP 258").', ['--pep-references'], {'action': 'store_true'}), ('Recognize and link to RFC references (like "RFC 822").', ['--rfc-references'], {'action': 'store_true'}), ('Set number of spaces for tab expansion (default 8).', ['--tab-width'], {'metavar': '', 'type': 'int', 'default': 8}),)) def __init__(self, rfc2822=None, inliner=None): if rfc2822: self.initial_state = 'RFC2822Body' else: self.initial_state = 'Body' self.state_classes = states.state_classes self.inliner = inliner def parse(self, inputstring, document): """Parse `inputstring` and populate `document`, a document tree.""" self.setup_parse(inputstring, document) debug = document.reporter[''].debug self.statemachine = states.RSTStateMachine( state_classes=self.state_classes, initial_state=self.initial_state, debug=debug) inputlines = docutils.statemachine.string2lines( inputstring, tab_width=document.settings.tab_width, convert_whitespace=1) self.statemachine.run(inputlines, document, inliner=self.inliner) self.finish_parse() --- NEW FILE: states.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ This is the ``docutils.parsers.restructuredtext.states`` module, the core of the reStructuredText parser. It defines the following: :Classes: - `RSTStateMachine`: reStructuredText parser's entry point. - `NestedStateMachine`: recursive StateMachine. - `RSTState`: reStructuredText State superclass. - `Inliner`: For parsing inline markup. - `Body`: Generic classifier of the first line of a block. - `SpecializedBody`: Superclass for compound element members. - `BulletList`: Second and subsequent bullet_list list_items - `DefinitionList`: Second+ definition_list_items. [...2602 lines suppressed...] def escape2null(text): """Return a string with escape-backslashes converted to nulls.""" parts = [] start = 0 while 1: found = text.find('\\', start) if found == -1: parts.append(text[start:]) return ''.join(parts) parts.append(text[start:found]) parts.append('\x00' + text[found+1:found+2]) start = found + 2 # skip character after escape def unescape(text, restore_backslashes=0): """Return a string with nulls removed or restored to backslashes.""" if restore_backslashes: return text.replace('\x00', '\\') else: return ''.join(text.split('\x00')) --- NEW FILE: tableparser.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ This module defines table parser classes,which parse plaintext-graphic tables and produce a well-formed data structure suitable for building a CALS table. :Classes: - `GridTableParser`: Parse fully-formed tables represented with a grid. - `SimpleTableParser`: Parse simple tables, delimited by top & bottom borders. :Exception class: `TableMarkupError` :Function: `update_dict_of_lists()`: Merge two dictionaries containing list values. """ __docformat__ = 'reStructuredText' import re import sys from docutils import DataError class TableMarkupError(DataError): pass class TableParser: """ Abstract superclass for the common parts of the syntax-specific parsers. """ head_body_separator_pat = None """Matches the row separator between head rows and body rows.""" def parse(self, block): """ Analyze the text `block` and return a table data structure. Given a plaintext-graphic table in `block` (list of lines of text; no whitespace padding), parse the table, construct and return the data necessary to construct a CALS table or equivalent. Raise `TableMarkupError` if there is any problem with the markup. """ self.setup(block) self.find_head_body_sep() self.parse_table() structure = self.structure_from_cells() return structure def find_head_body_sep(self): """Look for a head/body row separator line; store the line index.""" for i in range(len(self.block)): line = self.block[i] if self.head_body_separator_pat.match(line): if self.head_body_sep: raise TableMarkupError( 'Multiple head/body row separators in table (at line ' 'offset %s and %s); only one allowed.' % (self.head_body_sep, i)) else: self.head_body_sep = i self.block[i] = line.replace('=', '-') if self.head_body_sep == 0 or self.head_body_sep == (len(self.block) - 1): raise TableMarkupError('The head/body row separator may not be ' 'the first or last line of the table.') class GridTableParser(TableParser): """ Parse a grid table using `parse()`. Here's an example of a grid table:: +------------------------+------------+----------+----------+ | Header row, column 1 | Header 2 | Header 3 | Header 4 | +========================+============+==========+==========+ | body row 1, column 1 | column 2 | column 3 | column 4 | +------------------------+------------+----------+----------+ | body row 2 | Cells may span columns. | +------------------------+------------+---------------------+ | body row 3 | Cells may | - Table cells | +------------------------+ span rows. | - contain | | body row 4 | | - body elements. | +------------------------+------------+---------------------+ Intersections use '+', row separators use '-' (except for one optional head/body row separator, which uses '='), and column separators use '|'. Passing the above table to the `parse()` method will result in the following data structure:: ([24, 12, 10, 10], [[(0, 0, 1, ['Header row, column 1']), (0, 0, 1, ['Header 2']), (0, 0, 1, ['Header 3']), (0, 0, 1, ['Header 4'])]], [[(0, 0, 3, ['body row 1, column 1']), (0, 0, 3, ['column 2']), (0, 0, 3, ['column 3']), (0, 0, 3, ['column 4'])], [(0, 0, 5, ['body row 2']), (0, 2, 5, ['Cells may span columns.']), None, None], [(0, 0, 7, ['body row 3']), (1, 0, 7, ['Cells may', 'span rows.', '']), (1, 1, 7, ['- Table cells', '- contain', '- body elements.']), None], [(0, 0, 9, ['body row 4']), None, None, None]]) The first item is a list containing column widths (colspecs). The second item is a list of head rows, and the third is a list of body rows. Each row contains a list of cells. Each cell is either None (for a cell unused because of another cell's span), or a tuple. A cell tuple contains four items: the number of extra rows used by the cell in a vertical span (morerows); the number of extra columns used by the cell in a horizontal span (morecols); the line offset of the first line of the cell contents; and the cell contents, a list of lines of text. """ head_body_separator_pat = re.compile(r'\+=[=+]+=\+ *$') def setup(self, block): self.block = list(block) # make a copy; it may be modified self.bottom = len(block) - 1 self.right = len(block[0]) - 1 self.head_body_sep = None self.done = [-1] * len(block[0]) self.cells = [] self.rowseps = {0: [0]} self.colseps = {0: [0]} def parse_table(self): """ Start with a queue of upper-left corners, containing the upper-left corner of the table itself. Trace out one rectangular cell, remember it, and add its upper-right and lower-left corners to the queue of potential upper-left corners of further cells. Process the queue in top-to-bottom order, keeping track of how much of each text column has been seen. We'll end up knowing all the row and column boundaries, cell positions and their dimensions. """ corners = [(0, 0)] while corners: top, left = corners.pop(0) if top == self.bottom or left == self.right \ or top <= self.done[left]: continue result = self.scan_cell(top, left) if not result: continue bottom, right, rowseps, colseps = result update_dict_of_lists(self.rowseps, rowseps) update_dict_of_lists(self.colseps, colseps) self.mark_done(top, left, bottom, right) cellblock = self.get_cell_block(top, left, bottom, right) self.cells.append((top, left, bottom, right, cellblock)) corners.extend([(top, right), (bottom, left)]) corners.sort() if not self.check_parse_complete(): raise TableMarkupError('Malformed table; parse incomplete.') def mark_done(self, top, left, bottom, right): """For keeping track of how much of each text column has been seen.""" before = top - 1 after = bottom - 1 for col in range(left, right): assert self.done[col] == before self.done[col] = after def check_parse_complete(self): """Each text column should have been completely seen.""" last = self.bottom - 1 for col in range(self.right): if self.done[col] != last: return None return 1 def get_cell_block(self, top, left, bottom, right): """Given the corners, extract the text of a cell.""" cellblock = [] margin = right for lineno in range(top + 1, bottom): line = self.block[lineno][left + 1 : right].rstrip() cellblock.append(line) if line: margin = min(margin, len(line) - len(line.lstrip())) if 0 < margin < right: cellblock = [line[margin:] for line in cellblock] return cellblock def scan_cell(self, top, left): """Starting at the top-left corner, start tracing out a cell.""" assert self.block[top][left] == '+' result = self.scan_right(top, left) return result def scan_right(self, top, left): """ Look for the top-right corner of the cell, and make note of all column boundaries ('+'). """ colseps = {} line = self.block[top] for i in range(left + 1, self.right + 1): if line[i] == '+': colseps[i] = [top] result = self.scan_down(top, left, i) if result: bottom, rowseps, newcolseps = result update_dict_of_lists(colseps, newcolseps) return bottom, i, rowseps, colseps elif line[i] != '-': return None return None def scan_down(self, top, left, right): """ Look for the bottom-right corner of the cell, making note of all row boundaries. """ rowseps = {} for i in range(top + 1, self.bottom + 1): if self.block[i][right] == '+': rowseps[i] = [right] result = self.scan_left(top, left, i, right) if result: newrowseps, colseps = result update_dict_of_lists(rowseps, newrowseps) return i, rowseps, colseps elif self.block[i][right] != '|': return None return None def scan_left(self, top, left, bottom, right): """ Noting column boundaries, look for the bottom-left corner of the cell. It must line up with the starting point. """ colseps = {} line = self.block[bottom] for i in range(right - 1, left, -1): if line[i] == '+': colseps[i] = [bottom] elif line[i] != '-': return None if line[left] != '+': return None result = self.scan_up(top, left, bottom, right) if result is not None: rowseps = result return rowseps, colseps return None def scan_up(self, top, left, bottom, right): """ Noting row boundaries, see if we can return to the starting point. """ rowseps = {} for i in range(bottom - 1, top, -1): if self.block[i][left] == '+': rowseps[i] = [left] elif self.block[i][left] != '|': return None return rowseps def structure_from_cells(self): """ From the data colledted by `scan_cell()`, convert to the final data structure. """ rowseps = self.rowseps.keys() # list of row boundaries rowseps.sort() rowindex = {} for i in range(len(rowseps)): rowindex[rowseps[i]] = i # row boundary -> row number mapping colseps = self.colseps.keys() # list of column boundaries colseps.sort() colindex = {} for i in range(len(colseps)): colindex[colseps[i]] = i # column boundary -> col number map colspecs = [(colseps[i] - colseps[i - 1] - 1) for i in range(1, len(colseps))] # list of column widths # prepare an empty table with the correct number of rows & columns onerow = [None for i in range(len(colseps) - 1)] rows = [onerow[:] for i in range(len(rowseps) - 1)] # keep track of # of cells remaining; should reduce to zero remaining = (len(rowseps) - 1) * (len(colseps) - 1) for top, left, bottom, right, block in self.cells: rownum = rowindex[top] colnum = colindex[left] assert rows[rownum][colnum] is None, ( 'Cell (row %s, column %s) already used.' % (rownum + 1, colnum + 1)) morerows = rowindex[bottom] - rownum - 1 morecols = colindex[right] - colnum - 1 remaining -= (morerows + 1) * (morecols + 1) # write the cell into the table rows[rownum][colnum] = (morerows, morecols, top + 1, block) assert remaining == 0, 'Unused cells remaining.' if self.head_body_sep: # separate head rows from body rows numheadrows = rowindex[self.head_body_sep] headrows = rows[:numheadrows] bodyrows = rows[numheadrows:] else: headrows = [] bodyrows = rows return (colspecs, headrows, bodyrows) class SimpleTableParser(TableParser): """ Parse a simple table using `parse()`. Here's an example of a simple table:: ===== ===== col 1 col 2 ===== ===== 1 Second column of row 1. 2 Second column of row 2. Second line of paragraph. 3 - Second column of row 3. - Second item in bullet list (row 3, column 2). 4 is a span ------------ 5 ===== ===== Top and bottom borders use '=', column span underlines use '-', column separation is indicated with spaces. Passing the above table to the `parse()` method will result in the following data structure, whose interpretation is the same as for `GridTableParser`:: ([5, 25], [[(0, 0, 1, ['col 1']), (0, 0, 1, ['col 2'])]], [[(0, 0, 3, ['1']), (0, 0, 3, ['Second column of row 1.'])], [(0, 0, 4, ['2']), (0, 0, 4, ['Second column of row 2.', 'Second line of paragraph.'])], [(0, 0, 6, ['3']), (0, 0, 6, ['- Second column of row 3.', '', '- Second item in bullet', ' list (row 3, column 2).'])], [(0, 1, 10, ['4 is a span'])], [(0, 0, 12, ['5']), (0, 0, 12, [''])]]) """ head_body_separator_pat = re.compile('=[ =]*$') span_pat = re.compile('-[ -]*$') def setup(self, block): self.block = list(block) # make a copy; it will be modified # Convert top & bottom borders to column span underlines: self.block[0] = self.block[0].replace('=', '-') self.block[-1] = self.block[-1].replace('=', '-') self.head_body_sep = None self.columns = [] self.border_end = None self.table = [] self.done = [-1] * len(block[0]) self.rowseps = {0: [0]} self.colseps = {0: [0]} def parse_table(self): """ First determine the column boundaries from the top border, then process rows. Each row may consist of multiple lines; accumulate lines until a row is complete. Call `self.parse_row` to finish the job. """ # Top border must fully describe all table columns. self.columns = self.parse_columns(self.block[0], 0) self.border_end = self.columns[-1][1] firststart, firstend = self.columns[0] block = self.block[1:] offset = 0 # Container for accumulating text lines until a row is complete: rowlines = [] while block: line = block.pop(0) offset += 1 if self.span_pat.match(line): # Column span underline or border; row is complete. self.parse_row(rowlines, (line.rstrip(), offset)) rowlines = [] elif line[firststart:firstend].strip(): # First column not blank, therefore it's a new row. if rowlines: self.parse_row(rowlines) rowlines = [(line.rstrip(), offset)] else: # Accumulate lines of incomplete row. rowlines.append((line.rstrip(), offset)) def parse_columns(self, line, offset): """ Given a column span underline, return a list of (begin, end) pairs. """ cols = [] end = 0 while 1: begin = line.find('-', end) end = line.find(' ', begin) if begin < 0: break if end < 0: end = len(line) cols.append((begin, end)) if self.columns: if cols[-1][1] != self.border_end: raise TableMarkupError('Column span incomplete at line ' 'offset %s.' % offset) # Allow for an unbounded rightmost column: cols[-1] = (cols[-1][0], self.columns[-1][1]) return cols def init_row(self, colspec, offset): i = 0 cells = [] for start, end in colspec: morecols = 0 try: assert start == self.columns[i][0] while end != self.columns[i][1]: i += 1 morecols += 1 except (AssertionError, IndexError): raise TableMarkupError('Column span alignment problem at ' 'line offset %s.' % offset) cells.append((0, morecols, offset, [])) i += 1 return cells def parse_row(self, lines, spanline=None): """ Given the text `lines` of a row, parse it and append to `self.table`. The row is parsed according to the current column spec (either `spanline` if provided or `self.columns`). For each column, extract text from each line, and check for text in column margins. Finally, adjust for insigificant whitespace. """ while lines and not lines[-1][0]: lines.pop() # Remove blank trailing lines. if lines: offset = lines[0][1] elif spanline: offset = spanline[1] else: # No new row, just blank lines. return if spanline: columns = self.parse_columns(*spanline) else: columns = self.columns[:] row = self.init_row(columns, offset) # "Infinite" value for a dummy last column's beginning, used to # check for text overflow: columns.append((sys.maxint, None)) lastcol = len(columns) - 2 for i in range(len(columns) - 1): start, end = columns[i] nextstart = columns[i+1][0] block = [] margin = sys.maxint for line, offset in lines: if i == lastcol and line[end:].strip(): text = line[start:].rstrip() columns[lastcol] = (start, start + len(text)) self.adjust_last_column(start + len(text)) elif line[end:nextstart].strip(): raise TableMarkupError('Text in column margin at line ' 'offset %s.' % offset) else: text = line[start:end].rstrip() block.append(text) if text: margin = min(margin, len(text) - len(text.lstrip())) if 0 < margin < sys.maxint: block = [line[margin:] for line in block] row[i][3].extend(block) self.table.append(row) def adjust_last_column(self, new_end): start, end = self.columns[-1] if new_end > end: self.columns[-1] = (start, new_end) def structure_from_cells(self): colspecs = [end - start for start, end in self.columns] first_body_row = 0 if self.head_body_sep: for i in range(len(self.table)): if self.table[i][0][2] > self.head_body_sep: first_body_row = i break return (colspecs, self.table[:first_body_row], self.table[first_body_row:]) def update_dict_of_lists(master, newdata): """ Extend the list values of `master` with those from `newdata`. Both parameters must be dictionaries containing list values. """ for key, values in newdata.items(): master.setdefault(key, []).extend(values) From goodger@users.sourceforge.net Fri Nov 8 23:47:54 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:47:54 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/parsers/rst/directives .cvsignore,NONE,1.1 __init__.py,NONE,1.1 admonitions.py,NONE,1.1 body.py,NONE,1.1 html.py,NONE,1.1 images.py,NONE,1.1 misc.py,NONE,1.1 parts.py,NONE,1.1 references.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/parsers/rst/directives In directory usw-pr-cvs1:/tmp/cvs-serv8387/docutils/parsers/rst/directives Added Files: .cvsignore __init__.py admonitions.py body.py html.py images.py misc.py parts.py references.py Log Message: local copy of Docutils for PEP processing --- NEW FILE: .cvsignore --- *.pyc --- NEW FILE: __init__.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ This package contains directive implementation modules. The interface for directive functions is as follows:: def directive_fn(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): code... # Set function attributes: directive_fn.arguments = ... directive_fn.options = ... direcitve_fn.content = ... Parameters: - ``name`` is the directive type or name. - ``arguments`` is a list of positional arguments. - ``options`` is a dictionary mapping option names to values. - ``content`` is a list of strings, the directive content. - ``lineno`` is the line number of the first line of the directive. - ``content_offset`` is the line offset of the first line of the content from the beginning of the current input. Used when initiating a nested parse. - ``block_text`` is a string containing the entire directive. Include it as the content of a literal block in a system message if there is a problem. - ``state`` is the state which called the directive function. - ``state_machine`` is the state machine which controls the state which called the directive function. Function attributes, interpreted by the directive parser (which calls the directive function): - ``arguments``: A 3-tuple specifying the expected positional arguments, or ``None`` if the directive has no arguments. The 3 items in the tuple are ``(required, optional, whitespace OK in last argument)``: 1. The number of required arguments. 2. The number of optional arguments. 3. A boolean, indicating if the final argument may contain whitespace. Arguments are normally single whitespace-separated words. The final argument may contain whitespace if the third item in the argument spec tuple is 1/True. If the form of the arguments is more complex, specify only one argument (either required or optional) and indicate that final whitespace is OK; the client code must do any context-sensitive parsing. - ``options``: A dictionary, mapping known option names to conversion functions such as `int` or `float`. ``None`` or an empty dict implies no options to parse. - ``content``: A boolean; true if content is allowed. Client code must handle the case where content is required but not supplied (an empty content list will be supplied). Directive functions return a list of nodes which will be inserted into the document tree at the point where the directive was encountered (can be an empty list). See `Creating reStructuredText Directives`_ for more information. .. _Creating reStructuredText Directives: http://docutils.sourceforge.net/spec/howto/rst-directives.html """ __docformat__ = 'reStructuredText' from docutils import nodes from docutils.parsers.rst.languages import en as _fallback_language_module _directive_registry = { 'attention': ('admonitions', 'attention'), 'caution': ('admonitions', 'caution'), 'danger': ('admonitions', 'danger'), 'error': ('admonitions', 'error'), 'important': ('admonitions', 'important'), 'note': ('admonitions', 'note'), 'tip': ('admonitions', 'tip'), 'hint': ('admonitions', 'hint'), 'warning': ('admonitions', 'warning'), 'topic': ('body', 'topic'), 'line-block': ('body', 'line_block'), 'parsed-literal': ('body', 'parsed_literal'), #'questions': ('body', 'question_list'), 'image': ('images', 'image'), 'figure': ('images', 'figure'), 'contents': ('parts', 'contents'), 'sectnum': ('parts', 'sectnum'), #'footnotes': ('parts', 'footnotes'), #'citations': ('parts', 'citations'), 'target-notes': ('references', 'target_notes'), 'meta': ('html', 'meta'), #'imagemap': ('html', 'imagemap'), 'raw': ('misc', 'raw'), 'include': ('misc', 'include'), 'replace': ('misc', 'replace'), 'restructuredtext-test-directive': ('misc', 'directive_test_function'),} """Mapping of directive name to (module name, function name). The directive name is canonical & must be lowercase. Language-dependent names are defined in the ``language`` subpackage.""" _modules = {} """Cache of imported directive modules.""" _directives = {} """Cache of imported directive functions.""" def directive(directive_name, language_module, document): """ Locate and return a directive function from its language-dependent name. If not found in the current language, check English. """ normname = directive_name.lower() messages = [] if _directives.has_key(normname): return _directives[normname], messages try: canonicalname = language_module.directives[normname] except (KeyError, AttributeError): msg_text = ('No directive entry for "%s" in module "%s".' % (directive_name, language_module.__name__)) try: canonicalname = _fallback_language_module.directives[normname] msg_text += ('\nUsing English fallback for directive "%s".' % directive_name) except KeyError: msg_text += ('\nTrying "%s" as canonical directive name.' % directive_name) # The canonical name should be an English name, but just in case: canonicalname = normname warning = document.reporter.warning( msg_text, line=document.current_line) messages.append(warning) try: modulename, functionname = _directive_registry[canonicalname] except KeyError: return None, messages if _modules.has_key(modulename): module = _modules[modulename] else: try: module = __import__(modulename, globals(), locals()) except ImportError: return None, messages try: function = getattr(module, functionname) _directives[normname] = function except AttributeError: return None, messages return function, messages def flag(argument): """ Check for a valid flag option (no argument) and return ``None``. Raise ``ValueError`` if an argument is found. """ if argument and argument.strip(): raise ValueError('no argument is allowed; "%s" supplied' % argument) else: return None def unchanged(argument): """ Return the argument, unchanged. Raise ``ValueError`` if no argument is found. """ if argument is None: raise ValueError('argument required but none supplied') else: return argument # unchanged! def path(argument): """ Return the path argument unwrapped (with newlines removed). Raise ``ValueError`` if no argument is found or if the path contains internal whitespace. """ if argument is None: raise ValueError('argument required but none supplied') else: path = ''.join([s.strip() for s in argument.splitlines()]) if path.find(' ') == -1: return path else: raise ValueError('path contains whitespace') def nonnegative_int(argument): """ Check for a nonnegative integer argument; raise ``ValueError`` if not. """ value = int(argument) if value < 0: raise ValueError('negative value; must be positive or zero') return value def format_values(values): return '%s, or "%s"' % (', '.join(['"%s"' % s for s in values[:-1]]), values[-1]) def choice(argument, values): try: value = argument.lower().strip() except AttributeError: raise ValueError('must supply an argument; choose from %s' % format_values(values)) if value in values: return value else: raise ValueError('"%s" unknown; choose from %s' % (argument, format_values(values))) --- NEW FILE: admonitions.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ Admonition directives. """ __docformat__ = 'reStructuredText' from docutils.parsers.rst import states from docutils import nodes def admonition(node_class, name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): text = '\n'.join(content) admonition_node = node_class(text) if text: state.nested_parse(content, content_offset, admonition_node) return [admonition_node] else: error = state_machine.reporter.error( 'The "%s" admonition is empty; content required.' % (name), nodes.literal_block(block_text, block_text), line=lineno) return [error] def attention(*args): return admonition(nodes.attention, *args) attention.content = 1 def caution(*args): return admonition(nodes.caution, *args) caution.content = 1 def danger(*args): return admonition(nodes.danger, *args) danger.content = 1 def error(*args): return admonition(nodes.error, *args) error.content = 1 def important(*args): return admonition(nodes.important, *args) important.content = 1 def note(*args): return admonition(nodes.note, *args) note.content = 1 def tip(*args): return admonition(nodes.tip, *args) tip.content = 1 def hint(*args): return admonition(nodes.hint, *args) hint.content = 1 def warning(*args): return admonition(nodes.warning, *args) warning.content = 1 --- NEW FILE: body.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ Directives for additional body elements. """ __docformat__ = 'reStructuredText' import sys from docutils import nodes def topic(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): if not state_machine.match_titles: error = state_machine.reporter.error( 'Topics may not be nested within topics or body elements.', nodes.literal_block(block_text, block_text), line=lineno) return [error] if not content: warning = state_machine.reporter.warning( 'Content block expected for the "%s" directive; none found.' % name, nodes.literal_block(block_text, block_text), line=lineno) return [warning] title_text = arguments[0] textnodes, messages = state.inline_text(title_text, lineno) title = nodes.title(title_text, '', *textnodes) text = '\n'.join(content) topic_node = nodes.topic(text, title, *messages) if text: state.nested_parse(content, content_offset, topic_node) return [topic_node] topic.arguments = (1, 0, 1) topic.content = 1 def line_block(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine, node_class=nodes.line_block): if not content: warning = state_machine.reporter.warning( 'Content block expected for the "%s" directive; none found.' % name, nodes.literal_block(block_text, block_text), line=lineno) return [warning] text = '\n'.join(content) text_nodes, messages = state.inline_text(text, lineno) node = node_class(text, '', *text_nodes) return [node] + messages line_block.content = 1 def parsed_literal(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): return line_block(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine, node_class=nodes.literal_block) parsed_literal.content = 1 --- NEW FILE: html.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ Directives for typically HTML-specific constructs. """ __docformat__ = 'reStructuredText' import sys from docutils import nodes, utils from docutils.parsers.rst import states from docutils.transforms import components def meta(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): node = nodes.Element() if content: new_line_offset, blank_finish = state.nested_list_parse( content, content_offset, node, initial_state='MetaBody', blank_finish=1, state_machine_kwargs=metaSMkwargs) if (new_line_offset - content_offset) != len(content): # incomplete parse of block? error = state_machine.reporter.error( 'Invalid meta directive.', nodes.literal_block(block_text, block_text), line=lineno) node += error else: error = state_machine.reporter.error( 'Empty meta directive.', nodes.literal_block(block_text, block_text), line=lineno) node += error return node.get_children() meta.content = 1 def imagemap(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): return [] class MetaBody(states.SpecializedBody): class meta(nodes.Special, nodes.PreBibliographic, nodes.Element): """HTML-specific "meta" element.""" pass def field_marker(self, match, context, next_state): """Meta element.""" node, blank_finish = self.parsemeta(match) self.parent += node return [], next_state, [] def parsemeta(self, match): name = self.parse_field_marker(match) indented, indent, line_offset, blank_finish = \ self.state_machine.get_first_known_indented(match.end()) node = self.meta() pending = nodes.pending(components.Filter, {'component': 'writer', 'format': 'html', 'nodes': [node]}) node['content'] = ' '.join(indented) if not indented: line = self.state_machine.line msg = self.reporter.info( 'No content for meta tag "%s".' % name, nodes.literal_block(line, line), line=self.state_machine.abs_line_number()) return msg, blank_finish tokens = name.split() try: attname, val = utils.extract_name_value(tokens[0])[0] node[attname.lower()] = val except utils.NameValueError: node['name'] = tokens[0] for token in tokens[1:]: try: attname, val = utils.extract_name_value(token)[0] node[attname.lower()] = val except utils.NameValueError, detail: line = self.state_machine.line msg = self.reporter.error( 'Error parsing meta tag attribute "%s": %s.' % (token, detail), nodes.literal_block(line, line), line=self.state_machine.abs_line_number()) return msg, blank_finish self.document.note_pending(pending) return pending, blank_finish metaSMkwargs = {'state_classes': (MetaBody,)} --- NEW FILE: images.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ Directives for figures and simple images. """ __docformat__ = 'reStructuredText' import sys from docutils import nodes, utils from docutils.parsers.rst import directives align_values = ('top', 'middle', 'bottom', 'left', 'center', 'right') def align(argument): return directives.choice(argument, align_values) def image(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): reference = ''.join(arguments[0].split('\n')) if reference.find(' ') != -1: error = state_machine.reporter.error( 'Image URI contains whitespace.', nodes.literal_block(block_text, block_text), line=lineno) return [error] options['uri'] = reference image_node = nodes.image(block_text, **options) return [image_node] image.arguments = (1, 0, 1) image.options = {'alt': directives.unchanged, 'height': directives.nonnegative_int, 'width': directives.nonnegative_int, 'scale': directives.nonnegative_int, 'align': align} def figure(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): (image_node,) = image(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine) if isinstance(image_node, nodes.system_message): return [image_node] figure_node = nodes.figure('', image_node) if content: node = nodes.Element() # anonymous container for parsing state.nested_parse(content, content_offset, node) first_node = node[0] if isinstance(first_node, nodes.paragraph): caption = nodes.caption(first_node.rawsource, '', *first_node.children) figure_node += caption elif not (isinstance(first_node, nodes.comment) and len(first_node) == 0): error = state_machine.reporter.error( 'Figure caption must be a paragraph or empty comment.', nodes.literal_block(block_text, block_text), line=lineno) return [figure_node, error] if len(node) > 1: figure_node += nodes.legend('', *node[1:]) return [figure_node] figure.arguments = (1, 0, 1) figure.options = image.options figure.content = 1 --- NEW FILE: misc.py --- # Authors: David Goodger, Dethe Elza # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """Miscellaneous directives.""" __docformat__ = 'reStructuredText' import sys import os.path from urllib2 import urlopen, URLError from docutils import nodes, statemachine, utils from docutils.parsers.rst import directives, states def include(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """Include a reST file as part of the content of this reST file.""" source_dir = os.path.dirname( os.path.abspath(state.document.current_source)) path = ''.join(arguments[0].splitlines()) if path.find(' ') != -1: error = state_machine.reporter.error( '"%s" directive path contains whitespace.' % name, nodes.literal_block(block_text, block_text), line=lineno) return [error] path = os.path.normpath(os.path.join(source_dir, path)) path = utils.relative_path(None, path) try: include_file = open(path) except IOError, error: severe = state_machine.reporter.severe( 'Problems with "%s" directive path:\n%s.' % (name, error), nodes.literal_block(block_text, block_text), line=lineno) return [severe] include_text = include_file.read() include_file.close() if options.has_key('literal'): literal_block = nodes.literal_block(include_text, include_text, source=path) literal_block.line = 1 return literal_block else: include_lines = statemachine.string2lines(include_text, convert_whitespace=1) state_machine.insert_input(include_lines, path) return [] include.arguments = (1, 0, 1) include.options = {'literal': directives.flag} def raw(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """ Pass through content unchanged Content is included in output based on type argument Content may be included inline (content section of directive) or imported from a file or url. """ attributes = {'format': arguments[0]} if content: if options.has_key('file') or options.has_key('url'): error = state_machine.reporter.error( '"%s" directive may not both specify an external file and ' 'have content.' % name, nodes.literal_block(block_text, block_text), line=lineno) return [error] text = '\n'.join(content) elif options.has_key('file'): if options.has_key('url'): error = state_machine.reporter.error( 'The "file" and "url" options may not be simultaneously ' 'specified for the "%s" directive.' % name, nodes.literal_block(block_text, block_text), line=lineno) return [error] source_dir = os.path.dirname( os.path.abspath(state.document.current_source)) path = os.path.normpath(os.path.join(source_dir, options['file'])) path = utils.relative_path(None, path) try: raw_file = open(path) except IOError, error: severe = state_machine.reporter.severe( 'Problems with "%s" directive path:\n%s.' % (name, error), nodes.literal_block(block_text, block_text), line=lineno) return [severe] text = raw_file.read() raw_file.close() attributes['source'] = path elif options.has_key('url'): try: raw_file = urlopen(options['url']) except (URLError, IOError, OSError), error: severe = state_machine.reporter.severe( 'Problems with "%s" directive URL "%s":\n%s.' % (name, options['url'], error), nodes.literal_block(block_text, block_text), line=lineno) return [severe] text = raw_file.read() raw_file.close() attributes['source'] = options['file'] else: error = state_machine.reporter.warning( 'The "%s" directive requires content; none supplied.' % (name), nodes.literal_block(block_text, block_text), line=lineno) return [error] raw_node = nodes.raw('', text, **attributes) return [raw_node] raw.arguments = (1, 0, 1) raw.options = {'file': directives.path, 'url': directives.path} raw.content = 1 def replace(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): if not isinstance(state, states.SubstitutionDef): error = state_machine.reporter.error( 'Invalid context: the "%s" directive can only be used within a ' 'substitution definition.' % (name), nodes.literal_block(block_text, block_text), line=lineno) return [error] text = '\n'.join(content) element = nodes.Element(text) if text: state.nested_parse(content, content_offset, element) if len(element) != 1 or not isinstance(element[0], nodes.paragraph): messages = [] for node in element: if isinstance(node, nodes.system_message): if node.has_key('backrefs'): del node['backrefs'] messages.append(node) error = state_machine.reporter.error( 'Error in "%s" directive: may contain a single paragraph ' 'only.' % (name), line=lineno) messages.append(error) return messages else: return element[0].children else: error = state_machine.reporter.error( 'The "%s" directive is empty; content required.' % (name), line=lineno) return [error] replace.content = 1 def directive_test_function(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): if content: text = '\n'.join(content) info = state_machine.reporter.info( 'Directive processed. Type="%s", arguments=%r, options=%r, ' 'content:' % (name, arguments, options), nodes.literal_block(text, text), line=lineno) else: info = state_machine.reporter.info( 'Directive processed. Type="%s", arguments=%r, options=%r, ' 'content: None' % (name, arguments, options), line=lineno) return [info] directive_test_function.arguments = (0, 1, 1) directive_test_function.options = {'option': directives.unchanged} directive_test_function.content = 1 --- NEW FILE: parts.py --- # Author: David Goodger, Dmitry Jemerov # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ Directives for document parts. """ __docformat__ = 'reStructuredText' from docutils import nodes from docutils.transforms import parts from docutils.parsers.rst import directives backlinks_values = ('top', 'entry', 'none') def backlinks(arg): value = directives.choice(arg, backlinks_values) if value == 'none': return None else: return value def contents(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """Table of contents.""" if arguments: title_text = arguments[0] text_nodes, messages = state.inline_text(title_text, lineno) title = nodes.title(title_text, '', *text_nodes) else: messages = [] title = None pending = nodes.pending(parts.Contents, {'title': title}, block_text) pending.details.update(options) state_machine.document.note_pending(pending) return [pending] + messages contents.arguments = (0, 1, 1) contents.options = {'depth': directives.nonnegative_int, 'local': directives.flag, 'backlinks': backlinks} def sectnum(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """Automatic section numbering.""" pending = nodes.pending(parts.SectNum) pending.details.update(options) state_machine.document.note_pending(pending) return [pending] sectnum.options = {'depth': int} --- NEW FILE: references.py --- # Author: David Goodger, Dmitry Jemerov # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:52 $ # Copyright: This module has been placed in the public domain. """ Directives for references and targets. """ __docformat__ = 'reStructuredText' from docutils import nodes from docutils.transforms import references def target_notes(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """Target footnote generation.""" pending = nodes.pending(references.TargetNotes) state_machine.document.note_pending(pending) nodelist = [pending] return nodelist From goodger@users.sourceforge.net Fri Nov 8 23:47:53 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:47:53 -0800 Subject: [Python-checkins] python/nondist/peps/docutils .cvsignore,NONE,1.1 __init__.py,NONE,1.1 core.py,NONE,1.1 frontend.py,NONE,1.1 io.py,NONE,1.1 nodes.py,NONE,1.1 optik.py,NONE,1.1 roman.py,NONE,1.1 statemachine.py,NONE,1.1 urischemes.py,NONE,1.1 utils.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils In directory usw-pr-cvs1:/tmp/cvs-serv8387/docutils Added Files: .cvsignore __init__.py core.py frontend.py io.py nodes.py optik.py roman.py statemachine.py urischemes.py utils.py Log Message: local copy of Docutils for PEP processing --- NEW FILE: .cvsignore --- *.pyc --- NEW FILE: __init__.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:51 $ # Copyright: This module has been placed in the public domain. """ This is the Docutils (Python Documentation Utilities) package. Package Structure ================= Modules: - __init__.py: Contains the package docstring only (this text). - core.py: Contains the ``Publisher`` class and ``publish()`` convenience function. - frontend.py: Command-line and common processing for Docutils front-ends. - io.py: Provides a uniform API for low-level input and output. - nodes.py: Docutils document tree (doctree) node class library. - optik.py: Option parsing and command-line help; from Greg Ward's http://optik.sf.net/ project, included for convenience. - roman.py: Conversion to and from Roman numerals. Courtesy of Mark Pilgrim (http://diveintopython.org/). - statemachine.py: A finite state machine specialized for regular-expression-based text filters. - urischemes.py: Contains a complete mapping of known URI addressing scheme names to descriptions. - utils.py: Contains the ``Reporter`` system warning class and miscellaneous utilities. Subpackages: - languages: Language-specific mappings of terms. - parsers: Syntax-specific input parser modules or packages. - readers: Context-specific input handlers which understand the data source and manage a parser. - transforms: Modules used by readers and writers to modify DPS doctrees. - writers: Format-specific output translators. """ __docformat__ = 'reStructuredText' __version__ = '0.2.8' """``major.minor.micro`` version number. The micro number is bumped any time there's a change in the API incompatible with one of the front ends. The minor number is bumped whenever there is a project release. The major number will be bumped when the project is complete, and perhaps if there is a major change in the design.""" class ApplicationError(StandardError): pass class DataError(ApplicationError): pass class SettingsSpec: """ Runtime setting specification base class. SettingsSpec subclass objects used by `docutils.frontend.OptionParser`. """ settings_spec = () """Runtime settings specification. Override in subclasses. Specifies runtime settings and associated command-line options, as used by `docutils.frontend.OptionParser`. This tuple contains one or more sets of option group title, description, and a list/tuple of tuples: ``('help text', [list of option strings], {keyword arguments})``. Group title and/or description may be `None`; no group title implies no group, just a list of single options. Runtime settings names are derived implicitly from long option names ("--a-setting" becomes ``settings.a_setting``) or explicitly from the "destination" keyword argument.""" settings_default_overrides = None """A dictionary of auxiliary defaults, to override defaults for settings defined in other components. Override in subclasses.""" relative_path_settings = () """Settings containing filesystem paths. Override in subclasses. Settings listed here are to be interpreted relative to the current working directory.""" class TransformSpec: """ Runtime transform specification base class. TransformSpec subclass objects used by `docutils.transforms.Transformer`. """ default_transforms = () """Transforms required by this class. Override in subclasses.""" class Component(SettingsSpec, TransformSpec): """Base class for Docutils components.""" component_type = None """Override in subclasses.""" supported = () """Names for this component. Override in subclasses.""" def supports(self, format): """ Is `format` supported by this component? To be used by transforms to ask the dependent component if it supports a certain input context or output format. """ return format in self.supported --- NEW FILE: core.py --- # Authors: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:51 $ # Copyright: This module has been placed in the public domain. """ Calling the ``publish_*`` convenience functions (or instantiating a `Publisher` object) with component names will result in default behavior. For custom behavior (setting component options), create custom component objects first, and pass *them* to ``publish_*``/`Publisher`. """ __docformat__ = 'reStructuredText' import sys from docutils import Component from docutils import frontend, io, readers, parsers, writers from docutils.frontend import OptionParser, ConfigParser class Publisher: """ A facade encapsulating the high-level logic of a Docutils system. """ def __init__(self, reader=None, parser=None, writer=None, source=None, source_class=io.FileInput, destination=None, destination_class=io.FileOutput, settings=None): """ Initial setup. If any of `reader`, `parser`, or `writer` are not specified, the corresponding ``set_...`` method should be called with a component name (`set_reader` sets the parser as well). """ self.reader = reader """A `readers.Reader` instance.""" self.parser = parser """A `parsers.Parser` instance.""" self.writer = writer """A `writers.Writer` instance.""" self.source = source """The source of input data, an `io.Input` instance.""" self.source_class = source_class """The class for dynamically created source objects.""" self.destination = destination """The destination for docutils output, an `io.Output` instance.""" self.destination_class = destination_class """The class for dynamically created destination objects.""" self.settings = settings """An object containing Docutils settings as instance attributes. Set by `self.process_command_line()` or `self.get_settings()`.""" def set_reader(self, reader_name, parser, parser_name): """Set `self.reader` by name.""" reader_class = readers.get_reader_class(reader_name) self.reader = reader_class(parser, parser_name) self.parser = self.reader.parser def set_writer(self, writer_name): """Set `self.writer` by name.""" writer_class = writers.get_writer_class(writer_name) self.writer = writer_class() def set_components(self, reader_name, parser_name, writer_name): if self.reader is None: self.set_reader(reader_name, self.parser, parser_name) if self.parser is None: if self.reader.parser is None: self.reader.set_parser(parser_name) self.parser = self.reader.parser if self.writer is None: self.set_writer(writer_name) def setup_option_parser(self, usage=None, description=None, settings_spec=None, **defaults): #@@@ Add self.source & self.destination to components in future? option_parser = OptionParser( components=(settings_spec, self.parser, self.reader, self.writer), usage=usage, description=description) config = ConfigParser() config.read_standard_files() config_settings = config.get_section('options') frontend.make_paths_absolute(config_settings, option_parser.relative_path_settings) defaults.update(config_settings) option_parser.set_defaults(**defaults) return option_parser def get_settings(self, usage=None, description=None, settings_spec=None, **defaults): """ Set and return default settings (overrides in `defaults` keyword argument). Set components first (`self.set_reader` & `self.set_writer`). Explicitly setting `self.settings` disables command line option processing from `self.publish()`. """ option_parser = self.setup_option_parser(usage, description, settings_spec, **defaults) self.settings = option_parser.get_default_values() return self.settings def process_command_line(self, argv=None, usage=None, description=None, settings_spec=None, **defaults): """ Pass an empty list to `argv` to avoid reading `sys.argv` (the default). Set components first (`self.set_reader` & `self.set_writer`). """ option_parser = self.setup_option_parser(usage, description, settings_spec, **defaults) if argv is None: argv = sys.argv[1:] self.settings = option_parser.parse_args(argv) def set_io(self, source_path=None, destination_path=None): if self.source is None: self.set_source(source_path=source_path) if self.destination is None: self.set_destination(destination_path=destination_path) def set_source(self, source=None, source_path=None): if source_path is None: source_path = self.settings._source else: self.settings._source = source_path self.source = self.source_class(self.settings, source=source, source_path=source_path) def set_destination(self, destination=None, destination_path=None): if destination_path is None: destination_path = self.settings._destination else: self.settings._destination = destination_path self.destination = self.destination_class( self.settings, destination=destination, destination_path=destination_path) def apply_transforms(self, document): document.transformer.populate_from_components( (self.source, self.reader, self.reader.parser, self.writer, self.destination)) document.transformer.apply_transforms() def publish(self, argv=None, usage=None, description=None, settings_spec=None, settings_overrides=None): """ Process command line options and arguments (if `self.settings` not already set), run `self.reader` and then `self.writer`. Return `self.writer`'s output. """ if self.settings is None: self.process_command_line(argv, usage, description, settings_spec, **(settings_overrides or {})) elif settings_overrides: self.settings._update(settings_overrides, 'loose') self.set_io() document = self.reader.read(self.source, self.parser, self.settings) self.apply_transforms(document) output = self.writer.write(document, self.destination) if self.settings.dump_settings: from pprint import pformat print >>sys.stderr, '\n::: Runtime settings:' print >>sys.stderr, pformat(self.settings.__dict__) if self.settings.dump_internals: from pprint import pformat print >>sys.stderr, '\n::: Document internals:' print >>sys.stderr, pformat(document.__dict__) if self.settings.dump_transforms: from pprint import pformat print >>sys.stderr, '\n::: Transforms applied:' print >>sys.stderr, pformat(document.transformer.applied) if self.settings.dump_pseudo_xml: print >>sys.stderr, '\n::: Pseudo-XML:' print >>sys.stderr, document.pformat().encode( 'raw_unicode_escape') return output default_usage = '%prog [options] [ []]' default_description = ('Reads from (default is stdin) and writes to ' ' (default is stdout).') def publish_cmdline(reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None, argv=None, usage=default_usage, description=default_description): """ Set up & run a `Publisher`. For command-line front ends. Parameters: - `reader`: A `docutils.readers.Reader` object. - `reader_name`: Name or alias of the Reader class to be instantiated if no `reader` supplied. - `parser`: A `docutils.parsers.Parser` object. - `parser_name`: Name or alias of the Parser class to be instantiated if no `parser` supplied. - `writer`: A `docutils.writers.Writer` object. - `writer_name`: Name or alias of the Writer class to be instantiated if no `writer` supplied. - `settings`: Runtime settings object. - `settings_spec`: Extra settings specification; a `docutils.SettingsSpec` subclass. Used only if no `settings` specified. - `settings_overrides`: A dictionary containing program-specific overrides of component settings. - `argv`: Command-line argument list to use instead of ``sys.argv[1:]``. - `usage`: Usage string, output if there's a problem parsing the command line. - `description`: Program description, output for the "--help" option (along with command-line option descriptions). """ pub = Publisher(reader, parser, writer, settings=settings) pub.set_components(reader_name, parser_name, writer_name) pub.publish(argv, usage, description, settings_spec, settings_overrides) def publish_file(source=None, source_path=None, destination=None, destination_path=None, reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None): """ Set up & run a `Publisher`. For programmatic use with file-like I/O. Parameters: - `source`: A file-like object (must have "read" and "close" methods). - `source_path`: Path to the input file. Opened if no `source` supplied. If neither `source` nor `source_path` are supplied, `sys.stdin` is used. - `destination`: A file-like object (must have "write" and "close" methods). - `destination_path`: Path to the input file. Opened if no `destination` supplied. If neither `destination` nor `destination_path` are supplied, `sys.stdout` is used. - `reader`: A `docutils.readers.Reader` object. - `reader_name`: Name or alias of the Reader class to be instantiated if no `reader` supplied. - `parser`: A `docutils.parsers.Parser` object. - `parser_name`: Name or alias of the Parser class to be instantiated if no `parser` supplied. - `writer`: A `docutils.writers.Writer` object. - `writer_name`: Name or alias of the Writer class to be instantiated if no `writer` supplied. - `settings`: Runtime settings object. - `settings_spec`: Extra settings specification; a `docutils.SettingsSpec` subclass. Used only if no `settings` specified. - `settings_overrides`: A dictionary containing program-specific overrides of component settings. """ pub = Publisher(reader, parser, writer, settings=settings) pub.set_components(reader_name, parser_name, writer_name) if settings is None: settings = pub.get_settings(settings_spec=settings_spec) if settings_overrides: settings._update(settings_overrides, 'loose') pub.set_source(source, source_path) pub.set_destination(destination, destination_path) pub.publish() def publish_string(source, source_path=None, destination_path=None, reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None): """ Set up & run a `Publisher`, and return the string output. For programmatic use with string I/O. For encoded string output, be sure to set the "output_encoding" setting to the desired encoding. Set it to "unicode" for unencoded Unicode string output. Parameters: - `source`: An input string; required. This can be an encoded 8-bit string (set the "input_encoding" setting to the correct encoding) or a Unicode string (set the "input_encoding" setting to "unicode"). - `source_path`: Path to the file or object that produced `source`; optional. Only used for diagnostic output. - `destination_path`: Path to the file or object which will receive the output; optional. Used for determining relative paths (stylesheets, source links, etc.). - `reader`: A `docutils.readers.Reader` object. - `reader_name`: Name or alias of the Reader class to be instantiated if no `reader` supplied. - `parser`: A `docutils.parsers.Parser` object. - `parser_name`: Name or alias of the Parser class to be instantiated if no `parser` supplied. - `writer`: A `docutils.writers.Writer` object. - `writer_name`: Name or alias of the Writer class to be instantiated if no `writer` supplied. - `settings`: Runtime settings object. - `settings_spec`: Extra settings specification; a `docutils.SettingsSpec` subclass. Used only if no `settings` specified. - `settings_overrides`: A dictionary containing program-specific overrides of component settings. """ pub = Publisher(reader, parser, writer, settings=settings, source_class=io.StringInput, destination_class=io.StringOutput) pub.set_components(reader_name, parser_name, writer_name) if settings is None: settings = pub.get_settings(settings_spec=settings_spec) if settings_overrides: settings._update(settings_overrides, 'loose') pub.set_source(source, source_path) pub.set_destination(destination_path=destination_path) return pub.publish() --- NEW FILE: frontend.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:51 $ # Copyright: This module has been placed in the public domain. """ Command-line and common processing for Docutils front-end tools. Exports the following classes: - `OptionParser`: Standard Docutils command-line processing. - `Values`: Runtime settings; objects are simple structs (``object.attribute``). - `ConfigParser`: Standard Docutils config file processing. """ __docformat__ = 'reStructuredText' import os import os.path import ConfigParser as CP import docutils from docutils import optik from docutils.optik import Values def store_multiple(option, opt, value, parser, *args, **kwargs): """ Store multiple values in `parser.values`. (Option callback.) Store `None` for each attribute named in `args`, and store the value for each key (attribute name) in `kwargs`. """ for attribute in args: setattr(parser.values, attribute, None) for key, value in kwargs.items(): setattr(parser.values, key, value) def read_config_file(option, opt, value, parser): """ Read a configuration file during option processing. (Option callback.) """ config_parser = ConfigParser() config_parser.read(value) settings = config_parser.get_section('options') make_paths_absolute(settings, parser.relative_path_settings, os.path.dirname(value)) parser.values.__dict__.update(settings) def make_paths_absolute(pathdict, keys, base_path=None): """ Interpret filesystem path settings relative to the `base_path` given. Paths are values in `pathdict` whose keys are in `keys`. Get `keys` from `OptionParser.relative_path_settings`. """ if base_path is None: base_path = os.getcwd() for key in keys: if pathdict.has_key(key) and pathdict[key]: pathdict[key] = os.path.normpath( os.path.abspath(os.path.join(base_path, pathdict[key]))) class OptionParser(optik.OptionParser, docutils.SettingsSpec): """ Parser for command-line and library use. The `settings_spec` specification here and in other Docutils components are merged to build the set of command-line options and runtime settings for this process. Common settings (defined below) and component-specific settings must not conflict. Short options are reserved for common settings, and components are restrict to using long options. """ threshold_choices = 'info 1 warning 2 error 3 severe 4 none 5'.split() """Possible inputs for for --report and --halt threshold values.""" thresholds = {'info': 1, 'warning': 2, 'error': 3, 'severe': 4, 'none': 5} """Lookup table for --report and --halt threshold values.""" settings_spec = ( 'General Docutils Options', None, (('Include a "Generated by Docutils" credit and link at the end ' 'of the document.', ['--generator', '-g'], {'action': 'store_true'}), ('Do not include a generator credit.', ['--no-generator'], {'action': 'store_false', 'dest': 'generator'}), ('Include the date at the end of the document (UTC).', ['--date', '-d'], {'action': 'store_const', 'const': '%Y-%m-%d', 'dest': 'datestamp'}), ('Include the time & date at the end of the document (UTC).', ['--time', '-t'], {'action': 'store_const', 'const': '%Y-%m-%d %H:%M UTC', 'dest': 'datestamp'}), ('Do not include a datestamp of any kind.', ['--no-datestamp'], {'action': 'store_const', 'const': None, 'dest': 'datestamp'}), ('Include a "View document source" link (relative to destination).', ['--source-link', '-s'], {'action': 'store_true'}), ('Use the supplied verbatim for a "View document source" ' 'link; implies --source-link.', ['--source-url'], {'metavar': ''}), ('Do not include a "View document source" link.', ['--no-source-link'], {'action': 'callback', 'callback': store_multiple, 'callback_args': ('source_link', 'source_url')}), ('Enable backlinks from section headers to table of contents ' 'entries. This is the default.', ['--toc-entry-backlinks'], {'dest': 'toc_backlinks', 'action': 'store_const', 'const': 'entry', 'default': 'entry'}), ('Enable backlinks from section headers to the top of the table of ' 'contents.', ['--toc-top-backlinks'], {'dest': 'toc_backlinks', 'action': 'store_const', 'const': 'top'}), ('Disable backlinks to the table of contents.', ['--no-toc-backlinks'], {'dest': 'toc_backlinks', 'action': 'store_false'}), ('Enable backlinks from footnotes and citations to their ' 'references. This is the default.', ['--footnote-backlinks'], {'action': 'store_true', 'default': 1}), ('Disable backlinks from footnotes and citations.', ['--no-footnote-backlinks'], {'dest': 'footnote_backlinks', 'action': 'store_false'}), ('Set verbosity threshold; report system messages at or higher than ' ' (by name or number: "info" or "1", warning/2, error/3, ' 'severe/4; also, "none" or "5"). Default is 2 (warning).', ['--report', '-r'], {'choices': threshold_choices, 'default': 2, 'dest': 'report_level', 'metavar': ''}), ('Report all system messages, info-level and higher. (Same as ' '"--report=info".)', ['--verbose', '-v'], {'action': 'store_const', 'const': 'info', 'dest': 'report_level'}), ('Do not report any system messages. (Same as "--report=none".)', ['--quiet', '-q'], {'action': 'store_const', 'const': 'none', 'dest': 'report_level'}), ('Set the threshold () at or above which system messages are ' 'converted to exceptions, halting execution immediately. Levels ' 'as in --report. Default is 4 (severe).', ['--halt'], {'choices': threshold_choices, 'dest': 'halt_level', 'default': 4, 'metavar': ''}), ('Same as "--halt=info": halt processing at the slightest problem.', ['--strict'], {'action': 'store_const', 'const': 'info', 'dest': 'halt_level'}), ('Report debug-level system messages.', ['--debug'], {'action': 'store_true'}), ('Do not report debug-level system messages.', ['--no-debug'], {'action': 'store_false', 'dest': 'debug'}), ('Send the output of system messages (warnings) to .', ['--warnings'], {'dest': 'warning_stream', 'metavar': ''}), ('Specify the encoding of input text. Default is locale-dependent.', ['--input-encoding', '-i'], {'metavar': ''}), ('Specify the encoding for output. Default is UTF-8.', ['--output-encoding', '-o'], {'metavar': '', 'default': 'utf-8'}), ('Specify the language of input text (ISO 639 2-letter identifier).' ' Default is "en" (English).', ['--language', '-l'], {'dest': 'language_code', 'default': 'en', 'metavar': ''}), ('Read configuration settings from , if it exists.', ['--config'], {'metavar': '', 'type': 'string', 'action': 'callback', 'callback': read_config_file}), ("Show this program's version number and exit.", ['--version', '-V'], {'action': 'version'}), ('Show this help message and exit.', ['--help', '-h'], {'action': 'help'}), # Hidden options, for development use only: (optik.SUPPRESS_HELP, ['--dump-settings'], {'action': 'store_true'}), (optik.SUPPRESS_HELP, ['--dump-internals'], {'action': 'store_true'}), (optik.SUPPRESS_HELP, ['--dump-transforms'], {'action': 'store_true'}), (optik.SUPPRESS_HELP, ['--dump-pseudo-xml'], {'action': 'store_true'}), (optik.SUPPRESS_HELP, ['--expose-internal-attribute'], {'action': 'append', 'dest': 'expose_internals'}),)) """Runtime settings and command-line options common to all Docutils front ends. Setting specs specific to individual Docutils components are also used (see `populate_from_components()`).""" relative_path_settings = ('warning_stream',) version_template = '%%prog (Docutils %s)' % docutils.__version__ """Default version message.""" def __init__(self, components=(), *args, **kwargs): """ `components` is a list of Docutils components each containing a ``.settings_spec`` attribute. `defaults` is a mapping of setting default overrides. """ optik.OptionParser.__init__( self, help=None, format=optik.Titled(), # Needed when Optik is updated (replaces above 2 lines): #self, add_help=None, #formatter=optik.TitledHelpFormatter(width=78), *args, **kwargs) if not self.version: self.version = self.version_template # Internal settings with no defaults from settings specifications; # initialize manually: self.set_defaults(_source=None, _destination=None) # Make an instance copy (it will be modified): self.relative_path_settings = list(self.relative_path_settings) self.populate_from_components(tuple(components) + (self,)) def populate_from_components(self, components): for component in components: if component is None: continue i = 0 settings_spec = component.settings_spec self.relative_path_settings.extend( component.relative_path_settings) while i < len(settings_spec): title, description, option_spec = settings_spec[i:i+3] if title: group = optik.OptionGroup(self, title, description) self.add_option_group(group) else: group = self # single options for (help_text, option_strings, kwargs) in option_spec: group.add_option(help=help_text, *option_strings, **kwargs) i += 3 for component in components: if component and component.settings_default_overrides: self.defaults.update(component.settings_default_overrides) def check_values(self, values, args): if hasattr(values, 'report_level'): values.report_level = self.check_threshold(values.report_level) if hasattr(values, 'halt_level'): values.halt_level = self.check_threshold(values.halt_level) values._source, values._destination = self.check_args(args) make_paths_absolute(values.__dict__, self.relative_path_settings, os.getcwd()) return values def check_threshold(self, level): try: return int(level) except ValueError: try: return self.thresholds[level.lower()] except (KeyError, AttributeError): self.error('Unknown threshold: %r.' % level) def check_args(self, args): source = destination = None if args: source = args.pop(0) if args: destination = args.pop(0) if args: self.error('Maximum 2 arguments allowed.') if source and source == destination: self.error('Do not specify the same file for both source and ' 'destination. It will clobber the source file.') return source, destination class ConfigParser(CP.ConfigParser): standard_config_files = ( '/etc/docutils.conf', # system-wide './docutils.conf', # project-specific os.path.expanduser('~/.docutils')) # user-specific """Docutils configuration files, using ConfigParser syntax (section 'options'). Later files override earlier ones.""" def read_standard_files(self): self.read(self.standard_config_files) def optionxform(self, optionstr): """ Transform '-' to '_' so the cmdline form of option names can be used. """ return optionstr.lower().replace('-', '_') def get_section(self, section, raw=0, vars=None): """ Return a given section as a dictionary (empty if the section doesn't exist). All % interpolations are expanded in the return values, based on the defaults passed into the constructor, unless the optional argument `raw` is true. Additional substitutions may be provided using the `vars` argument, which must be a dictionary whose contents overrides any pre-existing defaults. The section DEFAULT is special. """ try: sectdict = self._ConfigParser__sections[section].copy() except KeyError: sectdict = {} d = self._ConfigParser__defaults.copy() d.update(sectdict) # Update with the entry specific variables if vars: d.update(vars) if raw: return sectdict # do the string interpolation for option in sectdict.keys(): rawval = sectdict[option] value = rawval # Make it a pretty variable name depth = 0 while depth < 10: # Loop through this until it's done depth += 1 if value.find("%(") >= 0: try: value = value % d except KeyError, key: raise CP.InterpolationError(key, option, section, rawval) else: break if value.find("%(") >= 0: raise CP.InterpolationDepthError(option, section, rawval) sectdict[option] = value return sectdict --- NEW FILE: io.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:51 $ # Copyright: This module has been placed in the public domain. """ I/O classes provide a uniform API for low-level input and output. Subclasses will exist for a variety of input/output mechanisms. """ __docformat__ = 'reStructuredText' import sys import locale from docutils import TransformSpec class Input(TransformSpec): """ Abstract base class for input wrappers. """ component_type = 'input' default_source_path = None def __init__(self, settings, source=None, source_path=None): self.settings = settings """A settings object with "input_encoding" and "output_encoding" attributes (typically a `docutils.optik.Values` object).""" self.source = source """The source of input data.""" self.source_path = source_path """A text reference to the source.""" if not source_path: self.source_path = self.default_source_path def __repr__(self): return '%s: source=%r, source_path=%r' % (self.__class__, self.source, self.source_path) def read(self, reader): raise NotImplementedError def decode(self, data): """ Decode a string, `data`, heuristically. Raise UnicodeError if unsuccessful. The client application should call ``locale.setlocale`` at the beginning of processing:: locale.setlocale(locale.LC_ALL, '') """ if self.settings.input_encoding \ and self.settings.input_encoding.lower() == 'unicode': return unicode(data) encodings = [self.settings.input_encoding, 'utf-8'] try: encodings.append(locale.nl_langinfo(locale.CODESET)) except: pass try: encodings.append(locale.getlocale()[1]) except: pass try: encodings.append(locale.getdefaultlocale()[1]) except: pass encodings.append('latin-1') for enc in encodings: if not enc: continue try: decoded = unicode(data, enc) return decoded except (UnicodeError, LookupError): pass raise UnicodeError( 'Unable to decode input data. Tried the following encodings: %s.' % ', '.join([repr(enc) for enc in encodings if enc])) class Output(TransformSpec): """ Abstract base class for output wrappers. """ component_type = 'output' default_destination_path = None def __init__(self, settings, destination=None, destination_path=None): self.settings = settings """A settings object with "input_encoding" and "output_encoding" attributes (typically a `docutils.optik.Values` object).""" self.destination = destination """The destination for output data.""" self.destination_path = destination_path """A text reference to the destination.""" if not destination_path: self.destination_path = self.default_destination_path def __repr__(self): return ('%s: destination=%r, destination_path=%r' % (self.__class__, self.destination, self.destination_path)) def write(self, data): raise NotImplementedError def encode(self, data): if self.settings.output_encoding \ and self.settings.output_encoding.lower() == 'unicode': return data else: return data.encode(self.settings.output_encoding or '') class FileInput(Input): """ Input for single, simple file-like objects. """ def __init__(self, settings, source=None, source_path=None, autoclose=1): """ :Parameters: - `source`: either a file-like object (which is read directly), or `None` (which implies `sys.stdin` if no `source_path` given). - `source_path`: a path to a file, which is opened and then read. - `autoclose`: close automatically after read (boolean); always false if `sys.stdin` is the source. """ Input.__init__(self, settings, source, source_path) self.autoclose = autoclose if source is None: if source_path: self.source = open(source_path) else: self.source = sys.stdin self.autoclose = None if not source_path: try: self.source_path = self.source.name except AttributeError: pass def read(self, reader): """Read and decode a single file and return the data.""" data = self.source.read() if self.autoclose: self.close() return self.decode(data) def close(self): self.source.close() class FileOutput(Output): """ Output for single, simple file-like objects. """ def __init__(self, settings, destination=None, destination_path=None, autoclose=1): """ :Parameters: - `destination`: either a file-like object (which is written directly) or `None` (which implies `sys.stdout` if no `destination_path` given). - `destination_path`: a path to a file, which is opened and then written. - `autoclose`: close automatically after write (boolean); always false if `sys.stdout` is the destination. """ Output.__init__(self, settings, destination, destination_path) self.opened = 1 self.autoclose = autoclose if destination is None: if destination_path: self.opened = None else: self.destination = sys.stdout self.autoclose = None if not destination_path: try: self.destination_path = self.destination.name except AttributeError: pass def open(self): self.destination = open(self.destination_path, 'w') self.opened = 1 def write(self, data): """Encode `data`, write it to a single file, and return it.""" output = self.encode(data) if not self.opened: self.open() self.destination.write(output) if self.autoclose: self.close() return output def close(self): self.destination.close() self.opened = None class StringInput(Input): """ Direct string input. """ default_source_path = '' def read(self, reader): """Decode and return the source string.""" return self.decode(self.source) class StringOutput(Output): """ Direct string output. """ default_destination_path = '' def write(self, data): """Encode `data`, store it in `self.destination`, and return it.""" self.destination = self.encode(data) return self.destination class NullInput(Input): """ Degenerate input: read nothing. """ default_source_path = 'null input' def read(self, reader): """Return a null string.""" return u'' class NullOutput(Output): """ Degenerate output: write nothing. """ default_destination_path = 'null output' def write(self, data): """Do nothing ([don't even] send data to the bit bucket).""" pass --- NEW FILE: nodes.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:51 $ # Copyright: This module has been placed in the public domain. """ Docutils document tree element class library. Classes in CamelCase are abstract base classes or auxiliary classes. The one exception is `Text`, for a text (PCDATA) node; uppercase is used to differentiate from element classes. Classes in lower_case_with_underscores are element classes, matching the XML element generic identifiers in the DTD_. The position of each node (the level at which it can occur) is significant and is represented by abstract base classes (`Root`, `Structural`, `Body`, `Inline`, etc.). Certain transformations will be easier because we can use ``isinstance(node, base_class)`` to determine the position of the node in the hierarchy. [...1394 lines suppressed...] The CSS1 "nmchar" rule does not include underscores ("_"), colons (":"), or periods ("."), therefore "class" and "id" attributes should not contain these characters. They should be replaced with hyphens ("-"). Combined with HTML's requirements (the first character must be a letter; no "unicode", "latin1", or "escape" characters), this results in the ``[a-z][-a-z0-9]*`` pattern. .. _HTML 4.01 spec: http://www.w3.org/TR/html401 .. _CSS1 spec: http://www.w3.org/TR/REC-CSS1 """ id = _non_id_chars.sub('-', ' '.join(string.lower().split())) id = _non_id_at_ends.sub('', id) return str(id) _non_id_chars = re.compile('[^a-z0-9]+') _non_id_at_ends = re.compile('^[-0-9]+|-+$') def dupname(node): node['dupname'] = node['name'] del node['name'] --- NEW FILE: optik.py --- # This is *not* the official distribution of Optik. See # http://optik.sourceforge.net/ for the official distro. # # This combined module was converted from the "optik" package for Docutils use # by David Goodger (2002-06-12). Optik is slated for inclusion in the Python # standard library as OptionParser.py. Once Optik itself becomes a single # module, Docutils will include the official module and kill off this # temporary fork. """optik A powerful, extensible, and easy-to-use command-line parser for Python. By Greg Ward See http://optik.sourceforge.net/ """ # Copyright (c) 2001 Gregory P. Ward. All rights reserved. [...1315 lines suppressed...] """ # Is there an exact match? if wordmap.has_key(s): return s else: # Isolate all words with s as a prefix. possibilities = [word for word in wordmap.keys() if word.startswith(s)] # No exact match, so there had better be just one possibility. if len(possibilities) == 1: return possibilities[0] elif not possibilities: raise BadOptionError("no such option: %s" % s) else: # More than one possible completion: ambiguous prefix. raise BadOptionError("ambiguous option: %s (%s?)" % (s, ", ".join(possibilities))) def get_prog_name (): return os.path.basename(sys.argv[0]) --- NEW FILE: roman.py --- """Convert to and from Roman numerals""" __author__ = "Mark Pilgrim (f8dy@diveintopython.org)" __version__ = "1.4" __date__ = "8 August 2001" __copyright__ = """Copyright (c) 2001 Mark Pilgrim This program is part of "Dive Into Python", a free Python tutorial for experienced programmers. Visit http://diveintopython.org/ for the latest version. This program is free software; you can redistribute it and/or modify it under the terms of the Python 2.1.1 license, available at http://www.python.org/2.1.1/license.html """ import re #Define exceptions class RomanError(Exception): pass class OutOfRangeError(RomanError): pass class NotIntegerError(RomanError): pass class InvalidRomanNumeralError(RomanError): pass #Define digit mapping romanNumeralMap = (('M', 1000), ('CM', 900), ('D', 500), ('CD', 400), ('C', 100), ('XC', 90), ('L', 50), ('XL', 40), ('X', 10), ('IX', 9), ('V', 5), ('IV', 4), ('I', 1)) def toRoman(n): """convert integer to Roman numeral""" if not (0 < n < 5000): raise OutOfRangeError, "number out of range (must be 1..4999)" if int(n) <> n: raise NotIntegerError, "decimals can not be converted" result = "" for numeral, integer in romanNumeralMap: while n >= integer: result += numeral n -= integer return result #Define pattern to detect valid Roman numerals romanNumeralPattern = re.compile(''' ^ # beginning of string M{0,4} # thousands - 0 to 4 M's (CM|CD|D?C{0,3}) # hundreds - 900 (CM), 400 (CD), 0-300 (0 to 3 C's), # or 500-800 (D, followed by 0 to 3 C's) (XC|XL|L?X{0,3}) # tens - 90 (XC), 40 (XL), 0-30 (0 to 3 X's), # or 50-80 (L, followed by 0 to 3 X's) (IX|IV|V?I{0,3}) # ones - 9 (IX), 4 (IV), 0-3 (0 to 3 I's), # or 5-8 (V, followed by 0 to 3 I's) $ # end of string ''' ,re.VERBOSE) def fromRoman(s): """convert Roman numeral to integer""" if not s: raise InvalidRomanNumeralError, 'Input can not be blank' if not romanNumeralPattern.search(s): raise InvalidRomanNumeralError, 'Invalid Roman numeral: %s' % s result = 0 index = 0 for numeral, integer in romanNumeralMap: while s[index:index+len(numeral)] == numeral: result += integer index += len(numeral) return result --- NEW FILE: statemachine.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:51 $ # Copyright: This module has been placed in the public domain. """ A finite state machine specialized for regular-expression-based text filters, this module defines the following classes: - `StateMachine`, a state machine - `State`, a state superclass - `StateMachineWS`, a whitespace-sensitive version of `StateMachine` - `StateWS`, a state superclass for use with `StateMachineWS` - `SearchStateMachine`, uses `re.search()` instead of `re.match()` - `SearchStateMachineWS`, uses `re.search()` instead of `re.match()` - `ViewList`, extends standard Python lists. - `StringList`, string-specific ViewList. [...1405 lines suppressed...] if convert_whitespace: astring = whitespace.sub(' ', astring) return [s.expandtabs(tab_width) for s in astring.splitlines()] def _exception_data(): """ Return exception information: - the exception's class name; - the exception object; - the name of the file containing the offending code; - the line number of the offending code; - the function name of the offending code. """ type, value, traceback = sys.exc_info() while traceback.tb_next: traceback = traceback.tb_next code = traceback.tb_frame.f_code return (type.__name__, value, code.co_filename, traceback.tb_lineno, code.co_name) --- NEW FILE: urischemes.py --- """ `schemes` is a dictionary with lowercase URI addressing schemes as keys and descriptions as values. It was compiled from the index at http://www.w3.org/Addressing/schemes.html (revised 2001-08-20). """ # Many values are blank and should be filled in with useful descriptions. schemes = { 'about': 'provides information on Navigator', 'acap': 'Application Configuration Access Protocol', 'addbook': "To add vCard entries to Communicator's Address Book", 'afp': 'Apple Filing Protocol', 'afs': 'Andrew File System global file names', 'aim': 'AOL Instant Messenger', 'callto': 'for NetMeeting links', 'castanet': 'Castanet Tuner URLs for Netcaster', 'chttp': 'cached HTTP supported by RealPlayer', 'cid': 'content identifier', 'data': ('allows inclusion of small data items as "immediate" data; ' 'RFC 2397'), 'dav': 'Distributed Authoring and Versioning Protocol; RFC 2518', 'dns': 'Domain Name System resources', 'eid': ('External ID; non-URL data; general escape mechanism to allow ' 'access to information for applications that are too ' 'specialized to justify their own schemes'), 'fax': ('a connection to a terminal that can handle telefaxes ' '(facsimiles); RFC 2806'), 'file': 'Host-specific file names', 'finger': '', 'freenet': '', 'ftp': 'File Transfer Protocol', 'gopher': 'The Gopher Protocol', 'gsm-sms': ('Global System for Mobile Communications Short Message ' 'Service'), 'h323': 'video (audiovisual) communication on local area networks', 'h324': ('video and audio communications over low bitrate connections ' 'such as POTS modem connections'), 'hdl': 'CNRI handle system', 'hnews': 'an HTTP-tunneling variant of the NNTP news protocol', 'http': 'Hypertext Transfer Protocol', 'https': 'HTTP over SSL', 'iioploc': 'Internet Inter-ORB Protocol Location?', 'ilu': 'Inter-Language Unification', 'imap': 'Internet Message Access Protocol', 'ior': 'CORBA interoperable object reference', 'ipp': 'Internet Printing Protocol', 'irc': 'Internet Relay Chat', 'jar': 'Java archive', 'javascript': ('JavaScript code; evaluates the expression after the ' 'colon'), 'jdbc': '', 'ldap': 'Lightweight Directory Access Protocol', 'lifn': '', 'livescript': '', 'lrq': '', 'mailbox': 'Mail folder access', 'mailserver': 'Access to data available from mail servers', 'mailto': 'Electronic mail address', 'md5': '', 'mid': 'message identifier', 'mocha': '', 'modem': ('a connection to a terminal that can handle incoming data ' 'calls; RFC 2806'), 'news': 'USENET news', 'nfs': 'Network File System protocol', 'nntp': 'USENET news using NNTP access', 'opaquelocktoken': '', 'phone': '', 'pop': 'Post Office Protocol', 'pop3': 'Post Office Protocol v3', 'printer': '', 'prospero': 'Prospero Directory Service', 'res': '', 'rtsp': 'real time streaming protocol', 'rvp': '', 'rwhois': '', 'rx': 'Remote Execution', 'sdp': '', 'service': 'service location', 'shttp': 'secure hypertext transfer protocol', 'sip': 'Session Initiation Protocol', 'smb': '', 'snews': 'For NNTP postings via SSL', 't120': 'real time data conferencing (audiographics)', 'tcp': '', 'tel': ('a connection to a terminal that handles normal voice ' 'telephone calls, a voice mailbox or another voice messaging ' 'system or a service that can be operated using DTMF tones; ' 'RFC 2806.'), 'telephone': 'telephone', 'telnet': 'Reference to interactive sessions', 'tip': 'Transaction Internet Protocol', 'tn3270': 'Interactive 3270 emulation sessions', 'tv': '', 'urn': 'Uniform Resource Name', 'uuid': '', 'vemmi': 'versatile multimedia interface', 'videotex': '', 'view-source': 'displays HTML code that was generated with JavaScript', 'wais': 'Wide Area Information Servers', 'whodp': '', 'whois++': 'Distributed directory service.', 'z39.50r': 'Z39.50 Retrieval', 'z39.50s': 'Z39.50 Session',} --- NEW FILE: utils.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:51 $ # Copyright: This module has been placed in the public domain. """ Miscellaneous utilities for the documentation utilities. """ __docformat__ = 'reStructuredText' import sys import os import os.path from types import StringType, UnicodeType from docutils import ApplicationError, DataError from docutils import frontend, nodes class SystemMessage(ApplicationError): def __init__(self, system_message): Exception.__init__(self, system_message.astext()) class Reporter: """ Info/warning/error reporter and ``system_message`` element generator. Five levels of system messages are defined, along with corresponding methods: `debug()`, `info()`, `warning()`, `error()`, and `severe()`. There is typically one Reporter object per process. A Reporter object is instantiated with thresholds for reporting (generating warnings) and halting processing (raising exceptions), a switch to turn debug output on or off, and an I/O stream for warnings. These are stored in the default reporting category, '' (zero-length string). Multiple reporting categories [#]_ may be set, each with its own reporting and halting thresholds, debugging switch, and warning stream (collectively a `ConditionSet`). Categories are hierarchical dotted-name strings that look like attribute references: 'spam', 'spam.eggs', 'neeeow.wum.ping'. The 'spam' category is the ancestor of 'spam.bacon.eggs'. Unset categories inherit stored conditions from their closest ancestor category that has been set. When a system message is generated, the stored conditions from its category (or ancestor if unset) are retrieved. The system message level is compared to the thresholds stored in the category, and a warning or error is generated as appropriate. Debug messages are produced iff the stored debug switch is on. Message output is sent to the stored warning stream. The default category is '' (empty string). By convention, Writers should retrieve reporting conditions from the 'writer' category (which, unless explicitly set, defaults to the conditions of the default category). The Reporter class also employs a modified form of the "Observer" pattern [GoF95]_ to track system messages generated. The `attach_observer` method should be called before parsing, with a bound method or function which accepts system messages. The observer can be removed with `detach_observer`, and another added in its place. .. [#] The concept of "categories" was inspired by the log4j project: http://jakarta.apache.org/log4j/. .. [GoF95] Gamma, Helm, Johnson, Vlissides. *Design Patterns: Elements of Reusable Object-Oriented Software*. Addison-Wesley, Reading, MA, USA, 1995. """ levels = 'DEBUG INFO WARNING ERROR SEVERE'.split() """List of names for system message levels, indexed by level.""" def __init__(self, source, report_level, halt_level, stream=None, debug=0): """ Initialize the `ConditionSet` forthe `Reporter`'s default category. :Parameters: - `source`: The path to or description of the source data. - `report_level`: The level at or above which warning output will be sent to `stream`. - `halt_level`: The level at or above which `SystemMessage` exceptions will be raised, halting execution. - `debug`: Show debug (level=0) system messages? - `stream`: Where warning output is sent. Can be file-like (has a ``.write`` method), a string (file name, opened for writing), or `None` (implies `sys.stderr`; default). """ self.source = source """The path to or description of the source data.""" if stream is None: stream = sys.stderr elif type(stream) in (StringType, UnicodeType): raise NotImplementedError('This should open a file for writing.') self.categories = {'': ConditionSet(debug, report_level, halt_level, stream)} """Mapping of category names to conditions. Default category is ''.""" self.observers = [] """List of bound methods or functions to call with each system_message created.""" def set_conditions(self, category, report_level, halt_level, stream=None, debug=0): if stream is None: stream = sys.stderr self.categories[category] = ConditionSet(debug, report_level, halt_level, stream) def unset_conditions(self, category): if category and self.categories.has_key(category): del self.categories[category] __delitem__ = unset_conditions def get_conditions(self, category): while not self.categories.has_key(category): category = category[:category.rfind('.') + 1][:-1] return self.categories[category] __getitem__ = get_conditions def attach_observer(self, observer): """ The `observer` parameter is a function or bound method which takes one argument, a `nodes.system_message` instance. """ self.observers.append(observer) def detach_observer(self, observer): self.observers.remove(observer) def notify_observers(self, message): for observer in self.observers: observer(message) def system_message(self, level, message, *children, **kwargs): """ Return a system_message object. Raise an exception or generate a warning if appropriate. """ attributes = kwargs.copy() category = kwargs.get('category', '') if kwargs.has_key('category'): del attributes['category'] if kwargs.has_key('base_node'): source, line = get_source_line(kwargs['base_node']) del attributes['base_node'] if source is not None: attributes.setdefault('source', source) if line is not None: attributes.setdefault('line', line) attributes.setdefault('source', self.source) msg = nodes.system_message(message, level=level, type=self.levels[level], *children, **attributes) debug, report_level, halt_level, stream = self[category].astuple() if level >= report_level or debug and level == 0: if category: print >>stream, msg.astext(), '[%s]' % category else: print >>stream, msg.astext() if level >= halt_level: raise SystemMessage(msg) if level > 0 or debug: self.notify_observers(msg) return msg def debug(self, *args, **kwargs): """ Level-0, "DEBUG": an internal reporting issue. Typically, there is no effect on the processing. Level-0 system messages are handled separately from the others. """ return self.system_message(0, *args, **kwargs) def info(self, *args, **kwargs): """ Level-1, "INFO": a minor issue that can be ignored. Typically there is no effect on processing, and level-1 system messages are not reported. """ return self.system_message(1, *args, **kwargs) def warning(self, *args, **kwargs): """ Level-2, "WARNING": an issue that should be addressed. If ignored, there may be unpredictable problems with the output. """ return self.system_message(2, *args, **kwargs) def error(self, *args, **kwargs): """ Level-3, "ERROR": an error that should be addressed. If ignored, the output will contain errors. """ return self.system_message(3, *args, **kwargs) def severe(self, *args, **kwargs): """ Level-4, "SEVERE": a severe error that must be addressed. If ignored, the output will contain severe errors. Typically level-4 system messages are turned into exceptions which halt processing. """ return self.system_message(4, *args, **kwargs) class ConditionSet: """ A set of two thresholds (`report_level` & `halt_level`), a switch (`debug`), and an I/O stream (`stream`), corresponding to one `Reporter` category. """ def __init__(self, debug, report_level, halt_level, stream): self.debug = debug self.report_level = report_level self.halt_level = halt_level self.stream = stream def astuple(self): return (self.debug, self.report_level, self.halt_level, self.stream) class ExtensionOptionError(DataError): pass class BadOptionError(ExtensionOptionError): pass class BadOptionDataError(ExtensionOptionError): pass class DuplicateOptionError(ExtensionOptionError): pass def extract_extension_options(field_list, options_spec): """ Return a dictionary mapping extension option names to converted values. :Parameters: - `field_list`: A flat field list without field arguments, where each field body consists of a single paragraph only. - `options_spec`: Dictionary mapping known option names to a conversion function such as `int` or `float`. :Exceptions: - `KeyError` for unknown option names. - `ValueError` for invalid option values (raised by the conversion function). - `DuplicateOptionError` for duplicate options. - `BadOptionError` for invalid fields. - `BadOptionDataError` for invalid option data (missing name, missing data, bad quotes, etc.). """ option_list = extract_options(field_list) option_dict = assemble_option_dict(option_list, options_spec) return option_dict def extract_options(field_list): """ Return a list of option (name, value) pairs from field names & bodies. :Parameter: `field_list`: A flat field list, where each field name is a single word and each field body consists of a single paragraph only. :Exceptions: - `BadOptionError` for invalid fields. - `BadOptionDataError` for invalid option data (missing name, missing data, bad quotes, etc.). """ option_list = [] for field in field_list: if len(field[0].astext().split()) != 1: raise BadOptionError( 'extension option field name may not contain multiple words') name = str(field[0].astext().lower()) body = field[1] if len(body) == 0: data = None elif len(body) > 1 or not isinstance(body[0], nodes.paragraph) \ or len(body[0]) != 1 or not isinstance(body[0][0], nodes.Text): raise BadOptionDataError( 'extension option field body may contain\n' 'a single paragraph only (option "%s")' % name) else: data = body[0][0].astext() option_list.append((name, data)) return option_list def assemble_option_dict(option_list, options_spec): """ Return a mapping of option names to values. :Parameters: - `option_list`: A list of (name, value) pairs (the output of `extract_options()`). - `options_spec`: Dictionary mapping known option names to a conversion function such as `int` or `float`. :Exceptions: - `KeyError` for unknown option names. - `DuplicateOptionError` for duplicate options. - `ValueError` for invalid option values (raised by conversion function). """ options = {} for name, value in option_list: convertor = options_spec[name] # raises KeyError if unknown if options.has_key(name): raise DuplicateOptionError('duplicate option "%s"' % name) try: options[name] = convertor(value) except (ValueError, TypeError), detail: raise detail.__class__('(option: "%s"; value: %r)\n%s' % (name, value, detail)) return options class NameValueError(DataError): pass def extract_name_value(line): """ Return a list of (name, value) from a line of the form "name=value ...". :Exception: `NameValueError` for invalid input (missing name, missing data, bad quotes, etc.). """ attlist = [] while line: equals = line.find('=') if equals == -1: raise NameValueError('missing "="') attname = line[:equals].strip() if equals == 0 or not attname: raise NameValueError( 'missing attribute name before "="') line = line[equals+1:].lstrip() if not line: raise NameValueError( 'missing value after "%s="' % attname) if line[0] in '\'"': endquote = line.find(line[0], 1) if endquote == -1: raise NameValueError( 'attribute "%s" missing end quote (%s)' % (attname, line[0])) if len(line) > endquote + 1 and line[endquote + 1].strip(): raise NameValueError( 'attribute "%s" end quote (%s) not followed by ' 'whitespace' % (attname, line[0])) data = line[1:endquote] line = line[endquote+1:].lstrip() else: space = line.find(' ') if space == -1: data = line line = '' else: data = line[:space] line = line[space+1:].lstrip() attlist.append((attname.lower(), data)) return attlist def normalize_name(name): """Return a case- and whitespace-normalized name.""" return ' '.join(name.lower().split()) def new_document(source, settings=None): if settings is None: settings = frontend.OptionParser().get_default_values() reporter = Reporter(source, settings.report_level, settings.halt_level, settings.warning_stream, settings.debug) document = nodes.document(settings, reporter, source=source) document.note_source(source, -1) return document def clean_rcs_keywords(paragraph, keyword_substitutions): if len(paragraph) == 1 and isinstance(paragraph[0], nodes.Text): textnode = paragraph[0] for pattern, substitution in keyword_substitutions: match = pattern.match(textnode.data) if match: textnode.data = pattern.sub(substitution, textnode.data) return def relative_path(source, target): """ Build and return a path to `target`, relative to `source`. If there is no common prefix, return the absolute path to `target`. """ source_parts = os.path.abspath(source or '').split(os.sep) target_parts = os.path.abspath(target).split(os.sep) # Check first 2 parts because '/dir'.split('/') == ['', 'dir']: if source_parts[:2] != target_parts[:2]: # Nothing in common between paths. # Return absolute path, using '/' for URLs: return '/'.join(target_parts) source_parts.reverse() target_parts.reverse() while (source_parts and target_parts and source_parts[-1] == target_parts[-1]): # Remove path components in common: source_parts.pop() target_parts.pop() target_parts.reverse() parts = ['..'] * (len(source_parts) - 1) + target_parts return '/'.join(parts) def get_source_line(node): """ Return the "source" and "line" attributes from the `node` given or from it's closest ancestor. """ while node: if node.source or node.line: return node.source, node.line node = node.parent return None, None From goodger@users.sourceforge.net Fri Nov 8 23:47:55 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 08 Nov 2002 15:47:55 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/transforms .cvsignore,NONE,1.1 __init__.py,NONE,1.1 components.py,NONE,1.1 frontmatter.py,NONE,1.1 parts.py,NONE,1.1 peps.py,NONE,1.1 references.py,NONE,1.1 universal.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/transforms In directory usw-pr-cvs1:/tmp/cvs-serv8387/docutils/transforms Added Files: .cvsignore __init__.py components.py frontmatter.py parts.py peps.py references.py universal.py Log Message: local copy of Docutils for PEP processing --- NEW FILE: .cvsignore --- *.pyc --- NEW FILE: __init__.py --- # Authors: David Goodger, Ueli Schlaepfer # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:53 $ # Copyright: This module has been placed in the public domain. """ This package contains modules for standard tree transforms available to Docutils components. Tree transforms serve a variety of purposes: - To tie up certain syntax-specific "loose ends" that remain after the initial parsing of the input plaintext. These transforms are used to supplement a limited syntax. - To automate the internal linking of the document tree (hyperlink references, footnote references, etc.). - To extract useful information from the document tree. These transforms may be used to construct (for example) indexes and tables of contents. Each transform is an optional step that a Docutils Reader may choose to perform on the parsed document, depending on the input context. A Docutils Reader may also perform Reader-specific transforms before or after performing these standard transforms. """ __docformat__ = 'reStructuredText' from docutils import languages, ApplicationError, TransformSpec class TransformError(ApplicationError): pass class Transform: """ Docutils transform component abstract base class. """ default_priority = None """Numerical priority of this transform, 0 through 999 (override).""" def __init__(self, document, startnode=None): """ Initial setup for in-place document transforms. """ self.document = document """The document tree to transform.""" self.startnode = startnode """Node from which to begin the transform. For many transforms which apply to the document as a whole, `startnode` is not set (i.e. its value is `None`).""" self.language = languages.get_language( document.settings.language_code) """Language module local to this document.""" def apply(self): """Override to apply the transform to the document tree.""" raise NotImplementedError('subclass must override this method') class Transformer(TransformSpec): """ Stores transforms (`Transform` classes) and applies them to document trees. Also keeps track of components by component type name. """ from docutils.transforms import universal default_transforms = (universal.Decorations, universal.FinalChecks, universal.Messages) """These transforms are applied to all document trees.""" def __init__(self, document): self.transforms = [] """List of transforms to apply. Each item is a 3-tuple: ``(priority string, transform class, pending node or None)``.""" self.document = document """The `nodes.document` object this Transformer is attached to.""" self.applied = [] """Transforms already applied, in order.""" self.sorted = 0 """Boolean: is `self.tranforms` sorted?""" self.components = {} """Mapping of component type name to component object. Set by `self.populate_from_components()`.""" self.serialno = 0 """Internal serial number to keep track of the add order of transforms.""" def add_transform(self, transform_class, priority=None): """ Store a single transform. Use `priority` to override the default. """ if priority is None: priority = transform_class.default_priority priority_string = self.get_priority_string(priority) self.transforms.append((priority_string, transform_class, None)) self.sorted = 0 def add_transforms(self, transform_list): """Store multiple transforms, with default priorities.""" for transform_class in transform_list: priority_string = self.get_priority_string( transform_class.default_priority) self.transforms.append((priority_string, transform_class, None)) self.sorted = 0 def add_pending(self, pending, priority=None): """Store a transform with an associated `pending` node.""" transform_class = pending.transform if priority is None: priority = transform_class.default_priority priority_string = self.get_priority_string(priority) self.transforms.append((priority_string, transform_class, pending)) self.sorted = 0 def get_priority_string(self, priority): """ Return a string, `priority` combined with `self.serialno`. This ensures FIFO order on transforms with identical priority. """ self.serialno += 1 return '%03d-%03d' % (priority, self.serialno) def populate_from_components(self, components): """ Store each component's default transforms, with default priorities. Also, store components by type name in a mapping for later lookup. """ self.add_transforms(self.default_transforms) for component in components: if component is None: continue self.add_transforms(component.default_transforms) self.components[component.component_type] = component self.sorted = 0 def apply_transforms(self): """Apply all of the stored transforms, in priority order.""" self.document.reporter.attach_observer( self.document.note_transform_message) while self.transforms: if not self.sorted: # Unsorted initially, and whenever a transform is added. self.transforms.sort() self.transforms.reverse() self.sorted = 1 priority, transform_class, pending = self.transforms.pop() transform = transform_class(self.document, startnode=pending) transform.apply() self.applied.append((priority, transform_class, pending)) --- NEW FILE: components.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:53 $ # Copyright: This module has been placed in the public domain. """ Docutils component-related transforms. """ __docformat__ = 'reStructuredText' import sys import os import re import time from docutils import nodes, utils from docutils import ApplicationError, DataError from docutils.transforms import Transform, TransformError class Filter(Transform): """ Include or exclude elements which depend on a specific Docutils component. For use with `nodes.pending` elements. A "pending" element's dictionary attribute ``details`` must contain the keys "component" and "format". The value of ``details['component']`` must match the type name of the component the elements depend on (e.g. "writer"). The value of ``details['format']`` is the name of a specific format or context of that component (e.g. "html"). If the matching Docutils component supports that format or context, the "pending" element is replaced by the contents of ``details['nodes']`` (a list of nodes); otherwise, the "pending" element is removed. For example, the reStructuredText "meta" directive creates a "pending" element containing a "meta" element (in ``pending.details['nodes']``). Only writers (``pending.details['component'] == 'writer'``) supporting the "html" format (``pending.details['format'] == 'html'``) will include the "meta" element; it will be deleted from the output of all other writers. """ default_priority = 780 def apply(self): pending = self.startnode component_type = pending.details['component'] # 'reader' or 'writer' format = pending.details['format'] component = self.document.transformer.components[component_type] if component.supports(format): pending.parent.replace(pending, pending.details['nodes']) else: pending.parent.remove(pending) --- NEW FILE: frontmatter.py --- # Authors: David Goodger, Ueli Schlaepfer # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:53 $ # Copyright: This module has been placed in the public domain. """ Transforms related to the front matter of a document (information found before the main text): - `DocTitle`: Used to transform a lone top level section's title to the document title, and promote a remaining lone top-level section's title to the document subtitle. - `DocInfo`: Used to transform a bibliographic field list into docinfo elements. """ __docformat__ = 'reStructuredText' import re from docutils import nodes, utils from docutils.transforms import TransformError, Transform class DocTitle(Transform): """ In reStructuredText_, there is no way to specify a document title and subtitle explicitly. Instead, we can supply the document title (and possibly the subtitle as well) implicitly, and use this two-step transform to "raise" or "promote" the title(s) (and their corresponding section contents) to the document level. 1. If the document contains a single top-level section as its first non-comment element, the top-level section's title becomes the document's title, and the top-level section's contents become the document's immediate contents. The lone top-level section header must be the first non-comment element in the document. For example, take this input text:: ================= Top-Level Title ================= A paragraph. Once parsed, it looks like this::
Top-Level Title <paragraph> A paragraph. After running the DocTitle transform, we have:: <document name="top-level title"> <title> Top-Level Title <paragraph> A paragraph. 2. If step 1 successfully determines the document title, we continue by checking for a subtitle. If the lone top-level section itself contains a single second-level section as its first non-comment element, that section's title is promoted to the document's subtitle, and that section's contents become the document's immediate contents. Given this input text:: ================= Top-Level Title ================= Second-Level Title ~~~~~~~~~~~~~~~~~~ A paragraph. After parsing and running the Section Promotion transform, the result is:: <document name="top-level title"> <title> Top-Level Title <subtitle name="second-level title"> Second-Level Title <paragraph> A paragraph. (Note that the implicit hyperlink target generated by the "Second-Level Title" is preserved on the "subtitle" element itself.) Any comment elements occurring before the document title or subtitle are accumulated and inserted as the first body elements after the title(s). """ default_priority = 320 def apply(self): if self.promote_document_title(): self.promote_document_subtitle() def promote_document_title(self): section, index = self.candidate_index() if index is None: return None document = self.document # Transfer the section's attributes to the document element (at root): document.attributes.update(section.attributes) document[:] = (section[:1] # section title + document[:index] # everything that was in the # document before the section + section[1:]) # everything that was in the section return 1 def promote_document_subtitle(self): subsection, index = self.candidate_index() if index is None: return None subtitle = nodes.subtitle() # Transfer the subsection's attributes to the new subtitle: subtitle.attributes.update(subsection.attributes) # Transfer the contents of the subsection's title to the subtitle: subtitle[:] = subsection[0][:] document = self.document document[:] = (document[:1] # document title + [subtitle] # everything that was before the section: + document[1:index] # everything that was in the subsection: + subsection[1:]) return 1 def candidate_index(self): """ Find and return the promotion candidate and its index. Return (None, None) if no valid candidate was found. """ document = self.document index = document.first_child_not_matching_class( nodes.PreBibliographic) if index is None or len(document) > (index + 1) or \ not isinstance(document[index], nodes.section): return None, None else: return document[index], index class DocInfo(Transform): """ This transform is specific to the reStructuredText_ markup syntax; see "Bibliographic Fields" in the `reStructuredText Markup Specification`_ for a high-level description. This transform should be run *after* the `DocTitle` transform. Given a field list as the first non-comment element after the document title and subtitle (if present), registered bibliographic field names are transformed to the corresponding DTD elements, becoming child elements of the "docinfo" element (except for a dedication and/or an abstract, which become "topic" elements after "docinfo"). For example, given this document fragment after parsing:: <document> <title> Document Title <field_list> <field> <field_name> Author <field_body> <paragraph> A. Name <field> <field_name> Status <field_body> <paragraph> $RCSfile: frontmatter.py,v $ ... After running the bibliographic field list transform, the resulting document tree would look like this:: <document> <title> Document Title <docinfo> <author> A. Name <status> frontmatter.py ... The "Status" field contained an expanded RCS keyword, which is normally (but optionally) cleaned up by the transform. The sole contents of the field body must be a paragraph containing an expanded RCS keyword of the form "$keyword: expansion text $". Any RCS keyword can be processed in any bibliographic field. The dollar signs and leading RCS keyword name are removed. Extra processing is done for the following RCS keywords: - "RCSfile" expands to the name of the file in the RCS or CVS repository, which is the name of the source file with a ",v" suffix appended. The transform will remove the ",v" suffix. - "Date" expands to the format "YYYY/MM/DD hh:mm:ss" (in the UTC time zone). The RCS Keywords transform will extract just the date itself and transform it to an ISO 8601 format date, as in "2000-12-31". (Since the source file for this text is itself stored under CVS, we can't show an example of the "Date" RCS keyword because we can't prevent any RCS keywords used in this explanation from being expanded. Only the "RCSfile" keyword is stable; its expansion text changes only if the file name changes.) """ default_priority = 340 def apply(self): document = self.document index = document.first_child_not_matching_class( nodes.PreBibliographic) if index is None: return candidate = document[index] if isinstance(candidate, nodes.field_list): biblioindex = document.first_child_not_matching_class( nodes.Titular) nodelist = self.extract_bibliographic(candidate) del document[index] # untransformed field list (candidate) document[biblioindex:biblioindex] = nodelist return def extract_bibliographic(self, field_list): docinfo = nodes.docinfo() bibliofields = self.language.bibliographic_fields labels = self.language.labels topics = {'dedication': None, 'abstract': None} for field in field_list: try: name = field[0][0].astext() normedname = utils.normalize_name(name) if not (len(field) == 2 and bibliofields.has_key(normedname) and self.check_empty_biblio_field(field, name)): raise TransformError biblioclass = bibliofields[normedname] if issubclass(biblioclass, nodes.TextElement): if not self.check_compound_biblio_field(field, name): raise TransformError utils.clean_rcs_keywords( field[1][0], self.rcs_keyword_substitutions) docinfo.append(biblioclass('', '', *field[1][0])) else: # multiple body elements possible if issubclass(biblioclass, nodes.authors): self.extract_authors(field, name, docinfo) elif issubclass(biblioclass, nodes.topic): if topics[normedname]: field[-1] += self.document.reporter.warning( 'There can only be one "%s" field.' % name, base_node=field) raise TransformError title = nodes.title(name, labels[normedname]) topics[normedname] = biblioclass( '', title, CLASS=normedname, *field[1].children) else: docinfo.append(biblioclass('', *field[1].children)) except TransformError: if len(field[-1]) == 1 \ and isinstance(field[-1][0], nodes.paragraph): utils.clean_rcs_keywords( field[-1][0], self.rcs_keyword_substitutions) docinfo.append(field) continue nodelist = [] if len(docinfo) != 0: nodelist.append(docinfo) for name in ('dedication', 'abstract'): if topics[name]: nodelist.append(topics[name]) return nodelist def check_empty_biblio_field(self, field, name): if len(field[-1]) < 1: field[-1] += self.document.reporter.warning( 'Cannot extract empty bibliographic field "%s".' % name, base_node=field) return None return 1 def check_compound_biblio_field(self, field, name): if len(field[-1]) > 1: field[-1] += self.document.reporter.warning( 'Cannot extract compound bibliographic field "%s".' % name, base_node=field) return None if not isinstance(field[-1][0], nodes.paragraph): field[-1] += self.document.reporter.warning( 'Cannot extract bibliographic field "%s" containing ' 'anything other than a single paragraph.' % name, base_node=field) return None return 1 rcs_keyword_substitutions = [ (re.compile(r'\$' r'Date: (\d\d\d\d)/(\d\d)/(\d\d) [\d:]+ \$$', re.IGNORECASE), r'\1-\2-\3'), (re.compile(r'\$' r'RCSfile: (.+),v \$$', re.IGNORECASE), r'\1'), (re.compile(r'\$[a-zA-Z]+: (.+) \$$'), r'\1'),] def extract_authors(self, field, name, docinfo): try: if len(field[1]) == 1: if isinstance(field[1][0], nodes.paragraph): authors = self.authors_from_one_paragraph(field) elif isinstance(field[1][0], nodes.bullet_list): authors = self.authors_from_bullet_list(field) else: raise TransformError else: authors = self.authors_from_paragraphs(field) authornodes = [nodes.author('', '', *author) for author in authors if author] if len(authornodes) > 1: docinfo.append(nodes.authors('', *authornodes)) elif len(authornodes) == 1: docinfo.append(authornodes[0]) else: raise TransformError except TransformError: field[-1] += self.document.reporter.warning( 'Bibliographic field "%s" incompatible with extraction: ' 'it must contain either a single paragraph (with authors ' 'separated by one of "%s"), multiple paragraphs (one per ' 'author), or a bullet list with one paragraph (one author) ' 'per item.' % (name, ''.join(self.language.author_separators)), base_node=field) raise def authors_from_one_paragraph(self, field): text = field[1][0].astext().strip() if not text: raise TransformError for authorsep in self.language.author_separators: authornames = text.split(authorsep) if len(authornames) > 1: break authornames = [author.strip() for author in authornames] authors = [[nodes.Text(author)] for author in authornames if author] return authors def authors_from_bullet_list(self, field): authors = [] for item in field[1][0]: if len(item) != 1 or not isinstance(item[0], nodes.paragraph): raise TransformError authors.append(item[0].children) if not authors: raise TransformError return authors def authors_from_paragraphs(self, field): for item in field[1]: if not isinstance(item, nodes.paragraph): raise TransformError authors = [item.children for item in field[1]] return authors --- NEW FILE: parts.py --- # Authors: David Goodger, Ueli Schlaepfer, Dmitry Jemerov # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:53 $ # Copyright: This module has been placed in the public domain. """ Transforms related to document parts. """ __docformat__ = 'reStructuredText' import re import sys from docutils import nodes, utils from docutils.transforms import TransformError, Transform class SectNum(Transform): """ Automatically assigns numbers to the titles of document sections. It is possible to limit the maximum section level for which the numbers are added. For those sections that are auto-numbered, the "autonum" attribute is set, informing the contents table generator that a different form of the TOC should be used. """ default_priority = 710 """Should be applied before `Contents`.""" def apply(self): self.maxdepth = self.startnode.details.get('depth', sys.maxint) self.startnode.parent.remove(self.startnode) self.update_section_numbers(self.document) def update_section_numbers(self, node, prefix=(), depth=0): depth += 1 sectnum = 1 for child in node: if isinstance(child, nodes.section): numbers = prefix + (str(sectnum),) title = child[0] # Use   for spacing: generated = nodes.generated( '', '.'.join(numbers) + u'\u00a0' * 3, CLASS='sectnum') title.insert(0, generated) title['auto'] = 1 if depth < self.maxdepth: self.update_section_numbers(child, numbers, depth) sectnum += 1 class Contents(Transform): """ This transform generates a table of contents from the entire document tree or from a single branch. It locates "section" elements and builds them into a nested bullet list, which is placed within a "topic". A title is either explicitly specified, taken from the appropriate language module, or omitted (local table of contents). The depth may be specified. Two-way references between the table of contents and section titles are generated (requires Writer support). This transform requires a startnode, which which contains generation options and provides the location for the generated table of contents (the startnode is replaced by the table of contents "topic"). """ default_priority = 720 def apply(self): topic = nodes.topic(CLASS='contents') title = self.startnode.details['title'] if self.startnode.details.has_key('local'): startnode = self.startnode.parent # @@@ generate an error if the startnode (directive) not at # section/document top-level? Drag it up until it is? while not isinstance(startnode, nodes.Structural): startnode = startnode.parent else: startnode = self.document if not title: title = nodes.title('', self.language.labels['contents']) if title: name = title.astext() topic += title else: name = self.language.labels['contents'] name = utils.normalize_name(name) if not self.document.has_name(name): topic['name'] = name self.document.note_implicit_target(topic) self.toc_id = topic['id'] if self.startnode.details.has_key('backlinks'): self.backlinks = self.startnode.details['backlinks'] else: self.backlinks = self.document.settings.toc_backlinks contents = self.build_contents(startnode) if len(contents): topic += contents self.startnode.parent.replace(self.startnode, topic) else: self.startnode.parent.remove(self.startnode) def build_contents(self, node, level=0): level += 1 sections = [] i = len(node) - 1 while i >= 0 and isinstance(node[i], nodes.section): sections.append(node[i]) i -= 1 sections.reverse() entries = [] autonum = 0 depth = self.startnode.details.get('depth', sys.maxint) for section in sections: title = section[0] auto = title.get('auto') # May be set by SectNum. entrytext = self.copy_and_filter(title) reference = nodes.reference('', '', refid=section['id'], *entrytext) ref_id = self.document.set_id(reference) entry = nodes.paragraph('', '', reference) item = nodes.list_item('', entry) if self.backlinks == 'entry': title['refid'] = ref_id elif self.backlinks == 'top': title['refid'] = self.toc_id if level < depth: subsects = self.build_contents(section, level) item += subsects entries.append(item) if entries: contents = nodes.bullet_list('', *entries) if auto: contents.set_class('auto-toc') return contents else: return [] def copy_and_filter(self, node): """Return a copy of a title, with references, images, etc. removed.""" visitor = ContentsFilter(self.document) node.walkabout(visitor) return visitor.get_entry_text() class ContentsFilter(nodes.TreeCopyVisitor): def get_entry_text(self): return self.get_tree_copy().get_children() def visit_citation_reference(self, node): raise nodes.SkipNode def visit_footnote_reference(self, node): raise nodes.SkipNode def visit_image(self, node): if node.hasattr('alt'): self.parent.append(nodes.Text(node['alt'])) raise nodes.SkipNode def ignore_node_but_process_children(self, node): raise nodes.SkipDeparture visit_interpreted = ignore_node_but_process_children visit_problematic = ignore_node_but_process_children visit_reference = ignore_node_but_process_children visit_target = ignore_node_but_process_children --- NEW FILE: peps.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:53 $ # Copyright: This module has been placed in the public domain. """ Transforms for PEP processing. - `Headers`: Used to transform a PEP's initial RFC-2822 header. It remains a field list, but some entries get processed. - `Contents`: Auto-inserts a table of contents. - `PEPZero`: Special processing for PEP 0. """ __docformat__ = 'reStructuredText' import sys import os import re import time from docutils import nodes, utils from docutils import ApplicationError, DataError from docutils.transforms import Transform, TransformError from docutils.transforms import parts, references class Headers(Transform): """ Process fields in a PEP's initial RFC-2822 header. """ default_priority = 360 pep_url = 'pep-%04d.html' pep_cvs_url = ('http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/' 'python/nondist/peps/pep-%04d.txt') rcs_keyword_substitutions = ( (re.compile(r'\$' r'RCSfile: (.+),v \$$', re.IGNORECASE), r'\1'), (re.compile(r'\$[a-zA-Z]+: (.+) \$$'), r'\1'),) def apply(self): if not len(self.document): raise DataError('Document tree is empty.') header = self.document[0] if not isinstance(header, nodes.field_list) or \ header.get('class') != 'rfc2822': raise DataError('Document does not begin with an RFC-2822 ' 'header; it is not a PEP.') pep = title = None for field in header: if field[0].astext().lower() == 'pep': # should be the first field value = field[1].astext() try: pep = int(value) cvs_url = self.pep_cvs_url % pep except ValueError: pep = value cvs_url = None msg = self.document.reporter.warning( '"PEP" header must contain an integer; "%s" is an ' 'invalid value.' % pep, base_node=field) msgid = self.document.set_id(msg) prb = nodes.problematic(value, value or '(none)', refid=msgid) prbid = self.document.set_id(prb) msg.add_backref(prbid) if len(field[1]): field[1][0][:] = [prb] else: field[1] += nodes.paragraph('', '', prb) break if pep is None: raise DataError('Document does not contain an RFC-2822 "PEP" ' 'header.') if pep == 0: # Special processing for PEP 0. pending = nodes.pending(PEPZero) self.document.insert(1, pending) self.document.note_pending(pending) for field in header: name = field[0].astext().lower() body = field[1] if len(body) > 1: raise DataError('PEP header field body contains multiple ' 'elements:\n%s' % field.pformat(level=1)) elif len(body) == 1: if not isinstance(body[0], nodes.paragraph): raise DataError('PEP header field body may only contain ' 'a single paragraph:\n%s' % field.pformat(level=1)) elif name == 'last-modified': date = time.strftime( '%d-%b-%Y', time.localtime(os.stat(self.document['source'])[8])) if cvs_url: body += nodes.paragraph( '', '', nodes.reference('', date, refuri=cvs_url)) else: # empty continue para = body[0] if name == 'author': for node in para: if isinstance(node, nodes.reference): node.parent.replace(node, mask_email(node)) elif name == 'discussions-to': for node in para: if isinstance(node, nodes.reference): node.parent.replace(node, mask_email(node, pep)) elif name in ('replaces', 'replaced-by', 'requires'): newbody = [] space = nodes.Text(' ') for refpep in re.split(',?\s+', body.astext()): pepno = int(refpep) newbody.append(nodes.reference( refpep, refpep, refuri=self.pep_url % pepno)) newbody.append(space) para[:] = newbody[:-1] # drop trailing space elif name == 'last-modified': utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions) if cvs_url: date = para.astext() para[:] = [nodes.reference('', date, refuri=cvs_url)] elif name == 'content-type': pep_type = para.astext() uri = self.pep_url % 12 para[:] = [nodes.reference('', pep_type, refuri=uri)] elif name == 'version' and len(body): utils.clean_rcs_keywords(para, self.rcs_keyword_substitutions) class Contents(Transform): """ Insert a table of contents transform placeholder into the document after the RFC 2822 header. """ default_priority = 380 def apply(self): pending = nodes.pending(parts.Contents, {'title': None}) self.document.insert(1, pending) self.document.note_pending(pending) class TargetNotes(Transform): """ Locate the "References" section, insert a placeholder for an external target footnote insertion transform at the end, and run the transform. """ default_priority = 520 def apply(self): doc = self.document i = len(doc) - 1 refsect = copyright = None while i >= 0 and isinstance(doc[i], nodes.section): title_words = doc[i][0].astext().lower().split() if 'references' in title_words: refsect = doc[i] break elif 'copyright' in title_words: copyright = i i -= 1 if not refsect: refsect = nodes.section() refsect += nodes.title('', 'References') if copyright: # Put the new "References" section before "Copyright": doc.insert(copyright, refsect) else: # Put the new "References" section at end of doc: doc.append(refsect) pending = nodes.pending(references.TargetNotes) refsect.append(pending) self.document.note_pending(pending, 0) class PEPZero(Transform): """ Special processing for PEP 0. """ default_priority =760 def apply(self): visitor = PEPZeroSpecial(self.document) self.document.walk(visitor) self.startnode.parent.remove(self.startnode) class PEPZeroSpecial(nodes.SparseNodeVisitor): """ Perform the special processing needed by PEP 0: - Mask email addresses. - Link PEP numbers in the second column of 4-column tables to the PEPs themselves. """ pep_url = Headers.pep_url def unknown_visit(self, node): pass def visit_reference(self, node): node.parent.replace(node, mask_email(node)) def visit_field_list(self, node): if node.hasattr('class') and node['class'] == 'rfc2822': raise nodes.SkipNode def visit_tgroup(self, node): self.pep_table = node['cols'] == 4 self.entry = 0 def visit_colspec(self, node): self.entry += 1 if self.pep_table and self.entry == 2: node['class'] = 'num' def visit_row(self, node): self.entry = 0 def visit_entry(self, node): self.entry += 1 if self.pep_table and self.entry == 2 and len(node) == 1: node['class'] = 'num' p = node[0] if isinstance(p, nodes.paragraph) and len(p) == 1: text = p.astext() try: pep = int(text) ref = self.pep_url % pep p[0] = nodes.reference(text, text, refuri=ref) except ValueError: pass non_masked_addresses = ('peps@python.org', 'python-list@python.org', 'python-dev@python.org') def mask_email(ref, pepno=None): """ Mask the email address in `ref` and return a replacement node. `ref` is returned unchanged if it contains no email address. For email addresses such as "user@host", mask the address as "user at host" (text) to thwart simple email address harvesters (except for those listed in `non_masked_addresses`). If a PEP number (`pepno`) is given, return a reference including a default email subject. """ if ref.hasattr('refuri') and ref['refuri'].startswith('mailto:'): if ref['refuri'][8:] in non_masked_addresses: replacement = ref[0] else: replacement_text = ref.astext().replace('@', ' at ') replacement = nodes.raw('', replacement_text, format='html') if pepno is None: return replacement else: ref['refuri'] += '?subject=PEP%%20%s' % pepno ref[:] = [replacement] return ref else: return ref --- NEW FILE: references.py --- # Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:53 $ # Copyright: This module has been placed in the public domain. """ Transforms for resolving references. """ __docformat__ = 'reStructuredText' import sys import re from docutils import nodes, utils from docutils.transforms import TransformError, Transform indices = xrange(sys.maxint) class ChainedTargets(Transform): """ Attributes "refuri" and "refname" are migrated from the final direct target up the chain of contiguous adjacent internal targets, using `ChainedTargetResolver`. """ default_priority = 420 def apply(self): visitor = ChainedTargetResolver(self.document) self.document.walk(visitor) class ChainedTargetResolver(nodes.SparseNodeVisitor): """ Copy reference attributes up the length of a hyperlink target chain. "Chained targets" are multiple adjacent internal hyperlink targets which "point to" an external or indirect target. After the transform, all chained targets will effectively point to the same place. Given the following ``document`` as input:: <document> <target id="a" name="a"> <target id="b" name="b"> <target id="c" name="c" refuri="http://chained.external.targets"> <target id="d" name="d"> <paragraph> I'm known as "d". <target id="e" name="e"> <target id="id1"> <target id="f" name="f" refname="d"> ``ChainedTargetResolver(document).walk()`` will transform the above into:: <document> <target id="a" name="a" refuri="http://chained.external.targets"> <target id="b" name="b" refuri="http://chained.external.targets"> <target id="c" name="c" refuri="http://chained.external.targets"> <target id="d" name="d"> <paragraph> I'm known as "d". <target id="e" name="e" refname="d"> <target id="id1" refname="d"> <target id="f" name="f" refname="d"> """ def unknown_visit(self, node): pass def visit_target(self, node): if node.hasattr('refuri'): attname = 'refuri' call_if_named = self.document.note_external_target elif node.hasattr('refname'): attname = 'refname' call_if_named = self.document.note_indirect_target elif node.hasattr('refid'): attname = 'refid' call_if_named = None else: return attval = node[attname] index = node.parent.index(node) for i in range(index - 1, -1, -1): sibling = node.parent[i] if not isinstance(sibling, nodes.target) \ or sibling.hasattr('refuri') \ or sibling.hasattr('refname') \ or sibling.hasattr('refid'): break sibling[attname] = attval if sibling.hasattr('name') and call_if_named: call_if_named(sibling) class AnonymousHyperlinks(Transform): """ Link anonymous references to targets. Given:: <paragraph> <reference anonymous="1"> internal <reference anonymous="1"> external <target anonymous="1" id="id1"> <target anonymous="1" id="id2" refuri="http://external"> Corresponding references are linked via "refid" or resolved via "refuri":: <paragraph> <reference anonymous="1" refid="id1"> text <reference anonymous="1" refuri="http://external"> external <target anonymous="1" id="id1"> <target anonymous="1" id="id2" refuri="http://external"> """ default_priority = 440 def apply(self): if len(self.document.anonymous_refs) \ != len(self.document.anonymous_targets): msg = self.document.reporter.error( 'Anonymous hyperlink mismatch: %s references but %s ' 'targets.\nSee "backrefs" attribute for IDs.' % (len(self.document.anonymous_refs), len(self.document.anonymous_targets))) msgid = self.document.set_id(msg) for ref in self.document.anonymous_refs: prb = nodes.problematic( ref.rawsource, ref.rawsource, refid=msgid) prbid = self.document.set_id(prb) msg.add_backref(prbid) ref.parent.replace(ref, prb) return for ref, target in zip(self.document.anonymous_refs, self.document.anonymous_targets): if target.hasattr('refuri'): ref['refuri'] = target['refuri'] ref.resolved = 1 else: ref['refid'] = target['id'] self.document.note_refid(ref) target.referenced = 1 class IndirectHyperlinks(Transform): """ a) Indirect external references:: <paragraph> <reference refname="indirect external"> indirect external <target id="id1" name="direct external" refuri="http://indirect"> <target id="id2" name="indirect external" refname="direct external"> The "refuri" attribute is migrated back to all indirect targets from the final direct target (i.e. a target not referring to another indirect target):: <paragraph> <reference refname="indirect external"> indirect external <target id="id1" name="direct external" refuri="http://indirect"> <target id="id2" name="indirect external" refuri="http://indirect"> Once the attribute is migrated, the preexisting "refname" attribute is dropped. b) Indirect internal references:: <target id="id1" name="final target"> <paragraph> <reference refname="indirect internal"> indirect internal <target id="id2" name="indirect internal 2" refname="final target"> <target id="id3" name="indirect internal" refname="indirect internal 2"> Targets which indirectly refer to an internal target become one-hop indirect (their "refid" attributes are directly set to the internal target's "id"). References which indirectly refer to an internal target become direct internal references:: <target id="id1" name="final target"> <paragraph> <reference refid="id1"> indirect internal <target id="id2" name="indirect internal 2" refid="id1"> <target id="id3" name="indirect internal" refid="id1"> """ default_priority = 460 def apply(self): for target in self.document.indirect_targets: if not target.resolved: self.resolve_indirect_target(target) self.resolve_indirect_references(target) def resolve_indirect_target(self, target): refname = target['refname'] reftarget_id = self.document.nameids.get(refname) if not reftarget_id: self.nonexistent_indirect_target(target) return reftarget = self.document.ids[reftarget_id] if isinstance(reftarget, nodes.target) \ and not reftarget.resolved and reftarget.hasattr('refname'): self.one_indirect_target(reftarget) # multiply indirect if reftarget.hasattr('refuri'): target['refuri'] = reftarget['refuri'] if target.hasattr('name'): self.document.note_external_target(target) elif reftarget.hasattr('refid'): target['refid'] = reftarget['refid'] self.document.note_refid(target) else: try: target['refid'] = reftarget['id'] self.document.note_refid(target) except KeyError: self.nonexistent_indirect_target(target) return del target['refname'] target.resolved = 1 reftarget.referenced = 1 def nonexistent_indirect_target(self, target): naming = '' if target.hasattr('name'): naming = '"%s" ' % target['name'] reflist = self.document.refnames.get(target['name'], []) else: reflist = self.document.refids.get(target['id'], []) naming += '(id="%s")' % target['id'] msg = self.document.reporter.warning( 'Indirect hyperlink target %s refers to target "%s", ' 'which does not exist.' % (naming, target['refname']), base_node=target) msgid = self.document.set_id(msg) for ref in reflist: prb = nodes.problematic( ref.rawsource, ref.rawsource, refid=msgid) prbid = self.document.set_id(prb) msg.add_backref(prbid) ref.parent.replace(ref, prb) target.resolved = 1 def resolve_indirect_references(self, target): if target.hasattr('refid'): attname = 'refid' call_if_named = 0 call_method = self.document.note_refid elif target.hasattr('refuri'): attname = 'refuri' call_if_named = 1 call_method = self.document.note_external_target else: return attval = target[attname] if target.hasattr('name'): name = target['name'] try: reflist = self.document.refnames[name] except KeyError, instance: if target.referenced: return msg = self.document.reporter.info( 'Indirect hyperlink target "%s" is not referenced.' % name, base_node=target) target.referenced = 1 return delatt = 'refname' else: id = target['id'] try: reflist = self.document.refids[id] except KeyError, instance: if target.referenced: return msg = self.document.reporter.info( 'Indirect hyperlink target id="%s" is not referenced.' % id, base_node=target) target.referenced = 1 return delatt = 'refid' for ref in reflist: if ref.resolved: continue del ref[delatt] ref[attname] = attval if not call_if_named or ref.hasattr('name'): call_method(ref) ref.resolved = 1 if isinstance(ref, nodes.target): self.resolve_indirect_references(ref) target.referenced = 1 class ExternalTargets(Transform): """ Given:: <paragraph> <reference refname="direct external"> direct external <target id="id1" name="direct external" refuri="http://direct"> The "refname" attribute is replaced by the direct "refuri" attribute:: <paragraph> <reference refuri="http://direct"> direct external <target id="id1" name="direct external" refuri="http://direct"> """ default_priority = 640 def apply(self): for target in self.document.external_targets: if target.hasattr('refuri') and target.hasattr('name'): name = target['name'] refuri = target['refuri'] try: reflist = self.document.refnames[name] except KeyError, instance: if target.referenced: continue msg = self.document.reporter.info( 'External hyperlink target "%s" is not referenced.' % name, base_node=target) target.referenced = 1 continue for ref in reflist: if ref.resolved: continue del ref['refname'] ref['refuri'] = refuri ref.resolved = 1 target.referenced = 1 class InternalTargets(Transform): """ Given:: <paragraph> <reference refname="direct internal"> direct internal <target id="id1" name="direct internal"> The "refname" attribute is replaced by "refid" linking to the target's "id":: <paragraph> <reference refid="id1"> direct internal <target id="id1" name="direct internal"> """ default_priority = 660 def apply(self): for target in self.document.internal_targets: if target.hasattr('refuri') or target.hasattr('refid') \ or not target.hasattr('name'): continue name = target['name'] refid = target['id'] try: reflist = self.document.refnames[name] except KeyError, instance: if target.referenced: continue msg = self.document.reporter.info( 'Internal hyperlink target "%s" is not referenced.' % name, base_node=target) target.referenced = 1 continue for ref in reflist: if ref.resolved: continue del ref['refname'] ref['refid'] = refid ref.resolved = 1 target.referenced = 1 class Footnotes(Transform): """ Assign numbers to autonumbered footnotes, and resolve links to footnotes, citations, and their references. Given the following ``document`` as input:: <document> <paragraph> A labeled autonumbered footnote referece: <footnote_reference auto="1" id="id1" refname="footnote"> <paragraph> An unlabeled autonumbered footnote referece: <footnote_reference auto="1" id="id2"> <footnote auto="1" id="id3"> <paragraph> Unlabeled autonumbered footnote. <footnote auto="1" id="footnote" name="footnote"> <paragraph> Labeled autonumbered footnote. Auto-numbered footnotes have attribute ``auto="1"`` and no label. Auto-numbered footnote_references have no reference text (they're empty elements). When resolving the numbering, a ``label`` element is added to the beginning of the ``footnote``, and reference text to the ``footnote_reference``. The transformed result will be:: <document> <paragraph> A labeled autonumbered footnote referece: <footnote_reference auto="1" id="id1" refid="footnote"> 2 <paragraph> An unlabeled autonumbered footnote referece: <footnote_reference auto="1" id="id2" refid="id3"> 1 <footnote auto="1" id="id3" backrefs="id2"> <label> 1 <paragraph> Unlabeled autonumbered footnote. <footnote auto="1" id="footnote" name="footnote" backrefs="id1"> <label> 2 <paragraph> Labeled autonumbered footnote. Note that the footnotes are not in the same order as the references. The labels and reference text are added to the auto-numbered ``footnote`` and ``footnote_reference`` elements. Footnote elements are backlinked to their references via "refids" attributes. References are assigned "id" and "refid" attributes. After adding labels and reference text, the "auto" attributes can be ignored. """ default_priority = 620 autofootnote_labels = None """Keep track of unlabeled autonumbered footnotes.""" symbols = [ # Entries 1-4 and 6 below are from section 12.51 of # The Chicago Manual of Style, 14th edition. '*', # asterisk/star u'\u2020', # dagger † u'\u2021', # double dagger ‡ u'\u00A7', # section mark § u'\u00B6', # paragraph mark (pilcrow) ¶ # (parallels ['||'] in CMoS) '#', # number sign # The entries below were chosen arbitrarily. u'\u2660', # spade suit ♠ u'\u2665', # heart suit ♥ u'\u2666', # diamond suit ♦ u'\u2663', # club suit ♣ ] def apply(self): self.autofootnote_labels = [] startnum = self.document.autofootnote_start self.document.autofootnote_start = self.number_footnotes(startnum) self.number_footnote_references(startnum) self.symbolize_footnotes() self.resolve_footnotes_and_citations() def number_footnotes(self, startnum): """ Assign numbers to autonumbered footnotes. For labeled autonumbered footnotes, copy the number over to corresponding footnote references. """ for footnote in self.document.autofootnotes: while 1: label = str(startnum) startnum += 1 if not self.document.nameids.has_key(label): break footnote.insert(0, nodes.label('', label)) if footnote.hasattr('dupname'): continue if footnote.hasattr('name'): name = footnote['name'] for ref in self.document.footnote_refs.get(name, []): ref += nodes.Text(label) ref.delattr('refname') ref['refid'] = footnote['id'] footnote.add_backref(ref['id']) self.document.note_refid(ref) ref.resolved = 1 else: footnote['name'] = label self.document.note_explicit_target(footnote, footnote) self.autofootnote_labels.append(label) return startnum def number_footnote_references(self, startnum): """Assign numbers to autonumbered footnote references.""" i = 0 for ref in self.document.autofootnote_refs: if ref.resolved or ref.hasattr('refid'): continue try: label = self.autofootnote_labels[i] except IndexError: msg = self.document.reporter.error( 'Too many autonumbered footnote references: only %s ' 'corresponding footnotes available.' % len(self.autofootnote_labels), base_node=ref) msgid = self.document.set_id(msg) for ref in self.document.autofootnote_refs[i:]: if ref.resolved or ref.hasattr('refname'): continue prb = nodes.problematic( ref.rawsource, ref.rawsource, refid=msgid) prbid = self.document.set_id(prb) msg.add_backref(prbid) ref.parent.replace(ref, prb) break ref += nodes.Text(label) id = self.document.nameids[label] footnote = self.document.ids[id] ref['refid'] = id self.document.note_refid(ref) footnote.add_backref(ref['id']) ref.resolved = 1 i += 1 def symbolize_footnotes(self): """Add symbols indexes to "[*]"-style footnotes and references.""" labels = [] for footnote in self.document.symbol_footnotes: reps, index = divmod(self.document.symbol_footnote_start, len(self.symbols)) labeltext = self.symbols[index] * (reps + 1) labels.append(labeltext) footnote.insert(0, nodes.label('', labeltext)) self.document.symbol_footnote_start += 1 self.document.set_id(footnote) i = 0 for ref in self.document.symbol_footnote_refs: try: ref += nodes.Text(labels[i]) except IndexError: msg = self.document.reporter.error( 'Too many symbol footnote references: only %s ' 'corresponding footnotes available.' % len(labels), base_node=ref) msgid = self.document.set_id(msg) for ref in self.document.symbol_footnote_refs[i:]: if ref.resolved or ref.hasattr('refid'): continue prb = nodes.problematic( ref.rawsource, ref.rawsource, refid=msgid) prbid = self.document.set_id(prb) msg.add_backref(prbid) ref.parent.replace(ref, prb) break footnote = self.document.symbol_footnotes[i] ref['refid'] = footnote['id'] self.document.note_refid(ref) footnote.add_backref(ref['id']) i += 1 def resolve_footnotes_and_citations(self): """ Link manually-labeled footnotes and citations to/from their references. """ for footnote in self.document.footnotes: label = footnote['name'] if self.document.footnote_refs.has_key(label): reflist = self.document.footnote_refs[label] self.resolve_references(footnote, reflist) for citation in self.document.citations: label = citation['name'] if self.document.citation_refs.has_key(label): reflist = self.document.citation_refs[label] self.resolve_references(citation, reflist) def resolve_references(self, note, reflist): id = note['id'] for ref in reflist: if ref.resolved: continue ref.delattr('refname') ref['refid'] = id note.add_backref(ref['id']) ref.resolved = 1 note.resolved = 1 class Substitutions(Transform): """ Given the following ``document`` as input:: <document> <paragraph> The <substitution_reference refname="biohazard"> biohazard symbol is deservedly scary-looking. <substitution_definition name="biohazard"> <image alt="biohazard" uri="biohazard.png"> The ``substitution_reference`` will simply be replaced by the contents of the corresponding ``substitution_definition``. The transformed result will be:: <document> <paragraph> The <image alt="biohazard" uri="biohazard.png"> symbol is deservedly scary-looking. <substitution_definition name="biohazard"> <image alt="biohazard" uri="biohazard.png"> """ default_priority = 220 """The Substitutions transform has to be applied very early, before `docutils.tranforms.frontmatter.DocTitle` and others.""" def apply(self): defs = self.document.substitution_defs for refname, refs in self.document.substitution_refs.items(): for ref in refs: if defs.has_key(refname): ref.parent.replace(ref, defs[refname].get_children()) else: msg = self.document.reporter.error( 'Undefined substitution referenced: "%s".' % refname, base_node=ref) msgid = self.document.set_id(msg) prb = nodes.problematic( ref.rawsource, ref.rawsource, refid=msgid) prbid = self.document.set_id(prb) msg.add_backref(prbid) ref.parent.replace(ref, prb) self.document.substitution_refs = None # release replaced references class TargetNotes(Transform): """ Creates a footnote for each external target in the text, and corresponding footnote references after each reference. """ default_priority = 540 """The TargetNotes transform has to be applied after `IndirectHyperlinks` but before `Footnotes`.""" def apply(self): notes = {} nodelist = [] for target in self.document.external_targets: name = target.get('name') if not name: print >>sys.stderr, 'no name on target: %r' % target continue refs = self.document.refnames.get(name, []) if not refs: continue footnote = self.make_target_footnote(target, refs, notes) if not notes.has_key(target['refuri']): notes[target['refuri']] = footnote nodelist.append(footnote) if len(self.document.anonymous_targets) \ == len(self.document.anonymous_refs): for target, ref in zip(self.document.anonymous_targets, self.document.anonymous_refs): if target.hasattr('refuri'): footnote = self.make_target_footnote(target, [ref], notes) if not notes.has_key(target['refuri']): notes[target['refuri']] = footnote nodelist.append(footnote) self.startnode.parent.replace(self.startnode, nodelist) def make_target_footnote(self, target, refs, notes): refuri = target['refuri'] if notes.has_key(refuri): # duplicate? footnote = notes[refuri] footnote_name = footnote['name'] else: # original footnote = nodes.footnote() footnote_id = self.document.set_id(footnote) # Use a colon; they can't be produced inside names by the parser: footnote_name = 'target_note: ' + footnote_id footnote['auto'] = 1 footnote['name'] = footnote_name footnote_paragraph = nodes.paragraph() footnote_paragraph += nodes.reference('', refuri, refuri=refuri) footnote += footnote_paragraph self.document.note_autofootnote(footnote) self.document.note_explicit_target(footnote, footnote) for ref in refs: if isinstance(ref, nodes.target): continue refnode = nodes.footnote_reference( refname=footnote_name, auto=1) self.document.note_autofootnote_ref(refnode) self.document.note_footnote_ref(refnode) index = ref.parent.index(ref) + 1 reflist = [nodes.Text(' '), refnode] ref.parent.insert(index, reflist) return footnote --- NEW FILE: universal.py --- # Authors: David Goodger, Ueli Schlaepfer # Contact: goodger@users.sourceforge.net # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/08 23:47:53 $ # Copyright: This module has been placed in the public domain. """ Transforms needed by most or all documents: - `Decorations`: Generate a document's header & footer. - `Messages`: Placement of system messages stored in `nodes.document.transform_messages`. - `TestMessages`: Like `Messages`, used on test runs. - `FinalReferences`: Resolve remaining references. """ __docformat__ = 'reStructuredText' import re import sys import time from docutils import nodes, utils from docutils.transforms import TransformError, Transform class Decorations(Transform): """ Populate a document's decoration element (header, footer). """ default_priority = 820 def apply(self): header = self.generate_header() footer = self.generate_footer() if header or footer: decoration = nodes.decoration() decoration += header decoration += footer document = self.document index = document.first_child_not_matching_class( nodes.PreDecorative) if index is None: document += decoration else: document[index:index] = [decoration] def generate_header(self): return None def generate_footer(self): # @@@ Text is hard-coded for now. # Should be made dynamic (language-dependent). settings = self.document.settings if settings.generator or settings.datestamp or settings.source_link \ or settings.source_url: text = [] if settings.source_link and settings._source \ or settings.source_url: if settings.source_url: source = settings.source_url else: source = utils.relative_path(settings._destination, settings._source) text.extend([ nodes.reference('', 'View document source', refuri=source), nodes.Text('.\n')]) if settings.datestamp: datestamp = time.strftime(settings.datestamp, time.gmtime()) text.append(nodes.Text('Generated on: ' + datestamp + '.\n')) if settings.generator: text.extend([ nodes.Text('Generated by '), nodes.reference('', 'Docutils', refuri= 'http://docutils.sourceforge.net/'), nodes.Text(' from '), nodes.reference('', 'reStructuredText', refuri='http://' 'docutils.sourceforge.net/rst.html'), nodes.Text(' source.\n')]) footer = nodes.footer() footer += nodes.paragraph('', '', *text) return footer else: return None class Messages(Transform): """ Place any system messages generated after parsing into a dedicated section of the document. """ default_priority = 860 def apply(self): unfiltered = self.document.transform_messages threshold = self.document.reporter['writer'].report_level messages = [] for msg in unfiltered: if msg['level'] >= threshold and not msg.parent: messages.append(msg) if len(messages) > 0: section = nodes.section(CLASS='system-messages') # @@@ get this from the language module? section += nodes.title('', 'Docutils System Messages') section += messages self.document.transform_messages[:] = [] self.document += section class TestMessages(Transform): """ Append all post-parse system messages to the end of the document. """ default_priority = 890 def apply(self): for msg in self.document.transform_messages: if not msg.parent: self.document += msg class FinalChecks(Transform): """ Perform last-minute checks. - Check for dangling references (incl. footnote & citation). """ default_priority = 840 def apply(self): visitor = FinalCheckVisitor(self.document) self.document.walk(visitor) if self.document.settings.expose_internals: visitor = InternalAttributeExposer(self.document) self.document.walk(visitor) class FinalCheckVisitor(nodes.SparseNodeVisitor): def unknown_visit(self, node): pass def visit_reference(self, node): if node.resolved or not node.hasattr('refname'): return refname = node['refname'] id = self.document.nameids.get(refname) if id is None: msg = self.document.reporter.error( 'Unknown target name: "%s".' % (node['refname']), base_node=node) msgid = self.document.set_id(msg) prb = nodes.problematic( node.rawsource, node.rawsource, refid=msgid) prbid = self.document.set_id(prb) msg.add_backref(prbid) node.parent.replace(node, prb) else: del node['refname'] node['refid'] = id self.document.ids[id].referenced = 1 node.resolved = 1 visit_footnote_reference = visit_citation_reference = visit_reference class InternalAttributeExposer(nodes.GenericNodeVisitor): def __init__(self, document): nodes.GenericNodeVisitor.__init__(self, document) self.internal_attributes = document.settings.expose_internals def default_visit(self, node): for att in self.internal_attributes: value = getattr(node, att, None) if value is not None: node['internal:' + att] = value From tim_one@users.sourceforge.net Sat Nov 9 04:21:46 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 20:21:46 -0800 Subject: [Python-checkins] python/dist/src/Modules bz2module.c,1.4,1.5 Message-ID: <E18AN7y-0002c6-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv9970/modules Modified Files: bz2module.c Log Message: This couldn't compile on WIndows, due to hardcoded "long long". Repaired. Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** bz2module.c 8 Nov 2002 14:31:49 -0000 1.4 --- bz2module.c 9 Nov 2002 04:21:44 -0000 1.5 *************** *** 37,41 **** #elif SIZEOF_LONG_LONG >= 8 #define BZS_TOTAL_OUT(bzs) \ ! (((long long)bzs->total_out_hi32 << 32) + bzs->total_out_lo32) #else #define BZS_TOTAL_OUT(bzs) \ --- 37,41 ---- #elif SIZEOF_LONG_LONG >= 8 #define BZS_TOTAL_OUT(bzs) \ ! (((LONG_LONG)bzs->total_out_hi32 << 32) + bzs->total_out_lo32) #else #define BZS_TOTAL_OUT(bzs) \ *************** *** 110,114 **** ret = 1; break; ! case BZ_PARAM_ERROR: PyErr_SetString(PyExc_ValueError, --- 110,114 ---- ret = 1; break; ! case BZ_PARAM_ERROR: PyErr_SetString(PyExc_ValueError, *************** *** 117,121 **** ret = 1; break; ! case BZ_MEM_ERROR: PyErr_NoMemory(); --- 117,121 ---- ret = 1; break; ! case BZ_MEM_ERROR: PyErr_NoMemory(); *************** *** 215,220 **** skipnextlf = 0; if (c == '\n') { ! /* Seeing a \n here with ! * skipnextlf true means we * saw a \r before. */ --- 215,220 ---- skipnextlf = 0; if (c == '\n') { ! /* Seeing a \n here with ! * skipnextlf true means we * saw a \r before. */ *************** *** 378,382 **** if (f->f_buf != NULL) { ! if((f->f_bufend - f->f_bufptr) >= 1) return 0; else --- 378,382 ---- if (f->f_buf != NULL) { ! if((f->f_bufend - f->f_bufptr) >= 1) return 0; else *************** *** 419,427 **** if (f->f_buf == NULL) ! if (Util_ReadAhead(bf, bufsize) < 0) return NULL; len = f->f_bufend - f->f_bufptr; ! if (len == 0) return (PyStringObject *) PyString_FromStringAndSize(NULL, skip); --- 419,427 ---- if (f->f_buf == NULL) ! if (Util_ReadAhead(bf, bufsize) < 0) return NULL; len = f->f_bufend - f->f_bufptr; ! if (len == 0) return (PyStringObject *) PyString_FromStringAndSize(NULL, skip); *************** *** 432,436 **** s = (PyStringObject *) PyString_FromStringAndSize(NULL, skip+len); ! if (s == NULL) return NULL; memcpy(PyString_AS_STRING(s)+skip, f->f_bufptr, len); --- 432,436 ---- s = (PyStringObject *) PyString_FromStringAndSize(NULL, skip+len); ! if (s == NULL) return NULL; memcpy(PyString_AS_STRING(s)+skip, f->f_bufptr, len); *************** *** 472,479 **** int bzerror; PyObject *ret = NULL; ! if (!PyArg_ParseTuple(args, "|l:read", &bytesrequested)) return NULL; ! ACQUIRE_LOCK(self); switch (self->mode) { --- 472,479 ---- int bzerror; PyObject *ret = NULL; ! if (!PyArg_ParseTuple(args, "|l:read", &bytesrequested)) return NULL; ! ACQUIRE_LOCK(self); switch (self->mode) { *************** *** 762,776 **** if (!PyArg_ParseTuple(args, "s#", &buf, &len)) return NULL; ! ACQUIRE_LOCK(self); switch (self->mode) { case MODE_WRITE: break; ! case MODE_CLOSED: PyErr_SetString(PyExc_ValueError, "I/O operation on closed file"); goto cleanup;; ! default: PyErr_SetString(PyExc_IOError, --- 762,776 ---- if (!PyArg_ParseTuple(args, "s#", &buf, &len)) return NULL; ! ACQUIRE_LOCK(self); switch (self->mode) { case MODE_WRITE: break; ! case MODE_CLOSED: PyErr_SetString(PyExc_ValueError, "I/O operation on closed file"); goto cleanup;; ! default: PyErr_SetString(PyExc_IOError, *************** *** 785,794 **** self->pos += len; Py_END_ALLOW_THREADS ! if (bzerror != BZ_OK) { Util_CatchBZ2Error(bzerror); goto cleanup; } ! Py_INCREF(Py_None); ret = Py_None; --- 785,794 ---- self->pos += len; Py_END_ALLOW_THREADS ! if (bzerror != BZ_OK) { Util_CatchBZ2Error(bzerror); goto cleanup; } ! Py_INCREF(Py_None); ret = Py_None; *************** *** 946,950 **** PyObject *func; PyObject *ret = NULL; ! if (!PyArg_ParseTuple(args, "l|i:seek", &offset, &where)) return NULL; --- 946,950 ---- PyObject *func; PyObject *ret = NULL; ! if (!PyArg_ParseTuple(args, "l|i:seek", &offset, &where)) return NULL; *************** *** 956,965 **** case MODE_READ_EOF: break; ! case MODE_CLOSED: PyErr_SetString(PyExc_ValueError, "I/O operation on closed file"); goto cleanup;; ! default: PyErr_SetString(PyExc_IOError, --- 956,965 ---- case MODE_READ_EOF: break; ! case MODE_CLOSED: PyErr_SetString(PyExc_ValueError, "I/O operation on closed file"); goto cleanup;; ! default: PyErr_SetString(PyExc_IOError, *************** *** 1193,1197 **** self->size = -1; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "et|sii:BZ2File", kwlist, Py_FileSystemDefaultEncoding, --- 1193,1197 ---- self->size = -1; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "et|sii:BZ2File", kwlist, Py_FileSystemDefaultEncoding, *************** *** 1241,1245 **** else mode = univ_newline ? "wbU" : "wb"; ! file_args = Py_BuildValue("(ssi)", name, mode, buffering); if (!file_args) --- 1241,1245 ---- else mode = univ_newline ? "wbU" : "wb"; ! file_args = Py_BuildValue("(ssi)", name, mode, buffering); if (!file_args) *************** *** 1953,1957 **** return NULL; } ! for (;;) { Py_BEGIN_ALLOW_THREADS --- 1953,1957 ---- return NULL; } ! for (;;) { Py_BEGIN_ALLOW_THREADS *************** *** 2026,2030 **** return NULL; } ! for (;;) { Py_BEGIN_ALLOW_THREADS --- 2026,2030 ---- return NULL; } ! for (;;) { Py_BEGIN_ALLOW_THREADS From tim_one@users.sourceforge.net Sat Nov 9 04:23:33 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 20:23:33 -0800 Subject: [Python-checkins] python/dist/src/Modules bz2module.c,1.5,1.6 Message-ID: <E18AN9h-0002i3-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv10370/modules Modified Files: bz2module.c Log Message: Repaired signed-vs-unsigned mismatch. Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** bz2module.c 9 Nov 2002 04:21:44 -0000 1.5 --- bz2module.c 9 Nov 2002 04:23:31 -0000 1.6 *************** *** 1048,1052 **** * to walk forward. */ for (;;) { ! if (offset-bytesread > buffersize) readsize = buffersize; else --- 1048,1052 ---- * to walk forward. */ for (;;) { ! if ((size_t)offset-bytesread > buffersize) readsize = buffersize; else From tim_one@users.sourceforge.net Sat Nov 9 04:26:06 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 20:26:06 -0800 Subject: [Python-checkins] python/dist/src/Modules bz2module.c,1.6,1.7 Message-ID: <E18ANCA-0002oP-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv10598/modules Modified Files: bz2module.c Log Message: BZ2Comp_compress(): changed decl of totalout to LONG_LONG, since it's solely used to hold LONG_LONG values, and the compiler rightfully warns about potential data loss otherwise. Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** bz2module.c 9 Nov 2002 04:23:31 -0000 1.6 --- bz2module.c 9 Nov 2002 04:26:02 -0000 1.7 *************** *** 1433,1437 **** int datasize; int bufsize = SMALLCHUNK; ! long totalout; PyObject *ret = NULL; bz_stream *bzs = &self->bzs; --- 1433,1437 ---- int datasize; int bufsize = SMALLCHUNK; ! LONG_LONG totalout; PyObject *ret = NULL; bz_stream *bzs = &self->bzs; From tim_one@users.sourceforge.net Sat Nov 9 04:28:20 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 20:28:20 -0800 Subject: [Python-checkins] python/dist/src/Modules bz2module.c,1.7,1.8 Message-ID: <E18ANEK-0002vE-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv11057/modules Modified Files: bz2module.c Log Message: BZ2Comp_compress(): Explicitly cast the LONG_LONG size argument to _PyString_Resize to int. Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** bz2module.c 9 Nov 2002 04:26:02 -0000 1.7 --- bz2module.c 9 Nov 2002 04:28:17 -0000 1.8 *************** *** 1481,1485 **** } ! _PyString_Resize(&ret, BZS_TOTAL_OUT(bzs) - totalout); RELEASE_LOCK(self); --- 1481,1485 ---- } ! _PyString_Resize(&ret, (int)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); From tim_one@users.sourceforge.net Sat Nov 9 04:30:11 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 20:30:11 -0800 Subject: [Python-checkins] python/dist/src/Modules bz2module.c,1.8,1.9 Message-ID: <E18ANG7-00031u-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv11497/modules Modified Files: bz2module.c Log Message: BZ2Comp_flush(): Fixed more int vs LONG_LONG confusions. Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** bz2module.c 9 Nov 2002 04:28:17 -0000 1.8 --- bz2module.c 9 Nov 2002 04:30:08 -0000 1.9 *************** *** 1505,1509 **** PyObject *ret = NULL; bz_stream *bzs = &self->bzs; ! int totalout; int bzerror; --- 1505,1509 ---- PyObject *ret = NULL; bz_stream *bzs = &self->bzs; ! LONG_LONG totalout; int bzerror; *************** *** 1547,1551 **** if (bzs->avail_out != 0) ! _PyString_Resize(&ret, BZS_TOTAL_OUT(bzs) - totalout); RELEASE_LOCK(self); --- 1547,1551 ---- if (bzs->avail_out != 0) ! _PyString_Resize(&ret, (int)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); From tim_one@users.sourceforge.net Sat Nov 9 04:31:41 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 20:31:41 -0800 Subject: [Python-checkins] python/dist/src/Modules bz2module.c,1.9,1.10 Message-ID: <E18ANHZ-00035g-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv11840/modules Modified Files: bz2module.c Log Message: BZ2Decomp_decompress(): Fixed more long vs LONG_LONG confusions. Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** bz2module.c 9 Nov 2002 04:30:08 -0000 1.9 --- bz2module.c 9 Nov 2002 04:31:38 -0000 1.10 *************** *** 1710,1714 **** int datasize; int bufsize = SMALLCHUNK; ! long totalout; PyObject *ret = NULL; bz_stream *bzs = &self->bzs; --- 1710,1714 ---- int datasize; int bufsize = SMALLCHUNK; ! LONG_LONG totalout; PyObject *ret = NULL; bz_stream *bzs = &self->bzs; *************** *** 1770,1774 **** if (bzs->avail_out != 0) ! _PyString_Resize(&ret, BZS_TOTAL_OUT(bzs) - totalout); RELEASE_LOCK(self); --- 1770,1774 ---- if (bzs->avail_out != 0) ! _PyString_Resize(&ret, (int)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); From tim_one@users.sourceforge.net Sat Nov 9 04:33:39 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 20:33:39 -0800 Subject: [Python-checkins] python/dist/src/Modules bz2module.c,1.10,1.11 Message-ID: <E18ANJT-0003CI-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12156/modules Modified Files: bz2module.c Log Message: bz2_compress/bz2_decompress: more casting away LONG_LONG for _PyString_Resize calls. Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** bz2module.c 9 Nov 2002 04:31:38 -0000 1.10 --- bz2module.c 9 Nov 2002 04:33:36 -0000 1.11 *************** *** 1979,1983 **** if (bzs->avail_out != 0) ! _PyString_Resize(&ret, BZS_TOTAL_OUT(bzs)); BZ2_bzCompressEnd(bzs); --- 1979,1983 ---- if (bzs->avail_out != 0) ! _PyString_Resize(&ret, (int)BZS_TOTAL_OUT(bzs)); BZ2_bzCompressEnd(bzs); *************** *** 2058,2062 **** if (bzs->avail_out != 0) ! _PyString_Resize(&ret, BZS_TOTAL_OUT(bzs)); BZ2_bzDecompressEnd(bzs); --- 2058,2062 ---- if (bzs->avail_out != 0) ! _PyString_Resize(&ret, (int)BZS_TOTAL_OUT(bzs)); BZ2_bzDecompressEnd(bzs); From tim_one@users.sourceforge.net Sat Nov 9 04:44:32 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 20:44:32 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_bz2.py,1.1,1.2 Message-ID: <E18ANU0-0003ee-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13951/lib/test Modified Files: test_bz2.py Log Message: Open at least one binary file in binary mode. This allows a few of the bz2 tests to pass on Windows; most are still failing. Index: test_bz2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bz2.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_bz2.py 5 Nov 2002 16:50:05 -0000 1.1 --- test_bz2.py 9 Nov 2002 04:44:30 -0000 1.2 *************** *** 35,39 **** def createTempFile(self, crlf=0): ! f = open(self.filename, "w") if crlf: data = self.DATA_CRLF --- 35,39 ---- def createTempFile(self, crlf=0): ! f = open(self.filename, "wb") if crlf: data = self.DATA_CRLF From tim_one@users.sourceforge.net Sat Nov 9 04:49:00 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 20:49:00 -0800 Subject: [Python-checkins] python/dist/src/PC dllbase_nt.txt,1.4,1.5 Message-ID: <E18ANYK-0003pt-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv14224/python/PC Modified Files: dllbase_nt.txt Log Message: Start building the bz2 module on Windows. CAUTION: The Python test still has many failures, but I'm out of time for this now (already took much longer than hoped to get this far). The base bz2 library does pass its own tests (see next). CAUTION: People building on Windows have to download and build tne bz2 compression libraries now. See PCbuild\readme.txt for complete instructions. Index: dllbase_nt.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/dllbase_nt.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dllbase_nt.txt 6 Sep 2001 06:42:00 -0000 1.4 --- dllbase_nt.txt 9 Nov 2002 04:48:58 -0000 1.5 *************** *** 31,34 **** --- 31,35 ---- - unicodedata 1D120000 - 1D160000 - winsound 1D160000 - 1D170000 + - bZ2 1D170000 - 1D180000 Other extension modules From tim_one@users.sourceforge.net Sat Nov 9 04:49:00 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 20:49:00 -0800 Subject: [Python-checkins] python/dist/src/PCbuild bz2.dsp,NONE,1.1 pcbuild.dsw,1.26,1.27 readme.txt,1.24,1.25 Message-ID: <E18ANYK-0003pz-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv14224/python/PCbuild Modified Files: pcbuild.dsw readme.txt Added Files: bz2.dsp Log Message: Start building the bz2 module on Windows. CAUTION: The Python test still has many failures, but I'm out of time for this now (already took much longer than hoped to get this far). The base bz2 library does pass its own tests (see next). CAUTION: People building on Windows have to download and build tne bz2 compression libraries now. See PCbuild\readme.txt for complete instructions. --- NEW FILE: bz2.dsp --- # Microsoft Developer Studio Project File - Name="bz2" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=bz2 - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "bz2.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "bz2.mak" CFG="bz2 - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "bz2 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "bz2 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "bz2" # PROP Scc_LocalPath ".." CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "bz2 - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-release\bz2" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "..\..\bzip2-1.0.2" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 # ADD LINK32 ..\..\bzip2-1.0.2\libbz2.lib /nologo /base:"0x1D170000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./bz2.pyd" # SUBTRACT LINK32 /pdb:none /nodefaultlib !ELSEIF "$(CFG)" == "bz2 - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-debug\bz2" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /I "..\..\bzip2-1.0.2" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 ..\..\bzip2-1.0.2\libbz2.lib /nologo /base:"0x1D170000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /nodefaultlib:"libc" /out:"./bz2_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ENDIF # Begin Target # Name "bz2 - Win32 Release" # Name "bz2 - Win32 Debug" # Begin Source File SOURCE=..\Modules\bz2module.c # End Source File # End Target # End Project Index: pcbuild.dsw =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pcbuild.dsw,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** pcbuild.dsw 4 Feb 2001 03:09:53 -0000 1.26 --- pcbuild.dsw 9 Nov 2002 04:48:58 -0000 1.27 *************** *** 94,97 **** --- 94,109 ---- ############################################################################### + Project: "bz2"=.\bz2.dsp - Package Owner=<4> + + Package=<5> + {{{ + }}} + + Package=<4> + {{{ + }}} + + ############################################################################### + Project: "mmap"=.\mmap.dsp - Package Owner=<4> Index: readme.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/readme.txt,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** readme.txt 10 Jul 2002 17:05:14 -0000 1.24 --- readme.txt 9 Nov 2002 04:48:58 -0000 1.25 *************** *** 89,92 **** --- 89,120 ---- you need to clean up zlib-1.1.4\ by hand. + bz2 + Python wrapper for the libbz2 compression library. Homepage + http://sources.redhat.com/bzip2/ + Download the source tarball, bzip2-1.0.2.tar.gz. + Unpack into dist\bzip2-1.0.2. WARNING: If you using WinZip, you + must disable its "TAR file smart CR/LF conversion" feature (under + Options -> Configuration -> Miscellaneous -> Other) for the duration. + Don't bother trying to use libbz2.dsp with MSVC. After 10 minutes + of fiddling, I couldn't get it to work. Perhaps it works with + MSVC 5 (I used MSVC 6). It's better to run the by-hand makefile + anyway, because it runs a helpful test step at the end. + cd into dist\bzip2-1.0.2, and run + nmake -f makefile.msc + [Note that if you're running Win9X, you'll need to run vcvars32.bat + before running nmake (this batch file is in your MSVC installation). + TODO: make this work like zlib (in particular, MSVC runs the prelink + step in an enviroment that already has the correct envars set up). + ] + The make step should yield any warnings or errors, and should end + by displaying 6 blocks each terminated with + FC: no differences encountered + If FC finds differences, see the warning abou WinZip above (when I + first tried it, sample3.ref failed due to CRLF conversion). + All of this managed to build bzip2-1.0.2\libbz2.lib, which the Python + project links in. + + + bsddb Python wrapper for the BSD database 1.85. Requires db.1.85.win32.zip, From tim_one@users.sourceforge.net Sat Nov 9 05:08:10 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 21:08:10 -0800 Subject: [Python-checkins] python/dist/src/Lib ConfigParser.py,1.51,1.52 httplib.py,1.66,1.67 locale.py,1.23,1.24 posixpath.py,1.53,1.54 site.py,1.45,1.46 telnetlib.py,1.21,1.22 Message-ID: <E18ANqs-0004pH-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv18453 Modified Files: ConfigParser.py httplib.py locale.py posixpath.py site.py telnetlib.py Log Message: Whitespace normalization. Index: ConfigParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** ConfigParser.py 6 Nov 2002 14:51:20 -0000 1.51 --- ConfigParser.py 9 Nov 2002 05:08:06 -0000 1.52 *************** *** 526,530 **** # do the string interpolation value = rawval ! depth = MAX_INTERPOLATION_DEPTH while depth: # Loop through this until it's done depth -= 1 --- 526,530 ---- # do the string interpolation value = rawval ! depth = MAX_INTERPOLATION_DEPTH while depth: # Loop through this until it's done depth -= 1 Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** httplib.py 3 Sep 2002 20:49:06 -0000 1.66 --- httplib.py 9 Nov 2002 05:08:06 -0000 1.67 *************** *** 372,376 **** if self.chunked: return self._read_chunked(amt) ! if amt is None: # unbounded read --- 372,376 ---- if self.chunked: return self._read_chunked(amt) ! if amt is None: # unbounded read *************** *** 442,446 **** return value ! def _safe_read(self, amt): """Read the number of bytes requested, compensating for partial reads. --- 442,446 ---- return value ! def _safe_read(self, amt): """Read the number of bytes requested, compensating for partial reads. Index: locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/locale.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** locale.py 5 Nov 2002 03:49:09 -0000 1.23 --- locale.py 9 Nov 2002 05:08:06 -0000 1.24 *************** *** 273,277 **** # locales. Also, we ignore other modifiers. return code, 'iso-8859-15' ! if '.' in code: return code.split('.')[:2] --- 273,277 ---- # locales. Also, we ignore other modifiers. return code, 'iso-8859-15' ! if '.' in code: return code.split('.')[:2] *************** *** 421,425 **** else: return nl_langinfo(CODESET) ! ### Database --- 421,425 ---- else: return nl_langinfo(CODESET) ! ### Database Index: posixpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** posixpath.py 8 Oct 2002 02:44:30 -0000 1.53 --- posixpath.py 9 Nov 2002 05:08:06 -0000 1.54 *************** *** 412,414 **** supports_unicode_filenames = False - --- 412,413 ---- Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** site.py 19 Sep 2002 11:11:27 -0000 1.45 --- site.py 9 Nov 2002 05:08:06 -0000 1.46 *************** *** 95,99 **** # XXX This should not be part of site.py, since it is needed even when # using the -S option for Python. See http://www.python.org/sf/586680 ! if (os.name == "posix" and sys.path and os.path.basename(sys.path[-1]) == "Modules"): from distutils.util import get_platform --- 95,99 ---- # XXX This should not be part of site.py, since it is needed even when # using the -S option for Python. See http://www.python.org/sf/586680 ! if (os.name == "posix" and sys.path and os.path.basename(sys.path[-1]) == "Modules"): from distutils.util import get_platform Index: telnetlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/telnetlib.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** telnetlib.py 4 Nov 2002 17:34:07 -0000 1.21 --- telnetlib.py 9 Nov 2002 05:08:06 -0000 1.22 *************** *** 400,409 **** raise EOFError, 'telnet connection closed' return buf ! def read_sb_data(self): """Return any data available in the SB ... SE queue. ! Return '' if no SB ... SE available. Should only be called ! after seeing a SB or SE command. When a new SB command is found, old unread SB data will be discarded. Don't block. --- 400,409 ---- raise EOFError, 'telnet connection closed' return buf ! def read_sb_data(self): """Return any data available in the SB ... SE queue. ! Return '' if no SB ... SE available. Should only be called ! after seeing a SB or SE command. When a new SB command is found, old unread SB data will be discarded. Don't block. *************** *** 443,447 **** self.iacseq += c continue ! self.iacseq = '' if c == IAC: --- 443,447 ---- self.iacseq += c continue ! self.iacseq = '' if c == IAC: *************** *** 469,473 **** opt = c if cmd in (DO, DONT): ! self.msg('IAC %s %d', cmd == DO and 'DO' or 'DONT', ord(opt)) if self.option_callback: --- 469,473 ---- opt = c if cmd in (DO, DONT): ! self.msg('IAC %s %d', cmd == DO and 'DO' or 'DONT', ord(opt)) if self.option_callback: From tim_one@users.sourceforge.net Sat Nov 9 05:08:10 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 21:08:10 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_bz2.py,1.2,1.3 Message-ID: <E18ANqs-0004pI-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18453/test Modified Files: test_bz2.py Log Message: Whitespace normalization. Index: test_bz2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bz2.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_bz2.py 9 Nov 2002 04:44:30 -0000 1.2 --- test_bz2.py 9 Nov 2002 05:08:07 -0000 1.3 *************** *** 29,37 **** def setUp(self): self.filename = tempfile.mktemp("bz2") ! def tearDown(self): if os.path.isfile(self.filename): os.unlink(self.filename) ! def createTempFile(self, crlf=0): f = open(self.filename, "wb") --- 29,37 ---- def setUp(self): self.filename = tempfile.mktemp("bz2") ! def tearDown(self): if os.path.isfile(self.filename): os.unlink(self.filename) ! def createTempFile(self, crlf=0): f = open(self.filename, "wb") *************** *** 42,46 **** f.write(data) f.close() ! def testRead(self): "Test BZ2File.read()" --- 42,46 ---- f.write(data) f.close() ! def testRead(self): "Test BZ2File.read()" *************** *** 49,53 **** self.assertEqual(bz2f.read(), self.TEXT) bz2f.close() ! def testReadChunk10(self): "Test BZ2File.read() in chunks of 10 bytes" --- 49,53 ---- self.assertEqual(bz2f.read(), self.TEXT) bz2f.close() ! def testReadChunk10(self): "Test BZ2File.read() in chunks of 10 bytes" *************** *** 62,66 **** self.assertEqual(text, text) bz2f.close() ! def testRead100(self): "Test BZ2File.read(100)" --- 62,66 ---- self.assertEqual(text, text) bz2f.close() ! def testRead100(self): "Test BZ2File.read(100)" *************** *** 69,73 **** self.assertEqual(bz2f.read(100), self.TEXT[:100]) bz2f.close() ! def testReadLine(self): "Test BZ2File.readline()" --- 69,73 ---- self.assertEqual(bz2f.read(100), self.TEXT[:100]) bz2f.close() ! def testReadLine(self): "Test BZ2File.readline()" *************** *** 78,82 **** self.assertEqual(bz2f.readline(), line) bz2f.close() ! def testReadLines(self): "Test BZ2File.readlines()" --- 78,82 ---- self.assertEqual(bz2f.readline(), line) bz2f.close() ! def testReadLines(self): "Test BZ2File.readlines()" *************** *** 86,90 **** self.assertEqual(bz2f.readlines(), sio.readlines()) bz2f.close() ! def testIterator(self): "Test iter(BZ2File)" --- 86,90 ---- self.assertEqual(bz2f.readlines(), sio.readlines()) bz2f.close() ! def testIterator(self): "Test iter(BZ2File)" *************** *** 94,98 **** self.assertEqual(list(iter(bz2f)), sio.readlines()) bz2f.close() ! def testXReadLines(self): "Test BZ2File.xreadlines()" --- 94,98 ---- self.assertEqual(list(iter(bz2f)), sio.readlines()) bz2f.close() ! def testXReadLines(self): "Test BZ2File.xreadlines()" *************** *** 102,106 **** self.assertEqual(list(bz2f.xreadlines()), sio.readlines()) bz2f.close() ! def testUniversalNewlinesLF(self): "Test BZ2File.read() with universal newlines (\\n)" --- 102,106 ---- self.assertEqual(list(bz2f.xreadlines()), sio.readlines()) bz2f.close() ! def testUniversalNewlinesLF(self): "Test BZ2File.read() with universal newlines (\\n)" *************** *** 110,114 **** self.assertEqual(bz2f.newlines, "\n") bz2f.close() ! def testUniversalNewlinesCRLF(self): "Test BZ2File.read() with universal newlines (\\r\\n)" --- 110,114 ---- self.assertEqual(bz2f.newlines, "\n") bz2f.close() ! def testUniversalNewlinesCRLF(self): "Test BZ2File.read() with universal newlines (\\r\\n)" *************** *** 118,122 **** self.assertEqual(bz2f.newlines, "\r\n") bz2f.close() ! def testWrite(self): "Test BZ2File.write()" --- 118,122 ---- self.assertEqual(bz2f.newlines, "\r\n") bz2f.close() ! def testWrite(self): "Test BZ2File.write()" *************** *** 152,156 **** self.assertEqual(self.decompress(f.read()), self.TEXT) f.close() ! def testSeekForward(self): "Test BZ2File.seek(150, 0)" --- 152,156 ---- self.assertEqual(self.decompress(f.read()), self.TEXT) f.close() ! def testSeekForward(self): "Test BZ2File.seek(150, 0)" *************** *** 174,178 **** bz2f.seek(-150, 2) self.assertEqual(bz2f.read(), self.TEXT[len(self.TEXT)-150:]) ! def testSeekPostEnd(self): "Test BZ2File.seek(150000)" --- 174,178 ---- bz2f.seek(-150, 2) self.assertEqual(bz2f.read(), self.TEXT[len(self.TEXT)-150:]) ! def testSeekPostEnd(self): "Test BZ2File.seek(150000)" *************** *** 259,263 **** class FuncTest(BaseTest): "Test module functions" ! def testCompress(self): "Test compress() function" --- 259,263 ---- class FuncTest(BaseTest): "Test module functions" ! def testCompress(self): "Test compress() function" *************** *** 269,273 **** text = decompress(self.DATA) self.assertEqual(text, self.TEXT) ! def testDecompressEmpty(self): "Test decompress() function with empty string" --- 269,273 ---- text = decompress(self.DATA) self.assertEqual(text, self.TEXT) ! def testDecompressEmpty(self): "Test decompress() function with empty string" From tim_one@users.sourceforge.net Sat Nov 9 05:22:44 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 21:22:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_bz2.py,1.3,1.4 Message-ID: <E18AO4y-0005XD-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21230/Lib/test Modified Files: test_bz2.py Log Message: Comment out the test docstrings so we can at least tell which tests are failing. Index: test_bz2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bz2.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_bz2.py 9 Nov 2002 05:08:07 -0000 1.3 --- test_bz2.py 9 Nov 2002 05:22:41 -0000 1.4 *************** *** 44,48 **** def testRead(self): ! "Test BZ2File.read()" self.createTempFile() bz2f = BZ2File(self.filename) --- 44,48 ---- def testRead(self): ! # "Test BZ2File.read()" self.createTempFile() bz2f = BZ2File(self.filename) *************** *** 51,55 **** def testReadChunk10(self): ! "Test BZ2File.read() in chunks of 10 bytes" self.createTempFile() bz2f = BZ2File(self.filename) --- 51,55 ---- def testReadChunk10(self): ! # "Test BZ2File.read() in chunks of 10 bytes" self.createTempFile() bz2f = BZ2File(self.filename) *************** *** 64,68 **** def testRead100(self): ! "Test BZ2File.read(100)" self.createTempFile() bz2f = BZ2File(self.filename) --- 64,68 ---- def testRead100(self): ! # "Test BZ2File.read(100)" self.createTempFile() bz2f = BZ2File(self.filename) *************** *** 71,75 **** def testReadLine(self): ! "Test BZ2File.readline()" self.createTempFile() bz2f = BZ2File(self.filename) --- 71,75 ---- def testReadLine(self): ! # "Test BZ2File.readline()" self.createTempFile() bz2f = BZ2File(self.filename) *************** *** 80,84 **** def testReadLines(self): ! "Test BZ2File.readlines()" self.createTempFile() bz2f = BZ2File(self.filename) --- 80,84 ---- def testReadLines(self): ! # "Test BZ2File.readlines()" self.createTempFile() bz2f = BZ2File(self.filename) *************** *** 88,92 **** def testIterator(self): ! "Test iter(BZ2File)" self.createTempFile() bz2f = BZ2File(self.filename) --- 88,92 ---- def testIterator(self): ! # "Test iter(BZ2File)" self.createTempFile() bz2f = BZ2File(self.filename) *************** *** 96,100 **** def testXReadLines(self): ! "Test BZ2File.xreadlines()" self.createTempFile() bz2f = BZ2File(self.filename) --- 96,100 ---- def testXReadLines(self): ! # "Test BZ2File.xreadlines()" self.createTempFile() bz2f = BZ2File(self.filename) *************** *** 104,108 **** def testUniversalNewlinesLF(self): ! "Test BZ2File.read() with universal newlines (\\n)" self.createTempFile() bz2f = BZ2File(self.filename, "rU") --- 104,108 ---- def testUniversalNewlinesLF(self): ! # "Test BZ2File.read() with universal newlines (\\n)" self.createTempFile() bz2f = BZ2File(self.filename, "rU") *************** *** 112,116 **** def testUniversalNewlinesCRLF(self): ! "Test BZ2File.read() with universal newlines (\\r\\n)" self.createTempFile(crlf=1) bz2f = BZ2File(self.filename, "rU") --- 112,116 ---- def testUniversalNewlinesCRLF(self): ! # "Test BZ2File.read() with universal newlines (\\r\\n)" self.createTempFile(crlf=1) bz2f = BZ2File(self.filename, "rU") *************** *** 120,124 **** def testWrite(self): ! "Test BZ2File.write()" bz2f = BZ2File(self.filename, "w") bz2f.write(self.TEXT) --- 120,124 ---- def testWrite(self): ! # "Test BZ2File.write()" bz2f = BZ2File(self.filename, "w") bz2f.write(self.TEXT) *************** *** 129,133 **** def testWriteChunks10(self): ! "Test BZ2File.write() with chunks of 10 bytes" bz2f = BZ2File(self.filename, "w") n = 0 --- 129,133 ---- def testWriteChunks10(self): ! # "Test BZ2File.write() with chunks of 10 bytes" bz2f = BZ2File(self.filename, "w") n = 0 *************** *** 144,148 **** def testWriteLines(self): ! "Test BZ2File.writelines()" bz2f = BZ2File(self.filename, "w") sio = StringIO(self.TEXT) --- 144,148 ---- def testWriteLines(self): ! # "Test BZ2File.writelines()" bz2f = BZ2File(self.filename, "w") sio = StringIO(self.TEXT) *************** *** 154,158 **** def testSeekForward(self): ! "Test BZ2File.seek(150, 0)" self.createTempFile() bz2f = BZ2File(self.filename) --- 154,158 ---- def testSeekForward(self): ! # "Test BZ2File.seek(150, 0)" self.createTempFile() bz2f = BZ2File(self.filename) *************** *** 161,165 **** def testSeekBackwards(self): ! "Test BZ2File.seek(-150, 1)" self.createTempFile() bz2f = BZ2File(self.filename) --- 161,165 ---- def testSeekBackwards(self): ! # "Test BZ2File.seek(-150, 1)" self.createTempFile() bz2f = BZ2File(self.filename) *************** *** 169,173 **** def testSeekBackwardsFromEnd(self): ! "Test BZ2File.seek(-150, 2)" self.createTempFile() bz2f = BZ2File(self.filename) --- 169,173 ---- def testSeekBackwardsFromEnd(self): ! # "Test BZ2File.seek(-150, 2)" self.createTempFile() bz2f = BZ2File(self.filename) *************** *** 176,180 **** def testSeekPostEnd(self): ! "Test BZ2File.seek(150000)" self.createTempFile() bz2f = BZ2File(self.filename) --- 176,180 ---- def testSeekPostEnd(self): ! # "Test BZ2File.seek(150000)" self.createTempFile() bz2f = BZ2File(self.filename) *************** *** 184,188 **** def testSeekPostEndTwice(self): ! "Test BZ2File.seek(150000) twice" self.createTempFile() bz2f = BZ2File(self.filename) --- 184,188 ---- def testSeekPostEndTwice(self): ! # "Test BZ2File.seek(150000) twice" self.createTempFile() bz2f = BZ2File(self.filename) *************** *** 193,197 **** def testSeekPreStart(self): ! "Test BZ2File.seek(-150, 0)" self.createTempFile() bz2f = BZ2File(self.filename) --- 193,197 ---- def testSeekPreStart(self): ! # "Test BZ2File.seek(-150, 0)" self.createTempFile() bz2f = BZ2File(self.filename) *************** *** 202,206 **** class BZ2CompressorTest(BaseTest): def testCompress(self): ! "Test BZ2Compressor.compress()/flush()" bz2c = BZ2Compressor() data = bz2c.compress(self.TEXT) --- 202,206 ---- class BZ2CompressorTest(BaseTest): def testCompress(self): ! # "Test BZ2Compressor.compress()/flush()" bz2c = BZ2Compressor() data = bz2c.compress(self.TEXT) *************** *** 209,213 **** def testCompressChunks10(self): ! "Test BZ2Compressor.compress()/flush() with chunks of 10 bytes" bz2c = BZ2Compressor() n = 0 --- 209,213 ---- def testCompressChunks10(self): ! # "Test BZ2Compressor.compress()/flush() with chunks of 10 bytes" bz2c = BZ2Compressor() n = 0 *************** *** 224,228 **** class BZ2DecompressorTest(BaseTest): def testDecompress(self): ! "Test BZ2Decompressor.decompress()" bz2d = BZ2Decompressor() text = bz2d.decompress(self.DATA) --- 224,228 ---- class BZ2DecompressorTest(BaseTest): def testDecompress(self): ! # "Test BZ2Decompressor.decompress()" bz2d = BZ2Decompressor() text = bz2d.decompress(self.DATA) *************** *** 230,234 **** def testDecompressChunks10(self): ! "Test BZ2Decompressor.decompress() with chunks of 10 bytes" bz2d = BZ2Decompressor() text = '' --- 230,234 ---- def testDecompressChunks10(self): ! # "Test BZ2Decompressor.decompress() with chunks of 10 bytes" bz2d = BZ2Decompressor() text = '' *************** *** 243,247 **** def testDecompressUnusedData(self): ! "Test BZ2Decompressor.decompress() with unused data" bz2d = BZ2Decompressor() unused_data = "this is unused data" --- 243,247 ---- def testDecompressUnusedData(self): ! # "Test BZ2Decompressor.decompress() with unused data" bz2d = BZ2Decompressor() unused_data = "this is unused data" *************** *** 251,255 **** def testEOFError(self): ! "Calling BZ2Decompressor.decompress() after EOS must raise EOFError" bz2d = BZ2Decompressor() text = bz2d.decompress(self.DATA) --- 251,255 ---- def testEOFError(self): ! # "Calling BZ2Decompressor.decompress() after EOS must raise EOFError" bz2d = BZ2Decompressor() text = bz2d.decompress(self.DATA) *************** *** 261,280 **** def testCompress(self): ! "Test compress() function" data = compress(self.TEXT) self.assertEqual(self.decompress(data), self.TEXT) def testDecompress(self): ! "Test decompress() function" text = decompress(self.DATA) self.assertEqual(text, self.TEXT) def testDecompressEmpty(self): ! "Test decompress() function with empty string" text = decompress("") self.assertEqual(text, "") def testDecompressIncomplete(self): ! "Test decompress() function with incomplete data" self.assertRaises(ValueError, decompress, self.DATA[:-10]) --- 261,280 ---- def testCompress(self): ! # "Test compress() function" data = compress(self.TEXT) self.assertEqual(self.decompress(data), self.TEXT) def testDecompress(self): ! # "Test decompress() function" text = decompress(self.DATA) self.assertEqual(text, self.TEXT) def testDecompressEmpty(self): ! # "Test decompress() function with empty string" text = decompress("") self.assertEqual(text, "") def testDecompressIncomplete(self): ! # "Test decompress() function with incomplete data" self.assertRaises(ValueError, decompress, self.DATA[:-10]) From tim_one@users.sourceforge.net Sat Nov 9 05:26:18 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 21:26:18 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_b1.py,1.56,1.57 test_bz2.py,1.4,1.5 test_codeccallbacks.py,1.2,1.3 test_pep277.py,1.4,1.5 test_sets.py,1.14,1.15 test_support.py,1.44,1.45 test_trace.py,1.5,1.6 Message-ID: <E18AO8Q-0005gH-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21765/test Modified Files: test_b1.py test_bz2.py test_codeccallbacks.py test_pep277.py test_sets.py test_support.py test_trace.py Log Message: Whitespace normalization. Index: test_b1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** test_b1.py 6 Nov 2002 16:15:10 -0000 1.56 --- test_b1.py 9 Nov 2002 05:26:13 -0000 1.57 *************** *** 471,476 **** if have_unicode: ! try: int(unichr(0x661) * 600) ! except: raise TestFailed("int('\\u0661' * 600) didn't return long") try: int(1, 12) --- 471,476 ---- if have_unicode: ! try: int(unichr(0x661) * 600) ! except: raise TestFailed("int('\\u0661' * 600) didn't return long") try: int(1, 12) *************** *** 540,554 **** # XXX re-enabled. try: ! # Verify clearing of bug #556025. ! # This assumes that the max data size (sys.maxint) == max ! # address size this also assumes that the address size is at ! # least 4 bytes with 8 byte addresses, the bug is not well ! # tested ! # ! # Note: This test is expected to SEGV under Cygwin 1.3.12 or ! # earlier due to a newlib bug. See the following mailing list ! # thread for the details: ! # http://sources.redhat.com/ml/newlib/2002/msg00369.html list(xrange(sys.maxint // 2)) except MemoryError: --- 540,554 ---- # XXX re-enabled. try: ! # Verify clearing of bug #556025. ! # This assumes that the max data size (sys.maxint) == max ! # address size this also assumes that the address size is at ! # least 4 bytes with 8 byte addresses, the bug is not well ! # tested ! # ! # Note: This test is expected to SEGV under Cygwin 1.3.12 or ! # earlier due to a newlib bug. See the following mailing list ! # thread for the details: ! # http://sources.redhat.com/ml/newlib/2002/msg00369.html list(xrange(sys.maxint // 2)) except MemoryError: Index: test_bz2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bz2.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_bz2.py 9 Nov 2002 05:22:41 -0000 1.4 --- test_bz2.py 9 Nov 2002 05:26:14 -0000 1.5 *************** *** 9,281 **** class BaseTest(unittest.TestCase): ! "Base for other testcases." ! TEXT = 'root:x:0:0:root:/root:/bin/bash\nbin:x:1:1:bin:/bin:\ndaemon:x:2:2:daemon:/sbin:\nadm:x:3:4:adm:/var/adm:\nlp:x:4:7:lp:/var/spool/lpd:\nsync:x:5:0:sync:/sbin:/bin/sync\nshutdown:x:6:0:shutdown:/sbin:/sbin/shutdown\nhalt:x:7:0:halt:/sbin:/sbin/halt\nmail:x:8:12:mail:/var/spool/mail:\nnews:x:9:13:news:/var/spool/news:\nuucp:x:10:14:uucp:/var/spool/uucp:\noperator:x:11:0:operator:/root:\ngames:x:12:100:games:/usr/games:\ngopher:x:13:30:gopher:/usr/lib/gopher-data:\nftp:x:14:50:FTP User:/var/ftp:/bin/bash\nnobody:x:65534:65534:Nobody:/home:\npostfix:x:100:101:postfix:/var/spool/postfix:\nniemeyer:x:500:500::/home/niemeyer:/bin/bash\npostgres:x:101:102:PostgreSQL Server:/var/lib/pgsql:/bin/bash\nmysql:x:102:103:MySQL server:/var/lib/mysql:/bin/bash\nwww:x:103:104::/var/www:/bin/false\n' ! DATA = 'BZh91AY&SY.\xc8N\x18\x00\x01>_\x80\x00\x10@\x02\xff\xf0\x01\x07n\x00?\xe7\xff\xe00\x01\x99\xaa\x00\xc0\x03F\x86\x8c#&\x83F\x9a\x03\x06\xa6\xd0\xa6\x93M\x0fQ\xa7\xa8\x06\x804hh\x12$\x11\xa4i4\xf14S\xd2<Q\xb5\x0fH\xd3\xd4\xdd\xd5\x87\xbb\xf8\x94\r\x8f\xafI\x12\xe1\xc9\xf8/E\x00pu\x89\x12]\xc9\xbbDL\nQ\x0e\t1\x12\xdf\xa0\xc0\x97\xac2O9\x89\x13\x94\x0e\x1c7\x0ed\x95I\x0c\xaaJ\xa4\x18L\x10\x05#\x9c\xaf\xba\xbc/\x97\x8a#C\xc8\xe1\x8cW\xf9\xe2\xd0\xd6M\xa7\x8bXa<e\x84t\xcbL\xb3\xa7\xd9\xcd\xd1\xcb\x84.\xaf\xb3\xab\xab\xad`n}\xa0lh\tE,\x8eZ\x15\x17VH>\x88\xe5\xcd9gd6\x0b\n\xe9\x9b\xd5\x8a\x99\xf7\x08.K\x8ev\xfb\xf7xw\xbb\xdf\xa1\x92\xf1\xdd|/";\xa2\xba\x9f\xd5\xb1#A\xb6\xf6\xb3o\xc9\xc5y\\\xebO\xe7\x85\x9a\xbc\xb6f8\x952\xd5\xd7"%\x89>V,\xf7\xa6z\xe2\x9f\xa3\xdf\x11\x11"\xd6E)I\xa9\x13^\xca\xf3r\xd0\x03U\x922\xf26\xec\xb6\xed\x8b\xc3U\x13\x9d\xc5\x170\xa4\xfa^\x92\xacDF\x8a\x97\xd6\x19\xfe\xdd\xb8\xbd\x1a\x9a\x19\xa3\x80ankR\x8b\xe5\xd83]\xa9\xc6\x08\x82f\xf6\xb9"6l$\xb8j@\xc0\x8a\xb0l1..\xbak\x83ls\x15\xbc\xf4\xc1\x13\xbe\xf8E\xb8\x9d\r\xa8\x9dk\x84\xd3n\xfa\xacQ\x07\xb1%y\xaav\xb4\x08\xe0z\x1b\x16\xf5\x04\xe9\xcc\xb9\x08z\x1en7.G\xfc]\xc9\x14\xe1B@\xbb!8`' ! DATA_CRLF = 'BZh91AY&SY\xaez\xbbN\x00\x01H\xdf\x80\x00\x12@\x02\xff\xf0\x01\x07n\x00?\xe7\xff\xe0@\x01\xbc\xc6`\x86*\x8d=M\xa9\x9a\x86\xd0L@\x0fI\xa6!\xa1\x13\xc8\x88jdi\x8d@\x03@\x1a\x1a\x0c\x0c\x83 \x00\xc4h2\x19\x01\x82D\x84e\t\xe8\x99\x89\x19\x1ah\x00\r\x1a\x11\xaf\x9b\x0fG\xf5(\x1b\x1f?\t\x12\xcf\xb5\xfc\x95E\x00ps\x89\x12^\xa4\xdd\xa2&\x05(\x87\x04\x98\x89u\xe40%\xb6\x19\'\x8c\xc4\x89\xca\x07\x0e\x1b!\x91UIFU%C\x994!DI\xd2\xfa\xf0\xf1N8W\xde\x13A\xf5\x9cr%?\x9f3;I45A\xd1\x8bT\xb1<l\xba\xcb_\xc00xY\x17r\x17\x88\x08\x08@\xa0\ry@\x10\x04$)`\xf2\xce\x89z\xb0s\xec\x9b.iW\x9d\x81\xb5-+t\x9f\x1a\'\x97dB\xf5x\xb5\xbe.[.\xd7\x0e\x81\xe7\x08\x1cN`\x88\x10\xca\x87\xc3!"\x80\x92R\xa1/\xd1\xc0\xe6mf\xac\xbd\x99\xcca\xb3\x8780>\xa4\xc7\x8d\x1a\\"\xad\xa1\xabyBg\x15\xb9l\x88\x88\x91k"\x94\xa4\xd4\x89\xae*\xa6\x0b\x10\x0c\xd6\xd4m\xe86\xec\xb5j\x8a\x86j\';\xca.\x01I\xf2\xaaJ\xe8\x88\x8cU+t3\xfb\x0c\n\xa33\x13r2\r\x16\xe0\xb3(\xbf\x1d\x83r\xe7M\xf0D\x1365\xd8\x88\xd3\xa4\x92\xcb2\x06\x04\\\xc1\xb0\xea//\xbek&\xd8\xe6+t\xe5\xa1\x13\xada\x16\xder5"w]\xa2i\xb7[\x97R \xe2IT\xcd;Z\x04dk4\xad\x8a\t\xd3\x81z\x10\xf1:^`\xab\x1f\xc5\xdc\x91N\x14$+\x9e\xae\xd3\x80' ! def decompress(self, data): ! pop = popen2.Popen3("bunzip2", capturestderr=1) ! pop.tochild.write(data) ! pop.tochild.close() ! ret = pop.fromchild.read() ! pop.fromchild.close() ! if pop.wait() != 0: ! ret = decompress(data) ! return ret class BZ2FileTest(BaseTest): ! "Test MCRYPT type miscelaneous methods." ! def setUp(self): ! self.filename = tempfile.mktemp("bz2") ! def tearDown(self): ! if os.path.isfile(self.filename): ! os.unlink(self.filename) ! def createTempFile(self, crlf=0): ! f = open(self.filename, "wb") ! if crlf: ! data = self.DATA_CRLF ! else: ! data = self.DATA ! f.write(data) ! f.close() ! def testRead(self): ! # "Test BZ2File.read()" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! self.assertEqual(bz2f.read(), self.TEXT) ! bz2f.close() ! def testReadChunk10(self): ! # "Test BZ2File.read() in chunks of 10 bytes" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! text = '' ! while 1: ! str = bz2f.read(10) ! if not str: ! break ! text += str ! self.assertEqual(text, text) ! bz2f.close() ! def testRead100(self): ! # "Test BZ2File.read(100)" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! self.assertEqual(bz2f.read(100), self.TEXT[:100]) ! bz2f.close() ! def testReadLine(self): ! # "Test BZ2File.readline()" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! sio = StringIO(self.TEXT) ! for line in sio.readlines(): ! self.assertEqual(bz2f.readline(), line) ! bz2f.close() ! def testReadLines(self): ! # "Test BZ2File.readlines()" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! sio = StringIO(self.TEXT) ! self.assertEqual(bz2f.readlines(), sio.readlines()) ! bz2f.close() ! def testIterator(self): ! # "Test iter(BZ2File)" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! sio = StringIO(self.TEXT) ! self.assertEqual(list(iter(bz2f)), sio.readlines()) ! bz2f.close() ! def testXReadLines(self): ! # "Test BZ2File.xreadlines()" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! sio = StringIO(self.TEXT) ! self.assertEqual(list(bz2f.xreadlines()), sio.readlines()) ! bz2f.close() ! def testUniversalNewlinesLF(self): ! # "Test BZ2File.read() with universal newlines (\\n)" ! self.createTempFile() ! bz2f = BZ2File(self.filename, "rU") ! self.assertEqual(bz2f.read(), self.TEXT) ! self.assertEqual(bz2f.newlines, "\n") ! bz2f.close() ! def testUniversalNewlinesCRLF(self): ! # "Test BZ2File.read() with universal newlines (\\r\\n)" ! self.createTempFile(crlf=1) ! bz2f = BZ2File(self.filename, "rU") ! self.assertEqual(bz2f.read(), self.TEXT) ! self.assertEqual(bz2f.newlines, "\r\n") ! bz2f.close() ! def testWrite(self): ! # "Test BZ2File.write()" ! bz2f = BZ2File(self.filename, "w") ! bz2f.write(self.TEXT) ! bz2f.close() ! f = open(self.filename) ! self.assertEqual(self.decompress(f.read()), self.TEXT) ! f.close() ! def testWriteChunks10(self): ! # "Test BZ2File.write() with chunks of 10 bytes" ! bz2f = BZ2File(self.filename, "w") ! n = 0 ! while 1: ! str = self.TEXT[n*10:(n+1)*10] ! if not str: ! break ! bz2f.write(str) ! n += 1 ! bz2f.close() ! f = open(self.filename) ! self.assertEqual(self.decompress(f.read()), self.TEXT) ! f.close() ! def testWriteLines(self): ! # "Test BZ2File.writelines()" ! bz2f = BZ2File(self.filename, "w") ! sio = StringIO(self.TEXT) ! bz2f.writelines(sio.readlines()) ! bz2f.close() ! f = open(self.filename) ! self.assertEqual(self.decompress(f.read()), self.TEXT) ! f.close() ! def testSeekForward(self): ! # "Test BZ2File.seek(150, 0)" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! bz2f.seek(150) ! self.assertEqual(bz2f.read(), self.TEXT[150:]) ! def testSeekBackwards(self): ! # "Test BZ2File.seek(-150, 1)" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! bz2f.read(500) ! bz2f.seek(-150, 1) ! self.assertEqual(bz2f.read(), self.TEXT[500-150:]) ! def testSeekBackwardsFromEnd(self): ! # "Test BZ2File.seek(-150, 2)" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! bz2f.seek(-150, 2) ! self.assertEqual(bz2f.read(), self.TEXT[len(self.TEXT)-150:]) ! def testSeekPostEnd(self): ! # "Test BZ2File.seek(150000)" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! bz2f.seek(150000) ! self.assertEqual(bz2f.tell(), len(self.TEXT)) ! self.assertEqual(bz2f.read(), "") ! def testSeekPostEndTwice(self): ! # "Test BZ2File.seek(150000) twice" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! bz2f.seek(150000) ! bz2f.seek(150000) ! self.assertEqual(bz2f.tell(), len(self.TEXT)) ! self.assertEqual(bz2f.read(), "") ! def testSeekPreStart(self): ! # "Test BZ2File.seek(-150, 0)" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! bz2f.seek(-150) ! self.assertEqual(bz2f.tell(), 0) ! self.assertEqual(bz2f.read(), self.TEXT) class BZ2CompressorTest(BaseTest): ! def testCompress(self): ! # "Test BZ2Compressor.compress()/flush()" ! bz2c = BZ2Compressor() ! data = bz2c.compress(self.TEXT) ! data += bz2c.flush() ! self.assertEqual(self.decompress(data), self.TEXT) ! def testCompressChunks10(self): ! # "Test BZ2Compressor.compress()/flush() with chunks of 10 bytes" ! bz2c = BZ2Compressor() ! n = 0 ! data = '' ! while 1: ! str = self.TEXT[n*10:(n+1)*10] ! if not str: ! break ! data += bz2c.compress(str) ! n += 1 ! data += bz2c.flush() ! self.assertEqual(self.decompress(data), self.TEXT) class BZ2DecompressorTest(BaseTest): ! def testDecompress(self): ! # "Test BZ2Decompressor.decompress()" ! bz2d = BZ2Decompressor() ! text = bz2d.decompress(self.DATA) ! self.assertEqual(text, self.TEXT) ! def testDecompressChunks10(self): ! # "Test BZ2Decompressor.decompress() with chunks of 10 bytes" ! bz2d = BZ2Decompressor() ! text = '' ! n = 0 ! while 1: ! str = self.DATA[n*10:(n+1)*10] ! if not str: ! break ! text += bz2d.decompress(str) ! n += 1 ! self.assertEqual(text, self.TEXT) ! def testDecompressUnusedData(self): ! # "Test BZ2Decompressor.decompress() with unused data" ! bz2d = BZ2Decompressor() ! unused_data = "this is unused data" ! text = bz2d.decompress(self.DATA+unused_data) ! self.assertEqual(text, self.TEXT) ! self.assertEqual(bz2d.unused_data, unused_data) ! def testEOFError(self): ! # "Calling BZ2Decompressor.decompress() after EOS must raise EOFError" ! bz2d = BZ2Decompressor() ! text = bz2d.decompress(self.DATA) ! self.assertRaises(EOFError, bz2d.decompress, "anything") class FuncTest(BaseTest): ! "Test module functions" ! def testCompress(self): ! # "Test compress() function" ! data = compress(self.TEXT) ! self.assertEqual(self.decompress(data), self.TEXT) ! def testDecompress(self): ! # "Test decompress() function" ! text = decompress(self.DATA) ! self.assertEqual(text, self.TEXT) ! def testDecompressEmpty(self): ! # "Test decompress() function with empty string" ! text = decompress("") ! self.assertEqual(text, "") ! def testDecompressIncomplete(self): ! # "Test decompress() function with incomplete data" ! self.assertRaises(ValueError, decompress, self.DATA[:-10]) def test_main(): --- 9,281 ---- class BaseTest(unittest.TestCase): ! "Base for other testcases." ! TEXT = 'root:x:0:0:root:/root:/bin/bash\nbin:x:1:1:bin:/bin:\ndaemon:x:2:2:daemon:/sbin:\nadm:x:3:4:adm:/var/adm:\nlp:x:4:7:lp:/var/spool/lpd:\nsync:x:5:0:sync:/sbin:/bin/sync\nshutdown:x:6:0:shutdown:/sbin:/sbin/shutdown\nhalt:x:7:0:halt:/sbin:/sbin/halt\nmail:x:8:12:mail:/var/spool/mail:\nnews:x:9:13:news:/var/spool/news:\nuucp:x:10:14:uucp:/var/spool/uucp:\noperator:x:11:0:operator:/root:\ngames:x:12:100:games:/usr/games:\ngopher:x:13:30:gopher:/usr/lib/gopher-data:\nftp:x:14:50:FTP User:/var/ftp:/bin/bash\nnobody:x:65534:65534:Nobody:/home:\npostfix:x:100:101:postfix:/var/spool/postfix:\nniemeyer:x:500:500::/home/niemeyer:/bin/bash\npostgres:x:101:102:PostgreSQL Server:/var/lib/pgsql:/bin/bash\nmysql:x:102:103:MySQL server:/var/lib/mysql:/bin/bash\nwww:x:103:104::/var/www:/bin/false\n' ! DATA = 'BZh91AY&SY.\xc8N\x18\x00\x01>_\x80\x00\x10@\x02\xff\xf0\x01\x07n\x00?\xe7\xff\xe00\x01\x99\xaa\x00\xc0\x03F\x86\x8c#&\x83F\x9a\x03\x06\xa6\xd0\xa6\x93M\x0fQ\xa7\xa8\x06\x804hh\x12$\x11\xa4i4\xf14S\xd2<Q\xb5\x0fH\xd3\xd4\xdd\xd5\x87\xbb\xf8\x94\r\x8f\xafI\x12\xe1\xc9\xf8/E\x00pu\x89\x12]\xc9\xbbDL\nQ\x0e\t1\x12\xdf\xa0\xc0\x97\xac2O9\x89\x13\x94\x0e\x1c7\x0ed\x95I\x0c\xaaJ\xa4\x18L\x10\x05#\x9c\xaf\xba\xbc/\x97\x8a#C\xc8\xe1\x8cW\xf9\xe2\xd0\xd6M\xa7\x8bXa<e\x84t\xcbL\xb3\xa7\xd9\xcd\xd1\xcb\x84.\xaf\xb3\xab\xab\xad`n}\xa0lh\tE,\x8eZ\x15\x17VH>\x88\xe5\xcd9gd6\x0b\n\xe9\x9b\xd5\x8a\x99\xf7\x08.K\x8ev\xfb\xf7xw\xbb\xdf\xa1\x92\xf1\xdd|/";\xa2\xba\x9f\xd5\xb1#A\xb6\xf6\xb3o\xc9\xc5y\\\xebO\xe7\x85\x9a\xbc\xb6f8\x952\xd5\xd7"%\x89>V,\xf7\xa6z\xe2\x9f\xa3\xdf\x11\x11"\xd6E)I\xa9\x13^\xca\xf3r\xd0\x03U\x922\xf26\xec\xb6\xed\x8b\xc3U\x13\x9d\xc5\x170\xa4\xfa^\x92\xacDF\x8a\x97\xd6\x19\xfe\xdd\xb8\xbd\x1a\x9a\x19\xa3\x80ankR\x8b\xe5\xd83]\xa9\xc6\x08\x82f\xf6\xb9"6l$\xb8j@\xc0\x8a\xb0l1..\xbak\x83ls\x15\xbc\xf4\xc1\x13\xbe\xf8E\xb8\x9d\r\xa8\x9dk\x84\xd3n\xfa\xacQ\x07\xb1%y\xaav\xb4\x08\xe0z\x1b\x16\xf5\x04\xe9\xcc\xb9\x08z\x1en7.G\xfc]\xc9\x14\xe1B@\xbb!8`' ! DATA_CRLF = 'BZh91AY&SY\xaez\xbbN\x00\x01H\xdf\x80\x00\x12@\x02\xff\xf0\x01\x07n\x00?\xe7\xff\xe0@\x01\xbc\xc6`\x86*\x8d=M\xa9\x9a\x86\xd0L@\x0fI\xa6!\xa1\x13\xc8\x88jdi\x8d@\x03@\x1a\x1a\x0c\x0c\x83 \x00\xc4h2\x19\x01\x82D\x84e\t\xe8\x99\x89\x19\x1ah\x00\r\x1a\x11\xaf\x9b\x0fG\xf5(\x1b\x1f?\t\x12\xcf\xb5\xfc\x95E\x00ps\x89\x12^\xa4\xdd\xa2&\x05(\x87\x04\x98\x89u\xe40%\xb6\x19\'\x8c\xc4\x89\xca\x07\x0e\x1b!\x91UIFU%C\x994!DI\xd2\xfa\xf0\xf1N8W\xde\x13A\xf5\x9cr%?\x9f3;I45A\xd1\x8bT\xb1<l\xba\xcb_\xc00xY\x17r\x17\x88\x08\x08@\xa0\ry@\x10\x04$)`\xf2\xce\x89z\xb0s\xec\x9b.iW\x9d\x81\xb5-+t\x9f\x1a\'\x97dB\xf5x\xb5\xbe.[.\xd7\x0e\x81\xe7\x08\x1cN`\x88\x10\xca\x87\xc3!"\x80\x92R\xa1/\xd1\xc0\xe6mf\xac\xbd\x99\xcca\xb3\x8780>\xa4\xc7\x8d\x1a\\"\xad\xa1\xabyBg\x15\xb9l\x88\x88\x91k"\x94\xa4\xd4\x89\xae*\xa6\x0b\x10\x0c\xd6\xd4m\xe86\xec\xb5j\x8a\x86j\';\xca.\x01I\xf2\xaaJ\xe8\x88\x8cU+t3\xfb\x0c\n\xa33\x13r2\r\x16\xe0\xb3(\xbf\x1d\x83r\xe7M\xf0D\x1365\xd8\x88\xd3\xa4\x92\xcb2\x06\x04\\\xc1\xb0\xea//\xbek&\xd8\xe6+t\xe5\xa1\x13\xada\x16\xder5"w]\xa2i\xb7[\x97R \xe2IT\xcd;Z\x04dk4\xad\x8a\t\xd3\x81z\x10\xf1:^`\xab\x1f\xc5\xdc\x91N\x14$+\x9e\xae\xd3\x80' ! def decompress(self, data): ! pop = popen2.Popen3("bunzip2", capturestderr=1) ! pop.tochild.write(data) ! pop.tochild.close() ! ret = pop.fromchild.read() ! pop.fromchild.close() ! if pop.wait() != 0: ! ret = decompress(data) ! return ret class BZ2FileTest(BaseTest): ! "Test MCRYPT type miscelaneous methods." ! def setUp(self): ! self.filename = tempfile.mktemp("bz2") ! def tearDown(self): ! if os.path.isfile(self.filename): ! os.unlink(self.filename) ! def createTempFile(self, crlf=0): ! f = open(self.filename, "wb") ! if crlf: ! data = self.DATA_CRLF ! else: ! data = self.DATA ! f.write(data) ! f.close() ! def testRead(self): ! # "Test BZ2File.read()" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! self.assertEqual(bz2f.read(), self.TEXT) ! bz2f.close() ! def testReadChunk10(self): ! # "Test BZ2File.read() in chunks of 10 bytes" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! text = '' ! while 1: ! str = bz2f.read(10) ! if not str: ! break ! text += str ! self.assertEqual(text, text) ! bz2f.close() ! def testRead100(self): ! # "Test BZ2File.read(100)" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! self.assertEqual(bz2f.read(100), self.TEXT[:100]) ! bz2f.close() ! def testReadLine(self): ! # "Test BZ2File.readline()" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! sio = StringIO(self.TEXT) ! for line in sio.readlines(): ! self.assertEqual(bz2f.readline(), line) ! bz2f.close() ! def testReadLines(self): ! # "Test BZ2File.readlines()" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! sio = StringIO(self.TEXT) ! self.assertEqual(bz2f.readlines(), sio.readlines()) ! bz2f.close() ! def testIterator(self): ! # "Test iter(BZ2File)" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! sio = StringIO(self.TEXT) ! self.assertEqual(list(iter(bz2f)), sio.readlines()) ! bz2f.close() ! def testXReadLines(self): ! # "Test BZ2File.xreadlines()" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! sio = StringIO(self.TEXT) ! self.assertEqual(list(bz2f.xreadlines()), sio.readlines()) ! bz2f.close() ! def testUniversalNewlinesLF(self): ! # "Test BZ2File.read() with universal newlines (\\n)" ! self.createTempFile() ! bz2f = BZ2File(self.filename, "rU") ! self.assertEqual(bz2f.read(), self.TEXT) ! self.assertEqual(bz2f.newlines, "\n") ! bz2f.close() ! def testUniversalNewlinesCRLF(self): ! # "Test BZ2File.read() with universal newlines (\\r\\n)" ! self.createTempFile(crlf=1) ! bz2f = BZ2File(self.filename, "rU") ! self.assertEqual(bz2f.read(), self.TEXT) ! self.assertEqual(bz2f.newlines, "\r\n") ! bz2f.close() ! def testWrite(self): ! # "Test BZ2File.write()" ! bz2f = BZ2File(self.filename, "w") ! bz2f.write(self.TEXT) ! bz2f.close() ! f = open(self.filename) ! self.assertEqual(self.decompress(f.read()), self.TEXT) ! f.close() ! def testWriteChunks10(self): ! # "Test BZ2File.write() with chunks of 10 bytes" ! bz2f = BZ2File(self.filename, "w") ! n = 0 ! while 1: ! str = self.TEXT[n*10:(n+1)*10] ! if not str: ! break ! bz2f.write(str) ! n += 1 ! bz2f.close() ! f = open(self.filename) ! self.assertEqual(self.decompress(f.read()), self.TEXT) ! f.close() ! def testWriteLines(self): ! # "Test BZ2File.writelines()" ! bz2f = BZ2File(self.filename, "w") ! sio = StringIO(self.TEXT) ! bz2f.writelines(sio.readlines()) ! bz2f.close() ! f = open(self.filename) ! self.assertEqual(self.decompress(f.read()), self.TEXT) ! f.close() ! def testSeekForward(self): ! # "Test BZ2File.seek(150, 0)" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! bz2f.seek(150) ! self.assertEqual(bz2f.read(), self.TEXT[150:]) ! def testSeekBackwards(self): ! # "Test BZ2File.seek(-150, 1)" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! bz2f.read(500) ! bz2f.seek(-150, 1) ! self.assertEqual(bz2f.read(), self.TEXT[500-150:]) ! def testSeekBackwardsFromEnd(self): ! # "Test BZ2File.seek(-150, 2)" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! bz2f.seek(-150, 2) ! self.assertEqual(bz2f.read(), self.TEXT[len(self.TEXT)-150:]) ! def testSeekPostEnd(self): ! # "Test BZ2File.seek(150000)" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! bz2f.seek(150000) ! self.assertEqual(bz2f.tell(), len(self.TEXT)) ! self.assertEqual(bz2f.read(), "") ! def testSeekPostEndTwice(self): ! # "Test BZ2File.seek(150000) twice" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! bz2f.seek(150000) ! bz2f.seek(150000) ! self.assertEqual(bz2f.tell(), len(self.TEXT)) ! self.assertEqual(bz2f.read(), "") ! def testSeekPreStart(self): ! # "Test BZ2File.seek(-150, 0)" ! self.createTempFile() ! bz2f = BZ2File(self.filename) ! bz2f.seek(-150) ! self.assertEqual(bz2f.tell(), 0) ! self.assertEqual(bz2f.read(), self.TEXT) class BZ2CompressorTest(BaseTest): ! def testCompress(self): ! # "Test BZ2Compressor.compress()/flush()" ! bz2c = BZ2Compressor() ! data = bz2c.compress(self.TEXT) ! data += bz2c.flush() ! self.assertEqual(self.decompress(data), self.TEXT) ! def testCompressChunks10(self): ! # "Test BZ2Compressor.compress()/flush() with chunks of 10 bytes" ! bz2c = BZ2Compressor() ! n = 0 ! data = '' ! while 1: ! str = self.TEXT[n*10:(n+1)*10] ! if not str: ! break ! data += bz2c.compress(str) ! n += 1 ! data += bz2c.flush() ! self.assertEqual(self.decompress(data), self.TEXT) class BZ2DecompressorTest(BaseTest): ! def testDecompress(self): ! # "Test BZ2Decompressor.decompress()" ! bz2d = BZ2Decompressor() ! text = bz2d.decompress(self.DATA) ! self.assertEqual(text, self.TEXT) ! def testDecompressChunks10(self): ! # "Test BZ2Decompressor.decompress() with chunks of 10 bytes" ! bz2d = BZ2Decompressor() ! text = '' ! n = 0 ! while 1: ! str = self.DATA[n*10:(n+1)*10] ! if not str: ! break ! text += bz2d.decompress(str) ! n += 1 ! self.assertEqual(text, self.TEXT) ! def testDecompressUnusedData(self): ! # "Test BZ2Decompressor.decompress() with unused data" ! bz2d = BZ2Decompressor() ! unused_data = "this is unused data" ! text = bz2d.decompress(self.DATA+unused_data) ! self.assertEqual(text, self.TEXT) ! self.assertEqual(bz2d.unused_data, unused_data) ! def testEOFError(self): ! # "Calling BZ2Decompressor.decompress() after EOS must raise EOFError" ! bz2d = BZ2Decompressor() ! text = bz2d.decompress(self.DATA) ! self.assertRaises(EOFError, bz2d.decompress, "anything") class FuncTest(BaseTest): ! "Test module functions" ! def testCompress(self): ! # "Test compress() function" ! data = compress(self.TEXT) ! self.assertEqual(self.decompress(data), self.TEXT) ! def testDecompress(self): ! # "Test decompress() function" ! text = decompress(self.DATA) ! self.assertEqual(text, self.TEXT) ! def testDecompressEmpty(self): ! # "Test decompress() function with empty string" ! text = decompress("") ! self.assertEqual(text, "") ! def testDecompressIncomplete(self): ! # "Test decompress() function with incomplete data" ! self.assertRaises(ValueError, decompress, self.DATA[:-10]) def test_main(): Index: test_codeccallbacks.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codeccallbacks.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_codeccallbacks.py 6 Sep 2002 17:21:40 -0000 1.2 --- test_codeccallbacks.py 9 Nov 2002 05:26:14 -0000 1.3 *************** *** 214,221 **** for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15", "utf-8", "utf-7", "utf-16"): for err in errors: ! try: ! uni.encode(enc, err) ! except UnicodeError: ! pass def check_exceptionobjectargs(self, exctype, args, msg): --- 214,221 ---- for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15", "utf-8", "utf-7", "utf-16"): for err in errors: ! try: ! uni.encode(enc, err) ! except UnicodeError: ! pass def check_exceptionobjectargs(self, exctype, args, msg): *************** *** 230,234 **** for wrongarg in wrongargs: if type(wrongarg) is type(args[i]): ! continue # build argument array callargs = [] --- 230,234 ---- for wrongarg in wrongargs: if type(wrongarg) is type(args[i]): ! continue # build argument array callargs = [] Index: test_pep277.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pep277.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_pep277.py 8 Oct 2002 02:44:30 -0000 1.4 --- test_pep277.py 9 Nov 2002 05:26:15 -0000 1.5 *************** *** 53,60 **** except expected_exception, details: if check_fn_in_exception and details.filename != filename: ! raise TestFailed("Function '%s(%r) failed with " ! "bad filename in the exception: %r" ! % (fn.__name__, filename, ! details.filename)) def test_failures(self): --- 53,60 ---- except expected_exception, details: if check_fn_in_exception and details.filename != filename: ! raise TestFailed("Function '%s(%r) failed with " ! "bad filename in the exception: %r" ! % (fn.__name__, filename, ! details.filename)) def test_failures(self): Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_sets.py 8 Nov 2002 05:03:21 -0000 1.14 --- test_sets.py 9 Nov 2002 05:26:15 -0000 1.15 *************** *** 447,454 **** class TestSubsetPartial(TestSubsets): ! left = Set([1]) ! right = Set([1, 2]) ! name = "one a non-empty proper subset of other" ! cases = "!=", "<", "<=" #------------------------------------------------------------------------------ --- 447,454 ---- class TestSubsetPartial(TestSubsets): ! left = Set([1]) ! right = Set([1, 2]) ! name = "one a non-empty proper subset of other" ! cases = "!=", "<", "<=" #------------------------------------------------------------------------------ Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** test_support.py 3 Nov 2002 00:35:53 -0000 1.44 --- test_support.py 9 Nov 2002 05:26:15 -0000 1.45 *************** *** 110,114 **** del TMP_TESTFN except IOError: ! print ('WARNING: tests will fail, unable to write to: %s or %s' % (TESTFN, TMP_TESTFN)) if fp is not None: --- 110,114 ---- del TMP_TESTFN except IOError: ! print ('WARNING: tests will fail, unable to write to: %s or %s' % (TESTFN, TMP_TESTFN)) if fp is not None: Index: test_trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_trace.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_trace.py 8 Nov 2002 13:08:45 -0000 1.5 --- test_trace.py 9 Nov 2002 05:26:15 -0000 1.6 *************** *** 108,112 **** def settrace_and_return(tracefunc): _settrace_and_return(tracefunc) ! settrace_and_return.events = [(1, 'return')] --- 108,112 ---- def settrace_and_return(tracefunc): _settrace_and_return(tracefunc) ! settrace_and_return.events = [(1, 'return')] *************** *** 120,124 **** except RuntimeError, exc: pass ! settrace_and_raise.events = [(2, 'exception'), (3, 'line'), --- 120,124 ---- except RuntimeError, exc: pass ! settrace_and_raise.events = [(2, 'exception'), (3, 'line'), *************** *** 135,139 **** class TraceTestCase(unittest.TestCase): def compare_events(self, line_offset, events, expected_events): ! events = [(l - line_offset, e) for (l, e) in events] if events != expected_events: self.fail( --- 135,139 ---- class TraceTestCase(unittest.TestCase): def compare_events(self, line_offset, events, expected_events): ! events = [(l - line_offset, e) for (l, e) in events] if events != expected_events: self.fail( *************** *** 141,146 **** "\n".join(difflib.ndiff(map(str, expected_events), map(str, events)))) ! ! def run_test(self, func): tracer = Tracer() --- 141,146 ---- "\n".join(difflib.ndiff(map(str, expected_events), map(str, events)))) ! ! def run_test(self, func): tracer = Tracer() *************** *** 157,161 **** self.compare_events(func.func_code.co_firstlineno, tracer.events, func.events) ! def test_1_basic(self): self.run_test(basic) --- 157,161 ---- self.compare_events(func.func_code.co_firstlineno, tracer.events, func.events) ! def test_1_basic(self): self.run_test(basic) *************** *** 186,190 **** else: return self.trace ! def f(self): """The function to trace; raises an exception if that's the case --- 186,190 ---- else: return self.trace ! def f(self): """The function to trace; raises an exception if that's the case *************** *** 195,199 **** else: return 1 ! def run_test_for_event(self, event): """Tests that an exception raised in response to the given event is --- 195,199 ---- else: return 1 ! def run_test_for_event(self, event): """Tests that an exception raised in response to the given event is *************** *** 211,215 **** except RuntimeError: self.fail("recursion counter not reset") ! # Test the handling of exceptions raised by each kind of trace event. def test_call(self): --- 211,215 ---- except RuntimeError: self.fail("recursion counter not reset") ! # Test the handling of exceptions raised by each kind of trace event. def test_call(self): From tim_one@users.sourceforge.net Sat Nov 9 06:31:58 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 22:31:58 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_bz2.py,1.5,1.6 Message-ID: <E18AP9y-0000BE-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv32717/Lib/test Modified Files: test_bz2.py Log Message: Many changes to get this to pass on Windows, and to make it easier to figure out what the code was doing. The fixes were a combination of closing open files before deletion, opening files in binary mode, and plain skipping things that can't work on Windows (BaseTest.decompress uses a process gimmick that doesn't exist on Windows, and, even if it did, assumes a "bunzip2" executable is on PATH). Index: test_bz2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bz2.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_bz2.py 9 Nov 2002 05:26:14 -0000 1.5 --- test_bz2.py 9 Nov 2002 06:31:56 -0000 1.6 *************** *** 1,3 **** --- 1,5 ---- #!/usr/bin/python + from test import test_support + import unittest from cStringIO import StringIO *************** *** 5,10 **** import popen2 import tempfile ! from bz2 import * ! from test import test_support class BaseTest(unittest.TestCase): --- 7,14 ---- import popen2 import tempfile ! import sys ! ! import bz2 ! from bz2 import BZ2File, BZ2Compressor, BZ2Decompressor class BaseTest(unittest.TestCase): *************** *** 14,18 **** --- 18,28 ---- DATA_CRLF = 'BZh91AY&SY\xaez\xbbN\x00\x01H\xdf\x80\x00\x12@\x02\xff\xf0\x01\x07n\x00?\xe7\xff\xe0@\x01\xbc\xc6`\x86*\x8d=M\xa9\x9a\x86\xd0L@\x0fI\xa6!\xa1\x13\xc8\x88jdi\x8d@\x03@\x1a\x1a\x0c\x0c\x83 \x00\xc4h2\x19\x01\x82D\x84e\t\xe8\x99\x89\x19\x1ah\x00\r\x1a\x11\xaf\x9b\x0fG\xf5(\x1b\x1f?\t\x12\xcf\xb5\xfc\x95E\x00ps\x89\x12^\xa4\xdd\xa2&\x05(\x87\x04\x98\x89u\xe40%\xb6\x19\'\x8c\xc4\x89\xca\x07\x0e\x1b!\x91UIFU%C\x994!DI\xd2\xfa\xf0\xf1N8W\xde\x13A\xf5\x9cr%?\x9f3;I45A\xd1\x8bT\xb1<l\xba\xcb_\xc00xY\x17r\x17\x88\x08\x08@\xa0\ry@\x10\x04$)`\xf2\xce\x89z\xb0s\xec\x9b.iW\x9d\x81\xb5-+t\x9f\x1a\'\x97dB\xf5x\xb5\xbe.[.\xd7\x0e\x81\xe7\x08\x1cN`\x88\x10\xca\x87\xc3!"\x80\x92R\xa1/\xd1\xc0\xe6mf\xac\xbd\x99\xcca\xb3\x8780>\xa4\xc7\x8d\x1a\\"\xad\xa1\xabyBg\x15\xb9l\x88\x88\x91k"\x94\xa4\xd4\x89\xae*\xa6\x0b\x10\x0c\xd6\xd4m\xe86\xec\xb5j\x8a\x86j\';\xca.\x01I\xf2\xaaJ\xe8\x88\x8cU+t3\xfb\x0c\n\xa33\x13r2\r\x16\xe0\xb3(\xbf\x1d\x83r\xe7M\xf0D\x1365\xd8\x88\xd3\xa4\x92\xcb2\x06\x04\\\xc1\xb0\xea//\xbek&\xd8\xe6+t\xe5\xa1\x13\xada\x16\xder5"w]\xa2i\xb7[\x97R \xe2IT\xcd;Z\x04dk4\xad\x8a\t\xd3\x81z\x10\xf1:^`\xab\x1f\xc5\xdc\x91N\x14$+\x9e\xae\xd3\x80' + # XXX BaseTest.decompress can't run on Windows -- popen2.Popen3 doesn't + # XXX exist there, XXX and even if it did, bunzip2 isn't available to + # XXX run. Tests using this are therefore skipped on Windows. + skip_decompress_tests = sys.platform in ("win32",) + def decompress(self, data): + assert not self.skip_decompress_tests pop = popen2.Popen3("bunzip2", capturestderr=1) pop.tochild.write(data) *************** *** 21,25 **** pop.fromchild.close() if pop.wait() != 0: ! ret = decompress(data) return ret --- 31,38 ---- pop.fromchild.close() if pop.wait() != 0: ! # XXX I don't think this works. On Windows, trying to call ! # XXX bz2.decompress in this function always raises ! # XXD ValueError: couldn't find end of stream ! ret = bz2.decompress(data) return ret *************** *** 120,123 **** --- 133,138 ---- def testWrite(self): + if self.skip_decompress_tests: + return # "Test BZ2File.write()" bz2f = BZ2File(self.filename, "w") *************** *** 130,133 **** --- 145,150 ---- def testWriteChunks10(self): # "Test BZ2File.write() with chunks of 10 bytes" + if self.skip_decompress_tests: + return bz2f = BZ2File(self.filename, "w") n = 0 *************** *** 145,148 **** --- 162,167 ---- def testWriteLines(self): # "Test BZ2File.writelines()" + if self.skip_decompress_tests: + return bz2f = BZ2File(self.filename, "w") sio = StringIO(self.TEXT) *************** *** 159,162 **** --- 178,182 ---- bz2f.seek(150) self.assertEqual(bz2f.read(), self.TEXT[150:]) + bz2f.close() def testSeekBackwards(self): *************** *** 167,170 **** --- 187,191 ---- bz2f.seek(-150, 1) self.assertEqual(bz2f.read(), self.TEXT[500-150:]) + bz2f.close() def testSeekBackwardsFromEnd(self): *************** *** 174,177 **** --- 195,199 ---- bz2f.seek(-150, 2) self.assertEqual(bz2f.read(), self.TEXT[len(self.TEXT)-150:]) + bz2f.close() def testSeekPostEnd(self): *************** *** 182,185 **** --- 204,208 ---- self.assertEqual(bz2f.tell(), len(self.TEXT)) self.assertEqual(bz2f.read(), "") + bz2f.close() def testSeekPostEndTwice(self): *************** *** 191,194 **** --- 214,218 ---- self.assertEqual(bz2f.tell(), len(self.TEXT)) self.assertEqual(bz2f.read(), "") + bz2f.close() def testSeekPreStart(self): *************** *** 199,206 **** --- 223,233 ---- self.assertEqual(bz2f.tell(), 0) self.assertEqual(bz2f.read(), self.TEXT) + bz2f.close() class BZ2CompressorTest(BaseTest): def testCompress(self): # "Test BZ2Compressor.compress()/flush()" + if self.skip_decompress_tests: + return bz2c = BZ2Compressor() data = bz2c.compress(self.TEXT) *************** *** 210,213 **** --- 237,242 ---- def testCompressChunks10(self): # "Test BZ2Compressor.compress()/flush() with chunks of 10 bytes" + if self.skip_decompress_tests: + return bz2c = BZ2Compressor() n = 0 *************** *** 262,287 **** def testCompress(self): # "Test compress() function" ! data = compress(self.TEXT) self.assertEqual(self.decompress(data), self.TEXT) def testDecompress(self): # "Test decompress() function" ! text = decompress(self.DATA) self.assertEqual(text, self.TEXT) def testDecompressEmpty(self): # "Test decompress() function with empty string" ! text = decompress("") self.assertEqual(text, "") def testDecompressIncomplete(self): # "Test decompress() function with incomplete data" ! self.assertRaises(ValueError, decompress, self.DATA[:-10]) def test_main(): ! test_support.run_unittest(BZ2FileTest) ! test_support.run_unittest(BZ2CompressorTest) ! test_support.run_unittest(BZ2DecompressorTest) ! test_support.run_unittest(FuncTest) if __name__ == '__main__': --- 291,321 ---- def testCompress(self): # "Test compress() function" ! if self.skip_decompress_tests: ! return ! data = bz2.compress(self.TEXT) self.assertEqual(self.decompress(data), self.TEXT) def testDecompress(self): # "Test decompress() function" ! text = bz2.decompress(self.DATA) self.assertEqual(text, self.TEXT) def testDecompressEmpty(self): # "Test decompress() function with empty string" ! text = bz2.decompress("") self.assertEqual(text, "") def testDecompressIncomplete(self): # "Test decompress() function with incomplete data" ! self.assertRaises(ValueError, bz2.decompress, self.DATA[:-10]) def test_main(): ! suite = unittest.TestSuite() ! for test in (BZ2FileTest, ! BZ2CompressorTest, ! BZ2DecompressorTest, ! FuncTest): ! suite.addTest(unittest.makeSuite(test)) ! test_support.run_suite(suite) if __name__ == '__main__': From tim_one@users.sourceforge.net Sat Nov 9 06:45:33 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 22:45:33 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_bz2.py,1.6,1.7 Message-ID: <E18APN7-0000nW-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2850/Lib/test Modified Files: test_bz2.py Log Message: More tests run on Windows now. Something is still wrong here, but no idea what. Added liberal XXX explanations for the next guy. Index: test_bz2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bz2.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_bz2.py 9 Nov 2002 06:31:56 -0000 1.6 --- test_bz2.py 9 Nov 2002 06:45:31 -0000 1.7 *************** *** 12,15 **** --- 12,17 ---- from bz2 import BZ2File, BZ2Compressor, BZ2Decompressor + has_cmdline_bunzip2 = sys.platform not in ("win32",) + class BaseTest(unittest.TestCase): "Base for other testcases." *************** *** 18,39 **** DATA_CRLF = 'BZh91AY&SY\xaez\xbbN\x00\x01H\xdf\x80\x00\x12@\x02\xff\xf0\x01\x07n\x00?\xe7\xff\xe0@\x01\xbc\xc6`\x86*\x8d=M\xa9\x9a\x86\xd0L@\x0fI\xa6!\xa1\x13\xc8\x88jdi\x8d@\x03@\x1a\x1a\x0c\x0c\x83 \x00\xc4h2\x19\x01\x82D\x84e\t\xe8\x99\x89\x19\x1ah\x00\r\x1a\x11\xaf\x9b\x0fG\xf5(\x1b\x1f?\t\x12\xcf\xb5\xfc\x95E\x00ps\x89\x12^\xa4\xdd\xa2&\x05(\x87\x04\x98\x89u\xe40%\xb6\x19\'\x8c\xc4\x89\xca\x07\x0e\x1b!\x91UIFU%C\x994!DI\xd2\xfa\xf0\xf1N8W\xde\x13A\xf5\x9cr%?\x9f3;I45A\xd1\x8bT\xb1<l\xba\xcb_\xc00xY\x17r\x17\x88\x08\x08@\xa0\ry@\x10\x04$)`\xf2\xce\x89z\xb0s\xec\x9b.iW\x9d\x81\xb5-+t\x9f\x1a\'\x97dB\xf5x\xb5\xbe.[.\xd7\x0e\x81\xe7\x08\x1cN`\x88\x10\xca\x87\xc3!"\x80\x92R\xa1/\xd1\xc0\xe6mf\xac\xbd\x99\xcca\xb3\x8780>\xa4\xc7\x8d\x1a\\"\xad\xa1\xabyBg\x15\xb9l\x88\x88\x91k"\x94\xa4\xd4\x89\xae*\xa6\x0b\x10\x0c\xd6\xd4m\xe86\xec\xb5j\x8a\x86j\';\xca.\x01I\xf2\xaaJ\xe8\x88\x8cU+t3\xfb\x0c\n\xa33\x13r2\r\x16\xe0\xb3(\xbf\x1d\x83r\xe7M\xf0D\x1365\xd8\x88\xd3\xa4\x92\xcb2\x06\x04\\\xc1\xb0\xea//\xbek&\xd8\xe6+t\xe5\xa1\x13\xada\x16\xder5"w]\xa2i\xb7[\x97R \xe2IT\xcd;Z\x04dk4\xad\x8a\t\xd3\x81z\x10\xf1:^`\xab\x1f\xc5\xdc\x91N\x14$+\x9e\xae\xd3\x80' ! # XXX BaseTest.decompress can't run on Windows -- popen2.Popen3 doesn't ! # XXX exist there, XXX and even if it did, bunzip2 isn't available to ! # XXX run. Tests using this are therefore skipped on Windows. ! skip_decompress_tests = sys.platform in ("win32",) ! def decompress(self, data): ! assert not self.skip_decompress_tests ! pop = popen2.Popen3("bunzip2", capturestderr=1) ! pop.tochild.write(data) ! pop.tochild.close() ! ret = pop.fromchild.read() ! pop.fromchild.close() ! if pop.wait() != 0: ! # XXX I don't think this works. On Windows, trying to call ! # XXX bz2.decompress in this function always raises ! # XXD ValueError: couldn't find end of stream ! ret = bz2.decompress(data) ! return ret class BZ2FileTest(BaseTest): --- 20,52 ---- DATA_CRLF = 'BZh91AY&SY\xaez\xbbN\x00\x01H\xdf\x80\x00\x12@\x02\xff\xf0\x01\x07n\x00?\xe7\xff\xe0@\x01\xbc\xc6`\x86*\x8d=M\xa9\x9a\x86\xd0L@\x0fI\xa6!\xa1\x13\xc8\x88jdi\x8d@\x03@\x1a\x1a\x0c\x0c\x83 \x00\xc4h2\x19\x01\x82D\x84e\t\xe8\x99\x89\x19\x1ah\x00\r\x1a\x11\xaf\x9b\x0fG\xf5(\x1b\x1f?\t\x12\xcf\xb5\xfc\x95E\x00ps\x89\x12^\xa4\xdd\xa2&\x05(\x87\x04\x98\x89u\xe40%\xb6\x19\'\x8c\xc4\x89\xca\x07\x0e\x1b!\x91UIFU%C\x994!DI\xd2\xfa\xf0\xf1N8W\xde\x13A\xf5\x9cr%?\x9f3;I45A\xd1\x8bT\xb1<l\xba\xcb_\xc00xY\x17r\x17\x88\x08\x08@\xa0\ry@\x10\x04$)`\xf2\xce\x89z\xb0s\xec\x9b.iW\x9d\x81\xb5-+t\x9f\x1a\'\x97dB\xf5x\xb5\xbe.[.\xd7\x0e\x81\xe7\x08\x1cN`\x88\x10\xca\x87\xc3!"\x80\x92R\xa1/\xd1\xc0\xe6mf\xac\xbd\x99\xcca\xb3\x8780>\xa4\xc7\x8d\x1a\\"\xad\xa1\xabyBg\x15\xb9l\x88\x88\x91k"\x94\xa4\xd4\x89\xae*\xa6\x0b\x10\x0c\xd6\xd4m\xe86\xec\xb5j\x8a\x86j\';\xca.\x01I\xf2\xaaJ\xe8\x88\x8cU+t3\xfb\x0c\n\xa33\x13r2\r\x16\xe0\xb3(\xbf\x1d\x83r\xe7M\xf0D\x1365\xd8\x88\xd3\xa4\x92\xcb2\x06\x04\\\xc1\xb0\xea//\xbek&\xd8\xe6+t\xe5\xa1\x13\xada\x16\xder5"w]\xa2i\xb7[\x97R \xe2IT\xcd;Z\x04dk4\xad\x8a\t\xd3\x81z\x10\xf1:^`\xab\x1f\xc5\xdc\x91N\x14$+\x9e\xae\xd3\x80' ! if has_cmdline_bunzip2: ! def decompress(self, data): ! pop = popen2.Popen3("bunzip2", capturestderr=1) ! pop.tochild.write(data) ! pop.tochild.close() ! ret = pop.fromchild.read() ! pop.fromchild.close() ! if pop.wait() != 0: ! ret = bz2.decompress(data) ! return ret ! else: ! # popen2.Popen3 doesn't exist on Windows, and even if it did, bunzip2 ! # isn't available to run. ! ! # XXX This alternative doesn't work in all tests. It raises ! # XXX ValueError: couldn't find end of stream ! # XXX in ! # XXX testWrite ! # XXX testWriteChunks10 ! # XXX testWriteLines ! # XXX from BZ2FileTest . ! # XXX I don't know why. ! ! def decompress(self, data): ! return bz2.decompress(data) ! ! # XXX See XXX comment above. ! skip_mystery_test = not has_cmdline_bunzip2 class BZ2FileTest(BaseTest): *************** *** 133,137 **** def testWrite(self): ! if self.skip_decompress_tests: return # "Test BZ2File.write()" --- 146,150 ---- def testWrite(self): ! if self.skip_mystery_test: return # "Test BZ2File.write()" *************** *** 145,149 **** def testWriteChunks10(self): # "Test BZ2File.write() with chunks of 10 bytes" ! if self.skip_decompress_tests: return bz2f = BZ2File(self.filename, "w") --- 158,162 ---- def testWriteChunks10(self): # "Test BZ2File.write() with chunks of 10 bytes" ! if self.skip_mystery_test: return bz2f = BZ2File(self.filename, "w") *************** *** 162,166 **** def testWriteLines(self): # "Test BZ2File.writelines()" ! if self.skip_decompress_tests: return bz2f = BZ2File(self.filename, "w") --- 175,179 ---- def testWriteLines(self): # "Test BZ2File.writelines()" ! if self.skip_mystery_test: return bz2f = BZ2File(self.filename, "w") *************** *** 228,233 **** def testCompress(self): # "Test BZ2Compressor.compress()/flush()" - if self.skip_decompress_tests: - return bz2c = BZ2Compressor() data = bz2c.compress(self.TEXT) --- 241,244 ---- *************** *** 237,242 **** def testCompressChunks10(self): # "Test BZ2Compressor.compress()/flush() with chunks of 10 bytes" - if self.skip_decompress_tests: - return bz2c = BZ2Compressor() n = 0 --- 248,251 ---- *************** *** 291,296 **** def testCompress(self): # "Test compress() function" - if self.skip_decompress_tests: - return data = bz2.compress(self.TEXT) self.assertEqual(self.decompress(data), self.TEXT) --- 300,303 ---- From tim_one@users.sourceforge.net Sat Nov 9 06:49:45 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 22:49:45 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_bz2.py,1.7,1.8 Message-ID: <E18APRB-0000zD-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv3652a/Lib/test Modified Files: test_bz2.py Log Message: OK -- all tests pass on Windows now. The rest were due to 3 more binary-vs-text-mode screwups. Index: test_bz2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bz2.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_bz2.py 9 Nov 2002 06:45:31 -0000 1.7 --- test_bz2.py 9 Nov 2002 06:49:43 -0000 1.8 *************** *** 34,53 **** # popen2.Popen3 doesn't exist on Windows, and even if it did, bunzip2 # isn't available to run. - - # XXX This alternative doesn't work in all tests. It raises - # XXX ValueError: couldn't find end of stream - # XXX in - # XXX testWrite - # XXX testWriteChunks10 - # XXX testWriteLines - # XXX from BZ2FileTest . - # XXX I don't know why. - def decompress(self, data): return bz2.decompress(data) - # XXX See XXX comment above. - skip_mystery_test = not has_cmdline_bunzip2 - class BZ2FileTest(BaseTest): "Test MCRYPT type miscelaneous methods." --- 34,40 ---- *************** *** 146,156 **** def testWrite(self): ! if self.skip_mystery_test: ! return # "Test BZ2File.write()" bz2f = BZ2File(self.filename, "w") bz2f.write(self.TEXT) bz2f.close() ! f = open(self.filename) self.assertEqual(self.decompress(f.read()), self.TEXT) f.close() --- 133,143 ---- def testWrite(self): ! #if self.skip_mystery_test: ! # return # "Test BZ2File.write()" bz2f = BZ2File(self.filename, "w") bz2f.write(self.TEXT) bz2f.close() ! f = open(self.filename, 'rb') self.assertEqual(self.decompress(f.read()), self.TEXT) f.close() *************** *** 158,163 **** def testWriteChunks10(self): # "Test BZ2File.write() with chunks of 10 bytes" - if self.skip_mystery_test: - return bz2f = BZ2File(self.filename, "w") n = 0 --- 145,148 ---- *************** *** 169,173 **** n += 1 bz2f.close() ! f = open(self.filename) self.assertEqual(self.decompress(f.read()), self.TEXT) f.close() --- 154,158 ---- n += 1 bz2f.close() ! f = open(self.filename, 'rb') self.assertEqual(self.decompress(f.read()), self.TEXT) f.close() *************** *** 175,185 **** def testWriteLines(self): # "Test BZ2File.writelines()" - if self.skip_mystery_test: - return bz2f = BZ2File(self.filename, "w") sio = StringIO(self.TEXT) bz2f.writelines(sio.readlines()) bz2f.close() ! f = open(self.filename) self.assertEqual(self.decompress(f.read()), self.TEXT) f.close() --- 160,168 ---- def testWriteLines(self): # "Test BZ2File.writelines()" bz2f = BZ2File(self.filename, "w") sio = StringIO(self.TEXT) bz2f.writelines(sio.readlines()) bz2f.close() ! f = open(self.filename, 'rb') self.assertEqual(self.decompress(f.read()), self.TEXT) f.close() From tim_one@users.sourceforge.net Sat Nov 9 06:51:32 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 08 Nov 2002 22:51:32 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_bz2.py,1.8,1.9 Message-ID: <E18APSu-00014F-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv4067/Lib/test Modified Files: test_bz2.py Log Message: I already forgot what I changed -- it wasn't important <wink>. Index: test_bz2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bz2.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_bz2.py 9 Nov 2002 06:49:43 -0000 1.8 --- test_bz2.py 9 Nov 2002 06:51:30 -0000 1.9 *************** *** 133,138 **** def testWrite(self): - #if self.skip_mystery_test: - # return # "Test BZ2File.write()" bz2f = BZ2File(self.filename, "w") --- 133,136 ---- From tim_one@users.sourceforge.net Sat Nov 9 08:25:00 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 09 Nov 2002 00:25:00 -0800 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.103,1.104 Message-ID: <E18AQvM-0005E7-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv20024/python/PCbuild Modified Files: python20.wse Log Message: Install the bz2 DLL on Windows. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** python20.wse 23 Jul 2002 19:56:30 -0000 1.103 --- python20.wse 9 Nov 2002 08:24:58 -0000 1.104 *************** *** 1721,1724 **** --- 1721,1729 ---- end item: Install File + Source=.\bz2.pyd + Destination=%MAINDIR%\DLLs\bz2.pyd + Flags=0000000000000010 + end + item: Install File Source=.\mmap.pyd Destination=%MAINDIR%\DLLs\mmap.pyd *************** *** 1795,1798 **** --- 1800,1808 ---- Source=.\bsddb.lib Destination=%MAINDIR%\libs\bsddb.lib + Flags=0000000000000010 + end + item: Install File + Source=.\bz2.lib + Destination=%MAINDIR%\libs\bz2.lib Flags=0000000000000010 end From mwh@users.sourceforge.net Sat Nov 9 14:47:20 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Sat, 09 Nov 2002 06:47:20 -0800 Subject: [Python-checkins] python/dist/src/Python mactoolboxglue.c,1.12,1.13 Message-ID: <E18AWtM-0000cW-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv2207 Modified Files: mactoolboxglue.c Log Message: Restore to ANSI C. Index: mactoolboxglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/mactoolboxglue.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** mactoolboxglue.c 7 Nov 2002 23:07:03 -0000 1.12 --- mactoolboxglue.c 9 Nov 2002 14:47:18 -0000 1.13 *************** *** 91,96 **** ** this only once. */ - errors_loaded = 1; PyObject *m, *rv; m = PyImport_ImportModule("macresource"); --- 91,96 ---- ** this only once. */ PyObject *m, *rv; + errors_loaded = 1; m = PyImport_ImportModule("macresource"); *************** *** 604,606 **** GLUE_NEW(CFURLRef, CFURLRefObj_New, "Carbon.CF") ! #endif /* USE_TOOLBOX_OBJECT_GLUE */ \ No newline at end of file --- 604,606 ---- GLUE_NEW(CFURLRef, CFURLRefObj_New, "Carbon.CF") ! #endif /* USE_TOOLBOX_OBJECT_GLUE */ From loewis@users.sourceforge.net Sat Nov 9 19:01:47 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 09 Nov 2002 11:01:47 -0800 Subject: [Python-checkins] python/dist/src/Lib/lib-tk FixTk.py,1.6,1.7 Message-ID: <E18Aarb-00017C-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv3744 Modified Files: FixTk.py Log Message: Search for tix subdirectories. Fixes #564729. Will backport to 2.2. Index: FixTk.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/FixTk.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FixTk.py 24 Feb 2002 16:51:45 -0000 1.6 --- FixTk.py 9 Nov 2002 19:01:44 -0000 1.7 *************** *** 20,32 **** if os.path.isdir(tcldir): os.environ["TCL_LIBRARY"] = tcldir ! # Now set the other variables accordingly import _tkinter ver = str(_tkinter.TCL_VERSION) ! for t in "tk", "tix": ! key = t.upper() + "_LIBRARY" ! try: ! v = os.environ[key] ! except KeyError: ! v = os.path.join(sys.prefix, "tcl", t+ver) ! if os.path.exists(os.path.join(v, "tclIndex")): ! os.environ[key] = v --- 20,37 ---- if os.path.isdir(tcldir): os.environ["TCL_LIBRARY"] = tcldir ! # Compute TK_LIBRARY, knowing that it has the same version ! # as Tcl import _tkinter ver = str(_tkinter.TCL_VERSION) ! if not os.environ.has_key("TK_LIBRARY"): ! v = os.path.join(prefix, 'tk'+ver) ! if os.path.exists(os.path.join(v, "tclIndex")): ! os.environ['TK_LIBRARY'] = v ! # We don't know the Tix version, so we must search the entire ! # directory ! if not os.environ.has_key("TIX_LIBRARY"): ! for name in os.listdir(prefix): ! if name.startswith("tix"): ! tixdir = os.path.join(prefix,name) ! if os.path.isdir(tixdir): ! os.environ["TIX_LIBRARY"] = tixdir From loewis@users.sourceforge.net Sat Nov 9 19:02:36 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 09 Nov 2002 11:02:36 -0800 Subject: [Python-checkins] python/dist/src/Lib/lib-tk FixTk.py,1.5.10.1,1.5.10.2 Message-ID: <E18AasO-0001HI-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv4563 Modified Files: Tag: release22-maint FixTk.py Log Message: Search for tix subdirectories. Fixes #564729. Index: FixTk.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/FixTk.py,v retrieving revision 1.5.10.1 retrieving revision 1.5.10.2 diff -C2 -d -r1.5.10.1 -r1.5.10.2 *** FixTk.py 25 Feb 2002 10:56:25 -0000 1.5.10.1 --- FixTk.py 9 Nov 2002 19:02:34 -0000 1.5.10.2 *************** *** 20,32 **** if os.path.isdir(tcldir): os.environ["TCL_LIBRARY"] = tcldir ! # Now set the other variables accordingly import _tkinter ver = str(_tkinter.TCL_VERSION) ! for t in "tk", "tix": ! key = t.upper() + "_LIBRARY" ! try: ! v = os.environ[key] ! except KeyError: ! v = os.path.join(sys.prefix, "tcl", t+ver) ! if os.path.exists(os.path.join(v, "tclIndex")): ! os.environ[key] = v --- 20,37 ---- if os.path.isdir(tcldir): os.environ["TCL_LIBRARY"] = tcldir ! # Compute TK_LIBRARY, knowing that it has the same version ! # as Tcl import _tkinter ver = str(_tkinter.TCL_VERSION) ! if not os.environ.has_key("TK_LIBRARY"): ! v = os.path.join(prefix, 'tk'+ver) ! if os.path.exists(os.path.join(v, "tclIndex")): ! os.environ['TK_LIBRARY'] = v ! # We don't know the Tix version, so we must search the entire ! # directory ! if not os.environ.has_key("TIX_LIBRARY"): ! for name in os.listdir(prefix): ! if name.startswith("tix"): ! tixdir = os.path.join(prefix,name) ! if os.path.isdir(tixdir): ! os.environ["TIX_LIBRARY"] = tixdir From loewis@users.sourceforge.net Sat Nov 9 19:53:06 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 09 Nov 2002 11:53:06 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.114,1.115 Message-ID: <E18AbfG-0004ZR-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv17345 Modified Files: setup.py Log Message: Look in db4 directories when checking for db4. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -d -r1.114 -r1.115 *** setup.py 8 Nov 2002 13:11:50 -0000 1.114 --- setup.py 9 Nov 2002 19:53:04 -0000 1.115 *************** *** 456,463 **** '/usr/local/BerkeleyDB.4.1/include', '/usr/local/BerkeleyDB.4.0/include', ! '/usr/local/include/db3', ! '/opt/sfw/include/db3', ! '/sw/include/db3', ! '/usr/include/db3', ), 'incs': ('db_185.h',)}, --- 456,463 ---- '/usr/local/BerkeleyDB.4.1/include', '/usr/local/BerkeleyDB.4.0/include', ! '/usr/local/include/db4', ! '/opt/sfw/include/db4', ! '/sw/include/db4', ! '/usr/include/db4', ), 'incs': ('db_185.h',)}, From loewis@users.sourceforge.net Sat Nov 9 19:54:08 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 09 Nov 2002 11:54:08 -0800 Subject: [Python-checkins] python/dist/src/Modules gcmodule.c,2.55,2.56 Message-ID: <E18AbgG-0004qt-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv18496 Modified Files: gcmodule.c Log Message: Fix typo. Index: gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.55 retrieving revision 2.56 diff -C2 -d -r2.55 -r2.56 *** gcmodule.c 9 Aug 2002 17:39:14 -0000 2.55 --- gcmodule.c 9 Nov 2002 19:54:06 -0000 2.56 *************** *** 97,101 **** times an object is referenced directly from outside the generation being collected. ! gc_refs reamins >= 0 throughout these steps. GC_TENTATIVELY_UNREACHABLE --- 97,101 ---- times an object is referenced directly from outside the generation being collected. ! gc_refs remains >= 0 throughout these steps. GC_TENTATIVELY_UNREACHABLE From loewis@users.sourceforge.net Sat Nov 9 19:57:28 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 09 Nov 2002 11:57:28 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_support.py,1.45,1.46 Message-ID: <E18AbjU-0005ag-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21042 Modified Files: test_support.py Log Message: Don't try to convert the test filename to Unicode with -U. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** test_support.py 9 Nov 2002 05:26:15 -0000 1.45 --- test_support.py 9 Nov 2002 19:57:26 -0000 1.46 *************** *** 93,97 **** # Unicode name only used if TEST_FN_ENCODING exists for the platform. if have_unicode: ! TESTFN_UNICODE=unicode("@test-\xe0\xf2", "latin-1") # 2 latin characters. if os.name=="nt": TESTFN_ENCODING="mbcs" --- 93,102 ---- # Unicode name only used if TEST_FN_ENCODING exists for the platform. if have_unicode: ! if isinstance('', unicode): ! # python -U ! # XXX perhaps unicode() should accept Unicode strings? ! TESTFN_UNICODE="@test-\xe0\xf2" ! else: ! TESTFN_UNICODE=unicode("@test-\xe0\xf2", "latin-1") # 2 latin characters. if os.name=="nt": TESTFN_ENCODING="mbcs" From loewis@users.sourceforge.net Sat Nov 9 20:19:15 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 09 Nov 2002 12:19:15 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test___future__.py,1.5,1.6 Message-ID: <E18Ac4Z-0003Li-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12475 Modified Files: test___future__.py Log Message: Allow both string and Unicode objects in levels. Index: test___future__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___future__.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test___future__.py 23 Jul 2002 19:03:43 -0000 1.5 --- test___future__.py 9 Nov 2002 20:19:12 -0000 1.6 *************** *** 34,38 **** verify(type(minor) is IntType, "optional minor isn't int") verify(type(micro) is IntType, "optional micro isn't int") ! verify(type(level) is StringType, "optional level isn't string") verify(level in GOOD_SERIALS, "optional level string has unknown value") --- 34,38 ---- verify(type(minor) is IntType, "optional minor isn't int") verify(type(micro) is IntType, "optional micro isn't int") ! verify(isinstance(level, basestring), "optional level isn't string") verify(level in GOOD_SERIALS, "optional level string has unknown value") *************** *** 47,51 **** verify(type(minor) is IntType, "mandatory minor isn't int") verify(type(micro) is IntType, "mandatory micro isn't int") ! verify(type(level) is StringType, "mandatory level isn't string") verify(level in GOOD_SERIALS, "mandatory serial string has unknown value") --- 47,51 ---- verify(type(minor) is IntType, "mandatory minor isn't int") verify(type(micro) is IntType, "mandatory micro isn't int") ! verify(isinstance(level, basestring), "mandatory level isn't string") verify(level in GOOD_SERIALS, "mandatory serial string has unknown value") From goodger@users.sourceforge.net Sat Nov 9 21:02:25 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat, 09 Nov 2002 13:02:25 -0800 Subject: [Python-checkins] python/nondist/peps pep-0287.txt,1.5,1.6 Message-ID: <E18AckL-00055e-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv19509 Modified Files: pep-0287.txt Log Message: typo caught by GvR Index: pep-0287.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0287.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0287.txt 8 Nov 2002 04:26:56 -0000 1.5 --- pep-0287.txt 9 Nov 2002 21:02:21 -0000 1.6 *************** *** 26,30 **** Only the low-level syntax of docstrings is addressed here. This PEP is not concerned with docstring semantics or processing at all (see ! PEP 256 for a "Road Map to the Doctring PEPs"). Nor is it an attempt to deprecate pure plaintext docstrings, which are always going to be legitimate. The reStructuredText markup is an alternative for those --- 26,30 ---- Only the low-level syntax of docstrings is addressed here. This PEP is not concerned with docstring semantics or processing at all (see ! PEP 256 for a "Road Map to the Docstring PEPs"). Nor is it an attempt to deprecate pure plaintext docstrings, which are always going to be legitimate. The reStructuredText markup is an alternative for those From nnorwitz@users.sourceforge.net Sun Nov 10 14:33:28 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 10 Nov 2002 06:33:28 -0800 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.85,2.86 Message-ID: <E18At9U-0003wO-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv15020/Modules Modified Files: _sre.c Log Message: Make private functions static so we don't pollute the namespace Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.85 retrieving revision 2.86 diff -C2 -d -r2.85 -r2.86 *** _sre.c 7 Nov 2002 03:28:56 -0000 2.85 --- _sre.c 10 Nov 2002 14:33:25 -0000 2.86 *************** *** 354,358 **** } ! void lastmark_restore(SRE_STATE *state, int lastmark) { if (state->lastmark > lastmark) { --- 354,359 ---- } ! static void ! lastmark_restore(SRE_STATE *state, int lastmark) { if (state->lastmark > lastmark) { From nnorwitz@users.sourceforge.net Sun Nov 10 14:33:29 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 10 Nov 2002 06:33:29 -0800 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.341,2.342 Message-ID: <E18At9V-0003wT-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv15020/Python Modified Files: ceval.c Log Message: Make private functions static so we don't pollute the namespace Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.341 retrieving revision 2.342 diff -C2 -d -r2.341 -r2.342 *** ceval.c 8 Nov 2002 13:08:46 -0000 2.341 --- ceval.c 10 Nov 2002 14:33:26 -0000 2.342 *************** *** 3198,3202 **** #define EXT_POP(STACK_POINTER) (*--(STACK_POINTER)) ! void err_args(PyObject *func, int flags, int nargs) { --- 3198,3202 ---- #define EXT_POP(STACK_POINTER) (*--(STACK_POINTER)) ! static void err_args(PyObject *func, int flags, int nargs) { From jackjansen@users.sourceforge.net Mon Nov 11 00:05:03 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 10 Nov 2002 16:05:03 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.28,1.29 Message-ID: <E18B24d-0001zz-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv7315 Modified Files: Makefile Log Message: - Building IDE is optional on waste being available, similar to building IDLE (it was a fatal error before) - Shuffled a few things around to facilitate the experimental building of MacPython for Jaguar's pre-installed python. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Makefile 7 Nov 2002 23:07:04 -0000 1.28 --- Makefile 11 Nov 2002 00:05:00 -0000 1.29 *************** *** 14,17 **** --- 14,18 ---- PYTHONAPPSDIR=$(dstroot)/Applications/Python APPINSTALLDIR=$(prefix)/Resources/Python.app + PTHFILE=$(srcdir)/Mac/OSX/Mac.pth # Variables for installing the "normal" unix binaries *************** *** 28,41 **** LN=ln STRIPFLAG=-s ! OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \ ! -fno-common -dynamic ! INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include ! DEFINES= ! ! CFLAGS=$(OPT) $(DEFINES) $(INCLUDES) ! LDFLAGS=-F$(builddir) -framework System -framework Python -framework Carbon \ ! -framework Foundation ! CC=cc ! LD=cc CPMAC=/Developer/Tools/CpMac --- 29,42 ---- LN=ln STRIPFLAG=-s ! ##OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \ ! ## -fno-common -dynamic ! ##INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include ! ##DEFINES= ! ## ! ##CFLAGS=$(OPT) $(DEFINES) $(INCLUDES) ! ##LDFLAGS=-F$(builddir) -framework System -framework Python -framework Carbon \ ! ## -framework Foundation ! ##CC=cc ! ##LD=cc CPMAC=/Developer/Tools/CpMac *************** *** 44,47 **** --- 45,49 ---- APPSUBDIRS=MacOS Resources Resources/English.lproj CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py + compileall=$(srcdir)/Lib/compileall.py installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE install_IDLE *************** *** 95,106 **** install_IDE: $(INSTALLED_PYTHONW) ! @if $(INSTALLED_PYTHONW) -c "import waste"; then : ; else \ echo PythonIDE needs the \"waste\" extension module; \ echo See Mac/OSX/README for details; \ ! exit 1; \ fi - $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ - --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \ - $(srcdir)/Mac/Tools/IDE/PythonIDE.py install_IDLE: $(INSTALLED_PYTHONW) --- 97,111 ---- install_IDE: $(INSTALLED_PYTHONW) ! @if ! $(INSTALLED_PYTHONW) -c "import waste"; then \ echo PythonIDE needs the \"waste\" extension module; \ echo See Mac/OSX/README for details; \ ! else \ ! echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ ! --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \ ! $(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \ ! $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ ! --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \ ! $(srcdir)/Mac/Tools/IDE/PythonIDE.py; \ fi install_IDLE: $(INSTALLED_PYTHONW) *************** *** 251,263 **** done ! $(INSTALL_DATA) $(srcdir)/Mac/OSX/Mac.pth $(LIBDEST)/site-packages/ $(PYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST) ! $(PYTHON) -Wi -tt $(srcdir)/Lib/compileall.py -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST) ! $(PYTHON) -O -Wi -tt $(srcdir)/Lib/compileall.py -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST) ! ! # Put symlinks "python" and "pythonw" in the standard place ! $(INSTALLED_PYTHONW): install_Python # $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here. --- 256,270 ---- done ! $(INSTALL_DATA) $(PTHFILE) $(LIBDEST)/site-packages/ $(PYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST) ! $(PYTHON) -Wi -tt $(compileall) -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST) ! $(PYTHON) -O -Wi -tt $(compileall) -x badsyntax $(MACLIBDEST) $(MACTOOLSDEST) ! # ! # We use the full name here in stead of $(INSTALLED_PYTHONW), because ! # the latter may be overridden by Makefile.jaguar when building for a pre-installed ! # /usr/bin/python ! $(APPINSTALLDIR)/Contents/MacOS/python: install_Python # $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here. From jackjansen@users.sourceforge.net Mon Nov 11 00:06:16 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 10 Nov 2002 16:06:16 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib buildtools.py,1.19,1.20 Message-ID: <E18B25o-00025C-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7846 Modified Files: buildtools.py Log Message: - Use imp to find appletrawmain.py in stead of hand-crafting the path to it. - Allow for symlinks in the applet template. Index: buildtools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/buildtools.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** buildtools.py 7 Nov 2002 23:07:04 -0000 1.19 --- buildtools.py 11 Nov 2002 00:06:14 -0000 1.20 *************** *** 390,395 **** progress.label('Creating __rawmain__.pyc') progress.inc(0) ! rawsourcefile = os.path.join(sys.prefix, 'Mac', 'Lib', 'appletrawmain.py') ! rawsource = open(rawsourcefile, 'rU').read() rawcode = compile(rawsource, rawsourcefile, 'exec') writepycfile(rawcode, outputfilename) --- 390,395 ---- progress.label('Creating __rawmain__.pyc') progress.inc(0) ! rawsourcefp, rawsourcefile, d2 = imp.find_module('appletrawmain') ! rawsource = rawsourcefp.read() rawcode = compile(rawsource, rawsourcefile, 'exec') writepycfile(rawcode, outputfilename) *************** *** 489,492 **** --- 489,495 ---- if os.path.isdir(srcpath): os.mkdir(dstpath) + elif os.path.islink(srcpath): + endpoint = os.readlink(srcpath) + os.symlink(endpoint, dstpath) else: if progress: From loewis@users.sourceforge.net Mon Nov 11 13:23:49 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 11 Nov 2002 05:23:49 -0800 Subject: [Python-checkins] python/dist/src configure,1.353,1.354 configure.in,1.364,1.365 pyconfig.h.in,1.56,1.57 Message-ID: <E18BEXd-0002Uq-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv9356 Modified Files: configure configure.in pyconfig.h.in Log Message: Check whether we can take the address of chown, link, and symlink. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.353 retrieving revision 1.354 diff -C2 -d -r1.353 -r1.354 *** configure 7 Nov 2002 07:42:28 -0000 1.353 --- configure 11 Nov 2002 13:23:42 -0000 1.354 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.363 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.364 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 11965,11980 **** ! ! ! ! for ac_func in alarm chown chroot clock confstr ctermid ctermid_r execv \ fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \ ! hstrerror inet_pton kill killpg lchown link lstat mkfifo mknod mktime \ mremap nice pathconf pause plock poll pthread_init \ putenv readlink \ select setegid seteuid setgid setgroups \ setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \ ! sigaction siginterrupt sigrelse strftime strptime symlink \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ truncate uname unsetenv utimes waitpid _getpty getpriority --- 11965,11977 ---- ! for ac_func in alarm chown clock confstr ctermid ctermid_r execv \ fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \ ! hstrerror inet_pton kill killpg lchown lstat mkfifo mknod mktime \ mremap nice pathconf pause plock poll pthread_init \ putenv readlink \ select setegid seteuid setgid setgroups \ setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \ ! sigaction siginterrupt sigrelse strftime strptime \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ truncate uname unsetenv utimes waitpid _getpty getpriority *************** *** 12053,12056 **** --- 12050,12197 ---- done + + # For some functions, having a definition is not sufficient, since + # we want to take their address. + echo "$as_me:$LINENO: checking for chroot" >&5 + echo $ECHO_N "checking for chroot... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + #include <unistd.h> + #ifdef F77_DUMMY_MAIN + # ifdef __cplusplus + extern "C" + # endif + int F77_DUMMY_MAIN() { return 1; } + #endif + int + main () + { + void *x=chroot + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cat >>confdefs.h <<\_ACEOF + #define HAVE_CHROOT 1 + _ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 + echo "${ECHO_T}yes" >&6 + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 + + fi + rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: checking for link" >&5 + echo $ECHO_N "checking for link... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + #include <unistd.h> + #ifdef F77_DUMMY_MAIN + # ifdef __cplusplus + extern "C" + # endif + int F77_DUMMY_MAIN() { return 1; } + #endif + int + main () + { + void *x=link + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cat >>confdefs.h <<\_ACEOF + #define HAVE_LINK 1 + _ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 + echo "${ECHO_T}yes" >&6 + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 + + fi + rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: checking for symlink" >&5 + echo $ECHO_N "checking for symlink... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + #include <unistd.h> + #ifdef F77_DUMMY_MAIN + # ifdef __cplusplus + extern "C" + # endif + int F77_DUMMY_MAIN() { return 1; } + #endif + int + main () + { + void *x=symlink + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cat >>confdefs.h <<\_ACEOF + #define HAVE_SYMLINK 1 + _ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 + echo "${ECHO_T}yes" >&6 + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 + + fi + rm -f conftest.$ac_objext conftest.$ac_ext # check for openpty and forkpty Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.364 retrieving revision 1.365 diff -C2 -d -r1.364 -r1.365 *** configure.in 7 Nov 2002 07:42:30 -0000 1.364 --- configure.in 11 Nov 2002 13:23:45 -0000 1.365 *************** *** 1713,1727 **** # checks for library functions ! AC_CHECK_FUNCS(alarm chown chroot clock confstr ctermid ctermid_r execv \ fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \ ! hstrerror inet_pton kill killpg lchown link lstat mkfifo mknod mktime \ mremap nice pathconf pause plock poll pthread_init \ putenv readlink \ select setegid seteuid setgid setgroups \ setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \ ! sigaction siginterrupt sigrelse strftime strptime symlink \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ truncate uname unsetenv utimes waitpid _getpty getpriority) # check for openpty and forkpty --- 1713,1748 ---- # checks for library functions ! AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \ fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \ ! hstrerror inet_pton kill killpg lchown lstat mkfifo mknod mktime \ mremap nice pathconf pause plock poll pthread_init \ putenv readlink \ select setegid seteuid setgid setgroups \ setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \ ! sigaction siginterrupt sigrelse strftime strptime \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ truncate uname unsetenv utimes waitpid _getpty getpriority) + + # For some functions, having a definition is not sufficient, since + # we want to take their address. + AC_MSG_CHECKING(for chroot) + AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot, + AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) + ) + AC_MSG_CHECKING(for link) + AC_TRY_COMPILE([#include <unistd.h>], void *x=link, + AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) + ) + AC_MSG_CHECKING(for symlink) + AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink, + AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) + ) # check for openpty and forkpty Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** pyconfig.h.in 26 Oct 2002 13:33:00 -0000 1.56 --- pyconfig.h.in 11 Nov 2002 13:23:45 -0000 1.57 *************** *** 43,47 **** #undef HAVE_CHOWN ! /* Define to 1 if you have the `chroot' function. */ #undef HAVE_CHROOT --- 43,47 ---- #undef HAVE_CHOWN ! /* Define if you have the 'chroot' function. */ #undef HAVE_CHROOT *************** *** 236,240 **** #undef HAVE_LIMITS_H ! /* Define to 1 if you have the `link' function. */ #undef HAVE_LINK --- 236,240 ---- #undef HAVE_LIMITS_H ! /* Define if you have the 'link' function. */ #undef HAVE_LINK *************** *** 445,449 **** #undef HAVE_ST_BLOCKS ! /* Define to 1 if you have the `symlink' function. */ #undef HAVE_SYMLINK --- 445,449 ---- #undef HAVE_ST_BLOCKS ! /* Define if you have the 'symlink' function. */ #undef HAVE_SYMLINK From loewis@users.sourceforge.net Mon Nov 11 13:26:54 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 11 Nov 2002 05:26:54 -0800 Subject: [Python-checkins] python/dist/src configure,1.354,1.355 configure.in,1.365,1.366 pyconfig.h.in,1.57,1.58 Message-ID: <E18BEac-0002vo-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv11050 Modified Files: configure configure.in pyconfig.h.in Log Message: Don't define _XOPEN_SOURCE on OpenBSD 2.x and 3.[012]. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.354 retrieving revision 1.355 diff -C2 -d -r1.354 -r1.355 *** configure 11 Nov 2002 13:23:42 -0000 1.354 --- configure 11 Nov 2002 13:26:51 -0000 1.355 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.364 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.365 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 1255,1262 **** - cat >>confdefs.h <<\_ACEOF - #define _XOPEN_SOURCE 500 - _ACEOF # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires definition --- 1255,1260 ---- + define_xopen_source=yes # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires definition *************** *** 1346,1349 **** --- 1344,1371 ---- '') MACHDEP="unknown";; esac + fi + + # Some systems cannot stand _XOPEN_SOURCE being defined at all; they + # disable features if it is defined, without any means to access these + # features as extensions. For these systems, we skip the definition of + # _XOPEN_SOURCE. Before adding a system to the list to gain access to + # some feature, make sure there is no alternative way to access this + # feature. Also, when using wildcards, make sure you have verified the + # need for not defining _XOPEN_SOURCE on all systems matching the + # wildcard, and that the wildcard does not include future systems + # (which may remove their limitations). + case $ac_sys_system/$ac_sys_release in + # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, + # even though select is a POSIX function. Reported by J. Ribbens. + OpenBSD/2.* | OpenBSD/3.[012]) + define_xopen_source=no;; + esac + + if test $define_xopen_source = yes + then + cat >>confdefs.h <<\_ACEOF + #define _XOPEN_SOURCE 500 + _ACEOF + fi Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.365 retrieving revision 1.366 diff -C2 -d -r1.365 -r1.366 *** configure.in 11 Nov 2002 13:23:45 -0000 1.365 --- configure.in 11 Nov 2002 13:26:51 -0000 1.366 *************** *** 34,40 **** [/* Define on UNIX to activate XPG/5 features. */ #ifndef _XOPEN_SOURCE ! # define _XOPEN_SOURCE 500 #endif]) ! AC_DEFINE(_XOPEN_SOURCE, 500) # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires definition --- 34,41 ---- [/* Define on UNIX to activate XPG/5 features. */ #ifndef _XOPEN_SOURCE ! # undef _XOPEN_SOURCE #endif]) ! ! define_xopen_source=yes # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires definition *************** *** 112,115 **** --- 113,138 ---- '') MACHDEP="unknown";; esac + fi + + # Some systems cannot stand _XOPEN_SOURCE being defined at all; they + # disable features if it is defined, without any means to access these + # features as extensions. For these systems, we skip the definition of + # _XOPEN_SOURCE. Before adding a system to the list to gain access to + # some feature, make sure there is no alternative way to access this + # feature. Also, when using wildcards, make sure you have verified the + # need for not defining _XOPEN_SOURCE on all systems matching the + # wildcard, and that the wildcard does not include future systems + # (which may remove their limitations). + dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output + case $ac_sys_system/$ac_sys_release in + # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, + # even though select is a POSIX function. Reported by J. Ribbens. + OpenBSD/2.* | OpenBSD/3.@<:@012@:>@) + define_xopen_source=no;; + esac + + if test $define_xopen_source = yes + then + AC_DEFINE(_XOPEN_SOURCE, 500) fi Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** pyconfig.h.in 11 Nov 2002 13:23:45 -0000 1.57 --- pyconfig.h.in 11 Nov 2002 13:26:51 -0000 1.58 *************** *** 800,804 **** /* Define on UNIX to activate XPG/5 features. */ #ifndef _XOPEN_SOURCE ! # define _XOPEN_SOURCE 500 #endif --- 800,804 ---- /* Define on UNIX to activate XPG/5 features. */ #ifndef _XOPEN_SOURCE ! # undef _XOPEN_SOURCE #endif From loewis@users.sourceforge.net Mon Nov 11 13:37:31 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 11 Nov 2002 05:37:31 -0800 Subject: [Python-checkins] python/dist/src configure,1.355,1.356 configure.in,1.366,1.367 pyconfig.h.in,1.58,1.59 Message-ID: <E18BEkt-0004Pe-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv16683 Modified Files: configure configure.in pyconfig.h.in Log Message: Protect pyconfig.h from multiple inclusions. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.355 retrieving revision 1.356 diff -C2 -d -r1.355 -r1.356 *** configure 11 Nov 2002 13:26:51 -0000 1.355 --- configure 11 Nov 2002 13:37:26 -0000 1.356 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.365 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.366 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 1234,1237 **** --- 1234,1239 ---- # This is for stuff that absolutely must end up in pyconfig.h. # Please use pyport.h instead, if possible. + + Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.366 retrieving revision 1.367 diff -C2 -d -r1.366 -r1.367 *** configure.in 11 Nov 2002 13:26:51 -0000 1.366 --- configure.in 11 Nov 2002 13:37:28 -0000 1.367 *************** *** 12,15 **** --- 12,19 ---- # This is for stuff that absolutely must end up in pyconfig.h. # Please use pyport.h instead, if possible. + AH_TOP([ + #ifndef Py_PYCONFIG_H + #define Py_PYCONFIG_H + ]) AH_BOTTOM([ /* Define the macros needed if on a UnixWare 7.x system. */ *************** *** 17,20 **** --- 21,26 ---- #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ #endif + + #endif /*Py_PYCONFIG_H*/ ]) Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** pyconfig.h.in 11 Nov 2002 13:26:51 -0000 1.58 --- pyconfig.h.in 11 Nov 2002 13:37:28 -0000 1.59 *************** *** 1,4 **** --- 1,9 ---- /* pyconfig.h.in. Generated from configure.in by autoheader. */ + + #ifndef Py_PYCONFIG_H + #define Py_PYCONFIG_H + + /* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want support for AIX C++ shared extension modules. */ *************** *** 852,854 **** --- 857,861 ---- #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ #endif + + #endif /*Py_PYCONFIG_H*/ From loewis@users.sourceforge.net Mon Nov 11 14:58:49 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 11 Nov 2002 06:58:49 -0800 Subject: [Python-checkins] python/dist/src configure,1.356,1.357 configure.in,1.367,1.368 pyconfig.h.in,1.59,1.60 Message-ID: <E18BG1Z-00084Q-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv30239 Modified Files: configure configure.in pyconfig.h.in Log Message: Use new-style CHECK_TYPE to avoid modifying confdefs.h. Include sys/types.h Fixes #636431. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.356 retrieving revision 1.357 diff -C2 -d -r1.356 -r1.357 *** configure 11 Nov 2002 13:37:26 -0000 1.356 --- configure 11 Nov 2002 14:58:30 -0000 1.357 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.366 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.367 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 16526,16536 **** fi - # THIS MUST BE LAST, IT CAN BREAK OTHER TESTS! - # Add sys/socket.h to confdefs.h - cat >> confdefs.h <<\EOF - #ifdef HAVE_SYS_SOCKET_H - #include <sys/socket.h> - #endif - EOF echo "$as_me:$LINENO: checking for socklen_t" >&5 echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 --- 16526,16529 ---- *************** *** 16541,16545 **** #line $LINENO "configure" #include "confdefs.h" ! $ac_includes_default #ifdef F77_DUMMY_MAIN # ifdef __cplusplus --- 16534,16546 ---- #line $LINENO "configure" #include "confdefs.h" ! ! #ifdef HAVE_SYS_TYPES_H ! #include <sys/types.h> ! #endif ! #ifdef HAVE_SYS_SOCKET_H ! #include <sys/socket.h> ! #endif ! ! #ifdef F77_DUMMY_MAIN # ifdef __cplusplus *************** *** 16585,16589 **** else ! cat >>confdefs.h <<_ACEOF #define socklen_t int _ACEOF --- 16586,16590 ---- else ! cat >>confdefs.h <<\_ACEOF #define socklen_t int _ACEOF *************** *** 16591,16605 **** fi - - #AC_MSG_CHECKING(for Modules/Setup) - #if test ! -f Modules/Setup ; then - # if test ! -d Modules ; then - # mkdir Modules - # fi - # cp "$srcdir/Modules/Setup.dist" Modules/Setup - # AC_MSG_RESULT(creating) - #else - # AC_MSG_RESULT(already exists) - #fi --- 16592,16595 ---- Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.367 retrieving revision 1.368 diff -C2 -d -r1.367 -r1.368 *** configure.in 11 Nov 2002 13:37:28 -0000 1.367 --- configure.in 11 Nov 2002 14:58:42 -0000 1.368 *************** *** 2446,2468 **** fi ! # THIS MUST BE LAST, IT CAN BREAK OTHER TESTS! ! # Add sys/socket.h to confdefs.h ! cat >> confdefs.h <<\EOF #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif ! EOF ! AC_CHECK_TYPE(socklen_t, int) ! ! #AC_MSG_CHECKING(for Modules/Setup) ! #if test ! -f Modules/Setup ; then ! # if test ! -d Modules ; then ! # mkdir Modules ! # fi ! # cp "$srcdir/Modules/Setup.dist" Modules/Setup ! # AC_MSG_RESULT(creating) ! #else ! # AC_MSG_RESULT(already exists) ! #fi AC_SUBST(THREADHEADERS) --- 2446,2459 ---- fi ! AC_CHECK_TYPE(socklen_t,, ! AC_DEFINE(socklen_t,int, ! Define to `int' if <sys/socket.h> does not define.),[ ! #ifdef HAVE_SYS_TYPES_H ! #include <sys/types.h> ! #endif #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif ! ]) AC_SUBST(THREADHEADERS) Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** pyconfig.h.in 11 Nov 2002 13:37:28 -0000 1.59 --- pyconfig.h.in 11 Nov 2002 14:58:44 -0000 1.60 *************** *** 843,847 **** #undef size_t ! /* Define to `int' if <sys/types.h> does not define. */ #undef socklen_t --- 843,847 ---- #undef size_t ! /* Define to `int' if <sys/socket.h> does not define. */ #undef socklen_t From tim_one@users.sourceforge.net Mon Nov 11 19:44:41 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 11 Nov 2002 11:44:41 -0800 Subject: [Python-checkins] python/dist/src/PC pyconfig.h,1.15,1.16 Message-ID: <E18BKUD-0006U7-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv23278/python/PC Modified Files: pyconfig.h Log Message: Some help for SF 614770: MSVC 7.0 compiler support This changes sys.version under Microsoft builds to include the MS compiler version number (_MSC_VER). Since VC 6 and VC 7 are apparently incompatible, and both can be installed on a single box, distutils needs some way to figure out which version of MSVC a given Python was compiled under. As also suggested by MvL, got rid of #ifdef'ery for the defunct _M_ALPHA target. Bugfix candidate? Hard to say. As far as I'm concerned, VC 7 wasn't a supported platform in the 2.2 line. If somebody thinks it should be, they can do the work. Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/pyconfig.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pyconfig.h 3 Oct 2002 05:10:39 -0000 1.15 --- pyconfig.h 11 Nov 2002 19:44:39 -0000 1.16 *************** *** 62,65 **** --- 62,87 ---- #ifdef _MSC_VER + /* We want COMPILER to expand to a string containing _MSC_VER's *value*. + * This is horridly tricky, because the stringization operator only works + * on macro arguments, and doesn't evaluate macros passed *as* arguments. + * Attempts simpler than the following appear doomed to produce "_MSC_VER" + * literally in the string. + */ + #define _Py_PASTE_VERSION(SUFFIX) \ + ("[MSC v." _Py_STRINGIZE(_MSC_VER) " " SUFFIX "]") + /* e.g., this produces, after compile-time string catenation, + * ("[MSC v.1200 32 bit (Intel)]") + * + * _Py_STRINGIZE(_MSC_VER) expands to + * _Py_STRINGIZE1((_MSC_VER)) expands to + * _Py_STRINGIZE2(_MSC_VER) but as this call is the result of token-pasting + * it's scanned again for macros and so further expands to (under MSVC 6) + * _Py_STRINGIZE2(1200) which then expands to + * "1200" + */ + #define _Py_STRINGIZE(X) _Py_STRINGIZE1((X)) + #define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X + #define _Py_STRINGIZE2(X) #X + /* MSVC defines _WINxx to differentiate the windows platform types *************** *** 77,85 **** #ifdef MS_WIN64 #ifdef _M_IX86 ! #define COMPILER "[MSC 64 bit (Intel)]" ! #elif defined(_M_ALPHA) ! #define COMPILER "[MSC 64 bit (Alpha)]" #else ! #define COMPILER "[MSC 64 bit (Unknown)]" #endif #endif /* MS_WIN64 */ --- 99,105 ---- #ifdef MS_WIN64 #ifdef _M_IX86 ! #define COMPILER _Py_PASTE_VERSION("64 bit (Intel)" #else ! #define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)") #endif #endif /* MS_WIN64 */ *************** *** 87,95 **** #if defined(MS_WIN32) && !defined(MS_WIN64) #ifdef _M_IX86 ! #define COMPILER "[MSC 32 bit (Intel)]" ! #elif defined(_M_ALPHA) ! #define COMPILER "[MSC 32 bit (Alpha)]" #else ! #define COMPILER "[MSC (Unknown)]" #endif #endif /* MS_WIN32 && !MS_WIN64 */ --- 107,113 ---- #if defined(MS_WIN32) && !defined(MS_WIN64) #ifdef _M_IX86 ! #define COMPILER _Py_PASTE_VERSION("32 bit (Intel)") #else ! #define COMPILER _Py_PASTE_VERSION("32 bit (Unknown)") #endif #endif /* MS_WIN32 && !MS_WIN64 */ *************** *** 178,182 **** #endif ! /* For Windows the Python core is in a DLL by default. Test Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ #if !defined(MS_NO_COREDLL) && !defined(Py_NO_ENABLE_SHARED) --- 196,200 ---- #endif ! /* For Windows the Python core is in a DLL by default. Test Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ #if !defined(MS_NO_COREDLL) && !defined(Py_NO_ENABLE_SHARED) *************** *** 197,201 **** # ifndef Py_BUILD_CORE /* not building the core - must be an ext */ # if defined(_MSC_VER) ! /* So MSVC users need not specify the .lib file in their Makefile (other compilers are generally taken care of by distutils.) */ --- 215,219 ---- # ifndef Py_BUILD_CORE /* not building the core - must be an ext */ # if defined(_MSC_VER) ! /* So MSVC users need not specify the .lib file in their Makefile (other compilers are generally taken care of by distutils.) */ *************** *** 228,241 **** # define PLATFORM "win32" # define HAVE_LARGEFILE_SUPPORT ! # ifdef _M_ALPHA ! # define SIZEOF_VOID_P 8 ! # define SIZEOF_TIME_T 8 ! # else ! # define SIZEOF_VOID_P 4 ! # define SIZEOF_TIME_T 4 ! # define SIZEOF_OFF_T 4 ! # define SIZEOF_FPOS_T 8 ! # define SIZEOF_HKEY 4 ! # endif #endif --- 246,254 ---- # define PLATFORM "win32" # define HAVE_LARGEFILE_SUPPORT ! # define SIZEOF_VOID_P 4 ! # define SIZEOF_TIME_T 4 ! # define SIZEOF_OFF_T 4 ! # define SIZEOF_FPOS_T 8 ! # define SIZEOF_HKEY 4 #endif From tim_one@users.sourceforge.net Mon Nov 11 19:51:45 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 11 Nov 2002 11:51:45 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.517,1.518 Message-ID: <E18BKb3-0007F3-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv27664/python/Misc Modified Files: NEWS Log Message: Added a blurb about the change to sys.version under MSVC. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.517 retrieving revision 1.518 diff -C2 -d -r1.517 -r1.518 *** NEWS 7 Nov 2002 16:23:55 -0000 1.517 --- NEWS 11 Nov 2002 19:51:33 -0000 1.518 *************** *** 752,755 **** --- 752,760 ---- ------- + - When Python is built under a Microsoft compiler, sys.version now + includes the compiler version number (_MSC_VER). For example, under + MSVC 6, sys.version constains the substring "MSC v.1200 ". 1200 is + the value of _MSC_VER under MSVC 6. + - Sometimes the uninstall executable (UNWISE.EXE) vanishes. One cause of that has been fixed in the installer (disabled Wise's "delete in- From tim_one@users.sourceforge.net Mon Nov 11 20:21:08 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 11 Nov 2002 12:21:08 -0800 Subject: [Python-checkins] python/dist/src/PC pyconfig.h,1.16,1.17 Message-ID: <E18BL3U-0001GX-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv4723/python/PC Modified Files: pyconfig.h Log Message: Forgot a paren in the MSVC + 64-bit + Intel case. Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/pyconfig.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pyconfig.h 11 Nov 2002 19:44:39 -0000 1.16 --- pyconfig.h 11 Nov 2002 20:21:06 -0000 1.17 *************** *** 99,103 **** #ifdef MS_WIN64 #ifdef _M_IX86 ! #define COMPILER _Py_PASTE_VERSION("64 bit (Intel)" #else #define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)") --- 99,103 ---- #ifdef MS_WIN64 #ifdef _M_IX86 ! #define COMPILER _Py_PASTE_VERSION("64 bit (Intel)") #else #define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)") From goodger@users.sourceforge.net Tue Nov 12 00:55:12 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Mon, 11 Nov 2002 16:55:12 -0800 Subject: [Python-checkins] python/nondist/peps pep-html-template,1.4,1.5 Message-ID: <E18BPKi-0002vL-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv11114 Modified Files: pep-html-template Log Message: removed bogus attributes Index: pep-html-template =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-html-template,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-html-template 8 Nov 2002 22:12:30 -0000 1.4 --- pep-html-template 12 Nov 2002 00:55:10 -0000 1.5 *************** *** 12,16 **** <title>PEP %(pep)s -- %(title)s %(stylesheet)s ! --- 12,16 ---- PEP %(pep)s -- %(title)s %(stylesheet)s ! From goodger@users.sourceforge.net Tue Nov 12 00:56:29 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Mon, 11 Nov 2002 16:56:29 -0800 Subject: [Python-checkins] python/nondist/peps pep2html.py,1.47,1.48 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv11640 Modified Files: pep2html.py Log Message: Added --local/-l option to make my life easier on creosote. Removed bogus attributes. Index: pep2html.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** pep2html.py 8 Nov 2002 03:43:48 -0000 1.47 --- pep2html.py 12 Nov 2002 00:56:27 -0000 1.48 *************** *** 22,25 **** --- 22,29 ---- used instead). Without -i, -u is ignored. + -l/--local + Same as -i/--install, except run on the local machine. Use this when + logged in to the python.org machine (creosote). + -q/--quiet Turn off verbose messages. *************** *** 106,110 **** link = RFCURL % rfcnum if link: ! return '%s' % (link, cgi.escape(text)) return cgi.escape(match.group(0)) # really slow, but it works... --- 110,114 ---- link = RFCURL % rfcnum if link: ! return '%s' % (cgi.escape(link), cgi.escape(text)) return cgi.escape(match.group(0)) # really slow, but it works... *************** *** 171,177 **** r = random.choice(range(64)) print >> outfile, ( ! ' \n' '\n' ! '\n' '\n' --- 175,181 ---- r = random.choice(range(64)) print >> outfile, ( ! ' \n' '\n' ! '\n' '\n' *************** *** 368,379 **** return outpath ! def push_pep(htmlfiles, txtfiles, username, verbose): ! if verbose: ! quiet = "" else: ! quiet = "-q" ! if username: ! username = username + "@" ! target = username + HOST + ":" + HDIR files = htmlfiles[:] files.extend(txtfiles) --- 372,391 ---- return outpath ! def push_pep(htmlfiles, txtfiles, username, verbose, local=0): ! quiet = "" ! if local: ! if verbose: ! quiet = "-v" ! target = HDIR ! copy_cmd = "cp" ! chmod_cmd = "chmod" else: ! if not verbose: ! quiet = "-q" ! if username: ! username = username + "@" ! target = username + HOST + ":" + HDIR ! copy_cmd = "scp" ! chmod_cmd = "ssh %s%s chmod" % (username, HOST) files = htmlfiles[:] files.extend(txtfiles) *************** *** 381,388 **** files.append("pep.css") filelist = SPACE.join(files) ! rc = os.system("scp %s %s %s" % (quiet, filelist, target)) if rc: sys.exit(rc) ! rc = os.system("ssh %s%s chmod 664 %s/*" % (username, HOST, HDIR)) if rc: sys.exit(rc) --- 393,400 ---- files.append("pep.css") filelist = SPACE.join(files) ! rc = os.system("%s %s %s %s" % (copy_cmd, quiet, filelist, target)) if rc: sys.exit(rc) ! rc = os.system("%s 664 %s/*" % (chmod_cmd, HDIR)) if rc: sys.exit(rc) *************** *** 446,449 **** --- 458,462 ---- # defaults update = 0 + local = 0 username = '' verbose = 1 *************** *** 457,462 **** try: opts, args = getopt.getopt( ! argv, 'bihqu:', ! ['browse', 'install', 'help', 'quiet', 'user=']) except getopt.error, msg: usage(1, msg) --- 470,475 ---- try: opts, args = getopt.getopt( ! argv, 'bilhqu:', ! ['browse', 'install', 'local', 'help', 'quiet', 'user=']) except getopt.error, msg: usage(1, msg) *************** *** 467,470 **** --- 480,486 ---- elif opt in ('-i', '--install'): update = 1 + elif opt in ('-l', '--local'): + update = 1 + local = 1 elif opt in ('-u', '--user'): username = arg *************** *** 500,504 **** if update: ! push_pep(html, peptxt, username, verbose) if browse: if args: --- 516,520 ---- if update: ! push_pep(html, peptxt, username, verbose, local=local) if browse: if args: From goodger@users.sourceforge.net Tue Nov 12 03:06:39 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Mon, 11 Nov 2002 19:06:39 -0800 Subject: [Python-checkins] python/nondist/peps pep.css,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv2862 Modified Files: pep.css Log Message: fix Index: pep.css =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep.css,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep.css 8 Nov 2002 03:44:20 -0000 1.4 --- pep.css 12 Nov 2002 03:06:36 -0000 1.5 *************** *** 23,27 **** .navigation .navicon { width: 150px ; ! height: 35 } .navigation .textlinks { --- 23,27 ---- .navigation .navicon { width: 150px ; ! height: 35px } .navigation .textlinks { From goodger@users.sourceforge.net Tue Nov 12 05:36:11 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Mon, 11 Nov 2002 21:36:11 -0800 Subject: [Python-checkins] python/nondist/peps pep-html-template,1.5,1.6 pep2html.py,1.48,1.49 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv6081 Modified Files: pep-html-template pep2html.py Log Message: Moved comment inside to appease MSIE. Index: pep-html-template =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-html-template,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-html-template 12 Nov 2002 00:55:10 -0000 1.5 --- pep-html-template 12 Nov 2002 05:36:09 -0000 1.6 *************** *** 1,3 **** --- 1,5 ---- + + - - --- 7,10 ---- Index: pep2html.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** pep2html.py 12 Nov 2002 00:56:27 -0000 1.48 --- pep2html.py 12 Nov 2002 05:36:09 -0000 1.49 *************** *** 143,149 **** infile = iter(input_lines) # convert plaintext pep to minimal XHTML markup - print >> outfile, COMMENT print >> outfile, DTD print >> outfile, '' print >> outfile, '' # head --- 143,149 ---- infile = iter(input_lines) # convert plaintext pep to minimal XHTML markup print >> outfile, DTD print >> outfile, '' + print >> outfile, COMMENT print >> outfile, '' # head From loewis@users.sourceforge.net Tue Nov 12 06:04:41 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 11 Nov 2002 22:04:41 -0800 Subject: [Python-checkins] python/dist/src configure,1.357,1.358 configure.in,1.368,1.369 pyconfig.h.in,1.60,1.61 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv13128 Modified Files: configure configure.in pyconfig.h.in Log Message: Don't define _XOPEN_SOURCE and _POSIX_C_SOURCE on FreeBSD 5.0. Fixes #636318. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.357 retrieving revision 1.358 diff -C2 -d -r1.357 -r1.358 *** configure 11 Nov 2002 14:58:30 -0000 1.357 --- configure 12 Nov 2002 06:04:36 -0000 1.358 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.367 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.368 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 1253,1278 **** - # The definition of _GNU_SOURCE potentially causes a change of the value - # of _XOPEN_SOURCE. So define it only conditionally. - - - define_xopen_source=yes - # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires definition - # of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else several APIs - # are not declared. Since this is also needed in some cases for HP-UX, - # we define it globally. - - cat >>confdefs.h <<\_ACEOF - #define _XOPEN_SOURCE_EXTENDED 1 - _ACEOF - - - cat >>confdefs.h <<\_ACEOF - #define _POSIX_C_SOURCE 199506L - _ACEOF - - # Arguments passed to configure. --- 1253,1258 ---- *************** *** 1362,1372 **** OpenBSD/2.* | OpenBSD/3.[012]) define_xopen_source=no;; esac if test $define_xopen_source = yes then ! cat >>confdefs.h <<\_ACEOF ! #define _XOPEN_SOURCE 500 _ACEOF fi --- 1342,1374 ---- OpenBSD/2.* | OpenBSD/3.[012]) define_xopen_source=no;; + # On FreeBSD 5.0, chroot and setgroups are not declared if _XOPEN_SOURCE + # is define. Reported by M. Recht. + FreeBSD/5.0*) + define_xopen_source=no;; esac if test $define_xopen_source = yes then ! ! cat >>confdefs.h <<\_ACEOF ! #define _XOPEN_SOURCE 600 ! _ACEOF ! ! ! # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires ! # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else ! # several APIs are not declared. Since this is also needed in some ! # cases for HP-UX, we define it globally. ! ! ! cat >>confdefs.h <<\_ACEOF ! #define _XOPEN_SOURCE_EXTENDED 1 _ACEOF + + + cat >>confdefs.h <<\_ACEOF + #define _POSIX_C_SOURCE 200112L + _ACEOF + fi Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.368 retrieving revision 1.369 diff -C2 -d -r1.368 -r1.369 *** configure.in 11 Nov 2002 14:58:42 -0000 1.368 --- configure.in 12 Nov 2002 06:04:39 -0000 1.369 *************** *** 35,55 **** AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features]) - # The definition of _GNU_SOURCE potentially causes a change of the value - # of _XOPEN_SOURCE. So define it only conditionally. - AH_VERBATIM([_XOPEN_SOURCE], - [/* Define on UNIX to activate XPG/5 features. */ - #ifndef _XOPEN_SOURCE - # undef _XOPEN_SOURCE - #endif]) - define_xopen_source=yes - # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires definition - # of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else several APIs - # are not declared. Since this is also needed in some cases for HP-UX, - # we define it globally. - AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Define to activate Unix95-and-earlier features) - AC_DEFINE(_POSIX_C_SOURCE, 199506L, Define to activate features from IEEE Stds 1003.{123}-1995) - # Arguments passed to configure. AC_SUBST(CONFIG_ARGS) --- 35,40 ---- *************** *** 136,144 **** OpenBSD/2.* | OpenBSD/3.@<:@012@:>@) define_xopen_source=no;; esac if test $define_xopen_source = yes then ! AC_DEFINE(_XOPEN_SOURCE, 500) fi --- 121,143 ---- OpenBSD/2.* | OpenBSD/3.@<:@012@:>@) define_xopen_source=no;; + # On FreeBSD 5.0, chroot and setgroups are not declared if _XOPEN_SOURCE + # is define. Reported by M. Recht. + FreeBSD/5.0*) + define_xopen_source=no;; esac if test $define_xopen_source = yes then ! AC_DEFINE(_XOPEN_SOURCE, 600, ! Define to the level of X/Open that your system supports) ! ! # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires ! # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else ! # several APIs are not declared. Since this is also needed in some ! # cases for HP-UX, we define it globally. ! ! AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Define to activate Unix95-and-earlier features) ! AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001) ! fi Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** pyconfig.h.in 11 Nov 2002 14:58:44 -0000 1.60 --- pyconfig.h.in 12 Nov 2002 06:04:39 -0000 1.61 *************** *** 791,795 **** #undef _POSIX_1_SOURCE ! /* Define to activate features from IEEE Stds 1003.{123}-1995 */ #undef _POSIX_C_SOURCE --- 791,795 ---- #undef _POSIX_1_SOURCE ! /* Define to activate features from IEEE Stds 1003.1-2001 */ #undef _POSIX_C_SOURCE *************** *** 803,810 **** #undef _REENTRANT ! /* Define on UNIX to activate XPG/5 features. */ ! #ifndef _XOPEN_SOURCE ! # undef _XOPEN_SOURCE ! #endif /* Define to activate Unix95-and-earlier features */ --- 803,808 ---- #undef _REENTRANT ! /* Define to the level of X/Open that your system supports */ ! #undef _XOPEN_SOURCE /* Define to activate Unix95-and-earlier features */ From perky@fallin.lv Tue Nov 12 07:24:54 2002 From: perky@fallin.lv (Hye-Shik Chang) Date: Tue, 12 Nov 2002 16:24:54 +0900 Subject: [Python-checkins] python/dist/src configure,1.357,1.358 configure.in,1.368,1.369 pyconfig.h.in,1.60,1.61 In-Reply-To: References: Message-ID: <20021112072454.GA86752@fallin.lv> On Mon, Nov 11, 2002 at 10:04:41PM -0800, loewis@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src > In directory usw-pr-cvs1:/tmp/cvs-serv13128 > > Modified Files: > configure configure.in pyconfig.h.in > Log Message: > Don't define _XOPEN_SOURCE and _POSIX_C_SOURCE on FreeBSD 5.0. Fixes #636318. > Thank you. -- Hye-Shik Chang Yonsei University, Seoul ^D From doerwalter@users.sourceforge.net Tue Nov 12 11:42:23 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 12 Nov 2002 03:42:23 -0800 Subject: [Python-checkins] python/dist/src/Modules selectmodule.c,2.70,2.71 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv14761/Modules Modified Files: selectmodule.c Log Message: Use PyInt_AsLong instead of PyInt_AS_LONG after the call to PyNumber_Int, because now PyNumber_Int might return a long, and PyInt_AsLong can handle that, whereas PyInt_AS_LONG can't. This closes SF bug #629989. Index: selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.70 retrieving revision 2.71 diff -C2 -d -r2.70 -r2.71 *** selectmodule.c 24 Sep 2002 17:03:26 -0000 2.70 --- selectmodule.c 12 Nov 2002 11:42:20 -0000 2.71 *************** *** 471,475 **** if (!tout) return NULL; ! timeout = PyInt_AS_LONG(tout); Py_DECREF(tout); } --- 471,475 ---- if (!tout) return NULL; ! timeout = PyInt_AsLong(tout); Py_DECREF(tout); } From loewis@users.sourceforge.net Tue Nov 12 13:03:36 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 12 Nov 2002 05:03:36 -0800 Subject: [Python-checkins] python/nondist/peps pep-0011.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv30877 Modified Files: pep-0011.txt Log Message: Add Minix. Proposed by Skip Montanaro. Index: pep-0011.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0011.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0011.txt 15 Jul 2002 18:26:52 -0000 1.4 --- pep-0011.txt 12 Nov 2002 13:03:33 -0000 1.5 *************** *** 89,93 **** Code removed in: Python 2.4 ! Name: dgux Unsupported in: Python 2.3 Code removed in: Python 2.4 --- 89,93 ---- Code removed in: Python 2.4 ! Name: Minix Unsupported in: Python 2.3 Code removed in: Python 2.4 From loewis@users.sourceforge.net Tue Nov 12 15:25:22 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 12 Nov 2002 07:25:22 -0800 Subject: [Python-checkins] python/nondist/peps pep-0011.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv18550 Modified Files: pep-0011.txt Log Message: Deprecate --with-dl-dld. Proposed by Matthew Cowles, in #636313. Index: pep-0011.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0011.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0011.txt 12 Nov 2002 13:03:33 -0000 1.5 --- pep-0011.txt 12 Nov 2002 15:25:17 -0000 1.6 *************** *** 102,105 **** --- 102,109 ---- Code removed in: Python 2.4 + Name: Systems using --with-dl-dld + Unsupported in: Python 2.3 + Code removed in: Python 2.4 + Copyright From montanaro@users.sourceforge.net Tue Nov 12 16:53:38 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 12 Nov 2002 08:53:38 -0800 Subject: [Python-checkins] python/dist/src README,1.156,1.157 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12298 Modified Files: README Log Message: delete reference to building on Minix, which will be unsupported in 2.3 Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** README 4 Nov 2002 20:49:45 -0000 1.156 --- README 12 Nov 2002 16:53:36 -0000 1.157 *************** *** 313,318 **** optimization solves the problems. - Minix: When using ack, use "CC=cc AR=aal RANLIB=: ./configure"! - SCO: The following apply to SCO 3 only; Python builds out of the box on SCO 5 (or so we've heard). --- 313,316 ---- From rhettinger@users.sourceforge.net Tue Nov 12 17:41:59 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 12 Nov 2002 09:41:59 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.518,1.519 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv10733/Misc Modified Files: NEWS Log Message: SF patch 629637: Add sample(population, k) method to the random module. Used for random sampling without replacement. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.518 retrieving revision 1.519 diff -C2 -d -r1.518 -r1.519 *** NEWS 11 Nov 2002 19:51:33 -0000 1.518 --- NEWS 12 Nov 2002 17:41:56 -0000 1.519 *************** *** 428,431 **** --- 428,434 ---- - Added operator.pow(a,b) which is equivalent to a**b. + - Added random.sample(population,k) for random sampling without replacement. + Returns a k length list of unique elements chosen from the population. + - random.randrange(-sys.maxint-1, sys.maxint) no longer raises OverflowError. That is, it now accepts any combination of 'start' From rhettinger@users.sourceforge.net Tue Nov 12 17:41:59 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 12 Nov 2002 09:41:59 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib librandom.tex,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv10733/Doc/lib Modified Files: librandom.tex Log Message: SF patch 629637: Add sample(population, k) method to the random module. Used for random sampling without replacement. Index: librandom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librandom.tex,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** librandom.tex 23 May 2002 21:07:19 -0000 1.30 --- librandom.tex 12 Nov 2002 17:41:57 -0000 1.31 *************** *** 180,183 **** --- 180,202 ---- \end{funcdesc} + \begin{funcdesc}{sample}{population, k} + Return a \var{k} length list of unique elements chosen from the + population sequence. Used for random sampling without replacement. + + Returns a new list containing elements from the population. The + list itself is in random order so that all sub-slices are also + random samples. The original sequence is left undisturbed. + + If the population has repeated elements, then each occurence is a + possible selection in the sample. + + If indices are needed for a large population, use \function{xrange} + as an argument: \code{sample(xrange(10000000), 60)}. + + Optional argument random is a 0-argument function returning a random + float in [0.0, 1.0); by default, the standard random.random. + \versionadded{2.3} + \end{funcdesc} + The following functions generate specific real-valued distributions. From rhettinger@users.sourceforge.net Tue Nov 12 17:42:00 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 12 Nov 2002 09:42:00 -0800 Subject: [Python-checkins] python/dist/src/Lib random.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10733/lib Modified Files: random.py Log Message: SF patch 629637: Add sample(population, k) method to the random module. Used for random sampling without replacement. Index: random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** random.py 16 Aug 2002 03:41:39 -0000 1.35 --- random.py 12 Nov 2002 17:41:57 -0000 1.36 *************** *** 8,11 **** --- 8,12 ---- --------- pick random element + pick random sample generate random permutation *************** *** 78,82 **** from math import floor as _floor ! __all__ = ["Random","seed","random","uniform","randint","choice", "randrange","shuffle","normalvariate","lognormvariate", "cunifvariate","expovariate","vonmisesvariate","gammavariate", --- 79,83 ---- from math import floor as _floor ! __all__ = ["Random","seed","random","uniform","randint","choice","sample", "randrange","shuffle","normalvariate","lognormvariate", "cunifvariate","expovariate","vonmisesvariate","gammavariate", *************** *** 374,377 **** --- 375,415 ---- x[i], x[j] = x[j], x[i] + def sample(self, population, k, random=None, int=int): + """Chooses k unique random elements from a population sequence. + + Returns a new list containing elements from the population. The + list itself is in random order so that all sub-slices are also + random samples. The original sequence is left undisturbed. + + If the population has repeated elements, then each occurence is + a possible selection in the sample. + + If indices are needed for a large population, use xrange as an + argument: sample(xrange(10000000), 60) + + Optional arg random is a 0-argument function returning a random + float in [0.0, 1.0); by default, the standard random.random. + """ + + n = len(population) + if not 0 <= k <= n: + raise ValueError, "sample larger than population" + if random is None: + random = self.random + if n < 6 * k: # if n len list takes less space than a k len dict + pool = list(population) + for i in xrange(n-1, n-k-1, -1): + j = int(random() * (i+1)) + pool[i], pool[j] = pool[j], pool[i] + return pool[-k:] + inorder = [None] * k + selections = {} + for i in xrange(k): + j = int(random() * n) + while j in selections: + j = int(random() * n) + selections[j] = inorder[i] = population[j] + return inorder # return selections in the order they were picked + ## -------------------- real-valued distributions ------------------- *************** *** 712,716 **** (avg, stddev, smallest, largest) ! def _test(N=20000): print 'TWOPI =', TWOPI print 'LOG4 =', LOG4 --- 750,766 ---- (avg, stddev, smallest, largest) ! def _test_sample(n): ! # For the entire allowable range of 0 <= k <= n, validate that ! # the sample is of the correct length and contains only unique items ! population = xrange(n) ! for k in xrange(n+1): ! s = sample(population, k) ! assert len(dict([(elem,True) for elem in s])) == len(s) == k ! ! def _sample_generator(n, k): ! # Return a fixed element from the sample. Validates random ordering. ! return sample(xrange(n), k)[k//2] ! ! def _test(N=2000): print 'TWOPI =', TWOPI print 'LOG4 =', LOG4 *************** *** 736,739 **** --- 786,792 ---- _test_generator(N, 'paretovariate(1.0)') _test_generator(N, 'weibullvariate(1.0, 1.0)') + _test_generator(N, '_sample_generator(50, 5)') # expected s.d.: 14.4 + _test_generator(N, '_sample_generator(50, 45)') # expected s.d.: 14.4 + _test_sample(1000) # Test jumpahead. *************** *** 761,764 **** --- 814,818 ---- choice = _inst.choice randrange = _inst.randrange + sample = _inst.sample shuffle = _inst.shuffle normalvariate = _inst.normalvariate From akuchling@users.sourceforge.net Tue Nov 12 18:45:49 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 12 Nov 2002 10:45:49 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew22.tex,1.57,1.58 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv17915 Modified Files: whatsnew22.tex Log Message: Remove extra word Index: whatsnew22.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew22.tex,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** whatsnew22.tex 2 May 2002 17:55:26 -0000 1.57 --- whatsnew22.tex 12 Nov 2002 18:45:46 -0000 1.58 *************** *** 4,8 **** \title{What's New in Python 2.2} ! \release{1.01} \author{A.M. Kuchling} \authoraddress{\email{akuchlin@mems-exchange.org}} --- 4,8 ---- \title{What's New in Python 2.2} ! \release{1.02} \author{A.M. Kuchling} \authoraddress{\email{akuchlin@mems-exchange.org}} *************** *** 126,130 **** integers, lists, dictionaries, and even files, are new-style classes now. A new-style class named \class{object}, the base class for all ! built-in types, has been also been added so if no built-in type is suitable, you can just subclass \class{object}: --- 126,130 ---- integers, lists, dictionaries, and even files, are new-style classes now. A new-style class named \class{object}, the base class for all ! built-in types, has also been added so if no built-in type is suitable, you can just subclass \class{object}: *************** *** 1433,1437 **** Lundh, Michael McLay, Nick Mathewson, Paul Moore, Gustavo Niemeyer, Don O'Donnell, Joonas Paalasma, Tim Peters, Jens Quade, Tom Reinhardt, Neil ! Schemenauer, Guido van Rossum, Greg Ward. \end{document} --- 1433,1437 ---- Lundh, Michael McLay, Nick Mathewson, Paul Moore, Gustavo Niemeyer, Don O'Donnell, Joonas Paalasma, Tim Peters, Jens Quade, Tom Reinhardt, Neil ! Schemenauer, Guido van Rossum, Greg Ward, Edward Welbourne. \end{document} From akuchling@users.sourceforge.net Tue Nov 12 18:59:22 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 12 Nov 2002 10:59:22 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew22.tex,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv26165 Modified Files: whatsnew22.tex Log Message: Update text to refer to 2.2.2 Remove an XXX item: I'm not going to write a section on the email package at this point Index: whatsnew22.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew22.tex,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** whatsnew22.tex 12 Nov 2002 18:45:46 -0000 1.58 --- whatsnew22.tex 12 Nov 2002 18:59:20 -0000 1.59 *************** *** 12,17 **** \section{Introduction} ! This article explains the new features in Python 2.2.1, released on ! April 10, 2002. Python 2.2.1 is a bugfix release of Python 2.2, originally released on December 21, 2001. --- 12,17 ---- \section{Introduction} ! This article explains the new features in Python 2.2.2, released on ! October 14, 2002. Python 2.2.2 is a bugfix release of Python 2.2, originally released on December 21, 2001. *************** *** 1159,1163 **** Baxter and Michel Pelletier.) - % XXX should the 'email' module get a section of its own? \item The \module{rfc822} module's parsing of email addresses is now compliant with \rfc{2822}, an update to \rfc{822}. (The module's --- 1159,1162 ---- *************** *** 1279,1284 **** scattered throughout the source tree. A search through the CVS change logs finds there were 527 patches applied and 683 bugs fixed between ! Python 2.1 and 2.2; 2.2.1 applied 139 patches and fixed 143 bugs. ! Both figures are likely to be underestimates. Some of the more notable changes are: --- 1278,1284 ---- scattered throughout the source tree. A search through the CVS change logs finds there were 527 patches applied and 683 bugs fixed between ! Python 2.1 and 2.2; 2.2.1 applied 139 patches and fixed 143 bugs; ! 2.2.2 applied 106 patches and fixed 82 bugs. These figures are likely ! to be underestimates. Some of the more notable changes are: From akuchling@users.sourceforge.net Tue Nov 12 19:01:09 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 12 Nov 2002 11:01:09 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew22.tex,1.54.2.1,1.54.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv27073 Modified Files: Tag: release22-maint whatsnew22.tex Log Message: Commit version 1.02 (CVS revision 1.59) of whatsnew22.tex, which fixes various small errors and adds mention of the 2.2.1 and 2.2.2 releases. Index: whatsnew22.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew22.tex,v retrieving revision 1.54.2.1 retrieving revision 1.54.2.2 diff -C2 -d -r1.54.2.1 -r1.54.2.2 *** whatsnew22.tex 2 May 2002 17:56:17 -0000 1.54.2.1 --- whatsnew22.tex 12 Nov 2002 19:01:04 -0000 1.54.2.2 *************** *** 4,8 **** \title{What's New in Python 2.2} ! \release{1.00} \author{A.M. Kuchling} \authoraddress{\email{akuchlin@mems-exchange.org}} --- 4,8 ---- \title{What's New in Python 2.2} ! \release{1.02} \author{A.M. Kuchling} \authoraddress{\email{akuchlin@mems-exchange.org}} *************** *** 12,17 **** \section{Introduction} ! This article explains the new features in Python 2.2, released on ! December 21, 2001. Python 2.2 can be thought of as the "cleanup release". There are some --- 12,18 ---- \section{Introduction} ! This article explains the new features in Python 2.2.2, released on ! October 14, 2002. Python 2.2.2 is a bugfix release of Python 2.2, ! originally released on December 21, 2001. Python 2.2 can be thought of as the "cleanup release". There are some *************** *** 125,129 **** integers, lists, dictionaries, and even files, are new-style classes now. A new-style class named \class{object}, the base class for all ! built-in types, has been also been added so if no built-in type is suitable, you can just subclass \class{object}: --- 126,130 ---- integers, lists, dictionaries, and even files, are new-style classes now. A new-style class named \class{object}, the base class for all ! built-in types, has also been added so if no built-in type is suitable, you can just subclass \class{object}: *************** *** 1064,1068 **** \item The \module{xmlrpclib} module was contributed to the standard ! library by Fredrik Lundh, provding support for writing XML-RPC clients. XML-RPC is a simple remote procedure call protocol built on top of HTTP and XML. For example, the following snippet retrieves a --- 1065,1069 ---- \item The \module{xmlrpclib} module was contributed to the standard ! library by Fredrik Lundh, providing support for writing XML-RPC clients. XML-RPC is a simple remote procedure call protocol built on top of HTTP and XML. For example, the following snippet retrieves a *************** *** 1114,1118 **** \item The Python profiler has been extensively reworked and various ! errors in its output have been corrected. (Contributed by Fred Fred~L. Drake, Jr. and Tim Peters.) --- 1115,1119 ---- \item The Python profiler has been extensively reworked and various ! errors in its output have been corrected. (Contributed by Fred~L. Drake, Jr. and Tim Peters.) *************** *** 1158,1162 **** Baxter and Michel Pelletier.) - % XXX should the 'email' module get a section of its own? \item The \module{rfc822} module's parsing of email addresses is now compliant with \rfc{2822}, an update to \rfc{822}. (The module's --- 1159,1162 ---- *************** *** 1277,1283 **** As usual there were a bunch of other improvements and bugfixes scattered throughout the source tree. A search through the CVS change ! logs finds there were 527 patches applied, and 683 bugs fixed; both ! figures are likely to be underestimates. Some of the more notable ! changes are: \begin{itemize} --- 1277,1286 ---- As usual there were a bunch of other improvements and bugfixes scattered throughout the source tree. A search through the CVS change ! logs finds there were 527 patches applied and 683 bugs fixed between ! Python 2.1 and 2.2; 2.2.1 applied 139 patches and fixed 143 bugs; ! 2.2.2 applied 106 patches and fixed 82 bugs. These figures are likely ! to be underestimates. ! ! Some of the more notable changes are: \begin{itemize} *************** *** 1429,1434 **** Hudson, Jack Jansen, Marc-Andr\'e Lemburg, Martin von L\"owis, Fredrik Lundh, Michael McLay, Nick Mathewson, Paul Moore, Gustavo Niemeyer, ! Don O'Donnell, Tim Peters, Jens Quade, Tom Reinhardt, Neil ! Schemenauer, Guido van Rossum, Greg Ward. \end{document} --- 1432,1437 ---- Hudson, Jack Jansen, Marc-Andr\'e Lemburg, Martin von L\"owis, Fredrik Lundh, Michael McLay, Nick Mathewson, Paul Moore, Gustavo Niemeyer, ! Don O'Donnell, Joonas Paalasma, Tim Peters, Jens Quade, Tom Reinhardt, Neil ! Schemenauer, Guido van Rossum, Greg Ward, Edward Welbourne. \end{document} From loewis@users.sourceforge.net Tue Nov 12 19:58:40 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 12 Nov 2002 11:58:40 -0800 Subject: [Python-checkins] python/nondist/peps pep-0011.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv1642 Modified Files: pep-0011.txt Log Message: Redeprecate dgux. Index: pep-0011.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0011.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0011.txt 12 Nov 2002 15:25:17 -0000 1.6 --- pep-0011.txt 12 Nov 2002 19:58:38 -0000 1.7 *************** *** 89,92 **** --- 89,96 ---- Code removed in: Python 2.4 + Name: dgux + Unsupported in: Python 2.3 + Code removed in: Python 2.4 + Name: Minix Unsupported in: Python 2.3 From fdrake@users.sourceforge.net Tue Nov 12 22:07:14 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 12 Nov 2002 14:07:14 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.102,1.103 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv20402 Modified Files: libos.tex Log Message: Clarified documentation of tempnam(). Closes SF bug #635656. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** libos.tex 7 Nov 2002 17:13:03 -0000 1.102 --- libos.tex 12 Nov 2002 22:07:11 -0000 1.103 *************** *** 973,976 **** --- 973,980 ---- managing files created using paths returned by \function{tempnam()}; no automatic cleanup is provided. + On \UNIX, the environment variable \envvar{TMPDIR} overrides + \var{dir}, while on Windows the \envvar{TMP} is used. The specific + behavior of this function depends on the C library implementation; + some aspects are underspecified in system documentation. \warning{Use of \function{tempnam()} is vulnerable to symlink attacks; consider using \function{tmpfile()} instead.} From fdrake@users.sourceforge.net Tue Nov 12 22:07:51 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 12 Nov 2002 14:07:51 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.74.2.1.2.7,1.74.2.1.2.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv20742 Modified Files: Tag: release22-maint libos.tex Log Message: Clarified documentation of tempnam(). Closes SF bug #635656. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.74.2.1.2.7 retrieving revision 1.74.2.1.2.8 diff -C2 -d -r1.74.2.1.2.7 -r1.74.2.1.2.8 *** libos.tex 23 Aug 2002 16:28:16 -0000 1.74.2.1.2.7 --- libos.tex 12 Nov 2002 22:07:48 -0000 1.74.2.1.2.8 *************** *** 866,869 **** --- 866,873 ---- managing files created using paths returned by \function{tempnam()}; no automatic cleanup is provided. + On \UNIX, the environment variable \envvar{TMPDIR} overrides + \var{dir}, while on Windows the \envvar{TMP} is used. The specific + behavior of this function depends on the C library implementation; + some aspects are underspecified in system documentation. \warning{Use of \function{tempnam()} is vulnerable to symlink attacks; consider using \function{tmpfile()} instead.} From tim_one@users.sourceforge.net Tue Nov 12 22:08:10 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 12 Nov 2002 14:08:10 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.107,1.108 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv19759/python/Doc/lib Modified Files: libstdtypes.tex Log Message: SF patch 637176: list.sort crasher Armin Rigo's Draconian but effective fix for SF bug 453523: list.sort crasher slightly fiddled to catch more cases of list mutation. The dreaded internal "immutable list type" is gone! OTOH, if you look at a list *while* it's being sorted now, it will appear to be empty. Better than a core dump. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** libstdtypes.tex 25 Oct 2002 16:55:51 -0000 1.107 --- libstdtypes.tex 12 Nov 2002 22:08:08 -0000 1.108 *************** *** 923,927 **** {reverses the items of \var{s} in place}{(6)} \lineiii{\var{s}.sort(\optional{\var{cmpfunc}})} ! {sort the items of \var{s} in place}{(6), (7), (8)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} --- 923,927 ---- {reverses the items of \var{s} in place}{(6)} \lineiii{\var{s}.sort(\optional{\var{cmpfunc}})} ! {sort the items of \var{s} in place}{(6), (7), (8), (9)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} *************** *** 981,984 **** --- 981,990 ---- \method{sort()} method, but code that intends to be portable across implementations and versions must not rely on stability. + + \item[(9)] While a list is being sorted, the effect of attempting to + mutate, or even inspect, the list is undefined. The C implementation + of Python 2.3 makes the list appear empty for the duration, and raises + \exception{ValueError} if it can detect that the list has been + mutated during a sort. \end{description} From tim_one@users.sourceforge.net Tue Nov 12 22:08:11 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 12 Nov 2002 14:08:11 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_sort.py,1.2,1.3 test_types.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19759/python/Lib/test Modified Files: test_sort.py test_types.py Log Message: SF patch 637176: list.sort crasher Armin Rigo's Draconian but effective fix for SF bug 453523: list.sort crasher slightly fiddled to catch more cases of list mutation. The dreaded internal "immutable list type" is gone! OTOH, if you look at a list *while* it's being sorted now, it will appear to be empty. Better than a core dump. Index: test_sort.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sort.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_sort.py 3 Aug 2002 02:17:41 -0000 1.2 --- test_sort.py 12 Nov 2002 22:08:08 -0000 1.3 *************** *** 117,120 **** --- 117,149 ---- check("stability", x, s) + def bug453523(): + global nerrors + from random import random + + # If this fails, the most likely outcome is a core dump. + if verbose: + print "Testing bug 453523 -- list.sort() crasher." + + class C: + def __lt__(self, other): + if L and random() < 0.75: + pop() + else: + push(3) + return random() < 0.5 + + L = [C() for i in range(50)] + pop = L.pop + push = L.append + try: + L.sort() + except ValueError: + pass + else: + print " Mutation during list.sort() wasn't caught." + nerrors += 1 + + bug453523() + if nerrors: print "Test failed", nerrors Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** test_types.py 5 Nov 2002 17:38:05 -0000 1.38 --- test_types.py 12 Nov 2002 22:08:08 -0000 1.39 *************** *** 368,375 **** def selfmodifyingComparison(x,y): ! z[0] = 1 return cmp(x, y) try: z.sort(selfmodifyingComparison) ! except TypeError: pass else: raise TestFailed, 'modifying list during sort' --- 368,375 ---- def selfmodifyingComparison(x,y): ! z.append(1) return cmp(x, y) try: z.sort(selfmodifyingComparison) ! except ValueError: pass else: raise TestFailed, 'modifying list during sort' From tim_one@users.sourceforge.net Tue Nov 12 22:08:12 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 12 Nov 2002 14:08:12 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.519,1.520 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv19759/python/Misc Modified Files: NEWS Log Message: SF patch 637176: list.sort crasher Armin Rigo's Draconian but effective fix for SF bug 453523: list.sort crasher slightly fiddled to catch more cases of list mutation. The dreaded internal "immutable list type" is gone! OTOH, if you look at a list *while* it's being sorted now, it will appear to be empty. Better than a core dump. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.519 retrieving revision 1.520 diff -C2 -d -r1.519 -r1.520 *** NEWS 12 Nov 2002 17:41:56 -0000 1.519 --- NEWS 12 Nov 2002 22:08:09 -0000 1.520 *************** *** 67,70 **** --- 67,80 ---- ----------------- + - Thanks to Armin Rigo, the last known way to provoke a system crash + by cleverly arranging for a comparison function to mutate a list + during a list.sort() operation has been fixed. The effect of + attempting to mutate a list, or even to inspect its contents or + length, while a sort is in progress, is not defined by the language. + The C implementation of Python 2.3 attempts to detect mutations, + and raise ValueError if one occurs, but there's no guarantee that + all mutations will be caught, or that any will be caught across + releases or implementations. + - Unicode file name processing for Windows (PEP 277) is implemented. All platforms now have an os.path.supports_unicode_filenames attribute, *************** *** 429,433 **** - Added random.sample(population,k) for random sampling without replacement. ! Returns a k length list of unique elements chosen from the population. - random.randrange(-sys.maxint-1, sys.maxint) no longer raises --- 439,443 ---- - Added random.sample(population,k) for random sampling without replacement. ! Returns a k length list of unique elements chosen from the population. - random.randrange(-sys.maxint-1, sys.maxint) no longer raises From tim_one@users.sourceforge.net Tue Nov 12 22:08:12 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 12 Nov 2002 14:08:12 -0800 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.140,2.141 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv19759/python/Objects Modified Files: listobject.c Log Message: SF patch 637176: list.sort crasher Armin Rigo's Draconian but effective fix for SF bug 453523: list.sort crasher slightly fiddled to catch more cases of list mutation. The dreaded internal "immutable list type" is gone! OTOH, if you look at a list *while* it's being sorted now, it will appear to be empty. Better than a core dump. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.140 retrieving revision 2.141 diff -C2 -d -r2.140 -r2.141 *** listobject.c 5 Nov 2002 22:41:37 -0000 2.140 --- listobject.c 12 Nov 2002 22:08:10 -0000 2.141 *************** *** 1635,1640 **** } - static PyTypeObject immutable_list_type; - /* An adaptive, stable, natural mergesort. See listsort.txt. * Returns Py_None on success, NULL on error. Even in case of error, the --- 1635,1638 ---- *************** *** 1649,1653 **** int nremaining; int minrun; ! PyTypeObject *savetype; PyObject *compare = NULL; PyObject *result = NULL; /* guilty until proved innocent */ --- 1647,1653 ---- int nremaining; int minrun; ! int saved_ob_size; ! PyObject **saved_ob_item; ! PyObject **empty_ob_item; PyObject *compare = NULL; PyObject *result = NULL; /* guilty until proved innocent */ *************** *** 1660,1667 **** merge_init(&ms, compare); ! savetype = self->ob_type; ! self->ob_type = &immutable_list_type; ! nremaining = self->ob_size; if (nremaining < 2) goto succeed; --- 1660,1674 ---- merge_init(&ms, compare); ! /* The list is temporarily made empty, so that mutations performed ! * by comparison functions can't affect the slice of memory we're ! * sorting (allowing mutations during sorting is a core-dump ! * factory, since ob_item may change). ! */ ! saved_ob_size = self->ob_size; ! saved_ob_item = self->ob_item; ! self->ob_size = 0; ! self->ob_item = empty_ob_item = PyMem_NEW(PyObject *, 0); ! nremaining = saved_ob_size; if (nremaining < 2) goto succeed; *************** *** 1670,1674 **** * and extending short natural runs to minrun elements. */ ! lo = self->ob_item; hi = lo + nremaining; minrun = merge_compute_minrun(nremaining); --- 1677,1681 ---- * and extending short natural runs to minrun elements. */ ! lo = saved_ob_item; hi = lo + nremaining; minrun = merge_compute_minrun(nremaining); *************** *** 1707,1717 **** goto fail; assert(ms.n == 1); ! assert(ms.pending[0].base == self->ob_item); ! assert(ms.pending[0].len == self->ob_size); succeed: result = Py_None; fail: ! self->ob_type = savetype; merge_freemem(&ms); Py_XINCREF(result); --- 1714,1736 ---- goto fail; assert(ms.n == 1); ! assert(ms.pending[0].base == saved_ob_item); ! assert(ms.pending[0].len == saved_ob_size); succeed: result = Py_None; fail: ! if (self->ob_item != empty_ob_item || self->ob_size) { ! /* The user mucked with the list during the sort. */ ! (void)list_ass_slice(self, 0, self->ob_size, (PyObject *)NULL); ! if (result != NULL) { ! PyErr_SetString(PyExc_ValueError, ! "list modified during sort"); ! result = NULL; ! } ! } ! if (self->ob_item == empty_ob_item) ! PyMem_FREE(empty_ob_item); ! self->ob_size = saved_ob_size; ! self->ob_item = saved_ob_item; merge_freemem(&ms); Py_XINCREF(result); *************** *** 2326,2415 **** PyType_GenericNew, /* tp_new */ PyObject_GC_Del, /* tp_free */ - }; - - - /* During a sort, we really can't have anyone modifying the list; it could - cause core dumps. Thus, we substitute a dummy type that raises an - explanatory exception when a modifying operation is used. Caveat: - comparisons may behave differently; but I guess it's a bad idea anyway to - compare a list that's being sorted... */ - - static PyObject * - immutable_list_op(void) - { - PyErr_SetString(PyExc_TypeError, - "a list cannot be modified while it is being sorted"); - return NULL; - } - - static PyMethodDef immutable_list_methods[] = { - {"append", (PyCFunction)immutable_list_op, METH_VARARGS}, - {"insert", (PyCFunction)immutable_list_op, METH_VARARGS}, - {"extend", (PyCFunction)immutable_list_op, METH_O}, - {"pop", (PyCFunction)immutable_list_op, METH_VARARGS}, - {"remove", (PyCFunction)immutable_list_op, METH_VARARGS}, - {"index", (PyCFunction)listindex, METH_O}, - {"count", (PyCFunction)listcount, METH_O}, - {"reverse", (PyCFunction)immutable_list_op, METH_VARARGS}, - {"sort", (PyCFunction)immutable_list_op, METH_VARARGS}, - {NULL, NULL} /* sentinel */ - }; - - static int - immutable_list_ass(void) - { - immutable_list_op(); - return -1; - } - - static PySequenceMethods immutable_list_as_sequence = { - (inquiry)list_length, /* sq_length */ - (binaryfunc)list_concat, /* sq_concat */ - (intargfunc)list_repeat, /* sq_repeat */ - (intargfunc)list_item, /* sq_item */ - (intintargfunc)list_slice, /* sq_slice */ - (intobjargproc)immutable_list_ass, /* sq_ass_item */ - (intintobjargproc)immutable_list_ass, /* sq_ass_slice */ - (objobjproc)list_contains, /* sq_contains */ - }; - - static PyTypeObject immutable_list_type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, - "list (immutable, during sort)", - sizeof(PyListObject), - 0, - 0, /* Cannot happen */ /* tp_dealloc */ - (printfunc)list_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* Won't be called */ /* tp_compare */ - (reprfunc)list_repr, /* tp_repr */ - 0, /* tp_as_number */ - &immutable_list_as_sequence, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - list_nohash, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - list_doc, /* tp_doc */ - (traverseproc)list_traverse, /* tp_traverse */ - 0, /* tp_clear */ - list_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - immutable_list_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_init */ - /* NOTE: This is *not* the standard list_type struct! */ }; --- 2345,2348 ---- From fdrake@users.sourceforge.net Tue Nov 12 22:19:37 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 12 Nov 2002 14:19:37 -0800 Subject: [Python-checkins] python/dist/src/Tools/webchecker webchecker.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/webchecker In directory usw-pr-cvs1:/tmp/cvs-serv29984 Modified Files: webchecker.py Log Message: Handle the Content-Type header a little more appropriately: if it contains options, drop them to get the major/minor content type. Modified from the supplied patch to support more whitespace variation. Closes SF patch #613605. Index: webchecker.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/webchecker.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** webchecker.py 11 Sep 2002 20:36:02 -0000 1.28 --- webchecker.py 12 Nov 2002 22:19:34 -0000 1.29 *************** *** 545,548 **** --- 545,551 ---- if info.has_key('content-type'): ctype = cgi.parse_header(info['content-type'])[0].lower() + if ';' in ctype: + # handle content-type: text/html; charset=iso8859-1 : + ctype = ctype.split(';', 1)[0].strip() else: if url[-1:] == "/": From fdrake@users.sourceforge.net Tue Nov 12 22:21:03 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 12 Nov 2002 14:21:03 -0800 Subject: [Python-checkins] python/dist/src/Tools/webchecker webchecker.py,1.25.6.1,1.25.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/webchecker In directory usw-pr-cvs1:/tmp/cvs-serv30979 Modified Files: Tag: release22-maint webchecker.py Log Message: Handle the Content-Type header a little more appropriately: if it contains options, drop them to get the major/minor content type. Modified from the supplied patch to support more whitespace variation. Closes SF patch #613605. Index: webchecker.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/webchecker.py,v retrieving revision 1.25.6.1 retrieving revision 1.25.6.2 diff -C2 -d -r1.25.6.1 -r1.25.6.2 *** webchecker.py 11 Mar 2002 10:04:07 -0000 1.25.6.1 --- webchecker.py 12 Nov 2002 22:21:01 -0000 1.25.6.2 *************** *** 545,548 **** --- 545,551 ---- if info.has_key('content-type'): ctype = string.lower(info['content-type']) + if ';' in ctype: + # handle content-type: text/html; charset=iso8859-1 : + ctype = ctype.split(';', 1)[0].strip() else: if url[-1:] == "/": From nnorwitz@users.sourceforge.net Tue Nov 12 23:01:14 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 12 Nov 2002 15:01:14 -0800 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.195,2.196 unicodeobject.c,2.173,2.174 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23060/Objects Modified Files: stringobject.c unicodeobject.c Log Message: Fix SF # 635969, No error "not all arguments converted" When mwh added extended slicing, strings and unicode became mappings. Thus, dict was set which prevented an error when doing: newstr = 'format without a percent' % string_value This fix raises an exception again when there are no formats and % with a string value. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.195 retrieving revision 2.196 diff -C2 -d -r2.195 -r2.196 *** stringobject.c 11 Oct 2002 05:37:59 -0000 2.195 --- stringobject.c 12 Nov 2002 23:01:11 -0000 2.196 *************** *** 3623,3627 **** argidx = -2; } ! if (args->ob_type->tp_as_mapping && !PyTuple_Check(args)) dict = args; while (--fmtcnt >= 0) { --- 3623,3628 ---- argidx = -2; } ! if (args->ob_type->tp_as_mapping && !PyTuple_Check(args) && ! !PyObject_TypeCheck(args, &PyBaseString_Type)) dict = args; while (--fmtcnt >= 0) { Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.173 retrieving revision 2.174 diff -C2 -d -r2.173 -r2.174 *** unicodeobject.c 23 Oct 2002 09:02:46 -0000 2.173 --- unicodeobject.c 12 Nov 2002 23:01:11 -0000 2.174 *************** *** 6182,6186 **** argidx = -2; } ! if (args->ob_type->tp_as_mapping && !PyTuple_Check(args)) dict = args; --- 6182,6187 ---- argidx = -2; } ! if (args->ob_type->tp_as_mapping && !PyTuple_Check(args) && ! !PyObject_TypeCheck(args, &PyBaseString_Type)) dict = args; From nnorwitz@users.sourceforge.net Tue Nov 12 23:01:14 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 12 Nov 2002 15:01:14 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_format.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23060/Lib/test Modified Files: test_format.py Log Message: Fix SF # 635969, No error "not all arguments converted" When mwh added extended slicing, strings and unicode became mappings. Thus, dict was set which prevented an error when doing: newstr = 'format without a percent' % string_value This fix raises an exception again when there are no formats and % with a string value. Index: test_format.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_format.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_format.py 11 Oct 2002 13:46:32 -0000 1.17 --- test_format.py 12 Nov 2002 23:01:12 -0000 1.18 *************** *** 222,225 **** --- 222,233 ---- test_exc('%d', '1', TypeError, "int argument required") test_exc('%g', '1', TypeError, "float argument required") + test_exc('no format', '1', TypeError, + "not all arguments converted during string formatting") + test_exc('no format', u'1', TypeError, + "not all arguments converted during string formatting") + test_exc(u'no format', '1', TypeError, + "not all arguments converted during string formatting") + test_exc(u'no format', u'1', TypeError, + "not all arguments converted during string formatting") if sys.maxint == 2**32-1: From nnorwitz@users.sourceforge.net Tue Nov 12 23:09:14 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 12 Nov 2002 15:09:14 -0800 Subject: [Python-checkins] python/dist/src/Tools/freeze modulefinder.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/freeze In directory usw-pr-cvs1:/tmp/cvs-serv28771/Tools/freeze Modified Files: modulefinder.py Log Message: SF # 627900, Bytecode copy bug in freeze Pass co_freevars and co_cellvars to new.code(). Will backport. Index: modulefinder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/modulefinder.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** modulefinder.py 11 Sep 2002 20:36:00 -0000 1.20 --- modulefinder.py 12 Nov 2002 23:09:12 -0000 1.21 *************** *** 434,438 **** co.co_flags, co.co_code, tuple(consts), co.co_names, co.co_varnames, new_filename, co.co_name, ! co.co_firstlineno, co.co_lnotab) --- 434,439 ---- co.co_flags, co.co_code, tuple(consts), co.co_names, co.co_varnames, new_filename, co.co_name, ! co.co_firstlineno, co.co_lnotab, ! co.co_freevars, co.co_cellvars) From nnorwitz@users.sourceforge.net Tue Nov 12 23:10:34 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 12 Nov 2002 15:10:34 -0800 Subject: [Python-checkins] python/dist/src/Tools/freeze modulefinder.py,1.18,1.18.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/freeze In directory usw-pr-cvs1:/tmp/cvs-serv30369/Tools/freeze Modified Files: Tag: release22-maint modulefinder.py Log Message: SF # 627900, Bytecode copy bug in freeze Pass co_freevars and co_cellvars to new.code(). Index: modulefinder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/modulefinder.py,v retrieving revision 1.18 retrieving revision 1.18.10.1 diff -C2 -d -r1.18 -r1.18.10.1 *** modulefinder.py 18 Oct 2001 19:15:32 -0000 1.18 --- modulefinder.py 12 Nov 2002 23:10:31 -0000 1.18.10.1 *************** *** 435,439 **** co.co_flags, co.co_code, tuple(consts), co.co_names, co.co_varnames, new_filename, co.co_name, ! co.co_firstlineno, co.co_lnotab) --- 435,440 ---- co.co_flags, co.co_code, tuple(consts), co.co_names, co.co_varnames, new_filename, co.co_name, ! co.co_firstlineno, co.co_lnotab, ! co.co_freevars, co.co_cellvars) From fdrake@users.sourceforge.net Tue Nov 12 23:12:56 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 12 Nov 2002 15:12:56 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.90,1.91 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv31850 Modified Files: libre.tex Log Message: Clarified meaning of \w and \W with respect to the UNICODE and LOCALE flags. Closes SF bug #635595. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** libre.tex 30 Oct 2002 21:03:28 -0000 1.90 --- libre.tex 12 Nov 2002 23:12:54 -0000 1.91 *************** *** 348,355 **** \item[\code{\e w}]When the \constant{LOCALE} and \constant{UNICODE} ! flags are not specified, ! matches any alphanumeric character; this is equivalent to the set \regexp{[a-zA-Z0-9_]}. With \constant{LOCALE}, it will match the set ! \regexp{[0-9_]} plus whatever characters are defined as letters for the current locale. If \constant{UNICODE} is set, this will match the characters \regexp{[0-9_]} plus whatever is classified as alphanumeric --- 348,355 ---- \item[\code{\e w}]When the \constant{LOCALE} and \constant{UNICODE} ! flags are not specified, matches any alphanumeric character and the ! underscore; this is equivalent to the set \regexp{[a-zA-Z0-9_]}. With \constant{LOCALE}, it will match the set ! \regexp{[0-9_]} plus whatever characters are defined as alphanumeric for the current locale. If \constant{UNICODE} is set, this will match the characters \regexp{[0-9_]} plus whatever is classified as alphanumeric *************** *** 360,366 **** is equivalent to the set \regexp{[{\textasciicircum}a-zA-Z0-9_]}. With \constant{LOCALE}, it will match any character not in the set ! \regexp{[0-9_]}, and not defined as a letter for the current locale. If \constant{UNICODE} is set, this will match anything other than ! \regexp{[0-9_]} and characters marked at alphanumeric in the Unicode character properties database. --- 360,366 ---- is equivalent to the set \regexp{[{\textasciicircum}a-zA-Z0-9_]}. With \constant{LOCALE}, it will match any character not in the set ! \regexp{[0-9_]}, and not defined as alphanumeric for the current locale. If \constant{UNICODE} is set, this will match anything other than ! \regexp{[0-9_]} and characters marked as alphanumeric in the Unicode character properties database. From fdrake@users.sourceforge.net Tue Nov 12 23:13:43 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 12 Nov 2002 15:13:43 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.73.6.10,1.73.6.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv32255 Modified Files: Tag: release22-maint libre.tex Log Message: Clarified meaning of \w and \W with respect to the UNICODE and LOCALE flags. Closes SF bug #635595. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.73.6.10 retrieving revision 1.73.6.11 diff -C2 -d -r1.73.6.10 -r1.73.6.11 *** libre.tex 5 Oct 2002 15:25:33 -0000 1.73.6.10 --- libre.tex 12 Nov 2002 23:13:40 -0000 1.73.6.11 *************** *** 357,364 **** \item[\code{\e w}]When the \constant{LOCALE} and \constant{UNICODE} ! flags are not specified, ! matches any alphanumeric character; this is equivalent to the set \regexp{[a-zA-Z0-9_]}. With \constant{LOCALE}, it will match the set ! \regexp{[0-9_]} plus whatever characters are defined as letters for the current locale. If \constant{UNICODE} is set, this will match the characters \regexp{[0-9_]} plus whatever is classified as alphanumeric --- 357,364 ---- \item[\code{\e w}]When the \constant{LOCALE} and \constant{UNICODE} ! flags are not specified, matches any alphanumeric character and the ! underscore; this is equivalent to the set \regexp{[a-zA-Z0-9_]}. With \constant{LOCALE}, it will match the set ! \regexp{[0-9_]} plus whatever characters are defined as alphanumeric for the current locale. If \constant{UNICODE} is set, this will match the characters \regexp{[0-9_]} plus whatever is classified as alphanumeric *************** *** 369,375 **** is equivalent to the set \regexp{[{\textasciicircum}a-zA-Z0-9_]}. With \constant{LOCALE}, it will match any character not in the set ! \regexp{[0-9_]}, and not defined as a letter for the current locale. If \constant{UNICODE} is set, this will match anything other than ! \regexp{[0-9_]} and characters marked at alphanumeric in the Unicode character properties database. --- 369,375 ---- is equivalent to the set \regexp{[{\textasciicircum}a-zA-Z0-9_]}. With \constant{LOCALE}, it will match any character not in the set ! \regexp{[0-9_]}, and not defined as alphanumeric for the current locale. If \constant{UNICODE} is set, this will match anything other than ! \regexp{[0-9_]} and characters marked as alphanumeric in the Unicode character properties database. From nnorwitz@users.sourceforge.net Tue Nov 12 23:21:18 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 12 Nov 2002 15:21:18 -0800 Subject: [Python-checkins] python/dist/src/Tools/freeze modulefinder.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/freeze In directory usw-pr-cvs1:/tmp/cvs-serv3848/Tools/freeze Modified Files: modulefinder.py Log Message: Fix SF # 464405, freeze doesn't like DOS files on Linux Use universal newline support when opening a file for freezing. Index: modulefinder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/modulefinder.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** modulefinder.py 12 Nov 2002 23:09:12 -0000 1.21 --- modulefinder.py 12 Nov 2002 23:21:15 -0000 1.22 *************** *** 117,121 **** def run_script(self, pathname): self.msg(2, "run_script", pathname) ! fp = open(pathname) stuff = ("", "r", imp.PY_SOURCE) self.load_module('__main__', fp, pathname, stuff) --- 117,121 ---- def run_script(self, pathname): self.msg(2, "run_script", pathname) ! fp = open(pathname, "U") stuff = ("", "r", imp.PY_SOURCE) self.load_module('__main__', fp, pathname, stuff) *************** *** 124,128 **** dir, name = os.path.split(pathname) name, ext = os.path.splitext(name) ! fp = open(pathname) stuff = (ext, "r", imp.PY_SOURCE) self.load_module(name, fp, pathname, stuff) --- 124,128 ---- dir, name = os.path.split(pathname) name, ext = os.path.splitext(name) ! fp = open(pathname, "U") stuff = (ext, "r", imp.PY_SOURCE) self.load_module(name, fp, pathname, stuff) From goodger@users.sourceforge.net Wed Nov 13 01:36:46 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Tue, 12 Nov 2002 17:36:46 -0800 Subject: [Python-checkins] python/nondist/peps pep2html.py,1.49,1.50 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv15470 Modified Files: pep2html.py Log Message: updated Index: pep2html.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** pep2html.py 12 Nov 2002 05:36:09 -0000 1.49 --- pep2html.py 13 Nov 2002 01:36:44 -0000 1.50 *************** *** 23,28 **** -l/--local ! Same as -i/--install, except run on the local machine. Use this when ! logged in to the python.org machine (creosote). -q/--quiet --- 23,28 ---- -l/--local ! Same as -i/--install, except install on the local machine. Use this ! when logged in to the python.org machine (creosote). -q/--quiet From goodger@users.sourceforge.net Wed Nov 13 01:37:04 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Tue, 12 Nov 2002 17:37:04 -0800 Subject: [Python-checkins] python/nondist/peps pep-html-template,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv15639 Modified Files: pep-html-template Log Message: conform to XHTML spec Index: pep-html-template =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-html-template,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-html-template 12 Nov 2002 05:36:09 -0000 1.6 --- pep-html-template 13 Nov 2002 01:37:02 -0000 1.7 *************** *** 1,5 **** ! ! its Closes SF bug #637810. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.73.6.11 retrieving revision 1.73.6.12 diff -C2 -d -r1.73.6.11 -r1.73.6.12 *** libre.tex 12 Nov 2002 23:13:40 -0000 1.73.6.11 --- libre.tex 13 Nov 2002 15:53:23 -0000 1.73.6.12 *************** *** 388,392 **** Note that octal escapes are not included. While the parser can ! attempt to determine whether a character is being specified by it's ordinal value expressed in octal, doing so yields an expression which is relatively difficult to maintain, as the same syntax is used to --- 388,392 ---- Note that octal escapes are not included. While the parser can ! attempt to determine whether a character is being specified by its ordinal value expressed in octal, doing so yields an expression which is relatively difficult to maintain, as the same syntax is used to Index: xmldom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmldom.tex,v retrieving revision 1.19.6.1 retrieving revision 1.19.6.2 diff -C2 -d -r1.19.6.1 -r1.19.6.2 *** xmldom.tex 11 Sep 2002 22:04:51 -0000 1.19.6.1 --- xmldom.tex 13 Nov 2002 15:53:23 -0000 1.19.6.2 *************** *** 374,378 **** A \class{NodeList} represents a sequence of nodes. These objects are used in two ways in the DOM Core recommendation: the ! \class{Element} objects provides one as it's list of child nodes, and the \method{getElementsByTagName()} and \method{getElementsByTagNameNS()} methods of \class{Node} return --- 374,378 ---- A \class{NodeList} represents a sequence of nodes. These objects are used in two ways in the DOM Core recommendation: the ! \class{Element} objects provides one as its list of child nodes, and the \method{getElementsByTagName()} and \method{getElementsByTagNameNS()} methods of \class{Node} return From fdrake@users.sourceforge.net Wed Nov 13 15:56:15 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 13 Nov 2002 07:56:15 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib xmldom.tex,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv28148/lib Modified Files: xmldom.tex Log Message: Typo: it's --> its Closes SF bug #637810. Index: xmldom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmldom.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** xmldom.tex 11 Sep 2002 22:03:47 -0000 1.21 --- xmldom.tex 13 Nov 2002 15:56:13 -0000 1.22 *************** *** 374,378 **** A \class{NodeList} represents a sequence of nodes. These objects are used in two ways in the DOM Core recommendation: the ! \class{Element} objects provides one as it's list of child nodes, and the \method{getElementsByTagName()} and \method{getElementsByTagNameNS()} methods of \class{Node} return --- 374,378 ---- A \class{NodeList} represents a sequence of nodes. These objects are used in two ways in the DOM Core recommendation: the ! \class{Element} objects provides one as its list of child nodes, and the \method{getElementsByTagName()} and \method{getElementsByTagNameNS()} methods of \class{Node} return From gvanrossum@users.sourceforge.net Wed Nov 13 16:15:19 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 13 Nov 2002 08:15:19 -0800 Subject: [Python-checkins] python/dist/src/Lib/logging - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Lib/logging In directory usw-pr-cvs1:/tmp/cvs-serv20966/logging Log Message: Directory /cvsroot/python/python/dist/src/Lib/logging added to the repository From gvanrossum@users.sourceforge.net Wed Nov 13 16:16:00 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 13 Nov 2002 08:16:00 -0800 Subject: [Python-checkins] python/dist/src/Lib/logging __init__.py,NONE,1.1 config.py,NONE,1.1 handlers.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/logging In directory usw-pr-cvs1:/tmp/cvs-serv21508 Added Files: __init__.py config.py handlers.py Log Message: Adding Vinay Sajip's logging package. --- NEW FILE: __init__.py --- #! /usr/bin/env python # # Copyright 2001-2002 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permission notice appear in # supporting documentation, and that the name of Vinay Sajip # not be used in advertising or publicity pertaining to distribution # of the software without specific, written prior permission. # VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING # ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL # VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR # ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER # IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # For the change history, see README.txt in the distribution. [...1144 lines suppressed...] def disable(level): """ Disable all logging calls less severe than 'level'. """ root.manager.disable = level def shutdown(): """ Perform any cleanup actions in the logging system (e.g. flushing buffers). Should be called at application exit. """ for h in _handlers.keys(): h.flush() h.close() if __name__ == "__main__": print __doc__ --- NEW FILE: config.py --- #! /usr/bin/env python # # Copyright 2001-2002 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permission notice appear in # supporting documentation, and that the name of Vinay Sajip # not be used in advertising or publicity pertaining to distribution # of the software without specific, written prior permission. # VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING # ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL # VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR # ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER # IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # For the change history, see README.txt in the distribution. # # This file is part of the Python logging distribution. See # http://www.red-dove.com/python_logging.html # """ Logging package for Python. Based on PEP 282 and comments thereto in comp.lang.python, and influenced by Apache's log4j system. Should work under Python versions >= 1.5.2, except that source line information is not available unless 'inspect' is. Copyright (C) 2001-2002 Vinay Sajip. All Rights Reserved. To use, simply 'import logging' and log away! """ import sys, logging, logging.handlers, string, thread, threading, socket, struct, os from SocketServer import ThreadingTCPServer, StreamRequestHandler DEFAULT_LOGGING_CONFIG_PORT = 9030 # # The following code implements a socket listener for on-the-fly # reconfiguration of logging. # # _listener holds the server object doing the listening _listener = None def fileConfig(fname): """ Read the logging configuration from a ConfigParser-format file. This can be called several times from an application, allowing an end user the ability to select from various pre-canned configurations (if the developer provides a mechanism to present the choices and load the chosen configuration). In versions of ConfigParser which have the readfp method [typically shipped in 2.x versions of Python], you can pass in a file-like object rather than a filename, in which case the file-like object will be read using readfp. """ import ConfigParser cp = ConfigParser.ConfigParser() if hasattr(cp, 'readfp') and hasattr(fname, 'readline'): cp.readfp(fname) else: cp.read(fname) #first, do the formatters... flist = cp.get("formatters", "keys") if len(flist): flist = string.split(flist, ",") formatters = {} for form in flist: sectname = "formatter_%s" % form opts = cp.options(sectname) if "format" in opts: fs = cp.get(sectname, "format", 1) else: fs = None if "datefmt" in opts: dfs = cp.get(sectname, "datefmt", 1) else: dfs = None f = logging.Formatter(fs, dfs) formatters[form] = f #next, do the handlers... #critical section... logging._acquireLock() try: try: #first, lose the existing handlers... logging._handlers.clear() #now set up the new ones... hlist = cp.get("handlers", "keys") if len(hlist): hlist = string.split(hlist, ",") handlers = {} fixups = [] #for inter-handler references for hand in hlist: sectname = "handler_%s" % hand klass = cp.get(sectname, "class") opts = cp.options(sectname) if "formatter" in opts: fmt = cp.get(sectname, "formatter") else: fmt = "" klass = eval(klass, vars(logging)) args = cp.get(sectname, "args") args = eval(args, vars(logging)) h = apply(klass, args) if "level" in opts: level = cp.get(sectname, "level") h.setLevel(logging._levelNames[level]) if len(fmt): h.setFormatter(formatters[fmt]) #temporary hack for FileHandler and MemoryHandler. if klass == logging.handlers.MemoryHandler: if "target" in opts: target = cp.get(sectname,"target") else: target = "" if len(target): #the target handler may not be loaded yet, so keep for later... fixups.append((h, target)) handlers[hand] = h #now all handlers are loaded, fixup inter-handler references... for fixup in fixups: h = fixup[0] t = fixup[1] h.setTarget(handlers[t]) #at last, the loggers...first the root... llist = cp.get("loggers", "keys") llist = string.split(llist, ",") llist.remove("root") sectname = "logger_root" root = logging.root log = root opts = cp.options(sectname) if "level" in opts: level = cp.get(sectname, "level") log.setLevel(logging._levelNames[level]) for h in root.handlers: root.removeHandler(h) hlist = cp.get(sectname, "handlers") if len(hlist): hlist = string.split(hlist, ",") for hand in hlist: log.addHandler(handlers[hand]) #and now the others... #we don't want to lose the existing loggers, #since other threads may have pointers to them. #existing is set to contain all existing loggers, #and as we go through the new configuration we #remove any which are configured. At the end, #what's left in existing is the set of loggers #which were in the previous configuration but #which are not in the new configuration. existing = root.manager.loggerDict.keys() #now set up the new ones... for log in llist: sectname = "logger_%s" % log qn = cp.get(sectname, "qualname") opts = cp.options(sectname) if "propagate" in opts: propagate = cp.getint(sectname, "propagate") else: propagate = 1 logger = logging.getLogger(qn) if qn in existing: existing.remove(qn) if "level" in opts: level = cp.get(sectname, "level") logger.setLevel(logging._levelNames[level]) for h in logger.handlers: logger.removeHandler(h) logger.propagate = propagate logger.disabled = 0 hlist = cp.get(sectname, "handlers") if len(hlist): hlist = string.split(hlist, ",") for hand in hlist: logger.addHandler(handlers[hand]) #Disable any old loggers. There's no point deleting #them as other threads may continue to hold references #and by disabling them, you stop them doing any logging. for log in existing: root.manager.loggerDict[log].disabled = 1 except: import traceback ei = sys.exc_info() traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr) del ei finally: logging._releaseLock() def listen(port=DEFAULT_LOGGING_CONFIG_PORT): """ Start up a socket server on the specified port, and listen for new configurations. These will be sent as a file suitable for processing by fileConfig(). Returns a Thread object on which you can call start() to start the server, and which you can join() when appropriate. To stop the server, call stopListening(). """ if not thread: raise NotImplementedError, "listen() needs threading to work" class ConfigStreamHandler(StreamRequestHandler): """ Handler for a logging configuration request. It expects a completely new logging configuration and uses fileConfig to install it. """ def handle(self): """ Handle a request. Each request is expected to be a 4-byte length, followed by the config file. Uses fileConfig() to do the grunt work. """ import tempfile try: conn = self.connection chunk = conn.recv(4) if len(chunk) == 4: slen = struct.unpack(">L", chunk)[0] chunk = self.connection.recv(slen) while len(chunk) < slen: chunk = chunk + conn.recv(slen - len(chunk)) #Apply new configuration. We'd like to be able to #create a StringIO and pass that in, but unfortunately #1.5.2 ConfigParser does not support reading file #objects, only actual files. So we create a temporary #file and remove it later. file = tempfile.mktemp(".ini") f = open(file, "w") f.write(chunk) f.close() fileConfig(file) os.remove(file) except socket.error, e: if type(e.args) != types.TupleType: raise else: errcode = e.args[0] if errcode != RESET_ERROR: raise class ConfigSocketReceiver(ThreadingTCPServer): """ A simple TCP socket-based logging config receiver. """ allow_reuse_address = 1 def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT, handler=None): ThreadingTCPServer.__init__(self, (host, port), handler) logging._acquireLock() self.abort = 0 logging._releaseLock() self.timeout = 1 def serve_until_stopped(self): import select abort = 0 while not abort: rd, wr, ex = select.select([self.socket.fileno()], [], [], self.timeout) if rd: self.handle_request() logging._acquireLock() abort = self.abort logging._releaseLock() def serve(rcvr, hdlr): server = rcvr(handler=hdlr) global _listener logging._acquireLock() _listener = server logging._releaseLock() server.serve_until_stopped() return threading.Thread(target=serve, args=(ConfigSocketReceiver, ConfigStreamHandler)) def stopListening(): """ Stop the listening server which was created with a call to listen(). """ if _listener: logging._acquireLock() _listener.abort = 1 _listener = None logging._releaseLock() --- NEW FILE: handlers.py --- #! /usr/bin/env python # # Copyright 2001-2002 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permission notice appear in # supporting documentation, and that the name of Vinay Sajip # not be used in advertising or publicity pertaining to distribution # of the software without specific, written prior permission. # VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING # ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL # VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR # ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER # IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # # For the change history, see README.txt in the distribution. # # This file is part of the Python logging distribution. See # http://www.red-dove.com/python_logging.html # """ Logging package for Python. Based on PEP 282 and comments thereto in comp.lang.python, and influenced by Apache's log4j system. Should work under Python versions >= 1.5.2, except that source line information is not available unless 'inspect' is. Copyright (C) 2001-2002 Vinay Sajip. All Rights Reserved. To use, simply 'import logging' and log away! """ import sys, logging, socket, types, os, string, cPickle, struct from SocketServer import ThreadingTCPServer, StreamRequestHandler # # Some constants... # DEFAULT_TCP_LOGGING_PORT = 9020 DEFAULT_UDP_LOGGING_PORT = 9021 DEFAULT_HTTP_LOGGING_PORT = 9022 DEFAULT_SOAP_LOGGING_PORT = 9023 SYSLOG_UDP_PORT = 514 class RotatingFileHandler(logging.FileHandler): def __init__(self, filename, mode="a", maxBytes=0, backupCount=0): """ Open the specified file and use it as the stream for logging. By default, the file grows indefinitely. You can specify particular values of maxBytes and backupCount to allow the file to rollover at a predetermined size. Rollover occurs whenever the current log file is nearly maxBytes in length. If backupCount is >= 1, the system will successively create new files with the same pathname as the base file, but with extensions ".1", ".2" etc. appended to it. For example, with a backupCount of 5 and a base file name of "app.log", you would get "app.log", "app.log.1", "app.log.2", ... through to "app.log.5". The file being written to is always "app.log" - when it gets filled up, it is closed and renamed to "app.log.1", and if files "app.log.1", "app.log.2" etc. exist, then they are renamed to "app.log.2", "app.log.3" etc. respectively. If maxBytes is zero, rollover never occurs. """ logging.FileHandler.__init__(self, filename, mode) self.maxBytes = maxBytes self.backupCount = backupCount if maxBytes > 0: self.mode = "a" def doRollover(self): """ Do a rollover, as described in __init__(). """ self.stream.close() if self.backupCount > 0: for i in range(self.backupCount - 1, 0, -1): sfn = "%s.%d" % (self.baseFilename, i) dfn = "%s.%d" % (self.baseFilename, i + 1) if os.path.exists(sfn): #print "%s -> %s" % (sfn, dfn) if os.path.exists(dfn): os.remove(dfn) os.rename(sfn, dfn) dfn = self.baseFilename + ".1" if os.path.exists(dfn): os.remove(dfn) os.rename(self.baseFilename, dfn) #print "%s -> %s" % (self.baseFilename, dfn) self.stream = open(self.baseFilename, "w") def emit(self, record): """ Emit a record. Output the record to the file, catering for rollover as described in setRollover(). """ if self.maxBytes > 0: # are we rolling over? msg = "%s\n" % self.format(record) #print msg if self.stream.tell() + len(msg) >= self.maxBytes: self.doRollover() logging.FileHandler.emit(self, record) class SocketHandler(logging.Handler): """ A handler class which writes logging records, in pickle format, to a streaming socket. The socket is kept open across logging calls. If the peer resets it, an attempt is made to reconnect on the next call. Note that the very simple wire protocol used means that packet sizes are expected to be encodable within 16 bits (i.e. < 32767 bytes). """ def __init__(self, host, port): """ Initializes the handler with a specific host address and port. The attribute 'closeOnError' is set to 1 - which means that if a socket error occurs, the socket is silently closed and then reopened on the next logging call. """ logging.Handler.__init__(self) self.host = host self.port = port self.sock = None self.closeOnError = 0 def makeSocket(self): """ A factory method which allows subclasses to define the precise type of socket they want. """ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((self.host, self.port)) return s def send(self, s): """ Send a pickled string to the socket. This function allows for partial sends which can happen when the network is busy. """ v = sys.version_info if v[0] >= 2 and v[1] >= 2: self.sock.sendall(s) else: sentsofar = 0 left = len(s) while left > 0: sent = self.sock.send(s[sentsofar:]) sentsofar = sentsofar + sent left = left - sent def makePickle(self, record): """ Pickles the record in binary format with a length prefix, and returns it ready for transmission across the socket. """ s = cPickle.dumps(record.__dict__, 1) #n = len(s) #slen = "%c%c" % ((n >> 8) & 0xFF, n & 0xFF) slen = struct.pack(">L", len(s)) return slen + s def handleError(self): """ Handle an error during logging. An error has occurred during logging. Most likely cause - connection lost. Close the socket so that we can retry on the next event. """ if self.closeOnError and self.sock: self.sock.close() self.sock = None #try to reconnect next time else: logging.Handler.handleError(self) def emit(self, record): """ Emit a record. Pickles the record and writes it to the socket in binary format. If there is an error with the socket, silently drop the packet. If there was a problem with the socket, re-establishes the socket. """ try: s = self.makePickle(record) if not self.sock: self.sock = self.makeSocket() self.send(s) except: self.handleError() def close(self): """ Closes the socket. """ if self.sock: self.sock.close() self.sock = None class DatagramHandler(SocketHandler): """ A handler class which writes logging records, in pickle format, to a datagram socket. Note that the very simple wire protocol used means that packet sizes are expected to be encodable within 16 bits (i.e. < 32767 bytes). """ def __init__(self, host, port): """ Initializes the handler with a specific host address and port. """ SocketHandler.__init__(self, host, port) self.closeOnError = 0 def makeSocket(self): """ The factory method of SocketHandler is here overridden to create a UDP socket (SOCK_DGRAM). """ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) return s def send(self, s): """ Send a pickled string to a socket. This function no longer allows for partial sends which can happen when the network is busy - UDP does not guarantee delivery and can deliver packets out of sequence. """ #old code #sentsofar = 0 #left = len(s) #addr = (self.host, self.port) #while left > 0: # sent = self.sock.sendto(s[sentsofar:], addr) # sentsofar = sentsofar + sent # left = left - sent self.sock.sendto(s, (self.host, self.port)) class SysLogHandler(logging.Handler): """ A handler class which sends formatted logging records to a syslog server. Based on Sam Rushing's syslog module: http://www.nightmare.com/squirl/python-ext/misc/syslog.py Contributed by Nicolas Untz (after which minor refactoring changes have been made). """ # from : # ====================================================================== # priorities/facilities are encoded into a single 32-bit quantity, where # the bottom 3 bits are the priority (0-7) and the top 28 bits are the # facility (0-big number). Both the priorities and the facilities map # roughly one-to-one to strings in the syslogd(8) source code. This # mapping is included in this file. # # priorities (these are ordered) LOG_EMERG = 0 # system is unusable LOG_ALERT = 1 # action must be taken immediately LOG_CRIT = 2 # critical conditions LOG_ERR = 3 # error conditions LOG_WARNING = 4 # warning conditions LOG_NOTICE = 5 # normal but significant condition LOG_INFO = 6 # informational LOG_DEBUG = 7 # debug-level messages # facility codes LOG_KERN = 0 # kernel messages LOG_USER = 1 # random user-level messages LOG_MAIL = 2 # mail system LOG_DAEMON = 3 # system daemons LOG_AUTH = 4 # security/authorization messages LOG_SYSLOG = 5 # messages generated internally by syslogd LOG_LPR = 6 # line printer subsystem LOG_NEWS = 7 # network news subsystem LOG_UUCP = 8 # UUCP subsystem LOG_CRON = 9 # clock daemon LOG_AUTHPRIV = 10 # security/authorization messages (private) # other codes through 15 reserved for system use LOG_LOCAL0 = 16 # reserved for local use LOG_LOCAL1 = 17 # reserved for local use LOG_LOCAL2 = 18 # reserved for local use LOG_LOCAL3 = 19 # reserved for local use LOG_LOCAL4 = 20 # reserved for local use LOG_LOCAL5 = 21 # reserved for local use LOG_LOCAL6 = 22 # reserved for local use LOG_LOCAL7 = 23 # reserved for local use priority_names = { "alert": LOG_ALERT, "crit": LOG_CRIT, "critical": LOG_CRIT, "debug": LOG_DEBUG, "emerg": LOG_EMERG, "err": LOG_ERR, "error": LOG_ERR, # DEPRECATED "info": LOG_INFO, "notice": LOG_NOTICE, "panic": LOG_EMERG, # DEPRECATED "warn": LOG_WARNING, # DEPRECATED "warning": LOG_WARNING, } facility_names = { "auth": LOG_AUTH, "authpriv": LOG_AUTHPRIV, "cron": LOG_CRON, "daemon": LOG_DAEMON, "kern": LOG_KERN, "lpr": LOG_LPR, "mail": LOG_MAIL, "news": LOG_NEWS, "security": LOG_AUTH, # DEPRECATED "syslog": LOG_SYSLOG, "user": LOG_USER, "uucp": LOG_UUCP, "local0": LOG_LOCAL0, "local1": LOG_LOCAL1, "local2": LOG_LOCAL2, "local3": LOG_LOCAL3, "local4": LOG_LOCAL4, "local5": LOG_LOCAL5, "local6": LOG_LOCAL6, "local7": LOG_LOCAL7, } def __init__(self, address=('localhost', SYSLOG_UDP_PORT), facility=LOG_USER): """ Initialize a handler. If address is specified as a string, UNIX socket is used. If facility is not specified, LOG_USER is used. """ logging.Handler.__init__(self) self.address = address self.facility = facility if type(address) == types.StringType: self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) self.socket.connect(address) self.unixsocket = 1 else: self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.unixsocket = 0 self.formatter = None # curious: when talking to the unix-domain '/dev/log' socket, a # zero-terminator seems to be required. this string is placed # into a class variable so that it can be overridden if # necessary. log_format_string = '<%d>%s\000' def encodePriority (self, facility, priority): """ Encode the facility and priority. You can pass in strings or integers - if strings are passed, the facility_names and priority_names mapping dictionaries are used to convert them to integers. """ if type(facility) == types.StringType: facility = self.facility_names[facility] if type(priority) == types.StringType: priority = self.priority_names[priority] return (facility << 3) | priority def close (self): """ Closes the socket. """ if self.unixsocket: self.socket.close() def emit(self, record): """ Emit a record. The record is formatted, and then sent to the syslog server. If exception information is present, it is NOT sent to the server. """ msg = self.format(record) """ We need to convert record level to lowercase, maybe this will change in the future. """ msg = self.log_format_string % ( self.encodePriority(self.facility, string.lower(record.levelname)), msg) try: if self.unixsocket: self.socket.send(msg) else: self.socket.sendto(msg, self.address) except: self.handleError() class SMTPHandler(logging.Handler): """ A handler class which sends an SMTP email for each logging event. """ def __init__(self, mailhost, fromaddr, toaddrs, subject): """ Initialize the handler. Initialize the instance with the from and to addresses and subject line of the email. To specify a non-standard SMTP port, use the (host, port) tuple format for the mailhost argument. """ logging.Handler.__init__(self) if type(mailhost) == types.TupleType: host, port = mailhost self.mailhost = host self.mailport = port else: self.mailhost = mailhost self.mailport = None self.fromaddr = fromaddr self.toaddrs = toaddrs self.subject = subject def getSubject(self, record): """ Determine the subject for the email. If you want to specify a subject line which is record-dependent, override this method. """ return self.subject def emit(self, record): """ Emit a record. Format the record and send it to the specified addressees. """ try: import smtplib port = self.mailport if not port: port = smtplib.SMTP_PORT smtp = smtplib.SMTP(self.mailhost, port) msg = self.format(record) msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s" % ( self.fromaddr, string.join(self.toaddrs, ","), self.getSubject(record), msg ) smtp.sendmail(self.fromaddr, self.toaddrs, msg) smtp.quit() except: self.handleError() class NTEventLogHandler(logging.Handler): """ A handler class which sends events to the NT Event Log. Adds a registry entry for the specified application name. If no dllname is provided, win32service.pyd (which contains some basic message placeholders) is used. Note that use of these placeholders will make your event logs big, as the entire message source is held in the log. If you want slimmer logs, you have to pass in the name of your own DLL which contains the message definitions you want to use in the event log. """ def __init__(self, appname, dllname=None, logtype="Application"): logging.Handler.__init__(self) try: import win32evtlogutil, win32evtlog self.appname = appname self._welu = win32evtlogutil if not dllname: dllname = os.path.split(self._welu.__file__) dllname = os.path.split(dllname[0]) dllname = os.path.join(dllname[0], r'win32service.pyd') self.dllname = dllname self.logtype = logtype self._welu.AddSourceToRegistry(appname, dllname, logtype) self.deftype = win32evtlog.EVENTLOG_ERROR_TYPE self.typemap = { logging.DEBUG : win32evtlog.EVENTLOG_INFORMATION_TYPE, logging.INFO : win32evtlog.EVENTLOG_INFORMATION_TYPE, logging.WARN : win32evtlog.EVENTLOG_WARNING_TYPE, logging.ERROR : win32evtlog.EVENTLOG_ERROR_TYPE, logging.CRITICAL: win32evtlog.EVENTLOG_ERROR_TYPE, } except ImportError: print "The Python Win32 extensions for NT (service, event "\ "logging) appear not to be available." self._welu = None def getMessageID(self, record): """ Return the message ID for the event record. If you are using your own messages, you could do this by having the msg passed to the logger being an ID rather than a formatting string. Then, in here, you could use a dictionary lookup to get the message ID. This version returns 1, which is the base message ID in win32service.pyd. """ return 1 def getEventCategory(self, record): """ Return the event category for the record. Override this if you want to specify your own categories. This version returns 0. """ return 0 def getEventType(self, record): """ Return the event type for the record. Override this if you want to specify your own types. This version does a mapping using the handler's typemap attribute, which is set up in __init__() to a dictionary which contains mappings for DEBUG, INFO, WARN, ERROR and CRITICAL. If you are using your own levels you will either need to override this method or place a suitable dictionary in the handler's typemap attribute. """ return self.typemap.get(record.levelno, self.deftype) def emit(self, record): """ Emit a record. Determine the message ID, event category and event type. Then log the message in the NT event log. """ if self._welu: try: id = self.getMessageID(record) cat = self.getEventCategory(record) type = self.getEventType(record) msg = self.format(record) self._welu.ReportEvent(self.appname, id, cat, type, [msg]) except: self.handleError() def close(self): """ Clean up this handler. You can remove the application name from the registry as a source of event log entries. However, if you do this, you will not be able to see the events as you intended in the Event Log Viewer - it needs to be able to access the registry to get the DLL name. """ #self._welu.RemoveSourceFromRegistry(self.appname, self.logtype) pass class HTTPHandler(logging.Handler): """ A class which sends records to a Web server, using either GET or POST semantics. """ def __init__(self, host, url, method="GET"): """ Initialize the instance with the host, the request URL, and the method ("GET" or "POST") """ logging.Handler.__init__(self) method = string.upper(method) if method not in ["GET", "POST"]: raise ValueError, "method must be GET or POST" self.host = host self.url = url self.method = method def emit(self, record): """ Emit a record. Send the record to the Web server as an URL-encoded dictionary """ try: import httplib, urllib h = httplib.HTTP(self.host) url = self.url data = urllib.urlencode(record.__dict__) if self.method == "GET": if (string.find(url, '?') >= 0): sep = '&' else: sep = '?' url = url + "%c%s" % (sep, data) h.putrequest(self.method, url) if self.method == "POST": h.putheader("Content-length", str(len(data))) h.endheaders() if self.method == "POST": h.send(data) h.getreply() #can't do anything with the result except: self.handleError() class BufferingHandler(logging.Handler): """ A handler class which buffers logging records in memory. Whenever each record is added to the buffer, a check is made to see if the buffer should be flushed. If it should, then flush() is expected to do what's needed. """ def __init__(self, capacity): """ Initialize the handler with the buffer size. """ logging.Handler.__init__(self) self.capacity = capacity self.buffer = [] def shouldFlush(self, record): """ Should the handler flush its buffer? Returns true if the buffer is up to capacity. This method can be overridden to implement custom flushing strategies. """ return (len(self.buffer) >= self.capacity) def emit(self, record): """ Emit a record. Append the record. If shouldFlush() tells us to, call flush() to process the buffer. """ self.buffer.append(record) if self.shouldFlush(record): self.flush() def flush(self): """ Override to implement custom flushing behaviour. This version just zaps the buffer to empty. """ self.buffer = [] class MemoryHandler(BufferingHandler): """ A handler class which buffers logging records in memory, periodically flushing them to a target handler. Flushing occurs whenever the buffer is full, or when an event of a certain severity or greater is seen. """ def __init__(self, capacity, flushLevel=logging.ERROR, target=None): """ Initialize the handler with the buffer size, the level at which flushing should occur and an optional target. Note that without a target being set either here or via setTarget(), a MemoryHandler is no use to anyone! """ BufferingHandler.__init__(self, capacity) self.flushLevel = flushLevel self.target = target def shouldFlush(self, record): """ Check for buffer full or a record at the flushLevel or higher. """ return (len(self.buffer) >= self.capacity) or \ (record.levelno >= self.flushLevel) def setTarget(self, target): """ Set the target handler for this handler. """ self.target = target def flush(self): """ For a MemoryHandler, flushing means just sending the buffered records to the target, if there is one. Override if you want different behaviour. """ if self.target: for record in self.buffer: self.target.handle(record) self.buffer = [] def close(self): """ Flush, set the target to None and lose the buffer. """ self.flush() self.target = None self.buffer = [] From gvanrossum@users.sourceforge.net Wed Nov 13 16:18:32 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 13 Nov 2002 08:18:32 -0800 Subject: [Python-checkins] python/dist/src/Lib/logging __init__.py,1.1,1.2 config.py,1.1,1.2 handlers.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/logging In directory usw-pr-cvs1:/tmp/cvs-serv23293 Modified Files: __init__.py config.py handlers.py Log Message: Get rid of #! lines, references to usage as __main__, README.txt, and http://www.red-dove.com/python_logging.html. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 13 Nov 2002 16:15:57 -0000 1.1 --- __init__.py 13 Nov 2002 16:18:29 -0000 1.2 *************** *** 1,4 **** - #! /usr/bin/env python - # # Copyright 2001-2002 by Vinay Sajip. All Rights Reserved. # --- 1,2 ---- *************** *** 16,25 **** # IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - # - # For the change history, see README.txt in the distribution. - # - # This file is part of the Python logging distribution. See - # http://www.red-dove.com/python_logging.html - # """ --- 14,17 ---- *************** *** 59,72 **** #_srcfile is used when walking the stack to check when we've got the first # caller stack frame. ! #If run as a script, __file__ is not bound. ! # ! if __name__ == "__main__": ! _srcfile = None else: ! if string.lower(__file__[-4:]) in ['.pyc', '.pyo']: ! _srcfile = __file__[:-4] + '.py' ! else: ! _srcfile = __file__ ! _srcfile = os.path.normcase(_srcfile) # --- 51,59 ---- #_srcfile is used when walking the stack to check when we've got the first # caller stack frame. ! if string.lower(__file__[-4:]) in ['.pyc', '.pyo']: ! _srcfile = __file__[:-4] + '.py' else: ! _srcfile = __file__ ! _srcfile = os.path.normcase(_srcfile) # *************** *** 1179,1183 **** h.flush() h.close() - - if __name__ == "__main__": - print __doc__ --- 1166,1167 ---- Index: config.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/config.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** config.py 13 Nov 2002 16:15:58 -0000 1.1 --- config.py 13 Nov 2002 16:18:29 -0000 1.2 *************** *** 1,4 **** - #! /usr/bin/env python - # # Copyright 2001-2002 by Vinay Sajip. All Rights Reserved. # --- 1,2 ---- *************** *** 16,25 **** # IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - # - # For the change history, see README.txt in the distribution. - # - # This file is part of the Python logging distribution. See - # http://www.red-dove.com/python_logging.html - # """ --- 14,17 ---- Index: handlers.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/handlers.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** handlers.py 13 Nov 2002 16:15:58 -0000 1.1 --- handlers.py 13 Nov 2002 16:18:29 -0000 1.2 *************** *** 1,4 **** - #! /usr/bin/env python - # # Copyright 2001-2002 by Vinay Sajip. All Rights Reserved. # --- 1,2 ---- *************** *** 16,25 **** # IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - # - # For the change history, see README.txt in the distribution. - # - # This file is part of the Python logging distribution. See - # http://www.red-dove.com/python_logging.html - # """ --- 14,17 ---- From gvanrossum@users.sourceforge.net Wed Nov 13 16:29:21 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 13 Nov 2002 08:29:21 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.520,1.521 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv800 Modified Files: NEWS Log Message: News about the logging module. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.520 retrieving revision 1.521 diff -C2 -d -r1.520 -r1.521 *** NEWS 12 Nov 2002 22:08:09 -0000 1.520 --- NEWS 13 Nov 2002 16:29:18 -0000 1.521 *************** *** 382,385 **** --- 382,388 ---- ------- + - A new package, logging, implements the logging API defined by PEP + 282. The code is written by Vinay Sajip. + - StreamReader, StreamReaderWriter and StreamRecoder in the codecs modules are iterators now. From akuchling@users.sourceforge.net Wed Nov 13 17:03:09 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 13 Nov 2002 09:03:09 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils sysconfig.py,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv25377 Modified Files: sysconfig.py Log Message: Back out part of rev. 1.53, restoring the use of the string module. The two long lines have been reflowed differently; hopefully someone on BeOS can test them. Rev. 1.53 also converted string.atoi() to int(); I've left that alone. Index: sysconfig.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/sysconfig.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** sysconfig.py 5 Nov 2002 20:11:08 -0000 1.53 --- sysconfig.py 13 Nov 2002 17:03:05 -0000 1.54 *************** *** 15,18 **** --- 15,19 ---- import os import re + import string import sys *************** *** 251,255 **** if m: n, v = m.group(1, 2) ! v = v.strip() if "$" in v: notdone[n] = v --- 252,256 ---- if m: n, v = m.group(1, 2) ! v = string.strip(v) if "$" in v: notdone[n] = v *************** *** 274,278 **** try: value = int(value) except ValueError: ! done[name] = value.strip() else: done[name] = value --- 275,279 ---- try: value = int(value) except ValueError: ! done[name] = string.strip(value) else: done[name] = value *************** *** 290,294 **** try: value = int(value) except ValueError: ! done[name] = value.strip() else: done[name] = value --- 291,295 ---- try: value = int(value) except ValueError: ! done[name] = string.strip(value) else: done[name] = value *************** *** 369,373 **** # sense. python_lib = get_python_lib(standard_lib=1) ! linkerscript_name = os.path.basename(g['LDSHARED'].split()[0]) linkerscript = os.path.join(python_lib, 'config', linkerscript_name) --- 370,375 ---- # sense. python_lib = get_python_lib(standard_lib=1) ! linkerscript_path = string.split(g['LDSHARED'])[0] ! linkerscript_name = os.path.basename(linkerscript_path) linkerscript = os.path.join(python_lib, 'config', linkerscript_name) From jhylton@users.sourceforge.net Wed Nov 13 17:27:46 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 13 Nov 2002 09:27:46 -0800 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.67,1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12406 Modified Files: httplib.py Log Message: Fix SF bug #637789: Handle Proxy-Connection header. Also, remove unused local variable noted by pychecker. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** httplib.py 9 Nov 2002 05:08:06 -0000 1.67 --- httplib.py 13 Nov 2002 17:27:43 -0000 1.68 *************** *** 170,174 **** # It's a continuation line. list.append(line) - x = self.dict[headerseen] + "\n " + line.strip() self.addcontinue(headerseen, line.strip()) continue --- 170,173 ---- *************** *** 312,329 **** # will the connection close at the end of the response? ! conn = self.msg.getheader('connection') ! if conn: ! conn = conn.lower() ! # a "Connection: close" will always close the connection. if we ! # don't see that and this is not HTTP/1.1, then the connection will ! # close unless we see a Keep-Alive header. ! self.will_close = conn.find('close') != -1 or \ ! ( self.version != 11 and \ ! not self.msg.getheader('keep-alive') ) ! else: ! # for HTTP/1.1, the connection will always remain open ! # otherwise, it will remain open IFF we see a Keep-Alive header ! self.will_close = self.version != 11 and \ ! not self.msg.getheader('keep-alive') # do we have a Content-Length? --- 311,315 ---- # will the connection close at the end of the response? ! self.will_close = self._check_close() # do we have a Content-Length? *************** *** 351,354 **** --- 337,364 ---- self.length is None: self.will_close = 1 + + def _check_close(self): + if self.version == 11: + # An HTTP/1.1 proxy is assumed to stay open unless + # explicitly closed. + conn = self.msg.getheader('connection') + if conn and conn.lower().find("close") >= 0: + return True + return False + + # An HTTP/1.0 response with a Connection header is probably + # the result of a confused proxy. Ignore it. + + # For older HTTP, Keep-Alive indiciates persistent connection. + if self.msg.getheader('keep-alive'): + return False + + # Proxy-Connection is a netscape hack. + pconn = self.msg.getheader('proxy-connection') + if pconn and pconn.lower().find("keep-alive") >= 0: + return False + + # otherwise, assume it will close + return True def close(self): From jhylton@users.sourceforge.net Wed Nov 13 17:30:35 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 13 Nov 2002 09:30:35 -0800 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14493 Modified Files: httplib.py Log Message: Remove some test code. The buggy yahoo server was fixed, and the opalgroup test files are gone. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** httplib.py 13 Nov 2002 17:27:43 -0000 1.68 --- httplib.py 13 Nov 2002 17:30:32 -0000 1.69 *************** *** 1225,1230 **** for host, selector in (('sourceforge.net', '/projects/python'), - ('dbserv2.theopalgroup.com', '/mediumfile'), - ('dbserv2.theopalgroup.com', '/smallfile'), ): print "https://%s%s" % (host, selector) --- 1225,1228 ---- *************** *** 1242,1276 **** for header in headers.headers: print header.strip() print - - # Test a buggy server -- returns garbled status line. - # http://www.yahoo.com/promotions/mom_com97/supermom.html - c = HTTPConnection("promotions.yahoo.com") - c.set_debuglevel(1) - c.connect() - c.request("GET", "/promotions/mom_com97/supermom.html") - r = c.getresponse() - print r.status, r.version - lines = r.read().split("\n") - print "\n".join(lines[:5]) - - c = HTTPConnection("promotions.yahoo.com", strict=1) - c.set_debuglevel(1) - c.connect() - c.request("GET", "/promotions/mom_com97/supermom.html") - try: - r = c.getresponse() - except BadStatusLine, err: - print "strict mode failed as expected" - print err - else: - print "XXX strict mode should have failed" - - for strict in 0, 1: - h = HTTP(strict=strict) - h.connect("promotions.yahoo.com") - h.putrequest('GET', "/promotions/mom_com97/supermom.html") - h.endheaders() - status, reason, headers = h.getreply() - assert (strict and status == -1) or status == 200, (strict, status) if __name__ == '__main__': --- 1240,1243 ---- From fdrake@users.sourceforge.net Wed Nov 13 17:47:56 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 13 Nov 2002 09:47:56 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.73.6.12,1.73.6.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv27409 Modified Files: Tag: release22-maint libre.tex Log Message: Fix broken markup. Closes SF bug #637807. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.73.6.12 retrieving revision 1.73.6.13 diff -C2 -d -r1.73.6.12 -r1.73.6.13 *** libre.tex 13 Nov 2002 15:53:23 -0000 1.73.6.12 --- libre.tex 13 Nov 2002 17:47:53 -0000 1.73.6.13 *************** *** 794,798 **** \begin{methoddesc}[MatchObject]{start}{\optional{group}} ! \funcline{end}{\optional{group}} Return the indices of the start and end of the substring matched by \var{group}; \var{group} defaults to zero (meaning the whole --- 794,798 ---- \begin{methoddesc}[MatchObject]{start}{\optional{group}} ! \methodline{end}{\optional{group}} Return the indices of the start and end of the substring matched by \var{group}; \var{group} defaults to zero (meaning the whole From fdrake@users.sourceforge.net Wed Nov 13 17:48:17 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 13 Nov 2002 09:48:17 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.91,1.92 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv27731 Modified Files: libre.tex Log Message: Fix broken markup. Closes SF bug #637807. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** libre.tex 12 Nov 2002 23:12:54 -0000 1.91 --- libre.tex 13 Nov 2002 17:48:15 -0000 1.92 *************** *** 783,787 **** \begin{methoddesc}[MatchObject]{start}{\optional{group}} ! \funcline{end}{\optional{group}} Return the indices of the start and end of the substring matched by \var{group}; \var{group} defaults to zero (meaning the whole --- 783,787 ---- \begin{methoddesc}[MatchObject]{start}{\optional{group}} ! \methodline{end}{\optional{group}} Return the indices of the start and end of the substring matched by \var{group}; \var{group} defaults to zero (meaning the whole From fdrake@users.sourceforge.net Wed Nov 13 17:55:19 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 13 Nov 2002 09:55:19 -0800 Subject: [Python-checkins] python/dist/src/Doc/perl python.perl,1.129,1.130 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv1370 Modified Files: python.perl Log Message: Add \funcline, \funclineni, and \methodlineni to the list of functions that are processed before their arguments. Closes SF bug #637807. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** python.perl 30 Oct 2002 21:38:32 -0000 1.129 --- python.perl 13 Nov 2002 17:55:17 -0000 1.130 *************** *** 1933,1938 **** --- 1933,1941 ---- process_commands_wrap_deferred(<<_RAW_ARG_DEFERRED_CMDS_); declaremodule # [] # {} # {} + funcline # {} # {} + funclineni # {} # {} memberline # [] # {} methodline # [] # {} # {} + methodlineni # [] # {} # {} modulesynopsis # {} platform # {} From fdrake@users.sourceforge.net Wed Nov 13 17:56:25 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 13 Nov 2002 09:56:25 -0800 Subject: [Python-checkins] python/dist/src/Doc/perl python.perl,1.116.4.4,1.116.4.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv2058 Modified Files: Tag: release22-maint python.perl Log Message: Add \funcline, \funclineni, and \methodlineni to the list of functions that are processed before their arguments. Closes SF bug #637807. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.116.4.4 retrieving revision 1.116.4.5 diff -C2 -d -r1.116.4.4 -r1.116.4.5 *** python.perl 7 Oct 2002 16:18:57 -0000 1.116.4.4 --- python.perl 13 Nov 2002 17:56:23 -0000 1.116.4.5 *************** *** 1881,1886 **** --- 1881,1889 ---- process_commands_wrap_deferred(<<_RAW_ARG_DEFERRED_CMDS_); declaremodule # [] # {} # {} + funcline # {} # {} + funclineni # {} # {} memberline # [] # {} methodline # [] # {} # {} + methodlineni # [] # {} # {} modulesynopsis # {} platform # {} From fdrake@users.sourceforge.net Wed Nov 13 19:05:03 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 13 Nov 2002 11:05:03 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libtime.tex,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv21939 Modified Files: libtime.tex Log Message: Document struct_time and the field names. Index: libtime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** libtime.tex 30 Oct 2002 18:17:03 -0000 1.50 --- libtime.tex 13 Nov 2002 19:05:01 -0000 1.51 *************** *** 74,97 **** \item ! The time tuple as returned by \function{gmtime()}, \function{localtime()}, and \function{strptime()}, and accepted by \function{asctime()}, \function{mktime()} and \function{strftime()}, ! is a tuple of 9 integers: ! \begin{tableiii}{r|l|l}{textrm}{Index}{Field}{Values} ! \lineiii{0}{year}{(for example, 1993)} ! \lineiii{1}{month}{range [1,12]} ! \lineiii{2}{day}{range [1,31]} ! \lineiii{3}{hour}{range [0,23]} ! \lineiii{4}{minute}{range [0,59]} ! \lineiii{5}{second}{range [0,61]; see \strong{(1)} in \function{strftime()} description} ! \lineiii{6}{weekday}{range [0,6], Monday is 0} ! \lineiii{7}{Julian day}{range [1,366]} ! \lineiii{8}{daylight savings flag}{0, 1 or -1; see below} \end{tableiii} Note that unlike the C structure, the month value is a range of 1-12, not 0-11. A year value will be handled as described ! under ``Year 2000 (Y2K) issues'' above. A \code{-1} argument as daylight savings flag, passed to \function{mktime()} will usually result in the correct daylight savings state to be filled in. --- 74,99 ---- \item ! The time value as returned by \function{gmtime()}, \function{localtime()}, and \function{strptime()}, and accepted by \function{asctime()}, \function{mktime()} and \function{strftime()}, ! is a sequence of 9 integers. The return values of \function{gmtime()}, ! \function{localtime()}, and \function{strptime()} also offer attribute ! names for individual fields. ! \begin{tableiii}{c|l|l}{textrm}{Index}{Attribute}{Values} ! \lineiii{0}{\member{tm_year}}{(for example, 1993)} ! \lineiii{1}{\member{tm_mon}}{range [1,12]} ! \lineiii{2}{\member{tm_mday}}{range [1,31]} ! \lineiii{3}{\member{tm_hour}}{range [0,23]} ! \lineiii{4}{\member{tm_min}}{range [0,59]} ! \lineiii{5}{\member{tm_sec}}{range [0,61]; see \strong{(1)} in \function{strftime()} description} ! \lineiii{6}{\member{tm_wday}}{range [0,6], Monday is 0} ! \lineiii{7}{\member{tm_yday}}{range [1,366]} ! \lineiii{8}{\member{tm_isdst}}{0, 1 or -1; see below} \end{tableiii} Note that unlike the C structure, the month value is a range of 1-12, not 0-11. A year value will be handled as described ! under ``Year 2000 (Y2K) issues'' above. A \code{-1} argument as the daylight savings flag, passed to \function{mktime()} will usually result in the correct daylight savings state to be filled in. *************** *** 101,104 **** --- 103,109 ---- \exception{TypeError} is raised. + \versionchanged[The time value sequence was changed from a tuple to a + specialized type, with the addition of attribute names + for the fields]{2.2} \end{itemize} *************** *** 285,288 **** --- 290,299 ---- does not provide sufficient information to constrain the result. \end{funcdesc} + + \begin{datadesc}{struct_time} + The type of the time value sequence returned by \function{gmtime()}, + \function{localtime()}, and \function{strptime()}. + \versionadded{2.2} + \end{datadesc} \begin{funcdesc}{time}{} From fdrake@users.sourceforge.net Wed Nov 13 19:06:02 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 13 Nov 2002 11:06:02 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libtime.tex,1.48.6.1,1.48.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv22554 Modified Files: Tag: release22-maint libtime.tex Log Message: Document struct_time and the field names. Index: libtime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.48.6.1 retrieving revision 1.48.6.2 diff -C2 -d -r1.48.6.1 -r1.48.6.2 *** libtime.tex 30 Oct 2002 18:18:08 -0000 1.48.6.1 --- libtime.tex 13 Nov 2002 19:06:00 -0000 1.48.6.2 *************** *** 74,97 **** \item ! The time tuple as returned by \function{gmtime()}, \function{localtime()}, and \function{strptime()}, and accepted by \function{asctime()}, \function{mktime()} and \function{strftime()}, ! is a tuple of 9 integers: ! \begin{tableiii}{r|l|l}{textrm}{Index}{Field}{Values} ! \lineiii{0}{year}{(for example, 1993)} ! \lineiii{1}{month}{range [1,12]} ! \lineiii{2}{day}{range [1,31]} ! \lineiii{3}{hour}{range [0,23]} ! \lineiii{4}{minute}{range [0,59]} ! \lineiii{5}{second}{range [0,61]; see \strong{(1)} in \function{strftime()} description} ! \lineiii{6}{weekday}{range [0,6], Monday is 0} ! \lineiii{7}{Julian day}{range [1,366]} ! \lineiii{8}{daylight savings flag}{0, 1 or -1; see below} \end{tableiii} Note that unlike the C structure, the month value is a range of 1-12, not 0-11. A year value will be handled as described ! under ``Year 2000 (Y2K) issues'' above. A \code{-1} argument as daylight savings flag, passed to \function{mktime()} will usually result in the correct daylight savings state to be filled in. --- 74,99 ---- \item ! The time value as returned by \function{gmtime()}, \function{localtime()}, and \function{strptime()}, and accepted by \function{asctime()}, \function{mktime()} and \function{strftime()}, ! is a sequence of 9 integers. The return values of \function{gmtime()}, ! \function{localtime()}, and \function{strptime()} also offer attribute ! names for individual fields. ! \begin{tableiii}{c|l|l}{textrm}{Index}{Attribute}{Values} ! \lineiii{0}{\member{tm_year}}{(for example, 1993)} ! \lineiii{1}{\member{tm_mon}}{range [1,12]} ! \lineiii{2}{\member{tm_mday}}{range [1,31]} ! \lineiii{3}{\member{tm_hour}}{range [0,23]} ! \lineiii{4}{\member{tm_min}}{range [0,59]} ! \lineiii{5}{\member{tm_sec}}{range [0,61]; see \strong{(1)} in \function{strftime()} description} ! \lineiii{6}{\member{tm_wday}}{range [0,6], Monday is 0} ! \lineiii{7}{\member{tm_yday}}{range [1,366]} ! \lineiii{8}{\member{tm_isdst}}{0, 1 or -1; see below} \end{tableiii} Note that unlike the C structure, the month value is a range of 1-12, not 0-11. A year value will be handled as described ! under ``Year 2000 (Y2K) issues'' above. A \code{-1} argument as the daylight savings flag, passed to \function{mktime()} will usually result in the correct daylight savings state to be filled in. *************** *** 101,104 **** --- 103,109 ---- \exception{TypeError} is raised. + \versionchanged[The time value sequence was changed from a tuple to a + specialized type, with the addition of attribute names + for the fields]{2.2} \end{itemize} *************** *** 292,295 **** --- 297,306 ---- Availability: Most modern \UNIX{} systems. \end{funcdesc} + + \begin{datadesc}{struct_time} + The type of the time value sequence returned by \function{gmtime()}, + \function{localtime()}, and \function{strptime()}. + \versionadded{2.2} + \end{datadesc} \begin{funcdesc}{time}{} From fdrake@users.sourceforge.net Wed Nov 13 19:16:41 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 13 Nov 2002 11:16:41 -0800 Subject: [Python-checkins] python/dist/src/Doc/perl python.perl,1.130,1.131 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv29310 Modified Files: python.perl Log Message: - Committing the modified signature lines I've been using for a long time in http://www.python.org/dev/doc/. There have been no bug reports on these for a long time now. - Remove local "use" statement that duplicates a top-level "use". Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.130 retrieving revision 1.131 diff -C2 -d -r1.130 -r1.131 *** python.perl 13 Nov 2002 17:55:17 -0000 1.130 --- python.perl 13 Nov 2002 19:16:37 -0000 1.131 *************** *** 915,919 **** $args =~ s/(\s|\*)([a-z_][a-z_0-9]*),/\1\2<\/var>,/g; $args =~ s/(\s|\*)([a-z_][a-z_0-9]*)$/\1\2<\/var>/s; ! return "$type $idx($args)"; } sub do_cmd_cfuncline{ --- 915,922 ---- $args =~ s/(\s|\*)([a-z_][a-z_0-9]*),/\1\2<\/var>,/g; $args =~ s/(\s|\*)([a-z_][a-z_0-9]*)$/\1\2<\/var>/s; ! return ('' ! . "" ! . "" ! . '
$type\ $idx($args)
'); } sub do_cmd_cfuncline{ *************** *** 1022,1026 **** my($first, $idxitem, $arglist) = @_; return (($first ? '
' : '') ! . "
$idxitem($arglist)\n
"); } --- 1025,1031 ---- my($first, $idxitem, $arglist) = @_; return (($first ? '
' : '') ! . '
' ! . "\n " ! . "\n
$idxitem($arglist)
\n
"); } *************** *** 2008,2012 **** return $VerbatimFiles{$file}; } - use File::Basename; my $srcname, $srcdir, $srcext; ($srcname, $srcdir, $srcext) = fileparse($file, '\..*'); --- 2013,2016 ---- From fdrake@users.sourceforge.net Wed Nov 13 19:31:06 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 13 Nov 2002 11:31:06 -0800 Subject: [Python-checkins] python/dist/src/Doc/info Makefile,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/info In directory usw-pr-cvs1:/tmp/cvs-serv5505/info Modified Files: Makefile Log Message: Integrate updates to the GNU info conversion. This includes SF patch #590352 and additional support for more of the custom markup. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/info/Makefile,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Makefile 3 May 2002 04:50:51 -0000 1.8 --- Makefile 13 Nov 2002 19:31:03 -0000 1.9 *************** *** 35,66 **** python$(VERSION)-api.info: ../api/api.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ python$(VERSION)-ext.info: ../ext/ext.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ python$(VERSION)-lib.info: ../lib/lib.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ # Not built by default; the conversion doesn't really handle it well. python$(VERSION)-mac.info: ../mac/mac.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ python$(VERSION)-ref.info: ../ref/ref.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ python$(VERSION)-tut.info: ../tut/tut.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ # Not built by default; the conversion doesn't handle it at all. python$(VERSION)-doc.info: ../doc/doc.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ python$(VERSION)-dist.info: ../dist/dist.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ # Not built by default; the conversion chokes on two @end multitable's python$(VERSION)-inst.info: ../inst/inst.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $@ clean: --- 35,66 ---- python$(VERSION)-api.info: ../api/api.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ python$(VERSION)-ext.info: ../ext/ext.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ python$(VERSION)-lib.info: ../lib/lib.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ # Not built by default; the conversion doesn't really handle it well. python$(VERSION)-mac.info: ../mac/mac.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ python$(VERSION)-ref.info: ../ref/ref.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ python$(VERSION)-tut.info: ../tut/tut.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ # Not built by default; the conversion doesn't handle it at all. python$(VERSION)-doc.info: ../doc/doc.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ python$(VERSION)-dist.info: ../dist/dist.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ # Not built by default; the conversion chokes on two @end multitable's python$(VERSION)-inst.info: ../inst/inst.tex $(SCRIPTS) ! EMACS=$(EMACS) $(MKINFO) $< $*.texi $@ clean: From fdrake@users.sourceforge.net Wed Nov 13 19:31:06 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 13 Nov 2002 11:31:06 -0800 Subject: [Python-checkins] python/dist/src/Doc/tools mkinfo,1.4,1.5 py2texi.el,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv5505/tools Modified Files: mkinfo py2texi.el Log Message: Integrate updates to the GNU info conversion. This includes SF patch #590352 and additional support for more of the custom markup. Index: mkinfo =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/mkinfo,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mkinfo 9 Jul 2002 03:24:32 -0000 1.4 --- mkinfo 13 Nov 2002 19:31:04 -0000 1.5 *************** *** 3,8 **** # Script to drive the HTML-info conversion process. ! # Pass in a single parameter: the name of the top-level HTML file ! # generated by LaTeX2HTML. # # Written by Fred L. Drake, Jr. --- 3,10 ---- # Script to drive the HTML-info conversion process. ! # Pass in upto three parameters: ! # - the name of the main tex file ! # - the name of the output file in texi format (optional) ! # - the name of the output file in info format (optional) # # Written by Fred L. Drake, Jr. *************** *** 19,23 **** DOCNAME=`basename "$FILENAME" .tex` if [ $# -gt 1 ]; then ! INFONAME="$2" else INFONAME="python-$DOCNAME.info" --- 21,30 ---- DOCNAME=`basename "$FILENAME" .tex` if [ $# -gt 1 ]; then ! TEXINAME="$2" ! else ! TEXINAME="python-$DOCNAME.texi" ! fi ! if [ $# -gt 2 ]; then ! INFONAME="$3" else INFONAME="python-$DOCNAME.info" *************** *** 44,47 **** --- 51,56 ---- run $EMACS -batch -q --no-site-file -l $TOOLSDIR/py2texi.el \ --eval "(setq py2texi-dirs '(\"./\" \"../texinputs/\" \"$DOCDIR\"))" \ + --eval "(setq py2texi-texi-file-name \"$TEXINAME\")" \ + --eval "(setq py2texi-info-file-name \"$INFONAME\")" \ --eval "(py2texi \"$DOCDIR/$DOCFILE\")" \ -f kill-emacs *************** *** 52,54 **** run $MAKEINFO --footnote-style end --fill-column 72 \ ! --paragraph-indent 0 --output=$INFONAME $DOCNAME.texi --- 61,63 ---- run $MAKEINFO --footnote-style end --fill-column 72 \ ! --paragraph-indent 0 --output=$INFONAME $TEXINAME Index: py2texi.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/py2texi.el,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** py2texi.el 27 Jun 2002 18:38:06 -0000 1.2 --- py2texi.el 13 Nov 2002 19:31:04 -0000 1.3 *************** *** 57,60 **** --- 57,68 ---- "Short version number, usually set by the LaTeX commands.") + (defvar py2texi-texi-file-name nil + "If non-nil, that string is used as the name of the Texinfo file. + Otherwise a generated Texinfo file name is used.") + + (defvar py2texi-info-file-name nil + "If non-nil, that string is used as the name of the Info file. + Otherwise a generated Info file name is used.") + (defvar py2texi-stop-on-problems nil "*If non-nil, stop when you encouter soft problem.") *************** *** 66,99 **** (progn (setq findex t) "\n@table @code\n@item \\1 \\2(\\3)\n@findex \\2\n") ! "@end table") ("classdesc" 2 (progn (setq obindex t) "\n@table @code\n@item \\1(\\2)\n@obindex \\1\n") ! "@end table") ("classdesc*" 1 (progn (setq obindex t) "\n@table @code\n@item \\1\n@obindex \\1\n") ! "@end table") ! ("cmemberdesc" 3 ! (progn (setq findex t) ! "\n@table @code\n@item \\1 \\2 \\3\n@findex \\3\n") ! "@end table") ("csimplemacrodesc" 1 (progn (setq cindex t) "\n@table @code\n@item \\1\n@cindex \\1\n") ! "@end table") ("ctypedesc" 1 (progn (setq cindex t) "\n@table @code\n@item \\1\n@cindex \\1\n") ! "@end table") ("cvardesc" 2 (progn (setq findex t) "\n@table @code\n@item \\1 \\2\n@findex \\2\n") ! "@end table") ("datadesc" 1 (progn (setq findex t) "\n@table @code\n@item \\1\n@findex \\1\n") ! "@end table") ! ("datadescni" 1 "\n@table @code\n@item \\1\n" "@end table") ("definitions" 0 "@table @dfn" "@end table\n") ("description" 0 "@table @samp" "@end table\n") --- 74,106 ---- (progn (setq findex t) "\n@table @code\n@item \\1 \\2(\\3)\n@findex \\2\n") ! "@end table\n") ! ("cmemberdesc" 3 ! "\n@table @code\n@item \\2 \\3\n" ! "@end table\n") ("classdesc" 2 (progn (setq obindex t) "\n@table @code\n@item \\1(\\2)\n@obindex \\1\n") ! "@end table\n") ("classdesc*" 1 (progn (setq obindex t) "\n@table @code\n@item \\1\n@obindex \\1\n") ! "@end table\n") ("csimplemacrodesc" 1 (progn (setq cindex t) "\n@table @code\n@item \\1\n@cindex \\1\n") ! "@end table\n") ("ctypedesc" 1 (progn (setq cindex t) "\n@table @code\n@item \\1\n@cindex \\1\n") ! "@end table\n") ("cvardesc" 2 (progn (setq findex t) "\n@table @code\n@item \\1 \\2\n@findex \\2\n") ! "@end table\n") ("datadesc" 1 (progn (setq findex t) "\n@table @code\n@item \\1\n@findex \\1\n") ! "@end table\n") ! ("datadescni" 1 "\n@table @code\n@item \\1\n" "@end table\n") ("definitions" 0 "@table @dfn" "@end table\n") ("description" 0 "@table @samp" "@end table\n") *************** *** 116,133 **** (progn (setq obindex t) "\n@table @code\n@item \\1\n@obindex \\1\n") ! "@end table") ("excclassdesc" 2 (progn (setq obindex t) "\n@table @code\n@item \\1(\\2)\n@obindex \\1\n") ! "@end table") ("flushleft" 0 "" "") ! ("fulllineitems" 0 "\n@table @code\n" "@end table") ("funcdesc" 2 (progn (setq findex t) "\n@table @code\n@item \\1(\\2)\n@findex \\1\n") ! "@end table") ! ("funcdescni" 2 "\n@table @code\n@item \\1(\\2)\n" "@end table") ("itemize" 0 "@itemize @bullet" "@end itemize\n") ! ("list" 2 "\n@table @code\n" "@end table") ("longtableii" 4 (concat "@multitable @columnfractions .5 .5\n" "@item \\3 @tab \\4\n" --- 123,140 ---- (progn (setq obindex t) "\n@table @code\n@item \\1\n@obindex \\1\n") ! "@end table\n") ("excclassdesc" 2 (progn (setq obindex t) "\n@table @code\n@item \\1(\\2)\n@obindex \\1\n") ! "@end table\n") ("flushleft" 0 "" "") ! ("fulllineitems" 0 "\n@table @code\n" "@end table\n") ("funcdesc" 2 (progn (setq findex t) "\n@table @code\n@item \\1(\\2)\n@findex \\1\n") ! "@end table\n") ! ("funcdescni" 2 "\n@table @code\n@item \\1(\\2)\n" "@end table\n") ("itemize" 0 "@itemize @bullet" "@end itemize\n") ! ("list" 2 "\n@table @code\n" "@end table\n") ("longtableii" 4 (concat "@multitable @columnfractions .5 .5\n" "@item \\3 @tab \\4\n" *************** *** 141,160 **** (progn (setq findex t) "\n@table @code\n@item \\1\n@findex \\1\n") ! "@end table") ! ("memberdescni" 1 "\n@table @code\n@item \\1\n" "@end table") ("methoddesc" 2 (progn (setq findex t) "\n@table @code\n@item \\1(\\2)\n@findex \\1\n") ! "@end table") ! ("methoddescni" 2 "\n@table @code\n@item \\1(\\2)\n" "@end table") ("notice" 0 "@emph{Notice:} " "") ("opcodedesc" 2 (progn (setq findex t) "\n@table @code\n@item \\1 \\2\n@findex \\1\n") ! "@end table") ! ("productionlist" 0 "\n@table @code\n" "@end table") ("quotation" 0 "@quotation" "@end quotation") ! ("seealso" 0 "See also:\n@table @emph\n" "@end table") ! ("seealso*" 0 "@table @emph\n" "@end table") ("sloppypar" 0 "" "") ("small" 0 "" "") --- 148,167 ---- (progn (setq findex t) "\n@table @code\n@item \\1\n@findex \\1\n") ! "@end table\n") ! ("memberdescni" 1 "\n@table @code\n@item \\1\n" "@end table\n") ("methoddesc" 2 (progn (setq findex t) "\n@table @code\n@item \\1(\\2)\n@findex \\1\n") ! "@end table\n") ! ("methoddescni" 2 "\n@table @code\n@item \\1(\\2)\n" "@end table\n") ("notice" 0 "@emph{Notice:} " "") ("opcodedesc" 2 (progn (setq findex t) "\n@table @code\n@item \\1 \\2\n@findex \\1\n") ! "@end table\n") ! ("productionlist" 0 "\n@table @code\n" "@end table\n") ("quotation" 0 "@quotation" "@end quotation") ! ("seealso" 0 "See also:\n@table @emph\n" "@end table\n") ! ("seealso*" 0 "@table @emph\n" "@end table\n") ("sloppypar" 0 "" "") ("small" 0 "" "") *************** *** 201,207 **** ("cdata" 1 "@code{\\1}") ("centerline" 1 "@center \\1") ! ("cfuncline" 3 ! (progn (setq findex t) ! "\n@item \\1 \\2(\\3)\n@findex \\2\n")) ("cfunction" 1 "@code{\\1}") ("chapter" 1 (format "@node \\1\n@%s \\1\n" --- 208,212 ---- ("cdata" 1 "@code{\\1}") ("centerline" 1 "@center \\1") ! ("cfuncline" 3 "@itemx \\1 \\2(\\3)\n@findex \\2") ("cfunction" 1 "@code{\\1}") ("chapter" 1 (format "@node \\1\n@%s \\1\n" *************** *** 211,217 **** ("citetitle" 1 "@ref{Top,,,\\1}") ("class" 1 "@code{\\1}") ! ("cmemberline" 3 ! (progn (setq findex t) ! "\n@item \\1 \\2 \\3\n@findex \\3\n")) ("code" 1 "@code{\\1}") ("command" 1 "@command{\\1}") --- 216,220 ---- ("citetitle" 1 "@ref{Top,,,\\1}") ("class" 1 "@code{\\1}") ! ("cmemberline" 3 "@itemx \\2 \\3\n") ("code" 1 "@code{\\1}") ("command" 1 "@command{\\1}") *************** *** 283,287 **** ("mimetype" 1 "@samp{\\1}") ("module" 1 "@samp{\\1}") ! ("moduleauthor" 2 "This module was written by \\1 @email{\\2}.@*") ("modulesynopsis" 1 "\\1") ("moreargs" 0 "@dots{}") --- 286,290 ---- ("mimetype" 1 "@samp{\\1}") ("module" 1 "@samp{\\1}") ! ("moduleauthor" 2 "") ("modulesynopsis" 1 "\\1") ("moreargs" 0 "@dots{}") *************** *** 309,313 **** ("POSIX" 0 "POSIX") ("production" 2 "@item \\1 \\2") ! ("productioncont" 1 "@item \\1") ("program" 1 "@command{\\1}") ("programopt" 1 "@option{\\1}") --- 312,316 ---- ("POSIX" 0 "POSIX") ("production" 2 "@item \\1 \\2") ! ("productioncont" 1 "@item @w{} \\1") ("program" 1 "@command{\\1}") ("programopt" 1 "@option{\\1}") *************** *** 335,340 **** (py2texi-backslash-quote (match-string 2 str))) "@node \\1\n@section \\1\n")))) ! ("sectionauthor" 2 ! "\nThis manual section was written by \\1 @email{\\2}.@*") ("seemodule" 2 "@ref{\\1} \\2") ("seepep" 3 "\n@table @strong\n@item PEP\\1 \\2\n\\3\n@end table\n") --- 338,342 ---- (py2texi-backslash-quote (match-string 2 str))) "@node \\1\n@section \\1\n")))) ! ("sectionauthor" 2 "") ("seemodule" 2 "@ref{\\1} \\2") ("seepep" 3 "\n@table @strong\n@item PEP\\1 \\2\n\\3\n@end table\n") *************** *** 469,486 **** (py2texi-fix-newlines) (py2texi-adjust-level)) ! (let* ((filename (concat "./" ! (file-name-nondirectory file) ! (if (string-match "\\.tex$" file) "i" ".texi"))) ! (infofilename (py2texi-info-file-name filename))) (goto-char (point-min)) (when (looking-at py2texi-magic) (delete-region (point) (progn (beginning-of-line 2) (point))) (insert "\\input texinfo @c -*-texinfo-*-\n") ! (insert "@setfilename " (file-name-nondirectory infofilename))) (when (re-search-forward "@chapter" nil t) (texinfo-all-menus-update t)) (goto-char (point-min)) ! (write-file filename) ! (message (format "You can apply `makeinfo %s' now." filename)))) --- 471,494 ---- (py2texi-fix-newlines) (py2texi-adjust-level)) ! (let* ((texi-file-name (or py2texi-texi-file-name ! (py2texi-texi-file-name file))) ! (info-file-name (or py2texi-info-file-name ! (py2texi-info-file-name texi-file-name)))) (goto-char (point-min)) (when (looking-at py2texi-magic) (delete-region (point) (progn (beginning-of-line 2) (point))) (insert "\\input texinfo @c -*-texinfo-*-\n") ! (insert "@setfilename " info-file-name)) (when (re-search-forward "@chapter" nil t) (texinfo-all-menus-update t)) (goto-char (point-min)) ! (write-file texi-file-name) ! (message (format "You can apply `makeinfo %s' now." texi-file-name)))) ! ! ! (defun py2texi-texi-file-name (filename) ! "Generate name of Texinfo file from original file name FILENAME." ! (concat filename ! (if (string-match "\\.tex$" filename) "i" ".texi"))) *************** *** 720,724 **** counter string ! label) (py2texi-search "^@node +\\(.*\\)$" (setq string (match-string 1)) --- 728,733 ---- counter string ! label ! index) (py2texi-search "^@node +\\(.*\\)$" (setq string (match-string 1)) *************** *** 726,736 **** (replace-match "@node " t) (replace-match "" t nil nil 1)) ! (when (string-match "@label{[^}]*}" string) (setq label (match-string 0 string)) (setq string (replace-match "" t nil string))) (while (string-match "@[a-zA-Z]+\\|[{}():]\\|``\\|''" string) (setq string (replace-match "" t nil string))) (while (string-match " -- " string) (setq string (replace-match " - " t nil string))) (when (string-match " +$" string) (setq string (replace-match "" t nil string))) --- 735,750 ---- (replace-match "@node " t) (replace-match "" t nil nil 1)) ! (while (string-match "@label{[^}]*}" string) (setq label (match-string 0 string)) (setq string (replace-match "" t nil string))) + (while (string-match "@..?index{[^}]*}" string) + (setq index (match-string 0 string)) + (setq string (replace-match "" t nil string))) (while (string-match "@[a-zA-Z]+\\|[{}():]\\|``\\|''" string) (setq string (replace-match "" t nil string))) (while (string-match " -- " string) (setq string (replace-match " - " t nil string))) + (while (string-match "\\." string) + (setq string (replace-match "" t nil string))) (when (string-match " +$" string) (setq string (replace-match "" t nil string))) *************** *** 748,754 **** (setf (gethash id nodes) counter) (insert string) (when label ! (beginning-of-line 3) ! (insert label "\n"))))) --- 762,770 ---- (setf (gethash id nodes) counter) (insert string) + (beginning-of-line 3) (when label ! (insert label "\n")) ! (when index ! (insert index "\n"))))) From jhylton@users.sourceforge.net Wed Nov 13 19:34:28 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 13 Nov 2002 11:34:28 -0800 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7523 Modified Files: sets.py Log Message: Add getstate and setstate implementation to concrete set classes. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** sets.py 8 Nov 2002 17:03:36 -0000 1.34 --- sets.py 13 Nov 2002 19:34:25 -0000 1.35 *************** *** 367,370 **** --- 367,375 ---- return self._hashcode + def __getstate__(self): + return self._data, self._hashcode + + def __setstate__(self, state): + self._data, self._hashcode = state class Set(BaseSet): *************** *** 380,383 **** --- 385,395 ---- if iterable is not None: self._update(iterable) + + def __getstate__(self): + # getstate's results are ignored if it is not + return self._data, + + def __setstate__(self, data): + self._data, = data def __hash__(self): From jhylton@users.sourceforge.net Wed Nov 13 19:34:29 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 13 Nov 2002 11:34:29 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7523/test Modified Files: test_sets.py Log Message: Add getstate and setstate implementation to concrete set classes. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_sets.py 9 Nov 2002 05:26:15 -0000 1.15 --- test_sets.py 13 Nov 2002 19:34:26 -0000 1.16 *************** *** 1,5 **** #!/usr/bin/env python ! import unittest, operator, copy from sets import Set, ImmutableSet from test import test_support --- 1,5 ---- #!/usr/bin/env python ! import unittest, operator, copy, pickle from sets import Set, ImmutableSet from test import test_support *************** *** 74,77 **** --- 74,85 ---- for v in self.set: self.assert_(v in self.values) + + def test_pickling(self): + p = pickle.dumps(self.set) + print repr(p) + copy = pickle.loads(p) + repr(copy) + self.assertEqual(self.set, copy, + "%s != %s" % (self.set, copy)) #------------------------------------------------------------------------------ From akuchling@users.sourceforge.net Wed Nov 13 20:54:24 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 13 Nov 2002 12:54:24 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils extension.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv26844 Modified Files: extension.py Log Message: Allow unknown keyword arguments to the Extension class, and warn about them. Index: extension.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/extension.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** extension.py 5 Nov 2002 16:11:56 -0000 1.13 --- extension.py 13 Nov 2002 20:54:21 -0000 1.14 *************** *** 11,14 **** --- 11,18 ---- from types import * + try: + import warnings + except ImportError: + warnings = None # This class is really only used by the "build_ext" command, so it might *************** *** 94,99 **** depends=None, language=None, ): - assert type(name) is StringType, "'name' must be a string" assert (type(sources) is ListType and --- 98,103 ---- depends=None, language=None, + **kw # To catch unknown keywords ): assert type(name) is StringType, "'name' must be a string" assert (type(sources) is ListType and *************** *** 116,119 **** --- 120,132 ---- self.language = language + # If there are unknown keyword options, warn about them + if len(kw): + L = kw.keys() ; L.sort() + L = map(repr, L) + msg = "Unknown Extension options: " + string.join(L, ', ') + if warnings is not None: + warnings.warn(msg) + else: + sys.stderr.write(msg + '\n') # class Extension From akuchling@users.sourceforge.net Wed Nov 13 20:55:43 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 13 Nov 2002 12:55:43 -0800 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.20,1.21 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv27941 Modified Files: pep-0283.txt Log Message: PEP 262 got withdrawn Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** pep-0283.txt 2 Sep 2002 14:14:49 -0000 1.20 --- pep-0283.txt 13 Nov 2002 20:55:40 -0000 1.21 *************** *** 156,163 **** what that need is and how much of the buffer object we can retire. - - PEP 262 Database of Installed Python Packages Kuchling - - Andrew is still hopeful that he'll implement this. - - Add support for the long-awaited Python catalog. Kapil Thangavelu has a Zope-based implementation that he demoed at --- 156,159 ---- From gvanrossum@users.sourceforge.net Wed Nov 13 21:04:35 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 13 Nov 2002 13:04:35 -0800 Subject: [Python-checkins] python/dist/src/Tools/scripts crlf.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory usw-pr-cvs1:/tmp/cvs-serv1766 Modified Files: crlf.py Log Message: Tim wins a bet. Don't use re. Index: crlf.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/crlf.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** crlf.py 14 Feb 2000 21:42:14 -0000 1.2 --- crlf.py 13 Nov 2002 21:04:31 -0000 1.3 *************** *** 3,7 **** "Replace CRLF with LF in argument files. Print names of changed files." ! import sys, re, os for file in sys.argv[1:]: if os.path.isdir(file): --- 3,7 ---- "Replace CRLF with LF in argument files. Print names of changed files." ! import sys, os for file in sys.argv[1:]: if os.path.isdir(file): *************** *** 12,16 **** print file, "Binary!" continue ! newdata = re.sub("\r\n", "\n", data) if newdata != data: print file --- 12,16 ---- print file, "Binary!" continue ! newdata = data.replace("\r\n", "\n") if newdata != data: print file From akuchling@users.sourceforge.net Wed Nov 13 21:18:54 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 13 Nov 2002 13:18:54 -0800 Subject: [Python-checkins] python/nondist/peps pep-0248.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv12397 Modified Files: pep-0248.txt Log Message: Typo fix Index: pep-0248.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0248.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0248.txt 29 May 2002 21:17:42 -0000 1.4 --- pep-0248.txt 13 Nov 2002 21:18:51 -0000 1.5 *************** *** 46,50 **** error ! Exception raise for errors from the database module. --- 46,50 ---- error ! Exception raised for errors from the database module. From akuchling@users.sourceforge.net Wed Nov 13 21:20:47 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 13 Nov 2002 13:20:47 -0800 Subject: [Python-checkins] python/nondist/peps pep-0249.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv13354 Modified Files: pep-0249.txt Log Message: [Bug #636159] Fix inheritance diagram (DatabaseError is not a subclass of InterfaceError) Index: pep-0249.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0249.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pep-0249.txt 29 May 2002 21:17:42 -0000 1.7 --- pep-0249.txt 13 Nov 2002 21:20:45 -0000 1.8 *************** *** 177,187 **** |__Error |__InterfaceError ! |__DatabaseError ! |__DataError ! |__OperationalError ! |__IntegrityError ! |__InternalError ! |__ProgrammingError ! |__NotSupportedError Note: The values of these exceptions are not defined. They should --- 177,187 ---- |__Error |__InterfaceError ! |__DatabaseError ! |__DataError ! |__OperationalError ! |__IntegrityError ! |__InternalError ! |__ProgrammingError ! |__NotSupportedError Note: The values of these exceptions are not defined. They should From jhylton@users.sourceforge.net Wed Nov 13 22:00:05 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 13 Nov 2002 14:00:05 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6059 Modified Files: test_sets.py Log Message: remove debugging print Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_sets.py 13 Nov 2002 19:34:26 -0000 1.16 --- test_sets.py 13 Nov 2002 22:00:02 -0000 1.17 *************** *** 77,83 **** def test_pickling(self): p = pickle.dumps(self.set) - print repr(p) copy = pickle.loads(p) - repr(copy) self.assertEqual(self.set, copy, "%s != %s" % (self.set, copy)) --- 77,81 ---- From jhylton@users.sourceforge.net Wed Nov 13 22:01:30 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 13 Nov 2002 14:01:30 -0800 Subject: [Python-checkins] python/dist/src/Lib pickle.py,1.71,1.72 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7024/Lib Modified Files: pickle.py Log Message: Remove inst_persistent_id() WANNI (we ain't never needed it). Add some simple tests of the persistence hooks. Index: pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** pickle.py 19 Sep 2002 23:00:12 -0000 1.71 --- pickle.py 13 Nov 2002 22:01:26 -0000 1.72 *************** *** 189,200 **** return GET + `i` + '\n' ! def save(self, object, pers_save = 0): memo = self.memo ! if not pers_save: ! pid = self.persistent_id(object) ! if pid is not None: ! self.save_pers(pid) ! return d = id(object) --- 189,199 ---- return GET + `i` + '\n' ! def save(self, object): memo = self.memo ! pid = self.persistent_id(object) ! if pid is not None: ! self.save_pers(pid) ! return d = id(object) *************** *** 216,224 **** f = self.dispatch[t] except KeyError: - pid = self.inst_persistent_id(object) - if pid is not None: - self.save_pers(pid) - return - try: issc = issubclass(t, TypeType) --- 215,218 ---- *************** *** 280,291 **** return None - def inst_persistent_id(self, object): - return None - def save_pers(self, pid): if not self.bin: self.write(PERSID + str(pid) + '\n') else: ! self.save(pid, 1) self.write(BINPERSID) --- 274,282 ---- return None def save_pers(self, pid): if not self.bin: self.write(PERSID + str(pid) + '\n') else: ! self.save(pid) self.write(BINPERSID) From jhylton@users.sourceforge.net Wed Nov 13 22:01:30 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 13 Nov 2002 14:01:30 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_pickle.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7024/Lib/test Modified Files: test_pickle.py Log Message: Remove inst_persistent_id() WANNI (we ain't never needed it). Add some simple tests of the persistence hooks. Index: test_pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pickle.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_pickle.py 30 Jul 2002 23:27:11 -0000 1.11 --- test_pickle.py 13 Nov 2002 22:01:27 -0000 1.12 *************** *** 2,6 **** import unittest from cStringIO import StringIO ! from test.pickletester import AbstractPickleTests, AbstractPickleModuleTests from test import test_support --- 2,7 ---- import unittest from cStringIO import StringIO ! from test.pickletester import AbstractPickleTests, AbstractPickleModuleTests, \ ! AbstractPersistentPicklerTests from test import test_support *************** *** 30,33 **** --- 31,54 ---- return u.load() + class PersPicklerTests(AbstractPersistentPicklerTests): + + def dumps(self, arg, bin=0): + class PersPickler(pickle.Pickler): + def persistent_id(subself, obj): + return self.persistent_id(obj) + f = StringIO() + p = PersPickler(f, bin) + p.dump(arg) + f.seek(0) + return f.read() + + def loads(self, buf): + class PersUnpickler(pickle.Unpickler): + def persistent_load(subself, obj): + return self.persistent_load(obj) + f = StringIO(buf) + u = PersUnpickler(f) + return u.load() + def test_main(): loader = unittest.TestLoader() *************** *** 35,38 **** --- 56,60 ---- suite.addTest(loader.loadTestsFromTestCase(PickleTests)) suite.addTest(loader.loadTestsFromTestCase(PicklerTests)) + suite.addTest(loader.loadTestsFromTestCase(PersPicklerTests)) test_support.run_suite(suite) From jhylton@users.sourceforge.net Wed Nov 13 22:10:50 2002 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 13 Nov 2002 14:10:50 -0800 Subject: [Python-checkins] python/dist/src/Lib/test pickletester.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13474/Lib/test Modified Files: pickletester.py Log Message: Add some simple tests of the persistence hooks. Index: pickletester.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** pickletester.py 14 Aug 2002 08:22:50 -0000 1.19 --- pickletester.py 13 Nov 2002 22:10:47 -0000 1.20 *************** *** 287,288 **** --- 287,323 ---- finally: os.remove(TESTFN) + + class AbstractPersistentPicklerTests(unittest.TestCase): + + # This class defines persistent_id() and persistent_load() + # functions that should be used by the pickler. All even integers + # are pickled using persistent ids. + + def persistent_id(self, object): + if isinstance(object, int) and object % 2 == 0: + self.id_count += 1 + return str(object) + else: + return None + + def persistent_load(self, oid): + self.load_count += 1 + object = int(oid) + assert object % 2 == 0 + return object + + def test_persistence(self): + self.id_count = 0 + self.load_count = 0 + L = range(10) + self.assertEqual(self.loads(self.dumps(L)), L) + self.assertEqual(self.id_count, 5) + self.assertEqual(self.load_count, 5) + + def test_bin_persistence(self): + self.id_count = 0 + self.load_count = 0 + L = range(10) + self.assertEqual(self.loads(self.dumps(L, 1)), L) + self.assertEqual(self.id_count, 5) + self.assertEqual(self.load_count, 5) From esr@users.sourceforge.net Wed Nov 13 23:05:38 2002 From: esr@users.sourceforge.net (esr@users.sourceforge.net) Date: Wed, 13 Nov 2002 15:05:38 -0800 Subject: [Python-checkins] python/dist/src/Lib nntplib.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15513 Modified Files: nntplib.py Log Message: Make nntplib aware of ~/.netrc credentials; now they get used if they are present and the caller has not specified a name/password pair. This change makes it less likely that a lazy coder will expose sensitive information in a word-readable script. Also, make the test a bit smarter. If NNTPSERVER is defined in the environment it will go talk to that server rather than look for a possibly nonexistent local one named 'news'. Maybe the osession initializer ought to look at NNTPSERVER rather than requiring a host arg? Must look around and see how universal this convention is first. Index: nntplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/nntplib.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** nntplib.py 3 Jun 2002 15:58:31 -0000 1.30 --- nntplib.py 13 Nov 2002 23:05:35 -0000 1.31 *************** *** 134,137 **** --- 134,147 ---- else: raise + # If no login/password was specified, try to get them from ~/.netrc + # Presume that if .netc has an entry, NNRP authentication is required. + if not user: + import netrc + credentials = netrc.netrc() + auth = credentials.authenticators(host) + if auth: + user = auth[0] + password = auth[2] + # Perform NNRP authentication if needed. if user: resp = self.shortcmd('authinfo user '+user) *************** *** 556,562 **** ! def _test(): ! """Minimal test function.""" ! s = NNTP('news', readermode='reader') resp, count, first, last, name = s.group('comp.lang.python') print resp --- 566,582 ---- ! # Test retrieval when rubn as a script. ! # Assumption: if there's a local news server, it's called 'news'. ! # Assumption: if user queries a remote news server, it's named ! # in the environment variable NNTPSERVER (used by slrn and kin) ! # and we want readermode off. ! if __name__ == '__main__': ! import os ! newshost = 'news' and os.environ["NNTPSERVER"] ! if newshost.find('.') == -1: ! mode = 'readermode' ! else: ! mode = None ! s = NNTP(newshost, readermode=mode) resp, count, first, last, name = s.group('comp.lang.python') print resp *************** *** 569,574 **** print resp - - # Run the test when run as a script - if __name__ == '__main__': - _test() --- 589,590 ---- From just@letterror.com Wed Nov 13 23:26:05 2002 From: just@letterror.com (Just van Rossum) Date: Thu, 14 Nov 2002 00:26:05 +0100 Subject: [Python-checkins] python/dist/src/Lib nntplib.py,1.30,1.31 In-Reply-To: Message-ID: esr@users.sourceforge.net wrote: > + # If no login/password was specified, try to get them from ~/.netrc > + # Presume that if .netc has an entry, NNRP authentication is required. > + if not user: > + import netrc > + credentials = netrc.netrc() > + auth = credentials.authenticators(host) > + if auth: > + user = auth[0] > + password = auth[2] > + # Perform NNRP authentication if needed. Erm, doesn't this make anonymous nntp access fail if there's no $HOME or no .netrc file in $HOME? Just From akuchling@users.sourceforge.net Thu Nov 14 01:29:02 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 13 Nov 2002 17:29:02 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils ccompiler.py,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv6832 Modified Files: ccompiler.py Log Message: [Bug #599248] ext module generation problem If you have source files srcdir1/foo.c and srcdir2/foo.c, the temporary .o for both files is written to build/temp./foo.o. This patch sets strip_dir to false for both calls to object_filename, so now the object files are written to temp./srcdir1/foo.o and .../srcdir2/foo.o. 2.2 bugfix candidate Index: ccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/ccompiler.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** ccompiler.py 5 Nov 2002 20:27:17 -0000 1.51 --- ccompiler.py 14 Nov 2002 01:29:00 -0000 1.52 *************** *** 367,371 **** # Get the list of expected output (object) files ! objects = self.object_filenames(sources, 1, outdir) assert len(objects) == len(sources) --- 367,371 ---- # Get the list of expected output (object) files ! objects = self.object_filenames(sources, 0, outdir) assert len(objects) == len(sources) *************** *** 473,477 **** """ # Get the list of expected output (object) files ! objects = self.object_filenames(sources, strip_dir=1, output_dir=output_dir) assert len(objects) == len(sources) --- 473,477 ---- """ # Get the list of expected output (object) files ! objects = self.object_filenames(sources, strip_dir=0, output_dir=output_dir) assert len(objects) == len(sources) From akuchling@users.sourceforge.net Thu Nov 14 01:43:02 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 13 Nov 2002 17:43:02 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils sysconfig.py,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv13960 Modified Files: sysconfig.py Log Message: [Bug #550364] Add get_python_version() Index: sysconfig.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/sysconfig.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** sysconfig.py 13 Nov 2002 17:03:05 -0000 1.54 --- sysconfig.py 14 Nov 2002 01:43:00 -0000 1.55 *************** *** 36,39 **** --- 36,47 ---- + def get_python_version (): + """Return a string containing the major and minor Python version, + leaving off the patchlevel. Sample return values could be '1.5' + or '2.2'. + """ + return sys.version[:3] + + def get_python_inc(plat_specific=0, prefix=None): """Return the directory containing installed Python header files. *************** *** 94,98 **** if os.name == "posix": libpython = os.path.join(prefix, ! "lib", "python" + sys.version[:3]) if standard_lib: return libpython --- 102,106 ---- if os.name == "posix": libpython = os.path.join(prefix, ! "lib", "python" + get_python_version()) if standard_lib: return libpython From akuchling@users.sourceforge.net Thu Nov 14 01:44:37 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 13 Nov 2002 17:44:37 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command build_ext.py,1.88,1.89 bdist_wininst.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv14766 Modified Files: build_ext.py bdist_wininst.py Log Message: [Bug #550364] Use sysconfig.get_python_version() Index: build_ext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_ext.py,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** build_ext.py 5 Nov 2002 16:12:01 -0000 1.88 --- build_ext.py 14 Nov 2002 01:44:34 -0000 1.89 *************** *** 13,17 **** from distutils.core import Command from distutils.errors import * ! from distutils.sysconfig import customize_compiler from distutils.dep_util import newer_group from distutils.extension import Extension --- 13,17 ---- from distutils.core import Command from distutils.errors import * ! from distutils.sysconfig import customize_compiler, get_python_version from distutils.dep_util import newer_group from distutils.extension import Extension *************** *** 185,189 **** # building third party extensions self.library_dirs.append(os.path.join(sys.prefix, "lib", ! "python" + sys.version[:3], "config")) else: --- 185,189 ---- # building third party extensions self.library_dirs.append(os.path.join(sys.prefix, "lib", ! "python" + get_python_version(), "config")) else: Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_wininst.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** bdist_wininst.py 7 Nov 2002 16:46:19 -0000 1.40 --- bdist_wininst.py 14 Nov 2002 01:44:35 -0000 1.41 *************** *** 71,75 **** self.target_version = "" if self.distribution.has_ext_modules(): ! short_version = sys.version[:3] if self.target_version and self.target_version != short_version: raise DistutilsOptionError, \ --- 71,75 ---- self.target_version = "" if self.distribution.has_ext_modules(): ! short_version = get_python_version() if self.target_version and self.target_version != short_version: raise DistutilsOptionError, \ From akuchling@users.sourceforge.net Thu Nov 14 01:58:50 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 13 Nov 2002 17:58:50 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils errors.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv22106 Modified Files: errors.py Log Message: Fix docstring typo; remove 'created' line Index: errors.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/errors.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** errors.py 30 Jul 2000 01:03:31 -0000 1.10 --- errors.py 14 Nov 2002 01:58:48 -0000 1.11 *************** *** 6,13 **** (eg. bad command-line arguments). ! This module safe to use in "from ... import *" mode; it only exports symbols whose names start with "Distutils" and end with "Error".""" - - # created 1999/03/03, Greg Ward __revision__ = "$Id$" --- 6,11 ---- (eg. bad command-line arguments). ! This module is safe to use in "from ... import *" mode; it only exports symbols whose names start with "Distutils" and end with "Error".""" __revision__ = "$Id$" From nnorwitz@users.sourceforge.net Thu Nov 14 02:19:46 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 13 Nov 2002 18:19:46 -0800 Subject: [Python-checkins] python/dist/src/Lib nntplib.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32610/Lib Modified Files: nntplib.py Log Message: Fix typo in comment Index: nntplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/nntplib.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** nntplib.py 13 Nov 2002 23:05:35 -0000 1.31 --- nntplib.py 14 Nov 2002 02:19:44 -0000 1.32 *************** *** 566,570 **** ! # Test retrieval when rubn as a script. # Assumption: if there's a local news server, it's called 'news'. # Assumption: if user queries a remote news server, it's named --- 566,570 ---- ! # Test retrieval when run as a script. # Assumption: if there's a local news server, it's called 'news'. # Assumption: if user queries a remote news server, it's named From nnorwitz@users.sourceforge.net Thu Nov 14 02:22:37 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 13 Nov 2002 18:22:37 -0800 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.200.6.9,1.200.6.10 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv960/Modules Modified Files: Tag: release22-maint socketmodule.c Log Message: Fix SF # 505427, socket module fails to build on HPUX10 h_errno is not defined on HPUX with the 2.2 build env't (ie, _XOPEN_SOURCE_EXTENDED is not defined) Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.200.6.9 retrieving revision 1.200.6.10 diff -C2 -d -r1.200.6.9 -r1.200.6.10 *** socketmodule.c 27 Sep 2002 08:51:20 -0000 1.200.6.9 --- socketmodule.c 14 Nov 2002 02:22:34 -0000 1.200.6.10 *************** *** 143,146 **** --- 143,151 ---- #endif + /* This declaration is required for HPUX 10 */ + #if defined(__hpux) && !defined(h_errno) + extern int h_errno; + #endif + /* Headers needed for inet_ntoa() and inet_addr() */ #ifdef __BEOS__ From akuchling@users.sourceforge.net Thu Nov 14 02:25:44 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 13 Nov 2002 18:25:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils archive_util.py,1.12,1.13 ccompiler.py,1.52,1.53 cmd.py,1.31,1.32 core.py,1.54,1.55 cygwinccompiler.py,1.19,1.20 dep_util.py,1.4,1.5 dir_util.py,1.9,1.10 dist.py,1.58,1.59 emxccompiler.py,1.9,1.10 extension.py,1.14,1.15 fancy_getopt.py,1.25,1.26 file_util.py,1.13,1.14 filelist.py,1.13,1.14 msvccompiler.py,1.50,1.51 spawn.py,1.13,1.14 sysconfig.py,1.55,1.56 text_file.py,1.14,1.15 unixccompiler.py,1.49,1.50 util.py,1.70,1.71 version.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv2783 Modified Files: archive_util.py ccompiler.py cmd.py core.py cygwinccompiler.py dep_util.py dir_util.py dist.py emxccompiler.py extension.py fancy_getopt.py file_util.py filelist.py msvccompiler.py spawn.py sysconfig.py text_file.py unixccompiler.py util.py version.py Log Message: Remove 'created by' lines; people can use CVS for this, and the information is often out of date Index: archive_util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/archive_util.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** archive_util.py 4 Jun 2002 20:14:42 -0000 1.12 --- archive_util.py 14 Nov 2002 02:25:41 -0000 1.13 *************** *** 4,9 **** that sort of thing).""" - # created 2000/04/03, Greg Ward (extracted from util.py) - __revision__ = "$Id$" --- 4,7 ---- Index: ccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/ccompiler.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** ccompiler.py 14 Nov 2002 01:29:00 -0000 1.52 --- ccompiler.py 14 Nov 2002 02:25:41 -0000 1.53 *************** *** 4,9 **** for the Distutils compiler abstraction model.""" - # created 1999/07/05, Greg Ward - __revision__ = "$Id$" --- 4,7 ---- Index: cmd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cmd.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** cmd.py 11 Sep 2002 16:31:52 -0000 1.31 --- cmd.py 14 Nov 2002 02:25:41 -0000 1.32 *************** *** 5,11 **** """ - # created 2000/04/03, Greg Ward - # (extricated from core.py; actually dates back to the beginning) - __revision__ = "$Id$" --- 5,8 ---- Index: core.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/core.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** core.py 8 Nov 2002 16:18:24 -0000 1.54 --- core.py 14 Nov 2002 02:25:41 -0000 1.55 *************** *** 7,12 **** """ - # created 1999/03/01, Greg Ward - __revision__ = "$Id$" --- 7,10 ---- Index: cygwinccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cygwinccompiler.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** cygwinccompiler.py 5 Nov 2002 16:11:54 -0000 1.19 --- cygwinccompiler.py 14 Nov 2002 02:25:41 -0000 1.20 *************** *** 42,47 **** # *** only the version of June 2000 shows these problems - # created 2000/05/05, Rene Liebscher - __revision__ = "$Id$" --- 42,45 ---- Index: dep_util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dep_util.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dep_util.py 4 Jun 2002 18:55:54 -0000 1.4 --- dep_util.py 14 Nov 2002 02:25:41 -0000 1.5 *************** *** 5,10 **** timestamp dependency analysis.""" - # created 2000/04/03, Greg Ward (extracted from util.py) - __revision__ = "$Id$" --- 5,8 ---- Index: dir_util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dir_util.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dir_util.py 4 Jun 2002 20:14:42 -0000 1.9 --- dir_util.py 14 Nov 2002 02:25:41 -0000 1.10 *************** *** 3,8 **** Utility functions for manipulating directories and directory trees.""" - # created 2000/04/03, Greg Ward (extracted from util.py) - __revision__ = "$Id$" --- 3,6 ---- Index: dist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dist.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** dist.py 31 Oct 2002 13:39:33 -0000 1.58 --- dist.py 14 Nov 2002 02:25:41 -0000 1.59 *************** *** 5,11 **** """ - # created 2000/04/03, Greg Ward - # (extricated from core.py; actually dates back to the beginning) - __revision__ = "$Id$" --- 5,8 ---- Index: emxccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/emxccompiler.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** emxccompiler.py 5 Nov 2002 16:11:54 -0000 1.9 --- emxccompiler.py 14 Nov 2002 02:25:41 -0000 1.10 *************** *** 20,25 **** # * EMX gcc 2.81/EMX 0.9d fix03 - # created 2001/5/7, Andrew MacIntyre, from Rene Liebscher's cywinccompiler.py - __revision__ = "$Id$" --- 20,23 ---- Index: extension.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/extension.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** extension.py 13 Nov 2002 20:54:21 -0000 1.14 --- extension.py 14 Nov 2002 02:25:41 -0000 1.15 *************** *** 4,9 **** modules in setup scripts.""" - # created 2000/05/30, Greg Ward - __revision__ = "$Id$" --- 4,7 ---- Index: fancy_getopt.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/fancy_getopt.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** fancy_getopt.py 4 Jun 2002 21:11:56 -0000 1.25 --- fancy_getopt.py 14 Nov 2002 02:25:41 -0000 1.26 *************** *** 9,14 **** """ - # created 1999/03/03, Greg Ward - __revision__ = "$Id$" --- 9,12 ---- Index: file_util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/file_util.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** file_util.py 4 Jun 2002 20:14:42 -0000 1.13 --- file_util.py 14 Nov 2002 02:25:41 -0000 1.14 *************** *** 4,9 **** """ - # created 2000/04/03, Greg Ward (extracted from util.py) - __revision__ = "$Id$" --- 4,7 ---- Index: filelist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/filelist.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** filelist.py 11 Sep 2002 16:31:52 -0000 1.13 --- filelist.py 14 Nov 2002 02:25:41 -0000 1.14 *************** *** 5,13 **** """ - # created 2000/07/17, Rene Liebscher (as template.py) - # most parts taken from commands/sdist.py - # renamed 2000/07/29 (to filelist.py) and officially added to - # the Distutils source, Greg Ward - __revision__ = "$Id$" --- 5,8 ---- Index: msvccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/msvccompiler.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** msvccompiler.py 5 Nov 2002 16:11:56 -0000 1.50 --- msvccompiler.py 14 Nov 2002 02:25:41 -0000 1.51 *************** *** 5,9 **** ! # created 1999/08/19, Perry Stoll # hacked by Robin Becker and Thomas Heller to do a better job of # finding DevStudio (through the registry) --- 5,9 ---- ! # Written by Perry Stoll # hacked by Robin Becker and Thomas Heller to do a better job of # finding DevStudio (through the registry) Index: spawn.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/spawn.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** spawn.py 4 Jun 2002 20:14:42 -0000 1.13 --- spawn.py 14 Nov 2002 02:25:41 -0000 1.14 *************** *** 7,12 **** """ - # created 1999/07/24, Greg Ward - __revision__ = "$Id$" --- 7,10 ---- Index: sysconfig.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/sysconfig.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** sysconfig.py 14 Nov 2002 01:43:00 -0000 1.55 --- sysconfig.py 14 Nov 2002 02:25:41 -0000 1.56 *************** *** 8,12 **** Written by: Fred L. Drake, Jr. Email: - Initial date: 17-Dec-1998 """ --- 8,11 ---- Index: text_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/text_file.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** text_file.py 6 Dec 2001 20:51:35 -0000 1.14 --- text_file.py 14 Nov 2002 02:25:41 -0000 1.15 *************** *** 5,10 **** lines, and joining lines with backslashes.""" - # created 1999/01/12, Greg Ward - __revision__ = "$Id$" --- 5,8 ---- Index: unixccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/unixccompiler.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** unixccompiler.py 5 Nov 2002 16:11:59 -0000 1.49 --- unixccompiler.py 14 Nov 2002 02:25:42 -0000 1.50 *************** *** 14,19 **** """ - # created 1999/07/05, Greg Ward - __revision__ = "$Id$" --- 14,17 ---- Index: util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/util.py,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** util.py 13 Aug 2002 17:42:57 -0000 1.70 --- util.py 14 Nov 2002 02:25:42 -0000 1.71 *************** *** 5,10 **** """ - # created 1999/03/08, Greg Ward - __revision__ = "$Id$" --- 5,8 ---- Index: version.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/version.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** version.py 6 Dec 2001 20:51:35 -0000 1.6 --- version.py 14 Nov 2002 02:25:42 -0000 1.7 *************** *** 5,10 **** # Python Module Distribution Utilities. # - # written by Greg Ward, 1998/12/17 - # # $Id$ # --- 5,8 ---- From akuchling@users.sourceforge.net Thu Nov 14 02:25:44 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 13 Nov 2002 18:25:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist.py,1.26,1.27 bdist_dumb.py,1.20,1.21 bdist_rpm.py,1.35,1.36 bdist_wininst.py,1.41,1.42 build.py,1.32,1.33 build_clib.py,1.25,1.26 build_ext.py,1.89,1.90 build_py.py,1.39,1.40 build_scripts.py,1.16,1.17 config.py,1.13,1.14 install.py,1.65,1.66 install_headers.py,1.8,1.9 install_lib.py,1.40,1.41 sdist.py,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv2783/command Modified Files: bdist.py bdist_dumb.py bdist_rpm.py bdist_wininst.py build.py build_clib.py build_ext.py build_py.py build_scripts.py config.py install.py install_headers.py install_lib.py sdist.py Log Message: Remove 'created by' lines; people can use CVS for this, and the information is often out of date Index: bdist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** bdist.py 4 Oct 2002 09:30:06 -0000 1.26 --- bdist.py 14 Nov 2002 02:25:42 -0000 1.27 *************** *** 4,9 **** distribution).""" - # created 2000/03/29, Greg Ward - __revision__ = "$Id$" --- 4,7 ---- Index: bdist_dumb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_dumb.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** bdist_dumb.py 4 Jun 2002 20:14:42 -0000 1.20 --- bdist_dumb.py 14 Nov 2002 02:25:42 -0000 1.21 *************** *** 5,10 **** $exec_prefix).""" - # created 2000/03/29, Greg Ward - __revision__ = "$Id$" --- 5,8 ---- Index: bdist_rpm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_rpm.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** bdist_rpm.py 8 Nov 2002 15:11:42 -0000 1.35 --- bdist_rpm.py 14 Nov 2002 02:25:42 -0000 1.36 *************** *** 4,9 **** distributions).""" - # created 2000/04/25, by Harry Henry Gebel - __revision__ = "$Id$" --- 4,7 ---- Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_wininst.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** bdist_wininst.py 14 Nov 2002 01:44:35 -0000 1.41 --- bdist_wininst.py 14 Nov 2002 02:25:42 -0000 1.42 *************** *** 4,9 **** exe-program.""" - # created 2000/06/02, Thomas Heller - __revision__ = "$Id$" --- 4,7 ---- Index: build.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** build.py 10 Dec 2001 15:28:30 -0000 1.32 --- build.py 14 Nov 2002 02:25:42 -0000 1.33 *************** *** 3,8 **** Implements the Distutils 'build' command.""" - # created 1999/03/08, Greg Ward - __revision__ = "$Id$" --- 3,6 ---- Index: build_clib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_clib.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** build_clib.py 4 Jun 2002 20:14:43 -0000 1.25 --- build_clib.py 14 Nov 2002 02:25:42 -0000 1.26 *************** *** 5,11 **** module.""" - # created (an empty husk) 1999/12/18, Greg Ward - # fleshed out 2000/02/03-04 - __revision__ = "$Id$" --- 5,8 ---- Index: build_ext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_ext.py,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** build_ext.py 14 Nov 2002 01:44:34 -0000 1.89 --- build_ext.py 14 Nov 2002 02:25:42 -0000 1.90 *************** *** 5,10 **** extensions ASAP).""" - # created 1999/08/09, Greg Ward - __revision__ = "$Id$" --- 5,8 ---- Index: build_py.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_py.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** build_py.py 4 Jun 2002 21:00:20 -0000 1.39 --- build_py.py 14 Nov 2002 02:25:42 -0000 1.40 *************** *** 3,8 **** Implements the Distutils 'build_py' command.""" - # created 1999/03/08, Greg Ward - __revision__ = "$Id$" --- 3,6 ---- Index: build_scripts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_scripts.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** build_scripts.py 4 Jun 2002 20:14:43 -0000 1.16 --- build_scripts.py 14 Nov 2002 02:25:42 -0000 1.17 *************** *** 3,8 **** Implements the Distutils 'build_scripts' command.""" - # created 2000/05/23, Bastian Kleineidam - __revision__ = "$Id$" --- 3,6 ---- Index: config.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/config.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** config.py 5 Nov 2002 16:12:02 -0000 1.13 --- config.py 14 Nov 2002 02:25:42 -0000 1.14 *************** *** 10,15 **** """ - # created 2000/05/29, Greg Ward - __revision__ = "$Id$" --- 10,13 ---- Index: install.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install.py,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** install.py 11 Sep 2002 16:31:51 -0000 1.65 --- install.py 14 Nov 2002 02:25:42 -0000 1.66 *************** *** 5,10 **** from distutils import log - # created 1999/03/13, Greg Ward - __revision__ = "$Id$" --- 5,8 ---- Index: install_headers.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install_headers.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** install_headers.py 6 Dec 2001 20:57:12 -0000 1.8 --- install_headers.py 14 Nov 2002 02:25:42 -0000 1.9 *************** *** 4,9 **** files to the Python include directory.""" - # created 2000/05/26, Greg Ward - __revision__ = "$Id$" --- 4,7 ---- Index: install_lib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install_lib.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** install_lib.py 4 Jun 2002 20:14:43 -0000 1.40 --- install_lib.py 14 Nov 2002 02:25:42 -0000 1.41 *************** *** 1,4 **** - # created 1999/03/13, Greg Ward - __revision__ = "$Id$" --- 1,2 ---- Index: sdist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/sdist.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** sdist.py 4 Jun 2002 20:14:43 -0000 1.54 --- sdist.py 14 Nov 2002 02:25:42 -0000 1.55 *************** *** 3,8 **** Implements the Distutils 'sdist' command (create a source distribution).""" - # created 1999/09/22, Greg Ward - __revision__ = "$Id$" --- 3,6 ---- From nnorwitz@users.sourceforge.net Thu Nov 14 02:43:43 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 13 Nov 2002 18:43:43 -0800 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tix.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv11273 Modified Files: Tix.py Log Message: Sync Tix from Mike Clarkson, a maintainer Index: Tix.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tix.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Tix.py 19 Sep 2002 08:12:55 -0000 1.11 --- Tix.py 14 Nov 2002 02:43:40 -0000 1.12 *************** *** 286,294 **** # a list of keywords (or None). extra=() if static_options: ! for k,v in cnf.items()[:]: ! if k in static_options: ! extra = extra + ('-' + k, v) ! del cnf[k] self.widgetName = widgetName --- 286,300 ---- # a list of keywords (or None). extra=() + + # 'options' is always a static option if static_options: ! static_options.append('options') ! else: ! static_options = ['options'] ! ! for k,v in cnf.items()[:]: ! if k in static_options: ! extra = extra + ('-' + k, v) ! del cnf[k] self.widgetName = widgetName *************** *** 409,414 **** # Create the intermediate widget parent = TixSubWidget(parent, plist[i], ! destroy_physically=0, ! check_intermediate=0) TixWidget.__init__(self, parent, None, None, {'name' : name}) self.destroy_physically = destroy_physically --- 415,420 ---- # Create the intermediate widget parent = TixSubWidget(parent, plist[i], ! destroy_physically=0, ! check_intermediate=0) TixWidget.__init__(self, parent, None, None, {'name' : name}) self.destroy_physically = destroy_physically *************** *** 473,478 **** return _lst2dict( self.tk.split( ! apply(self.tk.call, ! (self.stylename, 'configure') + self._options(cnf,kw)))) def __getitem__(self,key): --- 479,484 ---- return _lst2dict( self.tk.split( ! apply(self.tk.call, ! (self.stylename, 'configure') + self._options(cnf,kw)))) def __getitem__(self,key): *************** *** 632,638 **** Subwidget Class --------- ----- ! hlist HList ! hsb Scrollbar ! vsb Scrollbar""" def __init__(self, master, cnf={}, **kw): --- 638,644 ---- Subwidget Class --------- ----- ! hlist HList ! hsb Scrollbar ! vsb Scrollbar""" def __init__(self, master, cnf={}, **kw): *************** *** 655,661 **** --------- ----- selection ComboBox ! filter ComboBox ! dirlist ScrolledListBox ! filelist ScrolledListBox""" def __init__(self, master, cnf={}, **kw): --- 661,667 ---- --------- ----- selection ComboBox ! filter ComboBox ! dirlist ScrolledListBox ! filelist ScrolledListBox""" def __init__(self, master, cnf={}, **kw): *************** *** 709,713 **** def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixDirSelectDialog', ! ['options'], cnf, kw) self.subwidget_list['dirbox'] = _dummyDirSelectBox(self, 'dirbox') # cancel and ok buttons are missing --- 715,719 ---- def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixDirSelectDialog', ! ['options'], cnf, kw) self.subwidget_list['dirbox'] = _dummyDirSelectBox(self, 'dirbox') # cancel and ok buttons are missing *************** *** 731,735 **** def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixExFileSelectDialog', ! ['options'], cnf, kw) self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox') --- 737,741 ---- def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixExFileSelectDialog', ! ['options'], cnf, kw) self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox') *************** *** 750,756 **** --------- ----- selection ComboBox ! filter ComboBox ! dirlist ScrolledListBox ! filelist ScrolledListBox""" def __init__(self, master, cnf={}, **kw): --- 756,762 ---- --------- ----- selection ComboBox ! filter ComboBox ! dirlist ScrolledListBox ! filelist ScrolledListBox""" def __init__(self, master, cnf={}, **kw): *************** *** 778,782 **** def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixFileSelectDialog', ! ['options'], cnf, kw) self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns') self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox') --- 784,788 ---- def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixFileSelectDialog', ! ['options'], cnf, kw) self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns') self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox') *************** *** 801,805 **** def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixFileEntry', ! ['dialogtype', 'options'], cnf, kw) self.subwidget_list['button'] = _dummyButton(self, 'button') self.subwidget_list['entry'] = _dummyEntry(self, 'entry') --- 807,811 ---- def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixFileEntry', ! ['dialogtype', 'options'], cnf, kw) self.subwidget_list['button'] = _dummyButton(self, 'button') self.subwidget_list['entry'] = _dummyEntry(self, 'entry') *************** *** 822,830 **** def __init__ (self,master=None,cnf={}, **kw): TixWidget.__init__(self, master, 'tixHList', ! ['columns', 'options'], cnf, kw) def add(self, entry, cnf={}, **kw): return apply(self.tk.call, ! (self._w, 'add', entry) + self._options(cnf, kw)) def add_child(self, parent=None, cnf={}, **kw): --- 828,836 ---- def __init__ (self,master=None,cnf={}, **kw): TixWidget.__init__(self, master, 'tixHList', ! ['columns', 'options'], cnf, kw) def add(self, entry, cnf={}, **kw): return apply(self.tk.call, ! (self._w, 'add', entry) + self._options(cnf, kw)) def add_child(self, parent=None, cnf={}, **kw): *************** *** 832,836 **** parent = '' return apply(self.tk.call, ! (self._w, 'addchild', parent) + self._options(cnf, kw)) def anchor_set(self, entry): --- 838,842 ---- parent = '' return apply(self.tk.call, ! (self._w, 'addchild', parent) + self._options(cnf, kw)) def anchor_set(self, entry): *************** *** 845,849 **** else: return self.tk.call(self._w, 'column', 'width', col, ! '-char', chars) def delete_all(self): --- 851,855 ---- else: return self.tk.call(self._w, 'column', 'width', col, ! '-char', chars) def delete_all(self): *************** *** 878,883 **** if cnf is None: return _lst2dict( ! self.tk.split( ! self.tk.call(self._w, 'header', 'configure', col))) apply(self.tk.call, (self._w, 'header', 'configure', col) + self._options(cnf, kw)) --- 884,889 ---- if cnf is None: return _lst2dict( ! self.tk.split( ! self.tk.call(self._w, 'header', 'configure', col))) apply(self.tk.call, (self._w, 'header', 'configure', col) + self._options(cnf, kw)) *************** *** 905,910 **** if cnf is None: return _lst2dict( ! self.tk.split( ! self.tk.call(self._w, 'indicator', 'configure', entry))) apply(self.tk.call, (self._w, 'indicator', 'configure', entry) + self._options(cnf, kw)) --- 911,916 ---- if cnf is None: return _lst2dict( ! self.tk.split( ! self.tk.call(self._w, 'indicator', 'configure', entry))) apply(self.tk.call, (self._w, 'indicator', 'configure', entry) + self._options(cnf, kw)) *************** *** 957,962 **** if cnf is None: return _lst2dict( ! self.tk.split( ! self.tk.call(self._w, 'item', 'configure', entry, col))) apply(self.tk.call, (self._w, 'item', 'configure', entry, col) + self._options(cnf, kw)) --- 963,968 ---- if cnf is None: return _lst2dict( ! self.tk.split( ! self.tk.call(self._w, 'item', 'configure', entry, col))) apply(self.tk.call, (self._w, 'item', 'configure', entry, col) + self._options(cnf, kw)) *************** *** 1017,1021 **** def __init__ (self,master=None,cnf={}, **kw): TixWidget.__init__(self, master, 'tixLabelEntry', ! ['labelside','options'], cnf, kw) self.subwidget_list['label'] = _dummyLabel(self, 'label') self.subwidget_list['entry'] = _dummyEntry(self, 'entry') --- 1023,1027 ---- def __init__ (self,master=None,cnf={}, **kw): TixWidget.__init__(self, master, 'tixLabelEntry', ! ['labelside','options'], cnf, kw) self.subwidget_list['label'] = _dummyLabel(self, 'label') self.subwidget_list['entry'] = _dummyEntry(self, 'entry') *************** *** 1034,1038 **** def __init__ (self,master=None,cnf={}, **kw): TixWidget.__init__(self, master, 'tixLabelFrame', ! ['labelside','options'], cnf, kw) self.subwidget_list['label'] = _dummyLabel(self, 'label') self.subwidget_list['frame'] = _dummyFrame(self, 'frame') --- 1040,1044 ---- def __init__ (self,master=None,cnf={}, **kw): TixWidget.__init__(self, master, 'tixLabelFrame', ! ['labelside','options'], cnf, kw) self.subwidget_list['label'] = _dummyLabel(self, 'label') self.subwidget_list['frame'] = _dummyFrame(self, 'frame') *************** *** 1048,1056 **** def __init__(self, master, cnf={}, **kw): ! TixWidget.__init__(self, master, 'tixListNoteBook', ['options'], cnf, kw) ! self.subwidget_list['pane'] = _dummyPanedWindow(self, 'pane', ! destroy_physically=0) ! self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') ! self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'vsb') def add(self, name, cnf={}, **kw): --- 1054,1063 ---- def __init__(self, master, cnf={}, **kw): ! TixWidget.__init__(self, master, 'tixListNoteBook', ['options'], cnf, kw) ! # Is this necessary? It's not an exposed subwidget in Tix. ! self.subwidget_list['pane'] = _dummyPanedWindow(self, 'pane', ! destroy_physically=0) ! self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') ! self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'shlist') def add(self, name, cnf={}, **kw): *************** *** 1081,1085 **** def __init__(self, master=None, cnf={}, **kw): TixWidget.__init__(self, master, 'tixMeter', ! ['options'], cnf, kw) class NoteBook(TixWidget): --- 1088,1092 ---- def __init__(self, master=None, cnf={}, **kw): TixWidget.__init__(self, master, 'tixMeter', ! ['options'], cnf, kw) class NoteBook(TixWidget): *************** *** 1094,1098 **** TixWidget.__init__(self,master,'tixNoteBook', ['options'], cnf, kw) self.subwidget_list['nbframe'] = TixSubWidget(self, 'nbframe', ! destroy_physically=0) def add(self, name, cnf={}, **kw): --- 1101,1105 ---- TixWidget.__init__(self,master,'tixNoteBook', ['options'], cnf, kw) self.subwidget_list['nbframe'] = TixSubWidget(self, 'nbframe', ! destroy_physically=0) def add(self, name, cnf={}, **kw): *************** *** 1133,1138 **** Subwidget Class --------- ----- ! menubutton Menubutton ! menu Menu""" def __init__(self, master, cnf={}, **kw): --- 1140,1145 ---- Subwidget Class --------- ----- ! menubutton Menubutton ! menu Menu""" def __init__(self, master, cnf={}, **kw): *************** *** 1172,1182 **** TixWidget.__init__(self, master, 'tixPanedWindow', ['orientation', 'options'], cnf, kw) def add(self, name, cnf={}, **kw): apply(self.tk.call, (self._w, 'add', name) + self._options(cnf, kw)) self.subwidget_list[name] = TixSubWidget(self, name, ! check_intermediate=0) return self.subwidget_list[name] def panes(self): names = self.tk.call(self._w, 'panes') --- 1179,1209 ---- TixWidget.__init__(self, master, 'tixPanedWindow', ['orientation', 'options'], cnf, kw) + # add delete forget panecget paneconfigure panes setsize def add(self, name, cnf={}, **kw): apply(self.tk.call, (self._w, 'add', name) + self._options(cnf, kw)) self.subwidget_list[name] = TixSubWidget(self, name, ! check_intermediate=0) return self.subwidget_list[name] + def delete(self, name): + self.tk.call(self._w, 'delete', name) + self.subwidget_list[name].destroy() + del self.subwidget_list[name] + + def forget(self, name): + self.tk.call(self._w, 'forget', name) + + def panecget(self, entry, opt): + return self.tk.call(self._w, 'panecget', entry, opt) + + def paneconfigure(self, entry, cnf={}, **kw): + if cnf is None: + return _lst2dict( + self.tk.split( + self.tk.call(self._w, 'paneconfigure', entry))) + apply(self.tk.call, + (self._w, 'paneconfigure', entry) + self._options(cnf, kw)) + def panes(self): names = self.tk.call(self._w, 'panes') *************** *** 1222,1226 **** # In fact, x y height width are configurable TixWidget.__init__(self, master, 'tixResizeHandle', ! flags, cnf, kw) def attach_widget(self, widget): --- 1249,1253 ---- # In fact, x y height width are configurable TixWidget.__init__(self, master, 'tixResizeHandle', ! flags, cnf, kw) def attach_widget(self, widget): *************** *** 1241,1245 **** def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixScrolledHList', ['options'], ! cnf, kw) self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') --- 1268,1272 ---- def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixScrolledHList', ['options'], ! cnf, kw) self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') *************** *** 1269,1273 **** def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixScrolledTList', ['options'], ! cnf, kw) self.subwidget_list['tlist'] = _dummyTList(self, 'tlist') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') --- 1296,1300 ---- def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixScrolledTList', ['options'], ! cnf, kw) self.subwidget_list['tlist'] = _dummyTList(self, 'tlist') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') *************** *** 1291,1297 **** def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixSelect', ! ['allowzero', 'radio', 'orientation', 'labelside', ! 'options'], ! cnf, kw) self.subwidget_list['label'] = _dummyLabel(self, 'label') --- 1318,1324 ---- def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixSelect', ! ['allowzero', 'radio', 'orientation', 'labelside', ! 'options'], ! cnf, kw) self.subwidget_list['label'] = _dummyLabel(self, 'label') *************** *** 1305,1308 **** --- 1332,1367 ---- self.tk.call(self._w, 'invoke', name) + class Shell(TixWidget): + """Toplevel window. + + Subwidgets - None""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self, master, 'tixShell', ['options', 'title'], cnf, kw) + + class DialogShell(TixWidget): + """Toplevel window, with popup popdown and center methods. + It tells the window manager that it is a dialog window and should be + treated specially. The exact treatment depends on the treatment of + the window manager. + + Subwidgets - None""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self, master, + 'tixDialogShell', + ['options', 'title', 'mapped', + 'minheight', 'minwidth', + 'parent', 'transient'], cnf, kw) + + def popdown(self): + self.tk.call(self._w, 'popdown') + + def popup(self): + self.tk.call(self._w, 'popup') + + def center(self): + self.tk.call(self._w, 'center') + class StdButtonBox(TixWidget): """StdButtonBox - Standard Button Box (OK, Apply, Cancel and Help) """ *************** *** 1310,1314 **** def __init__(self, master=None, cnf={}, **kw): TixWidget.__init__(self, master, 'tixStdButtonBox', ! ['orientation', 'options'], cnf, kw) self.subwidget_list['ok'] = _dummyButton(self, 'ok') self.subwidget_list['apply'] = _dummyButton(self, 'apply') --- 1369,1373 ---- def __init__(self, master=None, cnf={}, **kw): TixWidget.__init__(self, master, 'tixStdButtonBox', ! ['orientation', 'options'], cnf, kw) self.subwidget_list['ok'] = _dummyButton(self, 'ok') self.subwidget_list['apply'] = _dummyButton(self, 'apply') *************** *** 1362,1366 **** def insert(self, index, cnf={}, **kw): apply(self.tk.call, ! (self._w, 'insert', index) + self._options(cnf, kw)) def info_active(self): --- 1421,1425 ---- def insert(self, index, cnf={}, **kw): apply(self.tk.call, ! (self._w, 'insert', index) + self._options(cnf, kw)) def info_active(self): *************** *** 1418,1422 **** def __init__(self, master=None, cnf={}, **kw): TixWidget.__init__(self, master, 'tixTree', ! ['options'], cnf, kw) self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') --- 1477,1481 ---- def __init__(self, master=None, cnf={}, **kw): TixWidget.__init__(self, master, 'tixTree', ! ['options'], cnf, kw) self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') *************** *** 1552,1559 **** # it may depend on if -dropdown is true; I've added as a trial self.subwidget_list['slistbox'] = _dummyScrolledListBox(self, ! 'slistbox', ! destroy_physically=0) self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox', ! destroy_physically=0) class _dummyDirList(DirList, TixSubWidget): --- 1611,1618 ---- # it may depend on if -dropdown is true; I've added as a trial self.subwidget_list['slistbox'] = _dummyScrolledListBox(self, ! 'slistbox', ! destroy_physically=0) self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox', ! destroy_physically=0) class _dummyDirList(DirList, TixSubWidget): From nnorwitz@users.sourceforge.net Thu Nov 14 02:44:10 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 13 Nov 2002 18:44:10 -0800 Subject: [Python-checkins] python/dist/src/Demo/tix tixwidgets.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/tix In directory usw-pr-cvs1:/tmp/cvs-serv11823 Modified Files: tixwidgets.py Log Message: Sync tixwidgets from Mike Clarkson, a maintainer Index: tixwidgets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/tix/tixwidgets.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tixwidgets.py 17 Mar 2002 18:19:13 -0000 1.6 --- tixwidgets.py 14 Nov 2002 02:44:08 -0000 1.7 *************** *** 7,12 **** # For Tix, see http://tix.sourceforge.net # ! # This is a demo program of all Tix widgets available from Python. If ! # you have installed Python & Tix properly, you can execute this as # # % python tixwidgets.py --- 7,12 ---- # For Tix, see http://tix.sourceforge.net # ! # This is a demo program of some of the Tix widgets available in Python. ! # If you have installed Python & Tix properly, you can execute this as # # % python tixwidgets.py *************** *** 15,18 **** --- 15,19 ---- import os, os.path, sys, Tix from Tkconstants import * + import traceback, tkMessageBox TCL_DONT_WAIT = 1<<1 *************** *** 66,73 **** help['menu'] = hm - if w.tk.eval ('info commands console') == "console": - fm.add_command(label='Console', underline=1, - command=lambda w=w: w.tk.eval('console show')) - fm.add_command(label='Exit', underline=1, command = lambda self=self: self.quitcmd () ) --- 67,70 ---- *************** *** 77,80 **** --- 74,78 ---- #apply(w.tk.call, ('trace', 'variable', self.useBalloons, 'w', # ToggleHelp)) + return w *************** *** 82,88 **** top = self.root w = Tix.NoteBook(top, ipadx=5, ipady=5, options=""" ! *TixNoteBook*tagPadX 6 ! *TixNoteBook*tagPadY 4 ! *TixNoteBook*borderWidth 2 """) # This may be required if there is no *Background option --- 80,86 ---- top = self.root w = Tix.NoteBook(top, ipadx=5, ipady=5, options=""" ! tagPadX 6 ! tagPadY 4 ! borderWidth 2 """) # This may be required if there is no *Background option *************** *** 116,121 **** z = root.winfo_toplevel() z.wm_title('Tix Widget Demonstration') ! z.geometry('790x590+10+10') ! demo.balloon = Tix.Balloon(root) frame1 = self.MkMainMenu() --- 114,121 ---- z = root.winfo_toplevel() z.wm_title('Tix Widget Demonstration') ! if z.winfo_screenwidth() <= 800: ! z.geometry('790x590+10+10') ! else: ! z.geometry('890x640+10+10') demo.balloon = Tix.Balloon(root) frame1 = self.MkMainMenu() *************** *** 128,131 **** --- 128,135 ---- z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd()) + # To show Tcl errors - uncomment this to see the listbox bug. + # Tkinter defines a Tcl tkerror procedure that in effect + # silences all background Tcl error reporting. + # root.tk.eval('if {[info commands tkerror] != ""} {rename tkerror pytkerror}') def quitcmd (self): """Quit our mainloop. It is up to you to call root.destroy() after.""" *************** *** 133,152 **** def loop(self): ! import tkMessageBox, traceback while self.exit < 0: try: ! self.root.tk.dooneevent(TCL_ALL_EVENTS) except SystemExit: #print 'Exit' self.exit = 1 ! break except KeyboardInterrupt: if tkMessageBox.askquestion ('Interrupt', 'Really Quit?') == 'yes': # self.tk.eval('exit') return - else: - pass continue except: t, v, tb = sys.exc_info() text = "" --- 137,164 ---- def loop(self): ! """This is an explict replacement for _tkinter mainloop() ! It lets you catch keyboard interrupts easier, and avoids ! the 20 msec. dead sleep() which burns a constant CPU.""" while self.exit < 0: + # There are 2 whiles here. The outer one lets you continue + # after a ^C interrupt. try: ! # This is the replacement for _tkinter mainloop() ! # It blocks waiting for the next Tcl event using select. ! while self.exit < 0: ! self.root.tk.dooneevent(TCL_ALL_EVENTS) except SystemExit: + # Tkinter uses SystemExit to exit #print 'Exit' self.exit = 1 ! return except KeyboardInterrupt: if tkMessageBox.askquestion ('Interrupt', 'Really Quit?') == 'yes': # self.tk.eval('exit') + self.exit = 1 return continue except: + # Otherwise it's some other error - be nice and say why t, v, tb = sys.exc_info() text = "" *************** *** 160,164 **** def destroy (self): self.root.destroy() ! def RunMain(root): global demo --- 172,176 ---- def destroy (self): self.root.destroy() ! def RunMain(root): global demo *************** *** 255,271 **** def MkChoosers(nb, name): w = nb.page(name) ! prefix = Tix.OptionName(w) ! if not prefix: ! prefix = '' ! w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4) ! til = Tix.LabelFrame(w, label='Chooser Widgets') ! cbx = Tix.LabelFrame(w, label='tixComboBox') ! ctl = Tix.LabelFrame(w, label='tixControl') ! sel = Tix.LabelFrame(w, label='tixSelect') ! opt = Tix.LabelFrame(w, label='tixOptionMenu') ! fil = Tix.LabelFrame(w, label='tixFileEntry') ! fbx = Tix.LabelFrame(w, label='tixFileSelectBox') ! tbr = Tix.LabelFrame(w, label='Tool Bar') MkTitle(til.frame) --- 267,280 ---- def MkChoosers(nb, name): w = nb.page(name) ! options = "label.padX 4" ! til = Tix.LabelFrame(w, label='Chooser Widgets', options=options) ! cbx = Tix.LabelFrame(w, label='tixComboBox', options=options) ! ctl = Tix.LabelFrame(w, label='tixControl', options=options) ! sel = Tix.LabelFrame(w, label='tixSelect', options=options) ! opt = Tix.LabelFrame(w, label='tixOptionMenu', options=options) ! fil = Tix.LabelFrame(w, label='tixFileEntry', options=options) ! fbx = Tix.LabelFrame(w, label='tixFileSelectBox', options=options) ! tbr = Tix.LabelFrame(w, label='Tool Bar', options=options) MkTitle(til.frame) *************** *** 294,307 **** def MkCombo(w): ! prefix = Tix.OptionName(w) ! if not prefix: prefix = '' ! w.option_add('*' + prefix + '*TixComboBox*label.width', 10) ! w.option_add('*' + prefix + '*TixComboBox*label.anchor', Tix.E) ! w.option_add('*' + prefix + '*TixComboBox*entry.width', 14) ! static = Tix.ComboBox(w, label='Static', editable=0) ! editable = Tix.ComboBox(w, label='Editable', editable=1) history = Tix.ComboBox(w, label='History', editable=1, history=1, ! anchor=Tix.E) static.insert(Tix.END, 'January') static.insert(Tix.END, 'February') --- 303,312 ---- def MkCombo(w): ! options="label.width %d label.anchor %s entry.width %d" % (10, Tix.E, 14) ! static = Tix.ComboBox(w, label='Static', editable=0, options=options) ! editable = Tix.ComboBox(w, label='Editable', editable=1, options=options) history = Tix.ComboBox(w, label='History', editable=1, history=1, ! anchor=Tix.E, options=options) static.insert(Tix.END, 'January') static.insert(Tix.END, 'February') *************** *** 356,369 **** global demo_spintxt ! prefix = Tix.OptionName(w) ! if not prefix: prefix = '' ! w.option_add('*' + prefix + '*TixControl*label.width', 10) ! w.option_add('*' + prefix + '*TixControl*label.anchor', Tix.E) ! w.option_add('*' + prefix + '*TixControl*entry.width', 13) demo_spintxt = Tix.StringVar() demo_spintxt.set(states[0]) ! simple = Tix.Control(w, label='Numbers') ! spintxt = Tix.Control(w, label='States', variable=demo_spintxt) spintxt['incrcmd'] = lambda w=spintxt: spin_cmd(w, 1) spintxt['decrcmd'] = lambda w=spintxt: spin_cmd(w, -1) --- 361,371 ---- global demo_spintxt ! options="label.width %d label.anchor %s entry.width %d" % (10, Tix.E, 13) demo_spintxt = Tix.StringVar() demo_spintxt.set(states[0]) ! simple = Tix.Control(w, label='Numbers', options=options) ! spintxt = Tix.Control(w, label='States', variable=demo_spintxt, ! options=options) spintxt['incrcmd'] = lambda w=spintxt: spin_cmd(w, 1) spintxt['decrcmd'] = lambda w=spintxt: spin_cmd(w, -1) *************** *** 372,385 **** simple.pack(side=Tix.TOP, padx=5, pady=3) spintxt.pack(side=Tix.TOP, padx=5, pady=3) ! def MkSelect(w): ! prefix = Tix.OptionName(w) ! if not prefix: prefix = '' ! w.option_add('*' + prefix + '*TixSelect*label.anchor', Tix.CENTER) ! w.option_add('*' + prefix + '*TixSelect*orientation', Tix.VERTICAL) ! w.option_add('*' + prefix + '*TixSelect*labelSide', Tix.TOP) ! sel1 = Tix.Select(w, label='Mere Mortals', allowzero=1, radio=1) ! sel2 = Tix.Select(w, label='Geeks', allowzero=1, radio=0) sel1.add('eat', text='Eat') --- 374,389 ---- simple.pack(side=Tix.TOP, padx=5, pady=3) spintxt.pack(side=Tix.TOP, padx=5, pady=3) ! def MkSelect(w): ! options = "label.anchor %s" % Tix.CENTER ! sel1 = Tix.Select(w, label='Mere Mortals', allowzero=1, radio=1, ! orientation=Tix.VERTICAL, ! labelside=Tix.TOP, ! options=options) ! sel2 = Tix.Select(w, label='Geeks', allowzero=1, radio=0, ! orientation=Tix.VERTICAL, ! labelside= Tix.TOP, ! options=options) sel1.add('eat', text='Eat') *************** *** 399,406 **** def MkOptMenu(w): ! prefix = Tix.OptionName(w) ! if not prefix: prefix = '' ! w.option_add('*' + prefix + '*TixOptionMenu*label.anchor', Tix.E) ! m = Tix.OptionMenu(w, label='File Format : ', options='menubutton.width 15') m.add_command('text', label='Plain Text') m.add_command('post', label='PostScript') --- 403,409 ---- def MkOptMenu(w): ! options='menubutton.width 15 label.anchor %s' % Tix.E ! ! m = Tix.OptionMenu(w, label='File Format : ', options=options) m.add_command('text', label='Plain Text') m.add_command('post', label='PostScript') *************** *** 414,418 **** def MkFileEnt(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='Press the "open file" icon button and a TixFileSelectDialog will popup.') --- 417,421 ---- def MkFileEnt(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='Press the "open file" icon button and a TixFileSelectDialog will popup.') *************** *** 426,430 **** and your past selections are recorded. """ ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The Tix FileSelectBox is a Motif-style box with various enhancements. For example, you can adjust the size of the two listboxes and your past selections are recorded.') --- 429,433 ---- and your past selections are recorded. """ ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The Tix FileSelectBox is a Motif-style box with various enhancements. For example, you can adjust the size of the two listboxes and your past selections are recorded.') *************** *** 434,448 **** def MkToolBar(w): global demo ! prefix = Tix.OptionName(w) ! if not prefix: prefix = '' ! w.option_add('*' + prefix + '*TixSelect*frame.borderWidth', 1) ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The Select widget is also good for arranging buttons in a tool bar.') bar = Tix.Frame(w, bd=2, relief=Tix.RAISED) ! font = Tix.Select(w, allowzero=1, radio=0, label='') ! para = Tix.Select(w, allowzero=0, radio=1, label='') font.add('bold', bitmap='@' + demo.dir + '/bitmaps/bold.xbm') --- 437,452 ---- def MkToolBar(w): + """The Select widget is also good for arranging buttons in a tool bar. + """ global demo ! options='frame.borderWidth 1' ! ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The Select widget is also good for arranging buttons in a tool bar.') bar = Tix.Frame(w, bd=2, relief=Tix.RAISED) ! font = Tix.Select(w, allowzero=1, radio=0, label='', options=options) ! para = Tix.Select(w, allowzero=0, radio=1, label='', options=options) font.add('bold', bitmap='@' + demo.dir + '/bitmaps/bold.xbm') *************** *** 462,469 **** def MkTitle(w): ! prefix = Tix.OptionName(w) ! if not prefix: prefix = '' ! w.option_add('*' + prefix + '*TixSelect*frame.borderWidth', 1) ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='There are many types of "chooser" widgets that allow the user to input different types of information') --- 466,470 ---- def MkTitle(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='There are many types of "chooser" widgets that allow the user to input different types of information') *************** *** 472,483 **** def MkScroll(nb, name): w = nb.page(name) ! prefix = Tix.OptionName(w) ! if not prefix: ! prefix = '' ! w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4) ! sls = Tix.LabelFrame(w, label='tixScrolledListBox') ! swn = Tix.LabelFrame(w, label='tixScrolledWindow') ! stx = Tix.LabelFrame(w, label='tixScrolledText') MkSList(sls.frame) --- 473,481 ---- def MkScroll(nb, name): w = nb.page(name) ! options='label.padX 4' ! sls = Tix.LabelFrame(w, label='tixScrolledListBox', options=options) ! swn = Tix.LabelFrame(w, label='tixScrolledWindow', options=options) ! stx = Tix.LabelFrame(w, label='tixScrolledText', options=options) MkSList(sls.frame) *************** *** 489,496 **** stx.form(top=0, left=swn, right=-1, bottom=-1) def MkSList(w): top = Tix.Frame(w, width=300, height=330) bot = Tix.Frame(w) ! msg = Tix.Message(top, relief=Tix.FLAT, width=200, anchor=Tix.N, text='This TixScrolledListBox is configured so that it uses scrollbars only when it is necessary. Use the handles to resize the listbox and watch the scrollbars automatically appear and disappear.') --- 487,498 ---- stx.form(top=0, left=swn, right=-1, bottom=-1) + def MkSList(w): + """This TixScrolledListBox is configured so that it uses scrollbars + only when it is necessary. Use the handles to resize the listbox and + watch the scrollbars automatically appear and disappear. """ top = Tix.Frame(w, width=300, height=330) bot = Tix.Frame(w) ! msg = Tix.Message(top, relief=Tix.FLAT, width=200, anchor=Tix.N, text='This TixScrolledListBox is configured so that it uses scrollbars only when it is necessary. Use the handles to resize the listbox and watch the scrollbars automatically appear and disappear.') *************** *** 523,534 **** rh.attach_widget(list) - # See below why this is necessary. - global image1 - image1 = None def MkSWindow(w): ! global demo, image1 - text = 'The TixScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.' - file = os.path.join(demo.dir, 'bitmaps', 'tix.gif') if not os.path.isfile(file): --- 525,536 ---- rh.attach_widget(list) def MkSWindow(w): ! """The ScrolledWindow widget allows you to scroll any kind of Tk ! widget. It is more versatile than a scrolled canvas widget. ! """ ! global demo ! ! text = 'The Tix ScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.' file = os.path.join(demo.dir, 'bitmaps', 'tix.gif') if not os.path.isfile(file): *************** *** 537,541 **** top = Tix.Frame(w, width=330, height=330) bot = Tix.Frame(w) ! msg = Tix.Message(top, relief=Tix.FLAT, width=200, anchor=Tix.N, text=text) --- 539,543 ---- top = Tix.Frame(w, width=330, height=330) bot = Tix.Frame(w) ! msg = Tix.Message(top, relief=Tix.FLAT, width=200, anchor=Tix.N, text=text) *************** *** 543,550 **** win = Tix.ScrolledWindow(top, scrollbar='auto') ! # This image is not showing up under Python unless it is set to a ! # global variable - no problem under Tcl. I assume it is being garbage ! # collected some how, even though the tcl command 'image names' shows ! # that as far as Tcl is concerned, the image exists and is called pyimage1. image1 = Tix.Image('photo', file=file) lbl = Tix.Label(win.window, image=image1) --- 545,552 ---- win = Tix.ScrolledWindow(top, scrollbar='auto') ! global image1 ! # This image is not showing up in the Label unless it is set to a ! # global variable - no problem under Tcl/Tix. It is being ! # garbage collected at the end of this proecedure if not global image1 = Tix.Image('photo', file=file) lbl = Tix.Label(win.window, image=image1) *************** *** 562,567 **** top.pack(expand=1, fill=Tix.BOTH) bot.pack(fill=Tix.BOTH) - win.bind('', func=lambda arg=0, rh=rh, win=win: - win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win))) def SWindow_reset(rh, win): --- 564,567 ---- *************** *** 571,579 **** def MkSText(w): top = Tix.Frame(w, width=330, height=330) bot = Tix.Frame(w) ! msg = Tix.Message(top, relief=Tix.FLAT, width=200, anchor=Tix.N, ! text='The TixScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.') win = Tix.ScrolledText(top, scrollbar='auto') --- 571,581 ---- def MkSText(w): + """The TixScrolledWindow widget allows you to scroll any kind of Tk + widget. It is more versatile than a scrolled canvas widget.""" top = Tix.Frame(w, width=330, height=330) bot = Tix.Frame(w) ! msg = Tix.Message(top, relief=Tix.FLAT, width=200, anchor=Tix.N, ! text='The Tix ScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.') win = Tix.ScrolledText(top, scrollbar='auto') *************** *** 601,611 **** def MkManager(nb, name): w = nb.page(name) ! prefix = Tix.OptionName(w) ! if not prefix: ! prefix = '' ! w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4) ! pane = Tix.LabelFrame(w, label='tixPanedWindow') ! note = Tix.LabelFrame(w, label='tixNoteBook') MkPanedWindow(pane.frame) --- 603,610 ---- def MkManager(nb, name): w = nb.page(name) ! options='label.padX 4' ! pane = Tix.LabelFrame(w, label='tixPanedWindow', options=options) ! note = Tix.LabelFrame(w, label='tixNoteBook', options=options) MkPanedWindow(pane.frame) *************** *** 616,620 **** def MkPanedWindow(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The PanedWindow widget allows the user to interactively manipulate the sizes of several panes. The panes can be arranged either vertically or horizontally.') --- 615,623 ---- def MkPanedWindow(w): ! """The PanedWindow widget allows the user to interactively manipulate ! the sizes of several panes. The panes can be arranged either vertically ! or horizontally. ! """ ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The PanedWindow widget allows the user to interactively manipulate the sizes of several panes. The panes can be arranged either vertically or horizontally.') *************** *** 659,674 **** def MkNoteBook(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The NoteBook widget allows you to layout a complex interface into individual pages.') ! prefix = Tix.OptionName(w) ! if not prefix: ! prefix = '' ! w.option_add('*' + prefix + '*TixControl*entry.width', 10) ! w.option_add('*' + prefix + '*TixControl*label.width', 18) ! w.option_add('*' + prefix + '*TixControl*label.anchor', Tix.E) ! w.option_add('*' + prefix + '*TixNoteBook*tagPadX', 8) ! nb = Tix.NoteBook(w, ipadx=6, ipady=6) nb.add('hard_disk', label="Hard Disk", underline=0) nb.add('network', label="Network", underline=0) --- 662,674 ---- def MkNoteBook(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, text='The NoteBook widget allows you to layout a complex interface into individual pages.') ! # prefix = Tix.OptionName(w) ! # if not prefix: prefix = '' ! # w.option_add('*' + prefix + '*TixNoteBook*tagPadX', 8) ! options = "entry.width %d label.width %d label.anchor %s" % (10, 18, Tix.E) ! nb = Tix.NoteBook(w, ipadx=6, ipady=6, options=options) nb.add('hard_disk', label="Hard Disk", underline=0) nb.add('network', label="Network", underline=0) *************** *** 715,725 **** def MkDirList(nb, name): w = nb.page(name) ! prefix = Tix.OptionName(w) ! if not prefix: ! prefix = '' ! w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4) ! dir = Tix.LabelFrame(w, label='tixDirList') ! fsbox = Tix.LabelFrame(w, label='tixExFileSelectBox') MkDirListWidget(dir.frame) MkExFileWidget(fsbox.frame) --- 715,722 ---- def MkDirList(nb, name): w = nb.page(name) ! options = "label.padX 4" ! dir = Tix.LabelFrame(w, label='tixDirList', options=options) ! fsbox = Tix.LabelFrame(w, label='tixExFileSelectBox', options=options) MkDirListWidget(dir.frame) MkExFileWidget(fsbox.frame) *************** *** 728,734 **** def MkDirListWidget(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, ! text='The TixDirList widget gives a graphical representation of the file system directory and makes it easy for the user to choose and access directories.') dirlist = Tix.DirList(w, options='hlist.padY 1 hlist.width 25 hlist.height 16') msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3) --- 725,735 ---- def MkDirListWidget(w): ! """The TixDirList widget gives a graphical representation of the file ! system directory and makes it easy for the user to choose and access ! directories. ! """ ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, ! text='The Tix DirList widget gives a graphical representation of the file system directory and makes it easy for the user to choose and access directories.') dirlist = Tix.DirList(w, options='hlist.padY 1 hlist.width 25 hlist.height 16') msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3) *************** *** 736,742 **** def MkExFileWidget(w): ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, ! text='The TixExFileSelectBox widget is more user friendly than the Motif style FileSelectBox.') # There's a bug in the ComboBoxes - the scrolledlistbox is destroyed box = Tix.ExFileSelectBox(w, bd=2, relief=Tix.RAISED) --- 737,745 ---- def MkExFileWidget(w): ! """The TixExFileSelectBox widget is more user friendly than the Motif ! style FileSelectBox. """ ! msg = Tix.Message(w, relief=Tix.FLAT, width=240, anchor=Tix.N, ! text='The Tix ExFileSelectBox widget is more user friendly than the Motif style FileSelectBox.') # There's a bug in the ComboBoxes - the scrolledlistbox is destroyed box = Tix.ExFileSelectBox(w, bd=2, relief=Tix.RAISED) *************** *** 774,795 **** ## {d "Image Types" image } ## } ! ## ## set image { ## {d "Compound Image" cmpimg } ## {d "XPM Image" xpm {i pixmap}} ## } ! ## ## set cmpimg { ! ## {f "In Buttons" CmpImg.tcl } ## {f "In NoteBook" CmpImg2.tcl } ## {f "Notebook Color Tabs" CmpImg4.tcl } ## {f "Icons" CmpImg3.tcl } ## } ! ## ## set xpm { ## {f "In Button" Xpm.tcl {i pixmap}} ## {f "In Menu" Xpm1.tcl {i pixmap}} ## } ! ## ## set file { ##added {f DirList DirList.tcl } --- 777,798 ---- ## {d "Image Types" image } ## } ! ## ## set image { ## {d "Compound Image" cmpimg } ## {d "XPM Image" xpm {i pixmap}} ## } ! ## ## set cmpimg { ! ##done {f "In Buttons" CmpImg.tcl } ## {f "In NoteBook" CmpImg2.tcl } ## {f "Notebook Color Tabs" CmpImg4.tcl } ## {f "Icons" CmpImg3.tcl } ## } ! ## ## set xpm { ## {f "In Button" Xpm.tcl {i pixmap}} ## {f "In Menu" Xpm1.tcl {i pixmap}} ## } ! ## ## set file { ##added {f DirList DirList.tcl } *************** *** 800,804 **** ## {f FileEntry FileEnt.tcl } ## } ! ## ## set hlist { ## {f HList HList1.tcl } --- 803,807 ---- ## {f FileEntry FileEnt.tcl } ## } ! ## ## set hlist { ## {f HList HList1.tcl } *************** *** 809,813 **** ##done {f "Tree (Dynamic)" DynTree.tcl {v win}} ## } ! ## ## set tlist { ## {f "ScrolledTList (1)" STList1.tcl {c tixTList}} --- 812,816 ---- ##done {f "Tree (Dynamic)" DynTree.tcl {v win}} ## } ! ## ## set tlist { ## {f "ScrolledTList (1)" STList1.tcl {c tixTList}} *************** *** 819,823 **** ##na lappend tlist {f "TList File Viewer" STList3.tcl {c tixTList}} ## } ! ## ## set grid { ##na {f "Simple Grid" SGrid0.tcl {c tixGrid}} --- 822,826 ---- ##na lappend tlist {f "TList File Viewer" STList3.tcl {c tixTList}} ## } ! ## ## set grid { ##na {f "Simple Grid" SGrid0.tcl {c tixGrid}} *************** *** 825,829 **** ##na {f "Editable Grid" EditGrid.tcl {c tixGrid}} ## } ! ## ## set scroll { ## {f ScrolledListBox SListBox.tcl } --- 828,832 ---- ##na {f "Editable Grid" EditGrid.tcl {c tixGrid}} ## } ! ## ## set scroll { ## {f ScrolledListBox SListBox.tcl } *************** *** 832,842 **** ##na {f "Canvas Object View" CObjView.tcl {c tixCObjView}} ## } ! ## ## set manager { ! ##na {f ListNoteBook ListNBK.tcl } ##done {f NoteBook NoteBook.tcl } ##done {f PanedWindow PanedWin.tcl } ## } ! ## ## set misc { ##done {f Balloon Balloon.tcl } --- 835,845 ---- ##na {f "Canvas Object View" CObjView.tcl {c tixCObjView}} ## } ! ## ## set manager { ! ## {f ListNoteBook ListNBK.tcl } ##done {f NoteBook NoteBook.tcl } ##done {f PanedWindow PanedWin.tcl } ## } ! ## ## set misc { ##done {f Balloon Balloon.tcl } *************** *** 846,850 **** ## {f LabelEntry LabEntry.tcl } ## {f LabelFrame LabFrame.tcl } ! ##na {f Meter Meter.tcl {c tixMeter}} ##done {f OptionMenu OptMenu.tcl } ##done {f PopupMenu PopMenu.tcl } --- 849,853 ---- ## {f LabelEntry LabEntry.tcl } ## {f LabelFrame LabFrame.tcl } ! ## {f Meter Meter.tcl {c tixMeter}} ##done {f OptionMenu OptMenu.tcl } ##done {f PopupMenu PopMenu.tcl } *************** *** 863,872 **** def MkSample(nb, name): w = nb.page(name) ! prefix = Tix.OptionName(w) ! if not prefix: ! prefix = '' ! else: ! prefix = '*' + prefix ! w.option_add(prefix + '*TixLabelFrame*label.padX', 4) pane = Tix.PanedWindow(w, orientation='horizontal') --- 866,870 ---- def MkSample(nb, name): w = nb.page(name) ! options = "label.padX 4" pane = Tix.PanedWindow(w, orientation='horizontal') *************** *** 877,899 **** f2['relief'] = 'flat' ! lab = Tix.Label(f1, text='Select a sample program:', anchor=Tix.W) ! lab.pack(side=Tix.TOP, expand=0, fill=Tix.X, padx=5, pady=5) ! lab1 = Tix.Label(f2, text='Source:', anchor=Tix.W) ! lab1.pack(side=Tix.TOP, expand=0, fill=Tix.X, padx=5, pady=5) ! slb = Tix.Tree(f1, options='hlist.width 25') slb.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5) ! stext = Tix.ScrolledText(f2, name='stext') font = root.tk.eval('tix option get fixed_font') stext.text.config(font=font) - stext.text.bind('', lambda w=stext.text: w.yview(scroll='-1 unit')) - stext.text.bind('', lambda w=stext.text: w.yview(scroll='1 unit')) - stext.text.bind('', lambda w=stext.text: w.xview(scroll='-1 unit')) - stext.text.bind('', lambda w=stext.text: w.xview(scroll='1 unit')) - stext.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=7) ! frame = Tix.Frame(f2, name='frame') ! frame.pack(side=Tix.TOP, expand=0, fill=Tix.X, padx=7) run = Tix.Button(frame, text='Run ...', name='run') --- 875,891 ---- f2['relief'] = 'flat' ! lab = Tix.LabelFrame(f1, label='Select a sample program:') ! lab.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5, pady=5) ! lab1 = Tix.LabelFrame(f2, label='Source:') ! lab1.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5, pady=5) ! slb = Tix.Tree(lab.frame, options='hlist.width 20') slb.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5) ! stext = Tix.ScrolledText(lab1.frame, name='stext') font = root.tk.eval('tix option get fixed_font') stext.text.config(font=font) ! frame = Tix.Frame(lab1.frame, name='frame') run = Tix.Button(frame, text='Run ...', name='run') *************** *** 906,909 **** --- 898,904 ---- stext.text['wrap'] = 'none' stext.text['width'] = 80 + + frame.pack(side=Tix.BOTTOM, expand=0, fill=Tix.X, padx=7) + stext.pack(side=Tix.TOP, expand=0, fill=Tix.BOTH, padx=7) slb.hlist['separator'] = '.' From nnorwitz@users.sourceforge.net Thu Nov 14 03:31:35 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 13 Nov 2002 19:31:35 -0800 Subject: [Python-checkins] python/dist/src/Lib string.py,1.66,1.67 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28637/Lib Modified Files: string.py Log Message: Update the docstring to match the code. Will backport. Index: string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/string.py,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** string.py 8 Nov 2002 12:09:59 -0000 1.66 --- string.py 14 Nov 2002 03:31:32 -0000 1.67 *************** *** 76,83 **** # Strip leading and trailing tabs and spaces def strip(s, chars=None): ! """strip(s) -> string Return a copy of the string s with leading and trailing whitespace removed. """ --- 76,85 ---- # Strip leading and trailing tabs and spaces def strip(s, chars=None): ! """strip(s [,chars]) -> string Return a copy of the string s with leading and trailing whitespace removed. + If chars is given and not None, remove characters in sep instead. + If chars is unicode, S will be converted to unicode before stripping. """ From nnorwitz@users.sourceforge.net Thu Nov 14 03:32:10 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 13 Nov 2002 19:32:10 -0800 Subject: [Python-checkins] python/dist/src/Lib string.py,1.60.16.3,1.60.16.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28799/Lib Modified Files: Tag: release22-maint string.py Log Message: Update the docstring to match the code. Index: string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/string.py,v retrieving revision 1.60.16.3 retrieving revision 1.60.16.4 diff -C2 -d -r1.60.16.3 -r1.60.16.4 *** string.py 8 Nov 2002 12:11:03 -0000 1.60.16.3 --- string.py 14 Nov 2002 03:32:08 -0000 1.60.16.4 *************** *** 75,82 **** # Strip leading and trailing tabs and spaces def strip(s, chars=None): ! """strip(s) -> string Return a copy of the string s with leading and trailing whitespace removed. """ --- 75,84 ---- # Strip leading and trailing tabs and spaces def strip(s, chars=None): ! """strip(s [,chars]) -> string Return a copy of the string s with leading and trailing whitespace removed. + If chars is given and not None, remove characters in sep instead. + If chars is unicode, S will be converted to unicode before stripping. """ From montanaro@users.sourceforge.net Thu Nov 14 03:58:22 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 13 Nov 2002 19:58:22 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib lib.tex,1.205,1.206 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv2432 Modified Files: lib.tex Log Message: add liblogging Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.205 retrieving revision 1.206 diff -C2 -d -r1.205 -r1.206 *** lib.tex 5 Nov 2002 16:50:04 -0000 1.205 --- lib.tex 14 Nov 2002 03:58:20 -0000 1.206 *************** *** 155,158 **** --- 155,159 ---- \input{liblocale} \input{libgettext} + \input{liblogging} \input{libsomeos} % Optional Operating System Services From montanaro@users.sourceforge.net Thu Nov 14 03:57:21 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 13 Nov 2002 19:57:21 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib liblogging.tex,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv2105 Added Files: liblogging.tex Log Message: initial rough cut at documentation of logging module. This is basically just a conversion of pydoc.help(logging). --- NEW FILE: liblogging.tex --- \section{\module{logging} --- Logging facility for Python} \declaremodule{standard}{logging} % standard library, in Python % These apply to all modules, and may be given more than once: \moduleauthor{Vinay Sajip}{vinay_sajip@red-dove.com} \sectionauthor{Skip Montanaro}{skip@pobox.com} \modulesynopsis{Logging module for Python based on PEP 282.} There is a need for a standard logging system in Python, as documented in {}\pep{282} and enthusiastically endorsed by the Guido van Rossum in the {}\citetitle[http://www.python.org/doc/essays/pepparade.html]{Parade of the PEPs}. By a happy coincidence, the package described here was already in development and fairly close in intent and design to the description in the aforementioned PEP, borrowing as it did heavily from JSR-47 (now JDK 1.4's [...1100 lines suppressed...] mymodule.doIt() except Exception, e: log.exception("There was a problem doin' stuff.") log.info("end my app") \end{verbatim} When you run \code{myapp.py}, the results are: \begin{verbatim} 2002-03-14 23:40:49,299 MyApp INFO - start my app 2002-03-14 23:40:49,299 MyModule DEBUG - doin' stuff 2002-03-14 23:40:49,299 MyApp ERROR - There was a problem doin' stuff. Traceback (innermost last): File "myapp.py", line 9, in ? mymodule.doIt() File "mymodule.py", line 7, in doIt raise TypeError, "bogus type error for testing" TypeError: bogus type error for testing 2002-03-14 23:40:49,409 MyApp INFO - end my app \end{verbatim} From nnorwitz@users.sourceforge.net Thu Nov 14 04:56:11 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 13 Nov 2002 20:56:11 -0800 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.101,1.102 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv17447 Modified Files: Makefile.pre.in Log Message: Fix SF # 638126, logging module not installed Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** Makefile.pre.in 6 Nov 2002 21:59:30 -0000 1.101 --- Makefile.pre.in 14 Nov 2002 04:56:09 -0000 1.102 *************** *** 612,616 **** XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax LIBSUBDIRS= lib-old lib-tk site-packages test test/output test/data \ ! encodings email compiler hotshot \ distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS) libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR) --- 612,616 ---- XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax LIBSUBDIRS= lib-old lib-tk site-packages test test/output test/data \ ! encodings email compiler hotshot logging \ distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS) libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR) From gvanrossum@users.sourceforge.net Thu Nov 14 12:52:19 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 14 Nov 2002 04:52:19 -0800 Subject: [Python-checkins] python/dist/src/Lib/logging config.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/logging In directory usw-pr-cvs1:/tmp/cvs-serv28432 Modified Files: config.py Log Message: >From SF patch 638299 [by Vinaj]: fileConfig() now takes an optional defaults dictionary parameter which is passed to ConfigParser. Index: config.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/config.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** config.py 13 Nov 2002 16:18:29 -0000 1.2 --- config.py 14 Nov 2002 12:52:17 -0000 1.3 *************** *** 41,45 **** _listener = None ! def fileConfig(fname): """ Read the logging configuration from a ConfigParser-format file. --- 41,45 ---- _listener = None ! def fileConfig(fname, defaults=None): """ Read the logging configuration from a ConfigParser-format file. *************** *** 56,60 **** import ConfigParser ! cp = ConfigParser.ConfigParser() if hasattr(cp, 'readfp') and hasattr(fname, 'readline'): cp.readfp(fname) --- 56,60 ---- import ConfigParser ! cp = ConfigParser.ConfigParser(defaults) if hasattr(cp, 'readfp') and hasattr(fname, 'readline'): cp.readfp(fname) From akuchling@users.sourceforge.net Thu Nov 14 14:14:18 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 14 Nov 2002 06:14:18 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv31309 Modified Files: whatsnew23.tex Log Message: Add partial section on the logging package; not finished yet. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** whatsnew23.tex 13 Nov 2002 14:59:06 -0000 1.65 --- whatsnew23.tex 14 Nov 2002 14:14:16 -0000 1.66 *************** *** 416,419 **** --- 416,523 ---- %====================================================================== + \section{PEP 282: The \module{logging} Package} + + A standard package for writing logs, the \module{logging} package, was + added. It provides a powerful and flexible way for components to + generate logging output which can then be filtered and processed in + various ways. The logging system can parse a configuration file to + control its behaviour. Logs can be written to standard error, a file + or a socket, sent to the system log, e-mailed to a particular address, + or buffered in memory. It's also possible to write your own handler + classes, of course. + + You can have multiple \class{Logger} objects, each one used by a + particular subsystem of your code. Each \class{Logger} is identified + by a name, and names are organized into a hierarchy using \samp{.} as + the component separator. For example, you might have \class{Logger} + instances named \samp{server}, \samp{server.auth} and + \samp{server.network}. The latter two instances fall under the + \samp{server} \class{Logger} in the hierarchy. This means that if you + turn up the verbosity for \samp{server}, or direct + \samp{server} messages to a different handler, + the changes will also apply to \samp{server.auth} and + \samp{server.network}. + There's also a root \class{Logger} with the name \samp{root}, + parent of all other instances. + + The \module{logging} package contains some convenience functions + that always use the root log: + + \begin{verbatim} + import logging + + logging.debug('Debugging information') + logging.info('Informational message') + logging.warn('Warning: config file %s not found', 'server.conf') + logging.error('Error occurred') + logging.critical('Critical error -- shutting down') + \end{verbatim} + + This produces the following output: + + \begin{verbatim} + WARN:root:Warning: config file not found + ERROR:root:Error occurred + CRITICAL:root:Critical error -- shutting down + \end{verbatim} + + In the default configuration, informational and debugging messages are + suppressed and the output is sent to standard error. Note the + \function{warn()} call's use of string formatting operators; all of + the functions for logging messages take the arguments + \code{(\var{msg}, \var{arg1}, \var{arg2}, ...)} and log the string resulting from + \code{\var{msg} \% (\var{arg1}, \var{arg2}, ...)}. + + There's also an \function{exception()} function that records the most + recent traceback. Any of the other functions will also record the + traceback by specifying the keyword argument \code{exc_info} as + \code{True}. + + \begin{verbatim} + def f(): + try: 1/0 + except: logging.exception('Problem recorded') + + f() + \end{verbatim} + + This produces the following output: + + \begin{verbatim} + ERROR:root:Problem recorded + Traceback (most recent call last): + File "t.py", line 6, in f + 1/0 + ZeroDivisionError: integer division or modulo by zero + \end{verbatim} + + The \function{getLogger(\var{name})} is used to get a particular log. + + \begin{verbatim} + log = logging.getLogger('server') + ... + log.info('Listening on port %i', port) + ... + log.critical('Disk full') + ... + \end{verbatim} + + XXX finish this section + + This is only a partial overview of the \module{logging} package's + features; see the + \citetitle[http://www.python.org/dev/doc/devel/lib/module-logging.html]{\module{logging} + package's reference documentation} for all of the details. + + + \begin{seealso} + + \seepep{282}{A Logging System}{Written by Vinay Sajip and Trent Mick; + implemented by Vinay Sajip.} + + \end{seealso} + + + %====================================================================== \section{PEP 285: The \class{bool} Type\label{section-bool}} *************** *** 685,689 **** >>> d.pop(4) Traceback (most recent call last): ! File ``stdin'', line 1, in ? KeyError: 4 >>> d.pop(1) --- 789,793 ---- >>> d.pop(4) Traceback (most recent call last): ! File "stdin", line 1, in ? KeyError: 4 >>> d.pop(1) *************** *** 691,695 **** >>> d.pop(1) Traceback (most recent call last): ! File ``stdin'', line 1, in ? KeyError: pop(): dictionary is empty >>> d --- 795,799 ---- >>> d.pop(1) Traceback (most recent call last): ! File "stdin", line 1, in ? KeyError: pop(): dictionary is empty >>> d *************** *** 1020,1026 **** >>> random.sample(pop, 7) # Can't choose more than six Traceback (most recent call last): ! File ``'', line 1, in ? ! File ``/home/amk/src/sf/python/dist/src/Lib/random.py'', line 396, in sample ! raise ValueError, ``sample larger than population'' ValueError: sample larger than population >>> --- 1124,1130 ---- >>> random.sample(pop, 7) # Can't choose more than six Traceback (most recent call last): ! File "", line 1, in ? ! File "random.py", line 396, in sample ! raise ValueError, "sample larger than population" ValueError: sample larger than population >>> From tim_one@users.sourceforge.net Thu Nov 14 16:23:31 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 14 Nov 2002 08:23:31 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_bz2.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv28925/python/Lib/test Modified Files: test_bz2.py Log Message: This uses only one temp file at a time, so use test_support.TESTFN as the name instead of enduring nanny "security warnings" from tempfile.mktemp(). Index: test_bz2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bz2.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_bz2.py 9 Nov 2002 06:51:30 -0000 1.9 --- test_bz2.py 14 Nov 2002 16:23:29 -0000 1.10 *************** *** 1,4 **** --- 1,5 ---- #!/usr/bin/python from test import test_support + from test.test_support import TESTFN import unittest *************** *** 6,10 **** import os import popen2 - import tempfile import sys --- 7,10 ---- *************** *** 41,45 **** def setUp(self): ! self.filename = tempfile.mktemp("bz2") def tearDown(self): --- 41,45 ---- def setUp(self): ! self.filename = TESTFN def tearDown(self): From gvanrossum@users.sourceforge.net Thu Nov 14 17:05:38 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 14 Nov 2002 09:05:38 -0800 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.21,1.22 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv16419 Modified Files: pep-0283.txt Log Message: Some updates to the status list. Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** pep-0283.txt 13 Nov 2002 20:55:40 -0000 1.21 --- pep-0283.txt 14 Nov 2002 17:05:36 -0000 1.22 *************** *** 56,63 **** Completed features for 2.3 ! This list is not complete; e.g. missing are bool, PyMalloc, and ! universal newlines, which were in before this PEP appeared. ! - PEP 263 Defining Python Source Code Encodings Implemented (at least phase 1, which is all that's planned for --- 56,69 ---- Completed features for 2.3 ! This list is not complete. See Doc/whatsnew/whatsnew23.tex in CVS ! for more, and of course Misc/NEWS for the full list. ! - The bool type and its constants, True and False (PEP 285). ! ! - PyMalloc was greatly enhanced and is enabled by default. ! ! - Universal newline support (PEP 278). ! ! - PEP 263 Defining Python Source Code Encodings Lemburg Implemented (at least phase 1, which is all that's planned for *************** *** 112,115 **** --- 118,127 ---- str.decode can now be customized. + - PEP 282 A Logging System Mick + + Vinay Sajip's implementation has been packagized and imported. + (Documentation and unit tests still pending.) + http://www.python.org/sf/578494 + Planned features for 2.3 *************** *** 124,127 **** --- 136,146 ---- life of the 2.3 development process. + - A modified MRO (Method Resolution Order) algorithm. Consensus + is that we should adopt C3. Samuele Pedroni has contributed a + draft implementation in C, see http://www.python.org/sf/619475 + + - For a class defined inside another class, the __name__ should be + "outer.inner", and pickling should work. + - PEP 273 Import Modules from Zip Archives Ahlstrom *************** *** 129,143 **** http://www.python.org/sf/492105 - - PEP 282 A Logging System Mick - - Vinay Sajip's implementation is close to completion, but could - stand a restructuring (some of the classes don't belong in the - core module; maybe the whole thing should become a package). - http://www.python.org/sf/578494 - - A new command line option parser. Greg Ward's Optik (http://optik.sf.net) fits the bill fine; there's only some question about whether it should be given a less "cutesy" name. ! See also http://www.python.org/sigs/getopt-sig/ - Provide alternatives for common uses of the types module; --- 148,156 ---- http://www.python.org/sf/492105 - A new command line option parser. Greg Ward's Optik (http://optik.sf.net) fits the bill fine; there's only some question about whether it should be given a less "cutesy" name. ! I'm leaning toward optparse now. See also ! http://www.python.org/sigs/getopt-sig/ - Provide alternatives for common uses of the types module; *************** *** 163,166 **** --- 176,181 ---- - A standard datetime type. An implementation effort is under way: http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage + There's a prototype implementation in nondist/sandbox/datetime/. + Tim Peters is committed to finishing the C implementation. Effbot and MAL have a proposal for a basic interface that all datetime types should implement, but there are some problems with From theller@users.sourceforge.net Thu Nov 14 18:45:13 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 14 Nov 2002 10:45:13 -0800 Subject: [Python-checkins] python/dist/src/Tools/freeze modulefinder.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/freeze In directory usw-pr-cvs1:/tmp/cvs-serv31800 Modified Files: modulefinder.py Log Message: Enhancement for ModuleFinder, it can now handle _xmlplus aka PyXML. Fixes SF # 637835. Index: modulefinder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/modulefinder.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** modulefinder.py 12 Nov 2002 23:21:15 -0000 1.22 --- modulefinder.py 14 Nov 2002 18:45:11 -0000 1.23 *************** *** 30,33 **** --- 30,44 ---- packagePathMap[packagename] = paths + replacePackageMap = {} + + # This ReplacePackage mechanism allows modulefinder to work around the + # way the _xmlplus package injects itself under the name "xml" into + # sys.modules at runtime by calling ReplacePackage("_xmlplus", "xml") + # before running ModuleFinder. + + def ReplacePackage(oldname, newname): + replacePackageMap[oldname] = newname + + class Module: *************** *** 337,340 **** --- 348,354 ---- def load_package(self, fqname, pathname): self.msgin(2, "load_package", fqname, pathname) + newname = replacePackageMap.get(fqname) + if newname: + fqname = newname m = self.add_module(fqname) m.__file__ = pathname From gvanrossum@users.sourceforge.net Thu Nov 14 19:49:19 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 14 Nov 2002 11:49:19 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.185,2.186 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30146 Modified Files: typeobject.c Log Message: Use the new C3 MRO algorithm, implemented by Samuele Pedroni (SF patch 619475; also closing SF bug 618704). I tweaked his code a bit for style. This raises TypeError for MRO order disagreements, which is an improvement (previously these went undetected) but also a degradation: what if the order disagreement doesn't affect any method lookups? I don't think I care. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.185 retrieving revision 2.186 diff -C2 -d -r2.185 -r2.186 *** typeobject.c 18 Oct 2002 16:33:12 -0000 2.185 --- typeobject.c 14 Nov 2002 19:49:16 -0000 2.186 *************** *** 614,677 **** } - /* Method resolution order algorithm from "Putting Metaclasses to Work" - by Forman and Danforth (Addison-Wesley 1999). */ - - static int - conservative_merge(PyObject *left, PyObject *right) - { - int left_size; - int right_size; - int i, j, r, ok; - PyObject *temp, *rr; - - assert(PyList_Check(left)); - assert(PyList_Check(right)); - - again: - left_size = PyList_GET_SIZE(left); - right_size = PyList_GET_SIZE(right); - for (i = 0; i < left_size; i++) { - for (j = 0; j < right_size; j++) { - if (PyList_GET_ITEM(left, i) == - PyList_GET_ITEM(right, j)) { - /* found a merge point */ - temp = PyList_New(0); - if (temp == NULL) - return -1; - for (r = 0; r < j; r++) { - rr = PyList_GET_ITEM(right, r); - ok = PySequence_Contains(left, rr); - if (ok < 0) { - Py_DECREF(temp); - return -1; - } - if (!ok) { - ok = PyList_Append(temp, rr); - if (ok < 0) { - Py_DECREF(temp); - return -1; - } - } - } - ok = PyList_SetSlice(left, i, i, temp); - Py_DECREF(temp); - if (ok < 0) - return -1; - ok = PyList_SetSlice(right, 0, j+1, NULL); - if (ok < 0) - return -1; - goto again; - } - } - } - return PyList_SetSlice(left, left_size, left_size, right); - } - - static int - serious_order_disagreements(PyObject *left, PyObject *right) - { - return 0; /* XXX later -- for now, we cheat: "don't do that" */ - } - static int fill_classic_mro(PyObject *mro, PyObject *cls) --- 614,617 ---- *************** *** 715,718 **** --- 655,733 ---- } + /* + Method resolution order algorithm C3 described in + "A Monotonic Superclass Linearization for Dylan", + by Kim Barrett, Bob Cassel, Paul Haahr, + David A. Moon, Keith Playford, and P. Tucker Withington. + (OOPSLA 1996) + + */ + + static int + tail_contains(PyObject *list, int whence, PyObject *o) { + int j, size; + size = PyList_GET_SIZE(list); + + for (j = whence+1; j < size; j++) { + if (PyList_GET_ITEM(list, j) == o) + return 1; + } + return 0; + } + + static int + pmerge(PyObject *acc, PyObject* to_merge) { + int i, j, to_merge_size; + int *remain; + int ok, empty_cnt; + + to_merge_size = PyList_GET_SIZE(to_merge); + + remain = PyMem_MALLOC(SIZEOF_INT*to_merge_size); + if (remain == NULL) + return -1; + for (i = 0; i < to_merge_size; i++) + remain[i] = 0; + + again: + empty_cnt = 0; + for (i = 0; i < to_merge_size; i++) { + PyObject *candidate; + + PyObject *cur_list = PyList_GET_ITEM(to_merge, i); + + if (remain[i] >= PyList_GET_SIZE(cur_list)) { + empty_cnt++; + continue; + } + + candidate = PyList_GET_ITEM(cur_list, remain[i]); + for (j = 0; j < to_merge_size; j++) { + PyObject *j_lst = PyList_GET_ITEM(to_merge, j); + if (tail_contains(j_lst, remain[j], candidate)) + goto skip; /* continue outer loop */ + } + ok = PyList_Append(acc, candidate); + if (ok < 0) { + PyMem_Free(remain); + return -1; + } + for (j = 0; j < to_merge_size; j++) { + PyObject *j_lst = PyList_GET_ITEM(to_merge, j); + if (PyList_GET_ITEM(j_lst, remain[j]) == candidate) { + remain[j]++; + } + } + goto again; + skip: + } + + PyMem_FREE(remain); + if (empty_cnt == to_merge_size) + return 0; + PyErr_SetString(PyExc_TypeError, "MRO order disagreement"); + return -1; + } + static PyObject * mro_implementation(PyTypeObject *type) *************** *** 720,723 **** --- 735,739 ---- int i, n, ok; PyObject *bases, *result; + PyObject *to_merge, *bases_aslist; if(type->tp_dict == NULL) { *************** *** 728,734 **** bases = type->tp_bases; n = PyTuple_GET_SIZE(bases); ! result = Py_BuildValue("[O]", (PyObject *)type); ! if (result == NULL) return NULL; for (i = 0; i < n; i++) { PyObject *base = PyTuple_GET_ITEM(bases, i); --- 744,752 ---- bases = type->tp_bases; n = PyTuple_GET_SIZE(bases); ! ! to_merge = PyList_New(n+1); ! if (to_merge == NULL) return NULL; + for (i = 0; i < n; i++) { PyObject *base = PyTuple_GET_ITEM(bases, i); *************** *** 740,757 **** parentMRO = classic_mro(base); if (parentMRO == NULL) { ! Py_DECREF(result); ! return NULL; ! } ! if (serious_order_disagreements(result, parentMRO)) { ! Py_DECREF(result); ! return NULL; ! } ! ok = conservative_merge(result, parentMRO); ! Py_DECREF(parentMRO); ! if (ok < 0) { ! Py_DECREF(result); return NULL; ! } } return result; } --- 758,788 ---- parentMRO = classic_mro(base); if (parentMRO == NULL) { ! Py_DECREF(to_merge); return NULL; ! } ! ! PyList_SET_ITEM(to_merge, i, parentMRO); ! } ! ! bases_aslist = PySequence_List(bases); ! if (bases_aslist == NULL) { ! Py_DECREF(to_merge); ! return NULL; ! } ! PyList_SET_ITEM(to_merge, n, bases_aslist); ! ! result = Py_BuildValue("[O]", (PyObject *)type); ! if (result == NULL) { ! Py_DECREF(to_merge); ! return NULL; } + + ok = pmerge(result, to_merge); + Py_DECREF(to_merge); + if (ok < 0) { + Py_DECREF(result); + return NULL; + } + return result; } From gvanrossum@users.sourceforge.net Thu Nov 14 19:50:16 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 14 Nov 2002 11:50:16 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.158,1.159 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv30637 Modified Files: test_descr.py Log Message: Fix or disable some tests that were affected by the new C3 MRO algorithm, and add some new tests for the C3 algorithm. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** test_descr.py 18 Oct 2002 16:33:13 -0000 1.158 --- test_descr.py 14 Nov 2002 19:50:14 -0000 1.159 *************** *** 933,937 **** return "D b" ! class M2(object, D): def m2method(self): return "M2 a" --- 933,937 ---- return "D b" ! class M2(D, object): def m2method(self): return "M2 a" *************** *** 939,943 **** return "M2 b" ! vereq(M2.__mro__, (M2, object, D, C)) m = M2() vereq(m.cmethod(), "C a") --- 939,943 ---- return "M2 b" ! vereq(M2.__mro__, (M2, D, C, object)) m = M2() vereq(m.cmethod(), "C a") *************** *** 946,957 **** vereq(m.all_method(), "M2 b") ! class M3(M1, object, M2): def m3method(self): return "M3 a" def all_method(self): return "M3 b" ! # XXX Expected this (the commented-out result): ! # vereq(M3.__mro__, (M3, M1, M2, object, D, C)) ! vereq(M3.__mro__, (M3, M1, M2, D, C, object)) # XXX ? m = M3() vereq(m.cmethod(), "C a") --- 946,955 ---- vereq(m.all_method(), "M2 b") ! class M3(M1, M2, object): def m3method(self): return "M3 a" def all_method(self): return "M3 b" ! vereq(M3.__mro__, (M3, M1, M2, D, C, object)) m = M3() vereq(m.cmethod(), "C a") *************** *** 994,1005 **** vereq(E().boo(), "C") vereq(E.__mro__, (E, C, B, A, object)) ! class F(D, E): pass ! vereq(F().spam(), "B") ! vereq(F().boo(), "B") ! vereq(F.__mro__, (F, D, E, B, C, A, object)) ! class G(E, D): pass ! vereq(G().spam(), "B") ! vereq(G().boo(), "C") ! vereq(G.__mro__, (G, E, D, C, B, A, object)) def objects(): --- 992,1058 ---- vereq(E().boo(), "C") vereq(E.__mro__, (E, C, B, A, object)) ! # MRO order disagreement ! try: ! class F(D, E): pass ! except TypeError: ! pass ! else: ! raise TestFailed, "expected MRO order disagreement (F)" ! try: ! class G(E, D): pass ! except TypeError: ! pass ! else: ! raise TestFailed, "expected MRO order disagreement (G)" ! ! ! # see thread python-dev/2002-October/029035.html ! def ex5(): ! if verbose: print "Testing ex5 from C3 switch discussion..." ! class A(object): pass ! class B(object): pass ! class C(object): pass ! class X(A): pass ! class Y(A): pass ! class Z(X,B,Y,C): pass ! vereq(Z.__mro__, (Z, X, B, Y, A, C, object)) ! ! # see "A Monotonic Superclass Linearization for Dylan", ! # by Kim Barrett et al. (OOPSLA 1996) ! def monotonicity(): ! if verbose: print "Testing MRO monotonicity..." ! class Boat(object): pass ! class DayBoat(Boat): pass ! class WheelBoat(Boat): pass ! class EngineLess(DayBoat): pass ! class SmallMultihull(DayBoat): pass ! class PedalWheelBoat(EngineLess,WheelBoat): pass ! class SmallCatamaran(SmallMultihull): pass ! class Pedalo(PedalWheelBoat,SmallCatamaran): pass ! ! vereq(PedalWheelBoat.__mro__, ! (PedalWheelBoat, EngineLess, DayBoat, WheelBoat, Boat, ! object)) ! vereq(SmallCatamaran.__mro__, ! (SmallCatamaran, SmallMultihull, DayBoat, Boat, object)) ! ! vereq(Pedalo.__mro__, ! (Pedalo, PedalWheelBoat, EngineLess, SmallCatamaran, ! SmallMultihull, DayBoat, WheelBoat, Boat, object)) ! ! # see "A Monotonic Superclass Linearization for Dylan", ! # by Kim Barrett et al. (OOPSLA 1996) ! def consistency_with_epg(): ! if verbose: print "Testing consistentcy with EPG..." ! class Pane(object): pass ! class ScrollingMixin(object): pass ! class EditingMixin(object): pass ! class ScrollablePane(Pane,ScrollingMixin): pass ! class EditablePane(Pane,EditingMixin): pass ! class EditableScrollablePane(ScrollablePane,EditablePane): pass ! ! vereq(EditableScrollablePane.__mro__, ! (EditableScrollablePane, ScrollablePane, EditablePane, ! Pane, ScrollingMixin, EditingMixin, object)) def objects(): *************** *** 1215,1223 **** vereq(a.__dict__, {"foo": 42}) ! class C3(C1, C2): ! __slots__ = [] ! ! class C4(C2, C1): ! __slots__ = [] def dynamics(): --- 1268,1278 ---- vereq(a.__dict__, {"foo": 42}) ! # MRO order disagreement ! # ! # class C3(C1, C2): ! # __slots__ = [] ! # ! # class C4(C2, C1): ! # __slots__ = [] def dynamics(): *************** *** 1506,1509 **** --- 1561,1565 ---- vereq(D.__mro__, (D, B, C, A, object)) vereq(D().f(), "C") + class PerverseMetaType(type): def mro(cls): *************** *** 1511,1515 **** L.reverse() return L ! class X(A,B,C,D): __metaclass__ = PerverseMetaType vereq(X.__mro__, (object, A, C, B, D, X)) --- 1567,1571 ---- L.reverse() return L ! class X(D,B,C,A): __metaclass__ = PerverseMetaType vereq(X.__mro__, (object, A, C, B, D, X)) *************** *** 3369,3372 **** --- 3425,3431 ---- multi() diamond() + ex5() + monotonicity() + consistency_with_epg() objects() slots() From gvanrossum@users.sourceforge.net Thu Nov 14 19:56:56 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 14 Nov 2002 11:56:56 -0800 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.22,1.23 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv1536 Modified Files: pep-0283.txt Log Message: C3 is checked in. Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** pep-0283.txt 14 Nov 2002 17:05:36 -0000 1.22 --- pep-0283.txt 14 Nov 2002 19:56:53 -0000 1.23 *************** *** 124,127 **** --- 124,132 ---- http://www.python.org/sf/578494 + - A modified MRO (Method Resolution Order) algorithm. Consensus + is that we should adopt C3. Samuele Pedroni has contributed a + draft implementation in C, see http://www.python.org/sf/619475 + This has now been checked in. + Planned features for 2.3 *************** *** 135,142 **** feedback to python-dev@python.org; I hope to maintain this for the life of the 2.3 development process. - - - A modified MRO (Method Resolution Order) algorithm. Consensus - is that we should adopt C3. Samuele Pedroni has contributed a - draft implementation in C, see http://www.python.org/sf/619475 - For a class defined inside another class, the __name__ should be --- 140,143 ---- From gvanrossum@users.sourceforge.net Thu Nov 14 22:00:22 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 14 Nov 2002 14:00:22 -0800 Subject: [Python-checkins] python/dist/src/Lib optparse.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30642 Added Files: optparse.py Log Message: Checking in Greg Ward's Optik, as optparse.py. This is the most recent version from Greg's CVS. I've changed the module docstring, added a copyright notice, and renamed OptikError to OptParseError. Still to do are documentation and unit tests. --- NEW FILE: optparse.py --- """optparse - a powerful, extensible, and easy-to-use option parser. By Greg Ward Originally distributed as Optik. See http://optik.sourceforge.net/ """ __copyright__ = """ Copyright (c) 2001-2002 Gregory P. Ward. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. [...1345 lines suppressed...] else: # Isolate all words with s as a prefix. possibilities = [word for word in wordmap.keys() if word.startswith(s)] # No exact match, so there had better be just one possibility. if len(possibilities) == 1: return possibilities[0] elif not possibilities: raise BadOptionError("no such option: %s" % s) else: # More than one possible completion: ambiguous prefix. raise BadOptionError("ambiguous option: %s (%s?)" % (s, ", ".join(possibilities))) # Some day, there might be many Option classes. As of Optik 1.3, the # preferred way to instantiate Options is indirectly, via make_option(), # which will become a factory function when there are many Option # classes. make_option = Option From fdrake@users.sourceforge.net Thu Nov 14 22:49:22 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 14 Nov 2002 14:49:22 -0800 Subject: [Python-checkins] python/dist/src/Doc/tools support.py,1.4,1.4.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv24459 Modified Files: Tag: release22-maint support.py Log Message: The "Up" link should point to index.html, not ./, since these documents are used from local filesystems as well as through webservers. Closes SF bug #624024; not needed on the trunk. Index: support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/support.py,v retrieving revision 1.4 retrieving revision 1.4.8.1 diff -C2 -d -r1.4 -r1.4.8.1 *** support.py 22 Oct 2001 15:07:16 -0000 1.4 --- support.py 14 Nov 2002 22:49:20 -0000 1.4.8.1 *************** *** 26,30 **** columns = 1 letters = 0 ! uplink = "./" uptitle = "Python Documentation Index" --- 26,30 ---- columns = 1 letters = 0 ! uplink = "index.html" uptitle = "Python Documentation Index" From akuchling@users.sourceforge.net Thu Nov 14 23:07:59 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 14 Nov 2002 15:07:59 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.66,1.67 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv915 Modified Files: whatsnew23.tex Log Message: Finish up the logging section Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** whatsnew23.tex 14 Nov 2002 14:14:16 -0000 1.66 --- whatsnew23.tex 14 Nov 2002 23:07:57 -0000 1.67 *************** *** 11,16 **** \tableofcontents - % Optik (or whatever it gets called) - % % MacOS framework-related changes (section of its own, probably) % --- 11,14 ---- *************** *** 418,446 **** \section{PEP 282: The \module{logging} Package} ! A standard package for writing logs, the \module{logging} package, was ! added. It provides a powerful and flexible way for components to ! generate logging output which can then be filtered and processed in ! various ways. The logging system can parse a configuration file to ! control its behaviour. Logs can be written to standard error, a file ! or a socket, sent to the system log, e-mailed to a particular address, ! or buffered in memory. It's also possible to write your own handler ! classes, of course. ! You can have multiple \class{Logger} objects, each one used by a ! particular subsystem of your code. Each \class{Logger} is identified ! by a name, and names are organized into a hierarchy using \samp{.} as ! the component separator. For example, you might have \class{Logger} ! instances named \samp{server}, \samp{server.auth} and ! \samp{server.network}. The latter two instances fall under the ! \samp{server} \class{Logger} in the hierarchy. This means that if you ! turn up the verbosity for \samp{server}, or direct ! \samp{server} messages to a different handler, ! the changes will also apply to \samp{server.auth} and ! \samp{server.network}. ! There's also a root \class{Logger} with the name \samp{root}, ! parent of all other instances. ! The \module{logging} package contains some convenience functions ! that always use the root log: \begin{verbatim} --- 416,444 ---- \section{PEP 282: The \module{logging} Package} ! A standard package for writing logs called \module{logging} has been ! added to Python 2.3. It provides a powerful and flexible way for ! components to generate logging output which can then be filtered and ! processed in various ways. A standard configuration file format can ! be used to control the logging behaviour of a program. Python comes ! with handlers that will write log records to standard error or to a ! file or socket, send them to the system log, or even e-mail them to a ! particular address, and of course it's also possible to write your own ! handler classes. ! Most application code will deal with one or more \class{Logger} ! objects, each one used by a particular subsystem of the application. ! Each \class{Logger} is identified by a name, and names are organized ! into a hierarchy using \samp{.} as the component separator. For ! example, you might have \class{Logger} instances named \samp{server}, ! \samp{server.auth} and \samp{server.network}. The latter two ! instances fall under the \samp{server} \class{Logger} in the ! hierarchy. This means that if you turn up the verbosity for ! \samp{server} or direct \samp{server} messages to a different handler, ! the changes will also apply to records logged to \samp{server.auth} ! and \samp{server.network}. There's also a root \class{Logger} with ! the name \samp{root} that's the parent of all other loggers. ! For simple uses, the \module{logging} package contains some ! convenience functions that always use the root log: \begin{verbatim} *************** *** 463,476 **** In the default configuration, informational and debugging messages are ! suppressed and the output is sent to standard error. Note the ! \function{warn()} call's use of string formatting operators; all of ! the functions for logging messages take the arguments ! \code{(\var{msg}, \var{arg1}, \var{arg2}, ...)} and log the string resulting from ! \code{\var{msg} \% (\var{arg1}, \var{arg2}, ...)}. There's also an \function{exception()} function that records the most recent traceback. Any of the other functions will also record the ! traceback by specifying the keyword argument \code{exc_info} as ! \code{True}. \begin{verbatim} --- 461,477 ---- In the default configuration, informational and debugging messages are ! suppressed and the output is sent to standard error; you can change ! this by calling the \method{setLevel()} method on the root logger. ! ! Notice the \function{warn()} call's use of string formatting ! operators; all of the functions for logging messages take the ! arguments \code{(\var{msg}, \var{arg1}, \var{arg2}, ...)} and log the ! string resulting from \code{\var{msg} \% (\var{arg1}, \var{arg2}, ! ...)}. There's also an \function{exception()} function that records the most recent traceback. Any of the other functions will also record the ! traceback if you specify a true value for the keyword argument ! \code{exc_info}. \begin{verbatim} *************** *** 492,496 **** \end{verbatim} ! The \function{getLogger(\var{name})} is used to get a particular log. \begin{verbatim} --- 493,499 ---- \end{verbatim} ! Slightly more advanced programs will use a logger other than the root ! logger. The \function{getLogger(\var{name})} is used to get a ! particular log, creating it if it doesn't exist yet. \begin{verbatim} *************** *** 503,512 **** \end{verbatim} ! XXX finish this section ! This is only a partial overview of the \module{logging} package's ! features; see the \citetitle[http://www.python.org/dev/doc/devel/lib/module-logging.html]{\module{logging} ! package's reference documentation} for all of the details. --- 506,529 ---- \end{verbatim} ! There are more classes that can be customized. When a \class{Logger} ! instance is told to log a message, it creates a \class{LogRecord} ! instance that is sent to any number of different \class{Handler} ! instances. Loggers and handlers can also have an attached list of ! filters, and each filter can cause the \class{LogRecord} to be ignored ! or can modify the record before passing it along. \class{LogRecord} ! instances are converted to text by a \class{Formatter} class. ! Log records are usually propagated up the hierarchy, so a message ! logged to \samp{server.auth} is also seen by \samp{server} and ! \samp{root}, but a handler can prevent this by setting its ! \member{propagate} attribute to \code{True}. ! ! With all of these features the \module{logging} package should provide ! enough flexibility for even the most complicated applications. This ! is only a partial overview of the \module{logging} package's features, ! so please see the \citetitle[http://www.python.org/dev/doc/devel/lib/module-logging.html]{\module{logging} ! package's reference documentation} for all of the details. Reading ! \pep{282} will also be helpful. *************** *** 867,870 **** --- 884,888 ---- + %====================================================================== \subsection{String Changes} *************** *** 945,948 **** --- 963,967 ---- + %====================================================================== \subsection{Optimizations} *************** *** 1188,1192 **** arguments for fine-tuning the formatting; consult the module's documentation for details. ! % XXX add a link to the module docs? (Contributed by Greg Ward.) --- 1207,1211 ---- arguments for fine-tuning the formatting; consult the module's documentation for details. ! %XXX add a link to the module docs? (Contributed by Greg Ward.) *************** *** 1235,1238 **** --- 1254,1263 ---- %====================================================================== + \subsection{Optik: The \module{optparse} Module} + + XXX write this section + + + %====================================================================== \section{Specialized Object Allocator (pymalloc)\label{section-pymalloc}} *************** *** 1388,1391 **** --- 1413,1422 ---- \code{PyObject_DelItem(\var{mapping}, PyString_New(\var{key})}. + \item The \method{xreadlines()} method of file objects, introduced in + Python 2.1, is no longer necessary because files now behave as their + own iterator. \method{xreadlines()} was originally introduced as a + faster way to loop over all the lines in a file, but now you can + simply write \code{for line in file_obj}. + \item File objects now manage their internal string buffer differently by increasing it exponentially when needed. *************** *** 1405,1408 **** --- 1436,1441 ---- \end{itemize} + + %====================================================================== \subsection{Port-Specific Changes} *************** *** 1512,1519 **** The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this ! article: Simon Brunning, Michael Chermside, Scott David Daniels, Fred~L. Drake, Jr., ! Michael Hudson, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, ! Lalo Martins, Gustavo Niemeyer, Neal Norwitz, Neil Schemenauer, Jason ! Tishler. \end{document} --- 1545,1552 ---- The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this ! article: Simon Brunning, Michael Chermside, Scott David Daniels, ! Fred~L. Drake, Jr., Michael Hudson, Detlef Lannert, Martin von ! L\"owis, Andrew MacIntyre, Lalo Martins, Gustavo Niemeyer, Neal ! Norwitz, Neil Schemenauer, Jason Tishler. \end{document} From tim_one@users.sourceforge.net Thu Nov 14 23:22:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 14 Nov 2002 15:22:36 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.186,2.187 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7040/python/objects Modified Files: typeobject.c Log Message: Repaired illegal syntax most compilers probably let slide (but MSVC treats as a fatal error). Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.186 retrieving revision 2.187 diff -C2 -d -r2.186 -r2.187 *** typeobject.c 14 Nov 2002 19:49:16 -0000 2.186 --- typeobject.c 14 Nov 2002 23:22:33 -0000 2.187 *************** *** 720,724 **** } goto again; ! skip: } --- 720,724 ---- } goto again; ! skip: ; } From tim_one@users.sourceforge.net Thu Nov 14 23:24:42 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 14 Nov 2002 15:24:42 -0800 Subject: [Python-checkins] python/dist/src/PCbuild _tkinter.dsp,1.20,1.21 python.dsp,1.15,1.16 python20.wse,1.104,1.105 readme.txt,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv7515/python/PCbuild Modified Files: _tkinter.dsp python.dsp python20.wse readme.txt Log Message: Windows changes to move from Tcl/Tk 8.3.2 to 8.4.1. I tested this by running IDLE, and since I'm not a Tcl Guy I'm not sure what else to do. Up to you! See XXX comments in PCbuild\readme.txt for cautions. Also repaired typos in the new bz2-for-Windows instructions. Index: _tkinter.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_tkinter.dsp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** _tkinter.dsp 23 Jul 2002 06:31:15 -0000 1.20 --- _tkinter.dsp 14 Nov 2002 23:24:40 -0000 1.21 *************** *** 45,49 **** F90=df.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c ! # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\tcl\include" /I "..\Include" /I "..\PC" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 --- 45,49 ---- F90=df.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c ! # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\tcl84\include" /I "..\Include" /I "..\PC" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 *************** *** 55,59 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 ..\..\tcl\lib\tk83.lib ..\..\tcl\lib\tcl83.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter_d.pyd" /pdbtype:sept /libpath:"C:\Program Files\Tcl\lib" # SUBTRACT LINK32 /pdb:none --- 55,59 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 ..\..\tcl84\lib\tk84.lib ..\..\tcl84\lib\tcl84.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter_d.pyd" /pdbtype:sept /libpath:"C:\Program Files\Tcl\lib" # SUBTRACT LINK32 /pdb:none *************** *** 73,77 **** F90=df.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c ! # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\tcl\include" /I "..\Include" /I "..\PC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 --- 73,77 ---- F90=df.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c ! # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\tcl84\include" /I "..\Include" /I "..\PC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 *************** *** 83,87 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 ! # ADD LINK32 ..\..\tcl\lib\tk83.lib ..\..\tcl\lib\tcl83.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter.pyd" /libpath:"C:\Program Files\Tcl\lib" # SUBTRACT LINK32 /pdb:none --- 83,87 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 ! # ADD LINK32 ..\..\tcl84\lib\tk84.lib ..\..\tcl84\lib\tcl84.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter.pyd" /libpath:"C:\Program Files\Tcl\lib" # SUBTRACT LINK32 /pdb:none Index: python.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python.dsp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** python.dsp 10 Jul 2002 06:22:10 -0000 1.15 --- python.dsp 14 Nov 2002 23:24:40 -0000 1.16 *************** *** 5,9 **** # TARGTYPE "Win32 (x86) Console Application" 0x0103 ! CFG=python - Win32 Alpha Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run --- 5,9 ---- # TARGTYPE "Win32 (x86) Console Application" 0x0103 ! CFG=python - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run *************** *** 14,18 **** !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "python.mak" CFG="python - Win32 Alpha Release" !MESSAGE !MESSAGE Possible choices for configuration are: --- 14,18 ---- !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE ! !MESSAGE NMAKE /f "python.mak" CFG="python - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** python20.wse 9 Nov 2002 08:24:58 -0000 1.104 --- python20.wse 14 Nov 2002 23:24:40 -0000 1.105 *************** *** 32,37 **** Variable Flags1=00001000 Variable Name2=_TCLMINOR_ ! Variable Description2=Tcl/Tk Minor Version (e.g. the "3" in "8.3.1") ! Variable Default2=3 Variable Flags2=00001000 Variable Name3=_DOC_ --- 32,37 ---- Variable Flags1=00001000 Variable Name2=_TCLMINOR_ ! Variable Description2=Tcl/Tk Minor Version (e.g. the "4" in "8.4.1") ! Variable Default2=4 Variable Flags2=00001000 Variable Name3=_DOC_ *************** *** 2049,2053 **** end item: Install File ! Source=..\..\tcl\bin\tcl8%_tclminor_%.dll Destination=%MAINDIR%\DLLs\tcl8%_TCLMINOR_%.dll Description=Tcl/Tk binaries and libraries --- 2049,2053 ---- end item: Install File ! Source=..\..\tcl84\bin\tcl8%_tclminor_%.dll Destination=%MAINDIR%\DLLs\tcl8%_TCLMINOR_%.dll Description=Tcl/Tk binaries and libraries *************** *** 2055,2059 **** end item: Install File ! Source=..\..\tcl\bin\tk8%_tclminor_%.dll Destination=%MAINDIR%\DLLs\tk8%_TCLMINOR_%.dll Description=Tcl/Tk binaries and libraries --- 2055,2059 ---- end item: Install File ! Source=..\..\tcl84\bin\tk8%_tclminor_%.dll Destination=%MAINDIR%\DLLs\tk8%_TCLMINOR_%.dll Description=Tcl/Tk binaries and libraries *************** *** 2061,2065 **** end item: Install File ! Source=..\..\tcl\lib\*.* Destination=%MAINDIR%\tcl Description=Tcl/Tk binaries and libraries --- 2061,2065 ---- end item: Install File ! Source=..\..\tcl84\lib\*.* Destination=%MAINDIR%\tcl Description=Tcl/Tk binaries and libraries Index: readme.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/readme.txt,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** readme.txt 9 Nov 2002 04:48:58 -0000 1.25 --- readme.txt 14 Nov 2002 23:24:40 -0000 1.26 *************** *** 72,79 **** _tkinter ! Python wrapper for the Tk windowing system. Requires tcl832.exe from ! http://dev.scriptics.com/software/tcltk/downloadnow83.html ! Run the installer, forcing installation into dist\Tcl. ! Be sure to install everything, including the Tcl/Tk header files. zlib --- 72,122 ---- _tkinter ! Python wrapper for the Tk windowing system. Requires building ! Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.1: ! ! Get source ! ---------- ! Go to ! http://prdownloads.sourceforge.net/tcl/ ! and download ! tcl841-src.zip ! tk841-src.zip ! Unzip into ! dist\tcl8.4.1\ ! dist\tk\8.4.1\ ! respectively. ! ! Build Tcl first (done here w/ MSVC 6 on Win2K) ! ---------------------------------------------- ! cd dist\tcl8.4.1\win ! run vcvars32.bat [necessary even on Win2K] ! nmake -f makefile.vc ! nmake -f makefile.vc INSTALLDIR=..\..\tcl84 install ! ! XXX Should we compile with OPTS=threads? ! ! XXX Some tests failed in "nmake -f makefile.vc test". ! ! XXX Should rename destination directory to something more generic ! XXX then tcl84. But unless I can backport 8.3.4 to the 2.2 line ! XXX too, I've got to be able to build using more than oneX Tcl/Tk ! XXX release, and that effectively reserves the "tcl" directory name ! XXX for the duration. Nothing that requires thought is going to ! XXX work when it comes to release crunch times. ! ! ! Build Tk ! ------- ! cd dist\tk8.4.1\win ! nmake -f makefile.vc TCLDIR=..\..\tcl8.4.1 ! nmake -f makefile.vc TCLDIR=..\..\tcl8.4.1 INSTALLDIR=..\..\tcl84 install ! ! XXX Should we compile with OPTS=threads? ! ! XXX Some tests failed in "nmake -f makefile.vc test". ! ! XXX Our installer copies a lot of stuff out of the Tcl/Tk install ! XXX directory. Is all of that really needed for Python use of Tcl/Tk? ! zlib *************** *** 93,103 **** http://sources.redhat.com/bzip2/ Download the source tarball, bzip2-1.0.2.tar.gz. ! Unpack into dist\bzip2-1.0.2. WARNING: If you using WinZip, you must disable its "TAR file smart CR/LF conversion" feature (under Options -> Configuration -> Miscellaneous -> Other) for the duration. Don't bother trying to use libbz2.dsp with MSVC. After 10 minutes of fiddling, I couldn't get it to work. Perhaps it works with MSVC 5 (I used MSVC 6). It's better to run the by-hand makefile ! anyway, because it runs a helpful test step at the end. cd into dist\bzip2-1.0.2, and run nmake -f makefile.msc --- 136,148 ---- http://sources.redhat.com/bzip2/ Download the source tarball, bzip2-1.0.2.tar.gz. ! Unpack into dist\bzip2-1.0.2. WARNING: If you're using WinZip, you must disable its "TAR file smart CR/LF conversion" feature (under Options -> Configuration -> Miscellaneous -> Other) for the duration. + Don't bother trying to use libbz2.dsp with MSVC. After 10 minutes of fiddling, I couldn't get it to work. Perhaps it works with MSVC 5 (I used MSVC 6). It's better to run the by-hand makefile ! anyway, because it runs a helpful test step at the end. ! cd into dist\bzip2-1.0.2, and run nmake -f makefile.msc *************** *** 107,115 **** step in an enviroment that already has the correct envars set up). ] ! The make step should yield any warnings or errors, and should end by displaying 6 blocks each terminated with FC: no differences encountered If FC finds differences, see the warning abou WinZip above (when I first tried it, sample3.ref failed due to CRLF conversion). All of this managed to build bzip2-1.0.2\libbz2.lib, which the Python project links in. --- 152,161 ---- step in an enviroment that already has the correct envars set up). ] ! The make step shouldn't yield any warnings or errors, and should end by displaying 6 blocks each terminated with FC: no differences encountered If FC finds differences, see the warning abou WinZip above (when I first tried it, sample3.ref failed due to CRLF conversion). + All of this managed to build bzip2-1.0.2\libbz2.lib, which the Python project links in. From tim_one@users.sourceforge.net Thu Nov 14 23:32:01 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 14 Nov 2002 15:32:01 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.521,1.522 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv11503/Python/Misc Modified Files: NEWS Log Message: Windows blurb about new Tcl/Tk release shipped on Windows. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.521 retrieving revision 1.522 diff -C2 -d -r1.521 -r1.522 *** NEWS 13 Nov 2002 16:29:18 -0000 1.521 --- NEWS 14 Nov 2002 23:31:58 -0000 1.522 *************** *** 768,771 **** --- 768,774 ---- ------- + - The Windows distribution now ships with Tcl/Tk version 8.4.1 (it + previously shipped with Tcl/Tk 8.3.2). + - When Python is built under a Microsoft compiler, sys.version now includes the compiler version number (_MSC_VER). For example, under From akuchling@users.sourceforge.net Thu Nov 14 23:40:46 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 14 Nov 2002 15:40:46 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.67,1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv15406 Modified Files: whatsnew23.tex Log Message: Add section on Optik Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** whatsnew23.tex 14 Nov 2002 23:07:57 -0000 1.67 --- whatsnew23.tex 14 Nov 2002 23:40:42 -0000 1.68 *************** *** 1254,1260 **** %====================================================================== ! \subsection{Optik: The \module{optparse} Module} ! XXX write this section --- 1254,1331 ---- %====================================================================== ! \subsection{The \module{optparse} Module} ! The \module{getopt} module provides simple parsing of command-line ! arguments. The new \module{optparse} module (originally named Optik) ! provides more elaborate command-line parsing that follows the Unix ! conventions, automatically creates the output for \longprogramopt{help}, ! and can perform different actions ! ! You start by creating an instance of \class{OptionParser} and telling ! it what your program's options are. ! ! \begin{verbatim} ! from optparse import OptionParser ! ! op = OptionParser() ! op.add_option('-i', '--input', ! action='store', type='string', dest='input', ! help='set input filename') ! op.add_option('-l', '--length', ! action='store', type='int', dest='length', ! help='set maximum length of output') ! \end{verbatim} ! ! Parsing a command line is then done by calling the \method{parse_args()} ! method. ! ! \begin{verbatim} ! options, args = op.parse_args(sys.argv[1:]) ! print options ! print args ! \end{verbatim} ! ! This returns an object containing all of the option values, ! and a list of strings containing the remaining arguments. ! ! Invoking the script with the various arguments now works as you'd ! expect it to. Note that the length argument is automatically ! converted to an integer. ! ! \begin{verbatim} ! $ ./python opt.py -i data arg1 ! ! ['arg1'] ! $ ./python opt.py --input=data --length=4 ! ! ['arg1'] ! $ ! \end{verbatim} ! ! The help message is automatically generated for you: ! ! \begin{verbatim} ! $ ./python opt.py --help ! usage: opt.py [options] ! ! options: ! -h, --help show this help message and exit ! -iINPUT, --input=INPUT ! set input filename ! -lLENGTH, --length=LENGTH ! set maximum length of output ! $ ! \end{verbatim} ! ! Optik was written by Greg Ward, with suggestions from the readers of ! the Getopt SIG. ! ! \begin{seealso} ! \seeurl{http://optik.sourceforge.net} ! {The Optik site has tutorial and reference documentation for ! \module{optparse}. ! % XXX change to point to Python docs, when those docs get written. ! } ! \end{seealso} From jackjansen@users.sourceforge.net Fri Nov 15 00:04:12 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 14 Nov 2002 16:04:12 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib appletrunner.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26023 Added Files: appletrunner.py Log Message: A script to run applets. Originally by Just, slightly modified by me. --- NEW FILE: appletrunner.py --- #!/usr/bin/env python # This file is meant as an executable script for running applets. # BuildApplet will use it as the main executable in the .app bundle if # we are not running in a framework build. import os import sys for name in ["__rawmain__.py", "__rawmain__.pyc", "__main__.py", "__main__.pyc"]: realmain = os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), "Resources", name) if os.path.exists(realmain): break else: sys.stderr.write("%s: cannot find applet main program\n" % sys.argv[0]) sys.exit(1) sys.argv.insert(1, realmain) os.execve(sys.executable, sys.argv, os.environ) From jackjansen@users.sourceforge.net Fri Nov 15 00:06:55 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 14 Nov 2002 16:06:55 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib/Carbon Res.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/Carbon In directory usw-pr-cvs1:/tmp/cvs-serv27044/Carbon Modified Files: Res.py Log Message: Python 2.2 as installed by Apple has a version of _Res that is too old. We attempt to load an override version in this case. Index: Res.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/Carbon/Res.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Res.py 23 Aug 2001 14:12:26 -0000 1.1 --- Res.py 15 Nov 2002 00:06:52 -0000 1.2 *************** *** 1 **** ! from _Res import * --- 1,4 ---- ! try: ! from OverrideFrom23._Res import * ! except ImportError: ! from _Res import * From jackjansen@users.sourceforge.net Fri Nov 15 00:07:34 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 14 Nov 2002 16:07:34 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts buildappbundle.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv27373 Modified Files: buildappbundle.py Log Message: Make the Resources directory if needed. Index: buildappbundle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/buildappbundle.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** buildappbundle.py 6 Nov 2002 23:15:51 -0000 1.1 --- buildappbundle.py 15 Nov 2002 00:07:31 -0000 1.2 *************** *** 102,105 **** --- 102,107 ---- if resources: resdir = os.path.join(contents, 'Resources') + if not os.path.isdir(resdir): + os.mkdir(resdir) for src in resources: dst = os.path.join(resdir, os.path.split(src)[1]) From jackjansen@users.sourceforge.net Fri Nov 15 00:08:32 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 14 Nov 2002 16:08:32 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts BuildApplet.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv27596 Modified Files: BuildApplet.py Log Message: Go from filename to FSSpec via FSRefs, to work around outdated macfs module in python 2.2. Index: BuildApplet.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/BuildApplet.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** BuildApplet.py 22 Aug 2002 23:36:11 -0000 1.15 --- BuildApplet.py 15 Nov 2002 00:08:29 -0000 1.16 *************** *** 87,91 **** # Loop over all files to be processed for filename in args: ! cr, tp = MacOS.GetCreatorAndType(filename) if tp == 'APPL': buildtools.update(template, filename, dstfilename) --- 87,91 ---- # Loop over all files to be processed for filename in args: ! cr, tp = MacOS.GetCreatorAndType(macfs.FSRef(filename)) if tp == 'APPL': buildtools.update(template, filename, dstfilename) From jackjansen@users.sourceforge.net Fri Nov 15 00:05:50 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 14 Nov 2002 16:05:50 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib buildtools.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26337 Modified Files: buildtools.py Log Message: Added a hack so we can build applets with a MacPython that uses the OSX 10.2 apple-supplied Python as its base: if we've copied a symlink as the executable we remove it and install appletrunner in stead. Index: buildtools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/buildtools.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** buildtools.py 11 Nov 2002 00:06:14 -0000 1.20 --- buildtools.py 15 Nov 2002 00:05:47 -0000 1.21 *************** *** 300,303 **** --- 300,314 ---- ] copyapptree(template, destname, exceptlist, progress) + # SERIOUS HACK. If we've just copied a symlink as the + # executable we assume we're running from the MacPython addon + # to 10.2 python. We remove the symlink again and install + # the appletrunner script. + executable = os.path.join(destname, "Contents/MacOS/python") + if os.path.islink(executable): + os.remove(executable) + dummyfp, appletrunner, d2 = imp.find_module('appletrunner') + del dummyfp + shutil.copy2(appletrunner, executable) + os.chmod(executable, 0775) # Now either use the .plist file or the default if progress: From jackjansen@users.sourceforge.net Fri Nov 15 00:13:37 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 14 Nov 2002 16:13:37 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile.jaguar,NONE,1.1 setup.jaguar.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory usw-pr-cvs1:/tmp/cvs-serv29384 Added Files: Makefile.jaguar setup.jaguar.py Log Message: First stab at a Makefile that will create a MacPython that uses the Apple-installed Python 2.2 from /usr/bin as it's underlying engine. All the MacPython stuff is installed into /Applications/MacPython-OSX, and .pth files and other magic are used to tie everything together. So far only the raw windowing interpreter and BuildApplet work. --- NEW FILE: Makefile.jaguar --- # This Makefile, which should be run from the current directory, will build # a MacPython based on the /usr/bin/python installed by Apple as of 10.2. VERSION=2.2 builddir = ../.. srcdir = ../.. dstroot=/. PYTHONAPPSDIR=$(dstroot)/Applications/MacPython-OSX prefix=/usr # These are normally computed form the previous ones osxdir=$(srcdir)/Mac/OSX PYTHON=$(prefix)/bin/python pythonw=$(prefix)/bin/pythonw LIBDEST=$(prefix)/lib/python$(VERSION) datadir=$(PYTHONAPPSDIR)/python-additions MACLIBDEST=$(datadir)/Lib MACDYNLIBDEST=$(datadir)/lib-dynload MACTOOLSDEST=$(datadir)/Tools APPINSTALLDIR=$(datadir)/Python.app INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/python # The usual stuff DIRMODE=755 INSTALL=/usr/bin/install -c INSTALL_SYMLINK=ln -fs INSTALL_PROGRAM=${INSTALL} INSTALL_SCRIPT= ${INSTALL_PROGRAM} INSTALL_DATA= ${INSTALL} -m 644 install: install_dirs install_dynlib install_lib \ install_Python install_IDE install_IDLE install_BuildApplet \ install_pythonw install_dirs: $(INSTALL) -d -m $(DIRMODE) $(PYTHONAPPSDIR) $(INSTALL) -d -m $(DIRMODE) $(datadir) $(INSTALL) -d -m $(DIRMODE) $(MACDYNLIBDEST) install_lib: Mac.jaguar.pth $(MAKE) -f $(osxdir)/Makefile installmacsubtree \ LIBDEST=$(LIBDEST) MACLIBDEST=$(MACLIBDEST) MACTOOLSDEST=$(MACTOOLSDEST) \ builddir=$(builddir) srcdir=$(srcdir) PTHFILE=Mac.jaguar.pth \ PYTHON=$(PYTHON) compileall=$(LIBDEST)/compileall.py Mac.jaguar.pth: echo $(MACLIBDEST) > Mac.jaguar.pth echo $(MACDYNLIBDEST) >> Mac.jaguar.pth ## echo "import macresource; macresource.open_error_resource()" >> Mac.jaguar.pth install_dynlib: $(PYTHON) $(osxdir)/setup.jaguar.py install --install-lib=$(MACDYNLIBDEST) touch $(MACDYNLIBDEST)/OverrideFrom23/__init__.py install_Python: $(PYTHON) $(srcdir)/Mac/scripts/buildappbundle.py -l \ -o $(APPINSTALLDIR) \ -r $(srcdir)/Mac/OSXResources/app/Resources/Applet-Info.plist \ -r $(srcdir)/Mac/OSXResources/app/Resources/PythonApplet.icns \ $(PYTHON) install_IDE: $(MAKE) -f $(osxdir)/Makefile install_IDE \ srcdir=$(srcdir) INSTALLED_PYTHONW=$(INSTALLED_PYTHONW) \ PYTHONAPPSDIR=$(PYTHONAPPSDIR) install_IDLE: $(MAKE) -f $(osxdir)/Makefile install_IDLE \ srcdir=$(srcdir) INSTALLED_PYTHONW=$(INSTALLED_PYTHONW) \ PYTHONAPPSDIR=$(PYTHONAPPSDIR) install_BuildApplet: $(MAKE) -f $(osxdir)/Makefile install_BuildApplet \ srcdir=$(srcdir) INSTALLED_PYTHONW=$(INSTALLED_PYTHONW) \ PYTHONAPPSDIR=$(PYTHONAPPSDIR) install_pythonw: echo "#!/bin/sh" > pythonw.sh echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh $(INSTALL) pythonw.sh $(prefix)/bin/pythonw --- NEW FILE: setup.jaguar.py --- from distutils.core import Extension, setup setup(name="MacPython for Jaguar extensions", version="2.2", ext_modules=[ Extension("OverrideFrom23._Res", ["../Modules/res/_Resmodule.c"], include_dirs=["../Include"], extra_link_args=['-framework', 'Carbon']), ]) From akuchling@users.sourceforge.net Fri Nov 15 02:52:46 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 14 Nov 2002 18:52:46 -0800 Subject: [Python-checkins] python/dist/src/Doc/inst inst.tex,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/inst In directory usw-pr-cvs1:/tmp/cvs-serv21926 Modified Files: inst.tex Log Message: Draft a section on modifying Python's path. I'm not sure where this section fits best in inst.tex's organization; Fred or someone, feel free to move it. Index: inst.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/inst/inst.tex,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** inst.tex 6 Nov 2002 14:34:50 -0000 1.43 --- inst.tex 15 Nov 2002 02:52:44 -0000 1.44 *************** *** 599,609 **** \end{verbatim} ! The specified installation directories are relative to \filevar{prefix}. ! Of course, you also have to ensure that these directories are in ! Python's module search path, such as by putting a \file{.pth} file in ! \filevar{prefix}. ! ! % \XXX should have a section describing \file{.pth} files and ! % cross-ref it here If you want to define an entire installation scheme, you just have to --- 599,607 ---- \end{verbatim} ! The specified installation directories are relative to ! \filevar{prefix}. Of course, you also have to ensure that these ! directories are in Python's module search path, such as by putting a ! \file{.pth} file in \filevar{prefix}. See section~\ref{search-path} ! to find out how to modify Python's search path. If you want to define an entire installation scheme, you just have to *************** *** 689,692 **** --- 687,771 ---- % XXX need some Windows and Mac OS examples---when would custom % installation schemes be needed on those platforms? + + + % XXX I'm not sure where this section should go. + \subsection{Modifying Python's Search Path} + \label{search-path} + + When the Python interpreter executes an \keyword{import} statement, it + searches for both Python code and extension modules along a search + path. A default value for the path is configured into the Python + binary when the interpreter is built. You can determine the path by + importing the \module{sys} module and printing the value of + \code{sys.path}. + + \begin{verbatim} + $ python + Python 2.2 (#11, Oct 3 2002, 13:31:27) + [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 + Type ``help'', ``copyright'', ``credits'' or ``license'' for more information. + >>> import sys + >>> sys.path + ['', '/usr/local/lib/python2.3', '/usr/local/lib/python2.3/plat-linux2', + '/usr/local/lib/python2.3/lib-tk', '/usr/local/lib/python2.3/lib-dynload', + '/usr/local/lib/python2.3/site-packages'] + >>> + \end{verbatim} + + The null string in \code{sys.path} represents the current working + directory. + + The expected convention for locally installed packages is to put them + in the \file{.../site-packages/} directory, but you may want to + install Python modules into some arbitrary directory. For example, + your site may have a convention of keeping all software related to the + web server under \file{/www}. Add-on Python modules might then belong + in \file{/www/python}, and in order to import them, this directory + must be added to \code{sys.path}. There are several different ways to + add the directory. + + The most convenient way is to add a path configuration file to a + directory that's already on Python's path, usually to the + \file{.../site-packages/} directory. Path configuration files have an + extension of \file{.pth}, and each line must contain a single path + that will be added to \code{sys.path}. Paths can be absolute or + relative, in which case they're relative to the directory containing + the \file{.pth} file. Any directories added to the search path will + be scanned in turn for \file{.pth} files. See + \citetitle[http://www.python.org/dev/doc/devel/lib/module-site.html]{the + documentation for the \module{site} module} for more information. + + A slightly less convenient way is to edit the \file{site.py} file in + Python's standard library, and modify \code{sys.path}. \file{site.py} + is automatically imported when the Python interpreter is executed, + unless the \programopt{-S} switch is supplied to suppress this + behaviour. So you could simply edit \file{site.py} and add two lines to it: + + \begin{verbatim} + import sys + sys.path.append('/www/python/') + \end{verbatim} + + However, if you reinstall the same major version of Python (perhaps + when upgrading from 2.2 to 2.2.2, for example) \file{site.py} will be + overwritten by the stock version. You'd have to remember that it was + modified and save a copy before doing the installation. + + There are two environment variables that can modify \code{sys.path}. + \envvar{PYTHONHOME} sets an alternate value for the prefix of the + Python installation. For example, if \envvar{PYTHONHOME} is set to + \samp{/www/python}, the search path will be set to \code{['', + '/www/python/lib/python2.2/', '/www/python/lib/python2.3/plat-linux2', + ...]}. + + The \envvar{PYTHONPATH} variable can be set to a list of paths that + will be added to the beginning of \code{sys.path}. For example, if + \envvar{PYTHONPATH} is set to \samp{/www/python:/opt/py}, the search + path will begin with \code{['/www/python', '/opt/py']}. (Note that + directories must exist in order to be added to \code{sys.path}; the + \module{site} module removes paths that don't exist.) + + Finally, \code{sys.path} is just a regular Python list, so any Python + application can modify it by adding or removing entries. From rhettinger@users.sourceforge.net Fri Nov 15 06:46:15 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 14 Nov 2002 22:46:15 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libuserdict.tex,1.21,1.22 libshelve.tex,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv2280/Doc/lib Modified Files: libuserdict.tex libshelve.tex Log Message: SF patch #520382: Expand shelve.py to have a full dictionary interface and add a mixin to UserDict.py to make it easier to implement a full dictionary interface. Index: libuserdict.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libuserdict.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** libuserdict.tex 30 Jun 2002 04:32:38 -0000 1.21 --- libuserdict.tex 15 Nov 2002 06:46:13 -0000 1.22 *************** *** 16,20 **** can add new behaviors to dictionaries. ! The \module{UserDict} module defines the \class{UserDict} class: \begin{classdesc}{UserDict}{\optional{initialdata}} --- 16,26 ---- can add new behaviors to dictionaries. ! The module also defines a mixin defining all dictionary methods for ! classes that already have a minimum mapping interface. This greatly ! simplifies writing classes that need to be substitutable for ! dictionaries (such as the shelve module). ! ! The \module{UserDict} module defines the \class{UserDict} class ! and \class{DictMixin}: \begin{classdesc}{UserDict}{\optional{initialdata}} *************** *** 35,38 **** --- 41,61 ---- class. \end{memberdesc} + + \begin{classdesc}{DictMixin}{} + Mixin defining all dictionary methods for classes that already have + a minimum dictionary interface including\method{__getitem__}, + \method{__setitem__}, \method{__delitem__}, and \method{keys}. + + This mixin should be used as a superclass. Adding each of the + above methods adds progressively more functionality. For instance, + the absence of \method{__delitem__} precludes only \method{pop} + and \method{popitem}. + + While the four methods listed above are sufficient to support the + entire dictionary interface, progessively more efficiency comes + with defining \method{__contains__}, \method{__iter__}, and + \method{iteritems}. + + \end{classdesc} Index: libshelve.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshelve.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** libshelve.tex 16 Jul 2000 19:01:10 -0000 1.14 --- libshelve.tex 15 Nov 2002 06:46:13 -0000 1.15 *************** *** 34,37 **** --- 34,41 ---- \end{verbatim} + In addition to the above, shelve supports all methods that are + supported by dictionaries. This eases the transition from dictionary + based scripts to those requiring persistent storage. + Restrictions: From rhettinger@users.sourceforge.net Fri Nov 15 06:46:15 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 14 Nov 2002 22:46:15 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.522,1.523 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2280/Misc Modified Files: NEWS Log Message: SF patch #520382: Expand shelve.py to have a full dictionary interface and add a mixin to UserDict.py to make it easier to implement a full dictionary interface. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.522 retrieving revision 1.523 diff -C2 -d -r1.522 -r1.523 *** NEWS 14 Nov 2002 23:31:58 -0000 1.522 --- NEWS 15 Nov 2002 06:46:12 -0000 1.523 *************** *** 382,385 **** --- 382,394 ---- ------- + - UserDict.py now defines a DictMixin class which defines all dictionary + methods for classes that already have a minimum mapping interface. + This greatly simplifies writing classes that need to be substitutable + for dictionaries (such as the shelve module). + + - shelve.py now subclasses from UserDict.DictMixin. Now shelve supports + all dictionary methods. This eases the transition to persistent + storage for scripts originally written with dictionaries in mind. + - A new package, logging, implements the logging API defined by PEP 282. The code is written by Vinay Sajip. From rhettinger@users.sourceforge.net Fri Nov 15 06:46:16 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 14 Nov 2002 22:46:16 -0800 Subject: [Python-checkins] python/dist/src/Lib UserDict.py,1.17,1.18 shelve.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv2280/Lib Modified Files: UserDict.py shelve.py Log Message: SF patch #520382: Expand shelve.py to have a full dictionary interface and add a mixin to UserDict.py to make it easier to implement a full dictionary interface. Index: UserDict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserDict.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** UserDict.py 13 Apr 2002 14:03:38 -0000 1.17 --- UserDict.py 15 Nov 2002 06:46:13 -0000 1.18 *************** *** 61,62 **** --- 61,126 ---- def __iter__(self): return iter(self.data) + + class DictMixin: + '''Mixin defining all dictionary methods for classes that already have + a minimum dictionary interface including getitem, setitem, delitem, + and keys ''' + + # first level provided by subclass: getitem, setitem, delitem, and keys + + # second level definitions which assume only getitem and keys + def has_key(self, key): + try: + value = self[key] + except KeyError: + return False + return True + __contains__ = has_key + def __iter__(self): + for k in self.keys(): + yield k + def __len__(self): + return len(self.keys()) + + # third level uses second level instead of first + def iteritems(self): + for k in self: + yield (k, self[k]) + iterkeys = __iter__ + + # fourth level uses second and third levels instead of first + def itervalues(self): + for _, v in self.iteritems(): + yield v + def values(self): + return [self[key] for key in self.keys()] + def items(self): + return list(self.iteritems()) + def clear(self): + for key in self.keys(): + del self[key] + def setdefault(self, key, default): + if key not in self: + self[key] = default + return default + return self[key] + def pop(self, key): + value = self[key] + del self[key] + return value + def popitem(self): + try: + k, v = self.iteritems().next() + except StopIteration: + raise KeyError, 'dictionary is empty' + del self[k] + return (k, v) + def update(self, other): + for key in other.keys(): + self[key] = other[key] + def get(self, key, default=None): + if key in self: + return self[key] + return default + def __repr__(self): + return repr(dict(self.items())) Index: shelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shelve.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shelve.py 18 Oct 2002 08:58:14 -0000 1.16 --- shelve.py 15 Nov 2002 06:46:14 -0000 1.17 *************** *** 41,47 **** from StringIO import StringIO __all__ = ["Shelf","BsdDbShelf","DbfilenameShelf","open"] ! class Shelf: """Base class for shelf implementations. --- 41,49 ---- from StringIO import StringIO + import UserDict + __all__ = ["Shelf","BsdDbShelf","DbfilenameShelf","open"] ! class Shelf(UserDict.DictMixin): """Base class for shelf implementations. From loewis@users.sourceforge.net Fri Nov 15 07:27:05 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 14 Nov 2002 23:27:05 -0800 Subject: [Python-checkins] python/dist/src README,1.136.4.12,1.136.4.13 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv16959 Modified Files: Tag: release22-maint README Log Message: Explain what to do in case of missing shared libraries. Fixes #635929. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.136.4.12 retrieving revision 1.136.4.13 diff -C2 -d -r1.136.4.12 -r1.136.4.13 *** README 4 Nov 2002 20:50:39 -0000 1.136.4.12 --- README 15 Nov 2002 07:27:03 -0000 1.136.4.13 *************** *** 214,226 **** If you get failures in test_long, or sys.maxint gets set to -1, you are probably experiencing compiler bugs, usually related to ! optimization. This is a common problem with some versions of gcc and ! egcs, and some vendor-supplied compilers, which can sometimes be ! worked around by turning off optimization. Consider switching to ! stable versions (gcc 2.7.2.3, egcs 1.1.2, or contact your vendor.) From Python 2.0 onward, all Python C code is ANSI C. Compiling using old K&R-C-only compilers is no longer possible. ANSI C compilers are available for all modern systems, either in the form of updated ! compilers from the vendor, or one of the free compilers (gcc, egcs). Platform specific notes --- 214,226 ---- If you get failures in test_long, or sys.maxint gets set to -1, you are probably experiencing compiler bugs, usually related to ! optimization. This is a common problem with some versions of gcc, and ! some vendor-supplied compilers, which can sometimes be worked around ! by turning off optimization. Consider switching to stable versions ! (gcc 2.95.2, or contact your vendor.) From Python 2.0 onward, all Python C code is ANSI C. Compiling using old K&R-C-only compilers is no longer possible. ANSI C compilers are available for all modern systems, either in the form of updated ! compilers from the vendor, or one of the free compilers (gcc). Platform specific notes *************** *** 250,253 **** --- 250,270 ---- are aware of the problem, so binutils 2.13.1 will probably fix this problem. + + When the dynamic loader complains about errors finding shared + libraries, such as + + ld.so.1: ./python: fatal: libstdc++.so.5: open failed: + No such file or directory + + you need to first make sure that the library is available on + your system. Then, you need to instruct the dynamic loader how + to find it. You can chose any of the following strategies: + + 1. When compiling Python, set LD_RUN_PATH to the directories + containing missing libraries. + 2. When running Python, set LD_LIBRARY_PATH to these directories. + 3. Use crle(8) to extend the search path of the loader. + 4. Modify the installed GCC specs file, adding -R options into the + *link: section. Linux: A problem with threads and fork() was tracked down to a bug in From loewis@users.sourceforge.net Fri Nov 15 07:28:07 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 14 Nov 2002 23:28:07 -0800 Subject: [Python-checkins] python/dist/src README,1.157,1.158 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv17143 Modified Files: README Log Message: Explain what to do in case of missing shared libraries. Remove mentioning of egcs. Fixes #635929. Backported to 2.2.3. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** README 12 Nov 2002 16:53:36 -0000 1.157 --- README 15 Nov 2002 07:28:05 -0000 1.158 *************** *** 215,227 **** If you get failures in test_long, or sys.maxint gets set to -1, you are probably experiencing compiler bugs, usually related to ! optimization. This is a common problem with some versions of gcc and ! egcs, and some vendor-supplied compilers, which can sometimes be ! worked around by turning off optimization. Consider switching to ! stable versions (gcc 2.7.2.3, egcs 1.1.2, or contact your vendor.) From Python 2.0 onward, all Python C code is ANSI C. Compiling using old K&R-C-only compilers is no longer possible. ANSI C compilers are available for all modern systems, either in the form of updated ! compilers from the vendor, or one of the free compilers (gcc, egcs). Platform specific notes --- 215,227 ---- If you get failures in test_long, or sys.maxint gets set to -1, you are probably experiencing compiler bugs, usually related to ! optimization. This is a common problem with some versions of gcc, and ! some vendor-supplied compilers, which can sometimes be worked around ! by turning off optimization. Consider switching to stable versions ! (gcc 2.95.2, or contact your vendor.) From Python 2.0 onward, all Python C code is ANSI C. Compiling using old K&R-C-only compilers is no longer possible. ANSI C compilers are available for all modern systems, either in the form of updated ! compilers from the vendor, or one of the free compilers (gcc). Platform specific notes *************** *** 251,254 **** --- 251,271 ---- are aware of the problem, so binutils 2.13.1 will probably fix this problem. + + When the dynamic loader complains about errors finding shared + libraries, such as + + ld.so.1: ./python: fatal: libstdc++.so.5: open failed: + No such file or directory + + you need to first make sure that the library is available on + your system. Then, you need to instruct the dynamic loader how + to find it. You can chose any of the following strategies: + + 1. When compiling Python, set LD_RUN_PATH to the directories + containing missing libraries. + 2. When running Python, set LD_LIBRARY_PATH to these directories. + 3. Use crle(8) to extend the search path of the loader. + 4. Modify the installed GCC specs file, adding -R options into the + *link: section. Linux: A problem with threads and fork() was tracked down to a bug in From rhettinger@users.sourceforge.net Fri Nov 15 08:39:42 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 15 Nov 2002 00:39:42 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_userdict.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2802 Modified Files: test_userdict.py Log Message: SF patch #520382: Expand shelve.py to have a full dictionary interface and add a mixin to UserDict.py to make it easier to implement a full dictionary interface. Index: test_userdict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userdict.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_userdict.py 23 Jul 2002 19:04:09 -0000 1.6 --- test_userdict.py 15 Nov 2002 08:39:40 -0000 1.7 *************** *** 119,120 **** --- 119,218 ---- keys.sort() verify(ikeys == keys) + + ########################## + # Test Dict Mixin + + from UserDict import DictMixin + + class SeqDict(DictMixin): + """Dictionary lookalike implemented with lists. + + Used to test and demonstrate DictMixin + """ + def __init__(self): + self.keylist = [] + self.valuelist = [] + def __getitem__(self, key): + try: + i = self.keylist.index(key) + except ValueError: + raise KeyError + return self.valuelist[i] + def __setitem__(self, key, value): + self.keylist.append(key) + self.valuelist.append(value) + def __delitem__(self, key): + try: + i = self.keylist.index(key) + except ValueError: + raise KeyError + self.keylist.pop(i) + self.valuelist.pop(i) + def keys(self): + return list(self.keylist) + + ## Setup test and verify working of the test class + s = SeqDict() # check init + s[10] = 'ten' # exercise setitem + s[20] = 'twenty' + s[30] = 'thirty' + del s[20] # exercise delitem + verify(s[10] == 'ten') # check getitem and setitem + verify(s.keys() == [10, 30]) # check keys() and delitem + + ## Now, test the DictMixin methods one by one + verify(s.has_key(10)) # has_key + verify(not s.has_key(20)) + + verify(10 in s) # __contains__ + verify(20 not in s) + + verify([k for k in s] == [10, 30]) # __iter__ + + verify(len(s) == 2) # __len__ + + verify(list(s.iteritems()) == [(10,'ten'), (30, 'thirty')]) # iteritems + + verify(list(s.iterkeys()) == [10, 30]) # iterkeys + + verify(list(s.itervalues()) == ['ten', 'thirty']) # itervalues + + verify(s.values() == ['ten', 'thirty']) # values + + verify(s.items() == [(10,'ten'), (30, 'thirty')]) # items + + verify(s.get(10) == 'ten') # get + verify(s.get(15,'fifteen') == 'fifteen') + verify(s.get(15) == None) + + verify(s.setdefault(40, 'forty') == 'forty') # setdefault + verify(s.setdefault(10, 'null') == 'ten') + del s[40] + + verify(s.pop(10) == 'ten') # pop + verify(10 not in s) + s[10] = 'ten' + + k, v = s.popitem() # popitem + verify(k not in s) + s[k] = v + + s.clear() # clear + verify(len(s) == 0) + + try: # empty popitem + s.popitem() + except KeyError: + pass + else: + verify(0, "popitem from an empty list should raise KeyError") + + s.update({10: 'ten', 20:'twenty'}) # update + verify(s[10]=='ten' and s[20]=='twenty') + + + + + + + From gvanrossum@users.sourceforge.net Fri Nov 15 13:20:02 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 15 Nov 2002 05:20:02 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.523,1.524 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv26168 Modified Files: NEWS Log Message: Add Optik news. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.523 retrieving revision 1.524 diff -C2 -d -r1.523 -r1.524 *** NEWS 15 Nov 2002 06:46:12 -0000 1.523 --- NEWS 15 Nov 2002 13:19:58 -0000 1.524 *************** *** 382,385 **** --- 382,389 ---- ------- + - A new module, optparse, provides a fancy alternative to getopt for + command line parsing. It is slightly modified version of Greg + Ward's Optik package. + - UserDict.py now defines a DictMixin class which defines all dictionary methods for classes that already have a minimum mapping interface. From akuchling@users.sourceforge.net Fri Nov 15 14:37:13 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri, 15 Nov 2002 06:37:13 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv22043 Modified Files: whatsnew23.tex Log Message: Mention change in MRO Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** whatsnew23.tex 14 Nov 2002 23:40:42 -0000 1.68 --- whatsnew23.tex 15 Nov 2002 14:37:10 -0000 1.69 *************** *** 855,858 **** --- 855,871 ---- \code{None} may finally become a keyword. + \item The method resolution order used by new-style classes has + changed, though you'll only notice the difference if you have a really + complicated inheritance hierarchy. (Classic classes are unaffected by + this change.) Python 2.2 originally used a topological sort of a + class's ancestors, but 2.3 now uses the C3 algorithm as described in + \citetitle[http://www.webcom.com/haahr/dylan/linearization-oopsla96.html]{``A + Monotonic Superclass Linearization for Dylan''}. To understand the + motivation for this change, read the thread on python-dev starting + with the message at + \url{http://mail.python.org/pipermail/python-dev/2002-October/029035.html}. + Samuele Pedroni first pointed out the problem and also implemented the + fix by coding the C3 algorithm. + \item Python runs multithreaded programs by switching between threads after executing N bytecodes. The default value for N has been From akuchling@users.sourceforge.net Fri Nov 15 14:37:49 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri, 15 Nov 2002 06:37:49 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew22.tex,1.59,1.60 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory usw-pr-cvs1:/tmp/cvs-serv22401 Modified Files: whatsnew22.tex Log Message: Mention that the MRO algorithm changes in 2.3 Index: whatsnew22.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew22.tex,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** whatsnew22.tex 12 Nov 2002 18:59:20 -0000 1.59 --- whatsnew22.tex 15 Nov 2002 14:37:46 -0000 1.60 *************** *** 315,318 **** --- 315,321 ---- New-style classes follow a different algorithm that's a bit more complicated to explain, but does the right thing in this situation. + (Note that Python 2.3 changes this algorithm to one that produces the + same results in most cases, but produces more useful results for + really complicated inheritance graphs.) \begin{enumerate} From akuchling@users.sourceforge.net Fri Nov 15 14:42:37 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri, 15 Nov 2002 06:42:37 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.524,1.525 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv24463 Modified Files: NEWS Log Message: Fix minor nits Trim excess whitespace off one line Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.524 retrieving revision 1.525 diff -C2 -d -r1.524 -r1.525 *** NEWS 15 Nov 2002 13:19:58 -0000 1.524 --- NEWS 15 Nov 2002 14:42:34 -0000 1.525 *************** *** 13,17 **** -------------------------------------------- ! - Assignment to __class__ is disallowed if either the old and the new class is a statically allocated type object (such as defined by an extension module). This prevents anomalies like 2.__class__ = bool. --- 13,17 ---- -------------------------------------------- ! - Assignment to __class__ is disallowed if either the old or the new class is a statically allocated type object (such as defined by an extension module). This prevents anomalies like 2.__class__ = bool. *************** *** 383,387 **** - A new module, optparse, provides a fancy alternative to getopt for ! command line parsing. It is slightly modified version of Greg Ward's Optik package. --- 383,387 ---- - A new module, optparse, provides a fancy alternative to getopt for ! command line parsing. It is a slightly modified version of Greg Ward's Optik package. *************** *** 393,397 **** - shelve.py now subclasses from UserDict.DictMixin. Now shelve supports all dictionary methods. This eases the transition to persistent ! storage for scripts originally written with dictionaries in mind. - A new package, logging, implements the logging API defined by PEP --- 393,397 ---- - shelve.py now subclasses from UserDict.DictMixin. Now shelve supports all dictionary methods. This eases the transition to persistent ! storage for scripts originally written with dictionaries in mind. - A new package, logging, implements the logging API defined by PEP From fdrake@users.sourceforge.net Fri Nov 15 16:38:09 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 15 Nov 2002 08:38:09 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libbz2.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv15127 Modified Files: libbz2.tex Log Message: Minor revisions to clarify the status of xreadlines(), change the way iteration support was documented; the docs for __iter__() were just confusing. Index: libbz2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbz2.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libbz2.tex 5 Nov 2002 23:55:27 -0000 1.3 --- libbz2.tex 15 Nov 2002 16:38:06 -0000 1.4 *************** *** 18,22 **** \begin{itemize} \item \class{BZ2File} class implements a complete file interface, including ! \method{readline()}, \method{readlines()}, \method{xreadlines()}, \method{writelines()}, \method{seek()}, etc; \item \class{BZ2File} class implements emulated \method{seek()} support; --- 18,22 ---- \begin{itemize} \item \class{BZ2File} class implements a complete file interface, including ! \method{readline()}, \method{readlines()}, \method{writelines()}, \method{seek()}, etc; \item \class{BZ2File} class implements emulated \method{seek()} support; *************** *** 48,59 **** \var{compresslevel} is given, must be a number between \code{1} and \code{9}; the default is \code{9}. ! Add a \code{'U'} to mode to open the file for input with universal newline support. Any line ending in the input file will be seen as a ! \character{\textbackslash n} ! in Python. Also, a file so opened gains the attribute \member{newlines}; ! the value for this attribute is one of \code{None} (no newline read yet), ! \code{'\textbackslash r'}, \code{'\textbackslash n'}, ! \code{'\textbackslash r\textbackslash n'} or a tuple containing all the ! newline types seen. Universal newlines are available only when reading. \end{classdesc} --- 48,60 ---- \var{compresslevel} is given, must be a number between \code{1} and \code{9}; the default is \code{9}. ! Add a \character{U} to mode to open the file for input with universal newline support. Any line ending in the input file will be seen as a ! \character{\e n} in Python. Also, a file so opened gains the ! attribute \member{newlines}; the value for this attribute is one of ! \code{None} (no newline read yet), \code{'\e r'}, \code{'\e n'}, ! \code{'\e r\e n'} or a tuple containing all the newline types ! seen. Universal newlines are available only when reading. ! Instances support iteration in the same way as normal \class{file} ! instances. \end{classdesc} *************** *** 83,93 **** \begin{methoddesc}[BZ2File]{xreadlines}{} For backward compatibility. \class{BZ2File} objects now include the ! performance optimizations previously implemented in the \module{xreadlines} ! module. ! \end{methoddesc} ! ! \begin{methoddesc}[BZ2File]{\_\_iter\_\_}{} ! Iterate through the file lines. Iteration optimization is implemented ! using the same readahead algorithm available in \class{file} objects. \end{methoddesc} --- 84,92 ---- \begin{methoddesc}[BZ2File]{xreadlines}{} For backward compatibility. \class{BZ2File} objects now include the ! performance optimizations previously implemented in the ! \refmodule{xreadlines} module. ! \deprecated{2.3}{This exists only for compatibility with the method by ! this name on \class{file} objects, which is ! deprecated. Use \code{for line in file} instead.} \end{methoddesc} From tim_one@users.sourceforge.net Fri Nov 15 18:36:14 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 15 Nov 2002 10:36:14 -0800 Subject: [Python-checkins] python/dist/src/PCbuild readme.txt,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv13764/python/PCbuild Modified Files: readme.txt Log Message: Repaired typos in the Tcl/Tk compilation instructions. Turns out they work on Win98SE too (yay!). Index: readme.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/readme.txt,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** readme.txt 14 Nov 2002 23:24:40 -0000 1.26 --- readme.txt 15 Nov 2002 18:36:11 -0000 1.27 *************** *** 84,92 **** Unzip into dist\tcl8.4.1\ ! dist\tk\8.4.1\ respectively. ! Build Tcl first (done here w/ MSVC 6 on Win2K) ! ---------------------------------------------- cd dist\tcl8.4.1\win run vcvars32.bat [necessary even on Win2K] --- 84,92 ---- Unzip into dist\tcl8.4.1\ ! dist\tk8.4.1\ respectively. ! Build Tcl first (done here w/ MSVC 6 on Win2K; also Win98SE) ! --------------- cd dist\tcl8.4.1\win run vcvars32.bat [necessary even on Win2K] *************** *** 99,111 **** XXX Should rename destination directory to something more generic ! XXX then tcl84. But unless I can backport 8.3.4 to the 2.2 line ! XXX too, I've got to be able to build using more than oneX Tcl/Tk XXX release, and that effectively reserves the "tcl" directory name XXX for the duration. Nothing that requires thought is going to XXX work when it comes to release crunch times. - Build Tk ! ------- cd dist\tk8.4.1\win nmake -f makefile.vc TCLDIR=..\..\tcl8.4.1 --- 99,110 ---- XXX Should rename destination directory to something more generic ! XXX then tcl84. But unless I can backport 8.4.1 to the 2.2 line ! XXX too, I've got to be able to build using more than one Tcl/Tk XXX release, and that effectively reserves the "tcl" directory name XXX for the duration. Nothing that requires thought is going to XXX work when it comes to release crunch times. Build Tk ! -------- cd dist\tk8.4.1\win nmake -f makefile.vc TCLDIR=..\..\tcl8.4.1 From fdrake@users.sourceforge.net Fri Nov 15 18:50:01 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 15 Nov 2002 10:50:01 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib liblogging.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv18574 Modified Files: liblogging.tex Log Message: Fix critical markup errors. Index: liblogging.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblogging.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** liblogging.tex 14 Nov 2002 03:57:19 -0000 1.1 --- liblogging.tex 15 Nov 2002 18:49:57 -0000 1.2 *************** *** 898,902 **** ! \begin{classdesc}PlaceHolder{logger} \class{PlaceHolder} instances are used in the \class{Manager} logger --- 898,902 ---- ! \begin{classdesc}{PlaceHolder}{logger} \class{PlaceHolder} instances are used in the \class{Manager} logger *************** *** 914,918 **** \end{methoddesc} ! \begin{classdesc}RootLogger{level} A root logger is not that different to any other logger, except that it must --- 914,918 ---- \end{methoddesc} ! \begin{classdesc}{RootLogger}{level} A root logger is not that different to any other logger, except that it must From fdrake@users.sourceforge.net Fri Nov 15 19:04:14 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 15 Nov 2002 11:04:14 -0800 Subject: [Python-checkins] python/dist/src/Doc/perl python.perl,1.131,1.132 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv23404 Modified Files: python.perl Log Message: Squash an enormous number of warnings reported when adding "use warnings;" to this, and keep the "use" statement this time. Fix an obscure bug that caused weird index entries to be generated in a few cases, and a minor problem with horizontal alignmetn of the last column of 5-column tables. [I'd report a SF bug #, but I can't get to that right now.] Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** python.perl 13 Nov 2002 19:16:37 -0000 1.131 --- python.perl 15 Nov 2002 19:04:10 -0000 1.132 *************** *** 9,12 **** --- 9,13 ---- package main; + use warnings; use File::Basename; *************** *** 27,31 **** sub make_icon_filename($){ ! my($myname, $mydir, $myext) = fileparse(@_[0], '\..*'); chop $mydir; if ($mydir eq '.') { --- 28,32 ---- sub make_icon_filename($){ ! my($myname, $mydir, $myext) = fileparse($_[0], '\..*'); chop $mydir; if ($mydir eq '.') { *************** *** 38,42 **** sub get_link_icon($){ ! my $url = @_[0]; if ($OFF_SITE_LINK_ICON && ($url =~ /^[-a-zA-Z0-9.]+:/)) { # absolute URL; assume it points off-site --- 39,43 ---- sub get_link_icon($){ ! my $url = $_[0]; if ($OFF_SITE_LINK_ICON && ($url =~ /^[-a-zA-Z0-9.]+:/)) { # absolute URL; assume it points off-site *************** *** 73,77 **** if ($matched) { my($new, $char) = ($1, $3); ! eval "sub do_cmd_$new { \"\\$char\" . \@_[0]; }"; print "\ndefining handler for \\$new to insert '$char'\n"; } --- 74,78 ---- if ($matched) { my($new, $char) = ($1, $3); ! eval "sub do_cmd_$new { \"\\$char\" . \$_[0]; }"; print "\ndefining handler for \\$new to insert '$char'\n"; } *************** *** 86,112 **** # the older version of LaTeX2HTML we use doesn't support this, but we use it: ! sub do_cmd_textasciitilde{ '~' . @_[0]; } ! sub do_cmd_textasciicircum{ '^' . @_[0]; } ! sub do_cmd_textbar{ '|' . @_[0]; } ! sub do_cmd_textgreater{ '>' . @_[0]; } ! sub do_cmd_textless{ '<' . @_[0]; } ! sub do_cmd_infinity{ '∞' . @_[0]; } ! sub do_cmd_plusminus{ '±' . @_[0]; } ! sub do_cmd_menuselection{ @_[0]; } ! sub do_cmd_sub{ ' > ' . @_[0]; } # words typeset in a special way (not in HTML though) ! sub do_cmd_ABC{ 'ABC' . @_[0]; } ! sub do_cmd_UNIX{ 'Unix'. @_[0]; } ! sub do_cmd_ASCII{ 'ASCII' . @_[0]; } ! sub do_cmd_POSIX{ 'POSIX' . @_[0]; } ! sub do_cmd_C{ 'C' . @_[0]; } ! sub do_cmd_Cpp{ 'C++' . @_[0]; } ! sub do_cmd_EOF{ 'EOF' . @_[0]; } ! sub do_cmd_NULL{ 'NULL' . @_[0]; } ! sub do_cmd_e{ '\' . @_[0]; } $DEVELOPER_ADDRESS = ''; --- 87,114 ---- # the older version of LaTeX2HTML we use doesn't support this, but we use it: ! sub do_cmd_textasciitilde{ '~' . $_[0]; } ! sub do_cmd_textasciicircum{ '^' . $_[0]; } ! sub do_cmd_textbar{ '|' . $_[0]; } ! sub do_cmd_textgreater{ '>' . $_[0]; } ! sub do_cmd_textless{ '<' . $_[0]; } ! sub do_cmd_textunderscore{ '_' . $_[0]; } ! sub do_cmd_infinity{ '∞' . $_[0]; } ! sub do_cmd_plusminus{ '±' . $_[0]; } ! sub do_cmd_menuselection{ $_[0]; } ! sub do_cmd_sub{ ' > ' . $_[0]; } # words typeset in a special way (not in HTML though) ! sub do_cmd_ABC{ 'ABC' . $_[0]; } ! sub do_cmd_UNIX{ 'Unix'. $_[0]; } ! sub do_cmd_ASCII{ 'ASCII' . $_[0]; } ! sub do_cmd_POSIX{ 'POSIX' . $_[0]; } ! sub do_cmd_C{ 'C' . $_[0]; } ! sub do_cmd_Cpp{ 'C++' . $_[0]; } ! sub do_cmd_EOF{ 'EOF' . $_[0]; } ! sub do_cmd_NULL{ 'NULL' . $_[0]; } ! sub do_cmd_e{ '\' . $_[0]; } $DEVELOPER_ADDRESS = ''; *************** *** 115,120 **** $PACKAGE_VERSION = ''; ! sub do_cmd_version{ $PACKAGE_VERSION . @_[0]; } ! sub do_cmd_shortversion{ $SHORT_VERSION . @_[0]; } sub do_cmd_release{ local($_) = @_; --- 117,122 ---- $PACKAGE_VERSION = ''; ! sub do_cmd_version{ $PACKAGE_VERSION . $_[0]; } ! sub do_cmd_shortversion{ $SHORT_VERSION . $_[0]; } sub do_cmd_release{ local($_) = @_; *************** *** 141,147 **** } ! #sub do_cmd_developer{ do_cmd_author(@_[0]); } ! #sub do_cmd_developers{ do_cmd_author(@_[0]); } ! #sub do_cmd_developersaddress{ do_cmd_authoraddress(@_[0]); } sub do_cmd_hackscore{ --- 143,149 ---- } ! #sub do_cmd_developer{ do_cmd_author($_[0]); } ! #sub do_cmd_developers{ do_cmd_author($_[0]); } ! #sub do_cmd_developersaddress{ do_cmd_authoraddress($_[0]); } sub do_cmd_hackscore{ *************** *** 160,168 **** sub do_cmd_optional{ if ($IN_DESC_HANDLER) { ! return use_wrappers(@_[0], "\[", "\]"); } else { ! return use_wrappers(@_[0], "\[", "\]"); } } --- 162,170 ---- sub do_cmd_optional{ if ($IN_DESC_HANDLER) { ! return use_wrappers($_[0], "\[", "\]"); } else { ! return use_wrappers($_[0], "\[", "\]"); } } *************** *** 173,240 **** # from local repositories. ! sub do_cmd_pytype{ return @_[0]; } sub do_cmd_makevar{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_code{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_module{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_keyword{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_exception{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_class{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_function{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_constant{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_member{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_method{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_cfunction{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_cdata{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_ctype{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_regexp{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_character{ ! return use_wrappers(@_[0], '"', '"'); } sub do_cmd_program{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_programopt{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_longprogramopt{ # note that the --- will be later converted to -- by LaTeX2HTML ! return use_wrappers(@_[0], '---', ''); } sub do_cmd_email{ ! return use_wrappers(@_[0], ''); } sub do_cmd_mailheader{ ! return use_wrappers(@_[0], '', ':'); } sub do_cmd_mimetype{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_var{ ! return use_wrappers(@_[0], "", ""); } sub do_cmd_dfn{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_emph{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_file{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_filenq{ ! return do_cmd_file(@_[0]); } sub do_cmd_samp{ ! return use_wrappers(@_[0], '"', '"'); } sub do_cmd_kbd{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_strong{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_textbf{ ! return use_wrappers(@_[0], '', ''); } sub do_cmd_textit{ ! return use_wrappers(@_[0], '', ''); } # This can be changed/overridden for translations: %NoticeNames = ('note' => 'Note:', --- 175,242 ---- # from local repositories. ! sub do_cmd_pytype{ return $_[0]; } sub do_cmd_makevar{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_code{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_module{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_keyword{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_exception{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_class{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_function{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_constant{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_member{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_method{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_cfunction{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_cdata{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_ctype{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_regexp{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_character{ ! return use_wrappers($_[0], '"', '"'); } sub do_cmd_program{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_programopt{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_longprogramopt{ # note that the --- will be later converted to -- by LaTeX2HTML ! return use_wrappers($_[0], '---', ''); } sub do_cmd_email{ ! return use_wrappers($_[0], ''); } sub do_cmd_mailheader{ ! return use_wrappers($_[0], '', ':'); } sub do_cmd_mimetype{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_var{ ! return use_wrappers($_[0], "", ""); } sub do_cmd_dfn{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_emph{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_file{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_filenq{ ! return do_cmd_file($_[0]); } sub do_cmd_samp{ ! return use_wrappers($_[0], '"', '"'); } sub do_cmd_kbd{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_strong{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_textbf{ ! return use_wrappers($_[0], '', ''); } sub do_cmd_textit{ ! return use_wrappers($_[0], '', ''); } # This can be changed/overridden for translations: %NoticeNames = ('note' => 'Note:', *************** *** 245,249 **** my $label = $NoticeNames{'note'}; return use_wrappers( ! @_[0], "$label\n", ''); } --- 247,251 ---- my $label = $NoticeNames{'note'}; return use_wrappers( ! $_[0], "$label\n", ''); } *************** *** 251,255 **** my $label = $NoticeNames{'warning'}; return use_wrappers( ! @_[0], "$label\n", ''); } --- 253,257 ---- my $label = $NoticeNames{'warning'}; return use_wrappers( ! $_[0], "$label\n", ''); } *************** *** 268,274 **** sub do_cmd_moreargs{ ! return '...' . @_[0]; } sub do_cmd_unspecified{ ! return '...' . @_[0]; } --- 270,276 ---- sub do_cmd_moreargs{ ! return '...' . $_[0]; } sub do_cmd_unspecified{ ! return '...' . $_[0]; } *************** *** 396,401 **** sub versionnote($$){ # one or two parameters: \versionnote[explanation]{version} ! my $type = @_[0]; ! local $_ = @_[1]; my $explanation = next_optional_argument(); my $release = next_argument(); --- 398,403 ---- sub versionnote($$){ # one or two parameters: \versionnote[explanation]{version} ! my $type = $_[0]; ! local $_ = $_[1]; my $explanation = next_optional_argument(); my $release = next_argument(); *************** *** 408,416 **** sub do_cmd_versionadded{ ! return versionnote('New', @_[0]); } sub do_cmd_versionchanged{ ! return versionnote('Changed', @_[0]); } --- 410,418 ---- sub do_cmd_versionadded{ ! return versionnote('New', $_[0]); } sub do_cmd_versionchanged{ ! return versionnote('Changed', $_[0]); } *************** *** 472,476 **** # a warning that \makemodindex is unknown.) # ! sub do_cmd_makemodindex{ return @_[0]; } # We're in the document subdirectory when this happens! --- 474,478 ---- # a warning that \makemodindex is unknown.) # ! sub do_cmd_makemodindex{ return $_[0]; } # We're in the document subdirectory when this happens! *************** *** 494,498 **** sub gen_link($$){ my($node, $target) = @_; ! print INTLABELS "\$internal_labels{\"$target\"} = \"$URL/$node\";\n"; return ""; } --- 496,500 ---- sub gen_link($$){ my($node, $target) = @_; ! print INTLABELS "\$internal_labels{\"$target\"} = \"/$node\";\n"; return ""; } *************** *** 518,527 **** my $i = 0; for (; $i < $count; ++$i) { ! my $name = @_[$i]; my $cmd = "idx_cmd_$name"; die "\nNo function $cmd() defined!\n" if (!defined &$cmd); eval ("sub do_cmd_$name { return process_index_macros(" ! . "\@_[0], '$name'); }"); if (length($IndexMacroPattern) == 0) { $IndexMacroPattern = "$name"; --- 520,529 ---- my $i = 0; for (; $i < $count; ++$i) { ! my $name = $_[$i]; my $cmd = "idx_cmd_$name"; die "\nNo function $cmd() defined!\n" if (!defined &$cmd); eval ("sub do_cmd_$name { return process_index_macros(" ! . "\$_[0], '$name'); }"); if (length($IndexMacroPattern) == 0) { $IndexMacroPattern = "$name"; *************** *** 536,540 **** sub process_index_macros($$){ local($_) = @_; ! my $cmdname = @_[1]; # This is what triggered us in the first place; # we know it's real, so just process it. my($name, $aname, $ahref) = new_link_info(); --- 538,542 ---- sub process_index_macros($$){ local($_) = @_; ! my $cmdname = $_[1]; # This is what triggered us in the first place; # we know it's real, so just process it. my($name, $aname, $ahref) = new_link_info(); *************** *** 565,569 **** sub idx_cmd_index($){ my $str = next_argument(); ! add_index_entry("$str", @_[0]); } --- 567,571 ---- sub idx_cmd_index($){ my $str = next_argument(); ! add_index_entry("$str", $_[0]); } *************** *** 571,576 **** sub idx_cmd_kwindex($){ my $str = next_argument(); ! add_index_entry("$str!keyword", @_[0]); ! add_index_entry("keyword!$str", @_[0]); } --- 573,578 ---- sub idx_cmd_kwindex($){ my $str = next_argument(); ! add_index_entry("$str!keyword", $_[0]); ! add_index_entry("keyword!$str", $_[0]); } *************** *** 579,584 **** my $str1 = next_argument(); my $str2 = next_argument(); ! add_index_entry("$str1!$str2", @_[0]); ! add_index_entry("$str2!$str1", @_[0]); } --- 581,586 ---- my $str1 = next_argument(); my $str2 = next_argument(); ! add_index_entry("$str1!$str2", $_[0]); ! add_index_entry("$str2!$str1", $_[0]); } *************** *** 588,594 **** my $str2 = next_argument(); my $str3 = next_argument(); ! add_index_entry("$str1!$str2 $str3", @_[0]); ! add_index_entry("$str2!$str3, $str1", @_[0]); ! add_index_entry("$str3!$str1 $str2", @_[0]); } --- 590,596 ---- my $str2 = next_argument(); my $str3 = next_argument(); ! add_index_entry("$str1!$str2 $str3", $_[0]); ! add_index_entry("$str2!$str3, $str1", $_[0]); ! add_index_entry("$str3!$str1 $str2", $_[0]); } *************** *** 599,606 **** my $str3 = next_argument(); my $str4 = next_argument(); ! add_index_entry("$str1!$str2 $str3 $str4", @_[0]); ! add_index_entry("$str2!$str3 $str4, $str1", @_[0]); ! add_index_entry("$str3!$str4, $str1 $str2", @_[0]); ! add_index_entry("$str4!$$str1 $str2 $str3", @_[0]); } --- 601,608 ---- my $str3 = next_argument(); my $str4 = next_argument(); ! add_index_entry("$str1!$str2 $str3 $str4", $_[0]); ! add_index_entry("$str2!$str3 $str4, $str1", $_[0]); ! add_index_entry("$str3!$str4, $str1 $str2", $_[0]); ! add_index_entry("$str4!$str1 $str2 $str3", $_[0]); } *************** *** 609,613 **** my $str = next_argument(); my $entry = $str . get_indexsubitem(); ! add_index_entry($entry, @_[0]); } --- 611,615 ---- my $str = next_argument(); my $entry = $str . get_indexsubitem(); ! add_index_entry($entry, $_[0]); } *************** *** 620,627 **** define_indexing_macro('stindex', 'opindex', 'exindex', 'obindex'); ! sub idx_cmd_stindex($){ my_typed_index_helper('statement', @_[0]); } ! sub idx_cmd_opindex($){ my_typed_index_helper('operator', @_[0]); } ! sub idx_cmd_exindex($){ my_typed_index_helper('exception', @_[0]); } ! sub idx_cmd_obindex($){ my_typed_index_helper('object', @_[0]); } define_indexing_macro('bifuncindex'); --- 622,629 ---- define_indexing_macro('stindex', 'opindex', 'exindex', 'obindex'); ! sub idx_cmd_stindex($){ my_typed_index_helper('statement', $_[0]); } ! sub idx_cmd_opindex($){ my_typed_index_helper('operator', $_[0]); } ! sub idx_cmd_exindex($){ my_typed_index_helper('exception', $_[0]); } ! sub idx_cmd_obindex($){ my_typed_index_helper('object', $_[0]); } define_indexing_macro('bifuncindex'); *************** *** 629,633 **** my $str = next_argument(); add_index_entry("$str() (built-in function)", ! @_[0]); } --- 631,635 ---- my $str = next_argument(); add_index_entry("$str() (built-in function)", ! $_[0]); } *************** *** 679,686 **** } ! sub do_cmd_modindex{ return my_module_index_helper('', @_); } ! sub do_cmd_bimodindex{ return my_module_index_helper('built-in', @_); } ! sub do_cmd_exmodindex{ return my_module_index_helper('extension', @_); } ! sub do_cmd_stmodindex{ return my_module_index_helper('standard', @_); } sub ref_module_index_helper($$){ --- 681,692 ---- } ! sub do_cmd_modindex{ return my_module_index_helper('', $_[0]); } ! sub do_cmd_bimodindex{ return my_module_index_helper('built-in', $_[0]); } ! sub do_cmd_exmodindex{ return my_module_index_helper('extension', $_[0]); } ! sub do_cmd_stmodindex{ return my_module_index_helper('standard', $_[0]); } ! # local($_) = @_; ! # my $name = next_argument(); ! # return define_module('standard', $name) . $_; ! # } sub ref_module_index_helper($$){ *************** *** 699,708 **** define_indexing_macro('refmodindex', 'refbimodindex', 'refexmodindex', 'refstmodindex'); ! sub idx_cmd_refmodindex($){ return ref_module_index_helper('', @_); } ! sub idx_cmd_refbimodindex($){ return ref_module_index_helper('built-in', @_); } ! sub idx_cmd_refexmodindex($){ return ref_module_index_helper('extension', @_);} ! sub idx_cmd_refstmodindex($){ return ref_module_index_helper('standard', @_); } ! sub do_cmd_nodename{ return do_cmd_label(@_); } sub init_myformat(){ --- 705,718 ---- define_indexing_macro('refmodindex', 'refbimodindex', 'refexmodindex', 'refstmodindex'); ! sub idx_cmd_refmodindex($){ ! return ref_module_index_helper('', $_[0]); } ! sub idx_cmd_refbimodindex($){ ! return ref_module_index_helper('built-in', $_[0]); } ! sub idx_cmd_refexmodindex($){ ! return ref_module_index_helper('extension', $_[0]);} ! sub idx_cmd_refstmodindex($){ ! return ref_module_index_helper('standard', $_[0]); } ! sub do_cmd_nodename{ return do_cmd_label($_[0]); } sub init_myformat(){ *************** *** 718,722 **** # sub make_str_index_entry($){ ! my $str = @_[0]; my($name, $aname, $ahref) = new_link_info(); add_index_entry($str, $ahref); --- 728,732 ---- # sub make_str_index_entry($){ ! my $str = $_[0]; my($name, $aname, $ahref) = new_link_info(); add_index_entry($str, $ahref); *************** *** 860,866 **** local($_) = @_; s/\\productioncont/ /g; ! s/\\production(<<\d+>>)(.+)\1/\n\2 ::= /g; ! s/\\token(<<\d+>>)(.+)\1/\2/g; ! s/\\e([^a-zA-Z])/\\\1/g; s/<<\d+>>//g; s/;SPMgt;/>/g; --- 870,876 ---- local($_) = @_; s/\\productioncont/ /g; ! s/\\production(<<\d+>>)(.+)\1/\n$2 ::= /g; ! s/\\token(<<\d+>>)(.+)\1/$2/g; ! s/\\e([^a-zA-Z])/\\$1/g; s/<<\d+>>//g; s/;SPMgt;/>/g; *************** *** 876,881 **** $REFCOUNTS_LOADED = 1; ! my $myname, $mydir, $myext; ! ($myname, $mydir, $myext) = fileparse(__FILE__, '\..*'); chop $mydir; # remove trailing '/' ($myname, $mydir, $myext) = fileparse($mydir, '\..*'); --- 886,890 ---- $REFCOUNTS_LOADED = 1; ! my($myname, $mydir, $myext) = fileparse(__FILE__, '\..*'); chop $mydir; # remove trailing '/' ($myname, $mydir, $myext) = fileparse($mydir, '\..*'); *************** *** 913,918 **** $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; # ???? - why both of these? ! $args =~ s/(\s|\*)([a-z_][a-z_0-9]*),/\1\2<\/var>,/g; ! $args =~ s/(\s|\*)([a-z_][a-z_0-9]*)$/\1\2<\/var>/s; return ('' . "" --- 922,927 ---- $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; # ???? - why both of these? ! $args =~ s/(\s|\*)([a-z_][a-z_0-9]*),/$1$2<\/var>,/g; ! $args =~ s/(\s|\*)([a-z_][a-z_0-9]*)$/$1$2<\/var>/s; return ('
$type\ $idx(
' . "" *************** *** 1154,1158 **** sub do_env_classdesc{ ! return handle_classlike_descriptor(@_[0], "class"); } --- 1163,1167 ---- sub do_env_classdesc{ ! return handle_classlike_descriptor($_[0], "class"); } *************** *** 1169,1173 **** sub do_env_excclassdesc{ ! return handle_classlike_descriptor(@_[0], "exception"); } --- 1178,1182 ---- sub do_env_excclassdesc{ ! return handle_classlike_descriptor($_[0], "exception"); } *************** *** 1297,1301 **** # do a little magic on a font name to get the right behavior in the first # column of the output table ! my $font = @_[0]; if (defined $FontConversions{$font}) { $font = $FontConversions{$font}; --- 1306,1310 ---- # do a little magic on a font name to get the right behavior in the first # column of the output table ! my $font = $_[0]; if (defined $FontConversions{$font}) { $font = $FontConversions{$font}; *************** *** 1305,1309 **** sub figure_column_alignment($){ ! my $a = @_[0]; my $mark = substr($a, 0, 1); my $r = ''; --- 1314,1321 ---- sub figure_column_alignment($){ ! my $a = $_[0]; ! if (!defined $a) { ! return ''; ! } my $mark = substr($a, 0, 1); my $r = ''; *************** *** 1321,1325 **** sub setup_column_alignments($){ local($_) = @_; ! my($s1, $s2, $s3, $s4, $a5) = split(/[|]/,$_); my $a1 = figure_column_alignment($s1); my $a2 = figure_column_alignment($s2); --- 1333,1337 ---- sub setup_column_alignments($){ local($_) = @_; ! my($s1, $s2, $s3, $s4, $s5) = split(/[|]/,$_); my $a1 = figure_column_alignment($s1); my $a2 = figure_column_alignment($s2); *************** *** 1702,1706 **** sub get_chapter_id(){ my $id = do_cmd_thechapter(''); ! $id =~ s/(\d+)<\/SPAN>/\1/; $id =~ s/\.//; return $id; --- 1714,1718 ---- sub get_chapter_id(){ my $id = do_cmd_thechapter(''); ! $id =~ s/(\d+)<\/SPAN>/$1/; $id =~ s/\.//; return $id; *************** *** 1711,1715 **** sub get_synopsis_table($){ ! my $chap = @_[0]; my $key; foreach $key (keys %ModuleSynopses) { --- 1723,1727 ---- sub get_synopsis_table($){ ! my $chap = $_[0]; my $key; foreach $key (keys %ModuleSynopses) { *************** *** 1768,1775 **** sub process_all_localmoduletables(){ my $key; - my $st, $file; foreach $key (keys %ModuleSynopses) { ! $st = $ModuleSynopses{$key}; ! $file = $st->get_file(); if ($file) { process_localmoduletables_in_file($file); --- 1780,1786 ---- sub process_all_localmoduletables(){ my $key; foreach $key (keys %ModuleSynopses) { ! my $st = $ModuleSynopses{$key}; ! my $file = $st->get_file(); if ($file) { process_localmoduletables_in_file($file); *************** *** 1782,1786 **** sub process_localmoduletables_in_file($){ ! my $file = @_[0]; open(MYFILE, "<$file"); local($_); --- 1793,1797 ---- sub process_localmoduletables_in_file($){ ! my $file = $_[0]; open(MYFILE, "<$file"); local($_); *************** *** 1812,1816 **** return ("
\n " . "

See Also:

\n" ! . @_[0] . '
'); } --- 1823,1827 ---- return ("
\n " . "

See Also:

\n" ! . $_[0] . '
'); } *************** *** 1818,1822 **** sub do_env_seealsostar{ return ("
\n " ! . @_[0] . '
'); } --- 1829,1833 ---- sub do_env_seealsostar{ return ("
\n " ! . $_[0] . '
'); } *************** *** 1843,1847 **** sub strip_html_markup($){ ! my $str = @_[0]; my $s = "$str"; $s =~ s/<[a-zA-Z0-9]+(\s+[a-zA-Z0-9]+(\s*=\s*(\'[^\']*\'|\"[^\"]*\"|[a-zA-Z0-9]+))?)*\s*>//g; --- 1854,1858 ---- sub strip_html_markup($){ ! my $str = $_[0]; my $s = "$str"; $s =~ s/<[a-zA-Z0-9]+(\s+[a-zA-Z0-9]+(\s*=\s*(\'[^\']*\'|\"[^\"]*\"|[a-zA-Z0-9]+))?)*\s*>//g; *************** *** 1867,1876 **** sub do_cmd_seepep{ ! return handle_rfclike_reference(@_[0], "PEP", $PEP_FORMAT); } sub do_cmd_seerfc{ # XXX Would be nice to add links to the text/plain and PDF versions. ! return handle_rfclike_reference(@_[0], "RFC", $RFC_FORMAT); } --- 1878,1887 ---- sub do_cmd_seepep{ ! return handle_rfclike_reference($_[0], "PEP", $PEP_FORMAT); } sub do_cmd_seerfc{ # XXX Would be nice to add links to the text/plain and PDF versions. ! return handle_rfclike_reference($_[0], "RFC", $RFC_FORMAT); } *************** *** 1919,1923 **** sub do_env_definitions{ ! return "
" . @_[0] . "
\n"; } --- 1930,1934 ---- sub do_env_definitions{ ! return "
" . $_[0] . "
\n"; } *************** *** 2001,2005 **** sub get_verbatim_output_name($){ ! my $file = @_[0]; # # Re-write the source filename to always use a .txt extension --- 2012,2016 ---- sub get_verbatim_output_name($){ ! my $file = $_[0]; # # Re-write the source filename to always use a .txt extension *************** *** 2013,2018 **** return $VerbatimFiles{$file}; } ! my $srcname, $srcdir, $srcext; ! ($srcname, $srcdir, $srcext) = fileparse($file, '\..*'); $filename = "$srcname.txt"; # --- 2024,2028 ---- return $VerbatimFiles{$file}; } ! my($srcname, $srcdir, $srcext) = fileparse($file, '\..*'); $filename = "$srcname.txt"; # From tim_one@users.sourceforge.net Fri Nov 15 19:08:54 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 15 Nov 2002 11:08:54 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_queue.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv24294/python/Lib/test Modified Files: test_queue.py Log Message: Style guide reformats. I saw this test fail on a very heavily loaded Win98SE box, but whatever the cause, it had scrolled off the DOS box. (There was just the "test_queue failed" summary at the end of the regrtest run.) Index: test_queue.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_queue.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_queue.py 15 Oct 2002 15:11:13 -0000 1.3 --- test_queue.py 15 Nov 2002 19:08:50 -0000 1.4 *************** *** 23,27 **** self.fn(*self.args) ! def _doBlockingTest( block_func, block_args, trigger_func, trigger_args): t = _TriggerThread(trigger_func, trigger_args) t.start() --- 23,27 ---- self.fn(*self.args) ! def _doBlockingTest(block_func, block_args, trigger_func, trigger_args): t = _TriggerThread(trigger_func, trigger_args) t.start() *************** *** 31,38 **** # If we unblocked before our thread made the call, we failed! if not t.startedEvent.isSet(): ! raise TestFailed("blocking function '%r' appeared not to block" % (block_func,)) t.join(1) # make sure the thread terminates if t.isAlive(): ! raise TestFailed("trigger function '%r' appeared to not return" % (trigger_func,)) # A Queue subclass that can provoke failure at a moment's notice :) --- 31,40 ---- # If we unblocked before our thread made the call, we failed! if not t.startedEvent.isSet(): ! raise TestFailed("blocking function '%r' appeared not to block" % ! block_func) t.join(1) # make sure the thread terminates if t.isAlive(): ! raise TestFailed("trigger function '%r' appeared to not return" % ! trigger_func) # A Queue subclass that can provoke failure at a moment's notice :) *************** *** 141,145 **** q.put(111) q.put(222) ! verify(q.get()==111 and q.get()==222, "Didn't seem to queue the correct data!") for i in range(queue_size-1): q.put(i) --- 143,148 ---- q.put(111) q.put(222) ! verify(q.get() == 111 and q.get() == 222, ! "Didn't seem to queue the correct data!") for i in range(queue_size-1): q.put(i) *************** *** 175,180 **** pass # Test a blocking get ! _doBlockingTest( q.get, (), q.put, ('empty',)) ! _doBlockingTest( q.get, (True, 0.2), q.put, ('empty',)) def test(): --- 178,183 ---- pass # Test a blocking get ! _doBlockingTest(q.get, (), q.put, ('empty',)) ! _doBlockingTest(q.get, (True, 0.2), q.put, ('empty',)) def test(): From theller@users.sourceforge.net Fri Nov 15 19:20:59 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Fri, 15 Nov 2002 11:20:59 -0800 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory usw-pr-cvs1:/tmp/cvs-serv28862 Modified Files: dist.tex Log Message: Correct typo: the option is 'formats' not 'format'. Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** dist.tex 29 May 2002 17:33:48 -0000 1.42 --- dist.tex 15 Nov 2002 19:20:56 -0000 1.43 *************** *** 1279,1283 **** \end{verbatim} ! or the \command{bdist} command with the \longprogramopt{format} option: \begin{verbatim} --- 1279,1283 ---- \end{verbatim} ! or the \command{bdist} command with the \longprogramopt{formats} option: \begin{verbatim} From theller@users.sourceforge.net Fri Nov 15 20:13:38 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Fri, 15 Nov 2002 12:13:38 -0800 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory usw-pr-cvs1:/tmp/cvs-serv12630 Modified Files: dist.tex Log Message: Document the available command line flags for bdist_wininst, which are avaliable in the Python 2.2 branch. I've left out some flags which are more thought for debugging, if someone needs them, he can always look at the output of --help. I'm sure Fred will make some adjustments, so I'll only mark this as a 2.2 bugfix candidate. There are more options available in the current CVS bdist_wininst, I will document them after this is in. Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** dist.tex 15 Nov 2002 19:20:56 -0000 1.43 --- dist.tex 15 Nov 2002 20:13:26 -0000 1.44 *************** *** 1266,1277 **** \label{creating-wininst} ! Executable installers are the natural format for binary ! distributions on Windows. They display a nice graphical user interface, ! display some information about the module distribution to be installed taken from the metadata in the setup script, let the user select a few ! (currently maybe too few) options, and start or cancel the installation. ! Since the metadata is taken from the setup script, creating ! Windows installers is usually as easy as running: \begin{verbatim} --- 1266,1277 ---- \label{creating-wininst} ! Executable installers are the natural format for binary distributions ! on Windows. They display a nice graphical user interface, display ! some information about the module distribution to be installed taken from the metadata in the setup script, let the user select a few ! options, and start or cancel the installation. ! Since the metadata is taken from the setup script, creating Windows ! installers is usually as easy as running: \begin{verbatim} *************** *** 1285,1304 **** \end{verbatim} ! If you have a pure module distribution (only containing pure ! Python modules and packages), the resulting installer will be ! version independent and have a name like \file{foo-1.0.win32.exe}. ! These installers can even be created on \UNIX{} or MacOS platforms. If you have a non-pure distribution, the extensions can only be created on a Windows platform, and will be Python version dependent. The installer filename will reflect this and now has the form ! \file{foo-1.0.win32-py2.0.exe}. You have to create a separate installer for every Python version you want to support. The installer will try to compile pure modules into bytecode after ! installation on the target system in normal and optimizing mode. ! If you don't want this to happen for some reason, you can run ! the bdist_wininst command with the \longprogramopt{no-target-compile} and/or ! the \longprogramopt{no-target-optimize} option. \section{Examples} --- 1285,1318 ---- \end{verbatim} ! If you have a pure module distribution (only containing pure Python ! modules and packages), the resulting installer will be version ! independent and have a name like \file{foo-1.0.win32.exe}. These ! installers can even be created on \UNIX{} or MacOS platforms. If you have a non-pure distribution, the extensions can only be created on a Windows platform, and will be Python version dependent. The installer filename will reflect this and now has the form ! \file{foo-1.0.win32-py2.0.exe}. You have to create a separate installer for every Python version you want to support. The installer will try to compile pure modules into bytecode after ! installation on the target system in normal and optimizing mode. If ! you don't want this to happen for some reason, you can run the ! bdist_wininst command with the \longprogramopt{no-target-compile} ! and/or the \longprogramopt{no-target-optimize} option. ! ! By default the installer will display the cool Python powered logo ! when it is run, but you can also supply your own bitmap which must be ! a Windows .bmp file with the \longprogramopt{bitmap} option. ! ! The installer will also display a large title on the desktop ! background window when it is run, which is constructed from the name ! of your distribution and the version number. This can be changed to ! another text by using the \longprogramopt{title} option. ! ! The installer file will be written to the ``distribution directory'' ! --- normally \file{dist/}, but customizable with the ! \longprogramopt{dist-dir} option. ! \section{Examples} From fdrake@users.sourceforge.net Fri Nov 15 20:32:05 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 15 Nov 2002 12:32:05 -0800 Subject: [Python-checkins] python/dist/src/Doc/perl distutils.perl,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv19507 Modified Files: distutils.perl Log Message: Fix stupid typo. Index: distutils.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/distutils.perl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** distutils.perl 27 Apr 2000 21:27:49 -0000 1.1 --- distutils.perl 15 Nov 2002 20:32:03 -0000 1.2 *************** *** 12,16 **** sub do_cmd_filevar { ! return use_wrappers(@_[0], '', ''); } --- 12,16 ---- sub do_cmd_filevar { ! return use_wrappers(@_[0], '', ''); } From fdrake@users.sourceforge.net Fri Nov 15 20:34:56 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 15 Nov 2002 12:34:56 -0800 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory usw-pr-cvs1:/tmp/cvs-serv20582 Modified Files: dist.tex Log Message: Minor markup nits. Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** dist.tex 15 Nov 2002 20:13:26 -0000 1.44 --- dist.tex 15 Nov 2002 20:34:52 -0000 1.45 *************** *** 1299,1308 **** installation on the target system in normal and optimizing mode. If you don't want this to happen for some reason, you can run the ! bdist_wininst command with the \longprogramopt{no-target-compile} ! and/or the \longprogramopt{no-target-optimize} option. ! By default the installer will display the cool Python powered logo when it is run, but you can also supply your own bitmap which must be ! a Windows .bmp file with the \longprogramopt{bitmap} option. The installer will also display a large title on the desktop --- 1299,1309 ---- installation on the target system in normal and optimizing mode. If you don't want this to happen for some reason, you can run the ! \command{bdist_wininst} command with the ! \longprogramopt{no-target-compile} and/or the ! \longprogramopt{no-target-optimize} option. ! By default the installer will display the cool ``Python Powered'' logo when it is run, but you can also supply your own bitmap which must be ! a Windows \file{.bmp} file with the \longprogramopt{bitmap} option. The installer will also display a large title on the desktop From nnorwitz@users.sourceforge.net Fri Nov 15 22:53:29 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 15 Nov 2002 14:53:29 -0800 Subject: [Python-checkins] python/nondist/peps pep-0291.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv4578 Modified Files: pep-0291.txt Log Message: Add logging package backward compatibility reqt for 1.5.2 Guido wants a comment at the top of each file that has a compatibility reqt Remove modulefinder as having a compatibility reqt (I think this is what Guido and Thomas agreed to, let me know if not.) Index: pep-0291.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0291.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0291.txt 7 Jun 2002 02:47:13 -0000 1.1 --- pep-0291.txt 15 Nov 2002 22:53:27 -0000 1.2 *************** *** 31,34 **** --- 31,38 ---- to make bug fixes easier to backport. + In addition to a package or module being listed in this PEP, + authors must add a comment at the top of each file documenting + the compatibility requirement. + Features to Avoid *************** *** 69,72 **** --- 73,77 ---- distutils Andrew Kuchling 1.5.2 email Barry Warsaw 2.1 + logging Vinay Sajip 1.5.2 sre Fredrik Lundh 1.5.2 xml (PyXML) Martin v. Loewis 2.0 *************** *** 76,80 **** Tool Maintainer(s) Python Version ---- ------------- -------------- ! scripts/freeze/modulefinder Thomas Heller 1.5.2 --- 81,85 ---- Tool Maintainer(s) Python Version ---- ------------- -------------- ! None From nnorwitz@users.sourceforge.net Fri Nov 15 23:00:36 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 15 Nov 2002 15:00:36 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libtime.tex,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv7477/Doc/lib Modified Files: libtime.tex Log Message: SF 639138, Ref. calendar module in time docs by John J Lee Will backport. Index: libtime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** libtime.tex 13 Nov 2002 19:05:01 -0000 1.51 --- libtime.tex 15 Nov 2002 23:00:30 -0000 1.52 *************** *** 323,325 **** --- 323,328 ---- settings can affect the return values for some of the functions in the \module{time} module.} + \seemodule{calendar}{General calendar-related functions. + \function{timegm()} is the inverse of + \function{gmtime()} from this module.} \end{seealso} From nnorwitz@users.sourceforge.net Fri Nov 15 23:01:41 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 15 Nov 2002 15:01:41 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libtime.tex,1.48.6.2,1.48.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv8059/Doc/lib Modified Files: Tag: release22-maint libtime.tex Log Message: SF 639138, Ref. calendar module in time docs Index: libtime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.48.6.2 retrieving revision 1.48.6.3 diff -C2 -d -r1.48.6.2 -r1.48.6.3 *** libtime.tex 13 Nov 2002 19:06:00 -0000 1.48.6.2 --- libtime.tex 15 Nov 2002 23:01:37 -0000 1.48.6.3 *************** *** 330,332 **** --- 330,335 ---- settings can affect the return values for some of the functions in the \module{time} module.} + \seemodule{calendar}{General calendar-related functions. + \function{timegm()} is the inverse of + \function{gmtime()} from this module.} \end{seealso} From nnorwitz@users.sourceforge.net Fri Nov 15 23:31:31 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 15 Nov 2002 15:31:31 -0800 Subject: [Python-checkins] python/dist/src/Lib/logging __init__.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/logging In directory usw-pr-cvs1:/tmp/cvs-serv16586/Lib/logging Modified Files: __init__.py Log Message: SF Patch #638825 logging module Fix pychecker warnings, remove unused imports and rename root Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 13 Nov 2002 16:18:29 -0000 1.2 --- __init__.py 15 Nov 2002 23:31:28 -0000 1.3 *************** *** 27,31 **** """ ! import sys, os, types, time, string, struct, cPickle, cStringIO try: --- 27,31 ---- """ ! import sys, os, types, time, string, cStringIO try: *************** *** 714,722 **** holds the hierarchy of loggers. """ ! def __init__(self, root): """ Initialize the manager with the root node of the logger hierarchy. """ ! self.root = root self.disable = 0 self.emittedNoHandlerWarning = 0 --- 714,722 ---- holds the hierarchy of loggers. """ ! def __init__(self, rootnode): """ Initialize the manager with the root node of the logger hierarchy. """ ! self.root = rootnode self.disable = 0 self.emittedNoHandlerWarning = 0 From nnorwitz@users.sourceforge.net Fri Nov 15 23:33:22 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 15 Nov 2002 15:33:22 -0800 Subject: [Python-checkins] python/dist/src/Lib/logging config.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/logging In directory usw-pr-cvs1:/tmp/cvs-serv17213/Lib/logging Modified Files: config.py Log Message: SF Patch #638825 Fix pychecker warnings, port arg was unused (it was always the default) Need a global statement for _listener Index: config.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/config.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** config.py 14 Nov 2002 12:52:17 -0000 1.3 --- config.py 15 Nov 2002 23:33:20 -0000 1.4 *************** *** 252,256 **** def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT, ! handler=None): ThreadingTCPServer.__init__(self, (host, port), handler) logging._acquireLock() --- 252,256 ---- def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT, ! handler=None): ThreadingTCPServer.__init__(self, (host, port), handler) logging._acquireLock() *************** *** 272,277 **** logging._releaseLock() ! def serve(rcvr, hdlr): ! server = rcvr(handler=hdlr) global _listener logging._acquireLock() --- 272,277 ---- logging._releaseLock() ! def serve(rcvr, hdlr, port): ! server = rcvr(port=port, handler=hdlr) global _listener logging._acquireLock() *************** *** 280,284 **** server.serve_until_stopped() ! return threading.Thread(target=serve, args=(ConfigSocketReceiver, ConfigStreamHandler)) def stopListening(): --- 280,286 ---- server.serve_until_stopped() ! return threading.Thread(target=serve, ! args=(ConfigSocketReceiver, ! ConfigStreamHandler, port)) def stopListening(): *************** *** 286,289 **** --- 288,292 ---- Stop the listening server which was created with a call to listen(). """ + global _listener if _listener: logging._acquireLock() From fdrake@users.sourceforge.net Sat Nov 16 00:41:57 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 15 Nov 2002 16:41:57 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.108,1.109 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv4202 Modified Files: libstdtypes.tex Log Message: Document that a minor feature was added in 2.2.2. ;-( Closes SF bug #639170. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** libstdtypes.tex 12 Nov 2002 22:08:08 -0000 1.108 --- libstdtypes.tex 16 Nov 2002 00:41:55 -0000 1.109 *************** *** 632,635 **** --- 632,636 ---- the characters in the string will be stripped from the beginning of the string this method is called on. + \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} *************** *** 665,668 **** --- 666,670 ---- the characters in the string will be stripped from the end of the string this method is called on. + \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} *************** *** 694,697 **** --- 696,700 ---- must be a string; the characters in the string will be stripped from the both ends of the string this method is called on. + \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} From fdrake@users.sourceforge.net Sat Nov 16 00:44:02 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 15 Nov 2002 16:44:02 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.109,1.110 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv4978 Modified Files: libstdtypes.tex Log Message: Better note that str.zfill() was added in 2.2.2 as well. ;-( Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -d -r1.109 -r1.110 *** libstdtypes.tex 16 Nov 2002 00:41:55 -0000 1.109 --- libstdtypes.tex 16 Nov 2002 00:44:00 -0000 1.110 *************** *** 724,727 **** --- 724,728 ---- of length \var{width}. The original string is returned if \var{width} is less than \code{len(\var{s})}. + \versionadded{2.2.2} \end{methoddesc} From fdrake@users.sourceforge.net Sat Nov 16 00:45:18 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 15 Nov 2002 16:45:18 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.80.6.15,1.80.6.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv5518 Modified Files: Tag: release22-maint libstdtypes.tex Log Message: Note that str.zfill() and the optional argument to str.strip(), .lstrip(), and .rstrip() were all added in 2.2.2. ;-( Closes SF bug #639170. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.80.6.15 retrieving revision 1.80.6.16 diff -C2 -d -r1.80.6.15 -r1.80.6.16 *** libstdtypes.tex 25 Oct 2002 16:56:16 -0000 1.80.6.15 --- libstdtypes.tex 16 Nov 2002 00:45:14 -0000 1.80.6.16 *************** *** 624,627 **** --- 624,628 ---- the characters in the string will be stripped from the beginning of the string this method is called on. + \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} *************** *** 657,660 **** --- 658,662 ---- the characters in the string will be stripped from the end of the string this method is called on. + \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} *************** *** 686,689 **** --- 688,692 ---- must be a string; the characters in the string will be stripped from the both ends of the string this method is called on. + \versionchanged[Support for the \var{chars} argument]{2.2.2} \end{methoddesc} *************** *** 713,716 **** --- 716,720 ---- of length \var{width}. The original string is returned if \var{width} is less than \code{len(\var{s})}. + \versionadded{2.2.2} \end{methoddesc} From goodger@users.sourceforge.net Sun Nov 17 00:09:22 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat, 16 Nov 2002 16:09:22 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/transforms peps.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/transforms In directory usw-pr-cvs1:/tmp/cvs-serv25859/transforms Modified Files: peps.py Log Message: updated from Docutils Index: peps.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/docutils/transforms/peps.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** peps.py 8 Nov 2002 23:47:53 -0000 1.1 --- peps.py 17 Nov 2002 00:09:20 -0000 1.2 *************** *** 171,174 **** --- 171,175 ---- refsect = nodes.section() refsect += nodes.title('', 'References') + doc.set_id(refsect) if copyright: # Put the new "References" section before "Copyright": From goodger@users.sourceforge.net Sun Nov 17 00:09:22 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat, 16 Nov 2002 16:09:22 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/parsers/rst/languages sk.py,NONE,1.1 __init__.py,1.1,1.2 sv.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/parsers/rst/languages In directory usw-pr-cvs1:/tmp/cvs-serv25859/parsers/rst/languages Modified Files: __init__.py sv.py Added Files: sk.py Log Message: updated from Docutils --- NEW FILE: sk.py --- # Author: Miroslav Vasko # Contact: zemiak@zoznam.sk # Revision: $Revision: 1.1 $ # Date: $Date: 2002/11/17 00:09:19 $ # Copyright: This module has been placed in the public domain. """ Slovak-language mappings for language-dependent features of reStructuredText. """ __docformat__ = 'reStructuredText' directives = { u'pozor': 'attention', u'opatrne': 'caution', u'nebezpe\xe8enstvo': 'danger', u'chyba': 'error', u'rada': 'hint', u'd\xf4le\x9eit\xe9': 'important', u'pozn\xe1mka': 'note', u'tip': 'tip', u'varovanie': 'warning', u't\xe9ma': 'topic', u'blok-riadkov': 'line-block', u'parsed-literal': 'parsed-literal', #u'questions': 'questions', #u'qa': 'questions', #u'faq': 'questions', u'meta': 'meta', #u'imagemap': 'imagemap', u'obr\xe1zok': 'image', u'tvar': 'figure', u'vlo\x9ei\x9d': 'include', u'raw': 'raw', u'nahradi\x9d': 'replace', u'obsah': 'contents', u'\xe8as\x9d': 'sectnum', u'\xe8as\x9d-\xe8\xedslovanie': 'sectnum', u'cie\xbeov\xe9-pozn\xe1mky': 'target-notes', #u'footnotes': 'footnotes', #u'citations': 'citations', } """Slovak name to registered (in directives/__init__.py) directive name mapping.""" Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/docutils/parsers/rst/languages/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 8 Nov 2002 23:47:52 -0000 1.1 --- __init__.py 17 Nov 2002 00:09:19 -0000 1.2 *************** *** 17,21 **** if _languages.has_key(language_code): return _languages[language_code] ! module = __import__(language_code, globals(), locals()) _languages[language_code] = module return module --- 17,24 ---- if _languages.has_key(language_code): return _languages[language_code] ! try: ! module = __import__(language_code, globals(), locals()) ! except ImportError: ! return None _languages[language_code] = module return module Index: sv.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/docutils/parsers/rst/languages/sv.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sv.py 8 Nov 2002 23:47:52 -0000 1.1 --- sv.py 17 Nov 2002 00:09:19 -0000 1.2 *************** *** 22,39 **** u'tips': 'tip', u'varning': 'warning', ! u'fr\u00e5gor': 'questions', # NOTE: A bit long, but recommended by http://www.nada.kth.se/dataterm/: ! u'fr\u00e5gor-och-svar': 'questions', ! u'vanliga-fr\u00e5gor': 'questions', u'meta': 'meta', # u'bildkarta': 'imagemap', # FIXME: Translation might be too literal. u'bild': 'image', u'figur': 'figure', ! # u'r\u00e5': 'raw', # FIXME: Translation might be too literal. u'inneh\u00e5ll': 'contents', # u'fotnoter': 'footnotes', # u'citeringar': 'citations', ! # u'\u00e4mne': 'topic', ! u'restructuredtext-test-directive': 'restructuredtext-test-directive' } """Swedish name to registered (in directives/__init__.py) directive name mapping.""" --- 22,38 ---- u'tips': 'tip', u'varning': 'warning', ! # u'fr\u00e5gor': 'questions', # NOTE: A bit long, but recommended by http://www.nada.kth.se/dataterm/: ! # u'fr\u00e5gor-och-svar': 'questions', ! # u'vanliga-fr\u00e5gor': 'questions', u'meta': 'meta', # u'bildkarta': 'imagemap', # FIXME: Translation might be too literal. u'bild': 'image', u'figur': 'figure', ! u'r\u00e5': 'raw', # FIXME: Translation might be too literal. u'inneh\u00e5ll': 'contents', # u'fotnoter': 'footnotes', # u'citeringar': 'citations', ! u'\u00e4mne': 'topic'} """Swedish name to registered (in directives/__init__.py) directive name mapping.""" From goodger@users.sourceforge.net Sun Nov 17 00:09:22 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat, 16 Nov 2002 16:09:22 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/writers html4css1.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/writers In directory usw-pr-cvs1:/tmp/cvs-serv25859/writers Modified Files: html4css1.py Log Message: updated from Docutils Index: html4css1.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/docutils/writers/html4css1.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** html4css1.py 8 Nov 2002 23:47:53 -0000 1.1 --- html4css1.py 17 Nov 2002 00:09:20 -0000 1.2 *************** *** 135,144 **** """ ! xml_declaration = '\n' doctype = ('\n') ! html_head = '\n\n' content_type = ('\n') --- 135,145 ---- """ ! xml_declaration = '\n' doctype = ('\n') ! html_head = ('\n\n') content_type = ('\n') *************** *** 154,162 **** nodes.NodeVisitor.__init__(self, document) self.settings = settings = document.settings ! self.language = languages.get_language(settings.language_code) self.head_prefix = [ self.xml_declaration % settings.output_encoding, self.doctype, ! self.html_head % settings.language_code, self.content_type % settings.output_encoding, self.generator % docutils.__version__] --- 155,164 ---- nodes.NodeVisitor.__init__(self, document) self.settings = settings = document.settings ! lcode = settings.language_code ! self.language = languages.get_language(lcode) self.head_prefix = [ self.xml_declaration % settings.output_encoding, self.doctype, ! self.html_head % (lcode, lcode), self.content_type % settings.output_encoding, self.generator % docutils.__version__] *************** *** 168,172 **** else: stylesheet = self.get_stylesheet_reference() ! self.stylesheet = [self.stylesheet_link % stylesheet] self.body_prefix = ['\n\n'] self.body_pre_docinfo = [] --- 170,177 ---- else: stylesheet = self.get_stylesheet_reference() ! if stylesheet: ! self.stylesheet = [self.stylesheet_link % stylesheet] ! else: ! self.stylesheet = [] self.body_prefix = ['\n\n'] self.body_pre_docinfo = [] From goodger@users.sourceforge.net Sun Nov 17 00:09:21 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat, 16 Nov 2002 16:09:21 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/parsers/rst/directives __init__.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/parsers/rst/directives In directory usw-pr-cvs1:/tmp/cvs-serv25859/parsers/rst/directives Modified Files: __init__.py Log Message: updated from Docutils Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/docutils/parsers/rst/directives/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 8 Nov 2002 23:47:52 -0000 1.1 --- __init__.py 17 Nov 2002 00:09:19 -0000 1.2 *************** *** 123,149 **** """ Locate and return a directive function from its language-dependent name. ! If not found in the current language, check English. """ normname = directive_name.lower() messages = [] if _directives.has_key(normname): return _directives[normname], messages try: canonicalname = language_module.directives[normname] ! except (KeyError, AttributeError): ! msg_text = ('No directive entry for "%s" in module "%s".' ! % (directive_name, language_module.__name__)) try: canonicalname = _fallback_language_module.directives[normname] ! msg_text += ('\nUsing English fallback for directive "%s".' ! % directive_name) except KeyError: ! msg_text += ('\nTrying "%s" as canonical directive name.' ! % directive_name) # The canonical name should be an English name, but just in case: canonicalname = normname ! warning = document.reporter.warning( ! msg_text, line=document.current_line) ! messages.append(warning) try: modulename, functionname = _directive_registry[canonicalname] --- 123,157 ---- """ Locate and return a directive function from its language-dependent name. ! If not found in the current language, check English. Return None if the ! named directive cannot be found. """ normname = directive_name.lower() messages = [] + msg_text = [] if _directives.has_key(normname): return _directives[normname], messages + canonicalname = None try: canonicalname = language_module.directives[normname] ! except AttributeError, error: ! msg_text.append('Problem retrieving directive entry from language ' ! 'module %r: %s.' % (language_module, error)) ! except KeyError: ! msg_text.append('No directive entry for "%s" in module "%s".' ! % (directive_name, language_module.__name__)) ! if not canonicalname: try: canonicalname = _fallback_language_module.directives[normname] ! msg_text.append('Using English fallback for directive "%s".' ! % directive_name) except KeyError: ! msg_text.append('Trying "%s" as canonical directive name.' ! % directive_name) # The canonical name should be an English name, but just in case: canonicalname = normname ! if msg_text: ! message = document.reporter.info( ! '\n'.join(msg_text), line=document.current_line) ! messages.append(message) try: modulename, functionname = _directive_registry[canonicalname] From goodger@users.sourceforge.net Sun Nov 17 00:09:21 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat, 16 Nov 2002 16:09:21 -0800 Subject: [Python-checkins] python/nondist/peps/docutils/parsers/rst states.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps/docutils/parsers/rst In directory usw-pr-cvs1:/tmp/cvs-serv25859/parsers/rst Modified Files: states.py Log Message: updated from Docutils Index: states.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/docutils/parsers/rst/states.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** states.py 8 Nov 2002 23:47:52 -0000 1.1 --- states.py 17 Nov 2002 00:09:19 -0000 1.2 *************** *** 535,541 **** # Alphanumerics with isolated internal [-._] chars (i.e. not 2 together): simplename = r'(?:(?!_)\w)+(?:[-._](?:(?!_)\w)+)*' uric = r"""[-_.!~*'()[\];/:@&=+$,%a-zA-Z0-9]""" ! urilast = r"""[_~/\]a-zA-Z0-9]""" # no punctuation emailc = r"""[-_!~*'{|}/#?^`&=+$%a-zA-Z0-9]""" parts = ('initial_inline', start_string_prefix, '', [('start', '', non_whitespace_after, # simple start-strings --- 535,549 ---- # Alphanumerics with isolated internal [-._] chars (i.e. not 2 together): simplename = r'(?:(?!_)\w)+(?:[-._](?:(?!_)\w)+)*' + # Valid URI characters (see RFC 2396 & RFC 2732): uric = r"""[-_.!~*'()[\];/:@&=+$,%a-zA-Z0-9]""" ! # Last URI character; same as uric but no punctuation: ! urilast = r"""[_~/a-zA-Z0-9]""" emailc = r"""[-_!~*'{|}/#?^`&=+$%a-zA-Z0-9]""" + email_pattern = r""" + %(emailc)s+(?:\.%(emailc)s+)* # name + @ # at + %(emailc)s+(?:\.%(emailc)s*)* # host + %(urilast)s # final URI char + """ parts = ('initial_inline', start_string_prefix, '', [('start', '', non_whitespace_after, # simple start-strings *************** *** 582,585 **** --- 590,605 ---- %(end_string_suffix)s """ % locals(), re.VERBOSE | re.UNICODE), + embedded_uri=re.compile( + r""" + ( + [ \n]+ # spaces or beginning of line + < # open bracket + %(non_whitespace_after)s + ([^<>\0]+) # anything but angle brackets & nulls + %(non_whitespace_before)s + > # close bracket w/o whitespace before + ) + $ # end of string + """ % locals(), re.VERBOSE), literal=re.compile(non_whitespace_before + '(``)' + end_string_suffix), *************** *** 589,594 **** + r'(\|_{0,2})' + end_string_suffix), uri=re.compile( ! r""" %(start_string_prefix)s (?P --- 609,615 ---- + r'(\|_{0,2})' + end_string_suffix), + email=re.compile(email_pattern % locals() + '$', re.VERBOSE), uri=re.compile( ! (r""" %(start_string_prefix)s (?P *************** *** 616,627 **** | # *OR* (?P # email address ! %(emailc)s+(\.%(emailc)s+)* # name ! @ # at ! %(emailc)s+(\.%(emailc)s*)* # host ! %(urilast)s # final URI char ) ) %(end_string_suffix)s ! """ % locals(), re.VERBOSE), pep=re.compile( r""" --- 637,645 ---- | # *OR* (?P # email address ! """ + email_pattern + r""" ) ) %(end_string_suffix)s ! """) % locals(), re.VERBOSE), pep=re.compile( r""" *************** *** 737,741 **** return string[:rolestart], [prb], string[textend:], [msg] return self.phrase_ref(string[:matchstart], string[textend:], ! rawsource, text) else: return self.interpreted(string[:rolestart], string[textend:], --- 755,759 ---- return string[:rolestart], [prb], string[textend:], [msg] return self.phrase_ref(string[:matchstart], string[textend:], ! rawsource, escaped, text) else: return self.interpreted(string[:rolestart], string[textend:], *************** *** 748,761 **** return string[:matchstart], [prb], string[matchend:], [msg] ! def phrase_ref(self, before, after, rawsource, text): refname = normalize_name(text) reference = nodes.reference(rawsource, text) if rawsource[-2:] == '__': ! reference['anonymous'] = 1 ! self.document.note_anonymous_ref(reference) else: ! reference['refname'] = refname ! self.document.note_refname(reference) ! return before, [reference], after, [] def interpreted(self, before, after, rawsource, text, role, position): --- 766,809 ---- return string[:matchstart], [prb], string[matchend:], [msg] ! def phrase_ref(self, before, after, rawsource, escaped, text): ! match = self.patterns.embedded_uri.search(escaped) ! if match: ! text = unescape(escaped[:match.start(0)]) ! uri_text = match.group(2) ! uri = ''.join(uri_text.split()) ! uri = self.adjust_uri(uri) ! if uri: ! target = nodes.target(match.group(1), refuri=uri) ! else: ! raise ApplicationError('problem with URI: %r' % uri_text) ! else: ! target = None refname = normalize_name(text) reference = nodes.reference(rawsource, text) + node_list = [reference] if rawsource[-2:] == '__': ! if target: ! reference['refuri'] = uri ! else: ! reference['anonymous'] = 1 ! self.document.note_anonymous_ref(reference) else: ! if target: ! reference['refuri'] = uri ! target['name'] = refname ! self.document.note_external_target(target) ! self.document.note_explicit_target(target, self.parent) ! node_list.append(target) ! else: ! reference['refname'] = refname ! self.document.note_refname(reference) ! return before, node_list, after, [] ! ! def adjust_uri(self, uri): ! match = self.patterns.email.match(uri) ! if match: ! return 'mailto:' + uri ! else: ! return uri def interpreted(self, before, after, rawsource, text, role, position): *************** *** 1640,1645 **** target['name'] = name if refuri: ! target['refuri'] = refuri ! self.document.note_external_target(target) else: self.document.note_internal_target(target) --- 1688,1697 ---- target['name'] = name if refuri: ! uri = self.inliner.adjust_uri(refuri) ! if uri: ! target['refuri'] = uri ! self.document.note_external_target(target) ! else: ! raise ApplicationError('problem with URI: %r' % refuri) else: self.document.note_internal_target(target) From montanaro@users.sourceforge.net Sun Nov 17 11:09:52 2002 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sun, 17 Nov 2002 03:09:52 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libbsddb.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv13255 Modified Files: libbsddb.tex Log Message: correct typo detected by Lee Hansen Index: libbsddb.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbsddb.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** libbsddb.tex 23 Apr 2002 02:11:03 -0000 1.7 --- libbsddb.tex 17 Nov 2002 11:09:50 -0000 1.8 *************** *** 130,134 **** \begin{methoddesc}{previous}{} ! Set the cursor to the first item in the DB file and return it. The order of keys in the file is unspecified, except in the case of B-Tree databases. This is not supported on hashtable databases (those opened --- 130,134 ---- \begin{methoddesc}{previous}{} ! Set the cursor to the previous item in the DB file and return it. The order of keys in the file is unspecified, except in the case of B-Tree databases. This is not supported on hashtable databases (those opened From rhettinger@users.sourceforge.net Sun Nov 17 17:39:53 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 17 Nov 2002 09:39:53 -0800 Subject: [Python-checkins] python/nondist/peps pep-0042.txt,1.63,1.64 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv11739 Modified Files: pep-0042.txt Log Message: Remove request to re-write cmath in Python. The goal had been to make it easier to improve the cmath algorithms, but no one had shown an interest. The new plan is to await implementation of a full blown complex type in C99. Index: pep-0042.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0042.txt,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** pep-0042.txt 13 Oct 2002 14:17:00 -0000 1.63 --- pep-0042.txt 17 Nov 2002 17:39:51 -0000 1.64 *************** *** 202,209 **** http://www.python.org/sf/210631 - - The cmath library should be rewritten in Python. - - http://www.python.org/sf/210838 - - every built-in function or method (including all core extensions) that accepts a string, dict, or list, should also --- 202,205 ---- From esr@users.sourceforge.net Sun Nov 17 17:53:15 2002 From: esr@users.sourceforge.net (esr@users.sourceforge.net) Date: Sun, 17 Nov 2002 09:53:15 -0800 Subject: [Python-checkins] python/dist/src/Lib nntplib.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv11255 Modified Files: nntplib.py Log Message: Guard against error if .netrc is missing. Index: nntplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/nntplib.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** nntplib.py 14 Nov 2002 02:19:44 -0000 1.32 --- nntplib.py 17 Nov 2002 17:53:12 -0000 1.33 *************** *** 136,146 **** # If no login/password was specified, try to get them from ~/.netrc # Presume that if .netc has an entry, NNRP authentication is required. ! if not user: ! import netrc ! credentials = netrc.netrc() ! auth = credentials.authenticators(host) ! if auth: ! user = auth[0] ! password = auth[2] # Perform NNRP authentication if needed. if user: --- 136,149 ---- # If no login/password was specified, try to get them from ~/.netrc # Presume that if .netc has an entry, NNRP authentication is required. ! try: ! if not user: ! import netrc ! credentials = netrc.netrc() ! auth = credentials.authenticators(host) ! if auth: ! user = auth[0] ! password = auth[2] ! except IOError: ! pass # Perform NNRP authentication if needed. if user: From nascheme@users.sourceforge.net Sun Nov 17 17:52:46 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sun, 17 Nov 2002 09:52:46 -0800 Subject: [Python-checkins] python/dist/src/Objects object.c,2.193,2.194 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv646/Objects Modified Files: object.c Log Message: Remove _Py_ResetReferences. Fixes bug #529750 "Circular reference makes Py_Init crash". refchain cannot be cleared because objects can live across Py_Finalize() and Py_Initialize() if they are kept alive by circular references. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.193 retrieving revision 2.194 diff -C2 -d -r2.193 -r2.194 *** object.c 11 Oct 2002 20:37:24 -0000 2.193 --- object.c 17 Nov 2002 17:52:44 -0000 2.194 *************** *** 1910,1920 **** void - _Py_ResetReferences(void) - { - refchain._ob_prev = refchain._ob_next = &refchain; - _Py_RefTotal = 0; - } - - void _Py_NewReference(PyObject *op) { --- 1910,1913 ---- From nascheme@users.sourceforge.net Sun Nov 17 17:52:46 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sun, 17 Nov 2002 09:52:46 -0800 Subject: [Python-checkins] python/dist/src/Include object.h,2.111,2.112 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv646/Include Modified Files: object.h Log Message: Remove _Py_ResetReferences. Fixes bug #529750 "Circular reference makes Py_Init crash". refchain cannot be cleared because objects can live across Py_Finalize() and Py_Initialize() if they are kept alive by circular references. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.111 retrieving revision 2.112 diff -C2 -d -r2.111 -r2.112 *** object.h 8 Aug 2002 20:55:20 -0000 2.111 --- object.h 17 Nov 2002 17:52:44 -0000 2.112 *************** *** 560,564 **** PyAPI_FUNC(void) _Py_Dealloc(PyObject *); PyAPI_FUNC(void) _Py_PrintReferences(FILE *); - PyAPI_FUNC(void) _Py_ResetReferences(void); #else --- 560,563 ---- From nascheme@users.sourceforge.net Sun Nov 17 17:52:46 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sun, 17 Nov 2002 09:52:46 -0800 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.168,2.169 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv646/Python Modified Files: pythonrun.c Log Message: Remove _Py_ResetReferences. Fixes bug #529750 "Circular reference makes Py_Init crash". refchain cannot be cleared because objects can live across Py_Finalize() and Py_Initialize() if they are kept alive by circular references. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.168 retrieving revision 2.169 diff -C2 -d -r2.168 -r2.169 *** pythonrun.c 17 Oct 2002 21:24:58 -0000 2.168 --- pythonrun.c 17 Nov 2002 17:52:44 -0000 2.169 *************** *** 278,285 **** call_ll_exitfuncs(); - - #ifdef Py_TRACE_REFS - _Py_ResetReferences(); - #endif /* Py_TRACE_REFS */ } --- 278,281 ---- From goodger@projects.sourceforge.net Mon Nov 18 02:02:45 2002 From: goodger@projects.sourceforge.net (goodger@projects.sourceforge.net) Date: Sun, 17 Nov 2002 18:02:45 -0800 Subject: [Python-checkins] python/nondist/peps pep-0301.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv6402/python/nondist/peps Modified Files: pep-0301.txt Log Message: Changes from Richard Jones: - changes to the success/failure indicators used by the register.py command. Originally I had copied the idea of using X-PyPI-* headers from PEP 243. Upon advice from Greg Stein, I have switched to using HTTP response codes. - clarifications to Roles - added PKG-INFO upload interface Index: pep-0301.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0301.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0301.txt 8 Nov 2002 22:22:55 -0000 1.2 --- pep-0301.txt 18 Nov 2002 02:02:43 -0000 1.3 *************** *** 100,104 **** **submit** ! Accepts a POST form submission of metadata about a package. The "name" and "version" fields are mandatory, as they uniquely identify an entry in the index. **Submit** will automatically determine --- 100,104 ---- **submit** ! Accepts a POST submission of metadata about a package. The "name" and "version" fields are mandatory, as they uniquely identify an entry in the index. **Submit** will automatically determine *************** *** 112,115 **** --- 112,119 ---- and updating for those who do not use Distutils. + **submit_pkg_info** + Accepts a POST submission of a PKG-INFO file and performs the same + function as the **submit** interface. + **user** Registers a new user with the index. Requires username, password and *************** *** 129,148 **** 3. User visits URL with the key and confirms registration. ! Several user Roles will exist: ! ! Admin ! Can assign Owner Role - they decide who may submit for a given ! package name. Owner Owns a package name, may assign Maintainer Role for that name. The ! first user to register information about a package is deemed owner of the package name. The Admin user may change this if necessary. Maintainer ! Can submit and update info for a particular package name ! Manual (through-the-web) user registration is also available through ! an HTML form. **roles** --- 133,150 ---- 3. User visits URL with the key and confirms registration. ! Several user Roles will exist, generally revolving around a ! particular package name: Owner Owns a package name, may assign Maintainer Role for that name. The ! first user to register information about a package is deemed Owner of the package name. The Admin user may change this if necessary. + May submit updates for the package name. Maintainer ! Can submit and update info for a particular package name. ! Admin ! Can assign Owner Role and edit user details. **roles** *************** *** 156,159 **** --- 158,174 ---- preferably over an HTTPS connection. + The server interface will indicate success or failure of the commands + through a subset of the standard HTTP response codes: + + ===== ============== ================================================ + Code Meaning Register command implications + ===== ============== ================================================ + 200 OK Everything worked just fine + 400 Bad request Data provided for submission was malformed + 401 Unauthorised The username or password supplied were incorrect + 403 Forbidden User does not have permission to update the + package information (not Owner or Maintainer) + ===== ============== ================================================ + Distutils *register* Command *************** *** 184,197 **** discriminators. - The index server will return custom headers (inspired by PEP 243) - which the *register* command will use to give feedback to the user: - - **X-Pypi-Status** - Either "success" or "fail". - - **X-Pypi-Reason** - A description of the reason for failure, or additional information - in the case of a success. - Distutils Trove Categorisation --- 199,202 ---- *************** *** 281,284 **** --- 286,305 ---- + Rejected Proposals + ================== + + Originally, the index server was to return custom headers (inspired by + PEP 243): + + **X-Pypi-Status** + Either "success" or "fail". + + **X-Pypi-Reason** + A description of the reason for failure, or additional information + in the case of a success. + + However, it has been pointed out [8]_ that this is a bad scheme to use. + + References ========== *************** *** 305,308 **** --- 326,332 ---- (http://www.python.org/peps/pep-0262.html) + .. [8] [PEP243] upload status is bogus + (http://mail.python.org/pipermail/distutils-sig/2001-March/002262.html) + Copyright *************** *** 320,323 **** --- 344,350 ---- A.M. Kuchling for support including hosting the second prototype. + Greg Stein for recommending that the register command interpret the + HTTP response codes rather than custom X-PyPI-* headers. + The many participants of the Distutils and Catalog SIGs for their ideas over the years. *************** *** 331,332 **** --- 358,360 ---- fill-column: 70 End: + From rhettinger@projects.sourceforge.net Mon Nov 18 04:34:12 2002 From: rhettinger@projects.sourceforge.net (rhettinger@projects.sourceforge.net) Date: Sun, 17 Nov 2002 20:34:12 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_userdict.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv23016/Lib/test Modified Files: test_userdict.py Log Message: Improve DictMixin. Replaced docstring with comments. Prevents subclass contamination. Added the missing __cmp__() method and a test for __cmp__(). Used try/except style in preference to has_key() followed by a look-up. Used iteritem() where possible to save creating a long key list and to save redundant lookups. Expanded .update() to look for the most helpful methods first and gradually work down to a mininum expected interface. Expanded documentation to be more clear on how to use the class. Index: test_userdict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userdict.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_userdict.py 15 Nov 2002 08:39:40 -0000 1.7 --- test_userdict.py 18 Nov 2002 04:34:10 -0000 1.8 *************** *** 211,218 **** verify(s[10]=='ten' and s[20]=='twenty') ! ! ! ! ! ! --- 211,217 ---- verify(s[10]=='ten' and s[20]=='twenty') ! verify(s == {10: 'ten', 20:'twenty'}) # cmp ! t = SeqDict() ! t[20] = 'twenty' ! t[10] = 'ten' ! verify(s == t) From rhettinger@projects.sourceforge.net Mon Nov 18 04:34:12 2002 From: rhettinger@projects.sourceforge.net (rhettinger@projects.sourceforge.net) Date: Sun, 17 Nov 2002 20:34:12 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libuserdict.tex,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv23016/Doc/lib Modified Files: libuserdict.tex Log Message: Improve DictMixin. Replaced docstring with comments. Prevents subclass contamination. Added the missing __cmp__() method and a test for __cmp__(). Used try/except style in preference to has_key() followed by a look-up. Used iteritem() where possible to save creating a long key list and to save redundant lookups. Expanded .update() to look for the most helpful methods first and gradually work down to a mininum expected interface. Expanded documentation to be more clear on how to use the class. Index: libuserdict.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libuserdict.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** libuserdict.tex 15 Nov 2002 06:46:13 -0000 1.22 --- libuserdict.tex 18 Nov 2002 04:34:10 -0000 1.23 *************** *** 44,60 **** \begin{classdesc}{DictMixin}{} Mixin defining all dictionary methods for classes that already have ! a minimum dictionary interface including\method{__getitem__}, ! \method{__setitem__}, \method{__delitem__}, and \method{keys}. This mixin should be used as a superclass. Adding each of the above methods adds progressively more functionality. For instance, ! the absence of \method{__delitem__} precludes only \method{pop} ! and \method{popitem}. ! While the four methods listed above are sufficient to support the ! entire dictionary interface, progessively more efficiency comes ! with defining \method{__contains__}, \method{__iter__}, and ! \method{iteritems}. \end{classdesc} --- 44,61 ---- \begin{classdesc}{DictMixin}{} Mixin defining all dictionary methods for classes that already have ! a minimum dictionary interface including \method{__getitem__()}, ! \method{__setitem__()}, \method{__delitem__()}, and \method{keys()}. This mixin should be used as a superclass. Adding each of the above methods adds progressively more functionality. For instance, ! defining all but \method{__delitem__} will preclude only \method{pop} ! and \method{popitem} from the full interface. ! In addition to the four base methods, progessively more efficiency ! comes with defining \method{__contains__()}, \method{__iter__()}, and ! \method{iteritems()}. + Since the mixin has no knowledge of the subclass constructor, it + does not define \method{__init__()} or \method{copy()}. \end{classdesc} From rhettinger@projects.sourceforge.net Mon Nov 18 04:34:12 2002 From: rhettinger@projects.sourceforge.net (rhettinger@projects.sourceforge.net) Date: Sun, 17 Nov 2002 20:34:12 -0800 Subject: [Python-checkins] python/dist/src/Lib UserDict.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv23016/Lib Modified Files: UserDict.py Log Message: Improve DictMixin. Replaced docstring with comments. Prevents subclass contamination. Added the missing __cmp__() method and a test for __cmp__(). Used try/except style in preference to has_key() followed by a look-up. Used iteritem() where possible to save creating a long key list and to save redundant lookups. Expanded .update() to look for the most helpful methods first and gradually work down to a mininum expected interface. Expanded documentation to be more clear on how to use the class. Index: UserDict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserDict.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** UserDict.py 15 Nov 2002 06:46:13 -0000 1.18 --- UserDict.py 18 Nov 2002 04:34:10 -0000 1.19 *************** *** 63,73 **** class DictMixin: ! '''Mixin defining all dictionary methods for classes that already have ! a minimum dictionary interface including getitem, setitem, delitem, ! and keys ''' ! ! # first level provided by subclass: getitem, setitem, delitem, and keys ! # second level definitions which assume only getitem and keys def has_key(self, key): try: --- 63,77 ---- class DictMixin: ! # Mixin defining all dictionary methods for classes that already have ! # a minimum dictionary interface including getitem, setitem, delitem, ! # and keys. Without knowledge of the subclass constructor, the mixin ! # does not define __init__() or copy(). In addition to the four base ! # methods, progessively more efficiency comes with defining ! # __contains__(), __iter__(), and iteritems(). ! # second level definitions support higher levels ! def __iter__(self): ! for k in self.keys(): ! yield k def has_key(self, key): try: *************** *** 77,87 **** return True __contains__ = has_key - def __iter__(self): - for k in self.keys(): - yield k - def __len__(self): - return len(self.keys()) ! # third level uses second level instead of first def iteritems(self): for k in self: --- 81,86 ---- return True __contains__ = has_key ! # third level takes advantage of second level definitions def iteritems(self): for k in self: *************** *** 89,98 **** iterkeys = __iter__ ! # fourth level uses second and third levels instead of first def itervalues(self): for _, v in self.iteritems(): yield v def values(self): ! return [self[key] for key in self.keys()] def items(self): return list(self.iteritems()) --- 88,97 ---- iterkeys = __iter__ ! # fourth level uses definitions from lower levels def itervalues(self): for _, v in self.iteritems(): yield v def values(self): ! return [v for _, v in self.iteritems()] def items(self): return list(self.iteritems()) *************** *** 101,108 **** del self[key] def setdefault(self, key, default): ! if key not in self: self[key] = default ! return default ! return self[key] def pop(self, key): value = self[key] --- 100,108 ---- del self[key] def setdefault(self, key, default): ! try: ! return self[key] ! except KeyError: self[key] = default ! return default def pop(self, key): value = self[key] *************** *** 113,126 **** k, v = self.iteritems().next() except StopIteration: ! raise KeyError, 'dictionary is empty' del self[k] return (k, v) def update(self, other): ! for key in other.keys(): ! self[key] = other[key] def get(self, key, default=None): ! if key in self: return self[key] ! return default def __repr__(self): ! return repr(dict(self.items())) --- 113,141 ---- k, v = self.iteritems().next() except StopIteration: ! raise KeyError, 'container is empty' del self[k] return (k, v) def update(self, other): ! # Make progressively weaker assumptions about "other" ! if hasattr(other, 'iteritems'): # iteritems saves memory and lookups ! for k, v in other.iteritems(): ! self[k] = v ! elif hasattr(other, '__iter__'): # iter saves memory ! for k in other: ! self[k] = other[k] ! else: ! for k in other.keys(): ! self[k] = other[k] def get(self, key, default=None): ! try: return self[key] ! except KeyError: ! return default def __repr__(self): ! return repr(dict(self.iteritems())) ! def __cmp__(self, other): ! if isinstance(other, DictMixin): ! other = dict(other.iteritems()) ! return cmp(dict(self.iteritems()), other) ! def __len__(self): ! return len(self.keys()) From rhettinger@projects.sourceforge.net Mon Nov 18 09:01:30 2002 From: rhettinger@projects.sourceforge.net (rhettinger@projects.sourceforge.net) Date: Mon, 18 Nov 2002 01:01:30 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib librandom.tex,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv29985/Doc/lib Modified Files: librandom.tex Log Message: Improve comments. Clarify docs. Replace "type(0)" with "int". Replace "while 1" with "while True" Index: librandom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librandom.tex,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** librandom.tex 12 Nov 2002 17:41:57 -0000 1.31 --- librandom.tex 18 Nov 2002 09:01:24 -0000 1.32 *************** *** 183,200 **** Return a \var{k} length list of unique elements chosen from the population sequence. Used for random sampling without replacement. ! Returns a new list containing elements from the population. The ! list itself is in random order so that all sub-slices are also ! random samples. The original sequence is left undisturbed. ! ! If the population has repeated elements, then each occurence is a ! possible selection in the sample. ! If indices are needed for a large population, use \function{xrange} ! as an argument: \code{sample(xrange(10000000), 60)}. ! Optional argument random is a 0-argument function returning a random ! float in [0.0, 1.0); by default, the standard random.random. ! \versionadded{2.3} \end{funcdesc} --- 183,201 ---- Return a \var{k} length list of unique elements chosen from the population sequence. Used for random sampling without replacement. + \versionadded{2.3} ! Returns a new list containing elements from the population while ! leaving the original population unchanged. The resulting list is ! in selection order so that all sub-slices will also be valid random ! samples. This allows raffle winners (the sample) to be partitioned ! into grand prize and second place winners (the subslices). ! Members of the population need not be hashable or unique. If the ! population contains repeats, then each occurrence is a possible ! selection in the sample. ! To choose a sample from a range of integers, use \function{xrange} ! as an argument. This is especially fast and space efficient for ! sampling from a large population: \code{sample(xrange(10000000), 60)}. \end{funcdesc} From rhettinger@projects.sourceforge.net Mon Nov 18 09:01:28 2002 From: rhettinger@projects.sourceforge.net (rhettinger@projects.sourceforge.net) Date: Mon, 18 Nov 2002 01:01:28 -0800 Subject: [Python-checkins] python/dist/src/Lib random.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv29985/Lib Modified Files: random.py Log Message: Improve comments. Clarify docs. Replace "type(0)" with "int". Replace "while 1" with "while True" Index: random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** random.py 13 Nov 2002 15:26:37 -0000 1.38 --- random.py 18 Nov 2002 09:01:21 -0000 1.39 *************** *** 240,244 **** """ ! if not type(x) == type(y) == type(z) == type(0): raise TypeError('seeds must be integers') if not (0 <= x < 256 and 0 <= y < 256 and 0 <= z < 256): --- 240,244 ---- """ ! if not type(x) == type(y) == type(z) == int: raise TypeError('seeds must be integers') if not (0 <= x < 256 and 0 <= y < 256 and 0 <= z < 256): *************** *** 408,413 **** # __contains__ for detecting repeat selections. Discarding repeats # is efficient unless most of the population has already been chosen. ! # So, tracking selections is useful when sample sizes are much ! # smaller than the total population. n = len(population) --- 408,412 ---- # __contains__ for detecting repeat selections. Discarding repeats # is efficient unless most of the population has already been chosen. ! # So, tracking selections is fast only with small sample sizes. n = len(population) *************** *** 418,434 **** result = [None] * k if n < 6 * k: # if n len list takes less space than a k len dict ! pool = list(population) # track potential selections ! for i in xrange(k): ! j = int(random() * (n-i)) # non-selected at [0,n-i) ! result[i] = pool[j] # save selected element ! pool[j] = pool[n-i-1] # non-selected to head of list else: ! selected = {} # track previous selections for i in xrange(k): j = int(random() * n) ! while j in selected: # discard and replace repeats j = int(random() * n) result[i] = selected[j] = population[j] ! return result # return selections in the order they were picked ## -------------------- real-valued distributions ------------------- --- 417,433 ---- result = [None] * k if n < 6 * k: # if n len list takes less space than a k len dict ! pool = list(population) ! for i in xrange(k): # invariant: non-selected at [0,n-i) ! j = int(random() * (n-i)) ! result[i] = pool[j] ! pool[j] = pool[n-i-1] else: ! selected = {} for i in xrange(k): j = int(random() * n) ! while j in selected: j = int(random() * n) result[i] = selected[j] = population[j] ! return result ## -------------------- real-valued distributions ------------------- *************** *** 456,460 **** random = self.random ! while 1: u1 = random() u2 = random() --- 455,459 ---- random = self.random ! while True: u1 = random() u2 = random() *************** *** 549,553 **** r = (1.0 + b * b)/(2.0 * b) ! while 1: u1 = random() --- 548,552 ---- r = (1.0 + b * b)/(2.0 * b) ! while True: u1 = random() *************** *** 596,600 **** ccc = alpha + ainv ! while 1: u1 = random() u2 = random() --- 595,599 ---- ccc = alpha + ainv ! while True: u1 = random() u2 = random() *************** *** 617,621 **** # Uses ALGORITHM GS of Statistical Computing - Kennedy & Gentle ! while 1: u = random() b = (_e + alpha)/_e --- 616,620 ---- # Uses ALGORITHM GS of Statistical Computing - Kennedy & Gentle ! while True: u = random() b = (_e + alpha)/_e From rhettinger@projects.sourceforge.net Mon Nov 18 10:40:46 2002 From: rhettinger@projects.sourceforge.net (rhettinger@projects.sourceforge.net) Date: Mon, 18 Nov 2002 02:40:46 -0800 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.219,1.220 pep-0288.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv31218 Modified Files: pep-0000.txt pep-0288.txt Log Message: Revise and undefer PEP 288: Generator Attributes and Exceptions Eliminated the original idea of passing arguments through gen.next(). Eliminated the alternative idea of using gen.submit(data). Replaced with a developed version of generator attributes. Left the discussion of exceptions essentially unchanged. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.219 retrieving revision 1.220 diff -C2 -d -r1.219 -r1.220 *** pep-0000.txt 8 Nov 2002 03:02:26 -0000 1.219 --- pep-0000.txt 18 Nov 2002 10:40:44 -0000 1.220 *************** *** 95,98 **** --- 95,99 ---- S 286 Enhanced Argument Tuples von Loewis I 287 reStructuredText Docstring Format Goodger + S 288 Generators Attributes and Exceptions Hettinger I 291 Backward Compatibility for Standard Library Norwitz S 292 Simpler String Substitutions Warsaw *************** *** 164,168 **** SR 270 uniq method for list objects Petrone SR 271 Prefixing sys.path by command line option Giacometti - SD 288 Generators Attributes and Exceptions Hettinger SR 289 Generator Comprehensions Hettinger SR 295 Interpretation of multiline string constants Koltsov --- 165,168 ---- *************** *** 282,286 **** S 286 Enhanced Argument Tuples von Loewis I 287 reStructuredText Docstring Format Goodger ! SD 288 Generators Attributes and Exceptions Hettinger SR 289 Generator Comprehensions Hettinger I 290 Code Migration and Modernization Hettinger --- 282,286 ---- S 286 Enhanced Argument Tuples von Loewis I 287 reStructuredText Docstring Format Goodger ! S 288 Generators Attributes and Exceptions Hettinger SR 289 Generator Comprehensions Hettinger I 290 Code Migration and Modernization Hettinger Index: pep-0288.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0288.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0288.txt 5 Apr 2002 19:42:56 -0000 1.2 --- pep-0288.txt 18 Nov 2002 10:40:44 -0000 1.3 *************** *** 4,8 **** Last-Modified: $Date$ Author: python@rcn.com (Raymond D. Hettinger) ! Status: Deferred Type: Standards Track Created: 21-Mar-2002 --- 4,8 ---- Last-Modified: $Date$ Author: python@rcn.com (Raymond D. Hettinger) ! Status: Draft Type: Standards Track Created: 21-Mar-2002 *************** *** 22,26 **** generator tools in PEP 279 [7]. They were split-off to this separate PEP to allow the ideas more time to mature and for ! alternatives to be considered. --- 22,27 ---- generator tools in PEP 279 [7]. They were split-off to this separate PEP to allow the ideas more time to mature and for ! alternatives to be considered. Subsequently, the argument ! passing idea gave way to Detlef Lannert's idea of using attributes. *************** *** 36,48 **** Generators, as proposed in PEP 255 [1], were introduced as a means for making it easier to create iterators, especially ones with complex ! internal execution or variable states. ! ! The next step in the evolution of generators is to extend the ! syntax of the 'yield' keyword to enable generator parameter ! passing. The resulting increase in power simplifies the creation ! of consumer streams which have a complex execution state and/or ! variable state. ! A better alternative being considered is to allow generators to accept attribute assignments. This allows data to be passed in a standard Python fashion. --- 37,43 ---- Generators, as proposed in PEP 255 [1], were introduced as a means for making it easier to create iterators, especially ones with complex ! internal states. ! The next step in the evolution of generators is to allow generators to accept attribute assignments. This allows data to be passed in a standard Python fashion. *************** *** 53,57 **** Also, generator exception passing helps mitigate the try/finally prohibition for generators. ! These suggestions are designed to take advantage of the existing implementation and require little additional effort to --- 48,52 ---- Also, generator exception passing helps mitigate the try/finally prohibition for generators. ! These suggestions are designed to take advantage of the existing implementation and require little additional effort to *************** *** 60,118 **** ! Reference Implementation ! ! There is not currently a CPython implementation; however, a ! simulation module written in pure Python is available on ! SourceForge [5]. The simulation is meant to allow direct ! experimentation with the proposal. ! ! There is also a module [6] with working source code for all of the ! examples used in this PEP. It serves as a test suite for the ! simulator and it documents how each of the feature works in ! practice. ! ! The authors and implementers of PEP 255 [1] were contacted to ! provide their assessment of whether the enhancement was going to ! be straight-forward to implement and require only minor ! modification of the existing generator code. Neil felt the ! assertion was correct. Ka-Ping thought so also. GvR said he ! could believe that it was true. Tim did not have an opportunity ! to give an assessment. ! ! Specification for Generator Parameter Passing ! 1. Allow 'yield' to assign a value as in: def mygen(): ! while 1: ! x = yield None ! print x ! ! 2. Let the .next() method take a value to pass to the generator as in: g = mygen() ! g.next() # runs the generator until the first 'yield' ! g.next(1) # '1' is bound to 'x' in mygen(), then printed ! g.next(2) # '2' is bound to 'x' in mygen(), then printed The control flow of 'yield' and 'next' is unchanged by this ! proposal. The only change is that a value can be sent into the generator. By analogy, consider the quality improvement from GOSUB (which had no argument passing mechanism) to modern procedure calls (which can pass in arguments and return values). - Most of the underlying machinery is already in place, only the ! communication needs to be added by modifying the parse syntax to ! accept the new 'x = yield expr' syntax and by allowing the .next() ! method to accept an optional argument. Yield is more than just a simple iterator creator. It does something else truly wonderful -- it suspends execution and saves state. It is good for a lot more than writing iterators. This ! proposal further expands its capability by making it easier to share data with the generator. ! The .next(arg) mechanism is especially useful for: 1. Sending data to any generator 2. Writing lazy consumers with complex execution states --- 55,92 ---- ! Specification for Generator Attributes ! Essentially, the proposal is to emulate attribute writing for classes. ! The only wrinkle is that generators lack a way to refer to instances of ! themselves. So, generators need an automatic instance variable, __self__. ! Here is a minimal example: def mygen(): ! while True: ! print __self__.data ! yield None g = mygen() ! g.data = 1 ! g.next() # prints 1 ! g.data = 2 ! g.next() # prints 2 The control flow of 'yield' and 'next' is unchanged by this ! proposal. The only change is that data can be sent into the generator. By analogy, consider the quality improvement from GOSUB (which had no argument passing mechanism) to modern procedure calls (which can pass in arguments and return values). Most of the underlying machinery is already in place, only the ! __self__ variable needs to be added. Yield is more than just a simple iterator creator. It does something else truly wonderful -- it suspends execution and saves state. It is good for a lot more than writing iterators. This ! proposal further taps its capabilities by making it easier to share data with the generator. ! The attribute mechanism is especially useful for: 1. Sending data to any generator 2. Writing lazy consumers with complex execution states *************** *** 125,139 **** queues. A class-based approach competes well when there are no complex execution states or variable states. However, when the ! complexity increases, generators with parameter passing are much simpler because they automatically save state (unlike classes which must explicitly save the variable and execution state in instance variables). - Note A: This proposal changes 'yield' from a statement to an - expression with binding and precedence similar to lambda. - Examples ! Example of a Complex Consumer --- 99,110 ---- queues. A class-based approach competes well when there are no complex execution states or variable states. However, when the ! complexity increases, generators with writable attributes are much simpler because they automatically save state (unlike classes which must explicitly save the variable and execution state in instance variables). Examples ! Example of a Complex Consumer *************** *** 148,165 **** def filelike(packagename, appendOrOverwrite): ! cum = [] if appendOrOverwrite == 'w+': ! cum.extend(packages[packagename]) try: ! while 1: ! dat = yield None ! cum.append(dat) except FlushStream: ! packages[packagename] = cum ! ostream = filelike('mydest','w') # Analogous to file.open(name,flag) ! ostream.next() # Advance to the first yield ! ostream.next(firstdat) # Analogous to file.write(dat) ! ostream.next(seconddat) ostream.throw(FlushStream) # Throw is proposed below --- 119,135 ---- def filelike(packagename, appendOrOverwrite): ! data = [] if appendOrOverwrite == 'w+': ! data.extend(packages[packagename]) try: ! while True: ! data.append(__self__.dat) ! yield None except FlushStream: ! packages[packagename] = data ! ostream = filelike('mydest','w') ! ostream.dat = firstdat; ostream.next() ! ostream.dat = firstdat; ostream.next() ostream.throw(FlushStream) # Throw is proposed below *************** *** 182,283 **** 'Analogy to Linux style pipes: source | upper | sink' sink = sinkgen() - sink.next() for word in source(): ! sink.next(word.upper()) ! ! ! Comments ! ! Comments from GvR: We discussed this at length when we were hashing ! out generators and coroutines, and found that there's always a ! problem with this: the argument to the first next() call has ! to be thrown away, because it doesn't correspond to a yield ! statement. This looks ugly (note that the example code has a ! dummy call to next() to get the generator going). But there ! may be useful examples that can only be programmed (elegantly) ! with this feature, so I'm reserving judgment. I can believe ! that it's easy to implement. ! ! Comments from Ka-Ping Yee: I also think there is a lot of power to be ! gained from generator argument passing. - Comments from Neil Schemenauer: I like the idea of being able to pass - values back into a generator. I originally pitched this idea - to Guido but in the end we decided against it (at least for - the initial implementation). There was a few issues to work - out but I can't seem to remember what they were. My feeling - is that we need to wait until the Python community has more - experience with generators before adding this feature. Maybe - for 2.4 but not for 2.3. In the mean time you can work around - this limitation by making your generator a method. Values can - be passed back by mutating the instance. ! Comments for Magnus Lie Hetland: I like the generator parameter ! passing mechanism. Although I see no need to defer it, ! deferral seems to be the most likely scenario, and in the ! meantime I guess the functionality can be emulated either by ! implementing the generator as a method, or by passing a ! parameter with the exception passing mechanism. ! ! Author response: Okay, consider this proposal deferred until version 2.4 ! so the idea can fully mature. I am currently teasing out two ! alternatives which may eliminate the issue with the initial ! next() call not having a corresponding yield. ! Alternative 1: Submit ! ! Instead of next(arg), use a separate method, submit(arg). ! Submit would behave just like next() except that on the first ! call, it will call next() twice. The word 'submit' has the ! further advantage of being explicit in its intent. It also ! allows checking for the proper number of arguments (next ! always has zero and submit always has one). Using this ! alternative, the call to the consumer stream looks like this: ! ostream = filelike('mydest','w') ! ostream.submit(firstdat) # No call to next is needed ! ostream.submit(seconddat) ! ostream.throw(FlushStream) # Throw is proposed below ! Alternative 2: Generator Attributes ! ! Instead of generator parameter passing, enable writable ! generator attributes: g.data=firstdat; g.next(). The code on ! the receiving end is written knowing that the attribute is set ! from the very beginning. This solves the problem because the ! first next call does not need to be associated with a yield ! statement. ! This solution uses a standard Python tool, object attributes, ! in a standard way. It is also explicit in its intention and ! provides some error checking (the receiving code raises an ! AttributeError if the expected field has not be set before the ! call). ! ! The one unclean part of this approach is that the generator ! needs some way to reference itself (something parallel to the ! use of the function name in a recursive function or to the use ! of 'self' in a method). The only way I can think of is to ! introduce a new system variable, __self__, in any function ! that employs a yield statement. Using this alternative, the ! code for the consumer stream looks like this: ! def filelike(packagename, appendOrOverwrite): ! cum = [] ! if appendOrOverwrite == 'w+': ! cum.extend(packages[packagename]) ! try: ! while 1: ! cum.append(__self__.dat) ! yield None ! except FlushStream: ! packages[packagename] = cum ! ostream = filelike('mydest','w') ! ostream.dat = firstdat; ostream.next() ! ostream.dat = firstdat; ostream.next() ! ostream.throw(FlushStream) # Throw is proposed in PEP 279 --- 152,190 ---- 'Analogy to Linux style pipes: source | upper | sink' sink = sinkgen() for word in source(): ! sink.data = word.upper() ! sink.next() ! Initialization Mechanism + If the attribute passing idea is accepted, Detlef Lannert further + proposed that generator instances have attributes initialized to + values in the generator's func_dict. This makes it easy to set + default values. For example: ! def mygen(): ! while True: ! print __self__.data ! yield None ! mygen.data = 0 ! g = mygen() # g initialized with .data set to 0 ! g.next() # prints 0 ! g.data = 1 ! g.next() # prints 1 ! Rejected Alternative ! One idea for passing data into a generator was to pass an argument ! through next() and make a assignment using the yield keyword: ! datain = yield dataout ! . . . ! dataout = gen.next(datain) ! The intractable problem is that the argument to the first next() call ! has to be thrown away, because it doesn't correspond to a yield keyword. *************** *** 290,294 **** log = [] try: ! while 1: log.append( time.time() - start ) yield log[-1] --- 197,201 ---- log = [] try: ! while True: log.append( time.time() - start ) yield log[-1] *************** *** 303,308 **** There is no existing work-around for triggering an exception ! inside a generator. This is a true deficiency. It is the only ! case in Python where active code cannot be excepted to or through. Generator exception passing also helps address an intrinsic --- 210,215 ---- There is no existing work-around for triggering an exception ! inside a generator. It is the only case in Python where active ! code cannot be excepted to or through. Generator exception passing also helps address an intrinsic *************** *** 375,385 **** THEN the need to raise exceptions will come up frequently. - I'm no judge of what is truly Pythonic, but am still - astonished that there can exist blocks of code that can't be - excepted to or through, that the try/finally combination is - blocked, and that the only work-around is to rewrite as a - class and move the exception code out of the function or - method being excepted. - References --- 282,285 ---- *************** *** 398,411 **** http://www.pythonware.com/products/pil/ - [5] A pure Python simulation of every feature in this PEP is at: - http://sourceforge.net/tracker/download.php?group_id=5470&atid=305470&file_id=17348&aid=513752 - - [6] The full, working source code for each of the examples in this PEP - along with other examples and tests is at: - http://sourceforge.net/tracker/download.php?group_id=5470&atid=305470&file_id=17412&aid=513756 - - [7] PEP 279 Enhanced Generators - http://www.python.org/peps/pep-0279.html - Copyright --- 298,301 ---- *************** *** 414,418 **** ! Local Variables: mode: indented-text --- 304,308 ---- ! Local Variables: mode: indented-text From jackjansen@projects.sourceforge.net Mon Nov 18 13:48:21 2002 From: jackjansen@projects.sourceforge.net (jackjansen@projects.sourceforge.net) Date: Mon, 18 Nov 2002 05:48:21 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX setup.jaguar.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv10713/OSX Modified Files: setup.jaguar.py Log Message: Build waste, _Help and _Scrap too. Index: setup.jaguar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/setup.jaguar.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** setup.jaguar.py 15 Nov 2002 00:13:33 -0000 1.1 --- setup.jaguar.py 18 Nov 2002 13:48:18 -0000 1.2 *************** *** 1,9 **** from distutils.core import Extension, setup setup(name="MacPython for Jaguar extensions", version="2.2", ! ext_modules=[ ! Extension("OverrideFrom23._Res", ! ["../Modules/res/_Resmodule.c"], ! include_dirs=["../Include"], ! extra_link_args=['-framework', 'Carbon']), ! ]) \ No newline at end of file --- 1,81 ---- from distutils.core import Extension, setup + from distutils import sysconfig + import os + + SRCDIR="../.." + + def find_file(filename, std_dirs, paths): + """Searches for the directory where a given file is located, + and returns a possibly-empty list of additional directories, or None + if the file couldn't be found at all. + + 'filename' is the name of a file, such as readline.h or libcrypto.a. + 'std_dirs' is the list of standard system directories; if the + file is found in one of them, no additional directives are needed. + 'paths' is a list of additional locations to check; if the file is + found in one of them, the resulting list will contain the directory. + """ + + # Check the standard locations + for dir in std_dirs: + f = os.path.join(dir, filename) + if os.path.exists(f): return [] + + # Check the additional directories + for dir in paths: + f = os.path.join(dir, filename) + if os.path.exists(f): + return [dir] + + # Not found anywhere + return None + + def find_library_file(compiler, libname, std_dirs, paths): + filename = compiler.library_filename(libname, lib_type='shared') + result = find_file(filename, std_dirs, paths) + if result is not None: return result + + filename = compiler.library_filename(libname, lib_type='static') + result = find_file(filename, std_dirs, paths) + return result + + def waste_Extension(): + waste_incs = find_file("WASTE.h", [], + ['../'*n + 'waste/C_C++ Headers' for n in (0,1,2,3,4)]) + if waste_incs != None: + waste_libs = [os.path.join(os.path.split(waste_incs[0])[0], "Static Libraries")] + srcdir = SRCDIR + return [ Extension('waste', + [os.path.join(srcdir, d) for d in + 'Mac/Modules/waste/wastemodule.c', + 'Mac/Wastemods/WEObjectHandlers.c', + 'Mac/Wastemods/WETabHooks.c', + 'Mac/Wastemods/WETabs.c' + ], + include_dirs = waste_incs + [ + os.path.join(srcdir, 'Mac/Include'), + os.path.join(srcdir, 'Mac/Wastemods') + ], + library_dirs = waste_libs, + libraries = ['WASTE'], + extra_link_args = ['-framework', 'Carbon'], + ) ] + return [] setup(name="MacPython for Jaguar extensions", version="2.2", ! ext_modules=[ ! Extension("OverrideFrom23._Res", ! [SRCDIR + "/Mac/Modules/res/_Resmodule.c"], ! include_dirs=[SRCDIR+"/Mac/Include"], ! extra_link_args=['-framework', 'Carbon']), ! Extension('_Help', ! [SRCDIR + '/Mac/Modules/help/_Helpmodule.c'], ! include_dirs=[SRCDIR+"/Mac/Include"], ! extra_link_args=['-framework', 'Carbon']), ! Extension('_Scrap', ! [SRCDIR + '/Mac/Modules/scrap/_Scrapmodule.c'], ! include_dirs=[SRCDIR+"/Mac/Include"], ! extra_link_args=['-framework', 'Carbon']), ! ] + ! waste_Extension() ! ) \ No newline at end of file From jackjansen@projects.sourceforge.net Mon Nov 18 15:26:45 2002 From: jackjansen@projects.sourceforge.net (jackjansen@projects.sourceforge.net) Date: Mon, 18 Nov 2002 07:26:45 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/res _Resmodule.c,1.13,1.14 ressupport.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/res In directory sc8-pr-cvs1:/tmp/cvs-serv31879/res Modified Files: _Resmodule.c ressupport.py Log Message: Define PyDoc_STR if it isn't defined. This makes these modules compile for Python 2.2. Index: _Resmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/_Resmodule.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** _Resmodule.c 16 Aug 2002 09:09:30 -0000 1.13 --- _Resmodule.c 18 Nov 2002 15:26:41 -0000 1.14 *************** *** 21,24 **** --- 21,27 ---- + #ifndef PyDoc_STR + #define PyDoc_STR(x) (x) + #endif #ifdef WITHOUT_FRAMEWORKS #include Index: ressupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/ressupport.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ressupport.py 22 Mar 2002 14:16:38 -0000 1.21 --- ressupport.py 18 Nov 2002 15:26:42 -0000 1.22 *************** *** 26,29 **** --- 26,32 ---- includestuff = includestuff + """ + #ifndef PyDoc_STR + #define PyDoc_STR(x) (x) + #endif #ifdef WITHOUT_FRAMEWORKS #include From jackjansen@projects.sourceforge.net Mon Nov 18 15:26:45 2002 From: jackjansen@projects.sourceforge.net (jackjansen@projects.sourceforge.net) Date: Mon, 18 Nov 2002 07:26:45 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/scrap _Scrapmodule.c,1.3,1.4 scrapsupport.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/scrap In directory sc8-pr-cvs1:/tmp/cvs-serv31879/scrap Modified Files: _Scrapmodule.c scrapsupport.py Log Message: Define PyDoc_STR if it isn't defined. This makes these modules compile for Python 2.2. Index: _Scrapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/scrap/_Scrapmodule.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** _Scrapmodule.c 22 May 2002 14:31:48 -0000 1.3 --- _Scrapmodule.c 18 Nov 2002 15:26:42 -0000 1.4 *************** *** 6,9 **** --- 6,12 ---- + #ifndef PyDoc_STR + #define PyDoc_STR(x) (x) + #endif #ifdef _WIN32 #include "pywintoolbox.h" Index: scrapsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/scrap/scrapsupport.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** scrapsupport.py 31 Dec 2001 14:52:03 -0000 1.5 --- scrapsupport.py 18 Nov 2002 15:26:42 -0000 1.6 *************** *** 27,30 **** --- 27,33 ---- includestuff = includestuff + """ + #ifndef PyDoc_STR + #define PyDoc_STR(x) (x) + #endif #ifdef WITHOUT_FRAMEWORKS #include From jackjansen@projects.sourceforge.net Mon Nov 18 15:26:47 2002 From: jackjansen@projects.sourceforge.net (jackjansen@projects.sourceforge.net) Date: Mon, 18 Nov 2002 07:26:47 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/waste wastemodule.c,1.25,1.26 wastescan.py,1.11,1.12 wastesupport.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/waste In directory sc8-pr-cvs1:/tmp/cvs-serv31879/waste Modified Files: wastemodule.c wastescan.py wastesupport.py Log Message: Define PyDoc_STR if it isn't defined. This makes these modules compile for Python 2.2. Index: wastemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/waste/wastemodule.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** wastemodule.c 22 Aug 2002 23:29:45 -0000 1.25 --- wastemodule.c 18 Nov 2002 15:26:43 -0000 1.26 *************** *** 24,27 **** --- 24,30 ---- #include #include + #ifndef PyDoc_STR + #define PyDoc_STR(x) (x) + #endif /* Exported by Qdmodule.c: */ Index: wastescan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/waste/wastescan.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** wastescan.py 15 Aug 2002 21:48:16 -0000 1.11 --- wastescan.py 18 Nov 2002 15:26:43 -0000 1.12 *************** *** 7,11 **** from scantools import Scanner ! WASTEDIR='/Applications/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/MacOS Support/(Third Party Support)/Waste 2.0 Distribution/C_C++ Headers/' if not os.path.exists(WASTEDIR): --- 7,11 ---- from scantools import Scanner ! WASTEDIR='/Volumes/Moes/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/MacOS Support/(Third Party Support)/Waste 2.0 Distribution/C_C++ Headers/' if not os.path.exists(WASTEDIR): Index: wastesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/waste/wastesupport.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** wastesupport.py 5 Aug 2002 15:36:57 -0000 1.16 --- wastesupport.py 18 Nov 2002 15:26:43 -0000 1.17 *************** *** 64,67 **** --- 64,70 ---- #include #include + #ifndef PyDoc_STR + #define PyDoc_STR(x) (x) + #endif /* Exported by Qdmodule.c: */ From jackjansen@projects.sourceforge.net Mon Nov 18 15:27:14 2002 From: jackjansen@projects.sourceforge.net (jackjansen@projects.sourceforge.net) Date: Mon, 18 Nov 2002 07:27:14 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/help _Helpmodule.c,1.7,1.8 helpsupport.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/help In directory sc8-pr-cvs1:/tmp/cvs-serv31879/help Modified Files: _Helpmodule.c helpsupport.py Log Message: Define PyDoc_STR if it isn't defined. This makes these modules compile for Python 2.2. Index: _Helpmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/help/_Helpmodule.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** _Helpmodule.c 29 Aug 2002 21:09:00 -0000 1.7 --- _Helpmodule.c 18 Nov 2002 15:26:38 -0000 1.8 *************** *** 21,24 **** --- 21,27 ---- + #ifndef PyDoc_STR + #define PyDoc_STR(x) (x) + #endif #ifdef WITHOUT_FRAMEWORKS #include Index: helpsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/help/helpsupport.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** helpsupport.py 29 Aug 2002 21:09:00 -0000 1.6 --- helpsupport.py 18 Nov 2002 15:26:39 -0000 1.7 *************** *** 37,40 **** --- 37,43 ---- includestuff = includestuff + """ + #ifndef PyDoc_STR + #define PyDoc_STR(x) (x) + #endif #ifdef WITHOUT_FRAMEWORKS #include From jackjansen@projects.sourceforge.net Mon Nov 18 15:29:07 2002 From: jackjansen@projects.sourceforge.net (jackjansen@projects.sourceforge.net) Date: Mon, 18 Nov 2002 07:29:07 -0800 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PythonIDE.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv630 Modified Files: PythonIDE.py Log Message: Another workaround, to find the IDE directory when we're in MacPython-OSX on Jaguar. Ceteram censeam W era packagendam esse. Index: PythonIDE.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDE.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PythonIDE.py 31 Aug 2002 01:22:37 -0000 1.10 --- PythonIDE.py 18 Nov 2002 15:29:02 -0000 1.11 *************** *** 21,24 **** --- 21,27 ---- widgetrespathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE", "Widgets.rsrc"] widgetresfile = os.path.join(*widgetrespathsegs) + if not os.path.exists(widgetresfile): + widgetrespathsegs = [os.pardir, "Tools", "IDE", "Widgets.rsrc"] + widgetresfile = os.path.join(*widgetrespathsegs) refno = macresource.need('CURS', 468, widgetresfile) if os.environ.has_key('PYTHONIDEPATH'): *************** *** 29,32 **** --- 32,42 ---- idepathsegs = [sys.exec_prefix, "Mac", "Tools", "IDE"] ide_path = os.path.join(*idepathsegs) + if not os.path.exists(ide_path): + idepathsegs = [os.pardir, "Tools", "IDE"] + for p in sys.path: + ide_path = os.path.join(*([p]+idepathsegs)) + if os.path.exists(ide_path): + break + else: # We are a fully frozen application From nascheme@projects.sourceforge.net Mon Nov 18 16:02:42 2002 From: nascheme@projects.sourceforge.net (nascheme@projects.sourceforge.net) Date: Mon, 18 Nov 2002 08:02:42 -0800 Subject: [Python-checkins] python/dist/src/Modules selectmodule.c,2.71,2.72 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv18671/Modules Modified Files: selectmodule.c Log Message: Don't use PyNumber_Float() since it's is nearly useless. Instead, rely on PyFloat_AsDouble to generate a good error message. Index: selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.71 retrieving revision 2.72 diff -C2 -d -r2.71 -r2.72 *** selectmodule.c 12 Nov 2002 11:42:20 -0000 2.71 --- selectmodule.c 18 Nov 2002 16:02:29 -0000 2.72 *************** *** 215,223 **** } else { ! tout = PyNumber_Float(tout); ! if (!tout) return NULL; - timeout = PyFloat_AS_DOUBLE(tout); - Py_DECREF(tout); if (timeout > (double)LONG_MAX) { PyErr_SetString(PyExc_OverflowError, --- 215,221 ---- } else { ! timeout = PyFloat_AsDouble(tout); ! if (timeout == -1 && PyErr_Occurred()) return NULL; if (timeout > (double)LONG_MAX) { PyErr_SetString(PyExc_OverflowError, From nascheme@projects.sourceforge.net Mon Nov 18 16:04:59 2002 From: nascheme@projects.sourceforge.net (nascheme@projects.sourceforge.net) Date: Mon, 18 Nov 2002 08:04:59 -0800 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.106,2.107 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv20324/Objects Modified Files: abstract.c Log Message: str and unicode objects now have a __mod__ slot so don't special case them in PyNumber_Remainder(). This fixes SF bug #615506 and allows string and unicode subclasses to override __mod__. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.106 retrieving revision 2.107 diff -C2 -d -r2.106 -r2.107 *** abstract.c 5 Nov 2002 18:05:49 -0000 2.106 --- abstract.c 18 Nov 2002 16:04:52 -0000 2.107 *************** *** 640,649 **** PyNumber_Remainder(PyObject *v, PyObject *w) { - if (PyString_Check(v)) - return PyString_Format(v, w); - #ifdef Py_USING_UNICODE - else if (PyUnicode_Check(v)) - return PyUnicode_Format(v, w); - #endif return binary_op(v, w, NB_SLOT(nb_remainder), "%"); } --- 640,643 ---- From nascheme@projects.sourceforge.net Mon Nov 18 16:07:58 2002 From: nascheme@projects.sourceforge.net (nascheme@projects.sourceforge.net) Date: Mon, 18 Nov 2002 08:07:58 -0800 Subject: [Python-checkins] python/dist/src/Objects floatobject.c,2.115,2.116 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv21197/Objects Modified Files: floatobject.c Log Message: Improve exception message raised by PyFloat_AsDouble if the object does not have a nb_float slot. This matches what PyInt_AsLong does. Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.115 retrieving revision 2.116 diff -C2 -d -r2.115 -r2.116 *** floatobject.c 19 Aug 2002 19:26:42 -0000 2.115 --- floatobject.c 18 Nov 2002 16:06:21 -0000 2.116 *************** *** 203,209 **** return PyFloat_AS_DOUBLE((PyFloatObject*) op); ! if (op == NULL || (nb = op->ob_type->tp_as_number) == NULL || ! nb->nb_float == NULL) { PyErr_BadArgument(); return -1; } --- 203,213 ---- return PyFloat_AS_DOUBLE((PyFloatObject*) op); ! if (op == NULL) { PyErr_BadArgument(); + return -1; + } + + if ((nb = op->ob_type->tp_as_number) == NULL || nb->nb_float == NULL) { + PyErr_SetString(PyExc_TypeError, "a float is required"); return -1; } From nascheme@projects.sourceforge.net Mon Nov 18 16:09:50 2002 From: nascheme@projects.sourceforge.net (nascheme@projects.sourceforge.net) Date: Mon, 18 Nov 2002 08:09:50 -0800 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.196,2.197 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv22756/Objects Modified Files: stringobject.c Log Message: Add nb_remainder (i.e. __mod__) slot to str type. Fixes SF bug #615506. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.196 retrieving revision 2.197 diff -C2 -d -r2.196 -r2.197 *** stringobject.c 12 Nov 2002 23:01:11 -0000 2.196 --- stringobject.c 18 Nov 2002 16:09:38 -0000 2.197 *************** *** 3127,3133 **** --- 3127,3152 ---- } + static PyObject * + string_mod(PyObject *v, PyObject *w) + { + if (!PyString_Check(v)) { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + return PyString_Format(v, w); + } + PyDoc_STRVAR(basestring_doc, "Type basestring cannot be instantiated; it is the base for str and unicode."); + static PyNumberMethods string_as_number = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + 0, /*nb_divide*/ + string_mod, /*nb_remainder*/ + }; + + PyTypeObject PyBaseString_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 3191,3195 **** 0, /* tp_compare */ (reprfunc)string_repr, /* tp_repr */ ! 0, /* tp_as_number */ &string_as_sequence, /* tp_as_sequence */ &string_as_mapping, /* tp_as_mapping */ --- 3210,3214 ---- 0, /* tp_compare */ (reprfunc)string_repr, /* tp_repr */ ! &string_as_number, /* tp_as_number */ &string_as_sequence, /* tp_as_sequence */ &string_as_mapping, /* tp_as_mapping */ *************** *** 3200,3204 **** 0, /* tp_setattro */ &string_as_buffer, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ string_doc, /* tp_doc */ 0, /* tp_traverse */ --- 3219,3224 ---- 0, /* tp_setattro */ &string_as_buffer, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | ! Py_TPFLAGS_BASETYPE, /* tp_flags */ string_doc, /* tp_doc */ 0, /* tp_traverse */ From nascheme@projects.sourceforge.net Mon Nov 18 16:10:30 2002 From: nascheme@projects.sourceforge.net (nascheme@projects.sourceforge.net) Date: Mon, 18 Nov 2002 08:10:30 -0800 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.174,2.175 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv23207/Objects Modified Files: unicodeobject.c Log Message: Add nb_remainder (i.e. __mod__) slot to unicode type. Fixes SF bug #615506. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.174 retrieving revision 2.175 diff -C2 -d -r2.174 -r2.175 *** unicodeobject.c 12 Nov 2002 23:01:11 -0000 2.174 --- unicodeobject.c 18 Nov 2002 16:10:18 -0000 2.175 *************** *** 5800,5803 **** --- 5800,5821 ---- }; + static PyObject * + unicode_mod(PyObject *v, PyObject *w) + { + if (!PyUnicode_Check(v)) { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + return PyUnicode_Format(v, w); + } + + static PyNumberMethods unicode_as_number = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + 0, /*nb_divide*/ + unicode_mod, /*nb_remainder*/ + }; + static PySequenceMethods unicode_as_sequence = { (inquiry) unicode_length, /* sq_length */ *************** *** 6648,6652 **** (cmpfunc) unicode_compare, /* tp_compare */ (reprfunc) unicode_repr, /* tp_repr */ ! 0, /* tp_as_number */ &unicode_as_sequence, /* tp_as_sequence */ &unicode_as_mapping, /* tp_as_mapping */ --- 6666,6670 ---- (cmpfunc) unicode_compare, /* tp_compare */ (reprfunc) unicode_repr, /* tp_repr */ ! &unicode_as_number, /* tp_as_number */ &unicode_as_sequence, /* tp_as_sequence */ &unicode_as_mapping, /* tp_as_mapping */ *************** *** 6657,6661 **** 0, /* tp_setattro */ &unicode_as_buffer, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ unicode_doc, /* tp_doc */ 0, /* tp_traverse */ --- 6675,6680 ---- 0, /* tp_setattro */ &unicode_as_buffer, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | ! Py_TPFLAGS_BASETYPE, /* tp_flags */ unicode_doc, /* tp_doc */ 0, /* tp_traverse */ From nascheme@projects.sourceforge.net Mon Nov 18 16:11:49 2002 From: nascheme@projects.sourceforge.net (nascheme@projects.sourceforge.net) Date: Mon, 18 Nov 2002 08:11:49 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24120/Lib/test Modified Files: test_unicode.py Log Message: check for unicode.__mod__ Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** test_unicode.py 23 Oct 2002 09:02:46 -0000 1.72 --- test_unicode.py 18 Nov 2002 16:11:34 -0000 1.73 *************** *** 455,458 **** --- 455,459 ---- verify(u"%c" % (34,) == u'"') verify(u"%c" % (36,) == u'$') + verify(u"%d".__mod__(10) == u'10') if sys.platform[:4] != 'java': value = u"%r, %r" % (u"abc", "abc") From nascheme@projects.sourceforge.net Mon Nov 18 16:12:19 2002 From: nascheme@projects.sourceforge.net (nascheme@projects.sourceforge.net) Date: Mon, 18 Nov 2002 08:12:19 -0800 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24676/Lib/test Modified Files: string_tests.py Log Message: check for str.__mod__ Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** string_tests.py 23 Aug 2002 18:21:26 -0000 1.24 --- string_tests.py 18 Nov 2002 16:12:11 -0000 1.25 *************** *** 283,286 **** --- 283,289 ---- test('zfill', '34', '0034', 4) + test('__mod__', '+%s+', '+hello+', 'hello') + test('__mod__', '+%d+', '+10+', 10) + # Encoding/decoding codecs = [('rot13', 'uryyb jbeyq'), From nascheme@projects.sourceforge.net Mon Nov 18 16:12:58 2002 From: nascheme@projects.sourceforge.net (nascheme@projects.sourceforge.net) Date: Mon, 18 Nov 2002 08:12:58 -0800 Subject: [Python-checkins] python/dist/src/Lib UserString.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv25331/Lib Modified Files: UserString.py Log Message: Add __mod__ method to UserString. Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** UserString.py 9 Aug 2002 01:37:06 -0000 1.15 --- UserString.py 18 Nov 2002 16:12:54 -0000 1.16 *************** *** 56,59 **** --- 56,61 ---- return self.__class__(self.data*n) __rmul__ = __mul__ + def __mod__(self, args): + return self.__class__(self.data % args) # the following methods are defined in alphabetical order: From nascheme@projects.sourceforge.net Mon Nov 18 16:20:07 2002 From: nascheme@projects.sourceforge.net (nascheme@projects.sourceforge.net) Date: Mon, 18 Nov 2002 08:20:07 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.525,1.526 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv30078/Misc Modified Files: NEWS Log Message: Note that PyNumber_Check() returns true for string and unicode objects. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.525 retrieving revision 1.526 diff -C2 -d -r1.525 -r1.526 *** NEWS 15 Nov 2002 14:42:34 -0000 1.525 --- NEWS 18 Nov 2002 16:19:39 -0000 1.526 *************** *** 692,695 **** --- 692,699 ---- ----- + - PyNumber_Check() now returns true for string and unicode objects. + This is a result of these types having a partially defined + tp_as_number slot. + - The string object's layout has changed: the pointer member ob_sinterned has been replaced by an int member ob_sstate. On some From gvanrossum@projects.sourceforge.net Mon Nov 18 16:27:40 2002 From: gvanrossum@projects.sourceforge.net (gvanrossum@projects.sourceforge.net) Date: Mon, 18 Nov 2002 08:27:40 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.526,1.527 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv2066 Modified Files: NEWS Log Message: Comment on PyNumber_Check(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.526 retrieving revision 1.527 diff -C2 -d -r1.526 -r1.527 *** NEWS 18 Nov 2002 16:19:39 -0000 1.526 --- NEWS 18 Nov 2002 16:27:16 -0000 1.527 *************** *** 694,698 **** - PyNumber_Check() now returns true for string and unicode objects. This is a result of these types having a partially defined ! tp_as_number slot. - The string object's layout has changed: the pointer member --- 694,700 ---- - PyNumber_Check() now returns true for string and unicode objects. This is a result of these types having a partially defined ! tp_as_number slot. (This is not a feature, but an indication that ! PyNumber_check() is not very useful to determine numeric behavior. ! It may be deprecated.) - The string object's layout has changed: the pointer member From loewis@users.sourceforge.net Tue Nov 19 08:05:39 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 19 Nov 2002 00:05:39 -0800 Subject: [Python-checkins] python/dist/src/Lib/bsddb - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb In directory sc8-pr-cvs1:/tmp/cvs-serv23833/bsddb Log Message: Directory /cvsroot/python/python/dist/src/Lib/bsddb added to the repository From loewis@users.sourceforge.net Tue Nov 19 08:09:54 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 19 Nov 2002 00:09:54 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.115,1.116 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv24766 Modified Files: setup.py Log Message: Import PyBSDDB 3.4.0. Rename historical wrapper to bsddb185. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** setup.py 9 Nov 2002 19:53:04 -0000 1.115 --- setup.py 19 Nov 2002 08:09:50 -0000 1.116 *************** *** 438,443 **** # when sorted in reverse order, keys for this dict must appear in the ! # order you wish to search - e.g., search for db3 before db2, db2 ! # before db1 db_try_this = { 'db4': {'libs': ('db-4.3', 'db-4.2', 'db-4.1', 'db-4.0'), --- 438,442 ---- # when sorted in reverse order, keys for this dict must appear in the ! # order you wish to search - e.g., search for db4 before db3 db_try_this = { 'db4': {'libs': ('db-4.3', 'db-4.2', 'db-4.1', 'db-4.0'), *************** *** 461,465 **** '/usr/include/db4', ), ! 'incs': ('db_185.h',)}, 'db3': {'libs': ('db-3.3', 'db-3.2', 'db-3.1', 'db-3.0'), 'libdirs': ('/usr/local/BerkeleyDB.3.3/lib', --- 460,464 ---- '/usr/include/db4', ), ! 'incs': ('db.h',)}, 'db3': {'libs': ('db-3.3', 'db-3.2', 'db-3.1', 'db-3.0'), 'libdirs': ('/usr/local/BerkeleyDB.3.3/lib', *************** *** 482,514 **** '/usr/include/db3', ), ! 'incs': ('db_185.h',)}, ! 'db2': {'libs': ('db2',), ! 'libdirs': ('/usr/local/lib', ! '/sw/lib', ! '/usr/lib', ! '/lib'), ! 'incdirs': ('/usr/local/include/db2', ! '/sw/include/db2', ! '/usr/include/db2'), ! 'incs': ('db_185.h',)}, ! # if you are willing to risk hash db file corruption you can ! # uncomment the lines below for db1. Note that this will affect ! # not only the bsddb module, but the dbhash and anydbm modules ! # as well. YOU HAVE BEEN WARNED!!! ! ##'db1': {'libs': ('db1', 'db'), ! ## 'libdirs': ('/usr/local/lib', ! ## '/sw/lib', ! ## '/usr/lib', ! ## '/lib'), ! ## 'incdirs': ('/usr/local/include/db1', ! ## '/usr/local/include', ! ## '/usr/include/db1', ! ## '/usr/include'), ! ## 'incs': ('db.h',)}, } - # override this list to affect the library version search order - # for example, if you want to force version 2 to be used: - # db_search_order = ["db2"] db_search_order = db_try_this.keys() db_search_order.sort() --- 481,487 ---- '/usr/include/db3', ), ! 'incs': ('db.h',)}, } db_search_order = db_try_this.keys() db_search_order.sort() *************** *** 538,554 **** # in some unusual system configurations (e.g. the directory is on # an NFS server that goes away). ! if dbinc == 'db_185.h': ! exts.append(Extension('bsddb', ['bsddbmodule.c'], ! library_dirs=[dblib_dir], ! runtime_library_dirs=[dblib_dir], ! include_dirs=db_incs, ! define_macros=[('HAVE_DB_185_H',1)], ! libraries=dblibs)) ! else: ! exts.append(Extension('bsddb', ['bsddbmodule.c'], ! library_dirs=[dblib_dir], ! runtime_library_dirs=[dblib_dir], ! include_dirs=db_incs, ! libraries=dblibs)) else: db_incs = None --- 511,519 ---- # in some unusual system configurations (e.g. the directory is on # an NFS server that goes away). ! exts.append(Extension('_bsddb', ['_bsddb.c'], ! library_dirs=[dblib_dir], ! runtime_library_dirs=[dblib_dir], ! include_dirs=db_incs, ! libraries=dblibs)) else: db_incs = None From loewis@users.sourceforge.net Tue Nov 19 08:09:55 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 19 Nov 2002 00:09:55 -0800 Subject: [Python-checkins] python/dist/src/Modules _bsddb.c,NONE,1.1 Setup.dist,1.30,1.31 bsddbmodule.c,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv24766/Modules Modified Files: Setup.dist bsddbmodule.c Added Files: _bsddb.c Log Message: Import PyBSDDB 3.4.0. Rename historical wrapper to bsddb185. --- NEW FILE: _bsddb.c --- /*---------------------------------------------------------------------- Copyright (c) 1999-2001, Digital Creations, Fredericksburg, VA, USA and Andrew Kuchling. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: o Redistributions of source code must retain the above copyright notice, this list of conditions, and the disclaimer that follows. o Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. o Neither the name of Digital Creations nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. [...4207 lines suppressed...] MAKE_EX(DBAccessError); MAKE_EX(DBNoSpaceError); MAKE_EX(DBNoMemoryError); MAKE_EX(DBAgainError); MAKE_EX(DBBusyError); MAKE_EX(DBFileExistsError); MAKE_EX(DBNoSuchFileError); MAKE_EX(DBPermissionsError); #undef MAKE_EX /* Check for errors */ if (PyErr_Occurred()) { PyErr_Print(); Py_FatalError("can't initialize module _db"); } } Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Setup.dist 9 Aug 2002 02:39:13 -0000 1.30 --- Setup.dist 19 Nov 2002 08:09:52 -0000 1.31 *************** *** 394,416 **** ! # Berkeley DB interface. # ! # This requires the Berkeley DB code, see ! # ftp://ftp.cs.berkeley.edu/pub/4bsd/db.1.85.tar.gz # ! # Edit the variables DB and DBPORT to point to the db top directory # and the subdirectory of PORT where you built it. ! # ! # (See http://electricrain.com/greg/python/bsddb3/ for an interface to ! # BSD DB 3.x.) ! ! # Note: If a db.h file is found by configure, bsddb will be enabled ! # automatically via Setup.config.in. It only needs to be enabled here ! # if it is not automatically enabled there; check the generated ! # Setup.config before enabling it here. #DB=/depot/sundry/src/berkeley-db/db.1.85 #DBPORT=$(DB)/PORT/irix.5.3 ! #bsddb bsddbmodule.c -I$(DBPORT)/include -I$(DBPORT) $(DBPORT)/libdb.a --- 394,421 ---- ! # Sleepycat Berkeley DB interface. # ! # This requires the Sleepycat DB code, see http://www.sleepycat.com/ ! # The minimum supported version of that library is 3.0. # ! # Edit the variables DB and DBLIBVERto point to the db top directory # and the subdirectory of PORT where you built it. ! #DB=/usr/local/BerkeleyDB.4.0 ! #DBLIBVER=4.0 ! #DBINC=$(DB)/include ! #DBLIB=$(DB)/lib ! #_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER + # Historical Berkeley DB 1.85 + # + # This requires the Berkeley DB code, see + # ftp://ftp.cs.berkeley.edu/pub/4bsd/db.1.85.tar.gz + # + # This module is deprecated; the historical BSDDB library has bugs + # that can cause data corruption. If you can, use the Sleepycat library + # instead. #DB=/depot/sundry/src/berkeley-db/db.1.85 #DBPORT=$(DB)/PORT/irix.5.3 ! #bsddb185 bsddbmodule.c -I$(DBPORT)/include -I$(DBPORT) $(DBPORT)/libdb.a Index: bsddbmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bsddbmodule.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** bsddbmodule.c 23 Jul 2002 06:31:12 -0000 1.37 --- bsddbmodule.c 19 Nov 2002 08:09:52 -0000 1.38 *************** *** 843,851 **** PyMODINIT_FUNC ! initbsddb(void) { PyObject *m, *d; Bsddbtype.ob_type = &PyType_Type; ! m = Py_InitModule("bsddb", bsddbmodule_methods); d = PyModule_GetDict(m); BsddbError = PyErr_NewException("bsddb.error", NULL, NULL); --- 843,851 ---- PyMODINIT_FUNC ! initbsddb185(void) { PyObject *m, *d; Bsddbtype.ob_type = &PyType_Type; ! m = Py_InitModule("bsddb185", bsddbmodule_methods); d = PyModule_GetDict(m); BsddbError = PyErr_NewException("bsddb.error", NULL, NULL); From loewis@users.sourceforge.net Tue Nov 19 08:09:54 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 19 Nov 2002 00:09:54 -0800 Subject: [Python-checkins] python/dist/src/Lib/bsddb __init__.py,NONE,1.1 db.py,NONE,1.1 dbobj.py,NONE,1.1 dbrecio.py,NONE,1.1 dbshelve.py,NONE,1.1 dbtables.py,NONE,1.1 dbutils.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb In directory sc8-pr-cvs1:/tmp/cvs-serv24766/Lib/bsddb Added Files: __init__.py db.py dbobj.py dbrecio.py dbshelve.py dbtables.py dbutils.py Log Message: Import PyBSDDB 3.4.0. Rename historical wrapper to bsddb185. --- NEW FILE: __init__.py --- #---------------------------------------------------------------------- # Copyright (c) 1999-2001, Digital Creations, Fredericksburg, VA, USA # and Andrew Kuchling. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # o Redistributions of source code must retain the above copyright # notice, this list of conditions, and the disclaimer that follows. # # o Redistributions in binary form must reproduce the above copyright # notice, this list of conditions, and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # # o Neither the name of Digital Creations nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS # IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL # CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH # DAMAGE. #---------------------------------------------------------------------- """ This package initialization module provides a compatibility interface that should enable bsddb3 to be a near drop-in replacement for the original old bsddb module. The functions and classes provided here are all wrappers around the new functionality provided in the bsddb3.db module. People interested in the more advanced capabilites of Berkeley DB 3.x should use the bsddb3.db module directly. """ import _bsddb # bsddb3 calls it _db _db = _bsddb __version__ = _db.__version__ error = _db.DBError # So bsddb3.error will mean something... #---------------------------------------------------------------------- class _DBWithCursor: """ A simple wrapper around DB that makes it look like the bsddbobject in the old module. It uses a cursor as needed to provide DB traversal. """ def __init__(self, db): self.db = db self.dbc = None self.db.set_get_returns_none(0) def __del__(self): self.close() def _checkCursor(self): if self.dbc is None: self.dbc = self.db.cursor() def _checkOpen(self): if self.db is None: raise error, "BSDDB object has already been closed" def isOpen(self): return self.db is not None def __len__(self): self._checkOpen() return len(self.db) def __getitem__(self, key): self._checkOpen() return self.db[key] def __setitem__(self, key, value): self._checkOpen() self.db[key] = value def __delitem__(self, key): self._checkOpen() del self.db[key] def close(self): if self.dbc is not None: self.dbc.close() v = 0 if self.db is not None: v = self.db.close() self.dbc = None self.db = None return v def keys(self): self._checkOpen() return self.db.keys() def has_key(self, key): self._checkOpen() return self.db.has_key(key) def set_location(self, key): self._checkOpen() self._checkCursor() return self.dbc.set(key) def next(self): self._checkOpen() self._checkCursor() rv = self.dbc.next() return rv def previous(self): self._checkOpen() self._checkCursor() rv = self.dbc.prev() return rv def first(self): self._checkOpen() self._checkCursor() rv = self.dbc.first() return rv def last(self): self._checkOpen() self._checkCursor() rv = self.dbc.last() return rv def sync(self): self._checkOpen() return self.db.sync() #---------------------------------------------------------------------- # Compatibility object factory functions def hashopen(file, flag='c', mode=0666, pgsize=None, ffactor=None, nelem=None, cachesize=None, lorder=None, hflags=0): flags = _checkflag(flag) d = _db.DB() d.set_flags(hflags) if cachesize is not None: d.set_cachesize(0, cachesize) if pgsize is not None: d.set_pagesize(pgsize) if lorder is not None: d.set_lorder(lorder) if ffactor is not None: d.set_h_ffactor(ffactor) if nelem is not None: d.set_h_nelem(nelem) d.open(file, _db.DB_HASH, flags, mode) return _DBWithCursor(d) #---------------------------------------------------------------------- def btopen(file, flag='c', mode=0666, btflags=0, cachesize=None, maxkeypage=None, minkeypage=None, pgsize=None, lorder=None): flags = _checkflag(flag) d = _db.DB() if cachesize is not None: d.set_cachesize(0, cachesize) if pgsize is not None: d.set_pagesize(pgsize) if lorder is not None: d.set_lorder(lorder) d.set_flags(btflags) if minkeypage is not None: d.set_bt_minkey(minkeypage) if maxkeypage is not None: d.set_bt_maxkey(maxkeypage) d.open(file, _db.DB_BTREE, flags, mode) return _DBWithCursor(d) #---------------------------------------------------------------------- def rnopen(file, flag='c', mode=0666, rnflags=0, cachesize=None, pgsize=None, lorder=None, rlen=None, delim=None, source=None, pad=None): flags = _checkflag(flag) d = _db.DB() if cachesize is not None: d.set_cachesize(0, cachesize) if pgsize is not None: d.set_pagesize(pgsize) if lorder is not None: d.set_lorder(lorder) d.set_flags(rnflags) if delim is not None: d.set_re_delim(delim) if rlen is not None: d.set_re_len(rlen) if source is not None: d.set_re_source(source) if pad is not None: d.set_re_pad(pad) d.open(file, _db.DB_RECNO, flags, mode) return _DBWithCursor(d) #---------------------------------------------------------------------- def _checkflag(flag): if flag == 'r': flags = _db.DB_RDONLY elif flag == 'rw': flags = 0 elif flag == 'w': flags = _db.DB_CREATE elif flag == 'c': flags = _db.DB_CREATE elif flag == 'n': flags = _db.DB_CREATE | _db.DB_TRUNCATE else: raise error, "flags should be one of 'r', 'w', 'c' or 'n'" return flags | _db.DB_THREAD #---------------------------------------------------------------------- # This is a silly little hack that allows apps to continue to use the # DB_THREAD flag even on systems without threads without freaking out # BerkeleyDB. # # This assumes that if Python was built with thread support then # BerkeleyDB was too. try: import thread del thread except ImportError: _db.DB_THREAD = 0 #---------------------------------------------------------------------- --- NEW FILE: db.py --- #---------------------------------------------------------------------- # Copyright (c) 1999-2001, Digital Creations, Fredericksburg, VA, USA # and Andrew Kuchling. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # o Redistributions of source code must retain the above copyright # notice, this list of conditions, and the disclaimer that follows. # # o Redistributions in binary form must reproduce the above copyright # notice, this list of conditions, and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # # o Neither the name of Digital Creations nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS # IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL # CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH # DAMAGE. #---------------------------------------------------------------------- # This module is just a placeholder for possible future expansion, in # case we ever want to augment the stuff in _db in any way. For now # it just simply imports everything from _db. from _db import * from _db import __version__ if version() < (3, 1, 0): raise ImportError, "BerkeleyDB 3.x symbols not found. Perhaps python was statically linked with an older version?" --- NEW FILE: dbobj.py --- #------------------------------------------------------------------------- # This file contains real Python object wrappers for DB and DBEnv # C "objects" that can be usefully subclassed. The previous SWIG # based interface allowed this thanks to SWIG's shadow classes. # -- Gregory P. Smith #------------------------------------------------------------------------- # # (C) Copyright 2001 Autonomous Zone Industries # # License: This is free software. You may use this software for any # purpose including modification/redistribution, so long as # this header remains intact and that you do not claim any # rights of ownership or authorship of this software. This # software has been tested, but no warranty is expressed or # implied. # import db class DBEnv: def __init__(self, *args, **kwargs): self._cobj = apply(db.DBEnv, args, kwargs) def close(self, *args, **kwargs): return apply(self._cobj.close, args, kwargs) def open(self, *args, **kwargs): return apply(self._cobj.open, args, kwargs) def remove(self, *args, **kwargs): return apply(self._cobj.remove, args, kwargs) def set_cachesize(self, *args, **kwargs): return apply(self._cobj.set_cachesize, args, kwargs) def set_data_dir(self, *args, **kwargs): return apply(self._cobj.set_data_dir, args, kwargs) def set_flags(self, *args, **kwargs): return apply(self._cobj.set_flags, args, kwargs) def set_lg_bsize(self, *args, **kwargs): return apply(self._cobj.set_lg_bsize, args, kwargs) def set_lg_dir(self, *args, **kwargs): return apply(self._cobj.set_lg_dir, args, kwargs) def set_lg_max(self, *args, **kwargs): return apply(self._cobj.set_lg_max, args, kwargs) def set_lk_detect(self, *args, **kwargs): return apply(self._cobj.set_lk_detect, args, kwargs) def set_lk_max(self, *args, **kwargs): return apply(self._cobj.set_lk_max, args, kwargs) def set_lk_max_locks(self, *args, **kwargs): return apply(self._cobj.set_lk_max_locks, args, kwargs) def set_lk_max_lockers(self, *args, **kwargs): return apply(self._cobj.set_lk_max_lockers, args, kwargs) def set_lk_max_objects(self, *args, **kwargs): return apply(self._cobj.set_lk_max_objects, args, kwargs) def set_mp_mmapsize(self, *args, **kwargs): return apply(self._cobj.set_mp_mmapsize, args, kwargs) def set_tmp_dir(self, *args, **kwargs): return apply(self._cobj.set_tmp_dir, args, kwargs) def txn_begin(self, *args, **kwargs): return apply(self._cobj.txn_begin, args, kwargs) def txn_checkpoint(self, *args, **kwargs): return apply(self._cobj.txn_checkpoint, args, kwargs) def txn_stat(self, *args, **kwargs): return apply(self._cobj.txn_stat, args, kwargs) def set_tx_max(self, *args, **kwargs): return apply(self._cobj.set_tx_max, args, kwargs) def lock_detect(self, *args, **kwargs): return apply(self._cobj.lock_detect, args, kwargs) def lock_get(self, *args, **kwargs): return apply(self._cobj.lock_get, args, kwargs) def lock_id(self, *args, **kwargs): return apply(self._cobj.lock_id, args, kwargs) def lock_put(self, *args, **kwargs): return apply(self._cobj.lock_put, args, kwargs) def lock_stat(self, *args, **kwargs): return apply(self._cobj.lock_stat, args, kwargs) def log_archive(self, *args, **kwargs): return apply(self._cobj.log_archive, args, kwargs) def set_get_returns_none(self, *args, **kwargs): return apply(self._cobj.set_get_returns_none, args, kwargs) class DB: def __init__(self, dbenv, *args, **kwargs): # give it the proper DBEnv C object that its expecting self._cobj = apply(db.DB, (dbenv._cobj,) + args, kwargs) # TODO are there other dict methods that need to be overridden? def __len__(self): return len(self._cobj) def __getitem__(self, arg): return self._cobj[arg] def __setitem__(self, key, value): self._cobj[key] = value def __delitem__(self, arg): del self._cobj[arg] def append(self, *args, **kwargs): return apply(self._cobj.append, args, kwargs) def associate(self, *args, **kwargs): return apply(self._cobj.associate, args, kwargs) def close(self, *args, **kwargs): return apply(self._cobj.close, args, kwargs) def consume(self, *args, **kwargs): return apply(self._cobj.consume, args, kwargs) def consume_wait(self, *args, **kwargs): return apply(self._cobj.consume_wait, args, kwargs) def cursor(self, *args, **kwargs): return apply(self._cobj.cursor, args, kwargs) def delete(self, *args, **kwargs): return apply(self._cobj.delete, args, kwargs) def fd(self, *args, **kwargs): return apply(self._cobj.fd, args, kwargs) def get(self, *args, **kwargs): return apply(self._cobj.get, args, kwargs) def get_both(self, *args, **kwargs): return apply(self._cobj.get_both, args, kwargs) def get_byteswapped(self, *args, **kwargs): return apply(self._cobj.get_byteswapped, args, kwargs) def get_size(self, *args, **kwargs): return apply(self._cobj.get_size, args, kwargs) def get_type(self, *args, **kwargs): return apply(self._cobj.get_type, args, kwargs) def join(self, *args, **kwargs): return apply(self._cobj.join, args, kwargs) def key_range(self, *args, **kwargs): return apply(self._cobj.key_range, args, kwargs) def has_key(self, *args, **kwargs): return apply(self._cobj.has_key, args, kwargs) def items(self, *args, **kwargs): return apply(self._cobj.items, args, kwargs) def keys(self, *args, **kwargs): return apply(self._cobj.keys, args, kwargs) def open(self, *args, **kwargs): return apply(self._cobj.open, args, kwargs) def put(self, *args, **kwargs): return apply(self._cobj.put, args, kwargs) def remove(self, *args, **kwargs): return apply(self._cobj.remove, args, kwargs) def rename(self, *args, **kwargs): return apply(self._cobj.rename, args, kwargs) def set_bt_minkey(self, *args, **kwargs): return apply(self._cobj.set_bt_minkey, args, kwargs) def set_cachesize(self, *args, **kwargs): return apply(self._cobj.set_cachesize, args, kwargs) def set_flags(self, *args, **kwargs): return apply(self._cobj.set_flags, args, kwargs) def set_h_ffactor(self, *args, **kwargs): return apply(self._cobj.set_h_ffactor, args, kwargs) def set_h_nelem(self, *args, **kwargs): return apply(self._cobj.set_h_nelem, args, kwargs) def set_lorder(self, *args, **kwargs): return apply(self._cobj.set_lorder, args, kwargs) def set_pagesize(self, *args, **kwargs): return apply(self._cobj.set_pagesize, args, kwargs) def set_re_delim(self, *args, **kwargs): return apply(self._cobj.set_re_delim, args, kwargs) def set_re_len(self, *args, **kwargs): return apply(self._cobj.set_re_len, args, kwargs) def set_re_pad(self, *args, **kwargs): return apply(self._cobj.set_re_pad, args, kwargs) def set_re_source(self, *args, **kwargs): return apply(self._cobj.set_re_source, args, kwargs) def set_q_extentsize(self, *args, **kwargs): return apply(self._cobj.set_q_extentsize, args, kwargs) def stat(self, *args, **kwargs): return apply(self._cobj.stat, args, kwargs) def sync(self, *args, **kwargs): return apply(self._cobj.sync, args, kwargs) def type(self, *args, **kwargs): return apply(self._cobj.type, args, kwargs) def upgrade(self, *args, **kwargs): return apply(self._cobj.upgrade, args, kwargs) def values(self, *args, **kwargs): return apply(self._cobj.values, args, kwargs) def verify(self, *args, **kwargs): return apply(self._cobj.verify, args, kwargs) def set_get_returns_none(self, *args, **kwargs): return apply(self._cobj.set_get_returns_none, args, kwargs) --- NEW FILE: dbrecio.py --- """ File-like objects that read from or write to a bsddb3 record. This implements (nearly) all stdio methods. f = DBRecIO(db, key, txn=None) f.close() # explicitly release resources held flag = f.isatty() # always false pos = f.tell() # get current position f.seek(pos) # set current position f.seek(pos, mode) # mode 0: absolute; 1: relative; 2: relative to EOF buf = f.read() # read until EOF buf = f.read(n) # read up to n bytes f.truncate([size]) # truncate file at to at most size (default: current pos) f.write(buf) # write at current position f.writelines(list) # for line in list: f.write(line) Notes: - fileno() is left unimplemented so that code which uses it triggers an exception early. - There's a simple test set (see end of this file) - not yet updated for DBRecIO. - readline() is not implemented yet. From: Itamar Shtull-Trauring """ import errno import string class DBRecIO: def __init__(self, db, key, txn=None): self.db = db self.key = key self.txn = txn self.len = None self.pos = 0 self.closed = 0 self.softspace = 0 def close(self): if not self.closed: self.closed = 1 del self.db, self.txn def isatty(self): if self.closed: raise ValueError, "I/O operation on closed file" return 0 def seek(self, pos, mode = 0): if self.closed: raise ValueError, "I/O operation on closed file" if mode == 1: pos = pos + self.pos elif mode == 2: pos = pos + self.len self.pos = max(0, pos) def tell(self): if self.closed: raise ValueError, "I/O operation on closed file" return self.pos def read(self, n = -1): if self.closed: raise ValueError, "I/O operation on closed file" if n < 0: newpos = self.len else: newpos = min(self.pos+n, self.len) dlen = newpos - self.pos r = self.db.get(key, txn=self.txn, dlen=dlen, doff=self.pos) self.pos = newpos return r __fixme = """ def readline(self, length=None): if self.closed: raise ValueError, "I/O operation on closed file" if self.buflist: self.buf = self.buf + string.joinfields(self.buflist, '') self.buflist = [] i = string.find(self.buf, '\n', self.pos) if i < 0: newpos = self.len else: newpos = i+1 if length is not None: if self.pos + length < newpos: newpos = self.pos + length r = self.buf[self.pos:newpos] self.pos = newpos return r def readlines(self, sizehint = 0): total = 0 lines = [] line = self.readline() while line: lines.append(line) total += len(line) if 0 < sizehint <= total: break line = self.readline() return lines """ def truncate(self, size=None): if self.closed: raise ValueError, "I/O operation on closed file" if size is None: size = self.pos elif size < 0: raise IOError(errno.EINVAL, "Negative size not allowed") elif size < self.pos: self.pos = size self.db.put(key, "", txn=self.txn, dlen=self.len-size, doff=size) def write(self, s): if self.closed: raise ValueError, "I/O operation on closed file" if not s: return if self.pos > self.len: self.buflist.append('\0'*(self.pos - self.len)) self.len = self.pos newpos = self.pos + len(s) self.db.put(key, s, txn=self.txn, dlen=len(s), doff=self.pos) self.pos = newpos def writelines(self, list): self.write(string.joinfields(list, '')) def flush(self): if self.closed: raise ValueError, "I/O operation on closed file" """ # A little test suite def _test(): import sys if sys.argv[1:]: file = sys.argv[1] else: file = '/etc/passwd' lines = open(file, 'r').readlines() text = open(file, 'r').read() f = StringIO() for line in lines[:-2]: f.write(line) f.writelines(lines[-2:]) if f.getvalue() != text: raise RuntimeError, 'write failed' length = f.tell() print 'File length =', length f.seek(len(lines[0])) f.write(lines[1]) f.seek(0) print 'First line =', `f.readline()` here = f.tell() line = f.readline() print 'Second line =', `line` f.seek(-len(line), 1) line2 = f.read(len(line)) if line != line2: raise RuntimeError, 'bad result after seek back' f.seek(len(line2), 1) list = f.readlines() line = list[-1] f.seek(f.tell() - len(line)) line2 = f.read() if line != line2: raise RuntimeError, 'bad result after seek back from EOF' print 'Read', len(list), 'more lines' print 'File length =', f.tell() if f.tell() != length: raise RuntimeError, 'bad length' f.close() if __name__ == '__main__': _test() """ --- NEW FILE: dbshelve.py --- #!/bin/env python #------------------------------------------------------------------------ # Copyright (c) 1997-2001 by Total Control Software # All Rights Reserved #------------------------------------------------------------------------ # # Module Name: dbShelve.py # # Description: A reimplementation of the standard shelve.py that # forces the use of cPickle, and DB. # # Creation Date: 11/3/97 3:39:04PM # # License: This is free software. You may use this software for any # purpose including modification/redistribution, so long as # this header remains intact and that you do not claim any # rights of ownership or authorship of this software. This # software has been tested, but no warranty is expressed or # implied. # # 13-Dec-2000: Updated to be used with the new bsddb3 package. # Added DBShelfCursor class. # #------------------------------------------------------------------------ """ Manage shelves of pickled objects using bsddb3 database files for the storage. """ #------------------------------------------------------------------------ import cPickle from bsddb3 import db #------------------------------------------------------------------------ def open(filename, flags=db.DB_CREATE, mode=0660, filetype=db.DB_HASH, dbenv=None, dbname=None): """ A simple factory function for compatibility with the standard shleve.py module. It can be used like this, where key is a string and data is a pickleable object: from bsddb3 import dbshelve db = dbshelve.open(filename) db[key] = data db.close() """ if type(flags) == type(''): sflag = flags if sflag == 'r': flags = db.DB_RDONLY elif sflag == 'rw': flags = 0 elif sflag == 'w': flags = db.DB_CREATE elif sflag == 'c': flags = db.DB_CREATE elif sflag == 'n': flags = db.DB_TRUNCATE | db.DB_CREATE else: raise error, "flags should be one of 'r', 'w', 'c' or 'n' or use the bsddb3.db.DB_* flags" d = DBShelf(dbenv) d.open(filename, dbname, filetype, flags, mode) return d #--------------------------------------------------------------------------- class DBShelf: """ A shelf to hold pickled objects, built upon a bsddb3 DB object. It automatically pickles/unpickles data objects going to/from the DB. """ def __init__(self, dbenv=None): self.db = db.DB(dbenv) self.binary = 1 def __del__(self): self.close() def __getattr__(self, name): """Many methods we can just pass through to the DB object. (See below)""" return getattr(self.db, name) #----------------------------------- # Dictionary access methods def __len__(self): return len(self.db) def __getitem__(self, key): data = self.db[key] return cPickle.loads(data) def __setitem__(self, key, value): data = cPickle.dumps(value, self.binary) self.db[key] = data def __delitem__(self, key): del self.db[key] def keys(self, txn=None): if txn != None: return self.db.keys(txn) else: return self.db.keys() def items(self, txn=None): if txn != None: items = self.db.items(txn) else: items = self.db.items() newitems = [] for k, v in items: newitems.append( (k, cPickle.loads(v)) ) return newitems def values(self, txn=None): if txn != None: values = self.db.values(txn) else: values = self.db.values() return map(cPickle.loads, values) #----------------------------------- # Other methods def append(self, value, txn=None): data = cPickle.dumps(value, self.binary) return self.db.append(data, txn) def associate(self, secondaryDB, callback, flags=0): def _shelf_callback(priKey, priData, realCallback=callback): data = cPickle.loads(priData) return realCallback(priKey, data) return self.db.associate(secondaryDB, _shelf_callback, flags) #def get(self, key, default=None, txn=None, flags=0): def get(self, *args, **kw): # We do it with *args and **kw so if the default value wasn't # given nothing is passed to the extension module. That way # an exception can be raised if set_get_returns_none is turned # off. data = apply(self.db.get, args, kw) try: return cPickle.loads(data) except (TypeError, cPickle.UnpicklingError): return data # we may be getting the default value, or None, # so it doesn't need unpickled. def get_both(self, key, value, txn=None, flags=0): data = cPickle.dumps(value, self.binary) data = self.db.get(key, data, txn, flags) return cPickle.loads(data) def cursor(self, txn=None, flags=0): c = DBShelfCursor(self.db.cursor(txn, flags)) c.binary = self.binary return c def put(self, key, value, txn=None, flags=0): data = cPickle.dumps(value, self.binary) return self.db.put(key, data, txn, flags) def join(self, cursorList, flags=0): raise NotImplementedError #---------------------------------------------- # Methods allowed to pass-through to self.db # # close, delete, fd, get_byteswapped, get_type, has_key, # key_range, open, remove, rename, stat, sync, # upgrade, verify, and all set_* methods. #--------------------------------------------------------------------------- class DBShelfCursor: """ """ def __init__(self, cursor): self.dbc = cursor def __del__(self): self.close() def __getattr__(self, name): """Some methods we can just pass through to the cursor object. (See below)""" return getattr(self.dbc, name) #---------------------------------------------- def dup(self, flags=0): return DBShelfCursor(self.dbc.dup(flags)) def put(self, key, value, flags=0): data = cPickle.dumps(value, self.binary) return self.dbc.put(key, data, flags) def get(self, *args): count = len(args) # a method overloading hack method = getattr(self, 'get_%d' % count) apply(method, args) def get_1(self, flags): rec = self.dbc.get(flags) return self._extract(rec) def get_2(self, key, flags): rec = self.dbc.get(key, flags) return self._extract(rec) def get_3(self, key, value, flags): data = cPickle.dumps(value, self.binary) rec = self.dbc.get(key, flags) return self._extract(rec) def current(self, flags=0): return self.get_1(flags|db.DB_CURRENT) def first(self, flags=0): return self.get_1(flags|db.DB_FIRST) def last(self, flags=0): return self.get_1(flags|db.DB_LAST) def next(self, flags=0): return self.get_1(flags|db.DB_NEXT) def prev(self, flags=0): return self.get_1(flags|db.DB_PREV) def consume(self, flags=0): return self.get_1(flags|db.DB_CONSUME) def next_dup(self, flags=0): return self.get_1(flags|db.DB_NEXT_DUP) def next_nodup(self, flags=0): return self.get_1(flags|db.DB_NEXT_NODUP) def prev_nodup(self, flags=0): return self.get_1(flags|db.DB_PREV_NODUP) def get_both(self, key, value, flags=0): data = cPickle.dumps(value, self.binary) rec = self.dbc.get_both(key, flags) return self._extract(rec) def set(self, key, flags=0): rec = self.dbc.set(key, flags) return self._extract(rec) def set_range(self, key, flags=0): rec = self.dbc.set_range(key, flags) return self._extract(rec) def set_recno(self, recno, flags=0): rec = self.dbc.set_recno(recno, flags) return self._extract(rec) set_both = get_both def _extract(self, rec): if rec is None: return None else: key, data = rec return key, cPickle.loads(data) #---------------------------------------------- # Methods allowed to pass-through to self.dbc # # close, count, delete, get_recno, join_item #--------------------------------------------------------------------------- --- NEW FILE: dbtables.py --- #----------------------------------------------------------------------- # # Copyright (C) 2000, 2001 by Autonomous Zone Industries # # License: This is free software. You may use this software for any # purpose including modification/redistribution, so long as # this header remains intact and that you do not claim any # rights of ownership or authorship of this software. This # software has been tested, but no warranty is expressed or # implied. # # -- Gregory P. Smith # This provides a simple database table interface built on top of # the Python BerkeleyDB 3 interface. # _cvsid = '$Id: dbtables.py,v 1.1 2002/11/19 08:09:52 loewis Exp $' import string import sys try: import cPickle pickle = cPickle except ImportError: import pickle import whrandom import xdrlib import re import copy from bsddb3.db import * class TableDBError(StandardError): pass class TableAlreadyExists(TableDBError): pass class Cond: """This condition matches everything""" def __call__(self, s): return 1 class ExactCond(Cond): """Acts as an exact match condition function""" def __init__(self, strtomatch): self.strtomatch = strtomatch def __call__(self, s): return s == self.strtomatch class PrefixCond(Cond): """Acts as a condition function for matching a string prefix""" def __init__(self, prefix): self.prefix = prefix def __call__(self, s): return s[:len(self.prefix)] == self.prefix class LikeCond(Cond): """ Acts as a function that will match using an SQL 'LIKE' style string. Case insensitive and % signs are wild cards. This isn't perfect but it should work for the simple common cases. """ def __init__(self, likestr, re_flags=re.IGNORECASE): # escape python re characters chars_to_escape = '.*+()[]?' for char in chars_to_escape : likestr = string.replace(likestr, char, '\\'+char) # convert %s to wildcards self.likestr = string.replace(likestr, '%', '.*') self.re = re.compile('^'+self.likestr+'$', re_flags) def __call__(self, s): return self.re.match(s) # # keys used to store database metadata # _table_names_key = '__TABLE_NAMES__' # list of the tables in this db _columns = '._COLUMNS__' # table_name+this key contains a list of columns def _columns_key(table) : return table + _columns # # these keys are found within table sub databases # _data = '._DATA_.' # this+column+this+rowid key contains table data _rowid = '._ROWID_.' # this+rowid+this key contains a unique entry for each # row in the table. (no data is stored) _rowid_str_len = 8 # length in bytes of the unique rowid strings def _data_key(table, col, rowid) : return table + _data + col + _data + rowid def _search_col_data_key(table, col) : return table + _data + col + _data def _search_all_data_key(table) : return table + _data def _rowid_key(table, rowid) : return table + _rowid + rowid + _rowid def _search_rowid_key(table) : return table + _rowid def contains_metastrings(s) : """Verify that the given string does not contain any metadata strings that might interfere with dbtables database operation. """ if string.find(s, _table_names_key) >= 0 or \ string.find(s, _columns) >= 0 or \ string.find(s, _data) >= 0 or \ string.find(s, _rowid) >= 0 : return 1 else : return 0 class bsdTableDB : def __init__(self, filename, dbhome, create=0, truncate=0, mode=0600, recover=0, dbflags=0) : """bsdTableDB.open(filename, dbhome, create=0, truncate=0, mode=0600) Open database name in the dbhome BerkeleyDB directory. Use keyword arguments when calling this constructor. """ myflags = DB_THREAD if create : myflags = myflags | DB_CREATE flagsforenv = DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN | dbflags if recover : flagsforenv = flagsforenv | DB_RECOVER self.env = DBEnv() self.env.set_lk_detect(DB_LOCK_DEFAULT) # enable auto deadlock avoidance self.env.open(dbhome, myflags | flagsforenv) if truncate : myflags = myflags | DB_TRUNCATE self.db = DB(self.env) self.db.set_flags(DB_DUP) # allow duplicate entries [warning: be careful w/ metadata] self.db.open(filename, DB_BTREE, myflags, mode) self.dbfilename = filename # Initialize the table names list if this is a new database if not self.db.has_key(_table_names_key) : self.db.put(_table_names_key, pickle.dumps([], 1)) # TODO verify more of the database's metadata? self.__tablecolumns = {} def __del__(self): self.close() def close(self): if self.db is not None: self.db.close() self.db = None if self.env is not None: self.env.close() self.env = None def checkpoint(self, mins=0): try: self.env.txn_checkpoint(mins) except DBIncompleteError: pass def sync(self): try: self.db.sync() except DBIncompleteError: pass def _db_print(self) : """Print the database to stdout for debugging""" print "******** Printing raw database for debugging ********" cur = self.db.cursor() try: key, data = cur.first() while 1 : print `{key: data}` next = cur.next() if next: key, data = next else: cur.close() return except DBNotFoundError: cur.close() def CreateTable(self, table, columns) : """CreateTable(table, columns) - Create a new table in the database raises TableDBError if it already exists or for other DB errors. """ assert type(columns) == type([]) txn = None try: # checking sanity of the table and column names here on # table creation will prevent problems elsewhere. if contains_metastrings(table) : raise ValueError, "bad table name: contains reserved metastrings" for column in columns : if contains_metastrings(column) : raise ValueError, "bad column name: contains reserved metastrings" columnlist_key = _columns_key(table) if self.db.has_key(columnlist_key) : raise TableAlreadyExists, "table already exists" txn = self.env.txn_begin() # store the table's column info self.db.put(columnlist_key, pickle.dumps(columns, 1), txn=txn) # add the table name to the tablelist tablelist = pickle.loads(self.db.get(_table_names_key, txn=txn, flags=DB_RMW)) tablelist.append(table) self.db.delete(_table_names_key, txn) # delete 1st, incase we opened with DB_DUP self.db.put(_table_names_key, pickle.dumps(tablelist, 1), txn=txn) txn.commit() txn = None except DBError, dberror: if txn : txn.abort() raise TableDBError, dberror[1] def ListTableColumns(self, table): """Return a list of columns in the given table. [] if the table doesn't exist. """ assert type(table) == type('') if contains_metastrings(table) : raise ValueError, "bad table name: contains reserved metastrings" columnlist_key = _columns_key(table) if not self.db.has_key(columnlist_key): return [] pickledcolumnlist = self.db.get(columnlist_key) if pickledcolumnlist: return pickle.loads(pickledcolumnlist) else: return [] def ListTables(self): """Return a list of tables in this database.""" pickledtablelist = self.db.get(_table_names_key) if pickledtablelist: return pickle.loads(pickledtablelist) else: return [] def CreateOrExtendTable(self, table, columns): """CreateOrExtendTable(table, columns) - Create a new table in the database. If a table of this name already exists, extend it to have any additional columns present in the given list as well as all of its current columns. """ assert type(columns) == type([]) try: self.CreateTable(table, columns) except TableAlreadyExists: # the table already existed, add any new columns txn = None try: columnlist_key = _columns_key(table) txn = self.env.txn_begin() # load the current column list oldcolumnlist = pickle.loads(self.db.get(columnlist_key, txn=txn, flags=DB_RMW)) # create a hash table for fast lookups of column names in the loop below oldcolumnhash = {} for c in oldcolumnlist: oldcolumnhash[c] = c # create a new column list containing both the old and new column names newcolumnlist = copy.copy(oldcolumnlist) for c in columns: if not oldcolumnhash.has_key(c): newcolumnlist.append(c) # store the table's new extended column list if newcolumnlist != oldcolumnlist : # delete the old one first since we opened with DB_DUP self.db.delete(columnlist_key, txn) self.db.put(columnlist_key, pickle.dumps(newcolumnlist, 1), txn=txn) txn.commit() txn = None self.__load_column_info(table) except DBError, dberror: if txn: txn.abort() raise TableDBError, dberror[1] def __load_column_info(self, table) : """initialize the self.__tablecolumns dict""" # check the column names try: tcolpickles = self.db.get(_columns_key(table)) except DBNotFoundError: raise TableDBError, "unknown table: " + `table` if not tcolpickles: raise TableDBError, "unknown table: " + `table` self.__tablecolumns[table] = pickle.loads(tcolpickles) def __new_rowid(self, table, txn=None) : """Create a new unique row identifier""" unique = 0 while not unique : # Generate a random 64-bit row ID string # (note: this code has <64 bits of randomness # but it's plenty for our database id needs!) p = xdrlib.Packer() p.pack_int(int(whrandom.random()*2147483647)) p.pack_int(int(whrandom.random()*2147483647)) newid = p.get_buffer() # Guarantee uniqueness by adding this key to the database try: self.db.put(_rowid_key(table, newid), None, txn=txn, flags=DB_NOOVERWRITE) except DBKeyExistsError: pass else: unique = 1 return newid def Insert(self, table, rowdict) : """Insert(table, datadict) - Insert a new row into the table using the keys+values from rowdict as the column values. """ txn = None try: if not self.db.has_key(_columns_key(table)) : raise TableDBError, "unknown table" # check the validity of each column name if not self.__tablecolumns.has_key(table) : self.__load_column_info(table) for column in rowdict.keys() : if not self.__tablecolumns[table].count(column) : raise TableDBError, "unknown column: "+`column` # get a unique row identifier for this row rowid = self.__new_rowid(table) txn = self.env.txn_begin() # insert the row values into the table database for column, dataitem in rowdict.items() : # store the value self.db.put(_data_key(table, column, rowid), dataitem, txn=txn) txn.commit() txn = None except DBError, dberror: if txn : txn.abort() self.db.delete(_rowid_key(table, rowid)) raise TableDBError, dberror[1] def Modify(self, table, conditions={}, mappings={}) : """Modify(table, conditions) - Modify in rows matching 'conditions' using mapping functions in 'mappings' * conditions is a dictionary keyed on column names containing condition functions expecting the data string as an argument and returning a boolean. * mappings is a dictionary keyed on column names containint condition functions expecting the data string as an argument and returning the new string for that column. """ try: matching_rowids = self.__Select(table, [], conditions) # modify only requested columns columns = mappings.keys() for rowid in matching_rowids.keys() : txn = None try: for column in columns : txn = self.env.txn_begin() # modify the requested column try: dataitem = self.db.get(_data_key(table, column, rowid), txn) self.db.delete(_data_key(table, column, rowid), txn) except DBNotFoundError: dataitem = None # XXXXXXX row key somehow didn't exist, assume no error dataitem = mappings[column](dataitem) if dataitem <> None: self.db.put(_data_key(table, column, rowid), dataitem, txn=txn) txn.commit() txn = None except DBError, dberror: if txn : txn.abort() raise except DBError, dberror: raise TableDBError, dberror[1] def Delete(self, table, conditions={}) : """Delete(table, conditions) - Delete items matching the given conditions from the table. * conditions is a dictionary keyed on column names containing condition functions expecting the data string as an argument and returning a boolean. """ try: matching_rowids = self.__Select(table, [], conditions) # delete row data from all columns columns = self.__tablecolumns[table] for rowid in matching_rowids.keys() : txn = None try: txn = self.env.txn_begin() for column in columns : # delete the data key try: self.db.delete(_data_key(table, column, rowid), txn) except DBNotFoundError: pass # XXXXXXX column may not exist, assume no error try: self.db.delete(_rowid_key(table, rowid), txn) except DBNotFoundError: pass # XXXXXXX row key somehow didn't exist, assume no error txn.commit() txn = None except DBError, dberror: if txn : txn.abort() raise except DBError, dberror: raise TableDBError, dberror[1] def Select(self, table, columns, conditions={}) : """Select(table, conditions) - retrieve specific row data Returns a list of row column->value mapping dictionaries. * columns is a list of which column data to return. If columns is None, all columns will be returned. * conditions is a dictionary keyed on column names containing callable conditions expecting the data string as an argument and returning a boolean. """ try: if not self.__tablecolumns.has_key(table) : self.__load_column_info(table) if columns is None : columns = self.__tablecolumns[table] matching_rowids = self.__Select(table, columns, conditions) except DBError, dberror: raise TableDBError, dberror[1] # return the matches as a list of dictionaries return matching_rowids.values() def __Select(self, table, columns, conditions) : """__Select() - Used to implement Select and Delete (above) Returns a dictionary keyed on rowids containing dicts holding the row data for columns listed in the columns param that match the given conditions. * conditions is a dictionary keyed on column names containing callable conditions expecting the data string as an argument and returning a boolean. """ # check the validity of each column name if not self.__tablecolumns.has_key(table) : self.__load_column_info(table) if columns is None : columns = self.tablecolumns[table] for column in (columns + conditions.keys()) : if not self.__tablecolumns[table].count(column) : raise TableDBError, "unknown column: "+`column` # keyed on rows that match so far, containings dicts keyed on # column names containing the data for that row and column. matching_rowids = {} rejected_rowids = {} # keys are rowids that do not match # attempt to sort the conditions in such a way as to minimize full column lookups def cmp_conditions(atuple, btuple): a = atuple[1] b = btuple[1] if type(a) == type(b) : if isinstance(a, PrefixCond) and isinstance(b, PrefixCond): return cmp(len(b.prefix), len(a.prefix)) # longest prefix first if isinstance(a, LikeCond) and isinstance(b, LikeCond): return cmp(len(b.likestr), len(a.likestr)) # longest likestr first return 0 if isinstance(a, ExactCond): return -1 if isinstance(b, ExactCond): return 1 if isinstance(a, PrefixCond): return -1 if isinstance(b, PrefixCond): return 1 # leave all unknown condition callables alone as equals return 0 conditionlist = conditions.items() conditionlist.sort(cmp_conditions) # Apply conditions to column data to find what we want cur = self.db.cursor() column_num = -1 for column, condition in conditionlist : column_num = column_num + 1 searchkey = _search_col_data_key(table, column) # speedup: don't linear search columns within loop if column in columns : savethiscolumndata = 1 # save the data for return else : savethiscolumndata = 0 # data only used for selection try: key, data = cur.set_range(searchkey) while key[:len(searchkey)] == searchkey : # extract the rowid from the key rowid = key[-_rowid_str_len:] if not rejected_rowids.has_key(rowid) : # if no condition was specified or the condition # succeeds, add row to our match list. if not condition or condition(data) : # only create new entries in matcing_rowids on # the first pass, otherwise reject the # rowid as it must not have matched # the previous passes if column_num == 0 : if not matching_rowids.has_key(rowid) : matching_rowids[rowid] = {} if savethiscolumndata : matching_rowids[rowid][column] = data else : rejected_rowids[rowid] = rowid else : if matching_rowids.has_key(rowid) : del matching_rowids[rowid] rejected_rowids[rowid] = rowid key, data = cur.next() except DBError, dberror: if dberror[0] != DB_NOTFOUND : raise continue cur.close() # we're done selecting rows, garbage collect the reject list del rejected_rowids # extract any remaining desired column data from the # database for the matching rows. if len(columns) > 0 : for rowid, rowdata in matching_rowids.items() : for column in columns : if rowdata.has_key(column) : continue try: rowdata[column] = self.db.get(_data_key(table, column, rowid)) except DBError, dberror: if dberror[0] != DB_NOTFOUND : raise rowdata[column] = None # return the matches return matching_rowids def Drop(self, table) : """Remove an entire table from the database """ txn = None try: txn = self.env.txn_begin() # delete the column list self.db.delete(_columns_key(table), txn) cur = self.db.cursor(txn) # delete all keys containing this tables column and row info table_key = _search_all_data_key(table) while 1 : try: key, data = cur.set_range(table_key) except DBNotFoundError: break # only delete items in this table if key[:len(table_key)] != table_key : break cur.delete() # delete all rowids used by this table table_key = _search_rowid_key(table) while 1 : try: key, data = cur.set_range(table_key) except DBNotFoundError: break # only delete items in this table if key[:len(table_key)] != table_key : break cur.delete() cur.close() # delete the tablename from the table name list tablelist = pickle.loads(self.db.get(_table_names_key, txn=txn, flags=DB_RMW)) try: tablelist.remove(table) except ValueError: pass # hmm, it wasn't there, oh well, that's what we want. self.db.delete(_table_names_key, txn) # delete 1st, incase we opened with DB_DUP self.db.put(_table_names_key, pickle.dumps(tablelist, 1), txn=txn) txn.commit() txn = None if self.__tablecolumns.has_key(table) : del self.__tablecolumns[table] except DBError, dberror: if txn : txn.abort() raise TableDBError, dberror[1] --- NEW FILE: dbutils.py --- #------------------------------------------------------------------------ # # In my performance tests, using this (as in dbtest.py test4) is # slightly slower than simply compiling _db.c with MYDB_THREAD # undefined to prevent multithreading support in the C module. # Using NoDeadlockDb also prevent deadlocks from mutliple processes # accessing the same database. # # Copyright (C) 2000 Autonomous Zone Industries # # License: This is free software. You may use this software for any # purpose including modification/redistribution, so long as # this header remains intact and that you do not claim any # rights of ownership or authorship of this software. This # software has been tested, but no warranty is expressed or # implied. # # Author: Gregory P. Smith # # Note: I don't know how useful this is in reality since when a # DBDeadlockError happens the current transaction is supposed to be # aborted. If it doesn't then when the operation is attempted again # the deadlock is still happening... # --Robin # #------------------------------------------------------------------------ # # import the time.sleep function in a namespace safe way to allow # "from bsddb3.db import *" # from time import sleep _sleep = sleep del sleep import _db _deadlock_MinSleepTime = 1.0/64 # always sleep at least N seconds between retrys _deadlock_MaxSleepTime = 1.0 # never sleep more than N seconds between retrys def DeadlockWrap(function, *_args, **_kwargs): """DeadlockWrap(function, *_args, **_kwargs) - automatically retries function in case of a database deadlock. This is a DeadlockWrapper method which DB calls can be made using to preform infinite retrys with sleeps in between when a DBLockDeadlockError exception is raised in a database call: d = DB(...) d.open(...) DeadlockWrap(d.put, "foo", data="bar") # set key "foo" to "bar" """ sleeptime = _deadlock_MinSleepTime while (1) : try: return apply(function, _args, _kwargs) except _db.DBLockDeadlockError: print 'DeadlockWrap sleeping ', sleeptime _sleep(sleeptime) # exponential backoff in the sleep time sleeptime = sleeptime * 2 if sleeptime > _deadlock_MaxSleepTime : sleeptime = _deadlock_MaxSleepTime #------------------------------------------------------------------------ From loewis@users.sourceforge.net Tue Nov 19 08:12:59 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 19 Nov 2002 00:12:59 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.527,1.528 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv25969/Misc Modified Files: NEWS Log Message: Document PyBSDDB import. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.527 retrieving revision 1.528 diff -C2 -d -r1.527 -r1.528 *** NEWS 18 Nov 2002 16:27:16 -0000 1.527 --- NEWS 19 Nov 2002 08:12:57 -0000 1.528 *************** *** 303,306 **** --- 303,311 ---- ----------------- + - The PyBSDDB wrapper around the Sleepycat Berkely DB library has been + added as the package bsddb. The traditional bsddb module is still + available in source code, but not built automatically anymore, and + is now named bsddb185. + - resource.getrlimit() now returns longs instead of ints. From loewis@users.sourceforge.net Tue Nov 19 08:30:14 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 19 Nov 2002 00:30:14 -0800 Subject: [Python-checkins] python/dist/src/Modules Setup.dist,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv31470/Modules Modified Files: Setup.dist Log Message: Don't try to use unsupported DB versions. Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Setup.dist 19 Nov 2002 08:09:52 -0000 1.31 --- Setup.dist 19 Nov 2002 08:30:08 -0000 1.32 *************** *** 397,401 **** # # This requires the Sleepycat DB code, see http://www.sleepycat.com/ ! # The minimum supported version of that library is 3.0. # # Edit the variables DB and DBLIBVERto point to the db top directory --- 397,406 ---- # # This requires the Sleepycat DB code, see http://www.sleepycat.com/ ! # The earliest supported version of that library is 3.0, the latest ! # supported version is 4.0 (4.1 is specifically not supported, as that ! # changes the semantics of transactional databases). A list of available ! # releases can be found at ! # ! # http://www.sleepycat.com/update/index.html # # Edit the variables DB and DBLIBVERto point to the db top directory From loewis@users.sourceforge.net Tue Nov 19 08:30:14 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 19 Nov 2002 00:30:14 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.116,1.117 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv31470 Modified Files: setup.py Log Message: Don't try to use unsupported DB versions. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -d -r1.116 -r1.117 *** setup.py 19 Nov 2002 08:09:50 -0000 1.116 --- setup.py 19 Nov 2002 08:30:08 -0000 1.117 *************** *** 440,448 **** # order you wish to search - e.g., search for db4 before db3 db_try_this = { ! 'db4': {'libs': ('db-4.3', 'db-4.2', 'db-4.1', 'db-4.0'), ! 'libdirs': ('/usr/local/BerkeleyDB.4.3/lib', ! '/usr/local/BerkeleyDB.4.2/lib', ! '/usr/local/BerkeleyDB.4.1/lib', ! '/usr/local/BerkeleyDB.4.0/lib', '/usr/local/lib', '/usr/lib', --- 440,445 ---- # order you wish to search - e.g., search for db4 before db3 db_try_this = { ! 'db4': {'libs': ('db-4.0',), ! 'libdirs': ('/usr/local/BerkeleyDB.4.0/lib', '/usr/local/lib', '/usr/lib', *************** *** 451,458 **** '/lib', ), ! 'incdirs': ('/usr/local/BerkeleyDB.4.3/include', ! '/usr/local/BerkeleyDB.4.2/include', ! '/usr/local/BerkeleyDB.4.1/include', ! '/usr/local/BerkeleyDB.4.0/include', '/usr/local/include/db4', '/opt/sfw/include/db4', --- 448,452 ---- '/lib', ), ! 'incdirs': ('/usr/local/BerkeleyDB.4.0/include', '/usr/local/include/db4', '/opt/sfw/include/db4', From akuchling@users.sourceforge.net Tue Nov 19 13:05:36 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 05:05:36 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.69,1.70 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv11908 Modified Files: whatsnew23.tex Log Message: Add PyBSDDB update Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** whatsnew23.tex 15 Nov 2002 14:37:10 -0000 1.69 --- whatsnew23.tex 19 Nov 2002 13:05:33 -0000 1.70 *************** *** 12,17 **** % MacOS framework-related changes (section of its own, probably) - % - % xreadlines obsolete; files are their own iterator %\section{Introduction \label{intro}} --- 12,15 ---- *************** *** 1021,1024 **** --- 1019,1033 ---- (Contributed by Jason Orendorff.) + \item The \module{bsddb} module has been updated to version 3.4.0 + of the \ulink{PyBSDDB}{http://pybsddb.sourceforge.net} package, + providing a more complete interface to the transactional features of + the BerkeleyDB library. + The old version of the module has been renamed to + \module{bsddb185} and is no longer built automatically; you'll + have to edit \file{Modules/Setup} to enable it. Note that the new + \module{bsddb} package is intended to be compatible with the + old module, so be sure to file bugs if you discover any + incompatibilities. + \item The Distutils \class{Extension} class now supports an extra constructor argument named \var{depends} for listing *************** *** 1330,1333 **** --- 1339,1343 ---- $ \end{verbatim} + % $ prevent Emacs tex-mode from getting confused Optik was written by Greg Ward, with suggestions from the readers of From akuchling@users.sourceforge.net Tue Nov 19 13:09:03 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 05:09:03 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.70,1.71 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv13181 Modified Files: whatsnew23.tex Log Message: Use \ulink instead of \citetitle; bump version number Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** whatsnew23.tex 19 Nov 2002 13:05:33 -0000 1.70 --- whatsnew23.tex 19 Nov 2002 13:09:00 -0000 1.71 *************** *** 3,7 **** \title{What's New in Python 2.3} ! \release{0.03} \author{A.M. Kuchling} \authoraddress{\email{amk@amk.ca}} --- 3,7 ---- \title{What's New in Python 2.3} ! \release{0.04} \author{A.M. Kuchling} \authoraddress{\email{amk@amk.ca}} *************** *** 521,526 **** is only a partial overview of the \module{logging} package's features, so please see the ! \citetitle[http://www.python.org/dev/doc/devel/lib/module-logging.html]{\module{logging} ! package's reference documentation} for all of the details. Reading \pep{282} will also be helpful. --- 521,526 ---- is only a partial overview of the \module{logging} package's features, so please see the ! \ulink{\module{logging} package's reference documentation}{http://www.python.org/dev/doc/devel/lib/module-logging.html} ! for all of the details. Reading \pep{282} will also be helpful. *************** *** 858,865 **** this change.) Python 2.2 originally used a topological sort of a class's ancestors, but 2.3 now uses the C3 algorithm as described in ! \citetitle[http://www.webcom.com/haahr/dylan/linearization-oopsla96.html]{``A ! Monotonic Superclass Linearization for Dylan''}. To understand the ! motivation for this change, read the thread on python-dev starting ! with the message at \url{http://mail.python.org/pipermail/python-dev/2002-October/029035.html}. Samuele Pedroni first pointed out the problem and also implemented the --- 858,865 ---- this change.) Python 2.2 originally used a topological sort of a class's ancestors, but 2.3 now uses the C3 algorithm as described in ! the paper \ulink{``A Monotonic Superclass Linearization for ! Dylan''}{http://www.webcom.com/haahr/dylan/linearization-oopsla96.html}. ! To understand the motivation for this change, read the thread on ! python-dev starting with the message at \url{http://mail.python.org/pipermail/python-dev/2002-October/029035.html}. Samuele Pedroni first pointed out the problem and also implemented the From akuchling@users.sourceforge.net Tue Nov 19 13:12:30 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 05:12:30 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils __init__.py,1.22,1.23 archive_util.py,1.13,1.14 bcppcompiler.py,1.14,1.15 ccompiler.py,1.53,1.54 cmd.py,1.32,1.33 core.py,1.55,1.56 cygwinccompiler.py,1.20,1.21 debug.py,1.1,1.2 dep_util.py,1.5,1.6 dir_util.py,1.10,1.11 dist.py,1.59,1.60 errors.py,1.11,1.12 fancy_getopt.py,1.26,1.27 file_util.py,1.14,1.15 filelist.py,1.14,1.15 log.py,1.2,1.3 msvccompiler.py,1.51,1.52 mwerkscompiler.py,1.11,1.12 spawn.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv14626 Modified Files: __init__.py archive_util.py bcppcompiler.py ccompiler.py cmd.py core.py cygwinccompiler.py debug.py dep_util.py dir_util.py dist.py errors.py fancy_getopt.py file_util.py filelist.py log.py msvccompiler.py mwerkscompiler.py spawn.py Log Message: Add comment to Distutil files about requiring 1.5.2 compatibility, as suggested by PEP 291. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/__init__.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** __init__.py 5 Oct 2001 20:43:09 -0000 1.22 --- __init__.py 19 Nov 2002 13:12:26 -0000 1.23 *************** *** 9,12 **** --- 9,14 ---- """ + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: archive_util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/archive_util.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** archive_util.py 14 Nov 2002 02:25:41 -0000 1.13 --- archive_util.py 19 Nov 2002 13:12:26 -0000 1.14 *************** *** 4,7 **** --- 4,9 ---- that sort of thing).""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: bcppcompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/bcppcompiler.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** bcppcompiler.py 5 Nov 2002 16:11:52 -0000 1.14 --- bcppcompiler.py 19 Nov 2002 13:12:26 -0000 1.15 *************** *** 12,15 **** --- 12,17 ---- # WindowsCCompiler! --GPW + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: ccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/ccompiler.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** ccompiler.py 14 Nov 2002 02:25:41 -0000 1.53 --- ccompiler.py 19 Nov 2002 13:12:27 -0000 1.54 *************** *** 4,7 **** --- 4,9 ---- for the Distutils compiler abstraction model.""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: cmd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cmd.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** cmd.py 14 Nov 2002 02:25:41 -0000 1.32 --- cmd.py 19 Nov 2002 13:12:27 -0000 1.33 *************** *** 5,8 **** --- 5,10 ---- """ + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: core.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/core.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** core.py 14 Nov 2002 02:25:41 -0000 1.55 --- core.py 19 Nov 2002 13:12:27 -0000 1.56 *************** *** 7,10 **** --- 7,12 ---- """ + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: cygwinccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cygwinccompiler.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** cygwinccompiler.py 14 Nov 2002 02:25:41 -0000 1.20 --- cygwinccompiler.py 19 Nov 2002 13:12:27 -0000 1.21 *************** *** 42,45 **** --- 42,47 ---- # *** only the version of June 2000 shows these problems + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: debug.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/debug.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** debug.py 11 Sep 2002 16:28:52 -0000 1.1 --- debug.py 19 Nov 2002 13:12:27 -0000 1.2 *************** *** 1,4 **** --- 1,8 ---- import os + # This module should be kept compatible with Python 1.5.2. + + __revision__ = "$Id$" + # If DISTUTILS_DEBUG is anything other than the empty string, we run in # debug mode. Index: dep_util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dep_util.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dep_util.py 14 Nov 2002 02:25:41 -0000 1.5 --- dep_util.py 19 Nov 2002 13:12:27 -0000 1.6 *************** *** 5,8 **** --- 5,10 ---- timestamp dependency analysis.""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: dir_util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dir_util.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dir_util.py 14 Nov 2002 02:25:41 -0000 1.10 --- dir_util.py 19 Nov 2002 13:12:27 -0000 1.11 *************** *** 3,6 **** --- 3,8 ---- Utility functions for manipulating directories and directory trees.""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: dist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dist.py,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** dist.py 14 Nov 2002 02:25:41 -0000 1.59 --- dist.py 19 Nov 2002 13:12:27 -0000 1.60 *************** *** 5,8 **** --- 5,10 ---- """ + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: errors.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/errors.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** errors.py 14 Nov 2002 01:58:48 -0000 1.11 --- errors.py 19 Nov 2002 13:12:27 -0000 1.12 *************** *** 9,12 **** --- 9,14 ---- symbols whose names start with "Distutils" and end with "Error".""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: fancy_getopt.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/fancy_getopt.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** fancy_getopt.py 14 Nov 2002 02:25:41 -0000 1.26 --- fancy_getopt.py 19 Nov 2002 13:12:27 -0000 1.27 *************** *** 9,12 **** --- 9,14 ---- """ + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: file_util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/file_util.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** file_util.py 14 Nov 2002 02:25:41 -0000 1.14 --- file_util.py 19 Nov 2002 13:12:27 -0000 1.15 *************** *** 4,7 **** --- 4,9 ---- """ + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: filelist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/filelist.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** filelist.py 14 Nov 2002 02:25:41 -0000 1.14 --- filelist.py 19 Nov 2002 13:12:27 -0000 1.15 *************** *** 5,8 **** --- 5,10 ---- """ + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: log.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/log.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** log.py 4 Nov 2002 14:27:43 -0000 1.2 --- log.py 19 Nov 2002 13:12:27 -0000 1.3 *************** *** 1,4 **** --- 1,6 ---- """A simple log mechanism styled after PEP 282.""" + # This module should be kept compatible with Python 1.5.2. + # The class here is styled after PEP 282 so that it could later be # replaced with a standard Python logging implementation. Index: msvccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/msvccompiler.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** msvccompiler.py 14 Nov 2002 02:25:41 -0000 1.51 --- msvccompiler.py 19 Nov 2002 13:12:27 -0000 1.52 *************** *** 4,11 **** for the Microsoft Visual Studio.""" - # Written by Perry Stoll # hacked by Robin Becker and Thomas Heller to do a better job of # finding DevStudio (through the registry) __revision__ = "$Id$" --- 4,12 ---- for the Microsoft Visual Studio.""" # Written by Perry Stoll # hacked by Robin Becker and Thomas Heller to do a better job of # finding DevStudio (through the registry) + + # This module should be kept compatible with Python 1.5.2. __revision__ = "$Id$" Index: mwerkscompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/mwerkscompiler.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mwerkscompiler.py 5 Nov 2002 16:11:57 -0000 1.11 --- mwerkscompiler.py 19 Nov 2002 13:12:27 -0000 1.12 *************** *** 5,8 **** --- 5,12 ---- Windows.""" + # This module should be kept compatible with Python 1.5.2. + + __revision__ = "$Id$" + import sys, os, string from types import * Index: spawn.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/spawn.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** spawn.py 14 Nov 2002 02:25:41 -0000 1.14 --- spawn.py 19 Nov 2002 13:12:27 -0000 1.15 *************** *** 7,10 **** --- 7,12 ---- """ + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" From akuchling@users.sourceforge.net Tue Nov 19 13:12:31 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 05:12:31 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command __init__.py,1.16,1.17 bdist.py,1.27,1.28 bdist_dumb.py,1.21,1.22 bdist_rpm.py,1.36,1.37 bdist_wininst.py,1.42,1.43 build.py,1.33,1.34 build_clib.py,1.26,1.27 build_ext.py,1.90,1.91 build_py.py,1.40,1.41 build_scripts.py,1.17,1.18 clean.py,1.14,1.15 config.py,1.14,1.15 install.py,1.66,1.67 install_data.py,1.19,1.20 install_headers.py,1.9,1.10 install_lib.py,1.41,1.42 install_scripts.py,1.13,1.14 sdist.py,1.55,1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1:/tmp/cvs-serv14626/command Modified Files: __init__.py bdist.py bdist_dumb.py bdist_rpm.py bdist_wininst.py build.py build_clib.py build_ext.py build_py.py build_scripts.py clean.py config.py install.py install_data.py install_headers.py install_lib.py install_scripts.py sdist.py Log Message: Add comment to Distutil files about requiring 1.5.2 compatibility, as suggested by PEP 291. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/__init__.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** __init__.py 4 Oct 2002 09:23:44 -0000 1.16 --- __init__.py 19 Nov 2002 13:12:27 -0000 1.17 *************** *** 4,7 **** --- 4,9 ---- commands.""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: bdist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** bdist.py 14 Nov 2002 02:25:42 -0000 1.27 --- bdist.py 19 Nov 2002 13:12:28 -0000 1.28 *************** *** 4,7 **** --- 4,9 ---- distribution).""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: bdist_dumb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_dumb.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** bdist_dumb.py 14 Nov 2002 02:25:42 -0000 1.21 --- bdist_dumb.py 19 Nov 2002 13:12:28 -0000 1.22 *************** *** 5,8 **** --- 5,10 ---- $exec_prefix).""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: bdist_rpm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_rpm.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** bdist_rpm.py 14 Nov 2002 02:25:42 -0000 1.36 --- bdist_rpm.py 19 Nov 2002 13:12:28 -0000 1.37 *************** *** 4,7 **** --- 4,9 ---- distributions).""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_wininst.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** bdist_wininst.py 14 Nov 2002 02:25:42 -0000 1.42 --- bdist_wininst.py 19 Nov 2002 13:12:28 -0000 1.43 *************** *** 4,7 **** --- 4,9 ---- exe-program.""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: build.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** build.py 14 Nov 2002 02:25:42 -0000 1.33 --- build.py 19 Nov 2002 13:12:28 -0000 1.34 *************** *** 3,6 **** --- 3,8 ---- Implements the Distutils 'build' command.""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: build_clib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_clib.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** build_clib.py 14 Nov 2002 02:25:42 -0000 1.26 --- build_clib.py 19 Nov 2002 13:12:28 -0000 1.27 *************** *** 5,8 **** --- 5,10 ---- module.""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: build_ext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_ext.py,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** build_ext.py 14 Nov 2002 02:25:42 -0000 1.90 --- build_ext.py 19 Nov 2002 13:12:28 -0000 1.91 *************** *** 5,8 **** --- 5,10 ---- extensions ASAP).""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: build_py.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_py.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** build_py.py 14 Nov 2002 02:25:42 -0000 1.40 --- build_py.py 19 Nov 2002 13:12:28 -0000 1.41 *************** *** 3,6 **** --- 3,8 ---- Implements the Distutils 'build_py' command.""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: build_scripts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_scripts.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** build_scripts.py 14 Nov 2002 02:25:42 -0000 1.17 --- build_scripts.py 19 Nov 2002 13:12:28 -0000 1.18 *************** *** 3,6 **** --- 3,8 ---- Implements the Distutils 'build_scripts' command.""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: clean.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/clean.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** clean.py 6 Jun 2002 14:54:56 -0000 1.14 --- clean.py 19 Nov 2002 13:12:28 -0000 1.15 *************** *** 5,8 **** --- 5,10 ---- # contributed by Bastian Kleineidam , added 2000-03-18 + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: config.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/config.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** config.py 14 Nov 2002 02:25:42 -0000 1.14 --- config.py 19 Nov 2002 13:12:28 -0000 1.15 *************** *** 10,13 **** --- 10,15 ---- """ + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: install.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install.py,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** install.py 14 Nov 2002 02:25:42 -0000 1.66 --- install.py 19 Nov 2002 13:12:28 -0000 1.67 *************** *** 5,8 **** --- 5,10 ---- from distutils import log + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: install_data.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install_data.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** install_data.py 4 Sep 2001 20:42:08 -0000 1.19 --- install_data.py 19 Nov 2002 13:12:28 -0000 1.20 *************** *** 6,9 **** --- 6,11 ---- # contributed by Bastian Kleineidam + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: install_headers.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install_headers.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** install_headers.py 14 Nov 2002 02:25:42 -0000 1.9 --- install_headers.py 19 Nov 2002 13:12:28 -0000 1.10 *************** *** 4,7 **** --- 4,9 ---- files to the Python include directory.""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: install_lib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install_lib.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** install_lib.py 14 Nov 2002 02:25:42 -0000 1.41 --- install_lib.py 19 Nov 2002 13:12:28 -0000 1.42 *************** *** 1,2 **** --- 1,4 ---- + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: install_scripts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install_scripts.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** install_scripts.py 4 Jun 2002 20:30:10 -0000 1.13 --- install_scripts.py 19 Nov 2002 13:12:28 -0000 1.14 *************** *** 6,9 **** --- 6,11 ---- # contributed by Bastian Kleineidam + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" Index: sdist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/sdist.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** sdist.py 14 Nov 2002 02:25:42 -0000 1.55 --- sdist.py 19 Nov 2002 13:12:28 -0000 1.56 *************** *** 3,6 **** --- 3,8 ---- Implements the Distutils 'sdist' command (create a source distribution).""" + # This module should be kept compatible with Python 1.5.2. + __revision__ = "$Id$" From akuchling@users.sourceforge.net Tue Nov 19 13:31:19 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 05:31:19 -0800 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.102,1.103 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv22331 Modified Files: Makefile.pre.in Log Message: Add Lib/bsddb to list of installed directories Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** Makefile.pre.in 14 Nov 2002 04:56:09 -0000 1.102 --- Makefile.pre.in 19 Nov 2002 13:31:16 -0000 1.103 *************** *** 612,616 **** XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax LIBSUBDIRS= lib-old lib-tk site-packages test test/output test/data \ ! encodings email compiler hotshot logging \ distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS) libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR) --- 612,616 ---- XMLLIBSUBDIRS= xml xml/dom xml/parsers xml/sax LIBSUBDIRS= lib-old lib-tk site-packages test test/output test/data \ ! encodings email compiler hotshot logging bsddb \ distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS) libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR) From akuchling@users.sourceforge.net Tue Nov 19 14:22:11 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 06:22:11 -0800 Subject: [Python-checkins] distutils TODO,1.11,1.12 Message-ID: Update of /cvsroot/python/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv8057 Modified Files: TODO Log Message: Updated file Index: TODO =================================================================== RCS file: /cvsroot/python/distutils/TODO,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TODO 24 Jul 2001 18:37:15 -0000 1.11 --- TODO 19 Nov 2002 14:22:09 -0000 1.12 *************** *** 20,25 **** any others that people suggest. ! * think about a database of installed packages (perhaps the simple ! directory/file structure mentioned at IPC9) [Thomas Heller] --- 20,24 ---- any others that people suggest. ! * add Richard Jones' register command. [Thomas Heller] *************** *** 234,241 **** -------------------- - * figure out why bdist_rpm doesn't work with RPM 2.x, and make it work if - possible - [punt: I don't care anymore, if anyone else does, let them fix it] - * bdist_rpm ignores the Python you ran it with, and just puts "python setup.py ..." into the setup script --- 233,236 ---- *************** *** 245,251 **** reinitialize, refinalize, and (presumably) rerun commands [done 2000/06/06 GPW] - - * Solaris pkgtool, HP depot - [Mark Alexander is working on these] * minimal Windows installer ("bdist_wininst") --- 240,243 ---- From akuchling@users.sourceforge.net Tue Nov 19 14:22:56 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 06:22:56 -0800 Subject: [Python-checkins] distutils CHANGES.txt,1.21,1.22 Message-ID: Update of /cvsroot/python/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv8315 Modified Files: CHANGES.txt Log Message: Updated file Index: CHANGES.txt =================================================================== RCS file: /cvsroot/python/distutils/CHANGES.txt,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** CHANGES.txt 3 May 2001 22:30:38 -0000 1.21 --- CHANGES.txt 19 Nov 2002 14:22:54 -0000 1.22 *************** *** 1,2 **** --- 1,18 ---- + Relase 1.0.3 (24 November, 2002): + --------------------------------- + + * Pete Shinners discovered that zipfile.ZipFile() is called with mode + argument "wb", while the only valid modes are "r", "w" or "a". + Fixed this by changing the mode to "w". + + * bdist_rpm now prefers to use 'rpmbuild' over 'rpm'. + + * added preprocess() method for Borland C compiler (untested). + + * fixes for Cygwin and MacOS X. + + * various bugfixes. + + Relase 1.0.2 (20 April, 2001): ------------------------------ From akuchling@users.sourceforge.net Tue Nov 19 14:26:20 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 06:26:20 -0800 Subject: [Python-checkins] distutils README.txt,1.25,1.26 Message-ID: Update of /cvsroot/python/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv9968 Modified Files: README.txt Log Message: Bump version to 1.0.3; reword sentence about docs Index: README.txt =================================================================== RCS file: /cvsroot/python/distutils/README.txt,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** README.txt 15 May 2002 21:05:49 -0000 1.25 --- README.txt 19 Nov 2002 14:26:18 -0000 1.26 *************** *** 1,5 **** Python Distribution Utilities ! release 1.0.2 ! April 20th, 2001 --- 1,5 ---- Python Distribution Utilities ! release 1.0.3 ! November 24th, 2002 *************** *** 120,124 **** 2.0 1.0.1 2.1 1.0.2 ! There's generally no need to install the Distutils under Python 1.6/2.0/2.1. However, if you'd like to upgrade the Distutils in your --- 120,125 ---- 2.0 1.0.1 2.1 1.0.2 ! 2.2 1.0.3 ! There's generally no need to install the Distutils under Python 1.6/2.0/2.1. However, if you'd like to upgrade the Distutils in your *************** *** 156,169 **** an installer created by some kind packager). ! Documentation for the Distutils is under construction in the form of ! two manuals, "Installing Python Modules" (for installers) and ! "Distributing Python Modules" (for developers and packagers). I've ! included the LaTeX source for these two manuals in the "doc" ! subdirectory; if you know your way around LaTeX, the Python ! documentation tools, and Unix, you might be able to get something out ! of these. Realistically, though, the documentation is just provided ! in the distribution so you can send me doc patches; if you want to ! read it, you're better off reading them in the standard Python ! documentation set at: http://www.python.org/doc/current/ --- 157,169 ---- an installer created by some kind packager). ! Documentation for the Distutils is in the form of two manuals, ! "Installing Python Modules" (for installers) and "Distributing Python ! Modules" (for developers and packagers). I've included the LaTeX ! source for these two manuals in the "doc" subdirectory; if you know ! your way around LaTeX, the Python documentation tools, and Unix, you ! might be able to get something out of these. Realistically, though, ! the documentation is just provided in the distribution so you can send ! me doc patches; if you want to read it, you're better off reading them ! in the standard Python documentation set at: http://www.python.org/doc/current/ From akuchling@users.sourceforge.net Tue Nov 19 14:29:37 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 06:29:37 -0800 Subject: [Python-checkins] distutils setup.py,1.31,1.32 Message-ID: Update of /cvsroot/python/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv11254 Modified Files: setup.py Log Message: Remove 'created by' line Index: setup.py =================================================================== RCS file: /cvsroot/python/distutils/setup.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** setup.py 5 Oct 2001 20:42:36 -0000 1.31 --- setup.py 19 Nov 2002 14:29:35 -0000 1.32 *************** *** 5,10 **** # exercise all of the Distutils' features!) - # created 1999/03 Greg Ward - __revision__ = "$Id$" --- 5,8 ---- From akuchling@users.sourceforge.net Tue Nov 19 14:31:24 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 06:31:24 -0800 Subject: [Python-checkins] distutils mksnap,1.7,NONE Message-ID: Update of /cvsroot/python/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv11878 Removed Files: mksnap Log Message: Remove outdated script --- mksnap DELETED --- From akuchling@users.sourceforge.net Tue Nov 19 14:35:16 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 06:35:16 -0800 Subject: [Python-checkins] distutils USAGE.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv13480 Modified Files: USAGE.txt Log Message: Update file Index: USAGE.txt =================================================================== RCS file: /cvsroot/python/distutils/USAGE.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** USAGE.txt 12 Apr 2000 01:40:04 -0000 1.6 --- USAGE.txt 19 Nov 2002 14:35:14 -0000 1.7 *************** *** 8,14 **** If you don't feel like wrestling LaTeX and the Python documentation tools into submission, you can find PDF, PostScript, and HTML versions ! of these manuals at the Distutils documentation page: ! http://www.python.org/sigs/distutils-sig/doc/ Not all of the information that was formerly in this file is in those --- 8,14 ---- If you don't feel like wrestling LaTeX and the Python documentation tools into submission, you can find PDF, PostScript, and HTML versions ! of these manuals at the Python documentation page: ! http://www.python.org/doc/current/ Not all of the information that was formerly in this file is in those *************** *** 16,20 **** patches to the LaTeX source) are welcome. ! Mail documentation patches to me: Greg Ward $Id$ --- 16,20 ---- patches to the LaTeX source) are welcome. ! Please submit documentation patches via SourceForge. $Id$ From akuchling@users.sourceforge.net Tue Nov 19 14:37:47 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 06:37:47 -0800 Subject: [Python-checkins] distutils/doc README.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/distutils/doc In directory sc8-pr-cvs1:/tmp/cvs-serv14515 Modified Files: README.txt Log Message: Update file (sheesh, how many links to the docs *are* there?) Index: README.txt =================================================================== RCS file: /cvsroot/python/distutils/doc/README.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** README.txt 3 Oct 2000 03:46:11 -0000 1.3 --- README.txt 19 Nov 2002 14:37:45 -0000 1.4 *************** *** 7,20 **** the rest of the world in the standard way) ! These manuals are a standard part of the Python 2.0 documentation set, and are tightly integrated with the standard Python documentation tools. That means that you won't be able to process the LaTeX files here without downloading the latest Python documentation tools. ! Since these two manuals are now included with the Python documentation ! (CVS version as of 28 April 2000), there's really not much point in ! trying to process the manuals provided here. You're better off checking ! out the latest Python documentation -- which is included in the Python ! source, when you access it via CVS -- and starting from there. For information on getting access to the Python source and documentation --- 7,20 ---- the rest of the world in the standard way) ! These manuals are a standard part of the Python documentation set, and are tightly integrated with the standard Python documentation tools. That means that you won't be able to process the LaTeX files here without downloading the latest Python documentation tools. ! Since these two manuals are now included with the Python documentation, ! there's really not much point in trying to process the manuals provided ! here. You're better off checking out the latest Python documentation -- ! which is included in the Python source, when you access it via CVS -- and ! starting from there. For information on getting access to the Python source and documentation *************** *** 24,28 **** If all you really want to do is *read* the documentation, you don't need to process it yourself: see ! http://www.python.org/sigs/distutils-sig/doc/ ! for access to the (roughly) current Distutils documentation, in ! PDF, PostScript, and HTML. --- 24,28 ---- If all you really want to do is *read* the documentation, you don't need to process it yourself: see ! http://www.python.org/doc/current/ ! for access to the current Distutils documentation, in PDF, PostScript, ! and HTML. From akuchling@users.sourceforge.net Tue Nov 19 14:42:23 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 06:42:23 -0800 Subject: [Python-checkins] distutils/test test_fgo.py,1.1,1.2 Message-ID: Update of /cvsroot/python/distutils/test In directory sc8-pr-cvs1:/tmp/cvs-serv16511 Modified Files: test_fgo.py Log Message: Fix import (but this test still doesn't work) Index: test_fgo.py =================================================================== RCS file: /cvsroot/python/distutils/test/test_fgo.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_fgo.py 12 Dec 1999 23:17:42 -0000 1.1 --- test_fgo.py 19 Nov 2002 14:42:21 -0000 1.2 *************** *** 5,9 **** from string import split ! from distutils.exceptions import * from distutils.fancy_getopt import fancy_getopt --- 5,9 ---- from string import split ! from distutils.errors import * from distutils.fancy_getopt import fancy_getopt From akuchling@users.sourceforge.net Tue Nov 19 14:44:35 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 06:44:35 -0800 Subject: [Python-checkins] distutils/test README.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/distutils/test In directory sc8-pr-cvs1:/tmp/cvs-serv17455 Added Files: README.txt Log Message: Note that most tests are broken --- NEW FILE: README.txt --- In version 1.0.3 of the Distutils, these test suites are mostly not working, except for test_changeroot, test_split, and test_version. From akuchling@users.sourceforge.net Tue Nov 19 14:50:35 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 06:50:35 -0800 Subject: [Python-checkins] distutils TODO,1.12,1.13 Message-ID: Update of /cvsroot/python/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv19529 Modified Files: TODO Log Message: Add todo list for 1.0.4/Python 2.3 Remove more irrelevant items Index: TODO =================================================================== RCS file: /cvsroot/python/distutils/TODO,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TODO 19 Nov 2002 14:22:09 -0000 1.12 --- TODO 19 Nov 2002 14:50:33 -0000 1.13 *************** *** 1,2 **** --- 1,13 ---- + DISTUTILS 1.0.4 PLANS + --------------------- + + * fix bdist_dumb + + * get the test suites running again + + * add Richard Jones' register command. + + + DISTUTILS 1.1 PLANS ------------------- *************** *** 20,25 **** any others that people suggest. - * add Richard Jones' register command. - [Thomas Heller] * extend the install_* commands so that they write uninstall --- 31,34 ---- *************** *** 41,52 **** windows installer, but nothing more) - [Paul Moore] - * Change default install location for Mac to site-packages - (to match what site.py in 2.1 does) [I have no personal - interest in Macs, this just seems sensible] - - * Change default install location on Windows to site-packages - (if Paul Moore's PEP on this subject - unnumbered as yet - gets accepted) - GENERAL --- 50,53 ---- *************** *** 64,70 **** build are the right way, so those should be preferred) - * should also allow overriding LDSHARED (eg. for Python 1.5 under Solaris), - maybe CC - * install_data should install to $prefix by default, not $prefix/share (and should warn if developer doesn't supply any dir component: --- 65,68 ---- *************** *** 87,113 **** * write write write - * include a standard blurb for README files somewhere - PATCH REVIEW/INTEGRATION ------------------------ ! * review Rene Liebscher's patch for help options: he changed ! archive_util.py ! ccompiler.py ! command/bdist.py ! command/build.py ! command/build_clib.py ! command/build_ext.py ! command/sdist.py ! dist.py ! ...and I checked 'em all in without review because I want ! other people to try it out and I don't have time to review ! it right now (and he fixed a stupid bug in bdist.py for me) ! [done 2000/06/23 GPW] ! ! * review Rene Liebscher's cygwinccompiler.py contribution ! [started and aborted, 2000/06/24 GPW; asked Rene to resubmit patch ! with stylistic changes] --- 85,93 ---- * write write write PATCH REVIEW/INTEGRATION ------------------------ ! * nothing at this point *************** *** 154,163 **** temporary compile and link steps] - * Cygwin/Mingw32 support - [Rene Liebscher is working on this] - - * Borland C++ support - [Lyle Johnson is working on this] - * Unix: -g comes from Makefile, and is unaffected by --debug or lack thereof (I think --debug is ignored by UnixCCompiler) --- 134,137 ---- *************** *** 240,246 **** reinitialize, refinalize, and (presumably) rerun commands [done 2000/06/06 GPW] - - * minimal Windows installer ("bdist_wininst") - [Thomas Heller is working on this] * Wise installer for Windows ("bdist_wise") --- 214,217 ---- From akuchling@users.sourceforge.net Tue Nov 19 14:52:30 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 06:52:30 -0800 Subject: [Python-checkins] distutils MANIFEST.in,1.11,1.12 Message-ID: Update of /cvsroot/python/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv20170 Modified Files: MANIFEST.in Log Message: Remove 'created by' line Index: MANIFEST.in =================================================================== RCS file: /cvsroot/python/distutils/MANIFEST.in,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** MANIFEST.in 3 Oct 2000 03:47:29 -0000 1.11 --- MANIFEST.in 19 Nov 2002 14:52:28 -0000 1.12 *************** *** 4,9 **** # Manifest template for creating the Distutils source distribution. # - # created 2000/02/14, Greg Ward - # # $Id$ # --- 4,7 ---- From akuchling@users.sourceforge.net Tue Nov 19 15:01:54 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 07:01:54 -0800 Subject: [Python-checkins] distutils CHECKLIST,NONE,1.1 Message-ID: Update of /cvsroot/python/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv23250 Added Files: CHECKLIST Log Message: Add release checklist --- NEW FILE: CHECKLIST --- Release checklist ----------------- * Update CHANGES.txt * Update README.txt with the current version number * Update setup.py with the current version number * To make a snapshot, run "./snapshot_setup.py sdist". * To make a final release, run "./setup.py sdist". * Copy the files to www.python.org:/usr/local/WWW/www.python.org/sigs/distutils-sig/download/ * For a final release, update download.html with the current stable version From loewis@users.sourceforge.net Tue Nov 19 17:10:30 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 19 Nov 2002 09:10:30 -0800 Subject: [Python-checkins] python/dist/src/Lib/bsddb/test - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb/test In directory sc8-pr-cvs1:/tmp/cvs-serv13784/Lib/bsddb/test Log Message: Directory /cvsroot/python/python/dist/src/Lib/bsddb/test added to the repository From tim_one@users.sourceforge.net Tue Nov 19 17:38:30 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 19 Nov 2002 09:38:30 -0800 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.105,1.106 readme.txt,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv26560/python/PCbuild Modified Files: python20.wse readme.txt Log Message: Renamed Wise vrbl from _TCLMINOR_ to _TCLDIR_, to remove any script dependence on the Tcl/Tk version number. Now you point it at the Tcl/Tk install you want to ship, and that's what it ships. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** python20.wse 14 Nov 2002 23:24:40 -0000 1.105 --- python20.wse 19 Nov 2002 17:38:26 -0000 1.106 *************** *** 31,37 **** Variable Default1=C:\PROGRAM FILES\WISE INSTALLMASTER 8.1 Variable Flags1=00001000 ! Variable Name2=_TCLMINOR_ ! Variable Description2=Tcl/Tk Minor Version (e.g. the "4" in "8.4.1") ! Variable Default2=4 Variable Flags2=00001000 Variable Name3=_DOC_ --- 31,39 ---- Variable Default1=C:\PROGRAM FILES\WISE INSTALLMASTER 8.1 Variable Flags1=00001000 ! Variable Name2=_TCLDIR_ ! Variable Description2=The directory in which the Tcl/Tk installation ! Variable Description2=lives. This must be a sibling of the Python ! Variable Description2=directory. ! Variable Default2=tcl84 Variable Flags2=00001000 Variable Name3=_DOC_ *************** *** 95,98 **** --- 97,108 ---- item: Remark end + item: Remark + Text=When the version of Tcl/Tk changes, the compiler vrbl + end + item: Remark + Text=_TCLDIR_ may also need to be changed. + end + item: Remark + end item: Set Variable Variable=APPTITLE *************** *** 2049,2065 **** end item: Install File ! Source=..\..\tcl84\bin\tcl8%_tclminor_%.dll ! Destination=%MAINDIR%\DLLs\tcl8%_TCLMINOR_%.dll ! Description=Tcl/Tk binaries and libraries ! Flags=0000000000000010 ! end ! item: Install File ! Source=..\..\tcl84\bin\tk8%_tclminor_%.dll ! Destination=%MAINDIR%\DLLs\tk8%_TCLMINOR_%.dll Description=Tcl/Tk binaries and libraries Flags=0000000000000010 end item: Install File ! Source=..\..\tcl84\lib\*.* Destination=%MAINDIR%\tcl Description=Tcl/Tk binaries and libraries --- 2059,2069 ---- end item: Install File ! Source=..\..\%_tcldir_%\bin\*.dll ! Destination=%MAINDIR%\DLLs Description=Tcl/Tk binaries and libraries Flags=0000000000000010 end item: Install File ! Source=..\..\%_tcldir_%\lib\*.* Destination=%MAINDIR%\tcl Description=Tcl/Tk binaries and libraries Index: readme.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/readme.txt,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** readme.txt 15 Nov 2002 18:36:11 -0000 1.27 --- readme.txt 19 Nov 2002 17:38:27 -0000 1.28 *************** *** 98,108 **** XXX Some tests failed in "nmake -f makefile.vc test". - XXX Should rename destination directory to something more generic - XXX then tcl84. But unless I can backport 8.4.1 to the 2.2 line - XXX too, I've got to be able to build using more than one Tcl/Tk - XXX release, and that effectively reserves the "tcl" directory name - XXX for the duration. Nothing that requires thought is going to - XXX work when it comes to release crunch times. - Build Tk -------- --- 98,101 ---- *************** *** 117,120 **** --- 110,120 ---- XXX Our installer copies a lot of stuff out of the Tcl/Tk install XXX directory. Is all of that really needed for Python use of Tcl/Tk? + + Make sure the installer matches + ------------------------------- + Ensure that the Wise compiler vrbl _TCLDIR_ is set to the name of + the common Tcl/Tk installation directory (tcl84 for the instructions + above). This is needed so the installer can copy various Tcl/Tk + files into the Python distribution. From gvanrossum@users.sourceforge.net Tue Nov 19 17:41:43 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 19 Nov 2002 09:41:43 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.py,1.61,1.62 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv30549 Modified Files: datetime.py Log Message: Bunch of changes related to timetuple() etc.: - Rip out the basetime class. - Classes date and datetime should not support utctimetuple(); only datetimetz does. - Get rid of _mktime() method. - Implement date.timetuple() and datetime.timetuple() without using the time module. One caveat: the tm_yday field is currently left zero. Maybe Tim can show me how to implement it. This goes into internal method _jday(). - Implement datetimetz. utctimetuple() without using the time module. We construct a naive time from our data and a timedelta from the utc offset, subtract them, and get the timetuple() of the result. All this passes the test suite, but I've got a feeling some things aren't properly tested. Index: datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.py,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** datetime.py 7 Nov 2002 16:20:36 -0000 1.61 --- datetime.py 19 Nov 2002 17:41:40 -0000 1.62 *************** *** 249,272 **** - # XXX I don't think we should use this. Let's rip it out. - class basetime(object): - """Abstract date/time type. - - See http://effbot.org/ideas/time-type.htm - """ - - def timetuple(self): - raise NotImplementedError - - def utctimetuple(self): - raise NotImplementedError - - def __cmp__(self, other): - raise NotImplementedError - - def __hash__(self): - raise NotImplementedError - - class timedelta(object): """Represent the difference between two datetime objects. --- 249,252 ---- *************** *** 487,491 **** ! class date(basetime): """Concrete date type. --- 467,471 ---- ! class date(object): """Concrete date type. *************** *** 505,509 **** Methods: ! timetuple(), utctimetuple() toordinal() weekday(), isoweekday(), isocalendar() --- 485,489 ---- Methods: ! timetuple() toordinal() weekday(), isoweekday(), isocalendar() *************** *** 578,591 **** # Standard conversions, __cmp__, __hash__ (and helpers) ! # XXX These should be done without reference to the time module ! def _mktime(self): ! # Helper to return a POSIX-ish timestamp ! t = tmxxx(self.__year, self.__month, self.__day) ! return t.time() def timetuple(self): "Return local time tuple compatible with time.localtime()." ! return _time.localtime(self._mktime()) def toordinal(self): --- 558,572 ---- # Standard conversions, __cmp__, __hash__ (and helpers) ! def _yday(self): ! """Return tm_yday: day within the current year, where Jan 1 == 1. ! XXX This is not correct for now. Who cares. ! """ ! return 0 def timetuple(self): "Return local time tuple compatible with time.localtime()." ! return (self.__year, self.__month, self.__day, ! 0, 0, 0, self.weekday(), self._yday(), -1) def toordinal(self): *************** *** 624,628 **** def strftime(self, fmt): "Format using strftime()." ! return _time.strftime(fmt, _time.localtime(self._mktime())) # Computations --- 605,609 ---- def strftime(self, fmt): "Format using strftime()." ! return _time.strftime(fmt, self.timetuple()) # Computations *************** *** 734,738 **** Methods: ! timetuple(), utctimetuple() ctime() strftime() --- 715,719 ---- Methods: ! timetuple() ctime() strftime() *************** *** 824,839 **** # Standard conversions, __cmp__, __hash__ (and helpers) ! # XXX These should be done without reference to the time module ! ! def _mktime(self): ! # Helper to return a POSIX-ish timestamp ! t = tmxxx(self.__year, self.__month, self.__day, ! self.__hour, self.__minute, self.__second, ! self.__microsecond) ! return t.time() ! ! def utctimetuple(self): ! "Return UTC time tuple compatible with time.gmtime()." ! return _time.gmtime(self._mktime()) def __cmp__(self, other): --- 805,813 ---- # Standard conversions, __cmp__, __hash__ (and helpers) ! def timetuple(self): ! "Return local time tuple compatible with time.localtime()." ! return (self.__year, self.__month, self.__day, ! self.__hour, self.__minute, self.__second, ! self.weekday(), self._yday(), -1) def __cmp__(self, other): *************** *** 954,957 **** --- 928,958 ---- tzinfo = property(lambda self: self.__tzinfo, doc="timezone info object") + + def fromtimestamp(cls, t, tzinfo=None): + """Construct a datetimetz from a POSIX timestamp (like time.time()). + + A timezone info object may be passed in as well. + """ + y, m, d, hh, mm, ss, weekday, jday, dst = _time.localtime(t) + us = int((t % 1.0) * 1000000) + return cls(y, m, d, hh, mm, ss, us, tzinfo) + fromtimestamp = classmethod(fromtimestamp) + + def now(cls, tzinfo=None): + "Construct a datetime from time.time() and optional time zone info." + t = _time.time() + return cls.fromtimestamp(t, tzinfo) + now = classmethod(now) + + def utctimetuple(self): + "Return UTC time tuple compatible with time.gmtime()." + offset = self.utcoffset() + if not offset: # Either None or 0 + return self.timetuple() + ts = datetime(self.year, self.month, self.day, + self.hour, self.minute, self.second, + self.microsecond) + dt = timedelta(minutes=offset) + return (ts - dt).timetuple() def isoformat(self, sep=' '): From loewis@users.sourceforge.net Tue Nov 19 17:47:09 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 19 Nov 2002 09:47:09 -0800 Subject: [Python-checkins] python/dist/src/Lib/bsddb/test __init__.py,NONE,1.1 test_associate.py,NONE,1.1 test_basics.py,NONE,1.1 test_compat.py,NONE,1.1 test_dbobj.py,NONE,1.1 test_dbshelve.py,NONE,1.1 test_dbtables.py,NONE,1.1 test_env_close.py,NONE,1.1 test_get_none.py,NONE,1.1 test_join.py,NONE,1.1 test_lock.py,NONE,1.1 test_misc.py,NONE,1.1 test_queue.py,NONE,1.1 test_recno.py,NONE,1.1 test_thread.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb/test In directory sc8-pr-cvs1:/tmp/cvs-serv32371/Lib/bsddb/test Added Files: __init__.py test_associate.py test_basics.py test_compat.py test_dbobj.py test_dbshelve.py test_dbtables.py test_env_close.py test_get_none.py test_join.py test_lock.py test_misc.py test_queue.py test_recno.py test_thread.py Log Message: Importing test suite from bsddb3 3.4.0 (with modifications). --- NEW FILE: __init__.py --- # PyBSDDB test suite --- NEW FILE: test_associate.py --- """ TestCases for multi-threaded access to a DB. """ import sys, os, string import tempfile import time from pprint import pprint try: from threading import Thread, currentThread have_threads = 1 except ImportError: have_threads = 0 import unittest from test.test_support import verbose from bsddb import db, dbshelve #---------------------------------------------------------------------- musicdata = { 1 : ("Bad English", "The Price Of Love", "Rock"), 2 : ("DNA featuring Suzanne Vega", "Tom's Diner", "Rock"), 3 : ("George Michael", "Praying For Time", "Rock"), 4 : ("Gloria Estefan", "Here We Are", "Rock"), 5 : ("Linda Ronstadt", "Don't Know Much", "Rock"), 6 : ("Michael Bolton", "How Am I Supposed To Live Without You", "Blues"), 7 : ("Paul Young", "Oh Girl", "Rock"), 8 : ("Paula Abdul", "Opposites Attract", "Rock"), 9 : ("Richard Marx", "Should've Known Better", "Rock"), 10: ("Rod Stewart", "Forever Young", "Rock"), 11: ("Roxette", "Dangerous", "Rock"), 12: ("Sheena Easton", "The Lover In Me", "Rock"), 13: ("Sinead O'Connor", "Nothing Compares 2 U", "Rock"), 14: ("Stevie B.", "Because I Love You", "Rock"), 15: ("Taylor Dayne", "Love Will Lead You Back", "Rock"), 16: ("The Bangles", "Eternal Flame", "Rock"), 17: ("Wilson Phillips", "Release Me", "Rock"), 18: ("Billy Joel", "Blonde Over Blue", "Rock"), 19: ("Billy Joel", "Famous Last Words", "Rock"), 20: ("Billy Joel", "Lullabye (Goodnight, My Angel)", "Rock"), 21: ("Billy Joel", "The River Of Dreams", "Rock"), 22: ("Billy Joel", "Two Thousand Years", "Rock"), 23: ("Janet Jackson", "Alright", "Rock"), 24: ("Janet Jackson", "Black Cat", "Rock"), 25: ("Janet Jackson", "Come Back To Me", "Rock"), 26: ("Janet Jackson", "Escapade", "Rock"), 27: ("Janet Jackson", "Love Will Never Do (Without You)", "Rock"), 28: ("Janet Jackson", "Miss You Much", "Rock"), 29: ("Janet Jackson", "Rhythm Nation", "Rock"), 30: ("Janet Jackson", "State Of The World", "Rock"), 31: ("Janet Jackson", "The Knowledge", "Rock"), 32: ("Spyro Gyra", "End of Romanticism", "Jazz"), 33: ("Spyro Gyra", "Heliopolis", "Jazz"), 34: ("Spyro Gyra", "Jubilee", "Jazz"), 35: ("Spyro Gyra", "Little Linda", "Jazz"), 36: ("Spyro Gyra", "Morning Dance", "Jazz"), 37: ("Spyro Gyra", "Song for Lorraine", "Jazz"), 38: ("Yes", "Owner Of A Lonely Heart", "Rock"), 39: ("Yes", "Rhythm Of Love", "Rock"), 40: ("Cusco", "Dream Catcher", "New Age"), 41: ("Cusco", "Geronimos Laughter", "New Age"), 42: ("Cusco", "Ghost Dance", "New Age"), 43: ("Blue Man Group", "Drumbone", "New Age"), 44: ("Blue Man Group", "Endless Column", "New Age"), 45: ("Blue Man Group", "Klein Mandelbrot", "New Age"), 46: ("Kenny G", "Silhouette", "Jazz"), 47: ("Sade", "Smooth Operator", "Jazz"), 48: ("David Arkenstone", "Papillon (On The Wings Of The Butterfly)", "New Age"), 49: ("David Arkenstone", "Stepping Stars", "New Age"), 50: ("David Arkenstone", "Carnation Lily Lily Rose", "New Age"), 51: ("David Lanz", "Behind The Waterfall", "New Age"), 52: ("David Lanz", "Cristofori's Dream", "New Age"), 53: ("David Lanz", "Heartsounds", "New Age"), 54: ("David Lanz", "Leaves on the Seine", "New Age"), } #---------------------------------------------------------------------- class AssociateTestCase(unittest.TestCase): keytype = '' def setUp(self): self.filename = self.__class__.__name__ + '.db' homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') self.homeDir = homeDir try: os.mkdir(homeDir) except os.error: pass self.env = db.DBEnv() self.env.open(homeDir, db.DB_CREATE | db.DB_INIT_MPOOL | db.DB_INIT_LOCK | db.DB_THREAD) def tearDown(self): self.closeDB() self.env.close() import glob files = glob.glob(os.path.join(self.homeDir, '*')) for file in files: os.remove(file) def addDataToDB(self, d): for key, value in musicdata.items(): if type(self.keytype) == type(''): key = "%02d" % key d.put(key, string.join(value, '|')) def createDB(self): self.primary = db.DB(self.env) self.primary.open(self.filename, "primary", self.dbtype, db.DB_CREATE | db.DB_THREAD) def closeDB(self): self.primary.close() def getDB(self): return self.primary def test01_associateWithDB(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_associateWithDB..." % self.__class__.__name__ self.createDB() secDB = db.DB(self.env) secDB.set_flags(db.DB_DUP) secDB.open(self.filename, "secondary", db.DB_BTREE, db.DB_CREATE | db.DB_THREAD) self.getDB().associate(secDB, self.getGenre) self.addDataToDB(self.getDB()) self.finish_test(secDB) def test02_associateAfterDB(self): if verbose: print '\n', '-=' * 30 print "Running %s.test02_associateAfterDB..." % self.__class__.__name__ self.createDB() self.addDataToDB(self.getDB()) secDB = db.DB(self.env) secDB.set_flags(db.DB_DUP) secDB.open(self.filename, "secondary", db.DB_BTREE, db.DB_CREATE | db.DB_THREAD) # adding the DB_CREATE flag will cause it to index existing records self.getDB().associate(secDB, self.getGenre, db.DB_CREATE) self.finish_test(secDB) def finish_test(self, secDB): if verbose: print "Primary key traversal:" c = self.getDB().cursor() count = 0 rec = c.first() while rec is not None: if type(self.keytype) == type(''): assert string.atoi(rec[0]) # for primary db, key is a number else: assert rec[0] and type(rec[0]) == type(0) count = count + 1 if verbose: print rec rec = c.next() assert count == len(musicdata) # all items accounted for if verbose: print "Secondary key traversal:" c = secDB.cursor() count = 0 rec = c.first() assert rec[0] == "Jazz" while rec is not None: count = count + 1 if verbose: print rec rec = c.next() assert count == len(musicdata)-1 # all items accounted for EXCEPT for 1 with "Blues" genre def getGenre(self, priKey, priData): assert type(priData) == type("") if verbose: print 'getGenre key:', `priKey`, 'data:', `priData` genre = string.split(priData, '|')[2] if genre == 'Blues': return db.DB_DONOTINDEX else: return genre #---------------------------------------------------------------------- class AssociateHashTestCase(AssociateTestCase): dbtype = db.DB_HASH class AssociateBTreeTestCase(AssociateTestCase): dbtype = db.DB_BTREE class AssociateRecnoTestCase(AssociateTestCase): dbtype = db.DB_RECNO keytype = 0 #---------------------------------------------------------------------- class ShelveAssociateTestCase(AssociateTestCase): def createDB(self): self.primary = dbshelve.open(self.filename, dbname="primary", dbenv=self.env, filetype=self.dbtype) def addDataToDB(self, d): for key, value in musicdata.items(): if type(self.keytype) == type(''): key = "%02d" % key d.put(key, value) # save the value as is this time def getGenre(self, priKey, priData): assert type(priData) == type(()) if verbose: print 'getGenre key:', `priKey`, 'data:', `priData` genre = priData[2] if genre == 'Blues': return db.DB_DONOTINDEX else: return genre class ShelveAssociateHashTestCase(ShelveAssociateTestCase): dbtype = db.DB_HASH class ShelveAssociateBTreeTestCase(ShelveAssociateTestCase): dbtype = db.DB_BTREE class ShelveAssociateRecnoTestCase(ShelveAssociateTestCase): dbtype = db.DB_RECNO keytype = 0 #---------------------------------------------------------------------- class ThreadedAssociateTestCase(AssociateTestCase): def addDataToDB(self, d): t1 = Thread(target = self.writer1, args = (d, )) t2 = Thread(target = self.writer2, args = (d, )) t1.start() t2.start() t1.join() t2.join() def writer1(self, d): for key, value in musicdata.items(): if type(self.keytype) == type(''): key = "%02d" % key d.put(key, string.join(value, '|')) def writer2(self, d): for x in range(100, 600): key = 'z%2d' % x value = [key] * 4 d.put(key, string.join(value, '|')) class ThreadedAssociateHashTestCase(ShelveAssociateTestCase): dbtype = db.DB_HASH class ThreadedAssociateBTreeTestCase(ShelveAssociateTestCase): dbtype = db.DB_BTREE class ThreadedAssociateRecnoTestCase(ShelveAssociateTestCase): dbtype = db.DB_RECNO keytype = 0 #---------------------------------------------------------------------- def suite(): theSuite = unittest.TestSuite() if db.version() >= (3, 3, 11): theSuite.addTest(unittest.makeSuite(AssociateHashTestCase)) theSuite.addTest(unittest.makeSuite(AssociateBTreeTestCase)) theSuite.addTest(unittest.makeSuite(AssociateRecnoTestCase)) theSuite.addTest(unittest.makeSuite(ShelveAssociateHashTestCase)) theSuite.addTest(unittest.makeSuite(ShelveAssociateBTreeTestCase)) theSuite.addTest(unittest.makeSuite(ShelveAssociateRecnoTestCase)) if have_threads: theSuite.addTest(unittest.makeSuite(ThreadedAssociateHashTestCase)) theSuite.addTest(unittest.makeSuite(ThreadedAssociateBTreeTestCase)) theSuite.addTest(unittest.makeSuite(ThreadedAssociateRecnoTestCase)) return theSuite if __name__ == '__main__': unittest.main( defaultTest='suite' ) --- NEW FILE: test_basics.py --- """ Basic TestCases for BTree and hash DBs, with and without a DBEnv, with various DB flags, etc. """ import sys, os, string import tempfile from pprint import pprint import unittest from bsddb import db from test.test_support import verbose #---------------------------------------------------------------------- class VersionTestCase(unittest.TestCase): def test00_version(self): info = db.version() if verbose: print '\n', '-=' * 20 print 'bsddb.db.version(): %s' % (info, ) print db.DB_VERSION_STRING print '-=' * 20 assert info == (db.DB_VERSION_MAJOR, db.DB_VERSION_MINOR, db.DB_VERSION_PATCH) #---------------------------------------------------------------------- class BasicTestCase(unittest.TestCase): dbtype = db.DB_UNKNOWN # must be set in derived class dbopenflags = 0 dbsetflags = 0 dbmode = 0660 dbname = None useEnv = 0 envflags = 0 def setUp(self): if self.useEnv: homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') try: os.mkdir(homeDir) except os.error: pass self.env = db.DBEnv() self.env.set_lg_max(1024*1024) self.env.open(homeDir, self.envflags | db.DB_CREATE) tempfile.tempdir = homeDir self.filename = os.path.split(tempfile.mktemp())[1] tempfile.tempdir = None self.homeDir = homeDir else: self.env = None self.filename = tempfile.mktemp() # create and open the DB self.d = db.DB(self.env) self.d.set_flags(self.dbsetflags) if self.dbname: self.d.open(self.filename, self.dbname, self.dbtype, self.dbopenflags|db.DB_CREATE, self.dbmode) else: self.d.open(self.filename, # try out keyword args mode = self.dbmode, dbtype = self.dbtype, flags = self.dbopenflags|db.DB_CREATE) self.populateDB() def tearDown(self): self.d.close() if self.env is not None: self.env.close() import glob files = glob.glob(os.path.join(self.homeDir, '*')) for file in files: os.remove(file) ## Make a new DBEnv to remove the env files from the home dir. ## (It can't be done while the env is open, nor after it has been ## closed, so we make a new one to do it.) #e = db.DBEnv() #e.remove(self.homeDir) #os.remove(os.path.join(self.homeDir, self.filename)) else: os.remove(self.filename) def populateDB(self): d = self.d for x in range(500): key = '%04d' % (1000 - x) # insert keys in reverse order data = self.makeData(key) d.put(key, data) for x in range(500): key = '%04d' % x # and now some in forward order data = self.makeData(key) d.put(key, data) num = len(d) if verbose: print "created %d records" % num def makeData(self, key): return string.join([key] * 5, '-') #---------------------------------------- def test01_GetsAndPuts(self): d = self.d if verbose: print '\n', '-=' * 30 print "Running %s.test01_GetsAndPuts..." % self.__class__.__name__ for key in ['0001', '0100', '0400', '0700', '0999']: data = d.get(key) if verbose: print data assert d.get('0321') == '0321-0321-0321-0321-0321' # By default non-existant keys return None... assert d.get('abcd') == None # ...but they raise exceptions in other situations. Call # set_get_returns_none() to change it. try: d.delete('abcd') except db.DBNotFoundError, val: assert val[0] == db.DB_NOTFOUND if verbose: print val else: self.fail("expected exception") d.put('abcd', 'a new record') assert d.get('abcd') == 'a new record' d.put('abcd', 'same key') if self.dbsetflags & db.DB_DUP: assert d.get('abcd') == 'a new record' else: assert d.get('abcd') == 'same key' try: d.put('abcd', 'this should fail', flags=db.DB_NOOVERWRITE) except db.DBKeyExistError, val: assert val[0] == db.DB_KEYEXIST if verbose: print val else: self.fail("expected exception") if self.dbsetflags & db.DB_DUP: assert d.get('abcd') == 'a new record' else: assert d.get('abcd') == 'same key' d.sync() d.close() del d self.d = db.DB(self.env) if self.dbname: self.d.open(self.filename, self.dbname) else: self.d.open(self.filename) d = self.d assert d.get('0321') == '0321-0321-0321-0321-0321' if self.dbsetflags & db.DB_DUP: assert d.get('abcd') == 'a new record' else: assert d.get('abcd') == 'same key' rec = d.get_both('0555', '0555-0555-0555-0555-0555') if verbose: print rec assert d.get_both('0555', 'bad data') == None # test default value data = d.get('bad key', 'bad data') assert data == 'bad data' # any object can pass through data = d.get('bad key', self) assert data == self s = d.stat() assert type(s) == type({}) if verbose: print 'd.stat() returned this dictionary:' pprint(s) #---------------------------------------- def test02_DictionaryMethods(self): d = self.d if verbose: print '\n', '-=' * 30 print "Running %s.test02_DictionaryMethods..." % self.__class__.__name__ for key in ['0002', '0101', '0401', '0701', '0998']: data = d[key] assert data == self.makeData(key) if verbose: print data assert len(d) == 1000 keys = d.keys() assert len(keys) == 1000 assert type(keys) == type([]) d['new record'] = 'a new record' assert len(d) == 1001 keys = d.keys() assert len(keys) == 1001 d['new record'] = 'a replacement record' assert len(d) == 1001 keys = d.keys() assert len(keys) == 1001 if verbose: print "the first 10 keys are:" pprint(keys[:10]) assert d['new record'] == 'a replacement record' assert d.has_key('0001') == 1 assert d.has_key('spam') == 0 items = d.items() assert len(items) == 1001 assert type(items) == type([]) assert type(items[0]) == type(()) assert len(items[0]) == 2 if verbose: print "the first 10 items are:" pprint(items[:10]) values = d.values() assert len(values) == 1001 assert type(values) == type([]) if verbose: print "the first 10 values are:" pprint(values[:10]) #---------------------------------------- def test03_SimpleCursorStuff(self): if verbose: print '\n', '-=' * 30 print "Running %s.test03_SimpleCursorStuff..." % self.__class__.__name__ c = self.d.cursor() rec = c.first() count = 0 while rec is not None: count = count + 1 if verbose and count % 100 == 0: print rec rec = c.next() assert count == 1000 rec = c.last() count = 0 while rec is not None: count = count + 1 if verbose and count % 100 == 0: print rec rec = c.prev() assert count == 1000 rec = c.set('0505') rec2 = c.current() assert rec == rec2 assert rec[0] == '0505' assert rec[1] == self.makeData('0505') try: c.set('bad key') except db.DBNotFoundError, val: assert val[0] == db.DB_NOTFOUND if verbose: print val else: self.fail("expected exception") rec = c.get_both('0404', self.makeData('0404')) assert rec == ('0404', self.makeData('0404')) try: c.get_both('0404', 'bad data') except db.DBNotFoundError, val: assert val[0] == db.DB_NOTFOUND if verbose: print val else: self.fail("expected exception") if self.d.get_type() == db.DB_BTREE: rec = c.set_range('011') if verbose: print "searched for '011', found: ", rec rec = c.set_range('011',dlen=0,doff=0) if verbose: print "searched (partial) for '011', found: ", rec if rec[1] != '': set.fail('expected empty data portion') c.set('0499') c.delete() try: rec = c.current() except db.DBKeyEmptyError, val: assert val[0] == db.DB_KEYEMPTY if verbose: print val else: self.fail('exception expected') c.next() c2 = c.dup(db.DB_POSITION) assert c.current() == c2.current() c2.put('', 'a new value', db.DB_CURRENT) assert c.current() == c2.current() assert c.current()[1] == 'a new value' c2.put('', 'er', db.DB_CURRENT, dlen=0, doff=5) assert c2.current()[1] == 'a newer value' c.close() c2.close() # time to abuse the closed cursors and hope we don't crash methods_to_test = { 'current': (), 'delete': (), 'dup': (db.DB_POSITION,), 'first': (), 'get': (0,), 'next': (), 'prev': (), 'last': (), 'put':('', 'spam', db.DB_CURRENT), 'set': ("0505",), } for method, args in methods_to_test.items(): try: if verbose: print "attempting to use a closed cursor's %s method" % method # a bug may cause a NULL pointer dereference... apply(getattr(c, method), args) except db.DBError, val: assert val[0] == 0 if verbose: print val else: self.fail("no exception raised when using a buggy cursor's %s method" % method) #---------------------------------------- def test04_PartialGetAndPut(self): d = self.d if verbose: print '\n', '-=' * 30 print "Running %s.test04_PartialGetAndPut..." % self.__class__.__name__ key = "partialTest" data = "1" * 1000 + "2" * 1000 d.put(key, data) assert d.get(key) == data assert d.get(key, dlen=20, doff=990) == ("1" * 10) + ("2" * 10) d.put("partialtest2", ("1" * 30000) + "robin" ) assert d.get("partialtest2", dlen=5, doff=30000) == "robin" # There seems to be a bug in DB here... Commented out the test for now. ##assert d.get("partialtest2", dlen=5, doff=30010) == "" if self.dbsetflags != db.DB_DUP: # Partial put with duplicate records requires a cursor d.put(key, "0000", dlen=2000, doff=0) assert d.get(key) == "0000" d.put(key, "1111", dlen=1, doff=2) assert d.get(key) == "0011110" #---------------------------------------- def test05_GetSize(self): d = self.d if verbose: print '\n', '-=' * 30 print "Running %s.test05_GetSize..." % self.__class__.__name__ for i in range(1, 50000, 500): key = "size%s" % i #print "before ", i, d.put(key, "1" * i) #print "after", assert d.get_size(key) == i #print "done" #---------------------------------------- def test06_Truncate(self): d = self.d if verbose: print '\n', '-=' * 30 print "Running %s.test99_Truncate..." % self.__class__.__name__ d.put("abcde", "ABCDE"); num = d.truncate() assert num >= 1, "truncate returned <= 0 on non-empty database" num = d.truncate() assert num == 0, "truncate on empty DB returned nonzero (%s)" % `num` #---------------------------------------------------------------------- class BasicBTreeTestCase(BasicTestCase): dbtype = db.DB_BTREE class BasicHashTestCase(BasicTestCase): dbtype = db.DB_HASH class BasicBTreeWithThreadFlagTestCase(BasicTestCase): dbtype = db.DB_BTREE dbopenflags = db.DB_THREAD class BasicHashWithThreadFlagTestCase(BasicTestCase): dbtype = db.DB_HASH dbopenflags = db.DB_THREAD class BasicBTreeWithEnvTestCase(BasicTestCase): dbtype = db.DB_BTREE dbopenflags = db.DB_THREAD useEnv = 1 envflags = db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK class BasicHashWithEnvTestCase(BasicTestCase): dbtype = db.DB_HASH dbopenflags = db.DB_THREAD useEnv = 1 envflags = db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK #---------------------------------------------------------------------- class BasicTransactionTestCase(BasicTestCase): dbopenflags = db.DB_THREAD useEnv = 1 envflags = db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK | db.DB_INIT_TXN def tearDown(self): self.txn.commit() BasicTestCase.tearDown(self) def populateDB(self): d = self.d txn = self.env.txn_begin() for x in range(500): key = '%04d' % (1000 - x) # insert keys in reverse order data = self.makeData(key) d.put(key, data, txn) for x in range(500): key = '%04d' % x # and now some in forward order data = self.makeData(key) d.put(key, data, txn) txn.commit() num = len(d) if verbose: print "created %d records" % num self.txn = self.env.txn_begin() def test06_Transactions(self): d = self.d if verbose: print '\n', '-=' * 30 print "Running %s.test06_Transactions..." % self.__class__.__name__ assert d.get('new rec', txn=self.txn) == None d.put('new rec', 'this is a new record', self.txn) assert d.get('new rec', txn=self.txn) == 'this is a new record' self.txn.abort() assert d.get('new rec') == None self.txn = self.env.txn_begin() assert d.get('new rec', txn=self.txn) == None d.put('new rec', 'this is a new record', self.txn) assert d.get('new rec', txn=self.txn) == 'this is a new record' self.txn.commit() assert d.get('new rec') == 'this is a new record' self.txn = self.env.txn_begin() c = d.cursor(self.txn) rec = c.first() count = 0 while rec is not None: count = count + 1 if verbose and count % 100 == 0: print rec rec = c.next() assert count == 1001 c.close() # Cursors *MUST* be closed before commit! self.txn.commit() # flush pending updates try: self.env.txn_checkpoint (0, 0, 0) except db.DBIncompleteError: pass # must have at least one log file present: logs = self.env.log_archive(db.DB_ARCH_ABS | db.DB_ARCH_LOG) assert logs != None for log in logs: if verbose: print 'log file: ' + log self.txn = self.env.txn_begin() #---------------------------------------- def test07_TxnTruncate(self): d = self.d if verbose: print '\n', '-=' * 30 print "Running %s.test07_TxnTruncate..." % self.__class__.__name__ d.put("abcde", "ABCDE"); txn = self.env.txn_begin() num = d.truncate(txn) assert num >= 1, "truncate returned <= 0 on non-empty database" num = d.truncate(txn) assert num == 0, "truncate on empty DB returned nonzero (%s)" % `num` txn.commit() class BTreeTransactionTestCase(BasicTransactionTestCase): dbtype = db.DB_BTREE class HashTransactionTestCase(BasicTransactionTestCase): dbtype = db.DB_HASH #---------------------------------------------------------------------- class BTreeRecnoTestCase(BasicTestCase): dbtype = db.DB_BTREE dbsetflags = db.DB_RECNUM def test07_RecnoInBTree(self): d = self.d if verbose: print '\n', '-=' * 30 print "Running %s.test07_RecnoInBTree..." % self.__class__.__name__ rec = d.get(200) assert type(rec) == type(()) assert len(rec) == 2 if verbose: print "Record #200 is ", rec c = d.cursor() c.set('0200') num = c.get_recno() assert type(num) == type(1) if verbose: print "recno of d['0200'] is ", num rec = c.current() assert c.set_recno(num) == rec c.close() class BTreeRecnoWithThreadFlagTestCase(BTreeRecnoTestCase): dbopenflags = db.DB_THREAD #---------------------------------------------------------------------- class BasicDUPTestCase(BasicTestCase): dbsetflags = db.DB_DUP def test08_DuplicateKeys(self): d = self.d if verbose: print '\n', '-=' * 30 print "Running %s.test08_DuplicateKeys..." % self.__class__.__name__ d.put("dup0", "before") for x in string.split("The quick brown fox jumped over the lazy dog."): d.put("dup1", x) d.put("dup2", "after") data = d.get("dup1") assert data == "The" if verbose: print data c = d.cursor() rec = c.set("dup1") assert rec == ('dup1', 'The') next = c.next() assert next == ('dup1', 'quick') rec = c.set("dup1") count = c.count() assert count == 9 next_dup = c.next_dup() assert next_dup == ('dup1', 'quick') rec = c.set('dup1') while rec is not None: if verbose: print rec rec = c.next_dup() c.set('dup1') rec = c.next_nodup() assert rec[0] != 'dup1' if verbose: print rec c.close() class BTreeDUPTestCase(BasicDUPTestCase): dbtype = db.DB_BTREE class HashDUPTestCase(BasicDUPTestCase): dbtype = db.DB_HASH class BTreeDUPWithThreadTestCase(BasicDUPTestCase): dbtype = db.DB_BTREE dbopenflags = db.DB_THREAD class HashDUPWithThreadTestCase(BasicDUPTestCase): dbtype = db.DB_HASH dbopenflags = db.DB_THREAD #---------------------------------------------------------------------- class BasicMultiDBTestCase(BasicTestCase): dbname = 'first' def otherType(self): if self.dbtype == db.DB_BTREE: return db.DB_HASH else: return db.DB_BTREE def test09_MultiDB(self): d1 = self.d if verbose: print '\n', '-=' * 30 print "Running %s.test09_MultiDB..." % self.__class__.__name__ d2 = db.DB(self.env) d2.open(self.filename, "second", self.dbtype, self.dbopenflags|db.DB_CREATE) d3 = db.DB(self.env) d3.open(self.filename, "third", self.otherType(), self.dbopenflags|db.DB_CREATE) for x in string.split("The quick brown fox jumped over the lazy dog"): d2.put(x, self.makeData(x)) for x in string.letters: d3.put(x, x*70) d1.sync() d2.sync() d3.sync() d1.close() d2.close() d3.close() self.d = d1 = d2 = d3 = None self.d = d1 = db.DB(self.env) d1.open(self.filename, self.dbname, flags = self.dbopenflags) d2 = db.DB(self.env) d2.open(self.filename, "second", flags = self.dbopenflags) d3 = db.DB(self.env) d3.open(self.filename, "third", flags = self.dbopenflags) c1 = d1.cursor() c2 = d2.cursor() c3 = d3.cursor() count = 0 rec = c1.first() while rec is not None: count = count + 1 if verbose and (count % 50) == 0: print rec rec = c1.next() assert count == 1000 count = 0 rec = c2.first() while rec is not None: count = count + 1 if verbose: print rec rec = c2.next() assert count == 9 count = 0 rec = c3.first() while rec is not None: count = count + 1 if verbose: print rec rec = c3.next() assert count == 52 c1.close() c2.close() c3.close() d2.close() d3.close() # Strange things happen if you try to use Multiple DBs per file without a # DBEnv with MPOOL and LOCKing... class BTreeMultiDBTestCase(BasicMultiDBTestCase): dbtype = db.DB_BTREE dbopenflags = db.DB_THREAD useEnv = 1 envflags = db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK class HashMultiDBTestCase(BasicMultiDBTestCase): dbtype = db.DB_HASH dbopenflags = db.DB_THREAD useEnv = 1 envflags = db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK #---------------------------------------------------------------------- #---------------------------------------------------------------------- def suite(): theSuite = unittest.TestSuite() theSuite.addTest(unittest.makeSuite(VersionTestCase)) theSuite.addTest(unittest.makeSuite(BasicBTreeTestCase)) theSuite.addTest(unittest.makeSuite(BasicHashTestCase)) theSuite.addTest(unittest.makeSuite(BasicBTreeWithThreadFlagTestCase)) theSuite.addTest(unittest.makeSuite(BasicHashWithThreadFlagTestCase)) theSuite.addTest(unittest.makeSuite(BasicBTreeWithEnvTestCase)) theSuite.addTest(unittest.makeSuite(BasicHashWithEnvTestCase)) theSuite.addTest(unittest.makeSuite(BTreeTransactionTestCase)) theSuite.addTest(unittest.makeSuite(HashTransactionTestCase)) theSuite.addTest(unittest.makeSuite(BTreeRecnoTestCase)) theSuite.addTest(unittest.makeSuite(BTreeRecnoWithThreadFlagTestCase)) theSuite.addTest(unittest.makeSuite(BTreeDUPTestCase)) theSuite.addTest(unittest.makeSuite(HashDUPTestCase)) theSuite.addTest(unittest.makeSuite(BTreeDUPWithThreadTestCase)) theSuite.addTest(unittest.makeSuite(HashDUPWithThreadTestCase)) theSuite.addTest(unittest.makeSuite(BTreeMultiDBTestCase)) theSuite.addTest(unittest.makeSuite(HashMultiDBTestCase)) return theSuite if __name__ == '__main__': unittest.main( defaultTest='suite' ) --- NEW FILE: test_compat.py --- """ Test cases adapted from the test_bsddb.py module in Python's regression test suite. """ import sys, os, string from bsddb import hashopen, btopen, rnopen import bsddb import unittest import tempfile from test.test_support import verbose class CompatibilityTestCase(unittest.TestCase): def setUp(self): self.filename = tempfile.mktemp() def tearDown(self): try: os.remove(self.filename) except os.error: pass def test01_btopen(self): self.do_bthash_test(btopen, 'btopen') def test02_hashopen(self): self.do_bthash_test(hashopen, 'hashopen') def test03_rnopen(self): data = string.split("The quick brown fox jumped over the lazy dog.") if verbose: print "\nTesting: rnopen" f = rnopen(self.filename, 'c') for x in range(len(data)): f[x+1] = data[x] getTest = (f[1], f[2], f[3]) if verbose: print '%s %s %s' % getTest assert getTest[1] == 'quick', 'data mismatch!' f[25] = 'twenty-five' f.close() del f f = rnopen(self.filename, 'w') f[20] = 'twenty' def noRec(f): rec = f[15] self.assertRaises(KeyError, noRec, f) def badKey(f): rec = f['a string'] self.assertRaises(TypeError, badKey, f) del f[3] rec = f.first() while rec: if verbose: print rec try: rec = f.next() except KeyError: break f.close() def test04_n_flag(self): f = hashopen(self.filename, 'n') f.close() def do_bthash_test(self, factory, what): if verbose: print '\nTesting: ', what f = factory(self.filename, 'c') if verbose: print 'creation...' # truth test if f: if verbose: print "truth test: true" else: if verbose: print "truth test: false" f['0'] = '' f['a'] = 'Guido' f['b'] = 'van' f['c'] = 'Rossum' f['d'] = 'invented' f['f'] = 'Python' if verbose: print '%s %s %s' % (f['a'], f['b'], f['c']) if verbose: print 'key ordering...' f.set_location(f.first()[0]) while 1: try: rec = f.next() except KeyError: assert rec == f.last(), 'Error, last <> last!' f.previous() break if verbose: print rec assert f.has_key('f'), 'Error, missing key!' f.sync() f.close() # truth test try: if f: if verbose: print "truth test: true" else: if verbose: print "truth test: false" except bsddb.error: pass else: self.fail("Exception expected") del f if verbose: print 'modification...' f = factory(self.filename, 'w') f['d'] = 'discovered' if verbose: print 'access...' for key in f.keys(): word = f[key] if verbose: print word def noRec(f): rec = f['no such key'] self.assertRaises(KeyError, noRec, f) def badKey(f): rec = f[15] self.assertRaises(TypeError, badKey, f) f.close() #---------------------------------------------------------------------- def suite(): return unittest.makeSuite(CompatibilityTestCase) if __name__ == '__main__': unittest.main( defaultTest='suite' ) --- NEW FILE: test_dbobj.py --- import sys, os, string import unittest import glob from bsddb import db, dbobj #---------------------------------------------------------------------- class dbobjTestCase(unittest.TestCase): """Verify that dbobj.DB and dbobj.DBEnv work properly""" db_home = 'db_home' db_name = 'test-dbobj.db' def setUp(self): homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') self.homeDir = homeDir try: os.mkdir(homeDir) except os.error: pass def tearDown(self): if hasattr(self, 'db'): del self.db if hasattr(self, 'env'): del self.env files = glob.glob(os.path.join(self.homeDir, '*')) for file in files: os.remove(file) def test01_both(self): class TestDBEnv(dbobj.DBEnv): pass class TestDB(dbobj.DB): def put(self, key, *args, **kwargs): key = string.upper(key) # call our parent classes put method with an upper case key return apply(dbobj.DB.put, (self, key) + args, kwargs) self.env = TestDBEnv() self.env.open(self.db_home, db.DB_CREATE | db.DB_INIT_MPOOL) self.db = TestDB(self.env) self.db.open(self.db_name, db.DB_HASH, db.DB_CREATE) self.db.put('spam', 'eggs') assert self.db.get('spam') == None, "overridden dbobj.DB.put() method failed [1]" assert self.db.get('SPAM') == 'eggs', "overridden dbobj.DB.put() method failed [2]" self.db.close() self.env.close() def test02_dbobj_dict_interface(self): self.env = dbobj.DBEnv() self.env.open(self.db_home, db.DB_CREATE | db.DB_INIT_MPOOL) self.db = dbobj.DB(self.env) self.db.open(self.db_name+'02', db.DB_HASH, db.DB_CREATE) # __setitem__ self.db['spam'] = 'eggs' # __len__ assert len(self.db) == 1 # __getitem__ assert self.db['spam'] == 'eggs' # __del__ del self.db['spam'] assert self.db.get('spam') == None, "dbobj __del__ failed" self.db.close() self.env.close() #---------------------------------------------------------------------- def suite(): return unittest.makeSuite(dbobjTestCase) if __name__ == '__main__': unittest.main( defaultTest='suite' ) --- NEW FILE: test_dbshelve.py --- """ TestCases for checking dbShelve objects. """ import sys, os, string import tempfile, random from pprint import pprint from types import * import unittest from bsddb import dbshelve, db from test.test_support import verbose #---------------------------------------------------------------------- # We want the objects to be comparable so we can test dbshelve.values # later on. class DataClass: def __init__(self): self.value = random.random() def __cmp__(self, other): return cmp(self.value, other) class DBShelveTestCase(unittest.TestCase): def setUp(self): self.filename = tempfile.mktemp() self.do_open() def tearDown(self): self.do_close() try: os.remove(self.filename) except os.error: pass def populateDB(self, d): for x in string.letters: d['S' + x] = 10 * x # add a string d['I' + x] = ord(x) # add an integer d['L' + x] = [x] * 10 # add a list inst = DataClass() # add an instance inst.S = 10 * x inst.I = ord(x) inst.L = [x] * 10 d['O' + x] = inst # overridable in derived classes to affect how the shelf is created/opened def do_open(self): self.d = dbshelve.open(self.filename) # and closed... def do_close(self): self.d.close() def test01_basics(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_basics..." % self.__class__.__name__ self.populateDB(self.d) self.d.sync() self.do_close() self.do_open() d = self.d l = len(d) k = d.keys() s = d.stat() f = d.fd() if verbose: print "length:", l print "keys:", k print "stats:", s assert 0 == d.has_key('bad key') assert 1 == d.has_key('IA') assert 1 == d.has_key('OA') d.delete('IA') del d['OA'] assert 0 == d.has_key('IA') assert 0 == d.has_key('OA') assert len(d) == l-2 values = [] for key in d.keys(): value = d[key] values.append(value) if verbose: print "%s: %s" % (key, value) self.checkrec(key, value) dbvalues = d.values() assert len(dbvalues) == len(d.keys()) values.sort() dbvalues.sort() assert values == dbvalues items = d.items() assert len(items) == len(values) for key, value in items: self.checkrec(key, value) assert d.get('bad key') == None assert d.get('bad key', None) == None assert d.get('bad key', 'a string') == 'a string' assert d.get('bad key', [1, 2, 3]) == [1, 2, 3] d.set_get_returns_none(0) self.assertRaises(db.DBNotFoundError, d.get, 'bad key') d.set_get_returns_none(1) d.put('new key', 'new data') assert d.get('new key') == 'new data' assert d['new key'] == 'new data' def test02_cursors(self): if verbose: print '\n', '-=' * 30 print "Running %s.test02_cursors..." % self.__class__.__name__ self.populateDB(self.d) d = self.d count = 0 c = d.cursor() rec = c.first() while rec is not None: count = count + 1 if verbose: print rec key, value = rec self.checkrec(key, value) rec = c.next() assert count == len(d) count = 0 c = d.cursor() rec = c.last() while rec is not None: count = count + 1 if verbose: print rec key, value = rec self.checkrec(key, value) rec = c.prev() assert count == len(d) c.set('SS') key, value = c.current() self.checkrec(key, value) c.close() def checkrec(self, key, value): x = key[1] if key[0] == 'S': assert type(value) == StringType assert value == 10 * x elif key[0] == 'I': assert type(value) == IntType assert value == ord(x) elif key[0] == 'L': assert type(value) == ListType assert value == [x] * 10 elif key[0] == 'O': assert type(value) == InstanceType assert value.S == 10 * x assert value.I == ord(x) assert value.L == [x] * 10 else: raise AssertionError, 'Unknown key type, fix the test' #---------------------------------------------------------------------- class BasicShelveTestCase(DBShelveTestCase): def do_open(self): self.d = dbshelve.DBShelf() self.d.open(self.filename, self.dbtype, self.dbflags) def do_close(self): self.d.close() class BTreeShelveTestCase(BasicShelveTestCase): dbtype = db.DB_BTREE dbflags = db.DB_CREATE class HashShelveTestCase(BasicShelveTestCase): dbtype = db.DB_BTREE dbflags = db.DB_CREATE class ThreadBTreeShelveTestCase(BasicShelveTestCase): dbtype = db.DB_BTREE dbflags = db.DB_CREATE | db.DB_THREAD class ThreadHashShelveTestCase(BasicShelveTestCase): dbtype = db.DB_BTREE dbflags = db.DB_CREATE | db.DB_THREAD #---------------------------------------------------------------------- class BasicEnvShelveTestCase(DBShelveTestCase): def do_open(self): self.homeDir = homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') try: os.mkdir(homeDir) except os.error: pass self.env = db.DBEnv() self.env.open(homeDir, self.envflags | db.DB_INIT_MPOOL | db.DB_CREATE) self.filename = os.path.split(self.filename)[1] self.d = dbshelve.DBShelf(self.env) self.d.open(self.filename, self.dbtype, self.dbflags) def do_close(self): self.d.close() self.env.close() def tearDown(self): self.do_close() import glob files = glob.glob(os.path.join(self.homeDir, '*')) for file in files: os.remove(file) class EnvBTreeShelveTestCase(BasicEnvShelveTestCase): envflags = 0 dbtype = db.DB_BTREE dbflags = db.DB_CREATE class EnvHashShelveTestCase(BasicEnvShelveTestCase): envflags = 0 dbtype = db.DB_BTREE dbflags = db.DB_CREATE class EnvThreadBTreeShelveTestCase(BasicEnvShelveTestCase): envflags = db.DB_THREAD dbtype = db.DB_BTREE dbflags = db.DB_CREATE | db.DB_THREAD class EnvThreadHashShelveTestCase(BasicEnvShelveTestCase): envflags = db.DB_THREAD dbtype = db.DB_BTREE dbflags = db.DB_CREATE | db.DB_THREAD #---------------------------------------------------------------------- # TODO: Add test cases for a DBShelf in a RECNO DB. #---------------------------------------------------------------------- def suite(): theSuite = unittest.TestSuite() theSuite.addTest(unittest.makeSuite(DBShelveTestCase)) theSuite.addTest(unittest.makeSuite(BTreeShelveTestCase)) theSuite.addTest(unittest.makeSuite(HashShelveTestCase)) theSuite.addTest(unittest.makeSuite(ThreadBTreeShelveTestCase)) theSuite.addTest(unittest.makeSuite(ThreadHashShelveTestCase)) theSuite.addTest(unittest.makeSuite(EnvBTreeShelveTestCase)) theSuite.addTest(unittest.makeSuite(EnvHashShelveTestCase)) theSuite.addTest(unittest.makeSuite(EnvThreadBTreeShelveTestCase)) theSuite.addTest(unittest.makeSuite(EnvThreadHashShelveTestCase)) return theSuite if __name__ == '__main__': unittest.main( defaultTest='suite' ) --- NEW FILE: test_dbtables.py --- #!/usr/bin/env python # #----------------------------------------------------------------------- # A test suite for the table interface built on bsddb.db #----------------------------------------------------------------------- # # Copyright (C) 2000, 2001 by Autonomous Zone Industries # # March 20, 2000 # # License: This is free software. You may use this software for any # purpose including modification/redistribution, so long as # this header remains intact and that you do not claim any # rights of ownership or authorship of this software. This # software has been tested, but no warranty is expressed or # implied. # # -- Gregory P. Smith # # $Id: test_dbtables.py,v 1.1 2002/11/19 17:47:04 loewis Exp $ import sys, os, re try: import cPickle pickle = cPickle except ImportError: import pickle import unittest from test.test_support import verbose from bsddb import db, dbtables #---------------------------------------------------------------------- class TableDBTestCase(unittest.TestCase): db_home = 'db_home' db_name = 'test-table.db' def setUp(self): homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') self.homeDir = homeDir try: os.mkdir(homeDir) except os.error: pass self.tdb = dbtables.bsdTableDB(filename='tabletest.db', dbhome='db_home', create=1) def tearDown(self): self.tdb.close() import glob files = glob.glob(os.path.join(self.homeDir, '*')) for file in files: os.remove(file) def test01(self): tabname = "test01" colname = 'cool numbers' try: self.tdb.Drop(tabname) except dbtables.TableDBError: pass self.tdb.CreateTable(tabname, [colname]) self.tdb.Insert(tabname, {colname: pickle.dumps(3.14159, 1)}) if verbose: self.tdb._db_print() values = self.tdb.Select(tabname, [colname], conditions={colname: None}) colval = pickle.loads(values[0][colname]) assert(colval > 3.141 and colval < 3.142) def test02(self): tabname = "test02" col0 = 'coolness factor' col1 = 'but can it fly?' col2 = 'Species' testinfo = [ {col0: pickle.dumps(8, 1), col1: 'no', col2: 'Penguin'}, {col0: pickle.dumps(-1, 1), col1: 'no', col2: 'Turkey'}, {col0: pickle.dumps(9, 1), col1: 'yes', col2: 'SR-71A Blackbird'} ] try: self.tdb.Drop(tabname) except dbtables.TableDBError: pass self.tdb.CreateTable(tabname, [col0, col1, col2]) for row in testinfo : self.tdb.Insert(tabname, row) values = self.tdb.Select(tabname, [col2], conditions={col0: lambda x: pickle.loads(x) >= 8}) assert len(values) == 2 if values[0]['Species'] == 'Penguin' : assert values[1]['Species'] == 'SR-71A Blackbird' elif values[0]['Species'] == 'SR-71A Blackbird' : assert values[1]['Species'] == 'Penguin' else : if verbose: print "values=", `values` raise "Wrong values returned!" def test03(self): tabname = "test03" try: self.tdb.Drop(tabname) except dbtables.TableDBError: pass if verbose: print '...before CreateTable...' self.tdb._db_print() self.tdb.CreateTable(tabname, ['a', 'b', 'c', 'd', 'e']) if verbose: print '...after CreateTable...' self.tdb._db_print() self.tdb.Drop(tabname) if verbose: print '...after Drop...' self.tdb._db_print() self.tdb.CreateTable(tabname, ['a', 'b', 'c', 'd', 'e']) try: self.tdb.Insert(tabname, {'a': "", 'e': pickle.dumps([{4:5, 6:7}, 'foo'], 1), 'f': "Zero"}) assert 0 except dbtables.TableDBError: pass try: self.tdb.Select(tabname, [], conditions={'foo': '123'}) assert 0 except dbtables.TableDBError: pass self.tdb.Insert(tabname, {'a': '42', 'b': "bad", 'c': "meep", 'e': 'Fuzzy wuzzy was a bear'}) self.tdb.Insert(tabname, {'a': '581750', 'b': "good", 'd': "bla", 'c': "black", 'e': 'fuzzy was here'}) self.tdb.Insert(tabname, {'a': '800000', 'b': "good", 'd': "bla", 'c': "black", 'e': 'Fuzzy wuzzy is a bear'}) if verbose: self.tdb._db_print() # this should return two rows values = self.tdb.Select(tabname, ['b', 'a', 'd'], conditions={'e': re.compile('wuzzy').search, 'a': re.compile('^[0-9]+$').match}) assert len(values) == 2 # now lets delete one of them and try again self.tdb.Delete(tabname, conditions={'b': dbtables.ExactCond('good')}) values = self.tdb.Select(tabname, ['a', 'd', 'b'], conditions={'e': dbtables.PrefixCond('Fuzzy')}) assert len(values) == 1 assert values[0]['d'] == None values = self.tdb.Select(tabname, ['b'], conditions={'c': lambda c: c == 'meep'}) assert len(values) == 1 assert values[0]['b'] == "bad" def test_CreateOrExtend(self): tabname = "test_CreateOrExtend" self.tdb.CreateOrExtendTable(tabname, ['name', 'taste', 'filling', 'alcohol content', 'price']) try: self.tdb.Insert(tabname, {'taste': 'crap', 'filling': 'no', 'is it Guinness?': 'no'}) assert 0, "Insert should've failed due to bad column name" except: pass self.tdb.CreateOrExtendTable(tabname, ['name', 'taste', 'is it Guinness?']) # these should both succeed as the table should contain the union of both sets of columns. self.tdb.Insert(tabname, {'taste': 'crap', 'filling': 'no', 'is it Guinness?': 'no'}) self.tdb.Insert(tabname, {'taste': 'great', 'filling': 'yes', 'is it Guinness?': 'yes', 'name': 'Guinness'}) def test_CondObjs(self): tabname = "test_CondObjs" self.tdb.CreateTable(tabname, ['a', 'b', 'c', 'd', 'e', 'p']) self.tdb.Insert(tabname, {'a': "the letter A", 'b': "the letter B", 'c': "is for cookie"}) self.tdb.Insert(tabname, {'a': "is for aardvark", 'e': "the letter E", 'c': "is for cookie", 'd': "is for dog"}) self.tdb.Insert(tabname, {'a': "the letter A", 'e': "the letter E", 'c': "is for cookie", 'p': "is for Python"}) values = self.tdb.Select(tabname, ['p', 'e'], conditions={'e': dbtables.PrefixCond('the l')}) assert len(values) == 2, values assert values[0]['e'] == values[1]['e'], values assert values[0]['p'] != values[1]['p'], values values = self.tdb.Select(tabname, ['d', 'a'], conditions={'a': dbtables.LikeCond('%aardvark%')}) assert len(values) == 1, values assert values[0]['d'] == "is for dog", values assert values[0]['a'] == "is for aardvark", values values = self.tdb.Select(tabname, None, {'b': dbtables.Cond(), 'e':dbtables.LikeCond('%letter%'), 'a':dbtables.PrefixCond('is'), 'd':dbtables.ExactCond('is for dog'), 'c':dbtables.PrefixCond('is for'), 'p':lambda s: not s}) assert len(values) == 1, values assert values[0]['d'] == "is for dog", values assert values[0]['a'] == "is for aardvark", values def test_Delete(self): tabname = "test_Delete" self.tdb.CreateTable(tabname, ['x', 'y', 'z']) # prior to 2001-05-09 there was a bug where Delete() would # fail if it encountered any rows that did not have values in # every column. # Hunted and Squashed by (Jukka Santala - donwulff@nic.fi) self.tdb.Insert(tabname, {'x': 'X1', 'y':'Y1'}) self.tdb.Insert(tabname, {'x': 'X2', 'y':'Y2', 'z': 'Z2'}) self.tdb.Delete(tabname, conditions={'x': dbtables.PrefixCond('X')}) values = self.tdb.Select(tabname, ['y'], conditions={'x': dbtables.PrefixCond('X')}) assert len(values) == 0 def test_Modify(self): tabname = "test_Modify" self.tdb.CreateTable(tabname, ['Name', 'Type', 'Access']) self.tdb.Insert(tabname, {'Name': 'Index to MP3 files.doc', 'Type': 'Word', 'Access': '8'}) self.tdb.Insert(tabname, {'Name': 'Nifty.MP3', 'Access': '1'}) self.tdb.Insert(tabname, {'Type': 'Unknown', 'Access': '0'}) def set_type(type): if type == None: return 'MP3' return type def increment_access(count): return str(int(count)+1) def remove_value(value): return None self.tdb.Modify(tabname, conditions={'Access': dbtables.ExactCond('0')}, mappings={'Access': remove_value}) self.tdb.Modify(tabname, conditions={'Name': dbtables.LikeCond('%MP3%')}, mappings={'Type': set_type}) self.tdb.Modify(tabname, conditions={'Name': dbtables.LikeCond('%')}, mappings={'Access': increment_access}) # Delete key in select conditions values = self.tdb.Select(tabname, None, conditions={'Type': dbtables.ExactCond('Unknown')}) assert len(values) == 1, values assert values[0]['Name'] == None, values assert values[0]['Access'] == None, values # Modify value by select conditions values = self.tdb.Select(tabname, None, conditions={'Name': dbtables.ExactCond('Nifty.MP3')}) assert len(values) == 1, values assert values[0]['Type'] == "MP3", values assert values[0]['Access'] == "2", values # Make sure change applied only to select conditions values = self.tdb.Select(tabname, None, conditions={'Name': dbtables.LikeCond('%doc%')}) assert len(values) == 1, values assert values[0]['Type'] == "Word", values assert values[0]['Access'] == "9", values def suite(): theSuite = unittest.TestSuite() theSuite.addTest(unittest.makeSuite(TableDBTestCase)) return theSuite if __name__ == '__main__': unittest.main( defaultTest='suite' ) --- NEW FILE: test_env_close.py --- """ TestCases for checking that it does not segfault when a DBEnv object is closed before its DB objects. """ import sys, os, string from pprint import pprint import tempfile import glob import unittest from bsddb import db from test.test_support import verbose #---------------------------------------------------------------------- class DBEnvClosedEarlyCrash(unittest.TestCase): def setUp(self): self.homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') try: os.mkdir(self.homeDir) except os.error: pass tempfile.tempdir = self.homeDir self.filename = os.path.split(tempfile.mktemp())[1] tempfile.tempdir = None def tearDown(self): files = glob.glob(os.path.join(self.homeDir, '*')) for file in files: os.remove(file) def test01_close_dbenv_before_db(self): dbenv = db.DBEnv() dbenv.open(self.homeDir,db.DB_INIT_CDB| db.DB_CREATE |db.DB_THREAD|db.DB_INIT_MPOOL, 0666) d = db.DB(dbenv) d.open(self.filename, db.DB_BTREE, db.DB_CREATE | db.DB_THREAD, 0666) try: dbenv.close() except db.DBError: try: d.close() except db.DBError: return assert 0, "DB close did not raise an exception about its DBEnv being trashed" assert 0, "dbenv did not raise an exception about its DB being open" def test02_close_dbenv_delete_db_success(self): dbenv = db.DBEnv() dbenv.open(self.homeDir,db.DB_INIT_CDB| db.DB_CREATE |db.DB_THREAD|db.DB_INIT_MPOOL, 0666) d = db.DB(dbenv) d.open(self.filename, db.DB_BTREE, db.DB_CREATE | db.DB_THREAD, 0666) try: dbenv.close() except db.DBError: pass # good, it should raise an exception # this should not raise an exception, it should silently skip # the db->close() call as it can't be done safely. del d try: import gc except ImportError: gc = None if gc: # force d.__del__ [DB_dealloc] to be called gc.collect() #---------------------------------------------------------------------- def suite(): return unittest.makeSuite(DBEnvClosedEarlyCrash) if __name__ == '__main__': unittest.main( defaultTest='suite' ) --- NEW FILE: test_get_none.py --- """ TestCases for checking set_get_returns_none. """ import sys, os, string import tempfile from pprint import pprint import unittest from bsddb import db from test.test_support import verbose #---------------------------------------------------------------------- class GetReturnsNoneTestCase(unittest.TestCase): def setUp(self): self.filename = tempfile.mktemp() def tearDown(self): try: os.remove(self.filename) except os.error: pass def test01_get_returns_none(self): d = db.DB() d.open(self.filename, db.DB_BTREE, db.DB_CREATE) d.set_get_returns_none(1) for x in string.letters: d.put(x, x * 40) data = d.get('bad key') assert data == None data = d.get('a') assert data == 'a'*40 count = 0 c = d.cursor() rec = c.first() while rec: count = count + 1 rec = c.next() assert rec == None assert count == 52 c.close() d.close() def test02_get_raises_exception(self): d = db.DB() d.open(self.filename, db.DB_BTREE, db.DB_CREATE) d.set_get_returns_none(0) for x in string.letters: d.put(x, x * 40) self.assertRaises(db.DBNotFoundError, d.get, 'bad key') self.assertRaises(KeyError, d.get, 'bad key') data = d.get('a') assert data == 'a'*40 count = 0 exceptionHappened = 0 c = d.cursor() rec = c.first() while rec: count = count + 1 try: rec = c.next() except db.DBNotFoundError: # end of the records exceptionHappened = 1 break assert rec != None assert exceptionHappened assert count == 52 c.close() d.close() #---------------------------------------------------------------------- def suite(): return unittest.makeSuite(GetReturnsNoneTestCase) if __name__ == '__main__': unittest.main( defaultTest='suite' ) --- NEW FILE: test_join.py --- """ TestCases for using the DB.join and DBCursor.join_item methods. """ import sys, os, string import tempfile from pprint import pprint import unittest from bsddb import db from test.test_support import verbose --- NEW FILE: test_lock.py --- """ TestCases for testing the locking sub-system. """ import sys, os, string import tempfile import time from pprint import pprint from whrandom import random try: from threading import Thread, currentThread have_threads = 1 except ImportError: have_threads = 0 import unittest from test.test_support import verbose from bsddb import db #---------------------------------------------------------------------- class LockingTestCase(unittest.TestCase): def setUp(self): homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') self.homeDir = homeDir try: os.mkdir(homeDir) except os.error: pass self.env = db.DBEnv() self.env.open(homeDir, db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK | db.DB_CREATE) def tearDown(self): self.env.close() import glob files = glob.glob(os.path.join(self.homeDir, '*')) for file in files: os.remove(file) def test01_simple(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_simple..." % self.__class__.__name__ anID = self.env.lock_id() if verbose: print "locker ID: %s" % anID lock = self.env.lock_get(anID, "some locked thing", db.DB_LOCK_WRITE) if verbose: print "Aquired lock: %s" % lock time.sleep(1) self.env.lock_put(lock) if verbose: print "Released lock: %s" % lock def test02_threaded(self): if verbose: print '\n', '-=' * 30 print "Running %s.test02_threaded..." % self.__class__.__name__ threads = [] threads.append(Thread(target = self.theThread, args=(5, db.DB_LOCK_WRITE))) threads.append(Thread(target = self.theThread, args=(1, db.DB_LOCK_READ))) threads.append(Thread(target = self.theThread, args=(1, db.DB_LOCK_READ))) threads.append(Thread(target = self.theThread, args=(1, db.DB_LOCK_WRITE))) threads.append(Thread(target = self.theThread, args=(1, db.DB_LOCK_READ))) threads.append(Thread(target = self.theThread, args=(1, db.DB_LOCK_READ))) threads.append(Thread(target = self.theThread, args=(1, db.DB_LOCK_WRITE))) threads.append(Thread(target = self.theThread, args=(1, db.DB_LOCK_WRITE))) threads.append(Thread(target = self.theThread, args=(1, db.DB_LOCK_WRITE))) for t in threads: t.start() for t in threads: t.join() def theThread(self, sleepTime, lockType): name = currentThread().getName() if lockType == db.DB_LOCK_WRITE: lt = "write" else: lt = "read" anID = self.env.lock_id() if verbose: print "%s: locker ID: %s" % (name, anID) lock = self.env.lock_get(anID, "some locked thing", lockType) if verbose: print "%s: Aquired %s lock: %s" % (name, lt, lock) time.sleep(sleepTime) self.env.lock_put(lock) if verbose: print "%s: Released %s lock: %s" % (name, lt, lock) #---------------------------------------------------------------------- def suite(): theSuite = unittest.TestSuite() if have_threads: theSuite.addTest(unittest.makeSuite(LockingTestCase)) else: theSuite.addTest(unittest.makeSuite(LockingTestCase, 'test01')) return theSuite if __name__ == '__main__': unittest.main( defaultTest='suite' ) --- NEW FILE: test_misc.py --- """ Misc TestCases """ import sys, os, string import tempfile from pprint import pprint import unittest from bsddb import db from bsddb import dbshelve from test.test_support import verbose #---------------------------------------------------------------------- class MiscTestCase(unittest.TestCase): def setUp(self): self.filename = self.__class__.__name__ + '.db' homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') self.homeDir = homeDir try: os.mkdir(homeDir) except os.error: pass def tearDown(self): try: os.remove(self.filename) except os.error: pass import glob files = glob.glob(os.path.join(self.homeDir, '*')) for file in files: os.remove(file) def test01_badpointer(self): dbs = dbshelve.open(self.filename) dbs.close() self.assertRaises(db.DBError, dbs.get, "foo") def test02_db_home(self): env = db.DBEnv() # check for crash fixed when db_home is used before open() assert env.db_home is None env.open(self.homeDir, db.DB_CREATE) assert self.homeDir == env.db_home #---------------------------------------------------------------------- def suite(): return unittest.makeSuite(MiscTestCase) if __name__ == '__main__': unittest.main( defaultTest='suite' ) --- NEW FILE: test_queue.py --- """ TestCases for exercising a Queue DB. """ import sys, os, string import tempfile from pprint import pprint import unittest from bsddb import db from test.test_support import verbose #---------------------------------------------------------------------- class SimpleQueueTestCase(unittest.TestCase): def setUp(self): self.filename = tempfile.mktemp() def tearDown(self): try: os.remove(self.filename) except os.error: pass def test01_basic(self): # Basic Queue tests using the deprecated DBCursor.consume method. if verbose: print '\n', '-=' * 30 print "Running %s.test01_basic..." % self.__class__.__name__ d = db.DB() d.set_re_len(40) # Queues must be fixed length d.open(self.filename, db.DB_QUEUE, db.DB_CREATE) if verbose: print "before appends" + '-' * 30 pprint(d.stat()) for x in string.letters: d.append(x * 40) assert len(d) == 52 d.put(100, "some more data") d.put(101, "and some more ") d.put(75, "out of order") d.put(1, "replacement data") assert len(d) == 55 if verbose: print "before close" + '-' * 30 pprint(d.stat()) d.close() del d d = db.DB() d.open(self.filename) if verbose: print "after open" + '-' * 30 pprint(d.stat()) d.append("one more") c = d.cursor() if verbose: print "after append" + '-' * 30 pprint(d.stat()) rec = c.consume() while rec: if verbose: print rec rec = c.consume() c.close() if verbose: print "after consume loop" + '-' * 30 pprint(d.stat()) assert len(d) == 0, \ "if you see this message then you need to rebuild BerkeleyDB 3.1.17 "\ "with the patch in patches/qam_stat.diff" d.close() def test02_basicPost32(self): # Basic Queue tests using the new DB.consume method in DB 3.2+ # (No cursor needed) if verbose: print '\n', '-=' * 30 print "Running %s.test02_basicPost32..." % self.__class__.__name__ if db.version() < (3, 2, 0): if verbose: print "Test not run, DB not new enough..." return d = db.DB() d.set_re_len(40) # Queues must be fixed length d.open(self.filename, db.DB_QUEUE, db.DB_CREATE) if verbose: print "before appends" + '-' * 30 pprint(d.stat()) for x in string.letters: d.append(x * 40) assert len(d) == 52 d.put(100, "some more data") d.put(101, "and some more ") d.put(75, "out of order") d.put(1, "replacement data") assert len(d) == 55 if verbose: print "before close" + '-' * 30 pprint(d.stat()) d.close() del d d = db.DB() d.open(self.filename) #d.set_get_returns_none(true) if verbose: print "after open" + '-' * 30 pprint(d.stat()) d.append("one more") if verbose: print "after append" + '-' * 30 pprint(d.stat()) rec = d.consume() while rec: if verbose: print rec rec = d.consume() if verbose: print "after consume loop" + '-' * 30 pprint(d.stat()) d.close() #---------------------------------------------------------------------- def suite(): return unittest.makeSuite(SimpleQueueTestCase) if __name__ == '__main__': unittest.main( defaultTest='suite' ) --- NEW FILE: test_recno.py --- """ TestCases for exercising a Recno DB. """ import sys, os, string import tempfile from pprint import pprint import unittest from bsddb import db from test.test_support import verbose #---------------------------------------------------------------------- class SimpleRecnoTestCase(unittest.TestCase): def setUp(self): self.filename = tempfile.mktemp() def tearDown(self): try: os.remove(self.filename) except os.error: pass def test01_basic(self): d = db.DB() d.open(self.filename, db.DB_RECNO, db.DB_CREATE) for x in string.letters: recno = d.append(x * 60) assert type(recno) == type(0) assert recno >= 1 if verbose: print recno, if verbose: print stat = d.stat() if verbose: pprint(stat) for recno in range(1, len(d)+1): data = d[recno] if verbose: print data assert type(data) == type("") assert data == d.get(recno) try: data = d[0] # This should raise a KeyError!?!?! except db.DBInvalidArgError, val: assert val[0] == db.EINVAL if verbose: print val else: self.fail("expected exception") try: data = d[100] except KeyError: pass else: self.fail("expected exception") data = d.get(100) assert data == None keys = d.keys() if verbose: print keys assert type(keys) == type([]) assert type(keys[0]) == type(123) assert len(keys) == len(d) items = d.items() if verbose: pprint(items) assert type(items) == type([]) assert type(items[0]) == type(()) assert len(items[0]) == 2 assert type(items[0][0]) == type(123) assert type(items[0][1]) == type("") assert len(items) == len(d) assert d.has_key(25) del d[25] assert not d.has_key(25) d.delete(13) assert not d.has_key(13) data = d.get_both(26, "z" * 60) assert data == "z" * 60 if verbose: print data fd = d.fd() if verbose: print fd c = d.cursor() rec = c.first() while rec: if verbose: print rec rec = c.next() c.set(50) rec = c.current() if verbose: print rec c.put(-1, "a replacement record", db.DB_CURRENT) c.set(50) rec = c.current() assert rec == (50, "a replacement record") if verbose: print rec rec = c.set_range(30) if verbose: print rec c.close() d.close() d = db.DB() d.open(self.filename) c = d.cursor() # put a record beyond the consecutive end of the recno's d[100] = "way out there" assert d[100] == "way out there" try: data = d[99] except KeyError: pass else: self.fail("expected exception") try: d.get(99) except db.DBKeyEmptyError, val: assert val[0] == db.DB_KEYEMPTY if verbose: print val else: self.fail("expected exception") rec = c.set(40) while rec: if verbose: print rec rec = c.next() c.close() d.close() def test02_WithSource(self): """ A Recno file that is given a "backing source file" is essentially a simple ASCII file. Normally each record is delimited by \n and so is just a line in the file, but you can set a different record delimiter if needed. """ source = os.path.join(os.path.dirname(sys.argv[0]), 'db_home/test_recno.txt') f = open(source, 'w') # create the file f.close() d = db.DB() d.set_re_delim(0x0A) # This is the default value, just checking if both int d.set_re_delim('\n') # and char can be used... d.set_re_source(source) d.open(self.filename, db.DB_RECNO, db.DB_CREATE) data = string.split("The quick brown fox jumped over the lazy dog") for datum in data: d.append(datum) d.sync() d.close() # get the text from the backing source text = open(source, 'r').read() text = string.strip(text) if verbose: print text print data print string.split(text, '\n') assert string.split(text, '\n') == data # open as a DB again d = db.DB() d.set_re_source(source) d.open(self.filename, db.DB_RECNO) d[3] = 'reddish-brown' d[8] = 'comatose' d.sync() d.close() text = open(source, 'r').read() text = string.strip(text) if verbose: print text print string.split(text, '\n') assert string.split(text, '\n') == string.split("The quick reddish-brown fox jumped over the comatose dog") def test03_FixedLength(self): d = db.DB() d.set_re_len(40) # fixed length records, 40 bytes long d.set_re_pad('-') # sets the pad character... d.set_re_pad(45) # ...test both int and char d.open(self.filename, db.DB_RECNO, db.DB_CREATE) for x in string.letters: d.append(x * 35) # These will be padded d.append('.' * 40) # this one will be exact try: # this one will fail d.append('bad' * 20) except db.DBInvalidArgError, val: assert val[0] == db.EINVAL if verbose: print val else: self.fail("expected exception") c = d.cursor() rec = c.first() while rec: if verbose: print rec rec = c.next() c.close() d.close() #---------------------------------------------------------------------- def suite(): return unittest.makeSuite(SimpleRecnoTestCase) if __name__ == '__main__': unittest.main( defaultTest='suite' ) --- NEW FILE: test_thread.py --- """ TestCases for multi-threaded access to a DB. """ import sys, os, string import tempfile import time from pprint import pprint from whrandom import random try: from threading import Thread, currentThread have_threads = 1 except ImportError: have_threads = 0 import unittest from test.test_support import verbose from bsddb import db #---------------------------------------------------------------------- class BaseThreadedTestCase(unittest.TestCase): dbtype = db.DB_UNKNOWN # must be set in derived class dbopenflags = 0 dbsetflags = 0 envflags = 0 def setUp(self): homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') self.homeDir = homeDir try: os.mkdir(homeDir) except os.error: pass self.env = db.DBEnv() self.setEnvOpts() self.env.open(homeDir, self.envflags | db.DB_CREATE) self.filename = self.__class__.__name__ + '.db' self.d = db.DB(self.env) if self.dbsetflags: self.d.set_flags(self.dbsetflags) self.d.open(self.filename, self.dbtype, self.dbopenflags|db.DB_CREATE) def tearDown(self): self.d.close() self.env.close() import glob files = glob.glob(os.path.join(self.homeDir, '*')) for file in files: os.remove(file) def setEnvOpts(self): pass def makeData(self, key): return string.join([key] * 5, '-') #---------------------------------------------------------------------- class ConcurrentDataStoreBase(BaseThreadedTestCase): dbopenflags = db.DB_THREAD envflags = db.DB_THREAD | db.DB_INIT_CDB | db.DB_INIT_MPOOL readers = 0 # derived class should set writers = 0 records = 1000 def test01_1WriterMultiReaders(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_1WriterMultiReaders..." % self.__class__.__name__ threads = [] for x in range(self.writers): wt = Thread(target = self.writerThread, args = (self.d, self.records, x), name = 'writer %d' % x, )#verbose = verbose) threads.append(wt) for x in range(self.readers): rt = Thread(target = self.readerThread, args = (self.d, x), name = 'reader %d' % x, )#verbose = verbose) threads.append(rt) for t in threads: t.start() for t in threads: t.join() def writerThread(self, d, howMany, writerNum): #time.sleep(0.01 * writerNum + 0.01) name = currentThread().getName() start, stop = howMany * writerNum, howMany * (writerNum + 1) - 1 if verbose: print "%s: creating records %d - %d" % (name, start, stop) for x in range(start, stop): key = '%04d' % x d.put(key, self.makeData(key)) if verbose and x % 100 == 0: print "%s: records %d - %d finished" % (name, start, x) if verbose: print "%s: finished creating records" % name ## # Each write-cursor will be exclusive, the only one that can update the DB... ## if verbose: print "%s: deleting a few records" % name ## c = d.cursor(flags = db.DB_WRITECURSOR) ## for x in range(10): ## key = int(random() * howMany) + start ## key = '%04d' % key ## if d.has_key(key): ## c.set(key) ## c.delete() ## c.close() if verbose: print "%s: thread finished" % name def readerThread(self, d, readerNum): time.sleep(0.01 * readerNum) name = currentThread().getName() for loop in range(5): c = d.cursor() count = 0 rec = c.first() while rec: count = count + 1 key, data = rec assert self.makeData(key) == data rec = c.next() if verbose: print "%s: found %d records" % (name, count) c.close() time.sleep(0.05) if verbose: print "%s: thread finished" % name class BTreeConcurrentDataStore(ConcurrentDataStoreBase): dbtype = db.DB_BTREE writers = 2 readers = 10 records = 1000 class HashConcurrentDataStore(ConcurrentDataStoreBase): dbtype = db.DB_HASH writers = 2 readers = 10 records = 1000 #---------------------------------------------------------------------- class SimpleThreadedBase(BaseThreadedTestCase): dbopenflags = db.DB_THREAD envflags = db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK readers = 5 writers = 3 records = 1000 def setEnvOpts(self): self.env.set_lk_detect(db.DB_LOCK_DEFAULT) def test02_SimpleLocks(self): if verbose: print '\n', '-=' * 30 print "Running %s.test02_SimpleLocks..." % self.__class__.__name__ threads = [] for x in range(self.writers): wt = Thread(target = self.writerThread, args = (self.d, self.records, x), name = 'writer %d' % x, )#verbose = verbose) threads.append(wt) for x in range(self.readers): rt = Thread(target = self.readerThread, args = (self.d, x), name = 'reader %d' % x, )#verbose = verbose) threads.append(rt) for t in threads: t.start() for t in threads: t.join() def writerThread(self, d, howMany, writerNum): name = currentThread().getName() start, stop = howMany * writerNum, howMany * (writerNum + 1) - 1 if verbose: print "%s: creating records %d - %d" % (name, start, stop) # create a bunch of records for x in xrange(start, stop): key = '%04d' % x d.put(key, self.makeData(key)) if verbose and x % 100 == 0: print "%s: records %d - %d finished" % (name, start, x) # do a bit or reading too if random() <= 0.05: for y in xrange(start, x): key = '%04d' % x data = d.get(key) assert data == self.makeData(key) # flush them try: d.sync() except db.DBIncompleteError, val: if verbose: print "could not complete sync()..." # read them back, deleting a few for x in xrange(start, stop): key = '%04d' % x data = d.get(key) if verbose and x % 100 == 0: print "%s: fetched record (%s, %s)" % (name, key, data) assert data == self.makeData(key) if random() <= 0.10: d.delete(key) if verbose: print "%s: deleted record %s" % (name, key) if verbose: print "%s: thread finished" % name def readerThread(self, d, readerNum): time.sleep(0.01 * readerNum) name = currentThread().getName() for loop in range(5): c = d.cursor() count = 0 rec = c.first() while rec: count = count + 1 key, data = rec assert self.makeData(key) == data rec = c.next() if verbose: print "%s: found %d records" % (name, count) c.close() time.sleep(0.05) if verbose: print "%s: thread finished" % name class BTreeSimpleThreaded(SimpleThreadedBase): dbtype = db.DB_BTREE class HashSimpleThreaded(SimpleThreadedBase): dbtype = db.DB_BTREE #---------------------------------------------------------------------- class ThreadedTransactionsBase(BaseThreadedTestCase): dbopenflags = db.DB_THREAD envflags = (db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK | db.DB_INIT_LOG | db.DB_INIT_TXN ) readers = 0 writers = 0 records = 2000 txnFlag = 0 def setEnvOpts(self): #self.env.set_lk_detect(db.DB_LOCK_DEFAULT) pass def test03_ThreadedTransactions(self): if verbose: print '\n', '-=' * 30 print "Running %s.test03_ThreadedTransactions..." % self.__class__.__name__ threads = [] for x in range(self.writers): wt = Thread(target = self.writerThread, args = (self.d, self.records, x), name = 'writer %d' % x, )#verbose = verbose) threads.append(wt) for x in range(self.readers): rt = Thread(target = self.readerThread, args = (self.d, x), name = 'reader %d' % x, )#verbose = verbose) threads.append(rt) dt = Thread(target = self.deadlockThread) dt.start() for t in threads: t.start() for t in threads: t.join() self.doLockDetect = 0 dt.join() def doWrite(self, d, name, start, stop): finished = 0 while not finished: try: txn = self.env.txn_begin(None, self.txnFlag) for x in range(start, stop): key = '%04d' % x d.put(key, self.makeData(key), txn) if verbose and x % 100 == 0: print "%s: records %d - %d finished" % (name, start, x) txn.commit() finished = 1 except (db.DBLockDeadlockError, db.DBLockNotGrantedError), val: if verbose: print "%s: Aborting transaction (%s)" % (name, val[1]) txn.abort() time.sleep(0.05) def writerThread(self, d, howMany, writerNum): name = currentThread().getName() start, stop = howMany * writerNum, howMany * (writerNum + 1) - 1 if verbose: print "%s: creating records %d - %d" % (name, start, stop) step = 100 for x in range(start, stop, step): self.doWrite(d, name, x, min(stop, x+step)) if verbose: print "%s: finished creating records" % name if verbose: print "%s: deleting a few records" % name finished = 0 while not finished: try: recs = [] txn = self.env.txn_begin(None, self.txnFlag) for x in range(10): key = int(random() * howMany) + start key = '%04d' % key data = d.get(key, None, txn, db.DB_RMW) if data is not None: d.delete(key, txn) recs.append(key) txn.commit() finished = 1 if verbose: print "%s: deleted records %s" % (name, recs) except (db.DBLockDeadlockError, db.DBLockNotGrantedError), val: if verbose: print "%s: Aborting transaction (%s)" % (name, val[1]) txn.abort() time.sleep(0.05) if verbose: print "%s: thread finished" % name def readerThread(self, d, readerNum): time.sleep(0.01 * readerNum + 0.05) name = currentThread().getName() for loop in range(5): finished = 0 while not finished: try: txn = self.env.txn_begin(None, self.txnFlag) c = d.cursor(txn) count = 0 rec = c.first() while rec: count = count + 1 key, data = rec assert self.makeData(key) == data rec = c.next() if verbose: print "%s: found %d records" % (name, count) c.close() txn.commit() finished = 1 except (db.DBLockDeadlockError, db.DBLockNotGrantedError), val: if verbose: print "%s: Aborting transaction (%s)" % (name, val[1]) c.close() txn.abort() time.sleep(0.05) time.sleep(0.05) if verbose: print "%s: thread finished" % name def deadlockThread(self): self.doLockDetect = 1 while self.doLockDetect: time.sleep(0.5) try: aborted = self.env.lock_detect(db.DB_LOCK_RANDOM, db.DB_LOCK_CONFLICT) if verbose and aborted: print "deadlock: Aborted %d deadlocked transaction(s)" % aborted except db.DBError: pass class BTreeThreadedTransactions(ThreadedTransactionsBase): dbtype = db.DB_BTREE writers = 3 readers = 5 records = 2000 class HashThreadedTransactions(ThreadedTransactionsBase): dbtype = db.DB_HASH writers = 1 readers = 5 records = 2000 class BTreeThreadedNoWaitTransactions(ThreadedTransactionsBase): dbtype = db.DB_BTREE writers = 3 readers = 5 records = 2000 txnFlag = db.DB_TXN_NOWAIT class HashThreadedNoWaitTransactions(ThreadedTransactionsBase): dbtype = db.DB_HASH writers = 1 readers = 5 records = 2000 txnFlag = db.DB_TXN_NOWAIT #---------------------------------------------------------------------- def suite(): theSuite = unittest.TestSuite() if have_threads: theSuite.addTest(unittest.makeSuite(BTreeConcurrentDataStore)) theSuite.addTest(unittest.makeSuite(HashConcurrentDataStore)) theSuite.addTest(unittest.makeSuite(BTreeSimpleThreaded)) theSuite.addTest(unittest.makeSuite(HashSimpleThreaded)) theSuite.addTest(unittest.makeSuite(BTreeThreadedTransactions)) theSuite.addTest(unittest.makeSuite(HashThreadedTransactions)) theSuite.addTest(unittest.makeSuite(BTreeThreadedNoWaitTransactions)) theSuite.addTest(unittest.makeSuite(HashThreadedNoWaitTransactions)) else: print "Threads not available, skipping thread tests." return theSuite if __name__ == '__main__': unittest.main( defaultTest='suite' ) From loewis@users.sourceforge.net Tue Nov 19 17:47:35 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 19 Nov 2002 09:47:35 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_bsddb3.py,NONE,1.1 regrtest.py,1.101,1.102 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv32371/Lib/test Modified Files: regrtest.py Added Files: test_bsddb3.py Log Message: Importing test suite from bsddb3 3.4.0 (with modifications). --- NEW FILE: test_bsddb3.py --- # Test driver for bsddb package. """ Run all test cases. """ import sys import unittest from test.test_support import requires, verbose, run_suite requires('bsddb') verbose = 0 if 'verbose' in sys.argv: verbose = 1 sys.argv.remove('verbose') if 'silent' in sys.argv: # take care of old flag, just in case verbose = 0 sys.argv.remove('silent') def suite(): test_modules = [ 'test_compat', 'test_basics', 'test_misc', 'test_dbobj', 'test_recno', 'test_queue', 'test_get_none', 'test_dbshelve', 'test_dbtables', 'test_thread', 'test_lock', 'test_associate', ] alltests = unittest.TestSuite() for name in test_modules: module = __import__("bsddb.test."+name, globals(), locals(), name) print module,name alltests.addTest(module.suite()) return alltests # For invocation through regrtest def test_main(): tests = suite() run_suite(tests) # For invocation as a script if __name__ == '__main__': from bsddb import db print '-=' * 38 print db.DB_VERSION_STRING print 'bsddb3.db.version(): %s' % (db.version(), ) print 'bsddb3.db.__version__: %s' % db.__version__ print 'bsddb3.db.cvsid: %s' % db.cvsid print 'python version: %s' % sys.version print '-=' * 38 unittest.main( defaultTest='suite' ) Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** regrtest.py 17 Oct 2002 20:36:08 -0000 1.101 --- regrtest.py 19 Nov 2002 17:46:59 -0000 1.102 *************** *** 56,59 **** --- 56,62 ---- network - It is okay to run tests that use external network resource, e.g. testing SSL support for sockets. + + bsddb - It is okay to run the bsddb testsuite, which takes + a long time to complete. """ *************** *** 79,83 **** from test import test_support ! RESOURCE_NAMES = ('curses', 'largefile', 'network') --- 82,86 ---- from test import test_support ! RESOURCE_NAMES = ('curses', 'largefile', 'network', 'bsddb') From loewis@users.sourceforge.net Tue Nov 19 17:48:53 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 19 Nov 2002 09:48:53 -0800 Subject: [Python-checkins] python/dist/src/Lib/bsddb db.py,1.1,1.2 dbshelve.py,1.1,1.2 dbtables.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb In directory sc8-pr-cvs1:/tmp/cvs-serv1518 Modified Files: db.py dbshelve.py dbtables.py Log Message: Replace bsddb3 and _db occurrences. Index: db.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/db.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** db.py 19 Nov 2002 08:09:52 -0000 1.1 --- db.py 19 Nov 2002 17:48:48 -0000 1.2 *************** *** 38,43 **** # it just simply imports everything from _db. ! from _db import * ! from _db import __version__ if version() < (3, 1, 0): --- 38,43 ---- # it just simply imports everything from _db. ! from _bsddb import * ! from _bsddb import __version__ if version() < (3, 1, 0): Index: dbshelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/dbshelve.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dbshelve.py 19 Nov 2002 08:09:52 -0000 1.1 --- dbshelve.py 19 Nov 2002 17:48:49 -0000 1.2 *************** *** 32,36 **** import cPickle ! from bsddb3 import db #------------------------------------------------------------------------ --- 32,36 ---- import cPickle ! from bsddb import db #------------------------------------------------------------------------ Index: dbtables.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/dbtables.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dbtables.py 19 Nov 2002 08:09:52 -0000 1.1 --- dbtables.py 19 Nov 2002 17:48:49 -0000 1.2 *************** *** 29,33 **** import copy ! from bsddb3.db import * --- 29,33 ---- import copy ! from bsddb.db import * From gvanrossum@users.sourceforge.net Tue Nov 19 19:22:28 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 19 Nov 2002 11:22:28 -0800 Subject: [Python-checkins] python/dist/src/Lib rexec.py,1.34.10.3,1.34.10.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv8825 Modified Files: Tag: release22-maint rexec.py Log Message: Add more names to ok_sys_names, including hexversion; otherwise the sre module and everything using it (e.g. re and glob) won't work. Index: rexec.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/rexec.py,v retrieving revision 1.34.10.3 retrieving revision 1.34.10.4 diff -C2 -d -r1.34.10.3 -r1.34.10.4 *** rexec.py 15 Sep 2002 06:08:27 -0000 1.34.10.3 --- rexec.py 19 Nov 2002 19:22:25 -0000 1.34.10.4 *************** *** 144,149 **** 'getcwd', 'getuid', 'getgid', 'geteuid', 'getegid') ! ok_sys_names = ('ps1', 'ps2', 'copyright', 'version', ! 'platform', 'exit', 'maxint') nok_builtin_names = ('open', 'file', 'reload', '__import__') --- 144,150 ---- 'getcwd', 'getuid', 'getgid', 'geteuid', 'getegid') ! ok_sys_names = ('byteorder', 'copyright', 'exit', 'getdefaultencoding', ! 'getrefcount', 'hexversion', 'maxint', 'maxunicode', ! 'platform', 'ps1', 'ps2', 'version', 'version_info') nok_builtin_names = ('open', 'file', 'reload', '__import__') From akuchling@users.sourceforge.net Tue Nov 19 19:43:42 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 19 Nov 2002 11:43:42 -0800 Subject: [Python-checkins] distutils TODO,1.13,1.14 Message-ID: Update of /cvsroot/python/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv17831 Modified Files: TODO Log Message: Add some items Index: TODO =================================================================== RCS file: /cvsroot/python/distutils/TODO,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TODO 19 Nov 2002 14:50:33 -0000 1.13 --- TODO 19 Nov 2002 19:43:39 -0000 1.14 *************** *** 6,9 **** --- 6,15 ---- * get the test suites running again + * document the recent bdist_wininst improvements (Thomas Heller) + + * Bugs to fix: + #410541 : bdist builds bogus .zips + #639118 : archiver should use zipfile before zip + * add Richard Jones' register command. From doerwalter@users.sourceforge.net Tue Nov 19 20:49:17 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 19 Nov 2002 12:49:17 -0800 Subject: [Python-checkins] python/dist/src/Objects floatobject.c,2.116,2.117 intobject.c,2.94,2.95 longobject.c,1.144,1.145 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv17074/Objects Modified Files: floatobject.c intobject.c longobject.c Log Message: Change int() so that passing a string, unicode, float or long argument that is outside the integer range no longer raises OverflowError, but returns a long object instead. This fixes SF bug http://www.python.org/sf/635115 Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.116 retrieving revision 2.117 diff -C2 -d -r2.116 -r2.117 *** floatobject.c 18 Nov 2002 16:06:21 -0000 2.116 --- floatobject.c 19 Nov 2002 20:49:15 -0000 2.117 *************** *** 643,646 **** --- 643,653 ---- static PyObject * + float_long(PyObject *v) + { + double x = PyFloat_AsDouble(v); + return PyLong_FromDouble(x); + } + + static PyObject * float_int(PyObject *v) { *************** *** 653,658 **** /* conversion from floating to integral type would raise exception */ if (wholepart>LONG_MAX || wholepartLONG_MAX || wholepart retry int conversion */ ! val = PyLong_AsLong((PyObject *)io); ! if (PyErr_Occurred()) { ! Py_DECREF(io); ! return -1; ! } ! } ! else ! { ! PyErr_SetString(PyExc_TypeError, ! "nb_int should return int object"); ! return -1; ! } } *************** *** 893,897 **** representation of a floating point number!) When converting a string, use\n\ the optional base. It is an error to supply a base when converting a\n\ ! non-string."); static PyNumberMethods int_as_number = { --- 904,909 ---- representation of a floating point number!) When converting a string, use\n\ the optional base. It is an error to supply a base when converting a\n\ ! non-string. If the argument is outside the integer range a long object\n\ ! will be returned instead."); static PyNumberMethods int_as_number = { Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.144 retrieving revision 1.145 diff -C2 -d -r1.144 -r1.145 *** longobject.c 6 Nov 2002 16:15:14 -0000 1.144 --- longobject.c 19 Nov 2002 20:49:15 -0000 1.145 *************** *** 2518,2535 **** static PyObject * ! long_int(PyObject *v) { ! long x; ! x = PyLong_AsLong(v); ! if (PyErr_Occurred()) ! return NULL; ! return PyInt_FromLong(x); } static PyObject * ! long_long(PyObject *v) { ! Py_INCREF(v); ! return v; } --- 2518,2546 ---- static PyObject * ! long_long(PyObject *v) { ! Py_INCREF(v); ! return v; } static PyObject * ! long_int(PyObject *v) { ! long x; ! x = PyLong_AsLong(v); ! if (PyErr_Occurred()) { ! if (PyErr_ExceptionMatches(PyExc_OverflowError)) { ! PyErr_Clear(); ! if (PyLong_CheckExact(v)) { ! Py_INCREF(v); ! return v; ! } ! else ! return _PyLong_Copy((PyLongObject *)v); ! } ! else ! return NULL; ! } ! return PyInt_FromLong(x); } From doerwalter@users.sourceforge.net Tue Nov 19 20:49:17 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 19 Nov 2002 12:49:17 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.528,1.529 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv17074/Misc Modified Files: NEWS Log Message: Change int() so that passing a string, unicode, float or long argument that is outside the integer range no longer raises OverflowError, but returns a long object instead. This fixes SF bug http://www.python.org/sf/635115 Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.528 retrieving revision 1.529 diff -C2 -d -r1.528 -r1.529 *** NEWS 19 Nov 2002 08:12:57 -0000 1.528 --- NEWS 19 Nov 2002 20:49:13 -0000 1.529 *************** *** 12,15 **** --- 12,18 ---- Type/class unification and new-style classes -------------------------------------------- + - int() now returns a long object if the argument is outside the + integer range, so int("4"*1000), int(1e200) and int(1L<<1000) will + all return long objects instead of raising an OverflowError. - Assignment to __class__ is disallowed if either the old or the new From doerwalter@users.sourceforge.net Tue Nov 19 20:49:45 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 19 Nov 2002 12:49:45 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.119,1.120 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv17074/Doc/lib Modified Files: libfuncs.tex Log Message: Change int() so that passing a string, unicode, float or long argument that is outside the integer range no longer raises OverflowError, but returns a long object instead. This fixes SF bug http://www.python.org/sf/635115 Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** libfuncs.tex 1 Nov 2002 21:33:44 -0000 1.119 --- libfuncs.tex 19 Nov 2002 20:49:13 -0000 1.120 *************** *** 508,511 **** --- 508,513 ---- long integer or a floating point number. Conversion of floating point numbers to integers truncates (towards zero). + If the argument is outside the integer range a long object will + be returned instead. \end{funcdesc} From doerwalter@users.sourceforge.net Tue Nov 19 20:49:45 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 19 Nov 2002 12:49:45 -0800 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv17074/Doc/api Modified Files: abstract.tex Log Message: Change int() so that passing a string, unicode, float or long argument that is outside the integer range no longer raises OverflowError, but returns a long object instead. This fixes SF bug http://www.python.org/sf/635115 Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** abstract.tex 8 Sep 2002 04:39:28 -0000 1.19 --- abstract.tex 19 Nov 2002 20:49:12 -0000 1.20 *************** *** 651,656 **** \begin{cfuncdesc}{PyObject*}{PyNumber_Int}{PyObject *o} Returns the \var{o} converted to an integer object on success, or ! \NULL{} on failure. This is the equivalent of the Python expression ! \samp{int(\var{o})}.\bifuncindex{int} \end{cfuncdesc} --- 651,657 ---- \begin{cfuncdesc}{PyObject*}{PyNumber_Int}{PyObject *o} Returns the \var{o} converted to an integer object on success, or ! \NULL{} on failure. If the argument is outside the integer range ! a long object will be returned instead. This is the equivalent ! of the Python expression \samp{int(\var{o})}.\bifuncindex{int} \end{cfuncdesc} From doerwalter@users.sourceforge.net Tue Nov 19 20:49:45 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 19 Nov 2002 12:49:45 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_b1.py,1.57,1.58 test_long.py,1.20,1.21 test_types.py,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17074/Lib/test Modified Files: test_b1.py test_long.py test_types.py Log Message: Change int() so that passing a string, unicode, float or long argument that is outside the integer range no longer raises OverflowError, but returns a long object instead. This fixes SF bug http://www.python.org/sf/635115 Index: test_b1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** test_b1.py 9 Nov 2002 05:26:13 -0000 1.57 --- test_b1.py 19 Nov 2002 20:49:13 -0000 1.58 *************** *** 439,453 **** raise TestFailed, "int(%s)" % `s[1:]` + " should return long" try: ! int(1e100) except OverflowError: ! pass else: ! raise TestFailed("int(1e100) expected OverflowError") try: ! int(-1e100) except OverflowError: ! pass else: ! raise TestFailed("int(-1e100) expected OverflowError") --- 439,455 ---- raise TestFailed, "int(%s)" % `s[1:]` + " should return long" try: ! x = int(1e100) except OverflowError: ! raise TestFailed("int(1e100) mustn't raise OverflowError") else: ! if not isinstance(x, long): ! raise TestFailed("int(1e100) should have returned long") try: ! x = int(-1e100) except OverflowError: ! raise TestFailed("int(-1e100) mustn't raise OverflowError") else: ! if not isinstance(x, long): ! raise TestFailed("int(-1e100) should have returned long") Index: test_long.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_long.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** test_long.py 13 Aug 2002 21:06:55 -0000 1.20 --- test_long.py 19 Nov 2002 20:49:13 -0000 1.21 *************** *** 268,287 **** x = hugepos_aslong + 1 try: ! int(x) ! raise ValueError except OverflowError: ! pass ! except: ! raise TestFailed, "int(long(sys.maxint) + 1) didn't overflow" x = hugeneg_aslong - 1 try: ! int(x) ! raise ValueError except OverflowError: ! pass ! except: ! raise TestFailed, "int(long(-sys.maxint-1) - 1) didn't overflow" # ----------------------------------- tests of auto int->long conversion --- 268,291 ---- x = hugepos_aslong + 1 try: ! y = int(x) except OverflowError: ! raise TestFailed, "int(long(sys.maxint) + 1) mustn't overflow" ! if not isinstance(y, long): ! raise TestFailed("int(long(sys.maxint) + 1) should have returned long") x = hugeneg_aslong - 1 try: ! y = int(x) except OverflowError: ! raise TestFailed, "int(long(-sys.maxint-1) - 1) mustn't overflow" ! if not isinstance(y, long): ! raise TestFailed("int(long(-sys.maxint-1) - 1) should have returned long") + class long2(long): + pass + x = long2(1L<<100) + y = int(x) + if type(y) is not long: + raise TestFailed("overflowing int conversion must return long not long subtype") # ----------------------------------- tests of auto int->long conversion Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** test_types.py 12 Nov 2002 22:08:08 -0000 1.39 --- test_types.py 19 Nov 2002 20:49:13 -0000 1.40 *************** *** 139,152 **** x = sys.maxint if int(long(x)) != x: raise TestFailed, 'long op' ! try: int(long(x)+1L) ! except OverflowError: pass ! else:raise TestFailed, 'long op' x = -x if int(long(x)) != x: raise TestFailed, 'long op' x = x-1 if int(long(x)) != x: raise TestFailed, 'long op' ! try: int(long(x)-1L) ! except OverflowError: pass ! else:raise TestFailed, 'long op' try: 5 << -5 --- 139,152 ---- x = sys.maxint if int(long(x)) != x: raise TestFailed, 'long op' ! try: y = int(long(x)+1L) ! except OverflowError: raise TestFailed, 'long op' ! if not isinstance(y, long): raise TestFailed, 'long op' x = -x if int(long(x)) != x: raise TestFailed, 'long op' x = x-1 if int(long(x)) != x: raise TestFailed, 'long op' ! try: y = int(long(x)-1L) ! except OverflowError: raise TestFailed, 'long op' ! if not isinstance(y, long): raise TestFailed, 'long op' try: 5 << -5 From doerwalter@users.sourceforge.net Tue Nov 19 21:20:28 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 19 Nov 2002 13:20:28 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.529,1.530 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv30061/Misc Modified Files: NEWS Log Message: Fix typo. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.529 retrieving revision 1.530 diff -C2 -d -r1.529 -r1.530 *** NEWS 19 Nov 2002 20:49:13 -0000 1.529 --- NEWS 19 Nov 2002 21:20:25 -0000 1.530 *************** *** 703,707 **** This is a result of these types having a partially defined tp_as_number slot. (This is not a feature, but an indication that ! PyNumber_check() is not very useful to determine numeric behavior. It may be deprecated.) --- 703,707 ---- This is a result of these types having a partially defined tp_as_number slot. (This is not a feature, but an indication that ! PyNumber_Check() is not very useful to determine numeric behavior. It may be deprecated.) From doerwalter@users.sourceforge.net Tue Nov 19 21:42:56 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 19 Nov 2002 13:42:56 -0800 Subject: [Python-checkins] python/dist/src/Lib codecs.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv6477/Lib Modified Files: codecs.py Log Message: Add missing documentation for the PEP 293 functionality to the codecs docstrings. Index: codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/codecs.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** codecs.py 6 Nov 2002 16:53:44 -0000 1.28 --- codecs.py 19 Nov 2002 21:42:53 -0000 1.29 *************** *** 68,74 **** """ Defines the interface for stateless encoders/decoders. ! The .encode()/.decode() methods may implement different error handling schemes by providing the errors argument. These ! string values are defined: 'strict' - raise a ValueError error (or a subclass) --- 68,74 ---- """ Defines the interface for stateless encoders/decoders. ! The .encode()/.decode() methods may use different error handling schemes by providing the errors argument. These ! string values are predefined: 'strict' - raise a ValueError error (or a subclass) *************** *** 76,80 **** 'replace' - replace with a suitable replacement character; Python will use the official U+FFFD REPLACEMENT ! CHARACTER for the builtin Unicode codecs. """ --- 76,87 ---- 'replace' - replace with a suitable replacement character; Python will use the official U+FFFD REPLACEMENT ! CHARACTER for the builtin Unicode codecs on ! decoding and '?' on encoding. ! 'xmlcharrefreplace' - Replace with the appropriate XML ! character reference (only for encoding). ! 'backslashreplace' - Replace with backslashed escape sequences ! (only for encoding). ! ! The set of allowed values can be extended via register_error. """ *************** *** 137,148 **** (binary) data. ! The StreamWriter may implement different error handling schemes by providing the errors keyword argument. These ! parameters are defined: 'strict' - raise a ValueError (or a subclass) 'ignore' - ignore the character and continue with the next 'replace'- replace with a suitable replacement character """ self.stream = stream --- 144,161 ---- (binary) data. ! The StreamWriter may use different error handling schemes by providing the errors keyword argument. These ! parameters are predefined: 'strict' - raise a ValueError (or a subclass) 'ignore' - ignore the character and continue with the next 'replace'- replace with a suitable replacement character + 'xmlcharrefreplace' - Replace with the appropriate XML + character reference. + 'backslashreplace' - Replace with backslashed escape + sequences (only for encoding). + The set of allowed parameter values can be extended via + register_error. """ self.stream = stream *************** *** 193,199 **** (binary) data. ! The StreamReader may implement different error handling schemes by providing the errors keyword argument. These ! parameters are defined: 'strict' - raise a ValueError (or a subclass) --- 206,212 ---- (binary) data. ! The StreamReader may use different error handling schemes by providing the errors keyword argument. These ! parameters are predefined: 'strict' - raise a ValueError (or a subclass) *************** *** 201,204 **** --- 214,219 ---- 'replace'- replace with a suitable replacement character; + The set of allowed parameter values can be extended via + register_error. """ self.stream = stream From doerwalter@users.sourceforge.net Tue Nov 19 21:51:38 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 19 Nov 2002 13:51:38 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libcodecs.tex,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv9893/Doc/lib Modified Files: libcodecs.tex Log Message: Document additional error handling names available through PEP 293. Index: libcodecs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodecs.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** libcodecs.tex 7 Nov 2002 22:33:17 -0000 1.14 --- libcodecs.tex 19 Nov 2002 21:51:35 -0000 1.15 *************** *** 46,52 **** Possible values for errors are \code{'strict'} (raise an exception in case of an encoding error), \code{'replace'} (replace malformed ! data with a suitable replacement marker, such as \character{?}) and \code{'ignore'} (ignore malformed data and continue without further ! notice). In case a search function cannot find a given encoding, it should --- 46,56 ---- Possible values for errors are \code{'strict'} (raise an exception in case of an encoding error), \code{'replace'} (replace malformed ! data with a suitable replacement marker, such as \character{?}), \code{'ignore'} (ignore malformed data and continue without further ! notice), \code{'xmlcharrefreplace'} (replace with the appropriate XML ! character reference (for encoding only)) and \code{'backslashreplace'} ! (replace with backslashed escape sequences (for encoding only)) as ! well as any other error handling name defined via ! \function{register_error()}. In case a search function cannot find a given encoding, it should From jvr@users.sourceforge.net Tue Nov 19 22:01:04 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Tue, 19 Nov 2002 14:01:04 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib plistlib.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv13639 Added Files: plistlib.py Log Message: Pure Python implementation of a plist generator/parser. --- NEW FILE: plistlib.py --- """plistlib.py -- a tool to generate and parse MacOSX .plist files. The main class in this module is Plist. It takes a set of arbitrary keyword arguments, which will be the top level elements of the plist dictionary. After instantiation you can add more elements by assigning new attributes to the Plist instance. To write out a plist file, call the write() method of the Plist instance with a filename or a file object. To parse a plist from a file, use the Plist.fromFile(pathOrFile) classmethod, with a file name or a file object as the only argument. (Warning: you need pyexpat installed for this to work, ie. it doesn't work with a vanilla Python 2.2 as shipped with MacOS X.2.) Values can be strings, integers, floats, booleans, tuples, lists, dictionaries, Data or Date objects. String values (including dictionary keys) may be unicode strings -- they will be written out as UTF-8. For convenience, this module exports a class named Dict(), which allows you to easily construct (nested) dicts using keyword arguments. But regular dicts work, too. To support Boolean values in plists with Python < 2.3, "bool", "True" and "False" are exported. Use these symbols from this module if you want to be compatible with Python 2.2.x (strongly recommended). The plist type is supported through the Data class. This is a thin wrapper around a Python string. The plist data has (limited) support through the Date class. (Warning: Dates are only supported if the PyXML package is installed.) Generate Plist example: pl = Plist( Foo="Doodah", aList=["A", "B", 12, 32.1, [1, 2, 3]], aFloat = 0.1, anInt = 728, aDict=Dict( aString="", SomeUnicodeValue=u'M\xe4ssig, Ma\xdf', someTrueValue=True, someFalseValue=False, ), someData = Data("hello there!"), someMoreData = Data("hello there! " * 10), aDate = Date(time.mktime(time.gmtime())), ) # unicode keys are possible, but a little awkward to use: pl[u'\xc5benraa'] = "That was a unicode key." pl.write(fileName) Parse Plist example: pl = Plist.fromFile(pathOrFile) print pl.aKey """ # written by Just van Rossum (just@letterror.com), 2002-11-19 __all__ = ["Plist", "Data", "Date", "Dict", "False", "True", "bool"] INDENT = "\t" class DumbXMLWriter: def __init__(self, file): self.file = file self.stack = [] self.indentLevel = 0 def beginElement(self, element): self.stack.append(element) element = _encode(element) self.writeln("<%s>" % element) self.indentLevel += 1 def endElement(self, element): assert self.indentLevel > 0 assert self.stack.pop() == element self.indentLevel -= 1 self.writeln("" % element) def simpleElement(self, element, value=None): if value: element = _encode(element) value = _encode(value) self.writeln("<%s>%s" % (element, value, element)) else: self.writeln("<%s/>" % element) def writeln(self, line): if line: self.file.write(self.indentLevel * INDENT + line + "\n") else: self.file.write("\n") def _encode(text): text = text.replace("&", "&") text = text.replace("<", "<") return text.encode("utf-8") PLISTHEADER = """\ """ class PlistWriter(DumbXMLWriter): def __init__(self, file): file.write(PLISTHEADER) DumbXMLWriter.__init__(self, file) def writeValue(self, value): if isinstance(value, (str, unicode)): self.simpleElement("string", value) elif isinstance(value, bool): # must switch for bool before int, as bool is a # subclass of int... if value: self.simpleElement("true") else: self.simpleElement("false") elif isinstance(value, int): self.simpleElement("integer", str(value)) elif isinstance(value, float): # should perhaps use repr() for better precision? self.simpleElement("real", str(value)) elif isinstance(value, (dict, Dict)): self.writeDict(value) elif isinstance(value, Data): self.writeData(value) elif isinstance(value, Date): self.simpleElement("date", value.toString()) elif isinstance(value, (tuple, list)): self.writeArray(value) else: assert 0, "unsuported type: %s" % type(value) def writeData(self, data): self.beginElement("data") for line in data.asBase64().split("\n"): if line: self.writeln(line.strip()) self.endElement("data") def writeDict(self, d): self.beginElement("dict") items = d.items() items.sort() for key, value in items: assert isinstance(key, (str, unicode)), "keys must be strings" self.simpleElement("key", key) self.writeValue(value) self.endElement("dict") def writeArray(self, array): self.beginElement("array") for value in array: self.writeValue(value) self.endElement("array") class Dict: """Dict wrapper for convenient acces of values through attributes.""" def __init__(self, **args): self.__dict__.update(args) def __cmp__(self, other): if isinstance(other, self.__class__): return cmp(self.__dict__, other.__dict__) elif isinstance(other, dict): return cmp(self.__dict__, other) else: return cmp(id(self), id(other)) def __str__(self): return "%s(**%s)" % (self.__class__.__name__, self.__dict__) __repr__ = __str__ def __getattr__(self, attr): """Delegate everything else to the dict object.""" return getattr(self.__dict__, attr) class Plist(Dict): """The main Plist object. Basically a dict (the toplevel object of a plist is a dict) with one additional method: write().""" def fromFile(cls, pathOrFile): didOpen = 0 if not hasattr(pathOrFile, "write"): pathOrFile = open(pathOrFile) didOpen = 1 p = PlistParser() plist = p.parse(pathOrFile) if didOpen: pathOrFile.close() return plist fromFile = classmethod(fromFile) def write(self, pathOrFile): if not hasattr(pathOrFile, "write"): pathOrFile = open(pathOrFile, "w") didOpen = 1 else: didOpen = 0 writer = PlistWriter(pathOrFile) writer.writeln("") writer.writeDict(self.__dict__) writer.writeln("") if didOpen: pathOrFile.close() class Data: """Wrapper for binary data.""" def __init__(self, data): self.data = data def fromBase64(cls, data): import base64 return cls(base64.decodestring(data)) fromBase64 = classmethod(fromBase64) def asBase64(self): import base64 return base64.encodestring(self.data) def __cmp__(self, other): if isinstance(other, self.__class__): return cmp(self.data, other.data) elif isinstance(other, str): return cmp(self.data, other) else: return cmp(id(self), id(other)) def __repr__(self): return "%s(%s)" % (self.__class__.__name__, repr(self.data)) class Date: """Primitive date wrapper, uses time floats internally, is agnostic about time zones. """ def __init__(self, date): if isinstance(date, str): from xml.utils.iso8601 import parse date = parse(date) self.date = date def toString(self): from xml.utils.iso8601 import tostring return tostring(self.date) def __cmp__(self, other): if isinstance(other, self.__class__): return cmp(self.date, other.date) elif isinstance(other, (int, float)): return cmp(self.date, other) else: return cmp(id(self), id(other)) def __repr__(self): return "%s(%s)" % (self.__class__.__name__, repr(self.toString())) class PlistParser: def __init__(self): self.stack = [] self.currentKey = None self.root = None def parse(self, file): from xml.parsers.expat import ParserCreate parser = ParserCreate() parser.StartElementHandler = self.handleBeginElement parser.EndElementHandler = self.handleEndElement parser.CharacterDataHandler = self.handleData parser.ParseFile(file) return self.root def handleBeginElement(self, element, attrs): self.data = [] handler = getattr(self, "begin_" + element, None) if handler is not None: handler(attrs) def handleEndElement(self, element): handler = getattr(self, "end_" + element, None) if handler is not None: handler() def handleData(self, data): self.data.append(data) def addObject(self, value): if self.currentKey is not None: self.stack[-1][self.currentKey] = value self.currentKey = None elif not self.stack: # this is the root object assert self.root is value else: self.stack[-1].append(value) def getData(self): data = "".join(self.data) try: data = data.encode("ascii") except UnicodeError: pass self.data = [] return data # element handlers def begin_dict(self, attrs): if self.root is None: self.root = d = Plist() else: d = Dict() self.addObject(d) self.stack.append(d) def end_dict(self): self.stack.pop() def end_key(self): self.currentKey = self.getData() def begin_array(self, attrs): a = [] self.addObject(a) self.stack.append(a) def end_array(self): self.stack.pop() def end_true(self): self.addObject(True) def end_false(self): self.addObject(False) def end_integer(self): self.addObject(int(self.getData())) def end_real(self): self.addObject(float(self.getData())) def end_string(self): self.addObject(self.getData()) def end_data(self): self.addObject(Data.fromBase64(self.getData())) def end_date(self): self.addObject(Date(self.getData())) # cruft to support booleans in Python <= 2.3 import sys if sys.version_info[:2] < (2, 3): # Python 2.2 and earlier: no booleans # Python 2.2.x: booleans are ints class bool(int): """Imitation of the Python 2.3 bool object.""" def __new__(cls, value): return int.__new__(cls, not not value) def __repr__(self): if self: return "True" else: return "False" True = bool(1) False = bool(0) else: import __builtin__ True = __builtin__.True False = __builtin__.False bool = __builtin__.bool if __name__ == "__main__": from StringIO import StringIO import time if len(sys.argv) == 1: pl = Plist( Foo="Doodah", aList=["A", "B", 12, 32.1, [1, 2, 3]], aFloat = 0.1, anInt = 728, aDict=Dict( aString="", SomeUnicodeValue=u'M\xe4ssig, Ma\xdf', someTrueValue=True, someFalseValue=False, ), someData = Data("hello there!"), someMoreData = Data("hello there! " * 10), aDate = Date(time.mktime(time.gmtime())), ) elif len(sys.argv) == 2: pl = Plist.fromFile(sys.argv[1]) else: print "Too many arguments: at most 1 plist file can be given." sys.exit(1) # unicode keys are possible, but a little awkward to use: pl[u'\xc5benraa'] = "That was a unicode key." f = StringIO() pl.write(f) xml = f.getvalue() print xml f.seek(0) pl2 = Plist.fromFile(f) assert pl == pl2 f = StringIO() pl2.write(f) assert xml == f.getvalue() #print repr(pl2) From jvr@users.sourceforge.net Tue Nov 19 23:01:23 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Tue, 19 Nov 2002 15:01:23 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib plistlib.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv5870 Modified Files: plistlib.py Log Message: No need to import __builtin__, spotted by Skip. Index: plistlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/plistlib.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** plistlib.py 19 Nov 2002 22:01:02 -0000 1.1 --- plistlib.py 19 Nov 2002 23:01:20 -0000 1.2 *************** *** 388,395 **** False = bool(0) else: ! import __builtin__ ! True = __builtin__.True ! False = __builtin__.False ! bool = __builtin__.bool --- 388,395 ---- False = bool(0) else: ! # Bind the boolean builtins to local names ! True = True ! False = False ! bool = bool From jvr@users.sourceforge.net Tue Nov 19 23:11:51 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Tue, 19 Nov 2002 15:11:51 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib plistlib.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv9745 Modified Files: plistlib.py Log Message: removed a redundant .strip(); made a doc string more or less tell the truth Index: plistlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/plistlib.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** plistlib.py 19 Nov 2002 23:01:20 -0000 1.2 --- plistlib.py 19 Nov 2002 23:11:49 -0000 1.3 *************** *** 151,155 **** for line in data.asBase64().split("\n"): if line: ! self.writeln(line.strip()) self.endElement("data") --- 151,155 ---- for line in data.asBase64().split("\n"): if line: ! self.writeln(line) self.endElement("data") *************** *** 197,202 **** class Plist(Dict): ! """The main Plist object. Basically a dict (the toplevel object of ! a plist is a dict) with one additional method: write().""" def fromFile(cls, pathOrFile): --- 197,204 ---- class Plist(Dict): ! """The main Plist object. Basically a dict (the toplevel object ! of a plist is a dict) with two additional methods to read from ! and write to files. ! """ def fromFile(cls, pathOrFile): From nnorwitz@users.sourceforge.net Wed Nov 20 02:38:12 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 19 Nov 2002 18:38:12 -0800 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.153.6.3,2.153.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv27740/Python Modified Files: Tag: release22-maint pythonrun.c Log Message: Backport Neil Schemenauer's fix for SF #529750, Circular reference makes Py_Init crash Modified to keep _Py_ResetReferences() API, but make it a no-op. It's not called now (for 2.3 it was completely removed). Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.153.6.3 retrieving revision 2.153.6.4 diff -C2 -d -r2.153.6.3 -r2.153.6.4 *** pythonrun.c 8 Apr 2002 17:00:54 -0000 2.153.6.3 --- pythonrun.c 20 Nov 2002 02:38:10 -0000 2.153.6.4 *************** *** 278,285 **** call_ll_exitfuncs(); - - #ifdef Py_TRACE_REFS - _Py_ResetReferences(); - #endif /* Py_TRACE_REFS */ } --- 278,281 ---- From nnorwitz@users.sourceforge.net Wed Nov 20 02:38:13 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue, 19 Nov 2002 18:38:13 -0800 Subject: [Python-checkins] python/dist/src/Objects object.c,2.162.6.6,2.162.6.7 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv27740/Objects Modified Files: Tag: release22-maint object.c Log Message: Backport Neil Schemenauer's fix for SF #529750, Circular reference makes Py_Init crash Modified to keep _Py_ResetReferences() API, but make it a no-op. It's not called now (for 2.3 it was completely removed). Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.162.6.6 retrieving revision 2.162.6.7 diff -C2 -d -r2.162.6.6 -r2.162.6.7 *** object.c 11 Oct 2002 20:37:58 -0000 2.162.6.6 --- object.c 20 Nov 2002 02:38:10 -0000 2.162.6.7 *************** *** 1785,1790 **** _Py_ResetReferences(void) { - refchain._ob_prev = refchain._ob_next = &refchain; - _Py_RefTotal = 0; } --- 1785,1788 ---- From tim_one@users.sourceforge.net Wed Nov 20 03:23:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 19 Nov 2002 19:23:36 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.py,1.62,1.63 test_datetime.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv10409 Modified Files: datetime.py test_datetime.py Log Message: Implemented the Julian day-of-year method (_yday), + a simple test. Index: datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.py,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** datetime.py 19 Nov 2002 17:41:40 -0000 1.62 --- datetime.py 20 Nov 2002 03:23:34 -0000 1.63 *************** *** 559,567 **** def _yday(self): ! """Return tm_yday: day within the current year, where Jan 1 == 1. ! ! XXX This is not correct for now. Who cares. ! """ ! return 0 def timetuple(self): --- 559,564 ---- def _yday(self): ! "Return tm_yday: day within the current year, where Jan 1 == 1." ! return _days_before_month(self.__month, self.__year) + self.__day def timetuple(self): Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_datetime.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** test_datetime.py 2 Apr 2002 13:41:09 -0000 1.43 --- test_datetime.py 20 Nov 2002 03:23:34 -0000 1.44 *************** *** 311,314 **** --- 311,329 ---- self.assertEqual(self.theclass.max - big, self.theclass.min) + def test_timetuple(self): + for i in range(7): + # January 2, 1956 is a Monday (0) + d = self.theclass(1956, 1, 2+i) + t = d.timetuple() + self.assertEqual(t, (1956, 1, 2+i, 0, 0, 0, i, 2+i, -1)) + # February 1, 1956 is a Wednesday (2) + d = self.theclass(1956, 2, 1+i) + t = d.timetuple() + self.assertEqual(t, (1956, 2, 1+i, 0, 0, 0, (2+i)%7, 32+i, -1)) + # March 1, 1956 is a Thurday (3), and is the 31+29+1 = 61st day + # of the year. + d = self.theclass(1956, 3, 1+i) + t = d.timetuple() + self.assertEqual(t, (1956, 3, 1+i, 0, 0, 0, (3+i)%7, 61+i, -1)) class TestDateTime(TestDate): From tim_one@email.msn.com Wed Nov 20 03:25:36 2002 From: tim_one@email.msn.com (Tim Peters) Date: Tue, 19 Nov 2002 22:25:36 -0500 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.py,1.61,1.62 In-Reply-To: Message-ID: [gvanrossum@users.sourceforge.net] > ... > - Implement date.timetuple() and datetime.timetuple() without using > the time module. One caveat: the tm_yday field is currently left > zero. Maybe Tim can show me how to implement it. This goes into > internal method _jday(). It was easier to just implement it , so I did, but in internal method _yday(). Unclear whether you really wanted to name that _jday(), and I left that alone. I don't think it matters. From tim_one@users.sourceforge.net Wed Nov 20 03:29:45 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 19 Nov 2002 19:29:45 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime test_datetime.py,1.44,1.45 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv12484 Modified Files: test_datetime.py Log Message: Typo repair in comment. Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_datetime.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** test_datetime.py 20 Nov 2002 03:23:34 -0000 1.44 --- test_datetime.py 20 Nov 2002 03:29:43 -0000 1.45 *************** *** 321,325 **** t = d.timetuple() self.assertEqual(t, (1956, 2, 1+i, 0, 0, 0, (2+i)%7, 32+i, -1)) ! # March 1, 1956 is a Thurday (3), and is the 31+29+1 = 61st day # of the year. d = self.theclass(1956, 3, 1+i) --- 321,325 ---- t = d.timetuple() self.assertEqual(t, (1956, 2, 1+i, 0, 0, 0, (2+i)%7, 32+i, -1)) ! # March 1, 1956 is a Thursday (3), and is the 31+29+1 = 61st day # of the year. d = self.theclass(1956, 3, 1+i) From akuchling@users.sourceforge.net Wed Nov 20 13:50:17 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 20 Nov 2002 05:50:17 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.71,1.72 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv16378 Modified Files: whatsnew23.tex Log Message: Add change to int() and OverflowError Re-order the "porting" section to list items by decreasing significance Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** whatsnew23.tex 19 Nov 2002 13:09:00 -0000 1.71 --- whatsnew23.tex 20 Nov 2002 13:50:15 -0000 1.72 *************** *** 789,792 **** --- 789,798 ---- section~\ref{section-bool} of this document. + \item The \function{int()} type constructor will now return a long + integer instead of raising an \exception{OverflowError} when a string + or floating-point number is too large to fit into an integer. This + can lead to the paradoxical result that + \code{isinstance(int(\var{expression}), int)} is false, but that seems unlikely to cause problems in practice. + \item Built-in types now support the extended slicing syntax, as described in section~\ref{section-slices} of this document. *************** *** 1603,1618 **** variable name in your code, a different name must be chosen. - \item You can no longer disable assertions by assigning to \code{__debug__}. - - \item Using \code{None} as a variable name will now result in a - \exception{SyntaxWarning} warning. - - \item Names of extension types defined by the modules included with - Python now contain the module and a \character{.} in front of the type - name. - \item For strings \var{X} and \var{Y}, \code{\var{X} in \var{Y}} now works if \var{X} is more than one character long. \item The Distutils \function{setup()} function has gained various new keyword arguments such as \var{depends}. Old versions of the --- 1609,1621 ---- variable name in your code, a different name must be chosen. \item For strings \var{X} and \var{Y}, \code{\var{X} in \var{Y}} now works if \var{X} is more than one character long. + \item The \function{int()} type constructor will now return a long + integer instead of raising an \exception{OverflowError} when a string + or floating-point number is too large to fit into an integer. + + \item You can no longer disable assertions by assigning to \code{__debug__}. + \item The Distutils \function{setup()} function has gained various new keyword arguments such as \var{depends}. Old versions of the *************** *** 1630,1633 **** --- 1633,1643 ---- ext = Extension(**kw) \end{verbatim} + + \item Using \code{None} as a variable name will now result in a + \exception{SyntaxWarning} warning. + + \item Names of extension types defined by the modules included with + Python now contain the module and a \character{.} in front of the type + name. \end{itemize} From jackjansen@users.sourceforge.net Wed Nov 20 14:05:44 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 20 Nov 2002 06:05:44 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX pythonw.sh,1.3,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv22551 Removed Files: pythonw.sh Log Message: This file is now generated dynamically. --- pythonw.sh DELETED --- From jackjansen@users.sourceforge.net Wed Nov 20 14:06:18 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 20 Nov 2002 06:06:18 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.29,1.30 Makefile.jaguar,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv22633 Modified Files: Makefile Makefile.jaguar Log Message: Build PythonLauncher for MacPython-OSX 2.2 as well. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Makefile 11 Nov 2002 00:05:00 -0000 1.29 --- Makefile 20 Nov 2002 14:06:16 -0000 1.30 *************** *** 12,16 **** # These are normally glimpsed from the previous set bindir=$(dstroot)/usr/local/bin ! PYTHONAPPSDIR=$(dstroot)/Applications/Python APPINSTALLDIR=$(prefix)/Resources/Python.app PTHFILE=$(srcdir)/Mac/OSX/Mac.pth --- 12,17 ---- # These are normally glimpsed from the previous set bindir=$(dstroot)/usr/local/bin ! PYTHONAPPSPATH=/Applications/Python ! PYTHONAPPSDIR=$(dstroot)$(PYTHONAPPSPATH) APPINSTALLDIR=$(prefix)/Resources/Python.app PTHFILE=$(srcdir)/Mac/OSX/Mac.pth *************** *** 51,55 **** install_PythonLauncher: cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ ! pbxbuild -target PythonLauncher -buildstyle Deployment DSTROOT=$(dstroot) install install_Python: $(PYTHON) --- 52,57 ---- install_PythonLauncher: cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ ! pbxbuild -target PythonLauncher -buildstyle Deployment \ ! DSTROOT=$(dstroot) INSTALL_PATH=$(PYTHONAPPSPATH) install install_Python: $(PYTHON) Index: Makefile.jaguar =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile.jaguar,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.jaguar 15 Nov 2002 00:13:32 -0000 1.1 --- Makefile.jaguar 20 Nov 2002 14:06:16 -0000 1.2 *************** *** 7,11 **** srcdir = ../.. dstroot=/. ! PYTHONAPPSDIR=$(dstroot)/Applications/MacPython-OSX prefix=/usr --- 7,12 ---- srcdir = ../.. dstroot=/. ! PYTHONAPPSPATH=/Applications/MacPython-OSX ! PYTHONAPPSDIR=$(dstroot)$(PYTHONAPPSPATH) prefix=/usr *************** *** 30,36 **** INSTALL_DATA= ${INSTALL} -m 644 ! install: install_dirs install_dynlib install_lib \ install_Python install_IDE install_IDLE install_BuildApplet \ ! install_pythonw install_dirs: --- 31,48 ---- INSTALL_DATA= ${INSTALL} -m 644 ! # These can be done as a normal user ! install: preflight install_dirs install_dynlib install_lib \ install_Python install_IDE install_IDLE install_BuildApplet \ ! install_PythonLauncher install_pythonw ! ! preflight: ! @if test ! -w $(LIBDEST)/site-packages; then \ ! echo Please make directory $(LIBDEST)/site-packages writeable; \ ! exit 1; \ ! fi ! @if grep "arch i386" $(LIBDEST)/config/Makefile >/dev/null; then \ ! echo Please edit $(LIBDEST)/config/Makefile, see README.JAGUAR; \ ! exit 1; \ ! fi install_dirs: *************** *** 76,80 **** --- 88,101 ---- PYTHONAPPSDIR=$(PYTHONAPPSDIR) + install_PythonLauncher: + $(MAKE) -f $(osxdir)/Makefile install_PythonLauncher \ + srcdir=$(srcdir) dstroot=$(dstroot) \ + PYTHONAPPSPATH=$(PYTHONAPPSPATH) + install_pythonw: + @if test ! -w $(prefix)/bin; then \ + echo Cannot write to $(prefix)/bin, use \"sudo make -f Makefile.jaguar install_pythonw\"; \ + exit 1; \ + fi echo "#!/bin/sh" > pythonw.sh echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh From jackjansen@users.sourceforge.net Wed Nov 20 14:07:59 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 20 Nov 2002 06:07:59 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX README.JAGUAR,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv23071 Added Files: README.JAGUAR Log Message: Minimal instructions on building a MacPython-OSX addon for Apple's /usr/bin/python. --- NEW FILE: README.JAGUAR --- Building a MacPython-OSX on top of Jaguar's /usr/bin/python ----------------------------------------------------------- One way of getting MacPython functionality is to use the Python that Apple supplies since MacOSX 10.2, and extend this with the missing bits. (Another way is building a framework python, see Mac/OSX/README for details on that). Preparation ----------- First of all you have to fix two things in the python distributed by Apple. This paragraph is valid for 10.2 through 10.2.2, so if you have a later version of Jaguar your mileage may vary. 1. /usr/lib/python2.2/config/Makefile has an erronuous reference to building for intel processors. Edit the file with sudo, and change the line LDFLAGS= -arch i386 -arch ppc to LDFLAGS= -arch ppc 2. /usr/lib/python2.2/site-packages is not writeable except by root. Make it writeable by administrators by doing sudo chgrp admin /usr/lib/python2.2/site-packages sudo chmod g+w /usr/lib/python2.2/site-packages Alternatively you can do the make's below as superuser, but I would advise against this. Building -------- Typing "make -f Makefile.jaguar" will build and install almost everything you need. If you also want the "pythonw" unix program, which allows you to run GUI scripts from a Terminal window, you should also do "sudo make -f Makefile.jaguar install_pythonw". What do you get --------------- After the make you will have a folder /Applications/MacPython-OSX that contains the IDE and BuildApplet applications. Also, you will find a folder "python-additions" there that contains the MacPython-specific additions to your installed Python. The only thing that is installed outside the /Applications/MacPython-OSX folder is /usr/lib/python2.2/site-packages/MacPython.pth, which is the magic file that will make python find the new modules. Uninstalling ------------ 1. Remove /Applications/MacPython-OSX 2. Remove /usr/lib/python2.2/site-packages/MacPython.pth How does it work? ----------------- Makefile.jaguar does most of the work by calling on Makefile (which is normally used to build the Mac extensions for a framework-based python) after setting various variables such that everything is built for /usr/bin/python. Some extension modules (that are included in framework python 2.3a0, but missing from static python 2.2) are built with setup.py. And some Carbon modules are built to replace their 2.2 versions, which lack required functionality. The stubs in Mac/Lib/Carbon know about this overriding. From jackjansen@users.sourceforge.net Wed Nov 20 14:14:16 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 20 Nov 2002 06:14:16 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher .cvsignore,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher In directory sc8-pr-cvs1:/tmp/cvs-serv25623/PythonLauncher Added Files: .cvsignore Log Message: dded cvsignores. --- NEW FILE: .cvsignore --- build From jackjansen@users.sourceforge.net Wed Nov 20 14:14:16 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 20 Nov 2002 06:14:16 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj .cvsignore,NONE,1.1 project.pbxproj,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj In directory sc8-pr-cvs1:/tmp/cvs-serv25623/PythonLauncher/PythonLauncher.pbproj Modified Files: project.pbxproj Added Files: .cvsignore Log Message: dded cvsignores. --- NEW FILE: .cvsignore --- *.pbxuser Index: project.pbxproj =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** project.pbxproj 30 Aug 2002 12:56:08 -0000 1.5 --- project.pbxproj 20 Nov 2002 14:14:14 -0000 1.6 *************** *** 306,311 **** productReference = 1758732AFF379DA111CA2CBB; productSettingsXML = " ! ! CFBundleDevelopmentRegion --- 306,311 ---- productReference = 1758732AFF379DA111CA2CBB; productSettingsXML = " ! ! CFBundleDevelopmentRegion *************** *** 411,414 **** --- 411,415 ---- ); isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; }; 2A37F4C8FDCFA73011CA2CEA = { *************** *** 432,435 **** --- 433,437 ---- ); isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; }; 2A37F4CEFDCFA73011CA2CEA = { *************** *** 444,447 **** --- 446,450 ---- ); isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; }; 2A37F4CFFDCFA73011CA2CEA = { *************** *** 468,471 **** --- 471,475 ---- ); isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; }; //2A0 From jackjansen@users.sourceforge.net Wed Nov 20 14:14:16 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 20 Nov 2002 06:14:16 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX .cvsignore,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv25623 Added Files: .cvsignore Log Message: dded cvsignores. --- NEW FILE: .cvsignore --- build build-html Mac.jaguar.pth pythonw.sh From akuchling@users.sourceforge.net Wed Nov 20 15:05:44 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 20 Nov 2002 07:05:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils dist.py,1.53,1.53.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv18967 Modified Files: Tag: release22-maint dist.py Log Message: Backport of rev1.57: Make the Distribution() constructor forgiving of unknown keyword arguments, triggering a warning instead of raising an exception. (In 1.5.2/2.0, it will print to stderr.) Index: dist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dist.py,v retrieving revision 1.53 retrieving revision 1.53.6.1 diff -C2 -d -r1.53 -r1.53.6.1 *** dist.py 6 Dec 2001 20:51:35 -0000 1.53 --- dist.py 20 Nov 2002 15:05:41 -0000 1.53.6.1 *************** *** 13,16 **** --- 13,22 ---- from types import * from copy import copy + + try: + import warnings + except: + warnings = None + from distutils.errors import * from distutils.fancy_getopt import FancyGetopt, translate_longopt *************** *** 205,210 **** setattr(self, key, val) else: ! raise DistutilsSetupError, \ ! "invalid distribution option '%s'" % key self.finalize_options() --- 211,219 ---- setattr(self, key, val) else: ! msg = "Unknown distribution option: %s" % repr(key) ! if warnings is not None: ! warnings.warn(msg) ! else: ! sys.stderr.write(msg + "\n") self.finalize_options() From akuchling@users.sourceforge.net Wed Nov 20 16:10:31 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 20 Nov 2002 08:10:31 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils extension.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv24468 Modified Files: extension.py Log Message: Add missing import Index: extension.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/extension.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** extension.py 14 Nov 2002 02:25:41 -0000 1.15 --- extension.py 20 Nov 2002 16:10:29 -0000 1.16 *************** *** 6,10 **** __revision__ = "$Id$" ! import os, string from types import * --- 6,10 ---- __revision__ = "$Id$" ! import os, string, sys from types import * From akuchling@users.sourceforge.net Wed Nov 20 16:14:34 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 20 Nov 2002 08:14:34 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils extension.py,1.9.6.1,1.9.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv25711 Modified Files: Tag: release22-maint extension.py Log Message: Backport rev. 1.14: Allow unknown keyword arguments to the Extension class, and warn about them. Index: extension.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/extension.py,v retrieving revision 1.9.6.1 retrieving revision 1.9.6.2 diff -C2 -d -r1.9.6.1 -r1.9.6.2 *** extension.py 28 Dec 2001 10:20:06 -0000 1.9.6.1 --- extension.py 20 Nov 2002 16:14:31 -0000 1.9.6.2 *************** *** 8,14 **** __revision__ = "$Id$" ! import os, string from types import * # This class is really only used by the "build_ext" command, so it might --- 8,18 ---- __revision__ = "$Id$" ! import os, string, sys from types import * + try: + import warnings + except ImportError: + warnings = None # This class is really only used by the "build_ext" command, so it might *************** *** 87,90 **** --- 91,95 ---- extra_link_args=None, export_symbols=None, + **kw # To catch unknown keywords ): *************** *** 107,110 **** --- 112,124 ---- self.export_symbols = export_symbols or [] + # If there are unknown keyword options, warn about them + if len(kw): + L = kw.keys() ; L.sort() + L = map(repr, L) + msg = "Unknown Extension options: " + string.join(L, ', ') + if warnings is not None: + warnings.warn(msg) + else: + sys.stderr.write(msg + '\n') # class Extension From jvr@users.sourceforge.net Wed Nov 20 20:47:58 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Wed, 20 Nov 2002 12:47:58 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib plistlib.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv9953 Modified Files: plistlib.py Log Message: - cleaned up example/test code - don't encode/escape elements - fixed typo in doc string - provide our own copy function for the Dict class Index: plistlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/plistlib.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** plistlib.py 19 Nov 2002 23:11:49 -0000 1.3 --- plistlib.py 20 Nov 2002 20:47:55 -0000 1.4 *************** *** 35,51 **** pl = Plist( ! Foo="Doodah", ! aList=["A", "B", 12, 32.1, [1, 2, 3]], ! aFloat = 0.1, ! anInt = 728, ! aDict=Dict( ! aString="", ! SomeUnicodeValue=u'M\xe4ssig, Ma\xdf', ! someTrueValue=True, ! someFalseValue=False, ! ), ! someData = Data("hello there!"), ! someMoreData = Data("hello there! " * 10), ! aDate = Date(time.mktime(time.gmtime())), ) # unicode keys are possible, but a little awkward to use: --- 35,51 ---- pl = Plist( ! aString="Doodah", ! aList=["A", "B", 12, 32.1, [1, 2, 3]], ! aFloat = 0.1, ! anInt = 728, ! aDict=Dict( ! anotherString="", ! aUnicodeValue=u'M\xe4ssig, Ma\xdf', ! aTrueValue=True, ! aFalseValue=False, ! ), ! someData = Data(""), ! someMoreData = Data("" * 10), ! aDate = Date(time.mktime(time.gmtime())), ) # unicode keys are possible, but a little awkward to use: *************** *** 79,83 **** def beginElement(self, element): self.stack.append(element) - element = _encode(element) self.writeln("<%s>" % element) self.indentLevel += 1 --- 79,82 ---- *************** *** 91,95 **** def simpleElement(self, element, value=None): if value: - element = _encode(element) value = _encode(value) self.writeln("<%s>%s" % (element, value, element)) --- 90,93 ---- *************** *** 173,177 **** class Dict: ! """Dict wrapper for convenient acces of values through attributes.""" def __init__(self, **args): --- 171,175 ---- class Dict: ! """Dict wrapper for convenient access of values through attributes.""" def __init__(self, **args): *************** *** 190,193 **** --- 188,194 ---- __repr__ = __str__ + def copy(self): + return self.__class__(**self.__dict__) + def __getattr__(self, attr): """Delegate everything else to the dict object.""" *************** *** 401,417 **** if len(sys.argv) == 1: pl = Plist( ! Foo="Doodah", ! aList=["A", "B", 12, 32.1, [1, 2, 3]], ! aFloat = 0.1, ! anInt = 728, ! aDict=Dict( ! aString="", ! SomeUnicodeValue=u'M\xe4ssig, Ma\xdf', ! someTrueValue=True, ! someFalseValue=False, ! ), ! someData = Data("hello there!"), ! someMoreData = Data("hello there! " * 10), ! aDate = Date(time.mktime(time.gmtime())), ) elif len(sys.argv) == 2: --- 402,418 ---- if len(sys.argv) == 1: pl = Plist( ! aString="Doodah", ! aList=["A", "B", 12, 32.1, [1, 2, 3]], ! aFloat = 0.1, ! anInt = 728, ! aDict=Dict( ! anotherString="", ! aUnicodeValue=u'M\xe4ssig, Ma\xdf', ! aTrueValue=True, ! aFalseValue=False, ! ), ! someData = Data(""), ! someMoreData = Data("" * 10), ! aDate = Date(time.mktime(time.gmtime())), ) elif len(sys.argv) == 2: From akuchling@users.sourceforge.net Wed Nov 20 22:08:51 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 20 Nov 2002 14:08:51 -0800 Subject: [Python-checkins] python/nondist/peps pep-0301.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv15620 Modified Files: pep-0301.txt Log Message: Updated version of the PEP from Richard Jones. (Barry, David: this is more recent that the version sent to the PEP editors. You can forget about the version you've already received.) Index: pep-0301.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0301.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0301.txt 18 Nov 2002 02:02:43 -0000 1.3 --- pep-0301.txt 20 Nov 2002 22:08:48 -0000 1.4 *************** *** 70,74 **** The specification takes three parts, the `web interface`_, the `Distutils register command`_ and the `Distutils Trove ! categorisation`_. --- 70,74 ---- The specification takes three parts, the `web interface`_, the `Distutils register command`_ and the `Distutils Trove ! classification`_. *************** *** 103,107 **** "name" and "version" fields are mandatory, as they uniquely identify an entry in the index. **Submit** will automatically determine ! whether to create a new entry or updating an existing entry. The metadata is checked for correctness where appropriate - specifically the Trove discriminators are compared with the allowed set. An --- 103,107 ---- "name" and "version" fields are mandatory, as they uniquely identify an entry in the index. **Submit** will automatically determine ! whether to create a new entry or update an existing entry. The metadata is checked for correctness where appropriate - specifically the Trove discriminators are compared with the allowed set. An *************** *** 128,151 **** Registration will be a three-step process, involving: ! 1. User submission of details via the Distutils *register* command, 2. Index server sending email to the user's email address with a URL to visit to confirm registration with a random one-time key, and 3. User visits URL with the key and confirms registration. - Several user Roles will exist, generally revolving around a - particular package name: - - Owner - Owns a package name, may assign Maintainer Role for that name. The - first user to register information about a package is deemed Owner - of the package name. The Admin user may change this if necessary. - May submit updates for the package name. - - Maintainer - Can submit and update info for a particular package name. - - Admin - Can assign Owner Role and edit user details. - **roles** An interface for changing user Role assignments. --- 128,137 ---- Registration will be a three-step process, involving: ! 1. User submission of details via the Distutils *register* command ! or through the web, 2. Index server sending email to the user's email address with a URL to visit to confirm registration with a random one-time key, and 3. User visits URL with the key and confirms registration. **roles** An interface for changing user Role assignments. *************** *** 171,174 **** --- 157,219 ---- ===== ============== ================================================ + User Roles + ---------- + + Three user Roles will be assignable to users: + + Owner + Owns a package name, may assign Maintainer Role for that name. The + first user to register information about a package is deemed Owner + of the package name. The Admin user may change this if necessary. + May submit updates for the package name. + + Maintainer + Can submit and update info for a particular package name. + + Admin + Can assign Owner Role and edit user details. Not specific to a + package name. + + + Index Storage (Schema) + ---------------------- + + The index is stored in a set of relational database tables: + + **packages** + Lists package names and holds package-level metadata (currently + just the stable release version) + + **releases** + Each package has an entry in **releases** for each version of the + package that is released. A row holds the bulk of the information + given in the package's PKG-INFO file. There is one row for each + package (*name*, *version*). + + **trove_discriminators** + Lists the Trove discriminator text and assigns each one a unique + ID. + + **release_discriminators** + Each entry maps a package (*name*, *version*) to a *discriminator_id*. + We map to releases instead of packages because the set of + discriminators may change between releases. + + **journals** + Holds information about changes to package information in the + index. Changes to the **packages**, **releases**, **roles**, + and **release_discriminators** tables are listed here by + package *name* and *version* if the change is release-specific. + + **users** + Holds our user database - user name, email address and password. + + **roles** + Maps *user_name* and *role_name* to a *package_name*. + + An additional table, **rego_otk** holds the One Time Keys generated + during registration and is not interesting in the scope of the index + itself. + Distutils *register* Command *************** *** 186,190 **** On systems where the ``$HOME`` environment variable is set, the user will be prompted at exit to save their username/password to a file ! in their ``$HOME`` directory in the file ``.pythonpackagerc``. Notification of changes to a package entry will be sent to all users --- 231,235 ---- On systems where the ``$HOME`` environment variable is set, the user will be prompted at exit to save their username/password to a file ! in their ``$HOME`` directory in the file ``.pypirc``. Notification of changes to a package entry will be sent to all users *************** *** 200,204 **** ! Distutils Trove Categorisation ------------------------------ --- 245,249 ---- ! Distutils Trove Classification ------------------------------ *************** *** 213,223 **** classifiers = [ 'Development Status :: 4 - Beta', ! 'Environment :: Console (Text Based)', 'Environment :: Web Environment', 'Intended Audience :: End Users/Desktop', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', ! 'License :: OSI Approved :: Python License', ! 'Operating System :: MacOS X', 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', --- 258,268 ---- classifiers = [ 'Development Status :: 4 - Beta', ! 'Environment :: Console', 'Environment :: Web Environment', 'Intended Audience :: End Users/Desktop', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', ! 'License :: OSI Approved :: Python Software Foundation License', ! 'Operating System :: MacOS :: MacOS X', 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', *************** *** 243,256 **** The list of classification values on the module index has been merged from FreshMeat and SourceForge (with their permission). This list ! will be made available through the web interface as a text list which ! may then be copied to the ``setup.py`` file. The *register* command's ! ``--verify`` option will also check classifiers values. Unfortunately, the addition of the "classifiers" property is not backwards-compatible. A setup.py file using it will not work under ! Python 2.1.3. It is hoped that a bugfix release of Python 2.2 will ! relax the argument checking of the setup() command to allow new ! keywords, even if they're not actually used. It is preferable that ! a warning be produced, rather than a show-stopping error. --- 288,318 ---- The list of classification values on the module index has been merged from FreshMeat and SourceForge (with their permission). This list ! will be made available both through the web interface and through the ! *regsiter* command's ``--list-classifiers`` option as a text list ! which may then be copied to the ``setup.py`` file. The *register* ! command's ``--verify`` option will check classifiers values against ! the server's list. Unfortunately, the addition of the "classifiers" property is not backwards-compatible. A setup.py file using it will not work under ! Python 2.1.3. It is hoped that a bugfix release of Python 2.2 (most ! likely 2.2.3) will relax the argument checking of the setup() command ! to allow new keywords, even if they're not actually used. It is ! preferable that a warning be produced, rather than a show-stopping ! error. The use of the new keyword should be discouraged in situations ! where the package is advertised as being compatible with python ! versions earlier than 2.2.3 or 2.3. ! ! In the PKG-INFO, the classifiers list items will appear as individual ! ``Classifier:`` entries:: ! ! Name: roundup ! Version: 0.5.2 ! Classifier: Development Status :: 4 - Beta ! Classifier: Environment :: Console (Text Based) ! . ! . ! Classifier: Topic :: Software Development :: Bug Tracking ! Url: http://sourceforge.net/projects/roundup/ *************** *** 266,282 **** http://www.amk.ca/cgi-bin/pypi.cgi ! ===== =================================================== Done Feature ! ===== =================================================== ! Y Submission ! Y Index ! Y Display ! Y Search ! Y User registration ! Y User verification ! Y Password reset ! Y Admin interfaces for user/package maintenance ! N Trove ! ===== =================================================== In the two days of the 22nd and 23rd October 2002, after the first --- 328,343 ---- http://www.amk.ca/cgi-bin/pypi.cgi ! ===== ============================================================= Done Feature ! ===== ============================================================= ! Y Submission via *register* command (register.py module) ! Y Web interface ! Y Handling of the *classifiers* setup() keyword (dist.py.patch) ! Y Patch Python 2.2.3 to relax keyword argument checks in the ! distutils setup() function ! N Patch Python 2.3 to apply the dist.py.patch ! N Library reference documentation of the *register* command and ! additional *classifiers* keyword ! ===== ============================================================= In the two days of the 22nd and 23rd October 2002, after the first *************** *** 286,289 **** --- 347,351 ---- + Rejected Proposals ================== *************** *** 320,324 **** (http://pause.cpan.org/) ! .. [6] PEP 243, Module Repository Upload Mechanism (http://www.python.org/peps/pep-0243.html) --- 382,386 ---- (http://pause.cpan.org/) ! . [6] PEP 243, Module Repository Upload Mechanism (http://www.python.org/peps/pep-0243.html) *************** *** 358,360 **** fill-column: 70 End: - --- 420,421 ---- From akuchling@users.sourceforge.net Wed Nov 20 22:10:26 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 20 Nov 2002 14:10:26 -0800 Subject: [Python-checkins] python/nondist/peps pep-0301.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv17058 Modified Files: pep-0301.txt Log Message: Fix broken link target Index: pep-0301.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0301.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0301.txt 20 Nov 2002 22:08:48 -0000 1.4 --- pep-0301.txt 20 Nov 2002 22:10:24 -0000 1.5 *************** *** 382,386 **** (http://pause.cpan.org/) ! . [6] PEP 243, Module Repository Upload Mechanism (http://www.python.org/peps/pep-0243.html) --- 382,386 ---- (http://pause.cpan.org/) ! .. [6] PEP 243, Module Repository Upload Mechanism (http://www.python.org/peps/pep-0243.html) From nnorwitz@users.sourceforge.net Wed Nov 20 23:15:56 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 20 Nov 2002 15:15:56 -0800 Subject: [Python-checkins] python/dist/src/Lib getpass.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv19128/Lib Modified Files: getpass.py Log Message: Fix SF #640094, on win32 getpass runs into unix_getpass Make sure we have a UNIX-compatible termios. Apparently, McMillan Installer made a termios on windows which caused unix_getpass() to be used instead of win_getpass(). Will backport. Index: getpass.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/getpass.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** getpass.py 30 Aug 2001 15:07:44 -0000 1.14 --- getpass.py 20 Nov 2002 23:15:54 -0000 1.15 *************** *** 105,109 **** try: import termios ! except ImportError: try: import msvcrt --- 105,112 ---- try: import termios ! # it's possible there is an incompatible termios from the ! # McMillan Installer, make sure we have a UNIX-compatible termios ! termios.tcgetattr, termios.tcsetattr ! except (ImportError, AttributeError): try: import msvcrt From nnorwitz@users.sourceforge.net Wed Nov 20 23:38:22 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 20 Nov 2002 15:38:22 -0800 Subject: [Python-checkins] python/dist/src/Lib getpass.py,1.14,1.14.14.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv27078/Lib Modified Files: Tag: release22-maint getpass.py Log Message: Backport fix for SF #640094, on win32 getpass runs into unix_getpass Make sure we have a UNIX-compatible termios. Apparently, McMillan Installer made a termios on windows which caused unix_getpass to be used instead of win_getpass Index: getpass.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/getpass.py,v retrieving revision 1.14 retrieving revision 1.14.14.1 diff -C2 -d -r1.14 -r1.14.14.1 *** getpass.py 30 Aug 2001 15:07:44 -0000 1.14 --- getpass.py 20 Nov 2002 23:38:20 -0000 1.14.14.1 *************** *** 105,109 **** try: import termios ! except ImportError: try: import msvcrt --- 105,112 ---- try: import termios ! # it's possible there is an incompatible termios from the ! # McMillan Installer, make sure we have a UNIX-compatible termios ! termios.tcgetattr, termios.tcsetattr ! except (ImportError, AttributeError): try: import msvcrt From jvr@users.sourceforge.net Thu Nov 21 10:23:06 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Thu, 21 Nov 2002 02:23:06 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib bundlebuilder.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv27425 Added Files: bundlebuilder.py Log Message: Tools to create MacOS X (application) bundles. Todo: - command line parsing - main program - modulefinder(-like ;-) support to build standalone apps. --- NEW FILE: bundlebuilder.py --- #! /usr/bin/env python """\ bundlebuilder.py -- Tools to assemble MacOS X (application) bundles. This module contains three classes to build so called "bundles" for MacOS X. BundleBuilder is a general tool, AppBuilder is a subclass specialized in building application bundles. CocoaAppBuilder is a further specialization of AppBuilder. [Bundle|App|CocoaApp]Builder objects are instantiated with a bunch of keyword arguments, and have a build() method that will do all the work. See the class doc strings for a description of the constructor arguments. """ # # XXX Todo: # - a command line interface, also for use with the buildapp() and # buildcocoaapp() convenience functions. # - modulefinder support to build standalone apps # __all__ = ["BundleBuilder", "AppBuilder", "CocoaAppBuilder", "buildapp", "buildcocoaapp"] import sys import os, errno, shutil from plistlib import Plist plistDefaults = Plist( CFBundleDevelopmentRegion = "English", CFBundleInfoDictionaryVersion = "6.0", ) class BundleBuilder: """BundleBuilder is a barebones class for assembling bundles. It knows nothing about executables or icons, it only copies files and creates the PkgInfo and Info.plist files. Constructor arguments: name: Name of the bundle, with or without extension. plist: A plistlib.Plist object. type: The type of the bundle. Defaults to "APPL". creator: The creator code of the bundle. Defaults to "????". resources: List of files that have to be copied to /Contents/Resources. Defaults to an empty list. files: List of (src, dest) tuples; dest should be a path relative to the bundle (eg. "Contents/Resources/MyStuff/SomeFile.ext. Defaults to an empty list. builddir: Directory where the bundle will be assembled. Defaults to "build" (in the current directory). symlink: Make symlinks instead copying files. This is handy during debugging, but makes the bundle non-distributable. Defaults to False. verbosity: verbosity level, defaults to 1 """ def __init__(self, name, plist=None, type="APPL", creator="????", resources=None, files=None, builddir="build", platform="MacOS", symlink=0, verbosity=1): """See the class doc string for a description of the arguments.""" self.name, ext = os.path.splitext(name) if not ext: ext = ".bundle" self.bundleextension = ext if plist is None: plist = Plist() self.plist = plist self.type = type self.creator = creator if files is None: files = [] if resources is None: resources = [] self.resources = resources self.files = files self.builddir = builddir self.platform = platform self.symlink = symlink # misc (derived) attributes self.bundlepath = pathjoin(builddir, self.name + self.bundleextension) self.execdir = pathjoin("Contents", platform) self.resdir = pathjoin("Contents", "Resources") self.verbosity = verbosity def build(self): """Build the bundle.""" builddir = self.builddir if builddir and not os.path.exists(builddir): os.mkdir(builddir) self.message("Building %s" % repr(self.bundlepath), 1) if os.path.exists(self.bundlepath): shutil.rmtree(self.bundlepath) os.mkdir(self.bundlepath) self.preProcess() self._copyFiles() self._addMetaFiles() self.postProcess() def preProcess(self): """Hook for subclasses.""" pass def postProcess(self): """Hook for subclasses.""" pass def _addMetaFiles(self): contents = pathjoin(self.bundlepath, "Contents") makedirs(contents) # # Write Contents/PkgInfo assert len(self.type) == len(self.creator) == 4, \ "type and creator must be 4-byte strings." pkginfo = pathjoin(contents, "PkgInfo") f = open(pkginfo, "wb") f.write(self.type + self.creator) f.close() # # Write Contents/Info.plist plist = plistDefaults.copy() plist.CFBundleName = self.name plist.CFBundlePackageType = self.type plist.CFBundleSignature = self.creator plist.update(self.plist) infoplist = pathjoin(contents, "Info.plist") plist.write(infoplist) def _copyFiles(self): files = self.files[:] for path in self.resources: files.append((path, pathjoin("Contents", "Resources", os.path.basename(path)))) if self.symlink: self.message("Making symbolic links", 1) msg = "Making symlink from" else: self.message("Copying files", 1) msg = "Copying" for src, dst in files: self.message("%s %s to %s" % (msg, src, dst), 2) dst = pathjoin(self.bundlepath, dst) if self.symlink: symlink(src, dst, mkdirs=1) else: copy(src, dst, mkdirs=1) def message(self, msg, level=0): if level <= self.verbosity: sys.stderr.write(msg + "\n") mainWrapperTemplate = """\ #!/usr/bin/env python import os from sys import argv, executable resources = os.path.join(os.path.dirname(os.path.dirname(argv[0])), "Resources") mainprogram = os.path.join(resources, "%(mainprogram)s") assert os.path.exists(mainprogram) argv.insert(1, mainprogram) %(executable)s os.execve(executable, argv, os.environ) """ executableTemplate = "executable = os.path.join(resources, \"%s\")" class AppBuilder(BundleBuilder): """This class extends the BundleBuilder constructor with these arguments: mainprogram: A Python main program. If this argument is given, the main executable in the bundle will be a small wrapper that invokes the main program. (XXX Discuss why.) executable: The main executable. If a Python main program is specified the executable will be copied to Resources and be invoked by the wrapper program mentioned above. Else it will simply be used as the main executable. For the other keyword arguments see the BundleBuilder doc string. """ def __init__(self, name=None, mainprogram=None, executable=None, **kwargs): """See the class doc string for a description of the arguments.""" if mainprogram is None and executable is None: raise TypeError, ("must specify either or both of " "'executable' and 'mainprogram'") if name is not None: pass elif mainprogram is not None: name = os.path.splitext(os.path.basename(mainprogram))[0] elif executable is not None: name = os.path.splitext(os.path.basename(executable))[0] if name[-4:] != ".app": name += ".app" self.mainprogram = mainprogram self.executable = executable BundleBuilder.__init__(self, name=name, **kwargs) def preProcess(self): self.plist.CFBundleExecutable = self.name if self.executable is not None: if self.mainprogram is None: execpath = pathjoin(self.execdir, self.name) else: execpath = pathjoin(self.resdir, os.path.basename(self.executable)) self.files.append((self.executable, execpath)) # For execve wrapper executable = executableTemplate % os.path.basename(self.executable) else: executable = "" # XXX for locals() call if self.mainprogram is not None: mainname = os.path.basename(self.mainprogram) self.files.append((self.mainprogram, pathjoin(self.resdir, mainname))) # Create execve wrapper mainprogram = self.mainprogram # XXX for locals() call execdir = pathjoin(self.bundlepath, self.execdir) mainwrapperpath = pathjoin(execdir, self.name) makedirs(execdir) open(mainwrapperpath, "w").write(mainWrapperTemplate % locals()) os.chmod(mainwrapperpath, 0777) class CocoaAppBuilder(AppBuilder): """Tiny specialization of AppBuilder. It has an extra constructor argument called 'nibname' which defaults to 'MainMenu'. It will set the appropriate fields in the plist. """ def __init__(self, nibname="MainMenu", **kwargs): """See the class doc string for a description of the arguments.""" self.nibname = nibname AppBuilder.__init__(self, **kwargs) self.plist.NSMainNibFile = self.nibname if not hasattr(self.plist, "NSPrincipalClass"): self.plist.NSPrincipalClass = "NSApplication" def copy(src, dst, mkdirs=0): """Copy a file or a directory.""" if mkdirs: makedirs(os.path.dirname(dst)) if os.path.isdir(src): shutil.copytree(src, dst) else: shutil.copy2(src, dst) def copytodir(src, dstdir): """Copy a file or a directory to an existing directory.""" dst = pathjoin(dstdir, os.path.basename(src)) copy(src, dst) def makedirs(dir): """Make all directories leading up to 'dir' including the leaf directory. Don't moan if any path element already exists.""" try: os.makedirs(dir) except OSError, why: if why.errno != errno.EEXIST: raise def symlink(src, dst, mkdirs=0): """Copy a file or a directory.""" if mkdirs: makedirs(os.path.dirname(dst)) os.symlink(os.path.abspath(src), dst) def pathjoin(*args): """Safe wrapper for os.path.join: asserts that all but the first argument are relative paths.""" for seg in args[1:]: assert seg[0] != "/" return os.path.join(*args) def buildapp(**kwargs): # XXX cmd line argument parsing builder = AppBuilder(**kwargs) builder.build() def buildcocoaapp(**kwargs): # XXX cmd line argument parsing builder = CocoaAppBuilder(**kwargs) builder.build() if __name__ == "__main__": # XXX This test is meant to be run in the Examples/TableModel/ folder # of the pyobj project... It will go as soon as I've written a proper # main program. buildcocoaapp(mainprogram="TableModel.py", resources=["English.lproj", "nibwrapper.py"], verbosity=4) From jvr@users.sourceforge.net Thu Nov 21 10:29:59 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Thu, 21 Nov 2002 02:29:59 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib plistlib.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv29944 Modified Files: plistlib.py Log Message: name kwargs kwargs Index: plistlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/plistlib.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** plistlib.py 20 Nov 2002 20:47:55 -0000 1.4 --- plistlib.py 21 Nov 2002 10:29:57 -0000 1.5 *************** *** 173,178 **** """Dict wrapper for convenient access of values through attributes.""" ! def __init__(self, **args): ! self.__dict__.update(args) def __cmp__(self, other): --- 173,178 ---- """Dict wrapper for convenient access of values through attributes.""" ! def __init__(self, **kwargs): ! self.__dict__.update(kwargs) def __cmp__(self, other): From mwh@users.sourceforge.net Thu Nov 21 14:17:54 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu, 21 Nov 2002 06:17:54 -0800 Subject: [Python-checkins] python/dist/src/Modules _cursesmodule.c,2.70,2.71 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv16415 Modified Files: _cursesmodule.c Log Message: Always call tparm with 10 arguments. It seems it's not varargs i more often than it is. In response to bug: [ 641808 ] Portability of Modules/_cursesmodule.c submitted by Nick Mclaren. Index: _cursesmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_cursesmodule.c,v retrieving revision 2.70 retrieving revision 2.71 diff -C2 -d -r2.70 -r2.71 *** _cursesmodule.c 6 Nov 2002 14:15:36 -0000 2.70 --- _cursesmodule.c 21 Nov 2002 14:17:51 -0000 2.71 *************** *** 2261,2265 **** char* fmt; char* result = NULL; ! int i1,i2,i3,i4,i5,i6,i7,i8,i9; PyCursesSetupTermCalled; --- 2261,2265 ---- char* fmt; char* result = NULL; ! int i1=0,i2=0,i3=0,i4=0,i5=0,i6=0,i7=0,i8=0,i9=0; PyCursesSetupTermCalled; *************** *** 2270,2316 **** return NULL; } ! ! #if defined(__hpux) || defined(_AIX) ! /* tparm is declared with 10 arguments on a few platforms ! (HP-UX, AIX). If this proves to be a problem on other ! platforms as well, perhaps an autoconf test should be ! added to determine whether tparm can be called with a ! variable number of arguments. Perhaps the other arguments ! should be initialized in this case also. */ result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7,i8,i9); ! #else ! switch (PyTuple_GET_SIZE(args)) { ! case 1: ! result = tparm(fmt); ! break; ! case 2: ! result = tparm(fmt,i1); ! break; ! case 3: ! result = tparm(fmt,i1,i2); ! break; ! case 4: ! result = tparm(fmt,i1,i2,i3); ! break; ! case 5: ! result = tparm(fmt,i1,i2,i3,i4); ! break; ! case 6: ! result = tparm(fmt,i1,i2,i3,i4,i5); ! break; ! case 7: ! result = tparm(fmt,i1,i2,i3,i4,i5,i6); ! break; ! case 8: ! result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7); ! break; ! case 9: ! result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7,i8); ! break; ! case 10: ! result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7,i8,i9); ! break; ! } ! #endif /* defined(__hpux) || defined(_AIX) */ return PyString_FromString(result); } --- 2270,2276 ---- return NULL; } ! result = tparm(fmt,i1,i2,i3,i4,i5,i6,i7,i8,i9); ! return PyString_FromString(result); } From tim_one@users.sourceforge.net Thu Nov 21 15:48:35 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 07:48:35 -0800 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv21036/python/Lib Modified Files: tempfile.py Log Message: _TemporaryFileWrapper: changed self.close_called to a proper bool. Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** tempfile.py 17 Aug 2002 14:50:24 -0000 1.50 --- tempfile.py 21 Nov 2002 15:48:33 -0000 1.51 *************** *** 352,356 **** self.file = file self.name = name ! self.close_called = 0 def __getattr__(self, name): --- 352,356 ---- self.file = file self.name = name ! self.close_called = False def __getattr__(self, name): *************** *** 375,379 **** def close(self): if not self.close_called: ! self.close_called = 1 self.file.close() self.unlink(self.name) --- 375,379 ---- def close(self): if not self.close_called: ! self.close_called = True self.file.close() self.unlink(self.name) From tim_one@users.sourceforge.net Thu Nov 21 16:00:02 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 08:00:02 -0800 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv26380/python/Lib Modified Files: tempfile.py Log Message: _RandomNameSequence(): style guide changes, small speedup, don't put more in the critical section than absolutely needed, acquire the mutex before the "try". Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** tempfile.py 21 Nov 2002 15:48:33 -0000 1.51 --- tempfile.py 21 Nov 2002 15:59:59 -0000 1.52 *************** *** 89,95 **** _RandomNameSequence is an iterator.""" ! characters = ( "abcdefghijklmnopqrstuvwxyz" ! + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ! + "0123456789-_") def __init__(self): --- 89,95 ---- _RandomNameSequence is an iterator.""" ! characters = ("abcdefghijklmnopqrstuvwxyz" + ! "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + ! "0123456789-_") def __init__(self): *************** *** 97,100 **** --- 97,101 ---- self.rng = _Random() self.normcase = _os.path.normcase + def __iter__(self): return self *************** *** 103,116 **** m = self.mutex c = self.characters ! r = self.rng try: ! m.acquire() ! letters = ''.join([r.choice(c), r.choice(c), r.choice(c), ! r.choice(c), r.choice(c), r.choice(c)]) finally: m.release() ! return self.normcase(letters) def _candidate_tempdir_list(): --- 104,116 ---- m = self.mutex c = self.characters ! choose = self.rng.choice + m.acquire() try: ! letters = [choose(c) for dummy in "123456"] finally: m.release() ! return self.normcase(''.join(letters)) def _candidate_tempdir_list(): From tim_one@users.sourceforge.net Thu Nov 21 16:32:14 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 08:32:14 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libtempfile.tex,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv7535/python/Doc/lib Modified Files: libtempfile.tex Log Message: NamedTemporaryFile: clarify behavior based on confusions noted by a user, and spell out a x-platform use limitation. Index: libtempfile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtempfile.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** libtempfile.tex 14 Aug 2002 16:37:10 -0000 1.19 --- libtempfile.tex 21 Nov 2002 16:32:11 -0000 1.20 *************** *** 60,65 **** This function operates exactly as \function{TemporaryFile} does, except that the file is guaranteed to have a visible name in the file ! system. That name can be retrieved from the \member{name} member of ! the file object. \versionadded{2.3} \end{funcdesc} --- 60,68 ---- This function operates exactly as \function{TemporaryFile} does, except that the file is guaranteed to have a visible name in the file ! system (on \UNIX, the directory entry is not unlinked). That name can ! be retrieved from the \member{name} member of the file object. Whether ! the name can be used to open the file a second time, while the ! named temporary file is still open, varies across platforms (it can ! be so used on \UNIX; it cannot on Windows NT or later). \versionadded{2.3} \end{funcdesc} From gvanrossum@users.sourceforge.net Thu Nov 21 17:59:30 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 21 Nov 2002 09:59:30 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.12,1.13 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv9723 Modified Files: datetime.c Log Message: Reindent with tabs. Tim will take it from here. Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** datetime.c 20 Aug 2002 18:53:07 -0000 1.12 --- datetime.c 21 Nov 2002 17:59:28 -0000 1.13 *************** *** 16,24 **** typedef struct { ! PyObject_HEAD ! int hashcode; ! long int days; ! long int seconds; ! long int microseconds; } PyDateTime_Delta; --- 16,24 ---- typedef struct { ! PyObject_HEAD ! int hashcode; ! long int days; ! long int seconds; ! long int microseconds; } PyDateTime_Delta; *************** *** 65,69 **** is_leap(int year) { ! return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? 1 : 0; } --- 65,69 ---- is_leap(int year) { ! return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? 1 : 0; } *************** *** 71,84 **** days_in_month(int year, int month) { ! static int _days_in_month[] = { ! 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ! }; ! assert(month >= 1); ! assert(month <= 12); ! if (month == 2 && is_leap(year)) ! return 29; ! else ! return _days_in_month[month]; } --- 71,84 ---- days_in_month(int year, int month) { ! static int _days_in_month[] = { ! 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ! }; ! assert(month >= 1); ! assert(month <= 12); ! if (month == 2 && is_leap(year)) ! return 29; ! else ! return _days_in_month[month]; } *************** *** 86,91 **** days_before_year(int year) { ! int y = year - 1; ! return y*365 + y/4 - y/100 + y/400; } --- 86,91 ---- days_before_year(int year) { ! int y = year - 1; ! return y*365 + y/4 - y/100 + y/400; } *************** *** 94,98 **** */ static int _days_before_month[] = { ! 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; --- 94,98 ---- */ static int _days_before_month[] = { ! 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; *************** *** 100,111 **** days_before_month(int year, int month) { ! int days; ! assert(month >= 1); ! assert(month <= 12); ! days = _days_before_month[month]; ! if (month > 2 && is_leap(year)) ! ++days; ! return days; } --- 100,111 ---- days_before_month(int year, int month) { ! int days; ! assert(month >= 1); ! assert(month <= 12); ! days = _days_before_month[month]; ! if (month > 2 && is_leap(year)) ! ++days; ! return days; } *************** *** 114,160 **** ord_to_ymd(long int ordinal, long int *year, long int *month, long int *day) { ! int di400y = days_before_year(401); ! int di100y = days_before_year(101); ! int di4y = days_before_year(5); ! int n, n1, n4, n100, n400, leapyear, preceding; ! assert(ordinal >= 1); ! --ordinal; ! n400 = ordinal / di400y; ! n = ordinal % di400y; ! *year = n400 * 400 + 1; ! n100 = n / di100y; ! n = n % di100y; ! n4 = n / di4y; ! n = n % di4y; ! n1 = n / 365; ! n = n % 365; ! *year += n100 * 100 + n4 * 4 + n1; ! if (n1 == 4 || n100 == 4) { ! assert(n == 0); ! *year -= 1; ! *month = 12; ! *day = 31; ! return; ! } ! leapyear = (n1 == 3 && (n4 != 24 || n100 == 3)) ? 1 : 0; ! assert(leapyear == is_leap(*year)); ! *month = (n + 50) >> 5; ! preceding = (_days_before_month[*month] ! + ((*month > 2 && leapyear) ? 1 : 0)); ! if (preceding > n) { ! /* estimate is too large */ ! *month -= 1; ! preceding -= days_in_month(*year, *month); ! } ! n -= preceding; ! assert(0 <= n); ! assert(n < days_in_month(*year, *month)); ! *day = n + 1; } --- 114,160 ---- ord_to_ymd(long int ordinal, long int *year, long int *month, long int *day) { ! int di400y = days_before_year(401); ! int di100y = days_before_year(101); ! int di4y = days_before_year(5); ! int n, n1, n4, n100, n400, leapyear, preceding; ! assert(ordinal >= 1); ! --ordinal; ! n400 = ordinal / di400y; ! n = ordinal % di400y; ! *year = n400 * 400 + 1; ! n100 = n / di100y; ! n = n % di100y; ! n4 = n / di4y; ! n = n % di4y; ! n1 = n / 365; ! n = n % 365; ! *year += n100 * 100 + n4 * 4 + n1; ! if (n1 == 4 || n100 == 4) { ! assert(n == 0); ! *year -= 1; ! *month = 12; ! *day = 31; ! return; ! } ! leapyear = (n1 == 3 && (n4 != 24 || n100 == 3)) ? 1 : 0; ! assert(leapyear == is_leap(*year)); ! *month = (n + 50) >> 5; ! preceding = (_days_before_month[*month] ! + ((*month > 2 && leapyear) ? 1 : 0)); ! if (preceding > n) { ! /* estimate is too large */ ! *month -= 1; ! preceding -= days_in_month(*year, *month); ! } ! n -= preceding; ! assert(0 <= n); ! assert(n < days_in_month(*year, *month)); ! *day = n + 1; } *************** *** 163,167 **** ymd_to_ord(int year, int month, int day) { ! return days_before_year(year) + days_before_month(year, month) + day; } --- 163,167 ---- ymd_to_ord(int year, int month, int day) { ! return days_before_year(year) + days_before_month(year, month) + day; } *************** *** 169,173 **** weekday(int year, int month, int day) { ! return (ymd_to_ord(year, month, day) + 6) % 7; } --- 169,173 ---- weekday(int year, int month, int day) { ! return (ymd_to_ord(year, month, day) + 6) % 7; } *************** *** 175,187 **** iso_week1_monday(int year) { ! int first_day = ymd_to_ord(year, 1, 1); ! int first_weekday = (first_day + 6) % 7; ! int week1_monday = first_day - first_weekday; #define THURSDAY 3 ! if (first_weekday > THURSDAY) ! week1_monday += 7; #undef THURSDAY ! return week1_monday; } --- 175,187 ---- iso_week1_monday(int year) { ! int first_day = ymd_to_ord(year, 1, 1); ! int first_weekday = (first_day + 6) % 7; ! int week1_monday = first_day - first_weekday; #define THURSDAY 3 ! if (first_weekday > THURSDAY) ! week1_monday += 7; #undef THURSDAY ! return week1_monday; } *************** *** 190,209 **** int hours, int minutes, int seconds) { ! static char *DayNames[] = { ! "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" ! }; ! static char *MonthNames[] = { ! "Jan", "Feb", "Mar", "Apr", "May", "Jun", ! "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ! }; ! char buffer[128]; ! int wday = weekday(GET_YEAR(date), GET_MONTH(date), GET_DAY(date)); ! PyOS_snprintf(buffer, sizeof(buffer), "%s %s %2d %02d:%02d:%02d %04d", ! DayNames[wday], MonthNames[GET_MONTH(date) - 1], ! GET_DAY(date), hours, minutes, seconds, ! GET_YEAR(date)); ! return PyString_FromString(buffer); } --- 190,209 ---- int hours, int minutes, int seconds) { ! static char *DayNames[] = { ! "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" ! }; ! static char *MonthNames[] = { ! "Jan", "Feb", "Mar", "Apr", "May", "Jun", ! "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ! }; ! char buffer[128]; ! int wday = weekday(GET_YEAR(date), GET_MONTH(date), GET_DAY(date)); ! PyOS_snprintf(buffer, sizeof(buffer), "%s %s %2d %02d:%02d:%02d %04d", ! DayNames[wday], MonthNames[GET_MONTH(date) - 1], ! GET_DAY(date), hours, minutes, seconds, ! GET_YEAR(date)); ! return PyString_FromString(buffer); } *************** *** 211,219 **** isoformat_date(PyDateTime_Date *dt, char buffer[], int bufflen) { ! int x; ! x = PyOS_snprintf(buffer, bufflen, ! "%04d-%02d-%02d", ! GET_YEAR(dt), GET_MONTH(dt), GET_DAY(dt)); ! return buffer + x; } --- 211,219 ---- isoformat_date(PyDateTime_Date *dt, char buffer[], int bufflen) { ! int x; ! x = PyOS_snprintf(buffer, bufflen, ! "%04d-%02d-%02d", ! GET_YEAR(dt), GET_MONTH(dt), GET_DAY(dt)); ! return buffer + x; } *************** *** 221,228 **** isoformat_time(PyDateTime_DateTime *dt, char buffer[], int bufflen) { ! PyOS_snprintf(buffer, bufflen, ! "%02d:%02d:%02d.%06d", ! GET_HOUR(dt), GET_MINUTE(dt), GET_SECOND(dt), ! GET_MICROSECOND(dt)); } --- 221,228 ---- isoformat_time(PyDateTime_DateTime *dt, char buffer[], int bufflen) { ! PyOS_snprintf(buffer, bufflen, ! "%02d:%02d:%02d.%06d", ! GET_HOUR(dt), GET_MINUTE(dt), GET_SECOND(dt), ! GET_MICROSECOND(dt)); } *************** *** 232,245 **** new_date(int year, int month, int day) { ! PyDateTime_Date *self; ! self = PyObject_New(PyDateTime_Date, &PyDateTime_DateType); ! if (self != NULL) { ! self->hashcode = -1; ! SET_YEAR(self, year); ! SET_MONTH(self, month); ! SET_DAY(self, day); ! } ! return (PyObject *) self; } --- 232,245 ---- new_date(int year, int month, int day) { ! PyDateTime_Date *self; ! self = PyObject_New(PyDateTime_Date, &PyDateTime_DateType); ! if (self != NULL) { ! self->hashcode = -1; ! SET_YEAR(self, year); ! SET_MONTH(self, month); ! SET_DAY(self, day); ! } ! return (PyObject *) self; } *************** *** 249,266 **** int second, int usecond) { ! PyDateTime_DateTime *self; ! self = PyObject_New(PyDateTime_DateTime, &PyDateTime_DateTimeType); ! if (self != NULL) { ! self->hashcode = -1; ! SET_YEAR(self, year); ! SET_MONTH(self, month); ! SET_DAY(self, day); ! SET_HOUR(self, hour); ! SET_MINUTE(self, minute); ! SET_SECOND(self, second); ! SET_MICROSECOND(self, usecond); ! } ! return (PyObject *) self; } --- 249,266 ---- int second, int usecond) { ! PyDateTime_DateTime *self; ! self = PyObject_New(PyDateTime_DateTime, &PyDateTime_DateTimeType); ! if (self != NULL) { ! self->hashcode = -1; ! SET_YEAR(self, year); ! SET_MONTH(self, month); ! SET_DAY(self, day); ! SET_HOUR(self, hour); ! SET_MINUTE(self, minute); ! SET_SECOND(self, second); ! SET_MICROSECOND(self, usecond); ! } ! return (PyObject *) self; } *************** *** 268,289 **** new_delta(long int days, long int seconds, long int microseconds) { ! PyDateTime_Delta *self; ! if (microseconds >= 1000000 || microseconds <= -1000000) { ! seconds += microseconds / 1000000; ! microseconds %= 1000000; ! } ! if (seconds >= 24*3600 || seconds <= 24*3600) { ! days += seconds / (24*3600); ! seconds %= (24*3600); ! } ! self = PyObject_New(PyDateTime_Delta, &PyDateTime_DeltaType); ! if (self != NULL) { ! self->hashcode = -1; ! SET_TD_DAYS(self, days); ! SET_TD_SECONDS(self, seconds); ! SET_TD_MICROSECONDS(self, microseconds); ! } ! return (PyObject *) self; } --- 268,289 ---- new_delta(long int days, long int seconds, long int microseconds) { ! PyDateTime_Delta *self; ! if (microseconds >= 1000000 || microseconds <= -1000000) { ! seconds += microseconds / 1000000; ! microseconds %= 1000000; ! } ! if (seconds >= 24*3600 || seconds <= 24*3600) { ! days += seconds / (24*3600); ! seconds %= (24*3600); ! } ! self = PyObject_New(PyDateTime_Delta, &PyDateTime_DeltaType); ! if (self != NULL) { ! self->hashcode = -1; ! SET_TD_DAYS(self, days); ! SET_TD_SECONDS(self, seconds); ! SET_TD_MICROSECONDS(self, microseconds); ! } ! return (PyObject *) self; } *************** *** 295,348 **** init_datetime(void) { ! PyObject *m; ! PyObject *d, *dt; ! if (PyType_Ready(&PyDateTime_DateType) < 0) ! return; ! if (PyType_Ready(&PyDateTime_DateTimeType) < 0) ! return; ! if (PyType_Ready(&PyDateTime_DeltaType) < 0) ! return; ! /* date values */ ! d = PyDateTime_DateType.tp_dict; ! dt = new_date(1, 1, 1); ! if (dt == NULL || PyDict_SetItemString(d, "min", dt) < 0) ! return; ! Py_DECREF(dt); ! dt = new_date(MAXYEAR, 12, 31); ! if (dt == NULL || PyDict_SetItemString(d, "max", dt) < 0) ! return; ! Py_DECREF(dt); ! dt = new_delta(1, 0, 0); ! if (dt == NULL || PyDict_SetItemString(d, "resolution", dt) < 0) ! return; ! Py_DECREF(dt); ! /* date/time values */ ! d = PyDateTime_DateTimeType.tp_dict; ! dt = new_datetime(1, 1, 1, 0, 0, 0, 0); ! if (dt == NULL || PyDict_SetItemString(d, "min", dt) < 0) ! return; ! Py_DECREF(dt); ! dt = new_datetime(MAXYEAR, 12, 31, 23, 59, 59, 999999); ! if (dt == NULL || PyDict_SetItemString(d, "max", dt) < 0) ! return; ! Py_DECREF(dt); ! dt = new_delta(0, 0, 1); ! if (dt == NULL || PyDict_SetItemString(d, "resolution", dt) < 0) ! return; ! Py_DECREF(dt); ! /* module initialization */ ! m = Py_InitModule3("_datetime", NULL, ! "Fast implementation of the datetime type."); ! PyModule_AddIntConstant(m, "MINYEAR", 1); ! PyModule_AddIntConstant(m, "MAXYEAR", MAXYEAR); ! Py_INCREF(&PyDateTime_DateType); ! PyModule_AddObject(m, "date", (PyObject *) &PyDateTime_DateType); ! Py_INCREF(&PyDateTime_DateTimeType); ! PyModule_AddObject(m, "datetime", (PyObject *) &PyDateTime_DateTimeType); ! Py_INCREF(&PyDateTime_DeltaType); ! PyModule_AddObject(m, "timedelta", (PyObject *) &PyDateTime_DeltaType); } --- 295,348 ---- init_datetime(void) { ! PyObject *m; ! PyObject *d, *dt; ! if (PyType_Ready(&PyDateTime_DateType) < 0) ! return; ! if (PyType_Ready(&PyDateTime_DateTimeType) < 0) ! return; ! if (PyType_Ready(&PyDateTime_DeltaType) < 0) ! return; ! /* date values */ ! d = PyDateTime_DateType.tp_dict; ! dt = new_date(1, 1, 1); ! if (dt == NULL || PyDict_SetItemString(d, "min", dt) < 0) ! return; ! Py_DECREF(dt); ! dt = new_date(MAXYEAR, 12, 31); ! if (dt == NULL || PyDict_SetItemString(d, "max", dt) < 0) ! return; ! Py_DECREF(dt); ! dt = new_delta(1, 0, 0); ! if (dt == NULL || PyDict_SetItemString(d, "resolution", dt) < 0) ! return; ! Py_DECREF(dt); ! /* date/time values */ ! d = PyDateTime_DateTimeType.tp_dict; ! dt = new_datetime(1, 1, 1, 0, 0, 0, 0); ! if (dt == NULL || PyDict_SetItemString(d, "min", dt) < 0) ! return; ! Py_DECREF(dt); ! dt = new_datetime(MAXYEAR, 12, 31, 23, 59, 59, 999999); ! if (dt == NULL || PyDict_SetItemString(d, "max", dt) < 0) ! return; ! Py_DECREF(dt); ! dt = new_delta(0, 0, 1); ! if (dt == NULL || PyDict_SetItemString(d, "resolution", dt) < 0) ! return; ! Py_DECREF(dt); ! /* module initialization */ ! m = Py_InitModule3("_datetime", NULL, ! "Fast implementation of the datetime type."); ! PyModule_AddIntConstant(m, "MINYEAR", 1); ! PyModule_AddIntConstant(m, "MAXYEAR", MAXYEAR); ! Py_INCREF(&PyDateTime_DateType); ! PyModule_AddObject(m, "date", (PyObject *) &PyDateTime_DateType); ! Py_INCREF(&PyDateTime_DateTimeType); ! PyModule_AddObject(m, "datetime", (PyObject *) &PyDateTime_DateTimeType); ! Py_INCREF(&PyDateTime_DeltaType); ! PyModule_AddObject(m, "timedelta", (PyObject *) &PyDateTime_DeltaType); } From gvanrossum@users.sourceforge.net Thu Nov 21 18:02:03 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 21 Nov 2002 10:02:03 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.h,1.5,1.6 obj_date.c,1.1,1.2 obj_datetime.c,1.1,1.2 obj_delta.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv10672 Modified Files: datetime.h obj_date.c obj_datetime.c obj_delta.c Log Message: Reindent with tabs. Tim will take it from here. Index: datetime.h =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** datetime.h 20 Aug 2002 18:53:07 -0000 1.5 --- datetime.h 21 Nov 2002 18:02:00 -0000 1.6 *************** *** 10,23 **** typedef struct { ! PyObject_HEAD ! long hashcode; ! unsigned char data[_PyDateTime_DATE_DATA_SIZE]; } PyDateTime_Date; typedef struct { ! PyObject_HEAD ! long hashcode; ! unsigned char data[_PyDateTime_DATETIME_DATA_SIZE]; } PyDateTime_DateTime; --- 10,23 ---- typedef struct { ! PyObject_HEAD ! long hashcode; ! unsigned char data[_PyDateTime_DATE_DATA_SIZE]; } PyDateTime_Date; typedef struct { ! PyObject_HEAD ! long hashcode; ! unsigned char data[_PyDateTime_DATETIME_DATA_SIZE]; } PyDateTime_DateTime; Index: obj_date.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_date.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** obj_date.c 20 Aug 2002 18:53:07 -0000 1.1 --- obj_date.c 21 Nov 2002 18:02:01 -0000 1.2 *************** *** 7,68 **** normalize_date(long int *year, long int *month, long int *day) { ! long int carry, dim; ! /* This is muddy: the proper range for day can't be determined ! * without knowing the correct month and year, but if day is, ! * e.g., plus or minus a million, the current month and year ! * values make no sense (and may also be out of bounds ! * themselves). Saying 12 months == 1 year should be ! * non-controversial. ! */ ! if (*month > 12) { ! carry = (*month - 1) / 12; ! *month -= (carry * 12); ! *year += carry; ! assert(*month >= 1); ! assert(*month <= 12); ! } ! /* Now only day can be out of bounds (year may also be out of ! * bounds for a datetime object, but we don't care about that ! * here). If day is out of bounds, what to do is arguable, but at ! * least the method here is principled and explainable. ! */ ! dim = days_in_month(*year, *month); ! if (*day < 1 || *day > dim) { ! /* Move day-1 days from the first of the month. First try to ! * get off cheap if we're only one day out of range ! * (adjustments for timezone alone can't be worse than that). ! */ ! if (*day == 0) { ! *month -= 1; ! if (*month > 0) ! *day = days_in_month(*year, *month); ! else { ! *year -= 1; ! *month = 12; ! *day = 31; ! } ! } ! else if (*day == dim + 1) { ! /* move forward a day */ ! *month += 1; ! *day = 1; ! if (*month > 12) { ! *month = 1; ! *year += 1; ! } ! } ! else { ! long int ordinal = ymd_to_ord(*year, *month, 1) + *day - 1; ! ord_to_ymd(ordinal, year, month, day); ! } ! } ! assert(*month > 0); ! assert(*day > 0); ! if (*year < MINYEAR) { ! PyErr_SetString(PyExc_OverflowError, "date value out of range"); ! return 0; ! } ! return 1; } --- 7,68 ---- normalize_date(long int *year, long int *month, long int *day) { ! long int carry, dim; ! /* This is muddy: the proper range for day can't be determined ! * without knowing the correct month and year, but if day is, ! * e.g., plus or minus a million, the current month and year ! * values make no sense (and may also be out of bounds ! * themselves). Saying 12 months == 1 year should be ! * non-controversial. ! */ ! if (*month > 12) { ! carry = (*month - 1) / 12; ! *month -= (carry * 12); ! *year += carry; ! assert(*month >= 1); ! assert(*month <= 12); ! } ! /* Now only day can be out of bounds (year may also be out of ! * bounds for a datetime object, but we don't care about that ! * here). If day is out of bounds, what to do is arguable, but at ! * least the method here is principled and explainable. ! */ ! dim = days_in_month(*year, *month); ! if (*day < 1 || *day > dim) { ! /* Move day-1 days from the first of the month. First try to ! * get off cheap if we're only one day out of range ! * (adjustments for timezone alone can't be worse than that). ! */ ! if (*day == 0) { ! *month -= 1; ! if (*month > 0) ! *day = days_in_month(*year, *month); ! else { ! *year -= 1; ! *month = 12; ! *day = 31; ! } ! } ! else if (*day == dim + 1) { ! /* move forward a day */ ! *month += 1; ! *day = 1; ! if (*month > 12) { ! *month = 1; ! *year += 1; ! } ! } ! else { ! long int ordinal = ymd_to_ord(*year, *month, 1) + *day - 1; ! ord_to_ymd(ordinal, year, month, day); ! } ! } ! assert(*month > 0); ! assert(*day > 0); ! if (*year < MINYEAR) { ! PyErr_SetString(PyExc_OverflowError, "date value out of range"); ! return 0; ! } ! return 1; } *************** *** 79,110 **** add_date_timedelta(PyDateTime_Date *date, PyDateTime_Delta *delta) { ! PyObject *result; ! /* delta + date */ ! if (GET_TD_SECONDS(delta) != 0 ! || GET_TD_MICROSECONDS(delta) != 0) { ! /* Convert to datetime and pass it off. */ ! PyObject *dt = new_datetime(GET_YEAR(date), GET_MONTH(date), ! GET_DAY(date), 0, 0, 0, 0); ! if (dt == NULL) ! return NULL; ! result = datetime_add((PyObject *)delta, dt); ! Py_DECREF(dt); ! } ! else if (GET_TD_DAYS(delta) != 0) { ! /* There's actually something to do. */ ! long int year = GET_YEAR(date); ! long int month = GET_MONTH(date); ! long int day = GET_DAY(date) + GET_TD_DAYS(delta); ! if (normalize_date(&year, &month, &day)) ! result = new_date(year, month, day); ! else ! result = NULL; ! } ! else { ! /* The delta is timedelta(0), so return the original date. */ ! Py_INCREF(date); ! result = (PyObject *) date; ! } ! return result; } --- 79,110 ---- add_date_timedelta(PyDateTime_Date *date, PyDateTime_Delta *delta) { ! PyObject *result; ! /* delta + date */ ! if (GET_TD_SECONDS(delta) != 0 ! || GET_TD_MICROSECONDS(delta) != 0) { ! /* Convert to datetime and pass it off. */ ! PyObject *dt = new_datetime(GET_YEAR(date), GET_MONTH(date), ! GET_DAY(date), 0, 0, 0, 0); ! if (dt == NULL) ! return NULL; ! result = datetime_add((PyObject *)delta, dt); ! Py_DECREF(dt); ! } ! else if (GET_TD_DAYS(delta) != 0) { ! /* There's actually something to do. */ ! long int year = GET_YEAR(date); ! long int month = GET_MONTH(date); ! long int day = GET_DAY(date) + GET_TD_DAYS(delta); ! if (normalize_date(&year, &month, &day)) ! result = new_date(year, month, day); ! else ! result = NULL; ! } ! else { ! /* The delta is timedelta(0), so return the original date. */ ! Py_INCREF(date); ! result = (PyObject *) date; ! } ! return result; } *************** *** 112,138 **** date_add(PyObject *left, PyObject *right) { ! PyTypeObject *left_type = left->ob_type; ! PyTypeObject *right_type = right->ob_type; ! if (PyType_IsSubtype(left_type, &PyDateTime_DateTimeType) ! || PyType_IsSubtype(right_type, &PyDateTime_DateTimeType)) { ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; ! } ! if (PyType_IsSubtype(left_type, &PyDateTime_DateType)) { ! /* date + ??? */ ! if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) ! return add_date_timedelta((PyDateTime_Date *) left, ! (PyDateTime_Delta *) right); ! } ! else { ! /* 'right' must be one of us, or we wouldn't have been called */ ! if (PyType_IsSubtype(left_type, &PyDateTime_DeltaType)) ! return add_date_timedelta((PyDateTime_Date *) right, ! (PyDateTime_Delta *) left); ! /* else fall through; we don't support it here */ ! } ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; } --- 112,138 ---- date_add(PyObject *left, PyObject *right) { ! PyTypeObject *left_type = left->ob_type; ! PyTypeObject *right_type = right->ob_type; ! if (PyType_IsSubtype(left_type, &PyDateTime_DateTimeType) ! || PyType_IsSubtype(right_type, &PyDateTime_DateTimeType)) { ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; ! } ! if (PyType_IsSubtype(left_type, &PyDateTime_DateType)) { ! /* date + ??? */ ! if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) ! return add_date_timedelta((PyDateTime_Date *) left, ! (PyDateTime_Delta *) right); ! } ! else { ! /* 'right' must be one of us, or we wouldn't have been called */ ! if (PyType_IsSubtype(left_type, &PyDateTime_DeltaType)) ! return add_date_timedelta((PyDateTime_Date *) right, ! (PyDateTime_Delta *) left); ! /* else fall through; we don't support it here */ ! } ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; } *************** *** 140,150 **** date_compare(PyDateTime_Date *self, PyObject *other) { ! if (!PyType_IsSubtype(other->ob_type, &PyDateTime_DateType)) { ! PyErr_SetString(PyExc_TypeError, ! "can't compare date to %s instance"); ! return -1; ! } ! return memcmp(self->data, ((PyDateTime_Date *)other)->data, ! _PyDateTime_DATE_DATA_SIZE); } --- 140,150 ---- date_compare(PyDateTime_Date *self, PyObject *other) { ! if (!PyType_IsSubtype(other->ob_type, &PyDateTime_DateType)) { ! PyErr_SetString(PyExc_TypeError, ! "can't compare date to %s instance"); ! return -1; ! } ! return memcmp(self->data, ((PyDateTime_Date *)other)->data, ! _PyDateTime_DATE_DATA_SIZE); } *************** *** 152,156 **** date_ctime(PyDateTime_Date *self) { ! return format_ctime(self, 0, 0, 0); } --- 152,156 ---- date_ctime(PyDateTime_Date *self) { ! return format_ctime(self, 0, 0, 0); } *************** *** 158,170 **** date_hash(PyDateTime_Date *self) { ! if (self->hashcode == -1) { ! PyObject *temp = Py_BuildValue("lll", GET_YEAR(self), ! GET_MONTH(self), GET_DAY(self)); ! if (temp != NULL) { ! self->hashcode = PyObject_Hash(temp); ! Py_DECREF(temp); ! } ! } ! return self->hashcode; } --- 158,170 ---- date_hash(PyDateTime_Date *self) { ! if (self->hashcode == -1) { ! PyObject *temp = Py_BuildValue("lll", GET_YEAR(self), ! GET_MONTH(self), GET_DAY(self)); ! if (temp != NULL) { ! self->hashcode = PyObject_Hash(temp); ! Py_DECREF(temp); ! } ! } ! return self->hashcode; } *************** *** 172,199 **** date_new(PyTypeObject *type, PyObject *args, PyObject *kw) { ! PyObject *self = NULL; ! long int year, month, day; ! static char *keywords[] = { ! "year", "month", "day", NULL ! }; ! if (PyArg_ParseTupleAndKeywords(args, kw, "lll", keywords, ! &year, &month, &day)) { ! if (year < MINYEAR || year > MAXYEAR) { ! PyErr_SetString(PyExc_ValueError, "year is out of range"); ! return NULL; ! } ! if (month < 1 || month > 12) { ! PyErr_SetString(PyExc_ValueError, "month must be in 1..12"); ! return NULL; ! } ! if (day < 1 || day > days_in_month(year, month)) { ! PyErr_SetString(PyExc_ValueError, "day is out of range for month"); ! return NULL; ! } ! self = new_date(year, month, day); ! } ! return self; } --- 172,199 ---- date_new(PyTypeObject *type, PyObject *args, PyObject *kw) { ! PyObject *self = NULL; ! long int year, month, day; ! static char *keywords[] = { ! "year", "month", "day", NULL ! }; ! if (PyArg_ParseTupleAndKeywords(args, kw, "lll", keywords, ! &year, &month, &day)) { ! if (year < MINYEAR || year > MAXYEAR) { ! PyErr_SetString(PyExc_ValueError, "year is out of range"); ! return NULL; ! } ! if (month < 1 || month > 12) { ! PyErr_SetString(PyExc_ValueError, "month must be in 1..12"); ! return NULL; ! } ! if (day < 1 || day > days_in_month(year, month)) { ! PyErr_SetString(PyExc_ValueError, "day is out of range for month"); ! return NULL; ! } ! self = new_date(year, month, day); ! } ! return self; } *************** *** 201,205 **** date_year(PyDateTime_Date *self, void *unused) { ! return (PyInt_FromLong(GET_YEAR(self))); } --- 201,205 ---- date_year(PyDateTime_Date *self, void *unused) { ! return (PyInt_FromLong(GET_YEAR(self))); } *************** *** 207,211 **** date_month(PyDateTime_Date *self, void *unused) { ! return (PyInt_FromLong(GET_MONTH(self))); } --- 207,211 ---- date_month(PyDateTime_Date *self, void *unused) { ! return (PyInt_FromLong(GET_MONTH(self))); } *************** *** 213,224 **** date_day(PyDateTime_Date *self, void *unused) { ! return (PyInt_FromLong(GET_DAY(self))); } static PyGetSetDef date_getset[] = { ! {"year", (getter)date_year}, ! {"month", (getter)date_month}, ! {"day", (getter)date_day}, ! {NULL} }; --- 213,224 ---- date_day(PyDateTime_Date *self, void *unused) { ! return (PyInt_FromLong(GET_DAY(self))); } static PyGetSetDef date_getset[] = { ! {"year", (getter)date_year}, ! {"month", (getter)date_month}, ! {"day", (getter)date_day}, ! {NULL} }; *************** *** 226,247 **** date_isocalendar(PyDateTime_Date *self) { ! int year = GET_YEAR(self); ! int week1_monday = iso_week1_monday(year); ! long today = ymd_to_ord(year, GET_MONTH(self), GET_DAY(self)); ! int week = (today - week1_monday) / 7; ! int day = (today - week1_monday) % 7; ! if (week < 0) { ! --year; ! week1_monday = iso_week1_monday(year); ! week = (today - week1_monday) / 7; ! day = (today - week1_monday) % 7; ! } ! else if (week >= 52 && ! today >= iso_week1_monday(year + 1)) { ! ++year; ! week = 0; ! } ! return Py_BuildValue("iii", year, week + 1, day + 1); } --- 226,247 ---- date_isocalendar(PyDateTime_Date *self) { ! int year = GET_YEAR(self); ! int week1_monday = iso_week1_monday(year); ! long today = ymd_to_ord(year, GET_MONTH(self), GET_DAY(self)); ! int week = (today - week1_monday) / 7; ! int day = (today - week1_monday) % 7; ! if (week < 0) { ! --year; ! week1_monday = iso_week1_monday(year); ! week = (today - week1_monday) / 7; ! day = (today - week1_monday) % 7; ! } ! else if (week >= 52 && ! today >= iso_week1_monday(year + 1)) { ! ++year; ! week = 0; ! } ! return Py_BuildValue("iii", year, week + 1, day + 1); } *************** *** 249,257 **** date_isoformat(PyDateTime_Date *self, PyObject *args, PyObject *kw) { ! char buffer[128]; ! isoformat_date(self, buffer, sizeof(buffer)); ! return PyString_FromString(buffer); } --- 249,257 ---- date_isoformat(PyDateTime_Date *self, PyObject *args, PyObject *kw) { ! char buffer[128]; ! isoformat_date(self, buffer, sizeof(buffer)); ! return PyString_FromString(buffer); } *************** *** 259,265 **** date_isoweekday(PyDateTime_Date *self) { ! int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); ! return PyInt_FromLong(dow + 1); } --- 259,265 ---- date_isoweekday(PyDateTime_Date *self) { ! int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); ! return PyInt_FromLong(dow + 1); } *************** *** 267,273 **** date_nonzero(PyDateTime_Date *self) { ! return (GET_YEAR(self) != 0 ! || GET_MONTH(self) != 0 ! || GET_DAY(self) != 0); } --- 267,273 ---- date_nonzero(PyDateTime_Date *self) { ! return (GET_YEAR(self) != 0 ! || GET_MONTH(self) != 0 ! || GET_DAY(self) != 0); } *************** *** 275,287 **** date_repr(PyDateTime_Date *self) { ! char buffer[1028]; ! char *typename; ! typename = self->ob_type->tp_name; ! PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d)", ! typename, ! GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); ! return PyString_FromString(buffer); } --- 275,287 ---- date_repr(PyDateTime_Date *self) { ! char buffer[1028]; ! char *typename; ! typename = self->ob_type->tp_name; ! PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d)", ! typename, ! GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); ! return PyString_FromString(buffer); } *************** *** 289,297 **** date_str(PyDateTime_Date *self) { ! char buffer[128]; ! isoformat_date(self, buffer, sizeof(buffer)); ! return PyString_FromString(buffer); } --- 289,297 ---- date_str(PyDateTime_Date *self) { ! char buffer[128]; ! isoformat_date(self, buffer, sizeof(buffer)); ! return PyString_FromString(buffer); } *************** *** 299,354 **** date_subtract(PyObject *left, PyObject *right) { ! PyTypeObject *left_type = left->ob_type; ! PyTypeObject *right_type = right->ob_type; ! if (PyType_IsSubtype(left_type, &PyDateTime_DateTimeType) ! || PyType_IsSubtype(right_type, &PyDateTime_DateTimeType)) { ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; ! } ! if (PyType_IsSubtype(left_type, &PyDateTime_DateType)) { ! if (PyType_IsSubtype(right_type, &PyDateTime_DateType)) { ! /* date - date */ ! long int left_ord = ymd_to_ord(GET_YEAR(left), GET_MONTH(left), ! GET_DAY(left)); ! long int right_ord = ymd_to_ord(GET_YEAR(right), GET_MONTH(right), ! GET_DAY(right)); ! return new_delta(left_ord - right_ord, 0, 0); ! } ! if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) { ! PyObject *result = NULL; ! if (GET_TD_SECONDS(right) != 0 ! || GET_TD_MICROSECONDS(right) != 0) { ! /* need to convert to datetime + delta */ ! PyObject *dt = new_datetime(GET_YEAR(left), GET_MONTH(left), ! GET_DAY(left), 0, 0, 0, 0); ! if (dt != NULL) { ! result = datetime_subtract(dt, right); ! Py_DECREF(dt); ! } ! } ! else if (GET_TD_DAYS(right) == 0) { ! /* date - timedelta(0) */ ! Py_INCREF(left); ! result = left; ! } ! else { ! long int year, month, day; ! long int ord = ymd_to_ord(GET_YEAR(left), GET_MONTH(left), ! GET_DAY(left)); ! ord -= GET_TD_DAYS(right); ! if (ord < 1) ! PyErr_SetString(PyExc_OverflowError, ! "resulting value out of range"); ! else { ! ord_to_ymd(ord, &year, &month, &day); ! result = new_date(year, month, day); ! } ! } ! return result; ! } ! } ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; } --- 299,354 ---- date_subtract(PyObject *left, PyObject *right) { ! PyTypeObject *left_type = left->ob_type; ! PyTypeObject *right_type = right->ob_type; ! if (PyType_IsSubtype(left_type, &PyDateTime_DateTimeType) ! || PyType_IsSubtype(right_type, &PyDateTime_DateTimeType)) { ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; ! } ! if (PyType_IsSubtype(left_type, &PyDateTime_DateType)) { ! if (PyType_IsSubtype(right_type, &PyDateTime_DateType)) { ! /* date - date */ ! long int left_ord = ymd_to_ord(GET_YEAR(left), GET_MONTH(left), ! GET_DAY(left)); ! long int right_ord = ymd_to_ord(GET_YEAR(right), GET_MONTH(right), ! GET_DAY(right)); ! return new_delta(left_ord - right_ord, 0, 0); ! } ! if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) { ! PyObject *result = NULL; ! if (GET_TD_SECONDS(right) != 0 ! || GET_TD_MICROSECONDS(right) != 0) { ! /* need to convert to datetime + delta */ ! PyObject *dt = new_datetime(GET_YEAR(left), GET_MONTH(left), ! GET_DAY(left), 0, 0, 0, 0); ! if (dt != NULL) { ! result = datetime_subtract(dt, right); ! Py_DECREF(dt); ! } ! } ! else if (GET_TD_DAYS(right) == 0) { ! /* date - timedelta(0) */ ! Py_INCREF(left); ! result = left; ! } ! else { ! long int year, month, day; ! long int ord = ymd_to_ord(GET_YEAR(left), GET_MONTH(left), ! GET_DAY(left)); ! ord -= GET_TD_DAYS(right); ! if (ord < 1) ! PyErr_SetString(PyExc_OverflowError, ! "resulting value out of range"); ! else { ! ord_to_ymd(ord, &year, &month, &day); ! result = new_date(year, month, day); ! } ! } ! return result; ! } ! } ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; } *************** *** 356,375 **** date_today(PyObject *self, PyObject *cls) { ! /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ ! struct timeval t; ! struct tm *tm; ! time_t timet; #ifdef GETTIMEOFDAY_NO_TZ ! gettimeofday(&t); #else /* !GETTIMEOFDAY_NO_TZ */ ! gettimeofday(&t, (struct timezone *)NULL); #endif /* !GETTIMEOFDAY_NO_TZ */ ! timet = t.tv_sec; ! tm = localtime(&timet); ! return PyObject_CallFunction(cls, "iii", ! tm->tm_year + 1900, tm->tm_mon + 1, ! tm->tm_mday); } --- 356,375 ---- date_today(PyObject *self, PyObject *cls) { ! /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ ! struct timeval t; ! struct tm *tm; ! time_t timet; #ifdef GETTIMEOFDAY_NO_TZ ! gettimeofday(&t); #else /* !GETTIMEOFDAY_NO_TZ */ ! gettimeofday(&t, (struct timezone *)NULL); #endif /* !GETTIMEOFDAY_NO_TZ */ ! timet = t.tv_sec; ! tm = localtime(&timet); ! return PyObject_CallFunction(cls, "iii", ! tm->tm_year + 1900, tm->tm_mon + 1, ! tm->tm_mday); } *************** *** 377,382 **** date_toordinal(PyDateTime_Date *self) { ! return PyInt_FromLong(ymd_to_ord(GET_YEAR(self), GET_MONTH(self), ! GET_DAY(self))); } --- 377,382 ---- date_toordinal(PyDateTime_Date *self) { ! return PyInt_FromLong(ymd_to_ord(GET_YEAR(self), GET_MONTH(self), ! GET_DAY(self))); } *************** *** 384,417 **** date_weekday(PyDateTime_Date *self) { ! int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); ! return PyInt_FromLong(dow); } static PyMethodDef date_methods[] = { ! /* Class methods: */ ! {"today", (PyCFunction)date_today, METH_O | METH_CLASS, ! "Return a new date that represents the current date."}, ! /* Instance methods: */ ! {"ctime", (PyCFunction)date_ctime, METH_NOARGS, ! "Return ctime() style string."}, ! {"isocalendar", (PyCFunction)date_isocalendar, METH_NOARGS, ! "Return a 3-tuple containing ISO year, week number, and weekday.\n\n" ! "The first ISO week of the year is the (Mon-Sun) week containing the\n" ! "year's first Thursday; everything rest derives from that."}, ! {"isoformat", (PyCFunction)date_isoformat, METH_KEYWORDS, ! "Return the day of the week represented by the date.\n" ! "Monday == 1 ... Sunday == 7"}, ! {"isoweekday", (PyCFunction)date_isoweekday, METH_NOARGS, ! "Return the day of the week represented by the date.\n" ! "Monday == 1 ... Sunday == 7"}, ! {"toordinal", (PyCFunction)date_toordinal, METH_NOARGS, ! "Return proleptic Gregorian ordinal for the year, month and day.\n" ! "January 1 of year 1 is day 1."}, ! {"weekday", (PyCFunction)date_weekday, METH_NOARGS, ! "Return the day of the week represented by the date.\n" ! "Monday == 0 ... Sunday == 6"}, ! {NULL} }; --- 384,417 ---- date_weekday(PyDateTime_Date *self) { ! int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); ! return PyInt_FromLong(dow); } static PyMethodDef date_methods[] = { ! /* Class methods: */ ! {"today", (PyCFunction)date_today, METH_O | METH_CLASS, ! "Return a new date that represents the current date."}, ! /* Instance methods: */ ! {"ctime", (PyCFunction)date_ctime, METH_NOARGS, ! "Return ctime() style string."}, ! {"isocalendar", (PyCFunction)date_isocalendar, METH_NOARGS, ! "Return a 3-tuple containing ISO year, week number, and weekday.\n\n" ! "The first ISO week of the year is the (Mon-Sun) week containing the\n" ! "year's first Thursday; everything rest derives from that."}, ! {"isoformat", (PyCFunction)date_isoformat, METH_KEYWORDS, ! "Return the day of the week represented by the date.\n" ! "Monday == 1 ... Sunday == 7"}, ! {"isoweekday", (PyCFunction)date_isoweekday, METH_NOARGS, ! "Return the day of the week represented by the date.\n" ! "Monday == 1 ... Sunday == 7"}, ! {"toordinal", (PyCFunction)date_toordinal, METH_NOARGS, ! "Return proleptic Gregorian ordinal for the year, month and day.\n" ! "January 1 of year 1 is day 1."}, ! {"weekday", (PyCFunction)date_weekday, METH_NOARGS, ! "Return the day of the week represented by the date.\n" ! "Monday == 0 ... Sunday == 6"}, ! {NULL} }; *************** *** 420,477 **** static PyNumberMethods date_as_number = { ! date_add, /* nb_add */ ! date_subtract, /* nb_subtract */ ! 0, /* nb_multiply */ ! 0, /* nb_divide */ ! 0, /* nb_remainder */ ! 0, /* nb_divmod */ ! 0, /* nb_power */ ! 0, /* nb_negative */ ! 0, /* nb_positive */ ! 0, /* nb_absolute */ ! (inquiry)date_nonzero, /* nb_nonzero */ }; static PyTypeObject PyDateTime_DateType = { ! PyObject_HEAD_INIT(NULL) ! 0, /* ob_size */ ! "date", /* tp_name */ ! sizeof(PyDateTime_Date), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! (destructor)PyObject_Del, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)date_compare, /* tp_compare */ ! (reprfunc)date_repr, /* tp_repr */ ! &date_as_number, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! (hashfunc)date_hash, /* tp_hash */ ! 0, /* tp_call */ ! (reprfunc)date_str, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE, /* tp_flags */ ! date_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! date_methods, /* tp_methods */ ! 0, /* tp_members */ ! date_getset, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! date_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 420,477 ---- static PyNumberMethods date_as_number = { ! date_add, /* nb_add */ ! date_subtract, /* nb_subtract */ ! 0, /* nb_multiply */ ! 0, /* nb_divide */ ! 0, /* nb_remainder */ ! 0, /* nb_divmod */ ! 0, /* nb_power */ ! 0, /* nb_negative */ ! 0, /* nb_positive */ ! 0, /* nb_absolute */ ! (inquiry)date_nonzero, /* nb_nonzero */ }; static PyTypeObject PyDateTime_DateType = { ! PyObject_HEAD_INIT(NULL) ! 0, /* ob_size */ ! "date", /* tp_name */ ! sizeof(PyDateTime_Date), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! (destructor)PyObject_Del, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)date_compare, /* tp_compare */ ! (reprfunc)date_repr, /* tp_repr */ ! &date_as_number, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! (hashfunc)date_hash, /* tp_hash */ ! 0, /* tp_call */ ! (reprfunc)date_str, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE, /* tp_flags */ ! date_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! date_methods, /* tp_methods */ ! 0, /* tp_members */ ! date_getset, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! date_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; Index: obj_datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_datetime.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** obj_datetime.c 20 Aug 2002 18:53:07 -0000 1.1 --- obj_datetime.c 21 Nov 2002 18:02:01 -0000 1.2 *************** *** 7,20 **** normalize_pair(long int *parent, long int *child, int size) { ! if (*child < 0) { ! long int borrow = (*child / size) + 1; ! *parent -= borrow; ! *child += (borrow * size); ! } ! else if (*child >= size) { ! long int carry = *child / size; ! *parent += carry; ! *child -= (carry * size); ! } } --- 7,20 ---- normalize_pair(long int *parent, long int *child, int size) { ! if (*child < 0) { ! long int borrow = (*child / size) + 1; ! *parent -= borrow; ! *child += (borrow * size); ! } ! else if (*child >= size) { ! long int carry = *child / size; ! *parent += carry; ! *child -= (carry * size); ! } } *************** *** 24,33 **** long int *microsecond) { ! normalize_pair(second, microsecond, 1000000); ! normalize_pair(minute, second, 60); ! normalize_pair(hour, minute, 60); ! normalize_pair(day, hour, 24); ! return normalize_date(year, month, day); } --- 24,33 ---- long int *microsecond) { ! normalize_pair(second, microsecond, 1000000); ! normalize_pair(minute, second, 60); ! normalize_pair(hour, minute, 60); ! normalize_pair(day, hour, 24); ! return normalize_date(year, month, day); } *************** *** 35,52 **** add_datetime_timedelta(PyDateTime_DateTime *date, PyDateTime_Delta *delta) { ! long int year = GET_YEAR(date); ! long int month = GET_MONTH(date); ! long int day = GET_DAY(date) + GET_TD_DAYS(delta); ! long int hour = GET_HOUR(date); ! long int minute = GET_MINUTE(date); ! long int second = GET_SECOND(date) + GET_TD_SECONDS(delta); ! long int microsecond = GET_MICROSECOND(date) + GET_TD_MICROSECONDS(delta); ! if (normalize_datetime(&year, &month, &day, ! &hour, &minute, &second, µsecond)) ! return new_datetime(year, month, day, ! hour, minute, second, microsecond); ! else ! return NULL; } --- 35,52 ---- add_datetime_timedelta(PyDateTime_DateTime *date, PyDateTime_Delta *delta) { ! long int year = GET_YEAR(date); ! long int month = GET_MONTH(date); ! long int day = GET_DAY(date) + GET_TD_DAYS(delta); ! long int hour = GET_HOUR(date); ! long int minute = GET_MINUTE(date); ! long int second = GET_SECOND(date) + GET_TD_SECONDS(delta); ! long int microsecond = GET_MICROSECOND(date) + GET_TD_MICROSECONDS(delta); ! if (normalize_datetime(&year, &month, &day, ! &hour, &minute, &second, µsecond)) ! return new_datetime(year, month, day, ! hour, minute, second, microsecond); ! else ! return NULL; } *************** *** 54,73 **** datetime_add(PyObject *left, PyObject *right) { ! PyTypeObject *left_type = left->ob_type; ! PyTypeObject *right_type = right->ob_type; ! if (PyType_IsSubtype(left_type, &PyDateTime_DateTimeType)) { ! /* datetime + ??? */ ! if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) ! return add_datetime_timedelta((PyDateTime_DateTime *) left, ! (PyDateTime_Delta *) right); ! } ! else if (PyType_IsSubtype(left_type, &PyDateTime_DeltaType)) { ! /* delta + datetime */ ! return add_datetime_timedelta((PyDateTime_DateTime *) right, ! (PyDateTime_Delta *) left); ! } ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; } --- 54,73 ---- datetime_add(PyObject *left, PyObject *right) { ! PyTypeObject *left_type = left->ob_type; ! PyTypeObject *right_type = right->ob_type; ! if (PyType_IsSubtype(left_type, &PyDateTime_DateTimeType)) { ! /* datetime + ??? */ ! if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) ! return add_datetime_timedelta((PyDateTime_DateTime *) left, ! (PyDateTime_Delta *) right); ! } ! else if (PyType_IsSubtype(left_type, &PyDateTime_DeltaType)) { ! /* delta + datetime */ ! return add_datetime_timedelta((PyDateTime_DateTime *) right, ! (PyDateTime_Delta *) left); ! } ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; } *************** *** 75,85 **** datetime_compare(PyDateTime_DateTime *self, PyObject *other) { ! if (!PyType_IsSubtype(other->ob_type, &PyDateTime_DateTimeType)) { ! PyErr_SetString(PyExc_TypeError, ! "can't compare date to %s instance"); ! return -1; ! } ! return memcmp(self->data, ((PyDateTime_DateTime *)other)->data, ! _PyDateTime_DATETIME_DATA_SIZE); } --- 75,85 ---- datetime_compare(PyDateTime_DateTime *self, PyObject *other) { ! if (!PyType_IsSubtype(other->ob_type, &PyDateTime_DateTimeType)) { ! PyErr_SetString(PyExc_TypeError, ! "can't compare date to %s instance"); ! return -1; ! } ! return memcmp(self->data, ((PyDateTime_DateTime *)other)->data, ! _PyDateTime_DATETIME_DATA_SIZE); } *************** *** 87,92 **** datetime_ctime(PyDateTime_DateTime *self) { ! return format_ctime((PyDateTime_Date *)self, ! GET_HOUR(self), GET_MINUTE(self), GET_SECOND(self)); } --- 87,92 ---- datetime_ctime(PyDateTime_DateTime *self) { ! return format_ctime((PyDateTime_Date *)self, ! GET_HOUR(self), GET_MINUTE(self), GET_SECOND(self)); } *************** *** 94,126 **** datetime_hash(PyDateTime_DateTime *self) { ! if (self->hashcode == -1) { ! PyObject *temp; ! if (GET_MICROSECOND(self) != 0) ! temp = Py_BuildValue("lllllll", GET_YEAR(self), ! GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self), ! GET_SECOND(self), GET_MICROSECOND(self)); ! else if (GET_SECOND(self) != 0) ! temp = Py_BuildValue("llllll", GET_YEAR(self), ! GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self), ! GET_SECOND(self)); ! else if (GET_MINUTE(self) != 0) ! temp = Py_BuildValue("lllll", GET_YEAR(self), ! GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self)); ! else if (GET_HOUR(self) != 0) ! temp = Py_BuildValue("llll", GET_YEAR(self), ! GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self)); ! else ! temp = Py_BuildValue("lll", GET_YEAR(self), ! GET_MONTH(self), GET_DAY(self)); ! if (temp != NULL) { ! self->hashcode = PyObject_Hash(temp); ! Py_DECREF(temp); ! } ! } ! return self->hashcode; } --- 94,126 ---- datetime_hash(PyDateTime_DateTime *self) { ! if (self->hashcode == -1) { ! PyObject *temp; ! if (GET_MICROSECOND(self) != 0) ! temp = Py_BuildValue("lllllll", GET_YEAR(self), ! GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self), ! GET_SECOND(self), GET_MICROSECOND(self)); ! else if (GET_SECOND(self) != 0) ! temp = Py_BuildValue("llllll", GET_YEAR(self), ! GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self), ! GET_SECOND(self)); ! else if (GET_MINUTE(self) != 0) ! temp = Py_BuildValue("lllll", GET_YEAR(self), ! GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self)); ! else if (GET_HOUR(self) != 0) ! temp = Py_BuildValue("llll", GET_YEAR(self), ! GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self)); ! else ! temp = Py_BuildValue("lll", GET_YEAR(self), ! GET_MONTH(self), GET_DAY(self)); ! if (temp != NULL) { ! self->hashcode = PyObject_Hash(temp); ! Py_DECREF(temp); ! } ! } ! return self->hashcode; } *************** *** 128,173 **** datetime_new(PyTypeObject *type, PyObject *args, PyObject *kw) { ! PyObject *self = NULL; ! long int year, month, day, hour = 0, minute = 0, second = 0, usecond = 0; ! static char *keywords[] = { ! "year", "month", "day", "hour", "minute", "second", "microsecond", NULL ! }; ! if (PyArg_ParseTupleAndKeywords(args, kw, "lll|llll", keywords, ! &year, &month, &day, &hour, &minute, ! &second, &usecond)) { ! if (year < MINYEAR || year > MAXYEAR) { ! PyErr_SetString(PyExc_ValueError, "year is out of range"); ! return NULL; ! } ! if (month < 1 || month > 12) { ! PyErr_SetString(PyExc_ValueError, "month must be in 1..12"); ! return NULL; ! } ! if (day < 1 || day > days_in_month(year, month)) { ! PyErr_SetString(PyExc_ValueError, "day is out of range for month"); ! return NULL; ! } ! if (hour < 0 || hour > 23) { ! PyErr_SetString(PyExc_ValueError, "hour must be in 0..23"); ! return NULL; ! } ! if (minute < 0 || minute > 59) { ! PyErr_SetString(PyExc_ValueError, "minute must be in 0..59"); ! return NULL; ! } ! if (second < 0 || second > 59) { ! PyErr_SetString(PyExc_ValueError, "second must be in 0..59"); ! return NULL; ! } ! if (usecond < 0 || usecond > 999999) { ! PyErr_SetString(PyExc_ValueError, ! "microsecond must be in 0..999999"); ! return NULL; ! } ! self = new_datetime(year, month, day, hour, minute, second, usecond); ! } ! return self; } --- 128,173 ---- datetime_new(PyTypeObject *type, PyObject *args, PyObject *kw) { ! PyObject *self = NULL; ! long int year, month, day, hour = 0, minute = 0, second = 0, usecond = 0; ! static char *keywords[] = { ! "year", "month", "day", "hour", "minute", "second", "microsecond", NULL ! }; ! if (PyArg_ParseTupleAndKeywords(args, kw, "lll|llll", keywords, ! &year, &month, &day, &hour, &minute, ! &second, &usecond)) { ! if (year < MINYEAR || year > MAXYEAR) { ! PyErr_SetString(PyExc_ValueError, "year is out of range"); ! return NULL; ! } ! if (month < 1 || month > 12) { ! PyErr_SetString(PyExc_ValueError, "month must be in 1..12"); ! return NULL; ! } ! if (day < 1 || day > days_in_month(year, month)) { ! PyErr_SetString(PyExc_ValueError, "day is out of range for month"); ! return NULL; ! } ! if (hour < 0 || hour > 23) { ! PyErr_SetString(PyExc_ValueError, "hour must be in 0..23"); ! return NULL; ! } ! if (minute < 0 || minute > 59) { ! PyErr_SetString(PyExc_ValueError, "minute must be in 0..59"); ! return NULL; ! } ! if (second < 0 || second > 59) { ! PyErr_SetString(PyExc_ValueError, "second must be in 0..59"); ! return NULL; ! } ! if (usecond < 0 || usecond > 999999) { ! PyErr_SetString(PyExc_ValueError, ! "microsecond must be in 0..999999"); ! return NULL; ! } ! self = new_datetime(year, month, day, hour, minute, second, usecond); ! } ! return self; } *************** *** 175,202 **** datetime_repr(PyDateTime_DateTime *self) { ! char buffer[1028]; ! char *typename; ! typename = self->ob_type->tp_name; ! if (GET_MICROSECOND(self)) { ! PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d, %d, %d, %d, %d)", ! typename, ! GET_YEAR(self), GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self), GET_SECOND(self), ! GET_MICROSECOND(self)); ! } ! else if (GET_SECOND(self)) { ! PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d, %d, %d, %d)", ! typename, ! GET_YEAR(self), GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self), GET_SECOND(self)); ! } ! else { ! PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d, %d, %d)", ! typename, ! GET_YEAR(self), GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self)); ! } ! return PyString_FromString(buffer); } --- 175,202 ---- datetime_repr(PyDateTime_DateTime *self) { ! char buffer[1028]; ! char *typename; ! typename = self->ob_type->tp_name; ! if (GET_MICROSECOND(self)) { ! PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d, %d, %d, %d, %d)", ! typename, ! GET_YEAR(self), GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self), GET_SECOND(self), ! GET_MICROSECOND(self)); ! } ! else if (GET_SECOND(self)) { ! PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d, %d, %d, %d)", ! typename, ! GET_YEAR(self), GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self), GET_SECOND(self)); ! } ! else { ! PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d, %d, %d)", ! typename, ! GET_YEAR(self), GET_MONTH(self), GET_DAY(self), ! GET_HOUR(self), GET_MINUTE(self)); ! } ! return PyString_FromString(buffer); } *************** *** 204,215 **** datetime_str(PyDateTime_DateTime *self) { ! char buffer[128]; ! char *cp; ! cp = isoformat_date((PyDateTime_Date *)self, buffer, sizeof(buffer)); ! *cp++ = ' '; ! isoformat_time(self, cp, sizeof(buffer) - (cp - buffer)); ! return PyString_FromString(buffer); } --- 204,215 ---- datetime_str(PyDateTime_DateTime *self) { ! char buffer[128]; ! char *cp; ! cp = isoformat_date((PyDateTime_Date *)self, buffer, sizeof(buffer)); ! *cp++ = ' '; ! isoformat_time(self, cp, sizeof(buffer) - (cp - buffer)); ! return PyString_FromString(buffer); } *************** *** 217,222 **** datetime_subtract(PyObject *left, PyObject *right) { ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; } --- 217,222 ---- datetime_subtract(PyObject *left, PyObject *right) { ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; } *************** *** 225,229 **** datetime_hour(PyDateTime_DateTime *self, void *unused) { ! return (PyInt_FromLong(GET_HOUR(self))); } --- 225,229 ---- datetime_hour(PyDateTime_DateTime *self, void *unused) { ! return (PyInt_FromLong(GET_HOUR(self))); } *************** *** 231,235 **** datetime_minute(PyDateTime_DateTime *self, void *unused) { ! return (PyInt_FromLong(GET_MINUTE(self))); } --- 231,235 ---- datetime_minute(PyDateTime_DateTime *self, void *unused) { ! return (PyInt_FromLong(GET_MINUTE(self))); } *************** *** 237,241 **** datetime_second(PyDateTime_DateTime *self, void *unused) { ! return (PyInt_FromLong(GET_SECOND(self))); } --- 237,241 ---- datetime_second(PyDateTime_DateTime *self, void *unused) { ! return (PyInt_FromLong(GET_SECOND(self))); } *************** *** 243,255 **** datetime_microsecond(PyDateTime_DateTime *self, void *unused) { ! return (PyInt_FromLong(GET_MICROSECOND(self))); } static PyGetSetDef datetime_getset[] = { ! {"hour", (getter)datetime_hour}, ! {"minute", (getter)datetime_minute}, ! {"second", (getter)datetime_second}, ! {"microsecond", (getter)datetime_microsecond}, ! {NULL} }; --- 243,255 ---- datetime_microsecond(PyDateTime_DateTime *self, void *unused) { ! return (PyInt_FromLong(GET_MICROSECOND(self))); } static PyGetSetDef datetime_getset[] = { ! {"hour", (getter)datetime_hour}, ! {"minute", (getter)datetime_minute}, ! {"second", (getter)datetime_second}, ! {"microsecond", (getter)datetime_microsecond}, ! {NULL} }; *************** *** 258,276 **** PyObject *args, PyObject *kw) { ! char buffer[128]; ! char sep = 'T'; ! char *cp; ! static char *keywords[] = {"sep", NULL}; ! if (!PyArg_ParseTupleAndKeywords(args, kw, "|c:isoformat", keywords, &sep)) ! return NULL; ! cp = isoformat_date((PyDateTime_Date *)self, buffer, sizeof(buffer)); ! assert(cp != NULL); ! *cp++ = sep; ! isoformat_time(self, cp, sizeof(buffer) - (cp - buffer)); ! return PyString_FromString(buffer); } --- 258,276 ---- PyObject *args, PyObject *kw) { ! char buffer[128]; ! char sep = 'T'; ! char *cp; ! static char *keywords[] = {"sep", NULL}; ! if (!PyArg_ParseTupleAndKeywords(args, kw, "|c:isoformat", keywords, &sep)) ! return NULL; ! cp = isoformat_date((PyDateTime_Date *)self, buffer, sizeof(buffer)); ! assert(cp != NULL); ! *cp++ = sep; ! isoformat_time(self, cp, sizeof(buffer) - (cp - buffer)); ! return PyString_FromString(buffer); } *************** *** 278,286 **** datetime_nonzero(PyDateTime_DateTime *self) { ! return (GET_MICROSECOND(self) != 0 ! || GET_SECOND(self) != 0 ! || GET_MINUTE(self) != 0 ! || GET_HOUR(self) != 0 ! || date_nonzero((PyDateTime_Date *) self) != 0); } --- 278,286 ---- datetime_nonzero(PyDateTime_DateTime *self) { ! return (GET_MICROSECOND(self) != 0 ! || GET_SECOND(self) != 0 ! || GET_MINUTE(self) != 0 ! || GET_HOUR(self) != 0 ! || date_nonzero((PyDateTime_Date *) self) != 0); } *************** *** 288,308 **** datetime_now(PyObject *self, PyObject *cls) { ! /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ ! struct timeval t; ! struct tm *tm; ! time_t timet; #ifdef GETTIMEOFDAY_NO_TZ ! gettimeofday(&t); #else /* !GETTIMEOFDAY_NO_TZ */ ! gettimeofday(&t, (struct timezone *)NULL); #endif /* !GETTIMEOFDAY_NO_TZ */ ! timet = t.tv_sec; ! tm = localtime(&timet); ! return PyObject_CallFunction(cls, "iiiiiil", ! tm->tm_year + 1900, tm->tm_mon + 1, ! tm->tm_mday, tm->tm_hour, tm->tm_min, ! tm->tm_sec, t.tv_usec); } --- 288,308 ---- datetime_now(PyObject *self, PyObject *cls) { ! /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ ! struct timeval t; ! struct tm *tm; ! time_t timet; #ifdef GETTIMEOFDAY_NO_TZ ! gettimeofday(&t); #else /* !GETTIMEOFDAY_NO_TZ */ ! gettimeofday(&t, (struct timezone *)NULL); #endif /* !GETTIMEOFDAY_NO_TZ */ ! timet = t.tv_sec; ! tm = localtime(&timet); ! return PyObject_CallFunction(cls, "iiiiiil", ! tm->tm_year + 1900, tm->tm_mon + 1, ! tm->tm_mday, tm->tm_hour, tm->tm_min, ! tm->tm_sec, t.tv_usec); } *************** *** 310,345 **** datetime_today(PyObject *self, PyObject *cls) { ! /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ ! struct timeval t; ! struct tm *tm; ! time_t timet; #ifdef GETTIMEOFDAY_NO_TZ ! gettimeofday(&t); #else /* !GETTIMEOFDAY_NO_TZ */ ! gettimeofday(&t, (struct timezone *)NULL); #endif /* !GETTIMEOFDAY_NO_TZ */ ! timet = t.tv_sec; ! tm = localtime(&timet); ! return PyObject_CallFunction(cls, "iiiiiil", ! tm->tm_year + 1900, tm->tm_mon + 1, ! tm->tm_mday, 0, 0, 0, 0); } static PyMethodDef datetime_methods[] = { ! /* Class methods: */ ! {"now", (PyCFunction)datetime_now, METH_O | METH_CLASS, ! "Return a new datetime that represents the current time."}, ! {"today", (PyCFunction)datetime_today, METH_O | METH_CLASS, ! "Return a new datetime that represents the current date."}, ! /* Instance methods: */ ! {"ctime", (PyCFunction)datetime_ctime, METH_NOARGS, ! "Return ctime() style string."}, ! {"isoformat", (PyCFunction)datetime_isoformat, METH_KEYWORDS, ! "Return the day of the week represented by the datetime.\n" ! "Monday == 1 ... Sunday == 7"}, ! {NULL} }; --- 310,345 ---- datetime_today(PyObject *self, PyObject *cls) { ! /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ ! struct timeval t; ! struct tm *tm; ! time_t timet; #ifdef GETTIMEOFDAY_NO_TZ ! gettimeofday(&t); #else /* !GETTIMEOFDAY_NO_TZ */ ! gettimeofday(&t, (struct timezone *)NULL); #endif /* !GETTIMEOFDAY_NO_TZ */ ! timet = t.tv_sec; ! tm = localtime(&timet); ! return PyObject_CallFunction(cls, "iiiiiil", ! tm->tm_year + 1900, tm->tm_mon + 1, ! tm->tm_mday, 0, 0, 0, 0); } static PyMethodDef datetime_methods[] = { ! /* Class methods: */ ! {"now", (PyCFunction)datetime_now, METH_O | METH_CLASS, ! "Return a new datetime that represents the current time."}, ! {"today", (PyCFunction)datetime_today, METH_O | METH_CLASS, ! "Return a new datetime that represents the current date."}, ! /* Instance methods: */ ! {"ctime", (PyCFunction)datetime_ctime, METH_NOARGS, ! "Return ctime() style string."}, ! {"isoformat", (PyCFunction)datetime_isoformat, METH_KEYWORDS, ! "Return the day of the week represented by the datetime.\n" ! "Monday == 1 ... Sunday == 7"}, ! {NULL} }; *************** *** 348,405 **** static PyNumberMethods datetime_as_number = { ! datetime_add, /* nb_add */ ! datetime_subtract, /* nb_subtract */ ! 0, /* nb_multiply */ ! 0, /* nb_divide */ ! 0, /* nb_remainder */ ! 0, /* nb_divmod */ ! 0, /* nb_power */ ! 0, /* nb_negative */ ! 0, /* nb_positive */ ! 0, /* nb_absolute */ ! (inquiry)datetime_nonzero, /* nb_nonzero */ }; statichere PyTypeObject PyDateTime_DateTimeType = { ! PyObject_HEAD_INIT(NULL) ! 0, /* ob_size */ ! "datetime", /* tp_name */ ! sizeof(PyDateTime_DateTime), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! (destructor)PyObject_Del, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)datetime_compare, /* tp_compare */ ! (reprfunc)datetime_repr, /* tp_repr */ ! &datetime_as_number, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! (hashfunc)datetime_hash, /* tp_hash */ ! 0, /* tp_call */ ! (reprfunc)datetime_str, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE, /* tp_flags */ ! datetime_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! datetime_methods, /* tp_methods */ ! 0, /* tp_members */ ! datetime_getset, /* tp_getset */ ! &PyDateTime_DateType, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! datetime_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 348,405 ---- static PyNumberMethods datetime_as_number = { ! datetime_add, /* nb_add */ ! datetime_subtract, /* nb_subtract */ ! 0, /* nb_multiply */ ! 0, /* nb_divide */ ! 0, /* nb_remainder */ ! 0, /* nb_divmod */ ! 0, /* nb_power */ ! 0, /* nb_negative */ ! 0, /* nb_positive */ ! 0, /* nb_absolute */ ! (inquiry)datetime_nonzero, /* nb_nonzero */ }; statichere PyTypeObject PyDateTime_DateTimeType = { ! PyObject_HEAD_INIT(NULL) ! 0, /* ob_size */ ! "datetime", /* tp_name */ ! sizeof(PyDateTime_DateTime), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! (destructor)PyObject_Del, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)datetime_compare, /* tp_compare */ ! (reprfunc)datetime_repr, /* tp_repr */ ! &datetime_as_number, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! (hashfunc)datetime_hash, /* tp_hash */ ! 0, /* tp_call */ ! (reprfunc)datetime_str, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE, /* tp_flags */ ! datetime_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! datetime_methods, /* tp_methods */ ! 0, /* tp_members */ ! datetime_getset, /* tp_getset */ ! &PyDateTime_DateType, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! datetime_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; Index: obj_delta.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_delta.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** obj_delta.c 20 Aug 2002 18:53:07 -0000 1.1 --- obj_delta.c 21 Nov 2002 18:02:01 -0000 1.2 *************** *** 8,39 **** delta_add(PyObject *left, PyObject *right) { ! PyTypeObject *left_type = left->ob_type; ! PyTypeObject *right_type = right->ob_type; ! PyDateTime_Delta *delta; ! PyObject *other; ! PyTypeObject *other_type; ! if (PyType_IsSubtype(left_type, &PyDateTime_DeltaType)) { ! /* delta + ??? */ ! delta = (PyDateTime_Delta *) left; ! if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) { ! /* delta + delta */ ! long int days = GET_TD_DAYS(delta) + GET_TD_DAYS(right); ! long int seconds = GET_TD_SECONDS(delta) + GET_TD_SECONDS(right); ! long int microseconds = (GET_TD_MICROSECONDS(delta) ! + GET_TD_MICROSECONDS(right)); ! return new_delta(days, seconds, microseconds); ! } ! other = right; ! other_type = right_type; ! } ! else { ! /* !delta + delta */ ! delta = (PyDateTime_Delta *) right; ! other = left; ! other_type = left_type; ! } ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; } --- 8,39 ---- delta_add(PyObject *left, PyObject *right) { ! PyTypeObject *left_type = left->ob_type; ! PyTypeObject *right_type = right->ob_type; ! PyDateTime_Delta *delta; ! PyObject *other; ! PyTypeObject *other_type; ! if (PyType_IsSubtype(left_type, &PyDateTime_DeltaType)) { ! /* delta + ??? */ ! delta = (PyDateTime_Delta *) left; ! if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) { ! /* delta + delta */ ! long int days = GET_TD_DAYS(delta) + GET_TD_DAYS(right); ! long int seconds = GET_TD_SECONDS(delta) + GET_TD_SECONDS(right); ! long int microseconds = (GET_TD_MICROSECONDS(delta) ! + GET_TD_MICROSECONDS(right)); ! return new_delta(days, seconds, microseconds); ! } ! other = right; ! other_type = right_type; ! } ! else { ! /* !delta + delta */ ! delta = (PyDateTime_Delta *) right; ! other = left; ! other_type = left_type; ! } ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; } *************** *** 41,62 **** delta_compare(PyDateTime_Delta *self, PyObject *other) { ! int result = -1; ! if (!PyObject_TypeCheck(other, &PyDateTime_DeltaType)) ! PyErr_Format(PyExc_TypeError, ! "can't compare %s to %s instance", ! self->ob_type->tp_name, other->ob_type->tp_name); ! else { ! long diff = GET_TD_DAYS(self) - GET_TD_DAYS(other); ! if (diff == 0) { ! diff = GET_TD_SECONDS(self) - GET_TD_SECONDS(other); ! if (diff == 0) ! diff = GET_TD_MICROSECONDS(self) - GET_TD_MICROSECONDS(other); ! } ! if (diff == 0) ! result = 0; ! else if (diff > 0) ! result = 1; ! } ! return result; } --- 41,62 ---- delta_compare(PyDateTime_Delta *self, PyObject *other) { ! int result = -1; ! if (!PyObject_TypeCheck(other, &PyDateTime_DeltaType)) ! PyErr_Format(PyExc_TypeError, ! "can't compare %s to %s instance", ! self->ob_type->tp_name, other->ob_type->tp_name); ! else { ! long diff = GET_TD_DAYS(self) - GET_TD_DAYS(other); ! if (diff == 0) { ! diff = GET_TD_SECONDS(self) - GET_TD_SECONDS(other); ! if (diff == 0) ! diff = GET_TD_MICROSECONDS(self) - GET_TD_MICROSECONDS(other); ! } ! if (diff == 0) ! result = 0; ! else if (diff > 0) ! result = 1; ! } ! return result; } *************** *** 64,68 **** delta_hash(PyDateTime_Delta *self) { ! return -2; } --- 64,68 ---- delta_hash(PyDateTime_Delta *self) { ! return -2; } *************** *** 70,77 **** multiply_int_timedelta(PyObject *intobj, PyDateTime_Delta *delta) { ! long i = PyInt_AS_LONG(intobj); ! return new_delta(GET_TD_DAYS(delta) * i, ! GET_TD_SECONDS(delta) * i, ! GET_TD_MICROSECONDS(delta) * i); } --- 70,77 ---- multiply_int_timedelta(PyObject *intobj, PyDateTime_Delta *delta) { ! long i = PyInt_AS_LONG(intobj); ! return new_delta(GET_TD_DAYS(delta) * i, ! GET_TD_SECONDS(delta) * i, ! GET_TD_MICROSECONDS(delta) * i); } *************** *** 79,100 **** delta_multiply(PyObject *left, PyObject *right) { ! PyObject *result = NULL; ! if (PyType_IsSubtype(left->ob_type, &PyDateTime_DeltaType)) { ! /* delta * ??? */ ! if (PyInt_Check(right)) ! result = multiply_int_timedelta(right, (PyDateTime_Delta *) left); ! else { ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; ! } ! } ! else if (PyInt_Check(left)) ! result = multiply_int_timedelta(left, (PyDateTime_Delta *) right); ! else { ! /* !(delta | int) * delta */ ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; ! } ! return result; } --- 79,100 ---- delta_multiply(PyObject *left, PyObject *right) { ! PyObject *result = NULL; ! if (PyType_IsSubtype(left->ob_type, &PyDateTime_DeltaType)) { ! /* delta * ??? */ ! if (PyInt_Check(right)) ! result = multiply_int_timedelta(right, (PyDateTime_Delta *) left); ! else { ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; ! } ! } ! else if (PyInt_Check(left)) ! result = multiply_int_timedelta(left, (PyDateTime_Delta *) right); ! else { ! /* !(delta | int) * delta */ ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; ! } ! return result; } *************** *** 102,108 **** delta_negative(PyDateTime_Delta *self) { ! return new_delta(-GET_TD_DAYS(self), ! -GET_TD_SECONDS(self), ! -GET_TD_MICROSECONDS(self)); } --- 102,108 ---- delta_negative(PyDateTime_Delta *self) { ! return new_delta(-GET_TD_DAYS(self), ! -GET_TD_SECONDS(self), ! -GET_TD_MICROSECONDS(self)); } *************** *** 110,135 **** delta_new(PyTypeObject *type, PyObject *args, PyObject *kw) { ! PyObject *self = NULL; ! long int days, seconds = 0, microseconds = 0; ! static char *keywords[] = { ! "days", "seconds", "microseconds", NULL ! }; ! if (PyArg_ParseTupleAndKeywords(args, kw, "l|ll:__new__", keywords, ! &days, &seconds, µseconds)) { ! if (seconds < 0 || seconds >= (24 * 3600)) { ! PyErr_SetString(PyExc_ValueError, ! "seconds must be in 0..86399"); ! return NULL; ! } ! if (microseconds < 0 || microseconds >= 1000000) { ! PyErr_SetString(PyExc_ValueError, ! "microseconds must be in 0..999999"); ! return NULL; ! } ! self = new_delta(days, seconds, microseconds); ! } ! return self; } --- 110,135 ---- delta_new(PyTypeObject *type, PyObject *args, PyObject *kw) { ! PyObject *self = NULL; ! long int days, seconds = 0, microseconds = 0; ! static char *keywords[] = { ! "days", "seconds", "microseconds", NULL ! }; ! if (PyArg_ParseTupleAndKeywords(args, kw, "l|ll:__new__", keywords, ! &days, &seconds, µseconds)) { ! if (seconds < 0 || seconds >= (24 * 3600)) { ! PyErr_SetString(PyExc_ValueError, ! "seconds must be in 0..86399"); ! return NULL; ! } ! if (microseconds < 0 || microseconds >= 1000000) { ! PyErr_SetString(PyExc_ValueError, ! "microseconds must be in 0..999999"); ! return NULL; ! } ! self = new_delta(days, seconds, microseconds); ! } ! return self; } *************** *** 137,142 **** delta_subtract(PyObject *left, PyObject *right) { ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; } --- 137,142 ---- delta_subtract(PyObject *left, PyObject *right) { ! Py_INCREF(Py_NotImplemented); ! return Py_NotImplemented; } *************** *** 144,150 **** delta_nonzero(PyDateTime_Delta *self) { ! return (GET_TD_DAYS(self) != 0 ! || GET_TD_SECONDS(self) != 0 ! || GET_TD_MICROSECONDS(self) != 0); } --- 144,150 ---- delta_nonzero(PyDateTime_Delta *self) { ! return (GET_TD_DAYS(self) != 0 ! || GET_TD_SECONDS(self) != 0 ! || GET_TD_MICROSECONDS(self) != 0); } *************** *** 152,170 **** delta_repr(PyDateTime_Delta *self) { ! if (GET_TD_MICROSECONDS(self) != 0) ! return PyString_FromFormat("%s(%ld, %ld, %ld)", ! self->ob_type->tp_name, ! GET_TD_DAYS(self), ! GET_TD_SECONDS(self), ! GET_TD_MICROSECONDS(self)); ! if (GET_TD_SECONDS(self) != 0) ! return PyString_FromFormat("%s(%ld, %ld)", ! self->ob_type->tp_name, ! GET_TD_DAYS(self), ! GET_TD_SECONDS(self)); ! return PyString_FromFormat("%s(%ld)", ! self->ob_type->tp_name, ! GET_TD_DAYS(self)); } --- 152,170 ---- delta_repr(PyDateTime_Delta *self) { ! if (GET_TD_MICROSECONDS(self) != 0) ! return PyString_FromFormat("%s(%ld, %ld, %ld)", ! self->ob_type->tp_name, ! GET_TD_DAYS(self), ! GET_TD_SECONDS(self), ! GET_TD_MICROSECONDS(self)); ! if (GET_TD_SECONDS(self) != 0) ! return PyString_FromFormat("%s(%ld, %ld)", ! self->ob_type->tp_name, ! GET_TD_DAYS(self), ! GET_TD_SECONDS(self)); ! return PyString_FromFormat("%s(%ld)", ! self->ob_type->tp_name, ! GET_TD_DAYS(self)); } *************** *** 172,182 **** static PyMemberDef delta_members[] = { ! {"days", T_LONG, OFFSET(days), READONLY, ! "Number os days."}, ! {"seconds", T_LONG, OFFSET(seconds), READONLY, ! "Number of seconds (less than 1 day)."}, ! {"microseconds", T_LONG, OFFSET(microseconds), READONLY, ! "Number of microseconds (less than 1 second)."}, ! {NULL} }; --- 172,182 ---- static PyMemberDef delta_members[] = { ! {"days", T_LONG, OFFSET(days), READONLY, ! "Number os days."}, ! {"seconds", T_LONG, OFFSET(seconds), READONLY, ! "Number of seconds (less than 1 day)."}, ! {"microseconds", T_LONG, OFFSET(microseconds), READONLY, ! "Number of microseconds (less than 1 second)."}, ! {NULL} }; *************** *** 185,241 **** static PyNumberMethods delta_as_number = { ! delta_add, /* nb_add */ ! delta_subtract, /* nb_subtract */ ! delta_multiply, /* nb_multiply */ ! 0, /* nb_divide */ ! 0, /* nb_remainder */ ! 0, /* nb_divmod */ ! 0, /* nb_power */ ! (unaryfunc)delta_negative, /* nb_negative */ ! 0, /* nb_positive */ ! 0, /* nb_absolute */ ! (inquiry)delta_nonzero, /* nb_nonzero */ }; static PyTypeObject PyDateTime_DeltaType = { ! PyObject_HEAD_INIT(NULL) ! 0, /* ob_size */ ! "timedelta", /* tp_name */ ! sizeof(PyDateTime_Delta), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! 0, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)delta_compare, /* tp_compare */ ! (reprfunc)delta_repr, /* tp_repr */ ! &delta_as_number, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! (hashfunc)delta_hash, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */ ! delta_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! 0, /* tp_methods */ ! delta_members, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! delta_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 185,241 ---- static PyNumberMethods delta_as_number = { ! delta_add, /* nb_add */ ! delta_subtract, /* nb_subtract */ ! delta_multiply, /* nb_multiply */ ! 0, /* nb_divide */ ! 0, /* nb_remainder */ ! 0, /* nb_divmod */ ! 0, /* nb_power */ ! (unaryfunc)delta_negative, /* nb_negative */ ! 0, /* nb_positive */ ! 0, /* nb_absolute */ ! (inquiry)delta_nonzero, /* nb_nonzero */ }; static PyTypeObject PyDateTime_DeltaType = { ! PyObject_HEAD_INIT(NULL) ! 0, /* ob_size */ ! "timedelta", /* tp_name */ ! sizeof(PyDateTime_Delta), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! 0, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)delta_compare, /* tp_compare */ ! (reprfunc)delta_repr, /* tp_repr */ ! &delta_as_number, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! (hashfunc)delta_hash, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */ ! delta_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! 0, /* tp_methods */ ! delta_members, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! delta_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; From akuchling@users.sourceforge.net Thu Nov 21 18:33:31 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 21 Nov 2002 10:33:31 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils archive_util.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv22305 Modified Files: archive_util.py Log Message: Bug #639118 from Ollie Oldham: archiver should use zipfile before zip Previously archive_util.py attempted to spawn an external 'zip' program for the zip action, if this fails, an attempt to import zipfile.py is made... This bites folks who have 'old' or non-conforming zip programs on windows platforms. This change tries the 'zipfile' module first, falling back to spawning a zip process if the module isn't available. Index: archive_util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/archive_util.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** archive_util.py 19 Nov 2002 13:12:26 -0000 1.14 --- archive_util.py 21 Nov 2002 18:33:28 -0000 1.15 *************** *** 60,98 **** def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): """Create a zip file from all the files under 'base_dir'. The output ! zip file will be named 'base_dir' + ".zip". Uses either the InfoZIP ! "zip" utility (if installed and found on the default search path) or ! the "zipfile" Python module (if available). If neither tool is ! available, raises DistutilsExecError. Returns the name of the output ! zip file. """ ! # This initially assumed the Unix 'zip' utility -- but ! # apparently InfoZIP's zip.exe works the same under Windows, so ! # no changes needed! ! zip_filename = base_name + ".zip" mkpath(os.path.dirname(zip_filename), dry_run=dry_run) - try: - spawn(["zip", "-rq", zip_filename, base_dir], - dry_run=dry_run) - except DistutilsExecError: ! # XXX really should distinguish between "couldn't find ! # external 'zip' command" and "zip failed" -- shouldn't try ! # again in the latter case. (I think fixing this will ! # require some cooperation from the spawn module -- perhaps ! # a utility function to search the path, so we can fallback ! # on zipfile.py without the failed spawn.) try: ! import zipfile ! except ImportError: raise DistutilsExecError, \ ! ("unable to create zip file '%s': " + ! "could neither find a standalone zip utility nor " + ! "import the 'zipfile' module") % zip_filename ! ! log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) ! def visit (z, dirname, names): for name in names: --- 60,99 ---- def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): """Create a zip file from all the files under 'base_dir'. The output ! zip file will be named 'base_dir' + ".zip". Uses either the "zipfile" ! Python module (if available) or the InfoZIP "zip" utility (if installed ! and found on the default search path). If neither tool is available, ! raises DistutilsExecError. Returns the name of the output zip file. """ ! try: ! import zipfile ! except ImportError: ! zipfile = None ! zip_filename = base_name + ".zip" mkpath(os.path.dirname(zip_filename), dry_run=dry_run) ! # If zipfile module is not available, try spawning an external ! # 'zip' command. ! if zipfile is None: ! if verbose: ! zipoptions = "-r" ! else: ! zipoptions = "-rq" ! try: ! spawn(["zip", zipoptions, zip_filename, base_dir], ! dry_run=dry_run) ! except DistutilsExecError: ! # XXX really should distinguish between "couldn't find ! # external 'zip' command" and "zip failed". raise DistutilsExecError, \ ! ("unable to create zip file '%s': " ! "could neither import the 'zipfile' module nor " ! "find a standalone zip utility") % zip_filename ! else: ! log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) ! def visit (z, dirname, names): for name in names: *************** *** 100,103 **** --- 101,105 ---- if os.path.isfile(path): z.write(path, path) + log.info("adding '%s'" % path) if not dry_run: From akuchling@users.sourceforge.net Thu Nov 21 19:01:23 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 21 Nov 2002 11:01:23 -0800 Subject: [Python-checkins] distutils TODO,1.14,1.15 Message-ID: Update of /cvsroot/python/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv2105 Modified Files: TODO Log Message: Remove item Index: TODO =================================================================== RCS file: /cvsroot/python/distutils/TODO,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TODO 19 Nov 2002 19:43:39 -0000 1.14 --- TODO 21 Nov 2002 19:01:19 -0000 1.15 *************** *** 10,14 **** * Bugs to fix: #410541 : bdist builds bogus .zips - #639118 : archiver should use zipfile before zip * add Richard Jones' register command. --- 10,13 ---- From tim_one@users.sourceforge.net Thu Nov 21 19:24:55 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 11:24:55 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.13,1.14 datetime.h,1.6,1.7 obj_date.c,1.2,1.3 obj_datetime.c,1.2,1.3 obj_delta.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv10921 Modified Files: datetime.c datetime.h obj_date.c obj_datetime.c obj_delta.c Log Message: Wrapped long lines. This doesn't compile on Windows, but it didn't before either, and it doesn't look like it's any worse than it was. Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** datetime.c 21 Nov 2002 17:59:28 -0000 1.13 --- datetime.c 21 Nov 2002 19:24:52 -0000 1.14 *************** *** 341,348 **** PyModule_AddIntConstant(m, "MAXYEAR", MAXYEAR); Py_INCREF(&PyDateTime_DateType); ! PyModule_AddObject(m, "date", (PyObject *) &PyDateTime_DateType); Py_INCREF(&PyDateTime_DateTimeType); ! PyModule_AddObject(m, "datetime", (PyObject *) &PyDateTime_DateTimeType); Py_INCREF(&PyDateTime_DeltaType); ! PyModule_AddObject(m, "timedelta", (PyObject *) &PyDateTime_DeltaType); } --- 341,351 ---- PyModule_AddIntConstant(m, "MAXYEAR", MAXYEAR); Py_INCREF(&PyDateTime_DateType); ! PyModule_AddObject(m, "date", ! (PyObject *) &PyDateTime_DateType); Py_INCREF(&PyDateTime_DateTimeType); ! PyModule_AddObject(m, "datetime", ! (PyObject *) &PyDateTime_DateTimeType); Py_INCREF(&PyDateTime_DeltaType); ! PyModule_AddObject(m, "timedelta", ! (PyObject *) &PyDateTime_DeltaType); } Index: datetime.h =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** datetime.h 21 Nov 2002 18:02:00 -0000 1.6 --- datetime.h 21 Nov 2002 19:24:53 -0000 1.7 *************** *** 36,42 **** #define PyDateTime_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5]) #define PyDateTime_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6]) ! #define PyDateTime_GET_MICROSECOND(o) (((PyDateTime_DateTime*)o)->data[7] << 16 \ ! | ((PyDateTime_DateTime*)o)->data[8] << 8\ ! | ((PyDateTime_DateTime*)o)->data[9]) #endif --- 36,43 ---- #define PyDateTime_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5]) #define PyDateTime_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6]) ! #define PyDateTime_GET_MICROSECOND(o) \ ! ((((PyDateTime_DateTime*)o)->data[7] << 16) | \ ! (((PyDateTime_DateTime*)o)->data[8] << 8) | \ ! ((PyDateTime_DateTime*)o)->data[9]) #endif Index: obj_date.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_date.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** obj_date.c 21 Nov 2002 18:02:01 -0000 1.2 --- obj_date.c 21 Nov 2002 19:24:53 -0000 1.3 *************** *** 54,58 **** } else { ! long int ordinal = ymd_to_ord(*year, *month, 1) + *day - 1; ord_to_ymd(ordinal, year, month, day); } --- 54,59 ---- } else { ! long int ordinal = ymd_to_ord(*year, *month, 1) + ! *day - 1; ord_to_ymd(ordinal, year, month, day); } *************** *** 61,65 **** assert(*day > 0); if (*year < MINYEAR) { ! PyErr_SetString(PyExc_OverflowError, "date value out of range"); return 0; } --- 62,67 ---- assert(*day > 0); if (*year < MINYEAR) { ! PyErr_SetString(PyExc_OverflowError, ! "date value out of range"); return 0; } *************** *** 127,131 **** } else { ! /* 'right' must be one of us, or we wouldn't have been called */ if (PyType_IsSubtype(left_type, &PyDateTime_DeltaType)) return add_date_timedelta((PyDateTime_Date *) right, --- 129,134 ---- } else { ! /* 'right' must be one of us, or we wouldn't have ! been called */ if (PyType_IsSubtype(left_type, &PyDateTime_DeltaType)) return add_date_timedelta((PyDateTime_Date *) right, *************** *** 182,194 **** &year, &month, &day)) { if (year < MINYEAR || year > MAXYEAR) { ! PyErr_SetString(PyExc_ValueError, "year is out of range"); return NULL; } if (month < 1 || month > 12) { ! PyErr_SetString(PyExc_ValueError, "month must be in 1..12"); return NULL; } if (day < 1 || day > days_in_month(year, month)) { ! PyErr_SetString(PyExc_ValueError, "day is out of range for month"); return NULL; } --- 185,200 ---- &year, &month, &day)) { if (year < MINYEAR || year > MAXYEAR) { ! PyErr_SetString(PyExc_ValueError, ! "year is out of range"); return NULL; } if (month < 1 || month > 12) { ! PyErr_SetString(PyExc_ValueError, ! "month must be in 1..12"); return NULL; } if (day < 1 || day > days_in_month(year, month)) { ! PyErr_SetString(PyExc_ValueError, ! "day is out of range for month"); return NULL; } *************** *** 310,316 **** if (PyType_IsSubtype(right_type, &PyDateTime_DateType)) { /* date - date */ ! long int left_ord = ymd_to_ord(GET_YEAR(left), GET_MONTH(left), GET_DAY(left)); ! long int right_ord = ymd_to_ord(GET_YEAR(right), GET_MONTH(right), GET_DAY(right)); return new_delta(left_ord - right_ord, 0, 0); --- 316,324 ---- if (PyType_IsSubtype(right_type, &PyDateTime_DateType)) { /* date - date */ ! long int left_ord = ymd_to_ord(GET_YEAR(left), ! GET_MONTH(left), GET_DAY(left)); ! long int right_ord = ymd_to_ord(GET_YEAR(right), ! GET_MONTH(right), GET_DAY(right)); return new_delta(left_ord - right_ord, 0, 0); *************** *** 321,326 **** || GET_TD_MICROSECONDS(right) != 0) { /* need to convert to datetime + delta */ ! PyObject *dt = new_datetime(GET_YEAR(left), GET_MONTH(left), ! GET_DAY(left), 0, 0, 0, 0); if (dt != NULL) { result = datetime_subtract(dt, right); --- 329,336 ---- || GET_TD_MICROSECONDS(right) != 0) { /* need to convert to datetime + delta */ ! PyObject *dt = new_datetime(GET_YEAR(left), ! GET_MONTH(left), ! GET_DAY(left), ! 0, 0, 0, 0); if (dt != NULL) { result = datetime_subtract(dt, right); *************** *** 335,344 **** else { long int year, month, day; ! long int ord = ymd_to_ord(GET_YEAR(left), GET_MONTH(left), GET_DAY(left)); ord -= GET_TD_DAYS(right); if (ord < 1) PyErr_SetString(PyExc_OverflowError, ! "resulting value out of range"); else { ord_to_ymd(ord, &year, &month, &day); --- 345,356 ---- else { long int year, month, day; ! long int ord = ymd_to_ord(GET_YEAR(left), ! GET_MONTH(left), GET_DAY(left)); ord -= GET_TD_DAYS(right); if (ord < 1) PyErr_SetString(PyExc_OverflowError, ! "resulting value " ! "out of range"); else { ord_to_ymd(ord, &year, &month, &day); *************** *** 421,425 **** static PyNumberMethods date_as_number = { date_add, /* nb_add */ ! date_subtract, /* nb_subtract */ 0, /* nb_multiply */ 0, /* nb_divide */ --- 433,437 ---- static PyNumberMethods date_as_number = { date_add, /* nb_add */ ! date_subtract, /* nb_subtract */ 0, /* nb_multiply */ 0, /* nb_divide */ *************** *** 430,434 **** 0, /* nb_positive */ 0, /* nb_absolute */ ! (inquiry)date_nonzero, /* nb_nonzero */ }; --- 442,446 ---- 0, /* nb_positive */ 0, /* nb_absolute */ ! (inquiry)date_nonzero, /* nb_nonzero */ }; *************** *** 436,440 **** PyObject_HEAD_INIT(NULL) 0, /* ob_size */ ! "date", /* tp_name */ sizeof(PyDateTime_Date), /* tp_basicsize */ 0, /* tp_itemsize */ --- 448,452 ---- PyObject_HEAD_INIT(NULL) 0, /* ob_size */ ! "date", /* tp_name */ sizeof(PyDateTime_Date), /* tp_basicsize */ 0, /* tp_itemsize */ *************** *** 443,452 **** 0, /* tp_getattr */ 0, /* tp_setattr */ ! (cmpfunc)date_compare, /* tp_compare */ ! (reprfunc)date_repr, /* tp_repr */ &date_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ ! (hashfunc)date_hash, /* tp_hash */ 0, /* tp_call */ (reprfunc)date_str, /* tp_str */ --- 455,464 ---- 0, /* tp_getattr */ 0, /* tp_setattr */ ! (cmpfunc)date_compare, /* tp_compare */ ! (reprfunc)date_repr, /* tp_repr */ &date_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ ! (hashfunc)date_hash, /* tp_hash */ 0, /* tp_call */ (reprfunc)date_str, /* tp_str */ *************** *** 455,459 **** 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | ! Py_TPFLAGS_BASETYPE, /* tp_flags */ date_doc, /* tp_doc */ 0, /* tp_traverse */ --- 467,471 ---- 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | ! Py_TPFLAGS_BASETYPE, /* tp_flags */ date_doc, /* tp_doc */ 0, /* tp_traverse */ *************** *** 463,469 **** 0, /* tp_iter */ 0, /* tp_iternext */ ! date_methods, /* tp_methods */ 0, /* tp_members */ ! date_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ --- 475,481 ---- 0, /* tp_iter */ 0, /* tp_iternext */ ! date_methods, /* tp_methods */ 0, /* tp_members */ ! date_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ *************** *** 474,477 **** 0, /* tp_alloc */ date_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 486,489 ---- 0, /* tp_alloc */ date_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; Index: obj_datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_datetime.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** obj_datetime.c 21 Nov 2002 18:02:01 -0000 1.2 --- obj_datetime.c 21 Nov 2002 19:24:53 -0000 1.3 *************** *** 330,342 **** static PyMethodDef datetime_methods[] = { /* Class methods: */ ! {"now", (PyCFunction)datetime_now, METH_O | METH_CLASS, "Return a new datetime that represents the current time."}, ! {"today", (PyCFunction)datetime_today, METH_O | METH_CLASS, "Return a new datetime that represents the current date."}, /* Instance methods: */ ! {"ctime", (PyCFunction)datetime_ctime, METH_NOARGS, "Return ctime() style string."}, ! {"isoformat", (PyCFunction)datetime_isoformat, METH_KEYWORDS, "Return the day of the week represented by the datetime.\n" "Monday == 1 ... Sunday == 7"}, --- 330,342 ---- static PyMethodDef datetime_methods[] = { /* Class methods: */ ! {"now", (PyCFunction)datetime_now, METH_O | METH_CLASS, "Return a new datetime that represents the current time."}, ! {"today", (PyCFunction)datetime_today, METH_O | METH_CLASS, "Return a new datetime that represents the current date."}, /* Instance methods: */ ! {"ctime", (PyCFunction)datetime_ctime, METH_NOARGS, "Return ctime() style string."}, ! {"isoformat", (PyCFunction)datetime_isoformat, METH_KEYWORDS, "Return the day of the week represented by the datetime.\n" "Monday == 1 ... Sunday == 7"}, *************** *** 363,404 **** statichere PyTypeObject PyDateTime_DateTimeType = { PyObject_HEAD_INIT(NULL) ! 0, /* ob_size */ ! "datetime", /* tp_name */ sizeof(PyDateTime_DateTime), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! (destructor)PyObject_Del, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)datetime_compare, /* tp_compare */ ! (reprfunc)datetime_repr, /* tp_repr */ &datetime_as_number, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! (hashfunc)datetime_hash, /* tp_hash */ ! 0, /* tp_call */ (reprfunc)datetime_str, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE, /* tp_flags */ datetime_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! datetime_methods, /* tp_methods */ ! 0, /* tp_members */ ! datetime_getset, /* tp_getset */ &PyDateTime_DateType, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ datetime_new, /* tp_new */ _PyObject_Del, /* tp_free */ --- 363,404 ---- statichere PyTypeObject PyDateTime_DateTimeType = { PyObject_HEAD_INIT(NULL) ! 0, /* ob_size */ ! "datetime", /* tp_name */ sizeof(PyDateTime_DateTime), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! (destructor)PyObject_Del, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! (cmpfunc)datetime_compare, /* tp_compare */ ! (reprfunc)datetime_repr, /* tp_repr */ &datetime_as_number, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! (hashfunc)datetime_hash, /* tp_hash */ ! 0, /* tp_call */ (reprfunc)datetime_str, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE, /* tp_flags */ datetime_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! datetime_methods, /* tp_methods */ ! 0, /* tp_members */ ! datetime_getset, /* tp_getset */ &PyDateTime_DateType, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ datetime_new, /* tp_new */ _PyObject_Del, /* tp_free */ Index: obj_delta.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_delta.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** obj_delta.c 21 Nov 2002 18:02:01 -0000 1.2 --- obj_delta.c 21 Nov 2002 19:24:53 -0000 1.3 *************** *** 19,26 **** if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) { /* delta + delta */ ! long int days = GET_TD_DAYS(delta) + GET_TD_DAYS(right); ! long int seconds = GET_TD_SECONDS(delta) + GET_TD_SECONDS(right); ! long int microseconds = (GET_TD_MICROSECONDS(delta) ! + GET_TD_MICROSECONDS(right)); return new_delta(days, seconds, microseconds); } --- 19,28 ---- if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) { /* delta + delta */ ! long int days = GET_TD_DAYS(delta) + ! GET_TD_DAYS(right); ! long int seconds = GET_TD_SECONDS(delta) + ! GET_TD_SECONDS(right); ! long int microseconds = GET_TD_MICROSECONDS(delta) + ! GET_TD_MICROSECONDS(right); return new_delta(days, seconds, microseconds); } *************** *** 51,55 **** diff = GET_TD_SECONDS(self) - GET_TD_SECONDS(other); if (diff == 0) ! diff = GET_TD_MICROSECONDS(self) - GET_TD_MICROSECONDS(other); } if (diff == 0) --- 53,58 ---- diff = GET_TD_SECONDS(self) - GET_TD_SECONDS(other); if (diff == 0) ! diff = GET_TD_MICROSECONDS(self) - ! GET_TD_MICROSECONDS(other); } if (diff == 0) *************** *** 83,87 **** /* delta * ??? */ if (PyInt_Check(right)) ! result = multiply_int_timedelta(right, (PyDateTime_Delta *) left); else { Py_INCREF(Py_NotImplemented); --- 86,91 ---- /* delta * ??? */ if (PyInt_Check(right)) ! result = multiply_int_timedelta(right, ! (PyDateTime_Delta *) left); else { Py_INCREF(Py_NotImplemented); *************** *** 90,94 **** } else if (PyInt_Check(left)) ! result = multiply_int_timedelta(left, (PyDateTime_Delta *) right); else { /* !(delta | int) * delta */ --- 94,99 ---- } else if (PyInt_Check(left)) ! result = multiply_int_timedelta(left, ! (PyDateTime_Delta *) right); else { /* !(delta | int) * delta */ From tim_one@users.sourceforge.net Thu Nov 21 19:29:15 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 11:29:15 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime obj_date.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv12551 Modified Files: obj_date.c Log Message: date_today(): Removed needless use of Unix-specific gettimeofday function. This gets us a little close to compiling on Windows. Index: obj_date.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_date.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** obj_date.c 21 Nov 2002 19:24:53 -0000 1.3 --- obj_date.c 21 Nov 2002 19:29:12 -0000 1.4 *************** *** 369,382 **** { /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ - struct timeval t; struct tm *tm; time_t timet; ! #ifdef GETTIMEOFDAY_NO_TZ ! gettimeofday(&t); ! #else /* !GETTIMEOFDAY_NO_TZ */ ! gettimeofday(&t, (struct timezone *)NULL); ! #endif /* !GETTIMEOFDAY_NO_TZ */ ! timet = t.tv_sec; tm = localtime(&timet); --- 369,376 ---- { /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ struct tm *tm; time_t timet; ! time(&timet); tm = localtime(&timet); From tim_one@users.sourceforge.net Thu Nov 21 19:31:32 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 11:31:32 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime obj_datetime.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv13321 Modified Files: obj_datetime.c Log Message: datetime_today(): Removed needless use of Unix-specific gettimeofday function. A little closer to compiling on Windows. Index: obj_datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_datetime.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** obj_datetime.c 21 Nov 2002 19:24:53 -0000 1.3 --- obj_datetime.c 21 Nov 2002 19:31:30 -0000 1.4 *************** *** 311,324 **** { /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ - struct timeval t; struct tm *tm; time_t timet; ! #ifdef GETTIMEOFDAY_NO_TZ ! gettimeofday(&t); ! #else /* !GETTIMEOFDAY_NO_TZ */ ! gettimeofday(&t, (struct timezone *)NULL); ! #endif /* !GETTIMEOFDAY_NO_TZ */ ! timet = t.tv_sec; tm = localtime(&timet); --- 311,318 ---- { /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ struct tm *tm; time_t timet; ! time(&timet); tm = localtime(&timet); From tim_one@users.sourceforge.net Thu Nov 21 19:47:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 11:47:36 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime obj_datetime.c,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv19476 Modified Files: obj_datetime.c Log Message: datetime_now(): Removed the last use of gettimeofday(), but *this* one had a real point to it. I'll have to fix this later, but it doesn't look easy to do so, and I don't want to get paralyzed by this at the start. It still doesn't compile on Windows, but gettimeofday ain't the problem anymore -- I'm not sure what is. Index: obj_datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_datetime.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** obj_datetime.c 21 Nov 2002 19:31:30 -0000 1.4 --- obj_datetime.c 21 Nov 2002 19:47:34 -0000 1.5 *************** *** 288,291 **** --- 288,299 ---- datetime_now(PyObject *self, PyObject *cls) { + /* XXX MAJOR: This needs to get some notion of current time + * XXX to better than 1-second resolution. Doing this in a x- + * XXX platform way is mondo painful. Maybe floattime() from + * XXX timemodule.c is good enough? We're running out of bits + * XXX in a typical time_t, though, and gettimeofday() should do + * XXX better than floattime() -- but gettimeofday isn't portable. + */ + #if 0 /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ struct timeval t; *************** *** 305,308 **** --- 313,329 ---- tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, t.tv_usec); + #else + /* XXX need to create the instance by calling cls(y,mon,d,h,min,s,u) */ + struct tm *tm; + time_t timet; + + time(&timet); + tm = localtime(&timet); + + return PyObject_CallFunction(cls, "iiiiiil", + tm->tm_year + 1900, tm->tm_mon + 1, + tm->tm_mday, tm->tm_hour, tm->tm_min, + tm->tm_sec, 0); + #endif } From doerwalter@users.sourceforge.net Thu Nov 21 20:08:37 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 21 Nov 2002 12:08:37 -0800 Subject: [Python-checkins] python/dist/src/Include pyerrors.h,2.61,2.62 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv4129/Include Modified Files: pyerrors.h Log Message: Fix PEP 293 related problems with --disable-unicode builds reported by Michael Hudson in http://mail.python.org/pipermail/python-dev/2002-November/030299.html Index: pyerrors.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyerrors.h,v retrieving revision 2.61 retrieving revision 2.62 diff -C2 -d -r2.61 -r2.62 *** pyerrors.h 3 Oct 2002 05:10:38 -0000 2.61 --- pyerrors.h 21 Nov 2002 20:08:33 -0000 2.62 *************** *** 139,144 **** --- 139,146 ---- PyAPI_FUNC(PyObject *) PyErr_ProgramText(char *, int); + #ifdef Py_USING_UNICODE /* The following functions are used to create and modify unicode exceptions from C */ + /* create a UnicodeDecodeError object */ PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create( *************** *** 199,202 **** --- 201,205 ---- PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( PyObject *, const char *); + #endif From doerwalter@users.sourceforge.net Thu Nov 21 20:08:37 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 21 Nov 2002 12:08:37 -0800 Subject: [Python-checkins] python/dist/src/Python exceptions.c,1.40,1.41 codecs.c,2.17,2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv4129/Python Modified Files: exceptions.c codecs.c Log Message: Fix PEP 293 related problems with --disable-unicode builds reported by Michael Hudson in http://mail.python.org/pipermail/python-dev/2002-November/030299.html Index: exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** exceptions.c 18 Sep 2002 22:37:17 -0000 1.40 --- exceptions.c 21 Nov 2002 20:08:31 -0000 1.41 *************** *** 893,896 **** --- 893,897 ---- + #ifdef Py_USING_UNICODE static int get_int(PyObject *exc, const char *name, int *value) *************** *** 1470,1473 **** --- 1471,1475 ---- object, length, start, end, reason); } + #endif *************** *** 1497,1500 **** --- 1499,1503 ---- PyDoc_STRVAR(UnicodeError__doc__, "Unicode related error."); + #ifdef Py_USING_UNICODE PyDoc_STRVAR(UnicodeEncodeError__doc__, "Unicode encoding error."); *************** *** 1502,1505 **** --- 1505,1509 ---- PyDoc_STRVAR(UnicodeTranslateError__doc__, "Unicode translation error."); + #endif PyDoc_STRVAR(SystemError__doc__, *************** *** 1676,1679 **** --- 1680,1684 ---- {"ValueError", &PyExc_ValueError, 0, ValueError__doc__}, {"UnicodeError", &PyExc_UnicodeError, &PyExc_ValueError, UnicodeError__doc__}, + #ifdef Py_USING_UNICODE {"UnicodeEncodeError", &PyExc_UnicodeEncodeError, &PyExc_UnicodeError, UnicodeEncodeError__doc__, UnicodeEncodeError_methods}, *************** *** 1682,1685 **** --- 1687,1691 ---- {"UnicodeTranslateError", &PyExc_UnicodeTranslateError, &PyExc_UnicodeError, UnicodeTranslateError__doc__, UnicodeTranslateError_methods}, + #endif {"ReferenceError", &PyExc_ReferenceError, 0, ReferenceError__doc__}, {"SystemError", &PyExc_SystemError, 0, SystemError__doc__}, Index: codecs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/codecs.c,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** codecs.c 26 Sep 2002 16:01:24 -0000 2.17 --- codecs.c 21 Nov 2002 20:08:32 -0000 2.18 *************** *** 487,490 **** --- 487,491 ---- + #ifdef Py_USING_UNICODE PyObject *PyCodec_IgnoreErrors(PyObject *exc) { *************** *** 729,732 **** --- 730,734 ---- } } + #endif static PyObject *strict_errors(PyObject *self, PyObject *exc) *************** *** 736,739 **** --- 738,742 ---- + #ifdef Py_USING_UNICODE static PyObject *ignore_errors(PyObject *self, PyObject *exc) { *************** *** 758,761 **** --- 761,765 ---- return PyCodec_BackslashReplaceErrors(exc); } + #endif *************** *** 775,778 **** --- 779,783 ---- } }, + #ifdef Py_USING_UNICODE { "ignore", *************** *** 807,810 **** --- 812,816 ---- } } + #endif }; if (_PyCodec_SearchPath == NULL) From doerwalter@users.sourceforge.net Thu Nov 21 20:13:42 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 21 Nov 2002 12:13:42 -0800 Subject: [Python-checkins] python/dist/src/Python compile.c,2.264,2.265 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv9156/Python Modified Files: compile.c Log Message: Move three variables that are only used inside an if block into the block, so the --disable-unicode build doesn't complain about unused variables. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.264 retrieving revision 2.265 diff -C2 -d -r2.264 -r2.265 *** compile.c 3 Oct 2002 09:50:47 -0000 2.264 --- compile.c 21 Nov 2002 20:13:40 -0000 2.265 *************** *** 1245,1251 **** PyObject *v; size_t len; - char *buf; - char *p; - char *end; int quote = *s; int rawmode = 0; --- 1245,1248 ---- *************** *** 1290,1293 **** --- 1287,1293 ---- if (unicode || Py_UnicodeFlag) { PyObject *u, *w; + char *buf; + char *p; + char *end; if (encoding == NULL) { buf = s; From doerwalter@users.sourceforge.net Thu Nov 21 20:18:51 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 21 Nov 2002 12:18:51 -0800 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.271,2.272 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv11099/Modules Modified Files: posixmodule.c Log Message: Comment out the getcwdu implementation for --disable-unicode builds Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.271 retrieving revision 2.272 diff -C2 -d -r2.271 -r2.272 *** posixmodule.c 7 Nov 2002 16:00:59 -0000 2.271 --- posixmodule.c 21 Nov 2002 20:18:46 -0000 2.272 *************** *** 1251,1254 **** --- 1251,1255 ---- } + #ifdef Py_USING_UNICODE PyDoc_STRVAR(posix_getcwdu__doc__, "getcwdu() -> path\n\n\ *************** *** 1288,1291 **** --- 1289,1293 ---- } #endif + #endif *************** *** 6856,6860 **** --- 6858,6864 ---- #ifdef HAVE_GETCWD {"getcwd", posix_getcwd, METH_VARARGS, posix_getcwd__doc__}, + #ifdef Py_USING_UNICODE {"getcwdu", posix_getcwdu, METH_VARARGS, posix_getcwdu__doc__}, + #endif #endif #ifdef HAVE_LINK From doerwalter@users.sourceforge.net Thu Nov 21 20:23:14 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 21 Nov 2002 12:23:14 -0800 Subject: [Python-checkins] python/dist/src/Python getargs.c,2.93,2.94 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv12631/Python Modified Files: getargs.c Log Message: Wrap uargs declaration in a #ifdef Py_USING_UNICODE, so that the --disable-unicode build doesn't complain about an unused variable. Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.93 retrieving revision 2.94 diff -C2 -d -r2.93 -r2.94 *** getargs.c 28 Jul 2002 10:23:27 -0000 2.93 --- getargs.c 21 Nov 2002 20:23:11 -0000 2.94 *************** *** 401,405 **** --- 401,407 ---- char *format = *p_format; char c = *format++; + #ifdef Py_USING_UNICODE PyObject *uarg; + #endif switch (c) { From tim_one@users.sourceforge.net Thu Nov 21 20:24:21 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 12:24:21 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.h,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv12883 Modified Files: datetime.h Log Message: A hack to get this to compile on Windows. It does, and the C tests pass now on Windows too. Will clean up later. Index: datetime.h =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** datetime.h 21 Nov 2002 19:24:53 -0000 1.7 --- datetime.h 21 Nov 2002 20:24:18 -0000 1.8 *************** *** 22,28 **** --- 22,40 ---- } PyDateTime_DateTime; + /* XXX CLEAN THIS UP. Using PyAPI_DATA doesn't work on Windows for + * XXX complicated reasons. One would like not to have the "static" + * XXX thingies here either, but with the global structure of #includes + * XXX right now, they're needed to prevent a slew of "undeclared name" + * XXX errors later. + */ + #if 0 PyAPI_DATA(PyTypeObject) PyDateTime_DateType; PyAPI_DATA(PyTypeObject) PyDateTime_DateTimeType; PyAPI_DATA(PyTypeObject) PyDateTime_DeltaType; + #else + static PyTypeObject PyDateTime_DateType; + static PyTypeObject PyDateTime_DateTimeType; + static PyTypeObject PyDateTime_DeltaType; + #endif /* Apply for date instances. */ From loewis@users.sourceforge.net Thu Nov 21 20:29:59 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 21 Nov 2002 12:29:59 -0800 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.103,1.104 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv14733 Modified Files: Makefile.pre.in Log Message: Patch #642020: Pass down prefix, BINDIR, and DESTSHARED to idleinstall. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** Makefile.pre.in 19 Nov 2002 13:31:16 -0000 1.103 --- Makefile.pre.in 21 Nov 2002 20:29:57 -0000 1.104 *************** *** 829,833 **** # This installs IDLE idleinstall: ! SRCDIR=$(srcdir) ./$(BUILDPYTHON) $(srcdir)/Tools/idle/setup.py install --check-tkinter # Build the toplevel Makefile --- 829,838 ---- # This installs IDLE idleinstall: ! SRCDIR=$(srcdir) \ ! ./$(BUILDPYTHON) $(srcdir)/Tools/idle/setup.py install \ ! --check-tkinter \ ! --prefix=$(prefix) \ ! --install-scripts=$(BINDIR) \ ! --install-platlib=$(DESTSHARED) # Build the toplevel Makefile From akuchling@users.sourceforge.net Thu Nov 21 20:41:10 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 21 Nov 2002 12:41:10 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils spawn.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv19503 Modified Files: spawn.py Log Message: Reflow comment Index: spawn.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/spawn.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** spawn.py 19 Nov 2002 13:12:27 -0000 1.15 --- spawn.py 21 Nov 2002 20:41:07 -0000 1.16 *************** *** 26,32 **** executable. ! If 'search_path' is true (the default), the system's executable search ! path will be used to find the program; otherwise, cmd[0] must be the ! exact path to the executable.If 'dry_run' is true, the command will not actually be run. --- 26,32 ---- executable. ! If 'search_path' is true (the default), the system's executable ! search path will be used to find the program; otherwise, cmd[0] ! must be the exact path to the executable. If 'dry_run' is true, the command will not actually be run. From loewis@users.sourceforge.net Thu Nov 21 20:33:27 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 21 Nov 2002 12:33:27 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils unixccompiler.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv16276/Lib/distutils Modified Files: unixccompiler.py Log Message: Patch #642019: Recognize gcc-x.y as gcc. Index: unixccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/unixccompiler.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** unixccompiler.py 14 Nov 2002 02:25:42 -0000 1.50 --- unixccompiler.py 21 Nov 2002 20:33:24 -0000 1.51 *************** *** 202,206 **** # MacOSX's linker doesn't understand the -R flag at all return "-L" + dir ! elif compiler == "gcc" or compiler == "g++": return "-Wl,-R" + dir else: --- 202,206 ---- # MacOSX's linker doesn't understand the -R flag at all return "-L" + dir ! elif compiler[:3] == "gcc" or compiler[:3] == "g++": return "-Wl,-R" + dir else: From loewis@users.sourceforge.net Thu Nov 21 20:41:31 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 21 Nov 2002 12:41:31 -0800 Subject: [Python-checkins] python/dist/src configure,1.359,1.360 configure.in,1.370,1.371 pyconfig.h.in,1.61,1.62 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv19210 Modified Files: configure configure.in pyconfig.h.in Log Message: Patch #639371: Remove FreeBSD 5 specific test, test for ctermid_r, setgroups prototypes explicitly. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.359 retrieving revision 1.360 diff -C2 -d -r1.359 -r1.360 *** configure 13 Nov 2002 08:51:18 -0000 1.359 --- configure 21 Nov 2002 20:41:21 -0000 1.360 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.369 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.370 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 1342,1349 **** OpenBSD/2.* | OpenBSD/3.[012]) define_xopen_source=no;; - # On FreeBSD 5.0, chroot and setgroups are not declared if _XOPEN_SOURCE - # is define. Reported by M. Recht. - FreeBSD/5.0*) - define_xopen_source=no;; esac --- 1342,1345 ---- *************** *** 11989,11995 **** ! ! ! for ac_func in alarm chown clock confstr ctermid ctermid_r execv \ fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \ --- 11985,11989 ---- ! for ac_func in alarm chown clock confstr ctermid execv \ fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \ *************** *** 11997,12001 **** mremap nice pathconf pause plock poll pthread_init \ putenv readlink \ ! select setegid seteuid setgid setgroups \ setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \ sigaction siginterrupt sigrelse strftime strptime \ --- 11991,11995 ---- mremap nice pathconf pause plock poll pthread_init \ putenv readlink \ ! select setegid seteuid setgid \ setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \ sigaction siginterrupt sigrelse strftime strptime \ *************** *** 12208,12211 **** --- 12202,12313 ---- cat >>confdefs.h <<\_ACEOF #define HAVE_SYMLINK 1 + _ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 + echo "${ECHO_T}yes" >&6 + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 + + fi + rm -f conftest.$ac_objext conftest.$ac_ext + + # On some systems (eg. FreeBSD 5), we would find a definition of the + # functions ctermid_r, setgroups in the library, but no prototype + # (e.g. because we use _XOPEN_SOURCE). See whether we can take their + # address to avoid compiler warnings and potential miscompilations + # because of the missing prototypes. + + echo "$as_me:$LINENO: checking for ctermid_r" >&5 + echo $ECHO_N "checking for ctermid_r... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + + #include "confdefs.h" + #include + + #ifdef F77_DUMMY_MAIN + # ifdef __cplusplus + extern "C" + # endif + int F77_DUMMY_MAIN() { return 1; } + #endif + int + main () + { + void* p = ctermid_r + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cat >>confdefs.h <<\_ACEOF + #define HAVE_CTERMID_R 1 + _ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 + echo "${ECHO_T}yes" >&6 + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 + + fi + rm -f conftest.$ac_objext conftest.$ac_ext + + echo "$as_me:$LINENO: checking for setgroups" >&5 + echo $ECHO_N "checking for setgroups... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + + #include "confdefs.h" + #include + + #ifdef F77_DUMMY_MAIN + # ifdef __cplusplus + extern "C" + # endif + int F77_DUMMY_MAIN() { return 1; } + #endif + int + main () + { + void* p = setgroups + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cat >>confdefs.h <<\_ACEOF + #define HAVE_SETGROUPS 1 _ACEOF Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.370 retrieving revision 1.371 diff -C2 -d -r1.370 -r1.371 *** configure.in 13 Nov 2002 08:51:19 -0000 1.370 --- configure.in 21 Nov 2002 20:41:28 -0000 1.371 *************** *** 121,128 **** OpenBSD/2.* | OpenBSD/3.@<:@012@:>@) define_xopen_source=no;; - # On FreeBSD 5.0, chroot and setgroups are not declared if _XOPEN_SOURCE - # is define. Reported by M. Recht. - FreeBSD/5.0*) - define_xopen_source=no;; esac --- 121,124 ---- *************** *** 1741,1745 **** # checks for library functions ! AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \ fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \ --- 1737,1741 ---- # checks for library functions ! AC_CHECK_FUNCS(alarm chown clock confstr ctermid execv \ fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \ *************** *** 1747,1751 **** mremap nice pathconf pause plock poll pthread_init \ putenv readlink \ ! select setegid seteuid setgid setgroups \ setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \ sigaction siginterrupt sigrelse strftime strptime \ --- 1743,1747 ---- mremap nice pathconf pause plock poll pthread_init \ putenv readlink \ ! select setegid seteuid setgid \ setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \ sigaction siginterrupt sigrelse strftime strptime \ *************** *** 1770,1773 **** --- 1766,1796 ---- AC_TRY_COMPILE([#include ], void *x=symlink, AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) + ) + + # On some systems (eg. FreeBSD 5), we would find a definition of the + # functions ctermid_r, setgroups in the library, but no prototype + # (e.g. because we use _XOPEN_SOURCE). See whether we can take their + # address to avoid compiler warnings and potential miscompilations + # because of the missing prototypes. + + AC_MSG_CHECKING(for ctermid_r) + AC_TRY_COMPILE([ + #include "confdefs.h" + #include + ], void* p = ctermid_r, + AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) + ) + + AC_MSG_CHECKING(for setgroups) + AC_TRY_COMPILE([ + #include "confdefs.h" + #include + ], + void* p = setgroups, + AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.) AC_MSG_RESULT(yes), AC_MSG_RESULT(no) Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** pyconfig.h.in 12 Nov 2002 06:04:39 -0000 1.61 --- pyconfig.h.in 21 Nov 2002 20:41:28 -0000 1.62 *************** *** 60,64 **** #undef HAVE_CTERMID ! /* Define to 1 if you have the `ctermid_r' function. */ #undef HAVE_CTERMID_R --- 60,64 ---- #undef HAVE_CTERMID ! /* Define if you have the 'ctermid_r' function. */ #undef HAVE_CTERMID_R *************** *** 349,353 **** #undef HAVE_SETGID ! /* Define to 1 if you have the `setgroups' function. */ #undef HAVE_SETGROUPS --- 349,353 ---- #undef HAVE_SETGID ! /* Define if you have the 'setgroups' function. */ #undef HAVE_SETGROUPS From gvanrossum@users.sourceforge.net Thu Nov 21 21:08:42 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 21 Nov 2002 13:08:42 -0800 Subject: [Python-checkins] python/dist/src/Lib threading.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv31955 Modified Files: threading.py Log Message: The _Event class should be more careful with releasing its lock when interrupted. A try/finally will do nicely. Maybe other classes need this too, but since they manipulate more state it's less clear that that is always the right thing, and I'm in a hurry. Backport candidate. Index: threading.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** threading.py 14 Aug 2002 19:25:42 -0000 1.28 --- threading.py 21 Nov 2002 21:08:39 -0000 1.29 *************** *** 319,336 **** def set(self): self.__cond.acquire() ! self.__flag = True ! self.__cond.notifyAll() ! self.__cond.release() def clear(self): self.__cond.acquire() ! self.__flag = False ! self.__cond.release() def wait(self, timeout=None): self.__cond.acquire() ! if not self.__flag: ! self.__cond.wait(timeout) ! self.__cond.release() # Helper to generate new thread names --- 319,342 ---- def set(self): self.__cond.acquire() ! try: ! self.__flag = True ! self.__cond.notifyAll() ! finally: ! self.__cond.release() def clear(self): self.__cond.acquire() ! try: ! self.__flag = False ! finally: ! self.__cond.release() def wait(self, timeout=None): self.__cond.acquire() ! try: ! if not self.__flag: ! self.__cond.wait(timeout) ! finally: ! self.__cond.release() # Helper to generate new thread names From loewis@users.sourceforge.net Thu Nov 21 21:45:34 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 21 Nov 2002 13:45:34 -0800 Subject: [Python-checkins] python/dist/src/Lib gettext.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv11193/Lib Modified Files: gettext.py Log Message: Patch #633547: Support plural forms. Do TODOs in test suite. Index: gettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gettext.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** gettext.py 14 Aug 2002 15:09:12 -0000 1.15 --- gettext.py 21 Nov 2002 21:45:32 -0000 1.16 *************** *** 33,36 **** --- 33,38 ---- # module. # + # J. David Ibanez implemented plural forms. + # # TODO: # - Lazy loading of .mo files. Currently the entire catalog is loaded into *************** *** 44,53 **** # find this format documented anywhere. ! import os ! import sys ! import struct ! import copy from errno import ENOENT __all__ = ["bindtextdomain","textdomain","gettext","dgettext", "find","translation","install","Catalog"] --- 46,54 ---- # find this format documented anywhere. ! ! import copy, os, re, struct, sys from errno import ENOENT + __all__ = ["bindtextdomain","textdomain","gettext","dgettext", "find","translation","install","Catalog"] *************** *** 56,59 **** --- 57,119 ---- + def test(condition, true, false): + """ + Implements the C expression: + + condition ? true : false + + Required to correctly interpret plural forms. + """ + if condition: + return true + else: + return false + + + def c2py(plural): + """ + Gets a C expression as used in PO files for plural forms and + returns a Python lambda function that implements an equivalent + expression. + """ + # Security check, allow only the "n" identifier + from StringIO import StringIO + import token, tokenize + tokens = tokenize.generate_tokens(StringIO(plural).readline) + danger = [ x for x in tokens if x[0] == token.NAME and x[1] != 'n' ] + if danger: + raise ValueError, 'dangerous expression' + + # Replace some C operators by their Python equivalents + plural = plural.replace('&&', ' and ') + plural = plural.replace('||', ' or ') + + expr = re.compile(r'\![^=]') + plural = expr.sub(' not ', plural) + + # Regular expression and replacement function used to transform + # "a?b:c" to "test(a,b,c)". + expr = re.compile(r'(.*?)\?(.*?):(.*)') + def repl(x): + return "test(%s, %s, %s)" % (x.group(1), x.group(2), + expr.sub(repl, x.group(3))) + + # Code to transform the plural expression, taking care of parentheses + stack = [''] + for c in plural: + if c == '(': + stack.append('') + elif c == ')': + if len(stack) == 0: + raise ValueError, 'unbalanced parenthesis in plural form' + s = expr.sub(repl, stack.pop()) + stack[-1] += '(%s)' % s + else: + stack[-1] += c + plural = expr.sub(repl, stack.pop()) + + return eval('lambda n: int(%s)' % plural) + + def _expand_lang(locale): *************** *** 122,125 **** --- 182,193 ---- return message + def ngettext(self, msgid1, msgid2, n): + if self._fallback: + return self._fallback.ngettext(msgid1, msgid2, n) + if n == 1: + return msgid1 + else: + return msgid2 + def ugettext(self, message): if self._fallback: *************** *** 127,130 **** --- 195,206 ---- return unicode(message) + def ungettext(self, msgid1, msgid2, n): + if self._fallback: + return self._fallback.ungettext(msgid1, msgid2, n) + if n == 1: + return unicode(msgid1) + else: + return unicode(msgid2) + def info(self): return self._info *************** *** 170,175 **** tend = toff + tlen if mend < buflen and tend < buflen: tmsg = buf[toff:tend] ! catalog[buf[moff:mend]] = tmsg else: raise IOError(0, 'File is corrupt', filename) --- 246,259 ---- tend = toff + tlen if mend < buflen and tend < buflen: + msg = buf[moff:mend] tmsg = buf[toff:tend] ! if msg.find('\x00') >= 0: ! # Plural forms ! msgid1, msgid2 = msg.split('\x00') ! tmsg = tmsg.split('\x00') ! for i in range(len(tmsg)): ! catalog[(msgid1, i)] = tmsg[i] ! else: ! catalog[msg] = tmsg else: raise IOError(0, 'File is corrupt', filename) *************** *** 187,190 **** --- 271,280 ---- if k == 'content-type': self._charset = v.split('charset=')[1] + elif k == 'plural-forms': + v = v.split(';') + ## nplurals = v[0].split('nplurals=')[1] + ## nplurals = int(nplurals.strip()) + plural = v[1].split('plural=')[1] + self.plural = c2py(plural) # advance to next entry in the seek tables masteridx += 8 *************** *** 199,202 **** --- 289,305 ---- return message + + def ngettext(self, msgid1, msgid2, n): + try: + return self._catalog[(msgid1, self.plural(n))] + except KeyError: + if self._fallback: + return self._fallback.ngettext(msgid1, msgid2, n) + if n == 1: + return msgid1 + else: + return msgid2 + + def ugettext(self, message): try: *************** *** 209,212 **** --- 312,327 ---- + def ungettext(self, msgid1, msgid2, n): + try: + tmsg = self._catalog[(msgid1, self.plural(n))] + except KeyError: + if self._fallback: + return self._fallback.ungettext(msgid1, msgid2, n) + if n == 1: + tmsg = msgid1 + else: + tmsg = msgid2 + return unicode(tmsg, self._charset) + # Locate a .mo file using the gettext strategy *************** *** 312,317 **** --- 427,447 ---- + def dngettext(domain, msgid1, msgid2, n): + try: + t = translation(domain, _localedirs.get(domain, None)) + except IOError: + if n == 1: + return msgid1 + else: + return msgid2 + return t.ngettext(msgid1, msgid2, n) + + def gettext(message): return dgettext(_current_domain, message) + + + def ngettext(msgid1, msgid2, n): + return dngettext(_current_domain, msgid1, msgid2, n) From loewis@users.sourceforge.net Thu Nov 21 21:45:34 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 21 Nov 2002 13:45:34 -0800 Subject: [Python-checkins] python/dist/src/Lib/test/output test_gettext,1.4,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv11193/Lib/test/output Removed Files: test_gettext Log Message: Patch #633547: Support plural forms. Do TODOs in test suite. --- test_gettext DELETED --- From loewis@users.sourceforge.net Thu Nov 21 21:45:34 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 21 Nov 2002 13:45:34 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_gettext.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv11193/Lib/test Modified Files: test_gettext.py Log Message: Patch #633547: Support plural forms. Do TODOs in test suite. Index: test_gettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gettext.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_gettext.py 20 Jul 2002 00:36:38 -0000 1.10 --- test_gettext.py 21 Nov 2002 21:45:32 -0000 1.11 *************** *** 3,154 **** import gettext ! def test_api_1(localedir, mofile): ! print 'test api 1' - # Test basic interface ! print 'installing gettext' ! gettext.install('gettext', localedir) - # test some translations - print _('albatross') - print _(u'mullusk') - print _(r'Raymond Luxury Yach-t') - print _(ur'nudge nudge') ! # double quotes ! print _("albatross") ! print _(u"mullusk") ! print _(r"Raymond Luxury Yach-t") ! print _(ur"nudge nudge") ! # triple single quotes ! print _('''albatross''') ! print _(u'''mullusk''') ! print _(r'''Raymond Luxury Yach-t''') ! print _(ur'''nudge nudge''') ! # triple double quotes ! print _("""albatross""") ! print _(u"""mullusk""") ! print _(r"""Raymond Luxury Yach-t""") ! print _(ur"""nudge nudge""") ! # multiline strings ! print _('''This module provides internationalization and localization support for your Python programs by providing an interface to the GNU ! gettext message catalog library.''') - # test the alternative interface - fp = open(os.path.join(mofile), 'rb') - t = gettext.GNUTranslations(fp) - fp.close() ! t.install() ! print _('nudge nudge') ! # try unicode return type ! t.install(unicode=1) ! print _('mullusk') ! def test_api_2(localedir, mofile): ! print 'test api 2' ! gettext.bindtextdomain('gettext', localedir) ! print gettext.bindtextdomain('gettext') == localedir ! gettext.textdomain('gettext') ! # should return 'gettext' ! print gettext.textdomain() - # local function override builtin - _ = gettext.gettext ! # test some translations ! print _('albatross') ! print _(u'mullusk') ! print _(r'Raymond Luxury Yach-t') ! print _(ur'nudge nudge') - # double quotes - print _("albatross") - print _(u"mullusk") - print _(r"Raymond Luxury Yach-t") - print _(ur"nudge nudge") ! # triple single quotes ! print _('''albatross''') ! print _(u'''mullusk''') ! print _(r'''Raymond Luxury Yach-t''') ! print _(ur'''nudge nudge''') - # triple double quotes - print _("""albatross""") - print _(u"""mullusk""") - print _(r"""Raymond Luxury Yach-t""") - print _(ur"""nudge nudge""") ! # multiline strings ! print _('''This module provides internationalization and localization support for your Python programs by providing an interface to the GNU ! gettext message catalog library.''') - # Now test dgettext() - def _(message): - return gettext.dgettext('gettext') ! GNU_MO_DATA = '''\ ! 3hIElQAAAAAFAAAAHAAAA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J0 ! IHl2b2VuZWwuAGJhY29uAHdpbmsgd2luawA= ! ''' ! LOCALEDIR = os.path.join('xx', 'LC_MESSAGES') ! MOFILE = os.path.join(LOCALEDIR, 'gettext.mo') - def setup(): - os.makedirs(LOCALEDIR) - fp = open(MOFILE, 'wb') - fp.write(base64.decodestring(GNU_MO_DATA)) - fp.close() - os.environ['LANGUAGE'] = 'xx' ! def teardown(): ! os.environ['LANGUAGE'] = 'en' ! os.unlink(MOFILE) ! os.removedirs(LOCALEDIR) - try: - setup() - test_api_1(os.curdir, MOFILE) - test_api_2(os.curdir, MOFILE) - finally: - teardown() - pass # For reference, here's the .po file used to created the .mo data above. ''' --- 3,283 ---- import gettext + import unittest + from unittest import TestCase ! # TODO: ! # - Add new tests, for example for "dgettext" ! # - Remove dummy tests, for example testing for single and double quotes ! # has no sense, it would have if we were testing a parser (i.e. pygettext) ! # - Tests should have only one assert. ! GNU_MO_DATA = '''\ ! 3hIElQAAAAAGAAAAHAAAAEwAAAALAAAAfAAAAAAAAACoAAAAFQAAAKkAAAAjAAAAvwAAAKEAAADj ! AAAABwAAAIUBAAALAAAAjQEAAEUBAACZAQAAFgAAAN8CAAAeAAAA9gIAAKEAAAAVAwAABQAAALcD ! AAAJAAAAvQMAAAEAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABQAAAAYAAAACAAAAAFJh ! eW1vbmQgTHV4dXJ5IFlhY2gtdABUaGVyZSBpcyAlcyBmaWxlAFRoZXJlIGFyZSAlcyBmaWxlcwBU ! aGlzIG1vZHVsZSBwcm92aWRlcyBpbnRlcm5hdGlvbmFsaXphdGlvbiBhbmQgbG9jYWxpemF0aW9u ! CnN1cHBvcnQgZm9yIHlvdXIgUHl0aG9uIHByb2dyYW1zIGJ5IHByb3ZpZGluZyBhbiBpbnRlcmZh ! Y2UgdG8gdGhlIEdOVQpnZXR0ZXh0IG1lc3NhZ2UgY2F0YWxvZyBsaWJyYXJ5LgBtdWxsdXNrAG51 ! ZGdlIG51ZGdlAFByb2plY3QtSWQtVmVyc2lvbjogMi4wClBPLVJldmlzaW9uLURhdGU6IDIwMDAt ! MDgtMjkgMTI6MTktMDQ6MDAKTGFzdC1UcmFuc2xhdG9yOiBKLiBEYXZpZCBJYsOhw7FleiA8ai1k ! YXZpZEBub29zLmZyPgpMYW5ndWFnZS1UZWFtOiBYWCA8cHl0aG9uLWRldkBweXRob24ub3JnPgpN ! SU1FLVZlcnNpb246IDEuMApDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9aXNvLTg4 ! NTktMQpDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiBub25lCkdlbmVyYXRlZC1CeTogcHlnZXR0 ! ZXh0LnB5IDEuMQpQbHVyYWwtRm9ybXM6IG5wbHVyYWxzPTI7IHBsdXJhbD1uIT0xOwoAVGhyb2F0 ! d29iYmxlciBNYW5ncm92ZQBIYXkgJXMgZmljaGVybwBIYXkgJXMgZmljaGVyb3MAR3V2ZiB6YnFo ! eXIgY2ViaXZxcmYgdmFncmVhbmd2YmFueXZtbmd2YmEgbmFxIHlicG55dm1uZ3ZiYQpmaGNjYmVn ! IHNiZSBsYmhlIENsZ3ViYSBjZWJ0ZW56ZiBvbCBjZWJpdnF2YXQgbmEgdmFncmVzbnByIGdiIGd1 ! ciBUQUgKdHJnZ3JrZyB6cmZmbnRyIHBuZ255YnQgeXZvZW5lbC4AYmFjb24Ad2luayB3aW5rAA== ! ''' ! LOCALEDIR = os.path.join('xx', 'LC_MESSAGES') ! MOFILE = os.path.join(LOCALEDIR, 'gettext.mo') ! def setup(): ! os.makedirs(LOCALEDIR) ! fp = open(MOFILE, 'wb') ! fp.write(base64.decodestring(GNU_MO_DATA)) ! fp.close() ! os.environ['LANGUAGE'] = 'xx' ! def teardown(): ! os.environ['LANGUAGE'] = 'en' ! os.unlink(MOFILE) ! os.removedirs(LOCALEDIR) ! ! class GettextTestCase1(TestCase): ! def setUp(self): ! self.localedir = os.curdir ! self.mofile = MOFILE ! ! gettext.install('gettext', self.localedir) ! ! ! def test_some_translations(self): ! # test some translations ! assert _('albatross') == 'albatross' ! assert _(u'mullusk') == 'bacon' ! assert _(r'Raymond Luxury Yach-t') == 'Throatwobbler Mangrove' ! assert _(ur'nudge nudge') == 'wink wink' ! ! ! def test_double_quotes(self): ! # double quotes ! assert _("albatross") == 'albatross' ! assert _(u"mullusk") == 'bacon' ! assert _(r"Raymond Luxury Yach-t") == 'Throatwobbler Mangrove' ! assert _(ur"nudge nudge") == 'wink wink' ! ! ! def test_triple_single_quotes(self): ! # triple single quotes ! assert _('''albatross''') == 'albatross' ! assert _(u'''mullusk''') == 'bacon' ! assert _(r'''Raymond Luxury Yach-t''') == 'Throatwobbler Mangrove' ! assert _(ur'''nudge nudge''') == 'wink wink' ! ! ! def test_triple_double_quotes(self): ! # triple double quotes ! assert _("""albatross""") == 'albatross' ! assert _(u"""mullusk""") == 'bacon' ! assert _(r"""Raymond Luxury Yach-t""") == 'Throatwobbler Mangrove' ! assert _(ur"""nudge nudge""") == 'wink wink' ! ! ! def test_multiline_strings(self): ! # multiline strings ! assert _('''This module provides internationalization and localization support for your Python programs by providing an interface to the GNU ! gettext message catalog library.''') == '''Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba ! fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH ! trggrkg zrffntr pngnybt yvoenel.''' ! def test_the_alternative_interface(self): ! # test the alternative interface ! fp = open(os.path.join(self.mofile), 'rb') ! t = gettext.GNUTranslations(fp) ! fp.close() ! t.install() ! assert _('nudge nudge') == 'wink wink' ! # try unicode return type ! t.install(unicode=1) + assert _('mullusk') == 'bacon' ! class GettextTestCase2(TestCase): ! def setUp(self): ! self.localedir = os.curdir ! gettext.bindtextdomain('gettext', self.localedir) ! gettext.textdomain('gettext') ! self._ = gettext.gettext ! def test_bindtextdomain(self): ! assert gettext.bindtextdomain('gettext') == self.localedir ! def test_textdomain(self): ! assert gettext.textdomain() == 'gettext' ! def test_some_translations(self): ! # test some translations ! assert self._('albatross') == 'albatross' ! assert self._(u'mullusk') == 'bacon' ! assert self._(r'Raymond Luxury Yach-t') == 'Throatwobbler Mangrove' ! assert self._(ur'nudge nudge') == 'wink wink' ! ! ! def test_double_quotes(self): ! # double quotes ! assert self._("albatross") == 'albatross' ! assert self._(u"mullusk") == 'bacon' ! assert self._(r"Raymond Luxury Yach-t") == 'Throatwobbler Mangrove' ! assert self._(ur"nudge nudge") == 'wink wink' ! ! ! def test_triple_single_quotes(self): ! # triple single quotes ! assert self._('''albatross''') == 'albatross' ! assert self._(u'''mullusk''') == 'bacon' ! assert self._(r'''Raymond Luxury Yach-t''') == 'Throatwobbler Mangrove' ! assert self._(ur'''nudge nudge''') == 'wink wink' ! ! ! def test_triple_double_quotes(self): ! # triple double quotes ! assert self._("""albatross""") == 'albatross' ! assert self._(u"""mullusk""") == 'bacon' ! assert self._(r"""Raymond Luxury Yach-t""") == 'Throatwobbler Mangrove' ! assert self._(ur"""nudge nudge""") == 'wink wink' ! ! ! def test_multiline_strings(self): ! # multiline strings ! assert self._('''This module provides internationalization and localization support for your Python programs by providing an interface to the GNU ! gettext message catalog library.''') == '''Guvf zbqhyr cebivqrf vagreangvbanyvmngvba naq ybpnyvmngvba ! fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH ! trggrkg zrffntr pngnybt yvoenel.''' ! class PluralFormsTestCase(TestCase): ! def setUp(self): ! self.mofile = MOFILE + def test_plural_forms1(self): + x = gettext.ngettext('There is %s file', 'There are %s files', 1) + assert x == 'Hay %s fichero' ! x = gettext.ngettext('There is %s file', 'There are %s files', 2) ! assert x == 'Hay %s ficheros' ! def test_plural_forms2(self): ! fp = open(os.path.join(self.mofile), 'rb') ! t = gettext.GNUTranslations(fp) ! fp.close() + x = t.ngettext('There is %s file', 'There are %s files', 1) + assert x == 'Hay %s fichero' + + x = t.ngettext('There is %s file', 'There are %s files', 2) + assert x == 'Hay %s ficheros' + + + def test_hu(self): + f = gettext.c2py('0') + s = ''.join([ str(f(x)) for x in range(200) ]) + assert s == "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + + + def test_de(self): + f = gettext.c2py('n != 1') + s = ''.join([ str(f(x)) for x in range(200) ]) + assert s == "10111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + + + def test_fr(self): + f = gettext.c2py('n>1') + s = ''.join([ str(f(x)) for x in range(200) ]) + assert s == "00111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + + + def test_gd(self): + f = gettext.c2py('n==1 ? 0 : n==2 ? 1 : 2') + s = ''.join([ str(f(x)) for x in range(200) ]) + assert s == "20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + + + def test_gd2(self): + # Tests the combination of parentheses and "?:" + f = gettext.c2py('n==1 ? 0 : (n==2 ? 1 : 2)') + s = ''.join([ str(f(x)) for x in range(200) ]) + assert s == "20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + + + def test_lt(self): + f = gettext.c2py('n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2') + s = ''.join([ str(f(x)) for x in range(200) ]) + assert s == "20111111112222222222201111111120111111112011111111201111111120111111112011111111201111111120111111112011111111222222222220111111112011111111201111111120111111112011111111201111111120111111112011111111" + + + def test_ru(self): + f = gettext.c2py('n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2') + s = ''.join([ str(f(x)) for x in range(200) ]) + assert s == "20111222222222222222201112222220111222222011122222201112222220111222222011122222201112222220111222222011122222222222222220111222222011122222201112222220111222222011122222201112222220111222222011122222" + + + def test_pl(self): + f = gettext.c2py('n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2') + s = ''.join([ str(f(x)) for x in range(200) ]) + assert s == "20111222222222222222221112222222111222222211122222221112222222111222222211122222221112222222111222222211122222222222222222111222222211122222221112222222111222222211122222221112222222111222222211122222" + + + def test_sl(self): + f = gettext.c2py('n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3') + s = ''.join([ str(f(x)) for x in range(200) ]) + assert s == "30122333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333012233333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333" + + + def test_security(self): + # Test for a dangerous expression + try: + gettext.c2py("os.chmod('/etc/passwd',0777)") + except ValueError: + pass + else: + raise AssertionError + + + + if __name__ == '__main__': + try: + setup() + unittest.main() + finally: + teardown() # For reference, here's the .po file used to created the .mo data above. + # + # The original version was automatically generated from the sources with + # pygettext. Later it was manually modified to add plural forms support. ''' *************** *** 161,170 **** "Project-Id-Version: 2.0\n" "PO-Revision-Date: 2000-08-29 12:19-04:00\n" ! "Last-Translator: Barry A. Warsaw \n" "Language-Team: XX \n" "MIME-Version: 1.0\n" ! "Content-Type: text/plain; charset=koi8_r\n" ! "Content-Transfer-Encoding: none\n" "Generated-By: pygettext.py 1.1\n" #: test_gettext.py:19 test_gettext.py:25 test_gettext.py:31 test_gettext.py:37 --- 290,300 ---- "Project-Id-Version: 2.0\n" "PO-Revision-Date: 2000-08-29 12:19-04:00\n" ! "Last-Translator: J. David Ibanez \n" "Language-Team: XX \n" "MIME-Version: 1.0\n" ! "Content-Type: text/plain; charset=iso-8859-1\n" ! "Content-Transfer-Encoding: 8bit\n" "Generated-By: pygettext.py 1.1\n" + "Plural-Forms: nplurals=2; plural=n!=1;\n" #: test_gettext.py:19 test_gettext.py:25 test_gettext.py:31 test_gettext.py:37 *************** *** 199,201 **** --- 329,338 ---- "fhccbeg sbe lbhe Clguba cebtenzf ol cebivqvat na vagresnpr gb gur TAH\n" "trggrkg zrffntr pngnybt yvoenel." + + # Manually added, as neither pygettext nor xgettext support plural forms + # in Python. + msgid "There is %s file" + msgid_plural "There are %s files" + msgstr[0] "Hay %s fichero" + msgstr[1] "Hay %s ficheros" ''' From loewis@users.sourceforge.net Thu Nov 21 21:45:34 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 21 Nov 2002 13:45:34 -0800 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.215,1.216 NEWS,1.530,1.531 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv11193/Misc Modified Files: ACKS NEWS Log Message: Patch #633547: Support plural forms. Do TODOs in test suite. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.215 retrieving revision 1.216 diff -C2 -d -r1.215 -r1.216 *** ACKS 8 Nov 2002 13:09:39 -0000 1.215 --- ACKS 21 Nov 2002 21:45:32 -0000 1.216 *************** *** 252,255 **** --- 252,256 ---- Greg Humphreys Jeremy Hylton + Juan David Ibáñez Palomar Tony Ingraldi John Interrante Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.530 retrieving revision 1.531 diff -C2 -d -r1.530 -r1.531 *** NEWS 19 Nov 2002 21:20:25 -0000 1.530 --- NEWS 21 Nov 2002 21:45:32 -0000 1.531 *************** *** 578,582 **** - gettext.translation has an optional fallback argument, and gettext.find an optional all argument. Translations will now fallback ! on a per-message basis. - distutils bdist commands now offer a --skip-build option. --- 578,583 ---- - gettext.translation has an optional fallback argument, and gettext.find an optional all argument. Translations will now fallback ! on a per-message basis. The module supports plural forms, by means ! of gettext.[d]ngettext and Translation.[u]ngettext. - distutils bdist commands now offer a --skip-build option. From loewis@users.sourceforge.net Thu Nov 21 21:45:34 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 21 Nov 2002 13:45:34 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libgettext.tex,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv11193/Doc/lib Modified Files: libgettext.tex Log Message: Patch #633547: Support plural forms. Do TODOs in test suite. Index: libgettext.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgettext.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** libgettext.tex 24 Jun 2002 02:22:39 -0000 1.12 --- libgettext.tex 21 Nov 2002 21:45:31 -0000 1.13 *************** *** 70,73 **** --- 70,99 ---- \end{funcdesc} + \begin{funcdesc}{ngettext}{singular, plural, n} + + Like \function{gettext()}, but consider plural forms. If a translation + is found, apply the plural formula to \var{n}, and return the + resulting message (some languages have more than two plural forms). + If no translation is found, return \var{singular} if \var{n} is 1; + return \var{plural} otherwise. + + The Plural formula is taken from the catalog header. It is a C or + Python expression that has a free variable n; the expression evaluates + to the index of the plural in the catalog. See the GNU gettext + documentation for the precise syntax to be used in .po files, and the + formulas for a variety of languages. + + \versionadded{2.3} + + \end{funcdesc} + + \begin{funcdesc}{dngettext}{domain, singular, plural, n} + Like \function{ngettext()}, but look the message up in the specified + \var{domain}. + + \versionadded{2.3} + \end{funcdesc} + + Note that GNU \program{gettext} also defines a \function{dcgettext()} method, but this was deemed not useful and so it is currently *************** *** 208,211 **** --- 234,252 ---- \end{methoddesc} + \begin{methoddesc}[NullTranslations]{ngettext}{singular, plural, n} + If a fallback has been set, forward \method{ngettext} to the fallback. + Otherwise, return the translated message. Overridden in derived classes. + + \versionadded{2.3} + \end{methoddesc} + + \begin{methoddesc}[NullTranslations]{ungettext}{singular, plural, n} + If a fallback has been set, forward \method{ungettext} to the fallback. + Otherwise, return the translated message as a Unicode string. + Overridden in derived classes. + + \versionadded{2.3} + \end{methoddesc} + \begin{methoddesc}[NullTranslations]{info}{} Return the ``protected'' \member{_info} variable. *************** *** 264,267 **** --- 305,311 ---- builtin \function{unicode()} function. + To facilitate plural forms, the methods \method{ngettext} and + \method{ungettext} are overridden as well. + \subsubsection{Solaris message catalog support} *************** *** 535,538 **** --- 579,583 ---- \item Peter Funk \item James Henstridge + \Juan David Ib\'a\~nez Palomar \item Marc-Andr\'e Lemburg \item Martin von L\"owis From tim_one@users.sourceforge.net Thu Nov 21 22:26:39 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 14:26:39 -0800 Subject: [Python-checkins] python/dist/src/Objects floatobject.c,2.117,2.118 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv24242/python/Objects Modified Files: floatobject.c Log Message: float_int(): Some systems raise an exception if a double is cast to long but the double is too big to fit in a long. Prevent that. This closes some recent bug or patch on SF, but SF is down now so I can't say which. Bugfix candidate. Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.117 retrieving revision 2.118 diff -C2 -d -r2.117 -r2.118 *** floatobject.c 19 Nov 2002 20:49:15 -0000 2.117 --- floatobject.c 21 Nov 2002 22:26:37 -0000 2.118 *************** *** 654,674 **** double x = PyFloat_AsDouble(v); double wholepart; /* integral portion of x, rounded toward 0 */ - long aslong; /* (long)wholepart */ (void)modf(x, &wholepart); ! #ifdef RISCOS ! /* conversion from floating to integral type would raise exception */ ! if (wholepart>LONG_MAX || wholepart= and <= LONG_{MIN,MAX} would ! * still be vulnerable: if a long has more bits of precision than ! * a double, casting MIN/MAX to double may yield an approximation, ! * and if that's rounded up, then, e.g., wholepart=LONG_MAX+1 would ! * yield true from the C expression wholepart<=LONG_MAX, despite ! * that wholepart is actually greater than LONG_MAX. ! */ ! if (LONG_MIN < wholepart && wholepart < LONG_MAX) { ! const long aslong = (long)wholepart; return PyInt_FromLong(aslong); ! } ! return PyLong_FromDouble(wholepart); } From tim_one@users.sourceforge.net Thu Nov 21 22:55:29 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 14:55:29 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.14,1.15 datetime.h,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv776 Modified Files: datetime.c datetime.h Log Message: Fixed one of the XXXs I introduced to get this to compile on Windows. Simplified some macros that merely aliased other macros. Lined things up better (I think some stuff got out of whack when the file got tabified). Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** datetime.c 21 Nov 2002 19:24:52 -0000 1.14 --- datetime.c 21 Nov 2002 22:55:25 -0000 1.15 *************** *** 24,60 **** /* Rename the long macros in datetime.h to more reasonable short names. */ ! #define GET_YEAR(o) PyDateTime_GET_YEAR(o) ! #define GET_MONTH(o) PyDateTime_GET_MONTH(o) ! #define GET_DAY(o) PyDateTime_GET_DAY(o) ! #define GET_HOUR(o) PyDateTime_GET_HOUR(o) ! #define GET_MINUTE(o) PyDateTime_GET_MINUTE(o) ! #define GET_SECOND(o) PyDateTime_GET_SECOND(o) ! #define GET_MICROSECOND(o) PyDateTime_GET_MICROSECOND(o) /* Date accessors. */ ! #define SET_YEAR(o, v) (((o)->data[0] = ((v) & 0xff00) >> 8), \ ! ((o)->data[1] = ((v) & 0x00ff))) ! #define SET_MONTH(o, v) (PyDateTime_GET_MONTH(o) = (v)) ! #define SET_DAY(o, v) (PyDateTime_GET_DAY(o) = (v)) /* Date/Time accessors. */ ! #define SET_HOUR(o, v) (PyDateTime_GET_HOUR(o) = (v)) ! #define SET_MINUTE(o, v) (PyDateTime_GET_MINUTE(o) = (v)) ! #define SET_SECOND(o, v) (PyDateTime_GET_SECOND(o) = (v)) ! #define SET_MICROSECOND(o, v) (((o)->data[7] = ((v) & 0xff0000) >> 16), \ ! ((o)->data[8] = ((v) & 0x00ff00) >> 8), \ ! ((o)->data[9] = ((v) & 0x0000ff))) /* Delta accessors. */ ! #define GET_TD_DAYS(o) (((PyDateTime_Delta *)(o))->days) ! #define GET_TD_SECONDS(o) (((PyDateTime_Delta *)(o))->seconds) ! #define GET_TD_MICROSECONDS(o) (((PyDateTime_Delta *)(o))->microseconds) ! #define SET_TD_DAYS(o, v) ((o)->days = (v)) ! #define SET_TD_SECONDS(o, v) ((o)->seconds = (v)) #define SET_TD_MICROSECONDS(o, v) ((o)->microseconds = (v)) static PyTypeObject PyDateTime_DateType; static PyTypeObject PyDateTime_DateTimeType; /* --- 24,62 ---- /* Rename the long macros in datetime.h to more reasonable short names. */ ! #define GET_YEAR PyDateTime_GET_YEAR ! #define GET_MONTH PyDateTime_GET_MONTH ! #define GET_DAY PyDateTime_GET_DAY ! #define GET_HOUR PyDateTime_GET_HOUR ! #define GET_MINUTE PyDateTime_GET_MINUTE ! #define GET_SECOND PyDateTime_GET_SECOND ! #define GET_MICROSECOND PyDateTime_GET_MICROSECOND /* Date accessors. */ ! #define SET_YEAR(o, v) (((o)->data[0] = ((v) & 0xff00) >> 8), \ ! ((o)->data[1] = ((v) & 0x00ff))) ! #define SET_MONTH(o, v) (PyDateTime_GET_MONTH(o) = (v)) ! #define SET_DAY(o, v) (PyDateTime_GET_DAY(o) = (v)) /* Date/Time accessors. */ ! #define SET_HOUR(o, v) (PyDateTime_GET_HOUR(o) = (v)) ! #define SET_MINUTE(o, v) (PyDateTime_GET_MINUTE(o) = (v)) ! #define SET_SECOND(o, v) (PyDateTime_GET_SECOND(o) = (v)) ! #define SET_MICROSECOND(o, v) (((o)->data[7] = ((v) & 0xff0000) >> 16), \ ! ((o)->data[8] = ((v) & 0x00ff00) >> 8), \ ! ((o)->data[9] = ((v) & 0x0000ff))) /* Delta accessors. */ ! #define GET_TD_DAYS(o) (((PyDateTime_Delta *)(o))->days) ! #define GET_TD_SECONDS(o) (((PyDateTime_Delta *)(o))->seconds) ! #define GET_TD_MICROSECONDS(o) (((PyDateTime_Delta *)(o))->microseconds) ! #define SET_TD_DAYS(o, v) ((o)->days = (v)) ! #define SET_TD_SECONDS(o, v) ((o)->seconds = (v)) #define SET_TD_MICROSECONDS(o, v) ((o)->microseconds = (v)) + /* Forward declarations. */ static PyTypeObject PyDateTime_DateType; static PyTypeObject PyDateTime_DateTimeType; + static PyTypeObject PyDateTime_DeltaType; /* Index: datetime.h =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** datetime.h 21 Nov 2002 20:24:18 -0000 1.8 --- datetime.h 21 Nov 2002 22:55:26 -0000 1.9 *************** *** 22,41 **** } PyDateTime_DateTime; - /* XXX CLEAN THIS UP. Using PyAPI_DATA doesn't work on Windows for - * XXX complicated reasons. One would like not to have the "static" - * XXX thingies here either, but with the global structure of #includes - * XXX right now, they're needed to prevent a slew of "undeclared name" - * XXX errors later. - */ - #if 0 - PyAPI_DATA(PyTypeObject) PyDateTime_DateType; - PyAPI_DATA(PyTypeObject) PyDateTime_DateTimeType; - PyAPI_DATA(PyTypeObject) PyDateTime_DeltaType; - #else - static PyTypeObject PyDateTime_DateType; - static PyTypeObject PyDateTime_DateTimeType; - static PyTypeObject PyDateTime_DeltaType; - #endif - /* Apply for date instances. */ #define PyDateTime_GET_YEAR(o) (((PyDateTime_Date*)o)->data[0] << 8 \ --- 22,25 ---- From tim_one@users.sourceforge.net Thu Nov 21 22:56:56 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 14:56:56 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.15,1.16 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv1290 Modified Files: datetime.c Log Message: is_leap(): It's already a boolean expression, so no need for a ternary operator to force a 0/1 outcome. Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** datetime.c 21 Nov 2002 22:55:25 -0000 1.15 --- datetime.c 21 Nov 2002 22:56:54 -0000 1.16 *************** *** 67,71 **** is_leap(int year) { ! return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? 1 : 0; } --- 67,71 ---- is_leap(int year) { ! return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0); } From tim_one@users.sourceforge.net Thu Nov 21 23:00:28 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 15:00:28 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.16,1.17 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv2465 Modified Files: datetime.c Log Message: is_leap(): Sped this by using unsigned arithmetic. Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** datetime.c 21 Nov 2002 22:56:54 -0000 1.16 --- datetime.c 21 Nov 2002 23:00:23 -0000 1.17 *************** *** 67,71 **** is_leap(int year) { ! return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0); } --- 67,77 ---- is_leap(int year) { ! /* Cast year to unsigned. The result is the same either way, but ! * C can generate faster code for unsigned mod than for signed ! * mod (especially for % 4 -- a good compiler should just grab ! * the last 2 bits when the LHS is unsigned). ! */ ! const unsigned int ayear = (unsigned int)year; ! return ayear % 4 == 0 && (ayear % 100 != 0 || ayear % 400 == 0); } From tim_one@users.sourceforge.net Thu Nov 21 23:04:03 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 15:04:03 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.17,1.18 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv3567 Modified Files: datetime.c Log Message: days_in_month, days_before_year: added comments about obscurities. Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** datetime.c 21 Nov 2002 23:00:23 -0000 1.17 --- datetime.c 21 Nov 2002 23:04:00 -0000 1.18 *************** *** 80,84 **** { static int _days_in_month[] = { ! 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; --- 80,85 ---- { static int _days_in_month[] = { ! 0, /* unused; this vector uses 1-based indexing */ ! 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; *************** *** 95,98 **** --- 96,104 ---- { int y = year - 1; + /* XXX This is incorrect if year <= 0; we really want the floor + * XXX here. + * XXX If we're sticking to strictly positive years, it would be + * XXX better to change all these signatures to use unsigned ints. + */ return y*365 + y/4 - y/100 + y/400; } From tim_one@users.sourceforge.net Thu Nov 21 23:06:42 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 15:06:42 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.18,1.19 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv4270 Modified Files: datetime.c Log Message: ord_to_ymd(): changed signature from taking "long int" things to plain "long"; same thing, but "long int" threw me for a few seconds (I so rarely see it!). Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** datetime.c 21 Nov 2002 23:04:00 -0000 1.18 --- datetime.c 21 Nov 2002 23:06:40 -0000 1.19 *************** *** 126,130 **** /* ordinal -> year, month, day, considering 01-Jan-0001 as day 1. */ static void ! ord_to_ymd(long int ordinal, long int *year, long int *month, long int *day) { int di400y = days_before_year(401); --- 126,130 ---- /* ordinal -> year, month, day, considering 01-Jan-0001 as day 1. */ static void ! ord_to_ymd(long ordinal, long *year, long *month, long *day) { int di400y = days_before_year(401); From tim_one@users.sourceforge.net Thu Nov 21 23:12:59 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 15:12:59 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.19,1.20 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv5497 Modified Files: datetime.c Log Message: ord_to_ymd(): Take out the days-in-{4,100,400}-years calculations, and capture their values in macros. It wasn't worth it in the Python version of the code, because that got to exploit that the calls were done only once per Python session (at module init time). In C, though, the calls were getting done on every call of ord_to_ymd. Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** datetime.c 21 Nov 2002 23:06:40 -0000 1.19 --- datetime.c 21 Nov 2002 23:12:56 -0000 1.20 *************** *** 124,147 **** } /* ordinal -> year, month, day, considering 01-Jan-0001 as day 1. */ static void ord_to_ymd(long ordinal, long *year, long *month, long *day) { - int di400y = days_before_year(401); - int di100y = days_before_year(101); - int di4y = days_before_year(5); int n, n1, n4, n100, n400, leapyear, preceding; assert(ordinal >= 1); --ordinal; ! n400 = ordinal / di400y; ! n = ordinal % di400y; *year = n400 * 400 + 1; ! n100 = n / di100y; ! n = n % di100y; ! n4 = n / di4y; ! n = n % di4y; n1 = n / 365; --- 124,148 ---- } + #define DI4Y 1461 /* days_before_year(5); days in 4 years */ + #define DI100Y 36524 /* days_before_year(101); days in 100 years */ + #define DI400Y 146097 /* days_before_year(401); days in 400 years */ + /* ordinal -> year, month, day, considering 01-Jan-0001 as day 1. */ static void ord_to_ymd(long ordinal, long *year, long *month, long *day) { int n, n1, n4, n100, n400, leapyear, preceding; assert(ordinal >= 1); --ordinal; ! n400 = ordinal / DI400Y; ! n = ordinal % DI400Y; *year = n400 * 400 + 1; ! n100 = n / DI100Y; ! n = n % DI100Y; ! n4 = n / DI4Y; ! n = n % DI4Y; n1 = n / 365; From tim_one@users.sourceforge.net Thu Nov 21 23:15:45 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 15:15:45 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.20,1.21 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv6671 Modified Files: datetime.c Log Message: ord_to_ymd(): Removed the expr ? 1 : 0 business from more expressions expr that return 0 or 1 already. Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** datetime.c 21 Nov 2002 23:12:56 -0000 1.20 --- datetime.c 21 Nov 2002 23:15:43 -0000 1.21 *************** *** 157,165 **** return; } ! leapyear = (n1 == 3 && (n4 != 24 || n100 == 3)) ? 1 : 0; assert(leapyear == is_leap(*year)); *month = (n + 50) >> 5; ! preceding = (_days_before_month[*month] ! + ((*month > 2 && leapyear) ? 1 : 0)); if (preceding > n) { /* estimate is too large */ --- 157,164 ---- return; } ! leapyear = n1 == 3 && (n4 != 24 || n100 == 3); assert(leapyear == is_leap(*year)); *month = (n + 50) >> 5; ! preceding = (_days_before_month[*month] + (*month > 2 && leapyear)); if (preceding > n) { /* estimate is too large */ From jvr@users.sourceforge.net Thu Nov 21 23:19:39 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Thu, 21 Nov 2002 15:19:39 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib bundlebuilder.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv7855 Modified Files: bundlebuilder.py Log Message: added command line interface; refactored a bit; little things. Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/bundlebuilder.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bundlebuilder.py 21 Nov 2002 10:23:04 -0000 1.1 --- bundlebuilder.py 21 Nov 2002 23:19:37 -0000 1.2 *************** *** 4,16 **** bundlebuilder.py -- Tools to assemble MacOS X (application) bundles. ! This module contains three classes to build so called "bundles" for MacOS X. BundleBuilder is a general tool, AppBuilder is a subclass ! specialized in building application bundles. CocoaAppBuilder is a ! further specialization of AppBuilder. ! [Bundle|App|CocoaApp]Builder objects are instantiated with a bunch ! of keyword arguments, and have a build() method that will do all the ! work. See the class doc strings for a description of the constructor ! arguments. """ --- 4,25 ---- bundlebuilder.py -- Tools to assemble MacOS X (application) bundles. ! This module contains two classes to build so called "bundles" for MacOS X. BundleBuilder is a general tool, AppBuilder is a subclass ! specialized in building application bundles. ! [Bundle|App]Builder objects are instantiated with a bunch of keyword ! arguments, and have a build() method that will do all the work. See ! the class doc strings for a description of the constructor arguments. ! ! The module contains a main program that can be used in two ways: ! ! % python bundlebuilder.py [options] build ! % python buildapp.py [options] build ! ! Where "buildapp.py" is a user-supplied setup.py-like script following ! this model: ! ! from bundlebuilder import buildapp ! buildapp() """ *************** *** 18,32 **** # # XXX Todo: - # - a command line interface, also for use with the buildapp() and - # buildcocoaapp() convenience functions. # - modulefinder support to build standalone apps # ! __all__ = ["BundleBuilder", "AppBuilder", "CocoaAppBuilder", ! "buildapp", "buildcocoaapp"] import sys import os, errno, shutil from plistlib import Plist --- 27,40 ---- # # XXX Todo: # - modulefinder support to build standalone apps + # - consider turning this into a distutils extension # ! __all__ = ["BundleBuilder", "AppBuilder", "buildapp"] import sys import os, errno, shutil + import getopt from plistlib import Plist *************** *** 63,83 **** """ ! def __init__(self, name, plist=None, type="APPL", creator="????", resources=None, files=None, builddir="build", platform="MacOS", symlink=0, verbosity=1): """See the class doc string for a description of the arguments.""" - self.name, ext = os.path.splitext(name) - if not ext: - ext = ".bundle" - self.bundleextension = ext if plist is None: plist = Plist() self.plist = plist self.type = type self.creator = creator - if files is None: - files = [] - if resources is None: - resources = [] self.resources = resources self.files = files --- 71,88 ---- """ ! def __init__(self, name=None, plist=None, type="APPL", creator="????", resources=None, files=None, builddir="build", platform="MacOS", symlink=0, verbosity=1): """See the class doc string for a description of the arguments.""" if plist is None: plist = Plist() + if resources is None: + resources = [] + if files is None: + files = [] + self.name = name self.plist = plist self.type = type self.creator = creator self.resources = resources self.files = files *************** *** 85,94 **** self.platform = platform self.symlink = symlink - # misc (derived) attributes - self.bundlepath = pathjoin(builddir, self.name + self.bundleextension) - self.execdir = pathjoin("Contents", platform) - self.resdir = pathjoin("Contents", "Resources") self.verbosity = verbosity def build(self): """Build the bundle.""" --- 90,111 ---- self.platform = platform self.symlink = symlink self.verbosity = verbosity + def setup(self): + self.name, ext = os.path.splitext(self.name) + if not ext: + ext = ".bundle" + self.bundleextension = ext + # misc (derived) attributes + self.bundlepath = pathjoin(self.builddir, self.name + self.bundleextension) + self.execdir = pathjoin("Contents", self.platform) + + plist = plistDefaults.copy() + plist.CFBundleName = self.name + plist.CFBundlePackageType = self.type + plist.CFBundleSignature = self.creator + plist.update(self.plist) + self.plist = plist + def build(self): """Build the bundle.""" *************** *** 125,135 **** # # Write Contents/Info.plist - plist = plistDefaults.copy() - plist.CFBundleName = self.name - plist.CFBundlePackageType = self.type - plist.CFBundleSignature = self.creator - plist.update(self.plist) infoplist = pathjoin(contents, "Info.plist") ! plist.write(infoplist) def _copyFiles(self): --- 142,147 ---- # # Write Contents/Info.plist infoplist = pathjoin(contents, "Info.plist") ! self.plist.write(infoplist) def _copyFiles(self): *************** *** 145,149 **** msg = "Copying" for src, dst in files: ! self.message("%s %s to %s" % (msg, src, dst), 2) dst = pathjoin(self.bundlepath, dst) if self.symlink: --- 157,164 ---- msg = "Copying" for src, dst in files: ! if os.path.isdir(src): ! self.message("%s %s/ to %s/" % (msg, src, dst), 2) ! else: ! self.message("%s %s to %s" % (msg, src, dst), 2) dst = pathjoin(self.bundlepath, dst) if self.symlink: *************** *** 154,158 **** def message(self, msg, level=0): if level <= self.verbosity: ! sys.stderr.write(msg + "\n") --- 169,181 ---- def message(self, msg, level=0): if level <= self.verbosity: ! indent = "" ! if level > 1: ! indent = (level - 1) * " " ! sys.stderr.write(indent + msg + "\n") ! ! def report(self): ! # XXX something decent ! import pprint ! pprint.pprint(self.__dict__) *************** *** 167,176 **** assert os.path.exists(mainprogram) argv.insert(1, mainprogram) ! %(executable)s os.execve(executable, argv, os.environ) """ ! executableTemplate = "executable = os.path.join(resources, \"%s\")" ! class AppBuilder(BundleBuilder): --- 190,201 ---- assert os.path.exists(mainprogram) argv.insert(1, mainprogram) ! os.environ["PYTHONPATH"] = resources ! %(setpythonhome)s ! %(setexecutable)s os.execve(executable, argv, os.environ) """ ! setExecutableTemplate = """executable = os.path.join(resources, "%s")""" ! pythonhomeSnippet = """os.environ["home"] = resources""" class AppBuilder(BundleBuilder): *************** *** 178,182 **** """This class extends the BundleBuilder constructor with these arguments: ! mainprogram: A Python main program. If this argument is given, the main executable in the bundle will be a small wrapper --- 203,207 ---- """This class extends the BundleBuilder constructor with these arguments: ! mainprogram: A Python main program. If this argument is given, the main executable in the bundle will be a small wrapper *************** *** 186,229 **** be invoked by the wrapper program mentioned above. Else it will simply be used as the main executable. ! For the other keyword arguments see the BundleBuilder doc string. """ def __init__(self, name=None, mainprogram=None, executable=None, ! **kwargs): """See the class doc string for a description of the arguments.""" ! if mainprogram is None and executable is None: raise TypeError, ("must specify either or both of " "'executable' and 'mainprogram'") ! if name is not None: pass ! elif mainprogram is not None: ! name = os.path.splitext(os.path.basename(mainprogram))[0] elif executable is not None: ! name = os.path.splitext(os.path.basename(executable))[0] ! if name[-4:] != ".app": ! name += ".app" ! self.mainprogram = mainprogram ! self.executable = executable ! BundleBuilder.__init__(self, name=name, **kwargs) def preProcess(self): ! self.plist.CFBundleExecutable = self.name if self.executable is not None: if self.mainprogram is None: execpath = pathjoin(self.execdir, self.name) else: ! execpath = pathjoin(self.resdir, os.path.basename(self.executable)) self.files.append((self.executable, execpath)) # For execve wrapper ! executable = executableTemplate % os.path.basename(self.executable) else: ! executable = "" # XXX for locals() call if self.mainprogram is not None: mainname = os.path.basename(self.mainprogram) ! self.files.append((self.mainprogram, pathjoin(self.resdir, mainname))) # Create execve wrapper mainprogram = self.mainprogram # XXX for locals() call --- 211,267 ---- be invoked by the wrapper program mentioned above. Else it will simply be used as the main executable. ! nibname: The name of the main nib, for Cocoa apps. Defaults ! to None, but must be specified when building a Cocoa app. ! For the other keyword arguments see the BundleBuilder doc string. """ def __init__(self, name=None, mainprogram=None, executable=None, ! nibname=None, **kwargs): """See the class doc string for a description of the arguments.""" ! self.mainprogram = mainprogram ! self.executable = executable ! self.nibname = nibname ! BundleBuilder.__init__(self, name=name, **kwargs) ! ! def setup(self): ! if self.mainprogram is None and self.executable is None: raise TypeError, ("must specify either or both of " "'executable' and 'mainprogram'") ! ! if self.name is not None: pass ! elif self.mainprogram is not None: ! self.name = os.path.splitext(os.path.basename(self.mainprogram))[0] elif executable is not None: ! self.name = os.path.splitext(os.path.basename(self.executable))[0] ! if self.name[-4:] != ".app": ! self.name += ".app" ! self.plist.CFBundleExecutable = self.name ! if self.nibname: ! self.plist.NSMainNibFile = self.nibname ! if not hasattr(self.plist, "NSPrincipalClass"): ! self.plist.NSPrincipalClass = "NSApplication" ! BundleBuilder.setup(self) def preProcess(self): ! resdir = pathjoin("Contents", "Resources") if self.executable is not None: if self.mainprogram is None: execpath = pathjoin(self.execdir, self.name) else: ! execpath = pathjoin(resdir, os.path.basename(self.executable)) self.files.append((self.executable, execpath)) # For execve wrapper ! setexecutable = setExecutableTemplate % os.path.basename(self.executable) else: ! setexecutable = "" # XXX for locals() call if self.mainprogram is not None: + setpythonhome = "" # pythonhomeSnippet if we're making a standalone app mainname = os.path.basename(self.mainprogram) ! self.files.append((self.mainprogram, pathjoin(resdir, mainname))) # Create execve wrapper mainprogram = self.mainprogram # XXX for locals() call *************** *** 235,254 **** - class CocoaAppBuilder(AppBuilder): - - """Tiny specialization of AppBuilder. It has an extra constructor - argument called 'nibname' which defaults to 'MainMenu'. It will - set the appropriate fields in the plist. - """ - - def __init__(self, nibname="MainMenu", **kwargs): - """See the class doc string for a description of the arguments.""" - self.nibname = nibname - AppBuilder.__init__(self, **kwargs) - self.plist.NSMainNibFile = self.nibname - if not hasattr(self.plist, "NSPrincipalClass"): - self.plist.NSPrincipalClass = "NSApplication" - - def copy(src, dst, mkdirs=0): """Copy a file or a directory.""" --- 273,276 ---- *************** *** 288,307 **** ! def buildapp(**kwargs): ! # XXX cmd line argument parsing ! builder = AppBuilder(**kwargs) ! builder.build() ! def buildcocoaapp(**kwargs): ! # XXX cmd line argument parsing ! builder = CocoaAppBuilder(**kwargs) ! builder.build() if __name__ == "__main__": ! # XXX This test is meant to be run in the Examples/TableModel/ folder ! # of the pyobj project... It will go as soon as I've written a proper ! # main program. ! buildcocoaapp(mainprogram="TableModel.py", ! resources=["English.lproj", "nibwrapper.py"], verbosity=4) --- 310,404 ---- ! cmdline_doc = """\ ! Usage: ! python [options] command ! python mybuildscript.py [options] command + Commands: + build build the application + report print a report ! Options: ! -b, --builddir=DIR the build directory; defaults to "build" ! -n, --name=NAME application name ! -r, --resource=FILE extra file or folder to be copied to Resources ! -e, --executable=FILE the executable to be used ! -m, --mainprogram=FILE the Python main program ! -p, --plist=FILE .plist file (default: generate one) ! --nib=NAME main nib name ! -c, --creator=CCCC 4-char creator code (default: '????') ! -l, --link symlink files/folder instead of copying them ! -v, --verbose increase verbosity level ! -q, --quiet decrease verbosity level ! -h, --help print this message ! """ ! ! def usage(msg=None): ! if msg: ! print msg ! print cmdline_doc ! sys.exit(1) ! ! def main(builder=None): ! if builder is None: ! builder = AppBuilder(verbosity=1) ! ! shortopts = "b:n:r:e:m:c:plhvq" ! longopts = ("builddir=", "name=", "resource=", "executable=", ! "mainprogram=", "creator=", "nib=", "plist=", "link", "help", ! "verbose", "quiet") ! ! try: ! options, args = getopt.getopt(sys.argv[1:], shortopts, longopts) ! except getopt.error: ! usage() ! ! for opt, arg in options: ! if opt in ('-b', '--builddir'): ! builder.builddir = arg ! elif opt in ('-n', '--name'): ! builder.name = arg ! elif opt in ('-r', '--resource'): ! builder.resources.append(arg) ! elif opt in ('-e', '--executable'): ! builder.executable = arg ! elif opt in ('-m', '--mainprogram'): ! builder.mainprogram = arg ! elif opt in ('-c', '--creator'): ! builder.creator = arg ! elif opt == "--nib": ! builder.nibname = arg ! elif opt in ('-p', '--plist'): ! builder.plist = Plist.fromFile(arg) ! elif opt in ('-l', '--link'): ! builder.symlink = 1 ! elif opt in ('-h', '--help'): ! usage() ! elif opt in ('-v', '--verbose'): ! builder.verbosity += 1 ! elif opt in ('-q', '--quiet'): ! builder.verbosity -= 1 ! ! if len(args) != 1: ! usage("Must specify one command ('build', 'report' or 'help')") ! command = args[0] ! ! if command == "build": ! builder.setup() ! builder.build() ! elif command == "report": ! builder.setup() ! builder.report() ! elif command == "help": ! usage() ! else: ! usage("Unknown command '%s'" % command) ! ! ! def buildapp(**kwargs): ! builder = AppBuilder(**kwargs) ! main(builder) if __name__ == "__main__": ! main() From loewis@users.sourceforge.net Thu Nov 21 23:52:37 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 21 Nov 2002 15:52:37 -0800 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.272,2.273 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv15542/Modules Modified Files: posixmodule.c Log Message: Fix --disable-unicode compilation problems. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.272 retrieving revision 2.273 diff -C2 -d -r2.272 -r2.273 *** posixmodule.c 21 Nov 2002 20:18:46 -0000 2.272 --- posixmodule.c 21 Nov 2002 23:52:35 -0000 2.273 *************** *** 23,26 **** --- 23,31 ---- corresponding Unix manual entries for more information on calls."); + #ifndef Py_USING_UNICODE + /* This is used in signatures of functions. */ + #define Py_UNICODE void + #endif + #if defined(PYOS_OS2) #define INCL_DOS From loewis@users.sourceforge.net Thu Nov 21 23:52:38 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 21 Nov 2002 15:52:38 -0800 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.169,2.170 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv15542/Objects Modified Files: fileobject.c Log Message: Fix --disable-unicode compilation problems. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.169 retrieving revision 2.170 diff -C2 -d -r2.169 -r2.170 *** fileobject.c 3 Oct 2002 05:10:39 -0000 2.169 --- fileobject.c 21 Nov 2002 23:52:35 -0000 2.170 *************** *** 117,123 **** --- 117,125 ---- Py_DECREF(f->f_name); Py_DECREF(f->f_mode); + #ifdef Py_USING_UNICODE if (wname) f->f_name = PyUnicode_FromObject(wname); else + #endif f->f_name = PyString_FromString(name); f->f_mode = PyString_FromString(mode); *************** *** 330,333 **** --- 332,336 ---- { if (PyUnicode_Check(f->f_name)) { + #ifdef Py_USING_UNICODE PyObject *ret = NULL; PyObject *name; *************** *** 340,343 **** --- 343,347 ---- Py_XDECREF(name); return ret; + #endif } else { return PyString_FromFormat("<%s file '%s', mode '%s' at %p>", From loewis@users.sourceforge.net Thu Nov 21 23:53:27 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 21 Nov 2002 15:53:27 -0800 Subject: [Python-checkins] python/dist/src/Python codecs.c,2.18,2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv15764/Python Modified Files: codecs.c Log Message: Properly compute array size even for --disable-unicode. Index: codecs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/codecs.c,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** codecs.c 21 Nov 2002 20:08:32 -0000 2.18 --- codecs.c 21 Nov 2002 23:53:25 -0000 2.19 *************** *** 823,827 **** if (_PyCodec_ErrorRegistry) { ! for (i = 0; i < 5; ++i) { PyObject *func = PyCFunction_New(&methods[i].def, NULL); int res; --- 823,827 ---- if (_PyCodec_ErrorRegistry) { ! for (i = 0; i < sizeof(methods)/sizeof(methods[0]); ++i) { PyObject *func = PyCFunction_New(&methods[i].def, NULL); int res; From rhettinger@users.sourceforge.net Fri Nov 22 00:07:42 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 21 Nov 2002 16:07:42 -0800 Subject: [Python-checkins] python/dist/src/Lib UserDict.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv17523 Modified Files: UserDict.py Log Message: Implement dict() style constructor. Already supported dict() and dict(mapping). Now supports dict(itemsequence) and Just van Rossum's new syntax for dict(keywordargs). Also, added related unittests. The docs already promise dict-like behavior so no update is needed there. Index: UserDict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserDict.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** UserDict.py 18 Nov 2002 04:34:10 -0000 1.19 --- UserDict.py 22 Nov 2002 00:07:39 -0000 1.20 *************** *** 2,8 **** class UserDict: ! def __init__(self, dict=None): ! self.data = {} ! if dict is not None: self.update(dict) def __repr__(self): return repr(self.data) def __cmp__(self, dict): --- 2,13 ---- class UserDict: ! def __init__(self, dict=None, **kwargs): ! self.data = kwargs # defaults to {} ! if dict is not None: ! if hasattr(dict,'keys'): # handle mapping (possibly a UserDict) ! self.update(dict) ! else: # handle sequence ! DICT = type({}) # because builtin dict is locally overridden ! self.data.update(DICT(dict)) def __repr__(self): return repr(self.data) def __cmp__(self, dict): From rhettinger@users.sourceforge.net Fri Nov 22 00:07:42 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 21 Nov 2002 16:07:42 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_userdict.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17523/test Modified Files: test_userdict.py Log Message: Implement dict() style constructor. Already supported dict() and dict(mapping). Now supports dict(itemsequence) and Just van Rossum's new syntax for dict(keywordargs). Also, added related unittests. The docs already promise dict-like behavior so no update is needed there. Index: test_userdict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userdict.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_userdict.py 18 Nov 2002 04:34:10 -0000 1.8 --- test_userdict.py 22 Nov 2002 00:07:40 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- uu2 = UserDict(u2) + verify(UserDict(one=1, two=2) == d2) # keyword arg constructor + verify(UserDict([('one',1), ('two',2)]) == d2) # item sequence constructor + # Test __repr__ From jvr@users.sourceforge.net Fri Nov 22 00:08:50 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Thu, 21 Nov 2002 16:08:50 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib bundlebuilder.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv18795 Modified Files: bundlebuilder.py Log Message: fixed stupid bug Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/bundlebuilder.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** bundlebuilder.py 21 Nov 2002 23:19:37 -0000 1.2 --- bundlebuilder.py 22 Nov 2002 00:08:47 -0000 1.3 *************** *** 238,242 **** if self.name[-4:] != ".app": self.name += ".app" - self.plist.CFBundleExecutable = self.name if self.nibname: --- 238,241 ---- *************** *** 248,251 **** --- 247,251 ---- def preProcess(self): + self.plist.CFBundleExecutable = self.name resdir = pathjoin("Contents", "Resources") if self.executable is not None: From jvr@users.sourceforge.net Fri Nov 22 00:31:52 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Thu, 21 Nov 2002 16:31:52 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib bundlebuilder.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv23577 Modified Files: bundlebuilder.py Log Message: fixed error in cmd line doc; moved funny self.name line once more Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/bundlebuilder.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** bundlebuilder.py 22 Nov 2002 00:08:47 -0000 1.3 --- bundlebuilder.py 22 Nov 2002 00:31:50 -0000 1.4 *************** *** 246,251 **** BundleBuilder.setup(self) - def preProcess(self): self.plist.CFBundleExecutable = self.name resdir = pathjoin("Contents", "Resources") if self.executable is not None: --- 246,252 ---- BundleBuilder.setup(self) self.plist.CFBundleExecutable = self.name + + def preProcess(self): resdir = pathjoin("Contents", "Resources") if self.executable is not None: *************** *** 312,316 **** cmdline_doc = """\ Usage: ! python [options] command python mybuildscript.py [options] command --- 313,317 ---- cmdline_doc = """\ Usage: ! python bundlebuilder.py [options] command python mybuildscript.py [options] command From tim_one@users.sourceforge.net Fri Nov 22 02:59:58 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 18:59:58 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.21,1.22 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv19481 Modified Files: datetime.c Log Message: Added some crucial asserts from the Python version. Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** datetime.c 21 Nov 2002 23:15:43 -0000 1.21 --- datetime.c 22 Nov 2002 02:59:56 -0000 1.22 *************** *** 124,127 **** --- 124,130 ---- } + /* Number of days in 4, 100, and 400 year cycles. That these have + * the correct values is asserted in the module init function. + */ #define DI4Y 1461 /* days_before_year(5); days in 4 years */ #define DI100Y 36524 /* days_before_year(101); days in 100 years */ *************** *** 363,365 **** --- 366,388 ---- PyModule_AddObject(m, "timedelta", (PyObject *) &PyDateTime_DeltaType); + + + /* A 4-year cycle has an extra leap day over what we'd get from + * pasting together 4 single years. + */ + assert(DI4Y == 4 * 365 + 1); + assert(DI4Y == days_before_year(4+1)); + + /* Similarly, a 400-year cycle has an extra leap day over what we'd + * get from pasting together 4 100-year cycles. + */ + assert(DI400Y == 4 * DI100Y + 1); + assert(DI400Y == days_before_year(400+1)); + + /* OTOH, a 100-year cycle has one fewer leap day than we'd get from + * pasting together 25 4-year cycles. + */ + assert(DI100Y == 25 * DI4Y - 1); + assert(DI100Y == days_before_year(100+1)); + } From tim_one@users.sourceforge.net Fri Nov 22 03:34:44 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 21 Nov 2002 19:34:44 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.22,1.23 datetime.h,1.9,1.10 datetime.py,1.63,1.64 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv26013 Modified Files: datetime.c datetime.h datetime.py Log Message: Copied over many comments from the .py version -- much of this code is incomprehensible without them. Fixed some typos and misdeclarations. Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** datetime.c 22 Nov 2002 02:59:56 -0000 1.22 --- datetime.c 22 Nov 2002 03:34:42 -0000 1.23 *************** *** 17,24 **** { PyObject_HEAD ! int hashcode; ! long int days; ! long int seconds; ! long int microseconds; } PyDateTime_Delta; --- 17,24 ---- { PyObject_HEAD ! long hashcode; ! long days; ! long seconds; ! long microseconds; } PyDateTime_Delta; *************** *** 64,67 **** --- 64,82 ---- */ + /* For each month ordinal in 1..12, the number of days in that month, + * and the number of days before that month in the same year. These + * are correct for non-leap years only. + */ + static int _days_in_month[] = { + 0, /* unused; this vector uses 1-based indexing */ + 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 + }; + + static int _days_before_month[] = { + 0, /* unused; this vector uses 1-based indexing */ + 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 + }; + + /* year -> 1 if leap year, else 0. */ static int is_leap(int year) *************** *** 76,87 **** } static int days_in_month(int year, int month) { - static int _days_in_month[] = { - 0, /* unused; this vector uses 1-based indexing */ - 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 - }; - assert(month >= 1); assert(month <= 12); --- 91,98 ---- } + /* month, year -> number of days in that month in that year */ static int days_in_month(int year, int month) { assert(month >= 1); assert(month <= 12); *************** *** 92,114 **** } ! static long ! days_before_year(int year) ! { ! int y = year - 1; ! /* XXX This is incorrect if year <= 0; we really want the floor ! * XXX here. ! * XXX If we're sticking to strictly positive years, it would be ! * XXX better to change all these signatures to use unsigned ints. ! */ ! return y*365 + y/4 - y/100 + y/400; ! } ! ! /* Each entry at index 1..12 gives the number of days before each ! * month on non-leap years. ! */ ! static int _days_before_month[] = { ! 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ! }; ! static int days_before_month(int year, int month) --- 103,107 ---- } ! /* month, year -> number of days in year preceeding first day of month */ static int days_before_month(int year, int month) *************** *** 124,127 **** --- 117,137 ---- } + /* year -> number of days before January 1st of year. Remember that we + * start with year 1, so days_before_year(1) == 0. + */ + static long + days_before_year(int year) + { + int y = year - 1; + /* XXX This is incorrect if year <= 0; we really want the floor + * XXX here. + * XXX If we're sticking to strictly positive years, it would be + * XXX better to change all these signatures to use unsigned ints. + */ + assert(year > 0); + return y*365 + y/4 - y/100 + y/400; + } + + /* Number of days in 4, 100, and 400 year cycles. That these have * the correct values is asserted in the module init function. *************** *** 133,140 **** /* ordinal -> year, month, day, considering 01-Jan-0001 as day 1. */ static void ! ord_to_ymd(long ordinal, long *year, long *month, long *day) { int n, n1, n4, n100, n400, leapyear, preceding; assert(ordinal >= 1); --ordinal; --- 143,172 ---- /* ordinal -> year, month, day, considering 01-Jan-0001 as day 1. */ static void ! ord_to_ymd(long ordinal, long *year, long *month, long *day) { int n, n1, n4, n100, n400, leapyear, preceding; + /* ordinal is a 1-based index, starting at 1-Jan-1. The pattern of + * leap years repeats exactly every 400 years. The basic strategy is + * to find the closest 400-year boundary at or before ordinal, then + * work with the offset from that boundary to ordinal. Life is much + * clearer if we subtract 1 from ordinal first -- then the values + * of ordinal at 400-year boundaries are exactly those divisible + * by DI400Y: + * + * D M Y n n-1 + * -- --- ---- ---------- ---------------- + * 31 Dec -400 -DI400Y -DI400Y -1 + * 1 Jan -399 -DI400Y +1 -DI400Y 400-year boundary + * ... + * 30 Dec 000 -1 -2 + * 31 Dec 000 0 -1 + * 1 Jan 001 1 0 400-year boundary + * 2 Jan 001 2 1 + * 3 Jan 001 3 2 + * ... + * 31 Dec 400 DI400Y DI400Y -1 + * 1 Jan 401 DI400Y +1 DI400Y 400-year boundary + */ assert(ordinal >= 1); --ordinal; *************** *** 143,152 **** --- 175,196 ---- *year = n400 * 400 + 1; + /* Now n is the (non-negative) offset, in days, from January 1 of + * year, to the desired date. Now compute how many 100-year cycles + * precede n. + * Note that it's possible for n100 to equal 4! In that case 4 full + * 100-year cycles precede the desired day, which implies the + * desired day is December 31 at the end of a 400-year cycle. + */ n100 = n / DI100Y; n = n % DI100Y; + /* Now compute how many 4-year cycles precede it. */ n4 = n / DI4Y; n = n % DI4Y; + /* And now how many single years. Again n1 can be 4, and again + * meaning that the desired day is December 31 at the end of the + * 4-year cycle. + */ n1 = n / 365; n = n % 365; *************** *** 160,163 **** --- 204,212 ---- return; } + + /* Now the year is correct, and n is the offset from January 1. We + * find the month via an estimate that's either exact or one too + * large. + */ leapyear = n1 == 3 && (n4 != 24 || n100 == 3); assert(leapyear == is_leap(*year)); *************** *** 183,186 **** --- 232,236 ---- } + /* Day of week, where Monday==0, ..., Sunday==6. 1/1/1 was a Monday. */ static int weekday(int year, int month, int day) Index: datetime.h =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** datetime.h 21 Nov 2002 22:55:26 -0000 1.9 --- datetime.h 22 Nov 2002 03:34:42 -0000 1.10 *************** *** 5,9 **** --- 5,27 ---- #define DATETIME_H + /* Fields are packed into successive bytes, each viewed as unsigned and + * big-endian, unless otherwise noted: + * + * byte offset + * 0 year 2 bytes, 1-9999 + * 2 month 1 byte, 1-12 + * 3 day 1 byte, 1-31 + * 4 hour 1 byte, 0-23 + * 5 minute 1 byte, 0-59 + * 6 second 1 byte, 0-59 + * 7 usecond 3 bytes, 0-999999 + * 10 tzoffset 2 bytes, signed, in minutes, -1439 .. 1439 + * 12 + */ + + /* # of bytes for year, month, and day. */ #define _PyDateTime_DATE_DATA_SIZE 4 + + /* # of bytes for year, month, day, hour, minute, second, and usecond. */ #define _PyDateTime_DATETIME_DATA_SIZE 10 Index: datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.py,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** datetime.py 20 Nov 2002 03:23:34 -0000 1.63 --- datetime.py 22 Nov 2002 03:34:42 -0000 1.64 *************** *** 655,659 **** The first ISO week of the year is the (Mon-Sun) week ! containing the year's first Thursday; everything rest derives from that. --- 655,659 ---- The first ISO week of the year is the (Mon-Sun) week ! containing the year's first Thursday; everything else derives from that. From pierslauder@users.sourceforge.net Fri Nov 22 05:47:41 2002 From: pierslauder@users.sourceforge.net (pierslauder@users.sourceforge.net) Date: Thu, 21 Nov 2002 21:47:41 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libimaplib.tex,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv22034/dist/src/Doc/lib Modified Files: libimaplib.tex Log Message: added details of new IMAP4_stream class; emphasised meaning of data part of command results; added proxyauth command description Index: libimaplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libimaplib.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** libimaplib.tex 20 Jul 2002 00:46:12 -0000 1.21 --- libimaplib.tex 22 Nov 2002 05:47:39 -0000 1.22 *************** *** 4,19 **** \declaremodule{standard}{imaplib} \modulesynopsis{IMAP4 protocol client (requires sockets).} ! \moduleauthor{Piers Lauder}{piers@staff.cs.usyd.edu.au} ! \sectionauthor{Piers Lauder}{piers@staff.cs.usyd.edu.au} ! % Based on HTML documentation by Piers Lauder ; % converted by Fred L. Drake, Jr. . % Revised by ESR, January 2000. % Changes for IMAP4_SSL by Tino Lange , March 2002 \indexii{IMAP4}{protocol} \indexii{IMAP4_SSL}{protocol} ! This module defines two classes, \class{IMAP4} and \class{IMAP4_SSL}, which encapsulate a connection to an IMAP4 server and implement a large subset of the IMAP4rev1 client protocol as defined in \rfc{2060}. It is backward --- 4,21 ---- \declaremodule{standard}{imaplib} \modulesynopsis{IMAP4 protocol client (requires sockets).} ! \moduleauthor{Piers Lauder}{piers@communitysolutions.com.au} ! \sectionauthor{Piers Lauder}{piers@communitysolutions.com.au} ! % Based on HTML documentation by Piers Lauder ; % converted by Fred L. Drake, Jr. . % Revised by ESR, January 2000. % Changes for IMAP4_SSL by Tino Lange , March 2002 + % Changes for IMAP4_stream by Piers Lauder , November 2002 \indexii{IMAP4}{protocol} \indexii{IMAP4_SSL}{protocol} + \indexii{IMAP4_stream}{protocol} ! This module defines three classes, \class{IMAP4}, \class{IMAP4_SSL} and \class{IMAP4_stream}, which encapsulate a connection to an IMAP4 server and implement a large subset of the IMAP4rev1 client protocol as defined in \rfc{2060}. It is backward *************** *** 21,25 **** \samp{STATUS} command is not supported in IMAP4. ! Two classes are provided by the \module{imaplib} module, \class{IMAP4} is the base class: \begin{classdesc}{IMAP4}{\optional{host\optional{, port}}} --- 23,27 ---- \samp{STATUS} command is not supported in IMAP4. ! Three classes are provided by the \module{imaplib} module, \class{IMAP4} is the base class: \begin{classdesc}{IMAP4}{\optional{host\optional{, port}}} *************** *** 31,35 **** \end{classdesc} ! Two exceptions are defined as attributes of the \class{IMAP4} class: \begin{excdesc}{IMAP4.error} --- 33,37 ---- \end{classdesc} ! Three exceptions are defined as attributes of the \class{IMAP4} class: \begin{excdesc}{IMAP4.error} *************** *** 62,65 **** --- 64,74 ---- \end{classdesc} + The second subclass allows for connections created by a child process: + + \begin{classdesc}{IMAP4_stream}{command} + This is a subclass derived from \class{IMAP4} that connects + to the \code{stdin/stdout} file descriptors created by passing \var{command} to \code{os.popen2()}. + \end{classdesc} + The following utility functions are defined: *************** *** 120,124 **** ...])} where \var{type} is usually \code{'OK'} or \code{'NO'}, and \var{data} is either the text from the command response, or ! mandated results from the command. An \class{IMAP4} instance has the following methods: --- 129,136 ---- ...])} where \var{type} is usually \code{'OK'} or \code{'NO'}, and \var{data} is either the text from the command response, or ! mandated results from the command. Each \var{data} ! is either a string, or a tuple. If a tuple, then the first part ! is the header of the response, and the second part contains ! the data (ie: 'literal' value). An \class{IMAP4} instance has the following methods: *************** *** 199,202 **** --- 211,219 ---- \end{methoddesc} + \begin{methoddesc}{login_cram_md5}{user, password} + Force use of \samp{CRAM-MD5} authentication when identifying the client to protect the password. + Will only work if the server \samp{CAPABILITY} response includes the phrase \samp{AUTH=CRAM-MD5}. + \end{methoddesc} + \begin{methoddesc}{logout}{} Shutdown connection to server. Returns server \samp{BYE} response. *************** *** 224,227 **** --- 241,249 ---- Fetch truncated part of a message. Returned data is a tuple of message part envelope and data. + \end{methoddesc} + + \begin{methoddesc}{proxyauth}{user} + Assume authentication as \var{user}. + Allows an authorised administrator to proxy into any user's mailbox. \end{methoddesc} From pierslauder@users.sourceforge.net Fri Nov 22 05:53:07 2002 From: pierslauder@users.sourceforge.net (pierslauder@users.sourceforge.net) Date: Thu, 21 Nov 2002 21:53:07 -0800 Subject: [Python-checkins] python/dist/src/Lib imaplib.py,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv23367/dist/src/Lib Modified Files: imaplib.py Log Message: added new IMAP4_stream class; added proxyauth command; added login_cram_md5 method Index: imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** imaplib.py 30 Oct 2002 06:20:37 -0000 1.56 --- imaplib.py 22 Nov 2002 05:53:04 -0000 1.57 *************** *** 18,25 **** # IMAP4_SSL contributed by Tino Lange March 2002. # GET/SETQUOTA contributed by Andreas Zeidler June 2002. ! __version__ = "2.53" ! import binascii, re, socket, time, random, sys __all__ = ["IMAP4", "IMAP4_SSL", "Internaldate2tuple", --- 18,26 ---- # IMAP4_SSL contributed by Tino Lange March 2002. # GET/SETQUOTA contributed by Andreas Zeidler June 2002. + # PROXYAUTH contributed by Rick Holbert November 2002. ! __version__ = "2.54" ! import binascii, os, random, re, socket, sys, time __all__ = ["IMAP4", "IMAP4_SSL", "Internaldate2tuple", *************** *** 59,62 **** --- 60,64 ---- 'NOOP': ('NONAUTH', 'AUTH', 'SELECTED', 'LOGOUT'), 'PARTIAL': ('SELECTED',), # NB: obsolete + 'PROXYAUTH': ('AUTH',), 'RENAME': ('AUTH', 'SELECTED'), 'SEARCH': ('SELECTED',), *************** *** 112,116 **** Each command returns a tuple: (type, [data, ...]) where 'type' is usually 'OK' or 'NO', and 'data' is either the text from the ! tagged response, or untagged results from command. Errors raise the exception class .error(""). --- 114,121 ---- Each command returns a tuple: (type, [data, ...]) where 'type' is usually 'OK' or 'NO', and 'data' is either the text from the ! tagged response, or untagged results from command. Each 'data' ! is either a string, or a tuple. If a tuple, then the first part ! is the header of the response, and the second part contains ! the data (ie: 'literal' value). Errors raise the exception class .error(""). *************** *** 326,331 **** mech = mechanism.upper() cap = 'AUTH=%s' % mech ! if not cap in self.capabilities: ! raise self.error("Server doesn't allow %s authentication." % mech) self.literal = _Authenticator(authobject).process typ, dat = self._simple_command('AUTHENTICATE', mech) --- 331,336 ---- mech = mechanism.upper() cap = 'AUTH=%s' % mech ! #if not cap in self.capabilities: # Let the server decide! ! # raise self.error("Server doesn't allow %s authentication." % mech) self.literal = _Authenticator(authobject).process typ, dat = self._simple_command('AUTHENTICATE', mech) *************** *** 462,467 **** NB: 'password' will be quoted. """ - #if not 'AUTH=LOGIN' in self.capabilities: - # raise self.error("Server doesn't allow LOGIN authentication." % mech) typ, dat = self._simple_command('LOGIN', user, self._quote(password)) if typ != 'OK': --- 467,470 ---- *************** *** 471,474 **** --- 474,492 ---- + def login_cram_md5(self, user, password): + """ Force use of CRAM-MD5 authentication. + + (typ, [data]) = .login_cram_md5(user, password) + """ + self.user, self.password = user, password + return self.authenticate('CRAM-MD5', self._CRAM_MD5_AUTH) + + + def _CRAM_MD5_AUTH(self, challenge): + """ Authobject to use with CRAM-MD5 authentication. """ + import hmac + return self.user + " " + hmac.HMAC(self.password, challenge).hexdigest() + + def logout(self): """Shutdown connection to server. *************** *** 512,516 **** """Send NOOP command. ! (typ, data) = .noop() """ if __debug__: --- 530,534 ---- """Send NOOP command. ! (typ, [data]) = .noop() """ if __debug__: *************** *** 532,539 **** def rename(self, oldmailbox, newmailbox): """Rename old mailbox name to new. ! (typ, data) = .rename(oldmailbox, newmailbox) """ return self._simple_command('RENAME', oldmailbox, newmailbox) --- 550,570 ---- + def proxyauth(self, user): + """Assume authentication as "user". + + Allows an authorised administrator to proxy into any user's + mailbox. + + (typ, [data]) = .proxyauth(user) + """ + + name = 'PROXYAUTH' + return self._simple_command('PROXYAUTH', user) + + def rename(self, oldmailbox, newmailbox): """Rename old mailbox name to new. ! (typ, [data]) = .rename(oldmailbox, newmailbox) """ return self._simple_command('RENAME', oldmailbox, newmailbox) *************** *** 1108,1111 **** --- 1139,1194 ---- + class IMAP4_stream(IMAP4): + + """IMAP4 client class over a stream + + Instantiate with: IMAP4_stream(command) + + where "command" is a string that can be passed to os.popen2() + + for more documentation see the docstring of the parent class IMAP4. + """ + + + def __init__(self, command): + self.command = command + IMAP4.__init__(self) + + + def open(self, host = None, port = None): + """Setup a stream connection. + This connection will be used by the routines: + read, readline, send, shutdown. + """ + self.host = None # For compatibility with parent class + self.port = None + self.sock = None + self.file = None + self.writefile, self.readfile = os.popen2(self.command) + + + def read(self, size): + """Read 'size' bytes from remote.""" + return self.readfile.read(size) + + + def readline(self): + """Read line from remote.""" + return self.readfile.readline() + + + def send(self, data): + """Send data to remote.""" + self.writefile.write(data) + self.writefile.flush() + + + def shutdown(self): + """Close I/O established in "open".""" + self.readfile.close() + self.writefile.close() + + + class _Authenticator: *************** *** 1252,1265 **** if __name__ == '__main__': import getopt, getpass try: ! optlist, args = getopt.getopt(sys.argv[1:], 'd:') except getopt.error, val: ! pass for opt,val in optlist: if opt == '-d': Debug = int(val) if not args: args = ('',) --- 1335,1356 ---- if __name__ == '__main__': + # To test: invoke either as 'python imaplib.py [IMAP4_server_hostname]' + # or 'python imaplib.py -s "rsh IMAP4_server_hostname exec /etc/rimapd"' + # to test the IMAP4_stream class + import getopt, getpass try: ! optlist, args = getopt.getopt(sys.argv[1:], 'd:s:') except getopt.error, val: ! optlist, args = (), () + stream_command = None for opt,val in optlist: if opt == '-d': Debug = int(val) + elif opt == '-s': + stream_command = val + if not args: args = (stream_command,) if not args: args = ('',) *************** *** 1302,1309 **** typ, dat = apply(getattr(M, cmd), args) M._mesg('%s => %s %s' % (cmd, typ, dat)) return dat try: ! M = IMAP4(host) M._mesg('PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION) M._mesg('CAPABILITIES = %s' % `M.capabilities`) --- 1393,1406 ---- typ, dat = apply(getattr(M, cmd), args) M._mesg('%s => %s %s' % (cmd, typ, dat)) + if typ == 'NO': raise dat[0] return dat try: ! if stream_command: ! M = IMAP4_stream(stream_command) ! else: ! M = IMAP4(host) ! if M.state == 'AUTH': ! test_seq1 = test_seq1[1:] # Login not needed M._mesg('PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION) M._mesg('CAPABILITIES = %s' % `M.capabilities`) From loewis@users.sourceforge.net Fri Nov 22 08:08:45 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 22 Nov 2002 00:08:45 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libsocksvr.tex,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv2547/Doc/lib Modified Files: libsocksvr.tex Log Message: Patch #550765: Add daemon_threads flag. Index: libsocksvr.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocksvr.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** libsocksvr.tex 25 Aug 2002 16:27:33 -0000 1.15 --- libsocksvr.tex 22 Nov 2002 08:08:43 -0000 1.16 *************** *** 38,41 **** --- 38,49 ---- many requests. + When inheriting from \class{ThreadingMixIn} for threaded connection + behavior, you should explicitly declare how you want your threads + to behave on an abrupt shutdown. The \class{ThreadingMixIn} class + defines an attribute \var{daemon_threads}, which indicates whether + or not the server should wait for thread termination. You should + set the flag explicitly if you would like threads to behave + autonomously. + Server classes have the same external methods and attributes, no matter what network protocol they use: From loewis@users.sourceforge.net Fri Nov 22 08:08:46 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 22 Nov 2002 00:08:46 -0800 Subject: [Python-checkins] python/dist/src/Lib SocketServer.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv2547/Lib Modified Files: SocketServer.py Log Message: Patch #550765: Add daemon_threads flag. Index: SocketServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/SocketServer.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** SocketServer.py 25 Aug 2002 16:36:49 -0000 1.32 --- SocketServer.py 22 Nov 2002 08:08:43 -0000 1.33 *************** *** 57,61 **** The Mix-in class must come first, since it overrides a method defined ! in UDPServer! To implement a service, you must derive a class from --- 57,62 ---- The Mix-in class must come first, since it overrides a method defined ! in UDPServer! Setting the various member variables also changes ! the behavior of the underlying server mechanism. To implement a service, you must derive a class from *************** *** 449,452 **** --- 450,457 ---- """Mix-in class to handle each request in a new thread.""" + # Decides how threads will act upon termination of the + # main process + daemon_threads = 0 + def process_request_thread(self, request, client_address): """Same as in BaseServer but as a thread. *************** *** 467,470 **** --- 472,477 ---- t = threading.Thread(target = self.process_request_thread, args = (request, client_address)) + if self.daemon_threads: + t.setDaemon (1) t.start() From loewis@users.sourceforge.net Fri Nov 22 08:08:47 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 22 Nov 2002 00:08:47 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.531,1.532 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv2547/Misc Modified Files: NEWS Log Message: Patch #550765: Add daemon_threads flag. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.531 retrieving revision 1.532 diff -C2 -d -r1.531 -r1.532 *** NEWS 21 Nov 2002 21:45:32 -0000 1.531 --- NEWS 22 Nov 2002 08:08:44 -0000 1.532 *************** *** 390,393 **** --- 390,399 ---- ------- + - When cancelling a server that implemented threading with a keyboard + interrupt, the server would shut down but not terminate (waiting on + client threads). A new member variable, daemon_threads, was added to + the ThreadingMixIn class in SocketServer.py to make it explicit that + this behavior needs to be controlled. + - A new module, optparse, provides a fancy alternative to getopt for command line parsing. It is a slightly modified version of Greg From loewis@users.sourceforge.net Fri Nov 22 08:23:11 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 22 Nov 2002 00:23:11 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libdoctest.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv10492/Doc/lib Modified Files: libdoctest.tex Log Message: Patch #486438: Make module argument to testmod optional. Index: libdoctest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdoctest.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** libdoctest.tex 2 Oct 2001 21:01:22 -0000 1.9 --- libdoctest.tex 22 Nov 2002 08:23:09 -0000 1.10 *************** *** 153,156 **** --- 153,160 ---- \end{verbatim} + If you want to test the module as the main module, you don't need to + pass M to \function{testmod}; in this case, it will test the current + module. + Then running the module as a script causes the examples in the docstrings to get executed and verified: *************** *** 393,397 **** def _test(): import doctest, sys ! doctest.testmod(sys.modules["__main__"]) \end{verbatim} \end{enumerate} --- 397,401 ---- def _test(): import doctest, sys ! doctest.testmod() \end{verbatim} \end{enumerate} From loewis@users.sourceforge.net Fri Nov 22 08:23:11 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 22 Nov 2002 00:23:11 -0800 Subject: [Python-checkins] python/dist/src/Lib doctest.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv10492/Lib Modified Files: doctest.py Log Message: Patch #486438: Make module argument to testmod optional. Index: doctest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** doctest.py 1 Jun 2002 14:18:45 -0000 1.24 --- doctest.py 22 Nov 2002 08:23:09 -0000 1.25 *************** *** 1045,1054 **** master = None ! def testmod(m, name=None, globs=None, verbose=None, isprivate=None, report=1): ! """m, name=None, globs=None, verbose=None, isprivate=None, report=1 ! Test examples in docstrings in functions and classes reachable from ! module m, starting with m.__doc__. Private names are skipped. Also test examples reachable from dict m.__test__ if it exists and is --- 1045,1055 ---- master = None ! def testmod(m=None, name=None, globs=None, verbose=None, isprivate=None, report=1): ! """m=None, name=None, globs=None, verbose=None, isprivate=None, report=1 ! Test examples in docstrings in functions and classes reachable ! from module m (or the current module if m is not supplied), starting ! with m.__doc__. Private names are skipped. Also test examples reachable from dict m.__test__ if it exists and is *************** *** 1090,1093 **** --- 1091,1101 ---- global master + + if m is None: + import sys + # DWA - m will still be None if this wasn't invoked from the command + # line, in which case the following TypeError is about as good an error + # as we should expect + m = sys.modules.get('__main__') if not _ismodule(m): From loewis@users.sourceforge.net Fri Nov 22 08:23:11 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 22 Nov 2002 00:23:11 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.532,1.533 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv10492/Misc Modified Files: NEWS Log Message: Patch #486438: Make module argument to testmod optional. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.532 retrieving revision 1.533 diff -C2 -d -r1.532 -r1.533 *** NEWS 22 Nov 2002 08:08:44 -0000 1.532 --- NEWS 22 Nov 2002 08:23:09 -0000 1.533 *************** *** 390,393 **** --- 390,396 ---- ------- + - doctest.testmod can now be called without argument, which means to + test the current module. + - When cancelling a server that implemented threading with a keyboard interrupt, the server would shut down but not terminate (waiting on From loewis@users.sourceforge.net Fri Nov 22 08:36:56 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 22 Nov 2002 00:36:56 -0800 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.216,1.217 NEWS,1.533,1.534 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv18615/Misc Modified Files: ACKS NEWS Log Message: Patch #494845: Support string concatenation, detect non-string data, add globbing support, find modules by name instead of by file. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.216 retrieving revision 1.217 diff -C2 -d -r1.216 -r1.217 *** ACKS 21 Nov 2002 21:45:32 -0000 1.216 --- ACKS 22 Nov 2002 08:36:54 -0000 1.217 *************** *** 221,224 **** --- 221,225 ---- Chris Herborth Ivan Herman + Jürgen Hermann Gary Herron Bernhard Herzog Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.533 retrieving revision 1.534 diff -C2 -d -r1.533 -r1.534 *** NEWS 22 Nov 2002 08:23:09 -0000 1.533 --- NEWS 22 Nov 2002 08:36:54 -0000 1.534 *************** *** 622,625 **** --- 622,628 ---- ----------- + - pygettext.py now supports globbing on Windows, and accepts module + names in addition to accepting file names. + - The SGI demos (Demo/sgi) have been removed. Nobody thought they were interesting any more. (The SGI library modules and extensions From loewis@users.sourceforge.net Fri Nov 22 08:36:56 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 22 Nov 2002 00:36:56 -0800 Subject: [Python-checkins] python/dist/src/Tools/i18n pygettext.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/i18n In directory sc8-pr-cvs1:/tmp/cvs-serv18615/Tools/i18n Modified Files: pygettext.py Log Message: Patch #494845: Support string concatenation, detect non-string data, add globbing support, find modules by name instead of by file. Index: pygettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/i18n/pygettext.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** pygettext.py 27 Jul 2001 16:47:18 -0000 1.21 --- pygettext.py 22 Nov 2002 08:36:54 -0000 1.22 *************** *** 1,30 **** #! /usr/bin/env python # Originally written by Barry Warsaw # # Minimally patched to make it even more xgettext compatible # by Peter Funk ! """pygettext -- Python equivalent of xgettext(1) Many systems (Solaris, Linux, Gnu) provide extensive tools that ease the ! internationalization of C programs. Most of these tools are independent of ! the programming language and can be used from within Python programs. Martin ! von Loewis' work[1] helps considerably in this regard. There's one problem though; xgettext is the program that scans source code ! looking for message strings, but it groks only C (or C++). Python introduces ! a few wrinkles, such as dual quoting characters, triple quoted strings, and ! raw strings. xgettext understands none of this. ! Enter pygettext, which uses Python's standard tokenize module to scan Python ! source code, generating .pot files identical to what GNU xgettext[2] generates ! for C and C++ code. From there, the standard GNU tools can be used. ! A word about marking Python strings as candidates for translation. GNU ! xgettext recognizes the following keywords: gettext, dgettext, dcgettext, and ! gettext_noop. But those can be a lot of text to include all over your code. ! C and C++ have a trick: they use the C preprocessor. Most internationalized C ! source includes a #define for gettext() to _() so that what has to be written ! in the source is much less. Thus these are both translatable strings: gettext("Translatable String") --- 1,48 ---- #! /usr/bin/env python + # -*- coding: iso-8859-1 -*- # Originally written by Barry Warsaw # # Minimally patched to make it even more xgettext compatible # by Peter Funk + # + # 2002-11-22 Jürgen Hermann + # Added checks that _() only contains string literals, and + # command line args are resolved to module lists, i.e. you + # can now pass a filename, a module or package name, or a + # directory (including globbing chars, important for Win32). + # Made docstring fit in 80 chars wide displays using pydoc. + # ! # for selftesting ! try: ! import fintl ! _ = fintl.gettext ! except ImportError: ! _ = lambda s: s ! ! __doc__ = _("""pygettext -- Python equivalent of xgettext(1) Many systems (Solaris, Linux, Gnu) provide extensive tools that ease the ! internationalization of C programs. Most of these tools are independent of ! the programming language and can be used from within Python programs. ! Martin von Loewis' work[1] helps considerably in this regard. There's one problem though; xgettext is the program that scans source code ! looking for message strings, but it groks only C (or C++). Python ! introduces a few wrinkles, such as dual quoting characters, triple quoted ! strings, and raw strings. xgettext understands none of this. ! Enter pygettext, which uses Python's standard tokenize module to scan ! Python source code, generating .pot files identical to what GNU xgettext[2] ! generates for C and C++ code. From there, the standard GNU tools can be ! used. ! A word about marking Python strings as candidates for translation. GNU ! xgettext recognizes the following keywords: gettext, dgettext, dcgettext, ! and gettext_noop. But those can be a lot of text to include all over your ! code. C and C++ have a trick: they use the C preprocessor. Most ! internationalized C source includes a #define for gettext() to _() so that ! what has to be written in the source is much less. Thus these are both ! translatable strings: gettext("Translatable String") *************** *** 38,46 **** [2] http://www.gnu.org/software/gettext/gettext.html ! NOTE: pygettext attempts to be option and feature compatible with GNU xgettext ! where ever possible. However some options are still missing or are not fully ! implemented. Also, xgettext's use of command line switches with option ! arguments is broken, and in these cases, pygettext just defines additional ! switches. Usage: pygettext [options] inputfile ... --- 56,64 ---- [2] http://www.gnu.org/software/gettext/gettext.html ! NOTE: pygettext attempts to be option and feature compatible with GNU ! xgettext where ever possible. However some options are still missing or are ! not fully implemented. Also, xgettext's use of command line switches with ! option arguments is broken, and in these cases, pygettext just defines ! additional switches. Usage: pygettext [options] inputfile ... *************** *** 62,68 **** -D --docstrings ! Extract module, class, method, and function docstrings. These do not ! need to be wrapped in _() markers, and in fact cannot be for Python to ! consider them docstrings. (See also the -X option). -h --- 80,86 ---- -D --docstrings ! Extract module, class, method, and function docstrings. These do ! not need to be wrapped in _() markers, and in fact cannot be for ! Python to consider them docstrings. (See also the -X option). -h *************** *** 136,140 **** If `inputfile' is -, standard input is read. ! """ import os --- 154,158 ---- If `inputfile' is -, standard input is read. ! """) import os *************** *** 142,156 **** import time import getopt import tokenize import operator ! # for selftesting ! try: ! import fintl ! _ = fintl.gettext ! except ImportError: ! def _(s): return s ! ! __version__ = '1.4' default_keywords = ['_'] --- 160,168 ---- import time import getopt + import token import tokenize import operator ! __version__ = '1.5' default_keywords = ['_'] *************** *** 184,188 **** def usage(code, msg=''): ! print >> sys.stderr, _(__doc__) % globals() if msg: print >> sys.stderr, msg --- 196,200 ---- def usage(code, msg=''): ! print >> sys.stderr, __doc__ % globals() if msg: print >> sys.stderr, msg *************** *** 243,246 **** --- 255,355 ---- return s + + def containsAny(str, set): + """ Check whether 'str' contains ANY of the chars in 'set' + """ + return 1 in [c in str for c in set] + + + def _visit_pyfiles(list, dirname, names): + """ Helper for getFilesForName(). + """ + # get extension for python source files + if not globals().has_key('_py_ext'): + import imp + global _py_ext + _py_ext = [triple[0] for triple in imp.get_suffixes() if triple[2] == imp.PY_SOURCE][0] + + # don't recurse into CVS directories + if 'CVS' in names: + names.remove('CVS') + + # add all *.py files to list + list.extend( + [os.path.join(dirname, file) + for file in names + if os.path.splitext(file)[1] == _py_ext]) + + + def _get_modpkg_path(dotted_name, pathlist=None): + """ Get the filesystem path for a module or a package. + + Return the file system path to a file for a module, + and to a directory for a package. Return None if + the name is not found, or is a builtin or extension module. + """ + import imp + + # split off top-most name + parts = dotted_name.split('.', 1) + + if len(parts) > 1: + # we have a dotted path, import top-level package + try: + file, pathname, description = imp.find_module(parts[0], pathlist) + if file: file.close() + except ImportError: + return None + + # check if it's indeed a package + if description[2] == imp.PKG_DIRECTORY: + # recursively handle the remaining name parts + pathname = _get_modpkg_path(parts[1], [pathname]) + else: + pathname = None + else: + # plain name + try: + file, pathname, description = imp.find_module(dotted_name, pathlist) + if file: file.close() + if description[2] not in [imp.PY_SOURCE, imp.PKG_DIRECTORY]: + pathname = None + except ImportError: + pathname = None + + return pathname + + + def getFilesForName(name): + """ Get a list of module files for a filename, a module or package name, + or a directory. + """ + import imp + + if not os.path.exists(name): + # check for glob chars + if containsAny(name, "*?[]"): + import glob + files = glob.glob(name) + list = [] + for file in files: + list.extend(getFilesForName(file)) + return list + + # try to find module or package + name = _get_modpkg_path(name) + if not name: + return [] + + if os.path.isdir(name): + # find all python files in directory + list = [] + os.path.walk(name, _visit_pyfiles, list) + return list + elif os.path.exists(name): + # a single file + return [name] + + return [] *************** *** 315,319 **** elif ttype == tokenize.STRING: self.__data.append(safe_eval(tstring)) ! # TBD: should we warn if we seen anything else? def __addentry(self, msg, lineno=None, isdocstring=0): --- 424,433 ---- elif ttype == tokenize.STRING: self.__data.append(safe_eval(tstring)) ! elif ttype not in [tokenize.COMMENT, token.INDENT, token.DEDENT, ! token.NEWLINE, tokenize.NL]: ! # warn if we see anything else than STRING or whitespace ! print >>sys.stderr, _('*** %(file)s:%(lineno)s: Seen unexpected token "%(token)s"') % { ! 'token': tstring, 'file': self.__curfile, 'lineno': self.__lineno} ! self.__state = self.__waiting def __addentry(self, msg, lineno=None, isdocstring=0): *************** *** 496,499 **** --- 610,622 ---- options.toexclude = [] + # resolve args to module lists + expanded = [] + for arg in args: + if arg == '-': + expanded.append(arg) + else: + expanded.extend(getFilesForName(arg)) + args = expanded + # slurp through all the files eater = TokenEater(options) *************** *** 540,541 **** --- 663,667 ---- # some more test strings _(u'a unicode string') + _('*** Seen unexpected token "%(token)s"' % {'token': 'test'}) # this one creates a warning + _('more' 'than' 'one' 'string') + From loewis@users.sourceforge.net Fri Nov 22 09:10:35 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 22 Nov 2002 01:10:35 -0800 Subject: [Python-checkins] python/dist/src/Tools/scripts trace.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv5383 Modified Files: trace.py Log Message: Patch #542562, file 25252: Remove changelog. Index: trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/trace.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** trace.py 11 Sep 2002 20:36:01 -0000 1.9 --- trace.py 22 Nov 2002 09:10:33 -0000 1.10 *************** *** 28,69 **** # distribution of the software without specific, written prior permission. # - # - # Cleaned up the usage message --GvR 11/28/01 - # - # Summary of even more recent changes, --Zooko 2001-10-14 - # Used new `inspect' module for better (?) determination of file<->module - # mappings, line numbers, and source code. - # Used new local trace function for faster (and better?) operation. - # Removed "speed hack", which, as far as I can tell, meant that it would - # ignore all files ??? (When I tried it, it would ignore only *most* of my - # files. In any case with the speed hack removed in favor of actually - # calling `Ignore.names()', it ignores only those files that I told it to - # ignore, so I am happy.) - # Rolled the `Coverage' class into `Trace', which now does either tracing or - # counting or both according to constructor flags. - # Moved the construction of the `Ignore' object inside the constructor of - # `Trace', simplifying usage. - # Changed function `create_results_log()' into method - # `CoverageResults.write_results()'. - # Add new mode "countfuncs" which is faster and which just reports which - # functions were invoked. - - # Made `write_results' create `coverdir' if it doesn't already exist. - # Moved the `run' funcs into `Trace' for simpler usage. - # Use pickle instead of marshal for persistence. - # - # Summary of recent changes: - # Support for files with the same basename (submodules in packages) - # Expanded the idea of how to ignore files or modules - # Split tracing and counting into different classes - # Extracted count information and reporting from the count class - # Added some ability to detect which missing lines could be executed - # Added pseudo-pragma to prohibit complaining about unexecuted lines - # Rewrote the main program - - # Summary of older changes: - # Added run-time display of statements being executed - # Incorporated portability and performance fixes from Greg Stein - # Incorporated main program from Michael Scharf """ --- 28,31 ---- From jvr@users.sourceforge.net Fri Nov 22 11:10:51 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 22 Nov 2002 03:10:51 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts buildappbundle.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv30942 Modified Files: buildappbundle.py Log Message: Replaced the bundle building code with calls to the new bundlebuilder module. Jack: I've compared the .app output of the orginal with the new and I can't find any significant differences. However, bundlebuilder.py contains its' own command line interface and I think we should use that instead. I'll have a look to see whether I can patch Mac/OSX/Makefile.jaguar to this effect. Index: buildappbundle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/buildappbundle.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** buildappbundle.py 15 Nov 2002 00:07:31 -0000 1.2 --- buildappbundle.py 22 Nov 2002 11:10:49 -0000 1.3 *************** *** 1,137 **** import sys import os - import shutil import getopt - def buildappbundle(executable, output=None, copyfunc=None, creator=None, - plist=None, nib=None, resources=None): - if not output: - output = os.path.split(executable)[1] + '.app' - if not copyfunc: - copyfunc = shutil.copy2 - if not creator: - creator='????' - if not resources: - resources = [] - if nib: - resources = resources + [nib] - # - # Create the main directory structure - # - if not os.path.isdir(output): - os.mkdir(output) - contents = os.path.join(output, 'Contents') - if not os.path.isdir(contents): - os.mkdir(contents) - macos = os.path.join(contents, 'MacOS') - if not os.path.isdir(macos): - os.mkdir(macos) - # - # Create the executable - # - shortname = os.path.split(executable)[1] - execname = os.path.join(macos, shortname) - try: - os.remove(execname) - except OSError: - pass - copyfunc(executable, execname) - # - # Create the PkgInfo file - # - pkginfo = os.path.join(contents, 'PkgInfo') - open(pkginfo, 'wb').write('APPL'+creator) - if plist: - # A plist file is specified. Read it. - plistdata = open(plist).read() - else: - # - # If we have a main NIB we create the extra Cocoa specific info for the plist file - # - if not nib: - nibname = "" - else: - nibname, ext = os.path.splitext(os.path.split(nib)[1]) - if ext == '.lproj': - # Special case: if the main nib is a .lproj we assum a directory - # and use the first nib from there - files = os.listdir(nib) - for f in files: - if f[-4:] == '.nib': - nibname = os.path.split(f)[1][:-4] - break - else: - nibname = "" - if nibname: - cocoainfo = """ - NSMainNibFile - %s - NSPrincipalClass - NSApplication""" % nibname - else: - cocoainfo = "" - plistdata = \ - """ - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - %s - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleSignature - %s - CFBundleVersion - 0.1 - %s - - - """ % (shortname, creator, cocoainfo) - # - # Next, we create the plist file - # - infoplist = os.path.join(contents, 'Info.plist') - open(infoplist, 'w').write(plistdata) - # - # Finally, if there are nibs or other resources to copy we do so. - # - if resources: - resdir = os.path.join(contents, 'Resources') - if not os.path.isdir(resdir): - os.mkdir(resdir) - for src in resources: - dst = os.path.join(resdir, os.path.split(src)[1]) - if os.path.isdir(src): - shutil.copytree(src, dst) - else: - shutil.copy2(src, dst) - def usage(): ! print "buildappbundle creates an application bundle" ! print "Usage:" ! print " buildappbundle [options] executable" ! print "Options:" ! print " --output o Output file; default executable with .app appended, short -o" ! print " --link Symlink the executable (default: copy), short -l" ! print " --plist file Plist file (default: generate one), short -p" ! print " --nib file Main nib file or lproj folder for Cocoa program, short -n" ! print " --resource r Extra resource file to be copied to Resources, short -r" ! print " --creator c 4-char creator code (default: ????), short -c" ! print " --help This message, short -?" sys.exit(1) def main(): ! output=None ! copyfunc=None ! creator=None ! plist=None ! nib=None ! resources=[] ! SHORTOPTS = "o:ln:r:p:c:?" ! LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) --- 1,47 ---- + #! /usr/bin/env python + + # XXX This will be replaced by a main program in Mac/Lib/bundlebuilder.py, + # but for now this is kept so Jack won't need to change his scripts... + + + """\ + buildappbundle creates an application bundle + Usage: + buildappbundle [options] executable + Options: + --output o Output file; default executable with .app appended, short -o + --link Symlink files instead of copying them, short -l + --plist file Plist file (default: generate one), short -p + --nib file Main nib file or lproj folder for Cocoa program, short -n + --resource r Extra resource file to be copied to Resources, short -r + --creator c 4-char creator code (default: '????'), short -c + --verbose increase verbosity level (default: quiet), short -v + --help This message, short -? or -h + """ + + import sys import os import getopt + from bundlebuilder import AppBuilder + from plistlib import Plist + def usage(): ! print __doc__ sys.exit(1) + def main(): ! output = None ! symlink = 0 ! creator = "????" ! plist = None ! nib = None ! resources = [] ! verbosity = 0 ! SHORTOPTS = "o:ln:r:p:c:v?h" ! LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help", ! "verbose") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) *************** *** 140,148 **** if len(args) != 1: usage() for opt, arg in options: if opt in ('-o', '--output'): output = arg elif opt in ('-l', '--link'): ! copyfunc = os.symlink elif opt in ('-n', '--nib'): nib = arg --- 50,59 ---- if len(args) != 1: usage() + executable = args[0] for opt, arg in options: if opt in ('-o', '--output'): output = arg elif opt in ('-l', '--link'): ! symlink = 1 elif opt in ('-n', '--nib'): nib = arg *************** *** 153,162 **** elif opt in ('-p', '--plist'): plist = arg ! elif opt in ('-?', '--help'): usage() ! buildappbundle(args[0], output=output, copyfunc=copyfunc, creator=creator, ! plist=plist, resources=resources) ! if __name__ == '__main__': main() - \ No newline at end of file --- 64,104 ---- elif opt in ('-p', '--plist'): plist = arg ! elif opt in ('-v', '--verbose'): ! verbosity += 1 ! elif opt in ('-?', '-h', '--help'): usage() ! if output is not None: ! builddir, bundlename = os.path.split(output) ! else: ! builddir = os.curdir ! bundlename = None # will be derived from executable ! if plist is not None: ! plist = Plist.fromFile(plist) ! ! builder = AppBuilder(name=bundlename, executable=executable, ! builddir=builddir, creator=creator, plist=plist, resources=resources, ! symlink=symlink, verbosity=verbosity) ! ! if nib is not None: ! resources.append(nib) ! nibname, ext = os.path.splitext(os.path.basename(nib)) ! if ext == '.lproj': ! # Special case: if the main nib is a .lproj we assum a directory ! # and use the first nib from there. XXX Look: an arbitrary pick ;-) ! files = os.listdir(nib) ! for f in files: ! if f[-4:] == '.nib': ! nibname = os.path.split(f)[1][:-4] ! break ! else: ! nibname = "" ! if nibname: ! builder.plist.NSMainNibFile = nibname ! if not hasattr(builder.plist, "NSPrincipalClass"): ! builder.plist.NSPrincipalClass = "NSApplication" ! builder.setup() ! builder.build() ! ! if __name__ == '__main__': main() From jvr@users.sourceforge.net Fri Nov 22 11:43:12 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 22 Nov 2002 03:43:12 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib bundlebuilder.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv5099 Modified Files: bundlebuilder.py Log Message: Added --link-exec option: make a symlink for the executable only, copy all other files. Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/bundlebuilder.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** bundlebuilder.py 22 Nov 2002 00:31:50 -0000 1.4 --- bundlebuilder.py 22 Nov 2002 11:43:10 -0000 1.5 *************** *** 213,216 **** --- 213,217 ---- nibname: The name of the main nib, for Cocoa apps. Defaults to None, but must be specified when building a Cocoa app. + symlink_exec: Symlink the executable instead of copying it. For the other keyword arguments see the BundleBuilder doc string. *************** *** 218,226 **** def __init__(self, name=None, mainprogram=None, executable=None, ! nibname=None, **kwargs): """See the class doc string for a description of the arguments.""" self.mainprogram = mainprogram self.executable = executable self.nibname = nibname BundleBuilder.__init__(self, name=name, **kwargs) --- 219,228 ---- def __init__(self, name=None, mainprogram=None, executable=None, ! nibname=None, symlink_exec=0, **kwargs): """See the class doc string for a description of the arguments.""" self.mainprogram = mainprogram self.executable = executable self.nibname = nibname + self.symlink_exec = symlink_exec BundleBuilder.__init__(self, name=name, **kwargs) *************** *** 255,259 **** else: execpath = pathjoin(resdir, os.path.basename(self.executable)) ! self.files.append((self.executable, execpath)) # For execve wrapper setexecutable = setExecutableTemplate % os.path.basename(self.executable) --- 257,264 ---- else: execpath = pathjoin(resdir, os.path.basename(self.executable)) ! if not self.symlink_exec: ! self.files.append((self.executable, execpath)) ! else: ! self.execpath = execpath # For execve wrapper setexecutable = setExecutableTemplate % os.path.basename(self.executable) *************** *** 273,276 **** --- 278,289 ---- os.chmod(mainwrapperpath, 0777) + def postProcess(self): + if self.symlink_exec and self.executable: + self.message("Symlinking executable %s to %s" % (self.executable, + self.execpath), 2) + dst = pathjoin(self.bundlepath, self.execpath) + makedirs(os.path.dirname(dst)) + os.symlink(os.path.abspath(self.executable), dst) + def copy(src, dst, mkdirs=0): *************** *** 330,333 **** --- 343,347 ---- -c, --creator=CCCC 4-char creator code (default: '????') -l, --link symlink files/folder instead of copying them + --link-exec symlink the executable instead of copying it -v, --verbose increase verbosity level -q, --quiet decrease verbosity level *************** *** 347,352 **** shortopts = "b:n:r:e:m:c:plhvq" longopts = ("builddir=", "name=", "resource=", "executable=", ! "mainprogram=", "creator=", "nib=", "plist=", "link", "help", ! "verbose", "quiet") try: --- 361,366 ---- shortopts = "b:n:r:e:m:c:plhvq" longopts = ("builddir=", "name=", "resource=", "executable=", ! "mainprogram=", "creator=", "nib=", "plist=", "link", ! "link-exec", "help", "verbose", "quiet") try: *************** *** 374,377 **** --- 388,393 ---- elif opt in ('-l', '--link'): builder.symlink = 1 + elif opt == '--link-exec': + builder.symlink_exec = 1 elif opt in ('-h', '--help'): usage() From jvr@users.sourceforge.net Fri Nov 22 11:45:44 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 22 Nov 2002 03:45:44 -0800 Subject: [Python-checkins] python/dist/src/Mac/scripts buildappbundle.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv7721 Modified Files: buildappbundle.py Log Message: make the --link option match the original: just symlink the executable Index: buildappbundle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/buildappbundle.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** buildappbundle.py 22 Nov 2002 11:10:49 -0000 1.3 --- buildappbundle.py 22 Nov 2002 11:45:42 -0000 1.4 *************** *** 11,15 **** Options: --output o Output file; default executable with .app appended, short -o ! --link Symlink files instead of copying them, short -l --plist file Plist file (default: generate one), short -p --nib file Main nib file or lproj folder for Cocoa program, short -n --- 11,15 ---- Options: --output o Output file; default executable with .app appended, short -o ! --link Symlink the executable instead of copying it, short -l --plist file Plist file (default: generate one), short -p --nib file Main nib file or lproj folder for Cocoa program, short -n *************** *** 78,82 **** builder = AppBuilder(name=bundlename, executable=executable, builddir=builddir, creator=creator, plist=plist, resources=resources, ! symlink=symlink, verbosity=verbosity) if nib is not None: --- 78,82 ---- builder = AppBuilder(name=bundlename, executable=executable, builddir=builddir, creator=creator, plist=plist, resources=resources, ! symlink_exec=symlink, verbosity=verbosity) if nib is not None: From jvr@users.sourceforge.net Fri Nov 22 11:52:17 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 22 Nov 2002 03:52:17 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile.jaguar,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv10506 Modified Files: Makefile.jaguar Log Message: changed to use Lib/bundlebuilder.py instead of scripts/buildappbundle.py Index: Makefile.jaguar =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile.jaguar,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.jaguar 20 Nov 2002 14:06:16 -0000 1.2 --- Makefile.jaguar 22 Nov 2002 11:52:15 -0000 1.3 *************** *** 20,25 **** MACDYNLIBDEST=$(datadir)/lib-dynload MACTOOLSDEST=$(datadir)/Tools ! APPINSTALLDIR=$(datadir)/Python.app ! INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/python # The usual stuff --- 20,26 ---- MACDYNLIBDEST=$(datadir)/lib-dynload MACTOOLSDEST=$(datadir)/Tools ! APPNAME=Python ! APPBUNDLENAME=$(APPNAME).app ! INSTALLED_PYTHONW=$(datadir)/$(APPBUNDLENAME)/Contents/MacOS/$(APPNAME) # The usual stuff *************** *** 67,75 **** install_Python: ! $(PYTHON) $(srcdir)/Mac/scripts/buildappbundle.py -l \ ! -o $(APPINSTALLDIR) \ -r $(srcdir)/Mac/OSXResources/app/Resources/Applet-Info.plist \ -r $(srcdir)/Mac/OSXResources/app/Resources/PythonApplet.icns \ ! $(PYTHON) install_IDE: --- 68,78 ---- install_Python: ! $(PYTHON) $(srcdir)/Mac/Lib/bundlebuilder.py -q --link-exec \ ! -b $(datadir) \ ! -n $(APPBUNDLENAME) \ -r $(srcdir)/Mac/OSXResources/app/Resources/Applet-Info.plist \ -r $(srcdir)/Mac/OSXResources/app/Resources/PythonApplet.icns \ ! -e $(PYTHON) \ ! build install_IDE: From effbot@users.sourceforge.net Fri Nov 22 12:46:38 2002 From: effbot@users.sourceforge.net (effbot@users.sourceforge.net) Date: Fri, 22 Nov 2002 04:46:38 -0800 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.86,2.87 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv30149/Modules Modified Files: _sre.c Log Message: fix for SF #635398 (don't "downcast" return strings from unicode to ascii) Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.86 retrieving revision 2.87 diff -C2 -d -r2.86 -r2.87 *** _sre.c 10 Nov 2002 14:33:25 -0000 2.86 --- _sre.c 22 Nov 2002 12:46:35 -0000 2.87 *************** *** 7,41 **** * 1999-10-24 fl created (based on existing template matcher code) * 2000-03-06 fl first alpha, sort of - * 2000-06-30 fl added fast search optimization - * 2000-06-30 fl added assert (lookahead) primitives, etc - * 2000-07-02 fl added charset optimizations, etc - * 2000-07-03 fl store code in pattern object, lookbehind, etc - * 2000-07-08 fl added regs attribute - * 2000-07-21 fl reset lastindex in scanner methods * 2000-08-01 fl fixes for 1.6b1 - * 2000-08-03 fl added recursion limit * 2000-08-07 fl use PyOS_CheckStack() if available - * 2000-08-08 fl changed findall to return empty strings instead of None - * 2000-08-27 fl properly propagate memory errors - * 2000-09-02 fl return -1 instead of None for start/end/span * 2000-09-20 fl added expand method - * 2000-09-21 fl don't use the buffer interface for unicode strings - * 2000-10-03 fl fixed assert_not primitive; support keyword arguments - * 2000-10-24 fl really fixed assert_not; reset groups in findall - * 2000-12-21 fl fixed memory leak in groupdict - * 2001-01-02 fl properly reset pointer after failed assertion in MIN_UNTIL - * 2001-01-15 fl avoid recursion for MIN_UNTIL; fixed uppercase literal bug - * 2001-01-16 fl fixed memory leak in pattern destructor * 2001-03-20 fl lots of fixes for 2.1b2 * 2001-04-15 fl export copyright as Python attribute, not global * 2001-04-28 fl added __copy__ methods (work in progress) ! * 2001-05-14 fl fixes for 1.5.2 * 2001-07-01 fl added BIGCHARSET support (from Martin von Loewis) * 2001-10-18 fl fixed group reset issue (from Matthew Mueller) * 2001-10-20 fl added split primitive; reenable unicode for 1.6/2.0/2.1 * 2001-10-21 fl added sub/subn primitive - * 2001-10-22 fl check for literal sub/subn templates * 2001-10-24 fl added finditer primitive (for 2.2 only) * 2001-12-07 fl fixed memory leak in sub/subn (Guido van Rossum) * * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved. --- 7,24 ---- * 1999-10-24 fl created (based on existing template matcher code) * 2000-03-06 fl first alpha, sort of * 2000-08-01 fl fixes for 1.6b1 * 2000-08-07 fl use PyOS_CheckStack() if available * 2000-09-20 fl added expand method * 2001-03-20 fl lots of fixes for 2.1b2 * 2001-04-15 fl export copyright as Python attribute, not global * 2001-04-28 fl added __copy__ methods (work in progress) ! * 2001-05-14 fl fixes for 1.5.2 compatibility * 2001-07-01 fl added BIGCHARSET support (from Martin von Loewis) * 2001-10-18 fl fixed group reset issue (from Matthew Mueller) * 2001-10-20 fl added split primitive; reenable unicode for 1.6/2.0/2.1 * 2001-10-21 fl added sub/subn primitive * 2001-10-24 fl added finditer primitive (for 2.2 only) * 2001-12-07 fl fixed memory leak in sub/subn (Guido van Rossum) + * 2002-11-09 fl fixed empty sub/subn return type * * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved. *************** *** 53,57 **** static char copyright[] = ! " SRE 2.2.1 Copyright (c) 1997-2001 by Secret Labs AB "; #include "Python.h" --- 36,40 ---- static char copyright[] = ! " SRE 2.2.2 Copyright (c) 1997-2002 by Secret Labs AB "; #include "Python.h" *************** *** 1802,1806 **** case 0: Py_DECREF(list); ! return PyString_FromString(""); case 1: result = PyList_GET_ITEM(list, 0); --- 1785,1789 ---- case 0: Py_DECREF(list); ! return PySequence_GetSlice(pattern, 0, 0); case 1: result = PyList_GET_ITEM(list, 0); From jvr@users.sourceforge.net Fri Nov 22 12:48:50 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 22 Nov 2002 04:48:50 -0800 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PythonIDEMain.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv31273 Modified Files: PythonIDEMain.py Log Message: workaround so the (otherwise still broken) IDE can at least quit in the Python 2.2 Jaguar addon install Index: PythonIDEMain.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDEMain.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** PythonIDEMain.py 20 Oct 2002 17:14:28 -0000 1.23 --- PythonIDEMain.py 22 Nov 2002 12:48:47 -0000 1.24 *************** *** 60,76 **** sys.stderr = debug_stderr for path in sys.argv[1:]: self.opendoc(path) ! try: ! import Wthreading ! except ImportError: ! self.mainloop() ! else: ! if Wthreading.haveThreading: ! self.mainthread = Wthreading.Thread("IDE event loop", self.mainloop) ! self.mainthread.start() ! #self.mainthread.setResistant(1) ! Wthreading.run() ! else: ! self.mainloop() def makeusermenus(self): --- 60,68 ---- sys.stderr = debug_stderr for path in sys.argv[1:]: + if path.startswith("-p"): + # process number added by the OS + continue self.opendoc(path) ! self.mainloop() def makeusermenus(self): *************** *** 274,280 **** def _quit(self): import PyConsole, PyEdit - PyConsole.console.writeprefs() - PyConsole.output.writeprefs() - PyEdit.searchengine.writeprefs() for window in self._windows.values(): try: --- 266,269 ---- *************** *** 284,287 **** --- 273,286 ---- if rv and rv > 0: return + try: + PyConsole.console.writeprefs() + PyConsole.output.writeprefs() + PyEdit.searchengine.writeprefs() + except: + # Write to __stderr__ so the msg end up in Console.app and has + # at least _some_ chance of getting read... + # But: this is a workaround for way more serious problems with + # the Python 2.2 Jaguar addon. + sys.__stderr__.write("*** PythonIDE: Can't write preferences ***\n") self.quitting = 1 From fdrake@users.sourceforge.net Fri Nov 22 14:22:52 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 22 Nov 2002 06:22:52 -0800 Subject: [Python-checkins] python/dist/src/Lib SocketServer.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv11299 Modified Files: SocketServer.py Log Message: Use False instead of 0. Index: SocketServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/SocketServer.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** SocketServer.py 22 Nov 2002 08:08:43 -0000 1.33 --- SocketServer.py 22 Nov 2002 14:22:49 -0000 1.34 *************** *** 452,456 **** # Decides how threads will act upon termination of the # main process ! daemon_threads = 0 def process_request_thread(self, request, client_address): --- 452,456 ---- # Decides how threads will act upon termination of the # main process ! daemon_threads = False def process_request_thread(self, request, client_address): From fdrake@users.sourceforge.net Fri Nov 22 14:28:56 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 22 Nov 2002 06:28:56 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libgettext.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv15778 Modified Files: libgettext.tex Log Message: Fix markup. Index: libgettext.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgettext.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** libgettext.tex 21 Nov 2002 21:45:31 -0000 1.13 --- libgettext.tex 22 Nov 2002 14:28:53 -0000 1.14 *************** *** 579,583 **** \item Peter Funk \item James Henstridge ! \Juan David Ib\'a\~nez Palomar \item Marc-Andr\'e Lemburg \item Martin von L\"owis --- 579,583 ---- \item Peter Funk \item James Henstridge ! \item Juan David Ib\'a\~nez Palomar \item Marc-Andr\'e Lemburg \item Martin von L\"owis From fdrake@users.sourceforge.net Fri Nov 22 14:29:45 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 22 Nov 2002 06:29:45 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libsocksvr.tex,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv16415 Modified Files: libsocksvr.tex Log Message: Clarify the default setting for daemon_threads. Index: libsocksvr.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocksvr.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** libsocksvr.tex 22 Nov 2002 08:08:43 -0000 1.16 --- libsocksvr.tex 22 Nov 2002 14:29:42 -0000 1.17 *************** *** 44,48 **** or not the server should wait for thread termination. You should set the flag explicitly if you would like threads to behave ! autonomously. Server classes have the same external methods and attributes, no --- 44,50 ---- or not the server should wait for thread termination. You should set the flag explicitly if you would like threads to behave ! autonomously; the default is \constant{False}, meaning that Python ! will not exit until all threads created by \class{ThreadingMixIn} have ! exited. Server classes have the same external methods and attributes, no From jackjansen@users.sourceforge.net Fri Nov 22 14:55:07 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 22 Nov 2002 06:55:07 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/file - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/file In directory sc8-pr-cvs1:/tmp/cvs-serv4646/file Log Message: Directory /cvsroot/python/python/dist/src/Mac/Modules/file added to the repository From jackjansen@users.sourceforge.net Fri Nov 22 14:55:07 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 22 Nov 2002 06:55:07 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/folder - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/folder In directory sc8-pr-cvs1:/tmp/cvs-serv4646/folder Log Message: Directory /cvsroot/python/python/dist/src/Mac/Modules/folder added to the repository From jackjansen@users.sourceforge.net Fri Nov 22 14:58:36 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 22 Nov 2002 06:58:36 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.117,1.118 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv6207 Modified Files: setup.py Log Message: Got angry and added support for pretty much the whole file and folder manager. This should allow us the get rid of most of the FSSpecs, only navigation services remains to be done. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -d -r1.117 -r1.118 *** setup.py 19 Nov 2002 08:30:08 -0000 1.117 --- setup.py 22 Nov 2002 14:58:33 -0000 1.118 *************** *** 746,749 **** --- 746,753 ---- exts.append( Extension('_Evt', ['evt/_Evtmodule.c'], extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_File', ['file/_Filemodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Folder', ['folder/_Foldermodule.c'], + extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Fm', ['fm/_Fmmodule.c'], extra_link_args=['-framework', 'Carbon']) ) From jackjansen@users.sourceforge.net Fri Nov 22 14:58:37 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 22 Nov 2002 06:58:37 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib/Carbon File.py,NONE,1.1 Files.py,NONE,1.1 Folder.py,NONE,1.1 Folders.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/Carbon In directory sc8-pr-cvs1:/tmp/cvs-serv6207/Mac/Lib/Carbon Added Files: File.py Files.py Folder.py Folders.py Log Message: Got angry and added support for pretty much the whole file and folder manager. This should allow us the get rid of most of the FSSpecs, only navigation services remains to be done. --- NEW FILE: File.py --- from _File import * --- NEW FILE: Files.py --- # Generated from 'Files.h' def FOUR_CHAR_CODE(x): return x true = True false = False fsCurPerm = 0x00 fsRdPerm = 0x01 fsWrPerm = 0x02 fsRdWrPerm = 0x03 fsRdWrShPerm = 0x04 fsRdDenyPerm = 0x10 fsWrDenyPerm = 0x20 fsRtParID = 1 fsRtDirID = 2 fsAtMark = 0 fsFromStart = 1 fsFromLEOF = 2 fsFromMark = 3 pleaseCacheBit = 4 pleaseCacheMask = 0x0010 noCacheBit = 5 noCacheMask = 0x0020 rdVerifyBit = 6 rdVerifyMask = 0x0040 rdVerify = 64 forceReadBit = 6 forceReadMask = 0x0040 newLineBit = 7 newLineMask = 0x0080 newLineCharMask = 0xFF00 fsSBPartialName = 1 fsSBFullName = 2 fsSBFlAttrib = 4 fsSBFlFndrInfo = 8 fsSBFlLgLen = 32 fsSBFlPyLen = 64 fsSBFlRLgLen = 128 fsSBFlRPyLen = 256 fsSBFlCrDat = 512 fsSBFlMdDat = 1024 fsSBFlBkDat = 2048 fsSBFlXFndrInfo = 4096 fsSBFlParID = 8192 fsSBNegate = 16384 fsSBDrUsrWds = 8 fsSBDrNmFls = 16 fsSBDrCrDat = 512 fsSBDrMdDat = 1024 fsSBDrBkDat = 2048 fsSBDrFndrInfo = 4096 fsSBDrParID = 8192 fsSBPartialNameBit = 0 fsSBFullNameBit = 1 fsSBFlAttribBit = 2 fsSBFlFndrInfoBit = 3 fsSBFlLgLenBit = 5 fsSBFlPyLenBit = 6 fsSBFlRLgLenBit = 7 fsSBFlRPyLenBit = 8 fsSBFlCrDatBit = 9 fsSBFlMdDatBit = 10 fsSBFlBkDatBit = 11 fsSBFlXFndrInfoBit = 12 fsSBFlParIDBit = 13 fsSBNegateBit = 14 fsSBDrUsrWdsBit = 3 fsSBDrNmFlsBit = 4 fsSBDrCrDatBit = 9 fsSBDrMdDatBit = 10 fsSBDrBkDatBit = 11 fsSBDrFndrInfoBit = 12 fsSBDrParIDBit = 13 bLimitFCBs = 31 bLocalWList = 30 bNoMiniFndr = 29 bNoVNEdit = 28 bNoLclSync = 27 bTrshOffLine = 26 bNoSwitchTo = 25 bNoDeskItems = 20 bNoBootBlks = 19 bAccessCntl = 18 bNoSysDir = 17 bHasExtFSVol = 16 bHasOpenDeny = 15 bHasCopyFile = 14 bHasMoveRename = 13 bHasDesktopMgr = 12 bHasShortName = 11 bHasFolderLock = 10 bHasPersonalAccessPrivileges = 9 bHasUserGroupList = 8 bHasCatSearch = 7 bHasFileIDs = 6 bHasBTreeMgr = 5 bHasBlankAccessPrivileges = 4 bSupportsAsyncRequests = 3 bSupportsTrashVolumeCache = 2 bIsEjectable = 0 bSupportsHFSPlusAPIs = 1 bSupportsFSCatalogSearch = 2 bSupportsFSExchangeObjects = 3 bSupports2TBFiles = 4 bSupportsLongNames = 5 bSupportsMultiScriptNames = 6 bSupportsNamedForks = 7 bSupportsSubtreeIterators = 8 bL2PCanMapFileBlocks = 9 bParentModDateChanges = 10 bAncestorModDateChanges = 11 bSupportsSymbolicLinks = 13 bIsAutoMounted = 14 bAllowCDiDataHandler = 17 kLargeIcon = 1 kLarge4BitIcon = 2 kLarge8BitIcon = 3 kSmallIcon = 4 kSmall4BitIcon = 5 kSmall8BitIcon = 6 kicnsIconFamily = 239 kLargeIconSize = 256 kLarge4BitIconSize = 512 kLarge8BitIconSize = 1024 kSmallIconSize = 64 kSmall4BitIconSize = 128 kSmall8BitIconSize = 256 kWidePosOffsetBit = 8 kUseWidePositioning = (1 << kWidePosOffsetBit) kMaximumBlocksIn4GB = 0x007FFFFF fsUnixPriv = 1 kNoUserAuthentication = 1 kPassword = 2 kEncryptPassword = 3 kTwoWayEncryptPassword = 6 kOwnerID2Name = 1 kGroupID2Name = 2 kOwnerName2ID = 3 kGroupName2ID = 4 kReturnNextUser = 1 kReturnNextGroup = 2 kReturnNextUG = 3 kVCBFlagsIdleFlushBit = 3 kVCBFlagsIdleFlushMask = 0x0008 kVCBFlagsHFSPlusAPIsBit = 4 kVCBFlagsHFSPlusAPIsMask = 0x0010 kVCBFlagsHardwareGoneBit = 5 kVCBFlagsHardwareGoneMask = 0x0020 kVCBFlagsVolumeDirtyBit = 15 kVCBFlagsVolumeDirtyMask = 0x8000 kioVAtrbDefaultVolumeBit = 5 kioVAtrbDefaultVolumeMask = 0x0020 kioVAtrbFilesOpenBit = 6 kioVAtrbFilesOpenMask = 0x0040 kioVAtrbHardwareLockedBit = 7 kioVAtrbHardwareLockedMask = 0x0080 kioVAtrbSoftwareLockedBit = 15 kioVAtrbSoftwareLockedMask = 0x8000 kioFlAttribLockedBit = 0 kioFlAttribLockedMask = 0x01 kioFlAttribResOpenBit = 2 kioFlAttribResOpenMask = 0x04 kioFlAttribDataOpenBit = 3 kioFlAttribDataOpenMask = 0x08 kioFlAttribDirBit = 4 kioFlAttribDirMask = 0x10 ioDirFlg = 4 ioDirMask = 0x10 kioFlAttribCopyProtBit = 6 kioFlAttribCopyProtMask = 0x40 kioFlAttribFileOpenBit = 7 kioFlAttribFileOpenMask = 0x80 kioFlAttribInSharedBit = 2 kioFlAttribInSharedMask = 0x04 kioFlAttribMountedBit = 3 kioFlAttribMountedMask = 0x08 kioFlAttribSharePointBit = 5 kioFlAttribSharePointMask = 0x20 kioFCBWriteBit = 8 kioFCBWriteMask = 0x0100 kioFCBResourceBit = 9 kioFCBResourceMask = 0x0200 kioFCBWriteLockedBit = 10 kioFCBWriteLockedMask = 0x0400 kioFCBLargeFileBit = 11 kioFCBLargeFileMask = 0x0800 kioFCBSharedWriteBit = 12 kioFCBSharedWriteMask = 0x1000 kioFCBFileLockedBit = 13 kioFCBFileLockedMask = 0x2000 kioFCBOwnClumpBit = 14 kioFCBOwnClumpMask = 0x4000 kioFCBModifiedBit = 15 kioFCBModifiedMask = 0x8000 kioACUserNoSeeFolderBit = 0 kioACUserNoSeeFolderMask = 0x01 kioACUserNoSeeFilesBit = 1 kioACUserNoSeeFilesMask = 0x02 kioACUserNoMakeChangesBit = 2 kioACUserNoMakeChangesMask = 0x04 kioACUserNotOwnerBit = 7 kioACUserNotOwnerMask = 0x80 kioACAccessOwnerBit = 31 # kioACAccessOwnerMask = (long)0x80000000 kioACAccessBlankAccessBit = 28 kioACAccessBlankAccessMask = 0x10000000 kioACAccessUserWriteBit = 26 kioACAccessUserWriteMask = 0x04000000 kioACAccessUserReadBit = 25 kioACAccessUserReadMask = 0x02000000 kioACAccessUserSearchBit = 24 kioACAccessUserSearchMask = 0x01000000 kioACAccessEveryoneWriteBit = 18 kioACAccessEveryoneWriteMask = 0x00040000 kioACAccessEveryoneReadBit = 17 kioACAccessEveryoneReadMask = 0x00020000 kioACAccessEveryoneSearchBit = 16 kioACAccessEveryoneSearchMask = 0x00010000 kioACAccessGroupWriteBit = 10 kioACAccessGroupWriteMask = 0x00000400 kioACAccessGroupReadBit = 9 kioACAccessGroupReadMask = 0x00000200 kioACAccessGroupSearchBit = 8 kioACAccessGroupSearchMask = 0x00000100 kioACAccessOwnerWriteBit = 2 kioACAccessOwnerWriteMask = 0x00000004 kioACAccessOwnerReadBit = 1 kioACAccessOwnerReadMask = 0x00000002 kioACAccessOwnerSearchBit = 0 kioACAccessOwnerSearchMask = 0x00000001 kfullPrivileges = 0x00070007 kownerPrivileges = 0x00000007 knoUser = 0 kadministratorUser = 1 knoGroup = 0 AppleShareMediaType = FOUR_CHAR_CODE('afpm') volMountNoLoginMsgFlagBit = 0 volMountNoLoginMsgFlagMask = 0x0001 volMountExtendedFlagsBit = 7 volMountExtendedFlagsMask = 0x0080 volMountInteractBit = 15 volMountInteractMask = 0x8000 volMountChangedBit = 14 volMountChangedMask = 0x4000 volMountFSReservedMask = 0x00FF volMountSysReservedMask = 0xFF00 kAFPExtendedFlagsAlternateAddressMask = 1 kAFPTagTypeIP = 0x01 kAFPTagTypeIPPort = 0x02 kAFPTagTypeDDP = 0x03 kAFPTagTypeDNS = 0x04 kAFPTagLengthIP = 0x06 kAFPTagLengthIPPort = 0x08 kAFPTagLengthDDP = 0x06 kFSInvalidVolumeRefNum = 0 kFSCatInfoNone = 0x00000000 kFSCatInfoTextEncoding = 0x00000001 kFSCatInfoNodeFlags = 0x00000002 kFSCatInfoVolume = 0x00000004 kFSCatInfoParentDirID = 0x00000008 kFSCatInfoNodeID = 0x00000010 kFSCatInfoCreateDate = 0x00000020 kFSCatInfoContentMod = 0x00000040 kFSCatInfoAttrMod = 0x00000080 kFSCatInfoAccessDate = 0x00000100 kFSCatInfoBackupDate = 0x00000200 kFSCatInfoPermissions = 0x00000400 kFSCatInfoFinderInfo = 0x00000800 kFSCatInfoFinderXInfo = 0x00001000 kFSCatInfoValence = 0x00002000 kFSCatInfoDataSizes = 0x00004000 kFSCatInfoRsrcSizes = 0x00008000 kFSCatInfoSharingFlags = 0x00010000 kFSCatInfoUserPrivs = 0x00020000 kFSCatInfoAllDates = 0x000003E0 kFSCatInfoGettableInfo = 0x0003FFFF kFSCatInfoSettableInfo = 0x00001FE3 # kFSCatInfoReserved = (long)0xFFFC0000 kFSNodeLockedBit = 0 kFSNodeLockedMask = 0x0001 kFSNodeResOpenBit = 2 kFSNodeResOpenMask = 0x0004 kFSNodeDataOpenBit = 3 kFSNodeDataOpenMask = 0x0008 kFSNodeIsDirectoryBit = 4 kFSNodeIsDirectoryMask = 0x0010 kFSNodeCopyProtectBit = 6 kFSNodeCopyProtectMask = 0x0040 kFSNodeForkOpenBit = 7 kFSNodeForkOpenMask = 0x0080 kFSNodeInSharedBit = 2 kFSNodeInSharedMask = 0x0004 kFSNodeIsMountedBit = 3 kFSNodeIsMountedMask = 0x0008 kFSNodeIsSharePointBit = 5 kFSNodeIsSharePointMask = 0x0020 kFSIterateFlat = 0 kFSIterateSubtree = 1 kFSIterateDelete = 2 # kFSIterateReserved = (long)0xFFFFFFFC fsSBNodeID = 0x00008000 fsSBAttributeModDate = 0x00010000 fsSBAccessDate = 0x00020000 fsSBPermissions = 0x00040000 fsSBNodeIDBit = 15 fsSBAttributeModDateBit = 16 fsSBAccessDateBit = 17 fsSBPermissionsBit = 18 kFSAllocDefaultFlags = 0x0000 kFSAllocAllOrNothingMask = 0x0001 kFSAllocContiguousMask = 0x0002 kFSAllocNoRoundUpMask = 0x0004 kFSAllocReservedMask = 0xFFF8 kFSVolInfoNone = 0x0000 kFSVolInfoCreateDate = 0x0001 kFSVolInfoModDate = 0x0002 kFSVolInfoBackupDate = 0x0004 kFSVolInfoCheckedDate = 0x0008 kFSVolInfoFileCount = 0x0010 kFSVolInfoDirCount = 0x0020 kFSVolInfoSizes = 0x0040 kFSVolInfoBlocks = 0x0080 kFSVolInfoNextAlloc = 0x0100 kFSVolInfoRsrcClump = 0x0200 kFSVolInfoDataClump = 0x0400 kFSVolInfoNextID = 0x0800 kFSVolInfoFinderInfo = 0x1000 kFSVolInfoFlags = 0x2000 kFSVolInfoFSInfo = 0x4000 kFSVolInfoDriveInfo = 0x8000 kFSVolInfoGettableInfo = 0xFFFF kFSVolInfoSettableInfo = 0x3004 kFSVolFlagDefaultVolumeBit = 5 kFSVolFlagDefaultVolumeMask = 0x0020 kFSVolFlagFilesOpenBit = 6 kFSVolFlagFilesOpenMask = 0x0040 kFSVolFlagHardwareLockedBit = 7 kFSVolFlagHardwareLockedMask = 0x0080 kFSVolFlagSoftwareLockedBit = 15 kFSVolFlagSoftwareLockedMask = 0x8000 kFNDirectoryModifiedMessage = 1 --- NEW FILE: Folder.py --- from _Folder import * --- NEW FILE: Folders.py --- # Generated from 'Folders.h' def FOUR_CHAR_CODE(x): return x true = True false = False kOnSystemDisk = -32768L kOnAppropriateDisk = -32767 kSystemDomain = -32766 kLocalDomain = -32765 kNetworkDomain = -32764 kUserDomain = -32763 kClassicDomain = -32762 kCreateFolder = true kDontCreateFolder = false kSystemFolderType = FOUR_CHAR_CODE('macs') kDesktopFolderType = FOUR_CHAR_CODE('desk') kSystemDesktopFolderType = FOUR_CHAR_CODE('sdsk') kTrashFolderType = FOUR_CHAR_CODE('trsh') kSystemTrashFolderType = FOUR_CHAR_CODE('strs') kWhereToEmptyTrashFolderType = FOUR_CHAR_CODE('empt') kPrintMonitorDocsFolderType = FOUR_CHAR_CODE('prnt') kStartupFolderType = FOUR_CHAR_CODE('strt') kShutdownFolderType = FOUR_CHAR_CODE('shdf') kAppleMenuFolderType = FOUR_CHAR_CODE('amnu') kControlPanelFolderType = FOUR_CHAR_CODE('ctrl') kSystemControlPanelFolderType = FOUR_CHAR_CODE('sctl') kExtensionFolderType = FOUR_CHAR_CODE('extn') kFontsFolderType = FOUR_CHAR_CODE('font') kPreferencesFolderType = FOUR_CHAR_CODE('pref') kSystemPreferencesFolderType = FOUR_CHAR_CODE('sprf') kTemporaryFolderType = FOUR_CHAR_CODE('temp') kExtensionDisabledFolderType = FOUR_CHAR_CODE('extD') kControlPanelDisabledFolderType = FOUR_CHAR_CODE('ctrD') kSystemExtensionDisabledFolderType = FOUR_CHAR_CODE('macD') kStartupItemsDisabledFolderType = FOUR_CHAR_CODE('strD') kShutdownItemsDisabledFolderType = FOUR_CHAR_CODE('shdD') kApplicationsFolderType = FOUR_CHAR_CODE('apps') kDocumentsFolderType = FOUR_CHAR_CODE('docs') kVolumeRootFolderType = FOUR_CHAR_CODE('root') kChewableItemsFolderType = FOUR_CHAR_CODE('flnt') kApplicationSupportFolderType = FOUR_CHAR_CODE('asup') kTextEncodingsFolderType = FOUR_CHAR_CODE('\xc4tex') kStationeryFolderType = FOUR_CHAR_CODE('odst') kOpenDocFolderType = FOUR_CHAR_CODE('odod') kOpenDocShellPlugInsFolderType = FOUR_CHAR_CODE('odsp') kEditorsFolderType = FOUR_CHAR_CODE('oded') kOpenDocEditorsFolderType = FOUR_CHAR_CODE('\xc4odf') kOpenDocLibrariesFolderType = FOUR_CHAR_CODE('odlb') kGenEditorsFolderType = FOUR_CHAR_CODE('\xc4edi') kHelpFolderType = FOUR_CHAR_CODE('\xc4hlp') kInternetPlugInFolderType = FOUR_CHAR_CODE('\xc4net') kModemScriptsFolderType = FOUR_CHAR_CODE('\xc4mod') kPrinterDescriptionFolderType = FOUR_CHAR_CODE('ppdf') kPrinterDriverFolderType = FOUR_CHAR_CODE('\xc4prd') kScriptingAdditionsFolderType = FOUR_CHAR_CODE('\xc4scr') kSharedLibrariesFolderType = FOUR_CHAR_CODE('\xc4lib') kVoicesFolderType = FOUR_CHAR_CODE('fvoc') kControlStripModulesFolderType = FOUR_CHAR_CODE('sdev') kAssistantsFolderType = FOUR_CHAR_CODE('ast\xc4') kUtilitiesFolderType = FOUR_CHAR_CODE('uti\xc4') kAppleExtrasFolderType = FOUR_CHAR_CODE('aex\xc4') kContextualMenuItemsFolderType = FOUR_CHAR_CODE('cmnu') kMacOSReadMesFolderType = FOUR_CHAR_CODE('mor\xc4') kALMModulesFolderType = FOUR_CHAR_CODE('walk') kALMPreferencesFolderType = FOUR_CHAR_CODE('trip') kALMLocationsFolderType = FOUR_CHAR_CODE('fall') kColorSyncProfilesFolderType = FOUR_CHAR_CODE('prof') kThemesFolderType = FOUR_CHAR_CODE('thme') kFavoritesFolderType = FOUR_CHAR_CODE('favs') kInternetFolderType = FOUR_CHAR_CODE('int\xc4') kAppearanceFolderType = FOUR_CHAR_CODE('appr') kSoundSetsFolderType = FOUR_CHAR_CODE('snds') kDesktopPicturesFolderType = FOUR_CHAR_CODE('dtp\xc4') kInternetSearchSitesFolderType = FOUR_CHAR_CODE('issf') kFindSupportFolderType = FOUR_CHAR_CODE('fnds') kFindByContentFolderType = FOUR_CHAR_CODE('fbcf') kInstallerLogsFolderType = FOUR_CHAR_CODE('ilgf') kScriptsFolderType = FOUR_CHAR_CODE('scr\xc4') kFolderActionsFolderType = FOUR_CHAR_CODE('fasf') kLauncherItemsFolderType = FOUR_CHAR_CODE('laun') kRecentApplicationsFolderType = FOUR_CHAR_CODE('rapp') kRecentDocumentsFolderType = FOUR_CHAR_CODE('rdoc') kRecentServersFolderType = FOUR_CHAR_CODE('rsvr') kSpeakableItemsFolderType = FOUR_CHAR_CODE('spki') kKeychainFolderType = FOUR_CHAR_CODE('kchn') kQuickTimeExtensionsFolderType = FOUR_CHAR_CODE('qtex') kDisplayExtensionsFolderType = FOUR_CHAR_CODE('dspl') kMultiprocessingFolderType = FOUR_CHAR_CODE('mpxf') kPrintingPlugInsFolderType = FOUR_CHAR_CODE('pplg') kDomainTopLevelFolderType = FOUR_CHAR_CODE('dtop') kDomainLibraryFolderType = FOUR_CHAR_CODE('dlib') kColorSyncFolderType = FOUR_CHAR_CODE('sync') kColorSyncCMMFolderType = FOUR_CHAR_CODE('ccmm') kColorSyncScriptingFolderType = FOUR_CHAR_CODE('cscr') kPrintersFolderType = FOUR_CHAR_CODE('impr') kSpeechFolderType = FOUR_CHAR_CODE('spch') kCarbonLibraryFolderType = FOUR_CHAR_CODE('carb') kDocumentationFolderType = FOUR_CHAR_CODE('info') kDeveloperDocsFolderType = FOUR_CHAR_CODE('ddoc') kDeveloperHelpFolderType = FOUR_CHAR_CODE('devh') kISSDownloadsFolderType = FOUR_CHAR_CODE('issd') kUserSpecificTmpFolderType = FOUR_CHAR_CODE('utmp') kCachedDataFolderType = FOUR_CHAR_CODE('cach') kFrameworksFolderType = FOUR_CHAR_CODE('fram') kPrivateFrameworksFolderType = FOUR_CHAR_CODE('pfrm') kClassicDesktopFolderType = FOUR_CHAR_CODE('sdsk') kDeveloperFolderType = FOUR_CHAR_CODE('devf') kSystemSoundsFolderType = FOUR_CHAR_CODE('ssnd') kComponentsFolderType = FOUR_CHAR_CODE('cmpd') kQuickTimeComponentsFolderType = FOUR_CHAR_CODE('wcmp') kCoreServicesFolderType = FOUR_CHAR_CODE('csrv') kPictureDocumentsFolderType = FOUR_CHAR_CODE('pdoc') kMovieDocumentsFolderType = FOUR_CHAR_CODE('mdoc') kMusicDocumentsFolderType = FOUR_CHAR_CODE('\xb5doc') kInternetSitesFolderType = FOUR_CHAR_CODE('site') kPublicFolderType = FOUR_CHAR_CODE('pubb') kAudioSupportFolderType = FOUR_CHAR_CODE('adio') kAudioSoundsFolderType = FOUR_CHAR_CODE('asnd') kAudioSoundBanksFolderType = FOUR_CHAR_CODE('bank') kAudioAlertSoundsFolderType = FOUR_CHAR_CODE('alrt') kAudioPlugInsFolderType = FOUR_CHAR_CODE('aplg') kAudioComponentsFolderType = FOUR_CHAR_CODE('acmp') kKernelExtensionsFolderType = FOUR_CHAR_CODE('kext') kDirectoryServicesFolderType = FOUR_CHAR_CODE('dsrv') kDirectoryServicesPlugInsFolderType = FOUR_CHAR_CODE('dplg') kLocalesFolderType = FOUR_CHAR_CODE('\xc4loc') kFindByContentPluginsFolderType = FOUR_CHAR_CODE('fbcp') kUsersFolderType = FOUR_CHAR_CODE('usrs') kCurrentUserFolderType = FOUR_CHAR_CODE('cusr') kCurrentUserRemoteFolderLocation = FOUR_CHAR_CODE('rusf') kCurrentUserRemoteFolderType = FOUR_CHAR_CODE('rusr') kSharedUserDataFolderType = FOUR_CHAR_CODE('sdat') kVolumeSettingsFolderType = FOUR_CHAR_CODE('vsfd') kAppleshareAutomountServerAliasesFolderType = FOUR_CHAR_CODE('srv\xc4') kPreMacOS91ApplicationsFolderType = FOUR_CHAR_CODE('\x8cpps') kPreMacOS91InstallerLogsFolderType = FOUR_CHAR_CODE('\x94lgf') kPreMacOS91AssistantsFolderType = FOUR_CHAR_CODE('\x8cst\xc4') kPreMacOS91UtilitiesFolderType = FOUR_CHAR_CODE('\x9fti\xc4') kPreMacOS91AppleExtrasFolderType = FOUR_CHAR_CODE('\x8cex\xc4') kPreMacOS91MacOSReadMesFolderType = FOUR_CHAR_CODE('\xb5or\xc4') kPreMacOS91InternetFolderType = FOUR_CHAR_CODE('\x94nt\xc4') kPreMacOS91AutomountedServersFolderType = FOUR_CHAR_CODE('\xa7rv\xc4') kPreMacOS91StationeryFolderType = FOUR_CHAR_CODE('\xbfdst') kCreateFolderAtBoot = 0x00000002 kCreateFolderAtBootBit = 1 kFolderCreatedInvisible = 0x00000004 kFolderCreatedInvisibleBit = 2 kFolderCreatedNameLocked = 0x00000008 kFolderCreatedNameLockedBit = 3 kFolderCreatedAdminPrivs = 0x00000010 kFolderCreatedAdminPrivsBit = 4 kFolderInUserFolder = 0x00000020 kFolderInUserFolderBit = 5 kFolderTrackedByAlias = 0x00000040 kFolderTrackedByAliasBit = 6 kFolderInRemoteUserFolderIfAvailable = 0x00000080 kFolderInRemoteUserFolderIfAvailableBit = 7 kFolderNeverMatchedInIdentifyFolder = 0x00000100 kFolderNeverMatchedInIdentifyFolderBit = 8 kFolderMustStayOnSameVolume = 0x00000200 kFolderMustStayOnSameVolumeBit = 9 kFolderManagerFolderInMacOS9FolderIfMacOSXIsInstalledMask = 0x00000400 kFolderManagerFolderInMacOS9FolderIfMacOSXIsInstalledBit = 10 kFolderInLocalOrRemoteUserFolder = kFolderInUserFolder | kFolderInRemoteUserFolderIfAvailable kRelativeFolder = FOUR_CHAR_CODE('relf') kSpecialFolder = FOUR_CHAR_CODE('spcf') kBlessedFolder = FOUR_CHAR_CODE('blsf') kRootFolder = FOUR_CHAR_CODE('rotf') kCurrentUserFolderLocation = FOUR_CHAR_CODE('cusf') kFindFolderRedirectionFlagUseDistinctUserFoldersBit = 0 kFindFolderRedirectionFlagUseGivenVRefAndDirIDAsUserFolderBit = 1 kFindFolderRedirectionFlagsUseGivenVRefNumAndDirIDAsRemoteUserFolderBit = 2 kFolderManagerUserRedirectionGlobalsCurrentVersion = 1 kFindFolderExtendedFlagsDoNotFollowAliasesBit = 0 kFindFolderExtendedFlagsDoNotUseUserFolderBit = 1 kFindFolderExtendedFlagsUseOtherUserRecord = 0x01000000 kFolderManagerNotificationMessageUserLogIn = FOUR_CHAR_CODE('log+') kFolderManagerNotificationMessagePreUserLogIn = FOUR_CHAR_CODE('logj') kFolderManagerNotificationMessageUserLogOut = FOUR_CHAR_CODE('log-') kFolderManagerNotificationMessagePostUserLogOut = FOUR_CHAR_CODE('logp') kFolderManagerNotificationDiscardCachedData = FOUR_CHAR_CODE('dche') kFolderManagerNotificationMessageLoginStartup = FOUR_CHAR_CODE('stup') kDoNotRemoveWhenCurrentApplicationQuitsBit = 0 kDoNotRemoveWheCurrentApplicationQuitsBit = kDoNotRemoveWhenCurrentApplicationQuitsBit kStopIfAnyNotificationProcReturnsErrorBit = 31 From jackjansen@users.sourceforge.net Fri Nov 22 14:58:37 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 22 Nov 2002 06:58:37 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/file _Filemodule.c,NONE,1.1 filescan.py,NONE,1.1 filesupport.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/file In directory sc8-pr-cvs1:/tmp/cvs-serv6207/Mac/Modules/file Added Files: _Filemodule.c filescan.py filesupport.py Log Message: Got angry and added support for pretty much the whole file and folder manager. This should allow us the get rid of most of the FSSpecs, only navigation services remains to be done. --- NEW FILE: _Filemodule.c --- /* ========================== Module _File ========================== */ #include "Python.h" #ifdef _WIN32 #include "pywintoolbox.h" #else #include "macglue.h" #include "pymactoolbox.h" #endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ PyErr_SetString(PyExc_NotImplementedError, \ "Not available in this shared library/OS version"); \ return NULL; \ [...1407 lines suppressed...] void init_File(void) { PyObject *m; PyObject *d; m = Py_InitModule("_File", File_methods); d = PyModule_GetDict(m); File_Error = PyMac_GetOSErrException(); if (File_Error == NULL || PyDict_SetItemString(d, "Error", File_Error) != 0) return; } /* ======================== End module _File ======================== */ --- NEW FILE: filescan.py --- # Scan an Apple header file, generating a Python file of generator calls. import sys import os from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner_OSX LONG = "Files" SHORT = "file" OBJECT = "NOTUSED" def main(): input = LONG + ".h" output = SHORT + "gen.py" defsoutput = TOOLBOXDIR + LONG + ".py" scanner = MyScanner(input, output, defsoutput) scanner.scan() scanner.close() scanner.gentypetest(SHORT+"typetest.py") print "=== Testing definitions output code ===" execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" print "=== Done. It's up to you to compile it now! ===" class MyScanner(Scanner_OSX): def destination(self, type, name, arglist): classname = "Function" listname = "functions" if arglist: t, n, m = arglist[0] # This is non-functional today if t == OBJECT and m == "InMode": classname = "Method" listname = "methods" return classname, listname def makeblacklistnames(self): return [ # Constants with incompatible definitions "kioACAccessOwnerMask", "kFSCatInfoReserved", "kFSIterateReserved", "FSRefMakePath", # Do this manually "FSRead", # Couldn't be bothered "FSWrite", # ditto "FSReadFork", # ditto "FSWriteFork", # ditto # Old routines: "GetWDInfo", "OpenWD", "CloseWD", "FInitQueue", "rstflock", "setflock", "setfinfo", "fsrename", "fsdelete", "create", "flushvol", "eject", "umountvol", "setvol", "getvol", "getfinfo", "getvinfo", "fsopen", "RstFLock", "SetFLock", "SetFInfo", "Rename", "OpenRF", "FSDelete", "Create", "GetVol", "GetFInfo", "GetVInfo", "FSOpen", "Eject", "SetVol", "openrf", "unmountvol", "OpenDF", ] def makeblacklisttypes(self): return [ "CInfoPBPtr", # Old stuff "CMovePBPtr", # Old stuff "ParmBlkPtr", # Old stuff "HParmBlkPtr", # Old stuff "DTPBPtr", # Old stuff "FCBPBPtr", # Old stuff "QHdrPtr", # Old stuff "CSParamPtr", # Old stuff "FSCatalogBulkParam", # old stuff "FSForkCBInfoParam", # old stuff "FSForkIOParam", # old stuff "FSRefParam", # old stuff "FSVolumeInfoParam", # old stuff "WDPBPtr", # old stuff "XCInfoPBPtr", # old stuff "XVolumeParamPtr", # old stuff "CatPositionRec", # State variable, not too difficult "FSCatalogInfo", # Lots of fields, difficult struct "FSCatalogInfo_ptr", # Lots of fields, difficult struct "FSIterator", # Should become an object "FSForkInfo", # Lots of fields, difficult struct "FSSearchParams", # Also catsearch stuff "FSVolumeInfo", # big struct "FSVolumeInfo_ptr", # big struct "IOCompletionProcPtr", # proc pointer "IOCompletionUPP", # Proc pointer ] def makerepairinstructions(self): return [ # Various ways to give pathnames ([('UInt8_ptr', 'path', 'InMode')], [('stringptr', 'path', 'InMode')] ), ([('char_ptr', '*', 'InMode')], [('stringptr', '*', 'InMode')] ), # Unicode filenames passed as length, buffer ([('UniCharCount', '*', 'InMode'), ('UniChar_ptr', '*', 'InMode')], [('UnicodeReverseInBuffer', '*', 'InMode')] ), ] def writeinitialdefs(self): self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") self.defsfile.write("true = True\n") self.defsfile.write("false = False\n") if __name__ == "__main__": main() --- NEW FILE: filesupport.py --- # This script generates a Python interface for an Apple Macintosh Manager. # It uses the "bgen" package to generate C code. # The function specifications are generated by scanning the mamager's header file, # using the "scantools" package (customized for this particular manager). import string # Declarations that change for each manager MACHEADERFILE = 'Files.h' # The Apple header file MODNAME = '_File' # The name of the module # The following is *usually* unchanged but may still require tuning MODPREFIX = 'File' # The prefix for module-wide routines INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner OUTPUTFILE = MODNAME + "module.c" # The file generated by this program from macsupport import * # Create the type objects #ConstStrFileNameParam = ConstStr255Param #StrFileName = Str255 #FolderClass = OSTypeType("FolderClass") # FolderDesc #FolderDescFlags = Type("FolderDescFlags", "l") #FolderLocation = OSTypeType("FolderLocation") # FolderRouting #FolderType = OSTypeType("FolderType") #RoutingFlags = Type("RoutingFlags", "l") class UniCharCountBuffer(InputOnlyType): pass #CatPositionRec ConstStr63Param = OpaqueArrayType("Str63", "PyMac_BuildStr255", "PyMac_GetStr255") FInfo = OpaqueByValueStructType("FInfo", "PyMac_BuildFInfo", "PyMac_GetFInfo") FInfo_ptr = OpaqueType("FInfo", "PyMac_BuildFInfo", "PyMac_GetFInfo") FNMessage = Type("FNMessage", "l") FSAllocationFlags = Type("FSAllocationFlags", "H") #FSCatalogInfo FSCatalogInfoBitmap = Type("FSCatalogInfoBitmap", "l") #FSForkInfo #FSIterator FSIteratorFlags = Type("FSIteratorFlags", "l") #FSVolumeInfo FSVolumeRefNum = Type("FSVolumeRefNum", "h") HFSUniStr255 = OpaqueType("HFSUniStr255", "PyMac_BuildHFSUniStr255", "PyMac_GetHFSUniStr255") SInt64 = Type("SInt64", "L") UInt64 = Type("UInt64", "L") #UInt8_ptr #UniCharCount #char_ptr #void_ptr includestuff = includestuff + """ #ifdef WITHOUT_FRAMEWORKS #include #else #include #endif /* ** Parse/generate objsect */ static PyObject * PyMac_BuildHFSUniStr255(HFSUniStr255 *itself) { return Py_BuildValue("u#", itself->unicode, itself->length); } #if 0 static int PyMac_GetHFSUniStr255(PyObject *v, HFSUniStr255 *itself) { return PyArg_ParseTuple(v, "O&O&O&O&O&", PyMac_GetFixed, &itself->ascent, PyMac_GetFixed, &itself->descent, PyMac_GetFixed, &itself->leading, PyMac_GetFixed, &itself->widMax, ResObj_Convert, &itself->wTabHandle); } #endif /* ** Parse/generate objsect */ static PyObject * PyMac_BuildFInfo(FInfo *itself) { return Py_BuildValue("O&O&HO&h", PyMac_BuildOSType, itself->fdType, PyMac_BuildOSType, itself->fdCreator, itself->fdFlags, PyMac_BuildPoint, &itself->fdLocation, itself->fdFldr); } static int PyMac_GetFInfo(PyObject *v, FInfo *itself) { return PyArg_ParseTuple(v, "O&O&HO&h", PyMac_GetOSType, &itself->fdType, PyMac_GetOSType, &itself->fdCreator, &itself->fdFlags, PyMac_GetPoint, &itself->fdLocation, &itself->fdFldr); } """ execfile(string.lower(MODPREFIX) + 'typetest.py') # From here on it's basically all boiler plate... # Create the generator groups and link them module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) # Create the generator classes used to populate the lists Function = OSErrFunctionGenerator # Create and populate the lists functions = [] execfile(INPUTFILE) # Manual generators: FSRefMakePath_body = """ OSStatus _err; FSRef ref; #define MAXPATHNAME 1024 UInt8 path[MAXPATHNAME]; UInt32 maxPathSize = MAXPATHNAME; if (!PyArg_ParseTuple(_args, "O&", PyMac_GetFSRef, &ref)) return NULL; _err = FSRefMakePath(&ref, path, maxPathSize); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("s", path); return _res; """ f = ManualGenerator("FSRefMakePath", FSRefMakePath_body) f.docstring = lambda: "(FSRef) -> string" functions.append(f) # add the populated lists to the generator groups # (in a different wordl the scan program would generate this) for f in functions: module.add(f) # generate output (open the output file as late as possible) SetOutputFileName(OUTPUTFILE) module.generate() From jackjansen@users.sourceforge.net Fri Nov 22 14:58:38 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 22 Nov 2002 06:58:38 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/folder _Foldermodule.c,NONE,1.1 folderscan.py,NONE,1.1 foldersupport.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/folder In directory sc8-pr-cvs1:/tmp/cvs-serv6207/Mac/Modules/folder Added Files: _Foldermodule.c folderscan.py foldersupport.py Log Message: Got angry and added support for pretty much the whole file and folder manager. This should allow us the get rid of most of the FSSpecs, only navigation services remains to be done. --- NEW FILE: _Foldermodule.c --- /* ========================= Module _Folder ========================= */ #include "Python.h" #ifdef _WIN32 #include "pywintoolbox.h" #else #include "macglue.h" #include "pymactoolbox.h" #endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ PyErr_SetString(PyExc_NotImplementedError, \ "Not available in this shared library/OS version"); \ return NULL; \ }} while(0) #ifdef WITHOUT_FRAMEWORKS #include #else #include #endif static PyObject *Folder_Error; static PyObject *Folder_FindFolder(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; short vRefNum; OSType folderType; Boolean createFolder; short foundVRefNum; long foundDirID; if (!PyArg_ParseTuple(_args, "hO&b", &vRefNum, PyMac_GetOSType, &folderType, &createFolder)) return NULL; _err = FindFolder(vRefNum, folderType, createFolder, &foundVRefNum, &foundDirID); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("hl", foundVRefNum, foundDirID); return _res; } static PyObject *Folder_ReleaseFolder(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; short vRefNum; OSType folderType; if (!PyArg_ParseTuple(_args, "hO&", &vRefNum, PyMac_GetOSType, &folderType)) return NULL; _err = ReleaseFolder(vRefNum, folderType); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; return _res; } static PyObject *Folder_FSFindFolder(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; short vRefNum; OSType folderType; Boolean createFolder; FSRef foundRef; if (!PyArg_ParseTuple(_args, "hO&b", &vRefNum, PyMac_GetOSType, &folderType, &createFolder)) return NULL; _err = FSFindFolder(vRefNum, folderType, createFolder, &foundRef); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", PyMac_BuildFSRef, &foundRef); return _res; } static PyObject *Folder_AddFolderDescriptor(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FolderType foldType; FolderDescFlags flags; FolderClass foldClass; FolderLocation foldLocation; OSType badgeSignature; OSType badgeType; Str255 name; Boolean replaceFlag; if (!PyArg_ParseTuple(_args, "O&lO&O&O&O&O&b", PyMac_GetOSType, &foldType, &flags, PyMac_GetOSType, &foldClass, PyMac_GetOSType, &foldLocation, PyMac_GetOSType, &badgeSignature, PyMac_GetOSType, &badgeType, PyMac_GetStr255, name, &replaceFlag)) return NULL; _err = AddFolderDescriptor(foldType, flags, foldClass, foldLocation, badgeSignature, badgeType, name, replaceFlag); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; return _res; } static PyObject *Folder_GetFolderTypes(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; UInt32 requestedTypeCount; UInt32 totalTypeCount; FolderType theTypes; if (!PyArg_ParseTuple(_args, "l", &requestedTypeCount)) return NULL; _err = GetFolderTypes(requestedTypeCount, &totalTypeCount, &theTypes); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("lO&", totalTypeCount, PyMac_BuildOSType, theTypes); return _res; } static PyObject *Folder_RemoveFolderDescriptor(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FolderType foldType; if (!PyArg_ParseTuple(_args, "O&", PyMac_GetOSType, &foldType)) return NULL; _err = RemoveFolderDescriptor(foldType); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; return _res; } static PyObject *Folder_GetFolderName(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; short vRefNum; OSType foldType; short foundVRefNum; Str255 name; if (!PyArg_ParseTuple(_args, "hO&O&", &vRefNum, PyMac_GetOSType, &foldType, PyMac_GetStr255, name)) return NULL; _err = GetFolderName(vRefNum, foldType, &foundVRefNum, name); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("h", foundVRefNum); return _res; } static PyObject *Folder_AddFolderRouting(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; OSType fileType; FolderType routeFromFolder; FolderType routeToFolder; RoutingFlags flags; Boolean replaceFlag; if (!PyArg_ParseTuple(_args, "O&O&O&lb", PyMac_GetOSType, &fileType, PyMac_GetOSType, &routeFromFolder, PyMac_GetOSType, &routeToFolder, &flags, &replaceFlag)) return NULL; _err = AddFolderRouting(fileType, routeFromFolder, routeToFolder, flags, replaceFlag); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; return _res; } static PyObject *Folder_RemoveFolderRouting(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; OSType fileType; FolderType routeFromFolder; if (!PyArg_ParseTuple(_args, "O&O&", PyMac_GetOSType, &fileType, PyMac_GetOSType, &routeFromFolder)) return NULL; _err = RemoveFolderRouting(fileType, routeFromFolder); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; return _res; } static PyObject *Folder_FindFolderRouting(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; OSType fileType; FolderType routeFromFolder; FolderType routeToFolder; RoutingFlags flags; if (!PyArg_ParseTuple(_args, "O&O&", PyMac_GetOSType, &fileType, PyMac_GetOSType, &routeFromFolder)) return NULL; _err = FindFolderRouting(fileType, routeFromFolder, &routeToFolder, &flags); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&l", PyMac_BuildOSType, routeToFolder, flags); return _res; } static PyObject *Folder_InvalidateFolderDescriptorCache(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; short vRefNum; long dirID; if (!PyArg_ParseTuple(_args, "hl", &vRefNum, &dirID)) return NULL; _err = InvalidateFolderDescriptorCache(vRefNum, dirID); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; return _res; } static PyObject *Folder_IdentifyFolder(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; short vRefNum; long dirID; FolderType foldType; if (!PyArg_ParseTuple(_args, "hl", &vRefNum, &dirID)) return NULL; _err = IdentifyFolder(vRefNum, dirID, &foldType); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", PyMac_BuildOSType, foldType); return _res; } static PyMethodDef Folder_methods[] = { {"FindFolder", (PyCFunction)Folder_FindFolder, 1, PyDoc_STR("(short vRefNum, OSType folderType, Boolean createFolder) -> (short foundVRefNum, long foundDirID)")}, {"ReleaseFolder", (PyCFunction)Folder_ReleaseFolder, 1, PyDoc_STR("(short vRefNum, OSType folderType) -> None")}, {"FSFindFolder", (PyCFunction)Folder_FSFindFolder, 1, PyDoc_STR("(short vRefNum, OSType folderType, Boolean createFolder) -> (FSRef foundRef)")}, {"AddFolderDescriptor", (PyCFunction)Folder_AddFolderDescriptor, 1, PyDoc_STR("(FolderType foldType, FolderDescFlags flags, FolderClass foldClass, FolderLocation foldLocation, OSType badgeSignature, OSType badgeType, Str255 name, Boolean replaceFlag) -> None")}, {"GetFolderTypes", (PyCFunction)Folder_GetFolderTypes, 1, PyDoc_STR("(UInt32 requestedTypeCount) -> (UInt32 totalTypeCount, FolderType theTypes)")}, {"RemoveFolderDescriptor", (PyCFunction)Folder_RemoveFolderDescriptor, 1, PyDoc_STR("(FolderType foldType) -> None")}, {"GetFolderName", (PyCFunction)Folder_GetFolderName, 1, PyDoc_STR("(short vRefNum, OSType foldType, Str255 name) -> (short foundVRefNum)")}, {"AddFolderRouting", (PyCFunction)Folder_AddFolderRouting, 1, PyDoc_STR("(OSType fileType, FolderType routeFromFolder, FolderType routeToFolder, RoutingFlags flags, Boolean replaceFlag) -> None")}, {"RemoveFolderRouting", (PyCFunction)Folder_RemoveFolderRouting, 1, PyDoc_STR("(OSType fileType, FolderType routeFromFolder) -> None")}, {"FindFolderRouting", (PyCFunction)Folder_FindFolderRouting, 1, PyDoc_STR("(OSType fileType, FolderType routeFromFolder) -> (FolderType routeToFolder, RoutingFlags flags)")}, {"InvalidateFolderDescriptorCache", (PyCFunction)Folder_InvalidateFolderDescriptorCache, 1, PyDoc_STR("(short vRefNum, long dirID) -> None")}, {"IdentifyFolder", (PyCFunction)Folder_IdentifyFolder, 1, PyDoc_STR("(short vRefNum, long dirID) -> (FolderType foldType)")}, {NULL, NULL, 0} }; void init_Folder(void) { PyObject *m; PyObject *d; m = Py_InitModule("_Folder", Folder_methods); d = PyModule_GetDict(m); Folder_Error = PyMac_GetOSErrException(); if (Folder_Error == NULL || PyDict_SetItemString(d, "Error", Folder_Error) != 0) return; } /* ======================= End module _Folder ======================= */ --- NEW FILE: folderscan.py --- # Scan an Apple header file, generating a Python file of generator calls. import sys import os from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner_OSX LONG = "Folders" SHORT = "folder" OBJECT = "NOTUSED" def main(): input = LONG + ".h" output = SHORT + "gen.py" defsoutput = TOOLBOXDIR + LONG + ".py" scanner = MyScanner(input, output, defsoutput) scanner.scan() scanner.close() scanner.gentypetest(SHORT+"typetest.py") print "=== Testing definitions output code ===" execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" print "=== Done. It's up to you to compile it now! ===" class MyScanner(Scanner_OSX): def destination(self, type, name, arglist): classname = "Function" listname = "functions" if arglist: t, n, m = arglist[0] # This is non-functional today if t == OBJECT and m == "InMode": classname = "Method" listname = "methods" return classname, listname def makeblacklistnames(self): return [ "FindFolderExtended", # Has funny void* argument "FSFindFolderExtended", # ditto "FolderManagerRegisterCallNotificationProcs", # ditto "FindFolderEx", # Non-MacOS routine ] def makeblacklisttypes(self): return [ "FolderManagerNotificationProcPtr", "FolderManagerNotificationUPP", "FolderRouting", # To be done, not difficult "FolderDesc", # To be done, not difficult ] def makerepairinstructions(self): return [ ] def writeinitialdefs(self): self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") self.defsfile.write("true = True\n") self.defsfile.write("false = False\n") if __name__ == "__main__": main() --- NEW FILE: foldersupport.py --- # This script generates a Python interface for an Apple Macintosh Manager. # It uses the "bgen" package to generate C code. # The function specifications are generated by scanning the mamager's header file, # using the "scantools" package (customized for this particular manager). import string # Declarations that change for each manager MACHEADERFILE = 'Folders.h' # The Apple header file MODNAME = '_Folder' # The name of the module # The following is *usually* unchanged but may still require tuning MODPREFIX = 'Folder' # The prefix for module-wide routines INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner OUTPUTFILE = MODNAME + "module.c" # The file generated by this program from macsupport import * # Create the type objects ConstStrFileNameParam = ConstStr255Param StrFileName = Str255 FolderClass = OSTypeType("FolderClass") # FolderDesc FolderDescFlags = Type("FolderDescFlags", "l") FolderLocation = OSTypeType("FolderLocation") # FolderRouting FolderType = OSTypeType("FolderType") RoutingFlags = Type("RoutingFlags", "l") includestuff = includestuff + """ #ifdef WITHOUT_FRAMEWORKS #include #else #include #endif """ execfile(string.lower(MODPREFIX) + 'typetest.py') # From here on it's basically all boiler plate... # Create the generator groups and link them module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) # Create the generator classes used to populate the lists Function = OSErrFunctionGenerator # Create and populate the lists functions = [] execfile(INPUTFILE) # add the populated lists to the generator groups # (in a different wordl the scan program would generate this) for f in functions: module.add(f) # generate output (open the output file as late as possible) SetOutputFileName(OUTPUTFILE) module.generate() From jackjansen@users.sourceforge.net Fri Nov 22 15:51:15 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 22 Nov 2002 07:51:15 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/alias - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/alias In directory sc8-pr-cvs1:/tmp/cvs-serv9392/alias Log Message: Directory /cvsroot/python/python/dist/src/Mac/Modules/alias added to the repository From jackjansen@users.sourceforge.net Fri Nov 22 15:53:34 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 22 Nov 2002 07:53:34 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib/Carbon Alias.py,NONE,1.1 Aliases.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/Carbon In directory sc8-pr-cvs1:/tmp/cvs-serv10191/Mac/Lib/Carbon Added Files: Alias.py Aliases.py Log Message: Added the alias manager too. The interface isn't perfect yet: the alias manager doesn't always have the alias as the first argument, so things become functions in stead of methods. --- NEW FILE: Alias.py --- from _Alias import * --- NEW FILE: Aliases.py --- # Generated from 'Aliases.h' def FOUR_CHAR_CODE(x): return x true = True false = False rAliasType = FOUR_CHAR_CODE('alis') kARMMountVol = 0x00000001 kARMNoUI = 0x00000002 kARMMultVols = 0x00000008 kARMSearch = 0x00000100 kARMSearchMore = 0x00000200 kARMSearchRelFirst = 0x00000400 asiZoneName = -3 asiServerName = -2 asiVolumeName = -1 asiAliasName = 0 asiParentName = 1 kResolveAliasFileNoUI = 0x00000001 From jackjansen@users.sourceforge.net Fri Nov 22 15:53:34 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 22 Nov 2002 07:53:34 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.118,1.119 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv10191 Modified Files: setup.py Log Message: Added the alias manager too. The interface isn't perfect yet: the alias manager doesn't always have the alias as the first argument, so things become functions in stead of methods. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** setup.py 22 Nov 2002 14:58:33 -0000 1.118 --- setup.py 22 Nov 2002 15:53:32 -0000 1.119 *************** *** 729,732 **** --- 729,734 ---- exts.append( Extension('_AH', ['ah/_AHmodule.c'], extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Alias', ['alias/_Aliasmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_App', ['app/_Appmodule.c'], extra_link_args=['-framework', 'Carbon']) ) From jackjansen@users.sourceforge.net Fri Nov 22 15:53:34 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 22 Nov 2002 07:53:34 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/alias _Aliasmodule.c,NONE,1.1 aliasscan.py,NONE,1.1 aliassupport.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/alias In directory sc8-pr-cvs1:/tmp/cvs-serv10191/Mac/Modules/alias Added Files: _Aliasmodule.c aliasscan.py aliassupport.py Log Message: Added the alias manager too. The interface isn't perfect yet: the alias manager doesn't always have the alias as the first argument, so things become functions in stead of methods. --- NEW FILE: _Aliasmodule.c --- /* ========================= Module _Alias ========================== */ #include "Python.h" #ifdef _WIN32 #include "pywintoolbox.h" #else #include "macglue.h" #include "pymactoolbox.h" #endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ PyErr_SetString(PyExc_NotImplementedError, \ "Not available in this shared library/OS version"); \ return NULL; \ }} while(0) #ifdef WITHOUT_FRAMEWORKS #include #else #include #endif static PyObject *Alias_Error; /* ----------------------- Object type Alias ------------------------ */ PyTypeObject Alias_Type; #define AliasObj_Check(x) ((x)->ob_type == &Alias_Type) typedef struct AliasObject { PyObject_HEAD AliasHandle ob_itself; void (*ob_freeit)(AliasHandle ptr); } AliasObject; PyObject *AliasObj_New(AliasHandle itself) { AliasObject *it; if (itself == NULL) return PyMac_Error(resNotFound); it = PyObject_NEW(AliasObject, &Alias_Type); if (it == NULL) return NULL; it->ob_itself = itself; it->ob_freeit = NULL; return (PyObject *)it; } int AliasObj_Convert(PyObject *v, AliasHandle *p_itself) { if (!AliasObj_Check(v)) { PyErr_SetString(PyExc_TypeError, "Alias required"); return 0; } *p_itself = ((AliasObject *)v)->ob_itself; return 1; } static void AliasObj_dealloc(AliasObject *self) { if (self->ob_freeit && self->ob_itself) { self->ob_freeit(self->ob_itself); } self->ob_itself = NULL; PyObject_Del(self); } static PyObject *AliasObj_GetAliasInfo(AliasObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; AliasInfoType index; Str63 theString; if (!PyArg_ParseTuple(_args, "h", &index)) return NULL; _err = GetAliasInfo(_self->ob_itself, index, theString); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", PyMac_BuildStr255, theString); return _res; } static PyMethodDef AliasObj_methods[] = { {"GetAliasInfo", (PyCFunction)AliasObj_GetAliasInfo, 1, PyDoc_STR("(AliasInfoType index) -> (Str63 theString)")}, {NULL, NULL, 0} }; PyMethodChain AliasObj_chain = { AliasObj_methods, NULL }; static PyObject *AliasObj_getattr(AliasObject *self, char *name) { return Py_FindMethodInChain(&AliasObj_chain, (PyObject *)self, name); } #define AliasObj_setattr NULL #define AliasObj_compare NULL #define AliasObj_repr NULL #define AliasObj_hash NULL PyTypeObject Alias_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "_Alias.Alias", /*tp_name*/ sizeof(AliasObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ (destructor) AliasObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc) AliasObj_getattr, /*tp_getattr*/ (setattrfunc) AliasObj_setattr, /*tp_setattr*/ (cmpfunc) AliasObj_compare, /*tp_compare*/ (reprfunc) AliasObj_repr, /*tp_repr*/ (PyNumberMethods *)0, /* tp_as_number */ (PySequenceMethods *)0, /* tp_as_sequence */ (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) AliasObj_hash, /*tp_hash*/ }; /* --------------------- End object type Alias ---------------------- */ static PyObject *Alias_NewAlias(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSSpec fromFile; FSSpec target; AliasHandle alias; if (!PyArg_ParseTuple(_args, "O&O&", PyMac_GetFSSpec, &fromFile, PyMac_GetFSSpec, &target)) return NULL; _err = NewAlias(&fromFile, &target, &alias); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", AliasObj_New, alias); return _res; } static PyObject *Alias_NewAliasMinimal(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSSpec target; AliasHandle alias; if (!PyArg_ParseTuple(_args, "O&", PyMac_GetFSSpec, &target)) return NULL; _err = NewAliasMinimal(&target, &alias); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", AliasObj_New, alias); return _res; } static PyObject *Alias_NewAliasMinimalFromFullPath(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; char *fullPath__in__; int fullPath__len__; int fullPath__in_len__; Str32 zoneName; Str31 serverName; AliasHandle alias; if (!PyArg_ParseTuple(_args, "s#O&O&", &fullPath__in__, &fullPath__in_len__, PyMac_GetStr255, zoneName, PyMac_GetStr255, serverName)) return NULL; fullPath__len__ = fullPath__in_len__; _err = NewAliasMinimalFromFullPath(fullPath__len__, fullPath__in__, zoneName, serverName, &alias); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", AliasObj_New, alias); return _res; } static PyObject *Alias_ResolveAlias(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSSpec fromFile; AliasHandle alias; FSSpec target; Boolean wasChanged; if (!PyArg_ParseTuple(_args, "O&O&", PyMac_GetFSSpec, &fromFile, AliasObj_Convert, &alias)) return NULL; _err = ResolveAlias(&fromFile, alias, &target, &wasChanged); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&b", PyMac_BuildFSSpec, &target, wasChanged); return _res; } static PyObject *Alias_IsAliasFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSSpec fileFSSpec; Boolean aliasFileFlag; Boolean folderFlag; if (!PyArg_ParseTuple(_args, "O&", PyMac_GetFSSpec, &fileFSSpec)) return NULL; _err = IsAliasFile(&fileFSSpec, &aliasFileFlag, &folderFlag); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("bb", aliasFileFlag, folderFlag); return _res; } static PyObject *Alias_ResolveAliasWithMountFlags(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSSpec fromFile; AliasHandle alias; FSSpec target; Boolean wasChanged; unsigned long mountFlags; if (!PyArg_ParseTuple(_args, "O&O&l", PyMac_GetFSSpec, &fromFile, AliasObj_Convert, &alias, &mountFlags)) return NULL; _err = ResolveAliasWithMountFlags(&fromFile, alias, &target, &wasChanged, mountFlags); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&b", PyMac_BuildFSSpec, &target, wasChanged); return _res; } static PyObject *Alias_ResolveAliasFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSSpec theSpec; Boolean resolveAliasChains; Boolean targetIsFolder; Boolean wasAliased; if (!PyArg_ParseTuple(_args, "b", &resolveAliasChains)) return NULL; _err = ResolveAliasFile(&theSpec, resolveAliasChains, &targetIsFolder, &wasAliased); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&bb", PyMac_BuildFSSpec, &theSpec, targetIsFolder, wasAliased); return _res; } static PyObject *Alias_ResolveAliasFileWithMountFlags(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSSpec theSpec; Boolean resolveAliasChains; Boolean targetIsFolder; Boolean wasAliased; unsigned long mountFlags; if (!PyArg_ParseTuple(_args, "bl", &resolveAliasChains, &mountFlags)) return NULL; _err = ResolveAliasFileWithMountFlags(&theSpec, resolveAliasChains, &targetIsFolder, &wasAliased, mountFlags); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&bb", PyMac_BuildFSSpec, &theSpec, targetIsFolder, wasAliased); return _res; } static PyObject *Alias_FollowFinderAlias(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSSpec fromFile; AliasHandle alias; Boolean logon; FSSpec target; Boolean wasChanged; if (!PyArg_ParseTuple(_args, "O&O&b", PyMac_GetFSSpec, &fromFile, AliasObj_Convert, &alias, &logon)) return NULL; _err = FollowFinderAlias(&fromFile, alias, logon, &target, &wasChanged); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&b", PyMac_BuildFSSpec, &target, wasChanged); return _res; } static PyObject *Alias_UpdateAlias(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSSpec fromFile; FSSpec target; AliasHandle alias; Boolean wasChanged; if (!PyArg_ParseTuple(_args, "O&O&O&", PyMac_GetFSSpec, &fromFile, PyMac_GetFSSpec, &target, AliasObj_Convert, &alias)) return NULL; _err = UpdateAlias(&fromFile, &target, alias, &wasChanged); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("b", wasChanged); return _res; } static PyObject *Alias_ResolveAliasFileWithMountFlagsNoUI(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSSpec theSpec; Boolean resolveAliasChains; Boolean targetIsFolder; Boolean wasAliased; unsigned long mountFlags; if (!PyArg_ParseTuple(_args, "bl", &resolveAliasChains, &mountFlags)) return NULL; _err = ResolveAliasFileWithMountFlagsNoUI(&theSpec, resolveAliasChains, &targetIsFolder, &wasAliased, mountFlags); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&bb", PyMac_BuildFSSpec, &theSpec, targetIsFolder, wasAliased); return _res; } static PyObject *Alias_FSNewAlias(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSRef fromFile; FSRef target; AliasHandle inAlias; if (!PyArg_ParseTuple(_args, "O&O&", PyMac_GetFSRef, &fromFile, PyMac_GetFSRef, &target)) return NULL; _err = FSNewAlias(&fromFile, &target, &inAlias); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", AliasObj_New, inAlias); return _res; } static PyObject *Alias_FSNewAliasMinimal(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSRef target; AliasHandle inAlias; if (!PyArg_ParseTuple(_args, "O&", PyMac_GetFSRef, &target)) return NULL; _err = FSNewAliasMinimal(&target, &inAlias); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", AliasObj_New, inAlias); return _res; } static PyObject *Alias_FSIsAliasFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSRef fileRef; Boolean aliasFileFlag; Boolean folderFlag; if (!PyArg_ParseTuple(_args, "O&", PyMac_GetFSRef, &fileRef)) return NULL; _err = FSIsAliasFile(&fileRef, &aliasFileFlag, &folderFlag); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("bb", aliasFileFlag, folderFlag); return _res; } static PyObject *Alias_FSResolveAliasWithMountFlags(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSRef fromFile; AliasHandle inAlias; FSRef target; Boolean wasChanged; unsigned long mountFlags; if (!PyArg_ParseTuple(_args, "O&O&l", PyMac_GetFSRef, &fromFile, AliasObj_Convert, &inAlias, &mountFlags)) return NULL; _err = FSResolveAliasWithMountFlags(&fromFile, inAlias, &target, &wasChanged, mountFlags); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&b", PyMac_BuildFSRef, &target, wasChanged); return _res; } static PyObject *Alias_FSResolveAlias(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSRef fromFile; AliasHandle alias; FSRef target; Boolean wasChanged; if (!PyArg_ParseTuple(_args, "O&O&", PyMac_GetFSRef, &fromFile, AliasObj_Convert, &alias)) return NULL; _err = FSResolveAlias(&fromFile, alias, &target, &wasChanged); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&b", PyMac_BuildFSRef, &target, wasChanged); return _res; } static PyObject *Alias_FSResolveAliasFileWithMountFlags(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSRef theRef; Boolean resolveAliasChains; Boolean targetIsFolder; Boolean wasAliased; unsigned long mountFlags; if (!PyArg_ParseTuple(_args, "bl", &resolveAliasChains, &mountFlags)) return NULL; _err = FSResolveAliasFileWithMountFlags(&theRef, resolveAliasChains, &targetIsFolder, &wasAliased, mountFlags); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&bb", PyMac_BuildFSRef, &theRef, targetIsFolder, wasAliased); return _res; } static PyObject *Alias_FSResolveAliasFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSRef theRef; Boolean resolveAliasChains; Boolean targetIsFolder; Boolean wasAliased; if (!PyArg_ParseTuple(_args, "b", &resolveAliasChains)) return NULL; _err = FSResolveAliasFile(&theRef, resolveAliasChains, &targetIsFolder, &wasAliased); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&bb", PyMac_BuildFSRef, &theRef, targetIsFolder, wasAliased); return _res; } static PyObject *Alias_FSFollowFinderAlias(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSRef fromFile; AliasHandle alias; Boolean logon; FSRef target; Boolean wasChanged; if (!PyArg_ParseTuple(_args, "O&b", AliasObj_Convert, &alias, &logon)) return NULL; _err = FSFollowFinderAlias(&fromFile, alias, logon, &target, &wasChanged); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&O&b", PyMac_BuildFSRef, &fromFile, PyMac_BuildFSRef, &target, wasChanged); return _res; } static PyObject *Alias_FSUpdateAlias(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSErr _err; FSRef fromFile; FSRef target; AliasHandle alias; Boolean wasChanged; if (!PyArg_ParseTuple(_args, "O&O&O&", PyMac_GetFSRef, &fromFile, PyMac_GetFSRef, &target, AliasObj_Convert, &alias)) return NULL; _err = FSUpdateAlias(&fromFile, &target, alias, &wasChanged); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("b", wasChanged); return _res; } static PyMethodDef Alias_methods[] = { {"NewAlias", (PyCFunction)Alias_NewAlias, 1, PyDoc_STR("(FSSpec fromFile, FSSpec target) -> (AliasHandle alias)")}, {"NewAliasMinimal", (PyCFunction)Alias_NewAliasMinimal, 1, PyDoc_STR("(FSSpec target) -> (AliasHandle alias)")}, {"NewAliasMinimalFromFullPath", (PyCFunction)Alias_NewAliasMinimalFromFullPath, 1, PyDoc_STR("(Buffer fullPath, Str32 zoneName, Str31 serverName) -> (AliasHandle alias)")}, {"ResolveAlias", (PyCFunction)Alias_ResolveAlias, 1, PyDoc_STR("(FSSpec fromFile, AliasHandle alias) -> (FSSpec target, Boolean wasChanged)")}, {"IsAliasFile", (PyCFunction)Alias_IsAliasFile, 1, PyDoc_STR("(FSSpec fileFSSpec) -> (Boolean aliasFileFlag, Boolean folderFlag)")}, {"ResolveAliasWithMountFlags", (PyCFunction)Alias_ResolveAliasWithMountFlags, 1, PyDoc_STR("(FSSpec fromFile, AliasHandle alias, unsigned long mountFlags) -> (FSSpec target, Boolean wasChanged)")}, {"ResolveAliasFile", (PyCFunction)Alias_ResolveAliasFile, 1, PyDoc_STR("(Boolean resolveAliasChains) -> (FSSpec theSpec, Boolean targetIsFolder, Boolean wasAliased)")}, {"ResolveAliasFileWithMountFlags", (PyCFunction)Alias_ResolveAliasFileWithMountFlags, 1, PyDoc_STR("(Boolean resolveAliasChains, unsigned long mountFlags) -> (FSSpec theSpec, Boolean targetIsFolder, Boolean wasAliased)")}, {"FollowFinderAlias", (PyCFunction)Alias_FollowFinderAlias, 1, PyDoc_STR("(FSSpec fromFile, AliasHandle alias, Boolean logon) -> (FSSpec target, Boolean wasChanged)")}, {"UpdateAlias", (PyCFunction)Alias_UpdateAlias, 1, PyDoc_STR("(FSSpec fromFile, FSSpec target, AliasHandle alias) -> (Boolean wasChanged)")}, {"ResolveAliasFileWithMountFlagsNoUI", (PyCFunction)Alias_ResolveAliasFileWithMountFlagsNoUI, 1, PyDoc_STR("(Boolean resolveAliasChains, unsigned long mountFlags) -> (FSSpec theSpec, Boolean targetIsFolder, Boolean wasAliased)")}, {"FSNewAlias", (PyCFunction)Alias_FSNewAlias, 1, PyDoc_STR("(FSRef fromFile, FSRef target) -> (AliasHandle inAlias)")}, {"FSNewAliasMinimal", (PyCFunction)Alias_FSNewAliasMinimal, 1, PyDoc_STR("(FSRef target) -> (AliasHandle inAlias)")}, {"FSIsAliasFile", (PyCFunction)Alias_FSIsAliasFile, 1, PyDoc_STR("(FSRef fileRef) -> (Boolean aliasFileFlag, Boolean folderFlag)")}, {"FSResolveAliasWithMountFlags", (PyCFunction)Alias_FSResolveAliasWithMountFlags, 1, PyDoc_STR("(FSRef fromFile, AliasHandle inAlias, unsigned long mountFlags) -> (FSRef target, Boolean wasChanged)")}, {"FSResolveAlias", (PyCFunction)Alias_FSResolveAlias, 1, PyDoc_STR("(FSRef fromFile, AliasHandle alias) -> (FSRef target, Boolean wasChanged)")}, {"FSResolveAliasFileWithMountFlags", (PyCFunction)Alias_FSResolveAliasFileWithMountFlags, 1, PyDoc_STR("(Boolean resolveAliasChains, unsigned long mountFlags) -> (FSRef theRef, Boolean targetIsFolder, Boolean wasAliased)")}, {"FSResolveAliasFile", (PyCFunction)Alias_FSResolveAliasFile, 1, PyDoc_STR("(Boolean resolveAliasChains) -> (FSRef theRef, Boolean targetIsFolder, Boolean wasAliased)")}, {"FSFollowFinderAlias", (PyCFunction)Alias_FSFollowFinderAlias, 1, PyDoc_STR("(AliasHandle alias, Boolean logon) -> (FSRef fromFile, FSRef target, Boolean wasChanged)")}, {"FSUpdateAlias", (PyCFunction)Alias_FSUpdateAlias, 1, PyDoc_STR("(FSRef fromFile, FSRef target, AliasHandle alias) -> (Boolean wasChanged)")}, {NULL, NULL, 0} }; void init_Alias(void) { PyObject *m; PyObject *d; m = Py_InitModule("_Alias", Alias_methods); d = PyModule_GetDict(m); Alias_Error = PyMac_GetOSErrException(); if (Alias_Error == NULL || PyDict_SetItemString(d, "Error", Alias_Error) != 0) return; Alias_Type.ob_type = &PyType_Type; Py_INCREF(&Alias_Type); if (PyDict_SetItemString(d, "AliasType", (PyObject *)&Alias_Type) != 0) Py_FatalError("can't initialize AliasType"); } /* ======================= End module _Alias ======================== */ --- NEW FILE: aliasscan.py --- # Scan an Apple header file, generating a Python file of generator calls. import sys import os from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner_OSX LONG = "Aliases" SHORT = "alias" OBJECT = "AliasHandle" def main(): input = LONG + ".h" output = SHORT + "gen.py" defsoutput = TOOLBOXDIR + LONG + ".py" scanner = MyScanner(input, output, defsoutput) scanner.scan() scanner.close() scanner.gentypetest(SHORT+"typetest.py") print "=== Testing definitions output code ===" execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" print "=== Done. It's up to you to compile it now! ===" class MyScanner(Scanner_OSX): def destination(self, type, name, arglist): classname = "Function" listname = "functions" if arglist: t, n, m = arglist[0] # This is non-functional today if t == OBJECT and m == "InMode": classname = "Method" listname = "methods" return classname, listname def makeblacklistnames(self): return [ # Constants with incompatible definitions ] def makeblacklisttypes(self): return [ "AliasFilterProcPtr", "AliasFilterUPP", "CInfoPBPtr", ] def makerepairinstructions(self): return [ ([('Str63', 'theString', 'InMode')], [('Str63', 'theString', 'OutMode')]), ([('short', 'fullPathLength', 'InMode'), ('void_ptr', 'fullPath', 'InMode')], [('FullPathName', 'fullPath', 'InMode')]), ] def writeinitialdefs(self): self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") self.defsfile.write("true = True\n") self.defsfile.write("false = False\n") if __name__ == "__main__": main() --- NEW FILE: aliassupport.py --- # This script generates a Python interface for an Apple Macintosh Manager. # It uses the "bgen" package to generate C code. # The function specifications are generated by scanning the mamager's header file, # using the "scantools" package (customized for this particular manager). import string # Declarations that change for each manager MACHEADERFILE = 'Aliases.h' # The Apple header file MODNAME = '_Alias' # The name of the module # The following is *usually* unchanged but may still require tuning MODPREFIX = 'Alias' # The prefix for module-wide routines INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner OUTPUTFILE = MODNAME + "module.c" # The file generated by this program from macsupport import * # Create the type objects class VarReverseInputBufferType(ReverseInputBufferMixin, VarInputBufferType): pass FullPathName = VarReverseInputBufferType() AliasHandle = OpaqueByValueType("AliasHandle", "AliasObj") AliasInfoType = Type("AliasInfoType", "h") ConstStr31Param = OpaqueArrayType("Str31", "PyMac_BuildStr255", "PyMac_GetStr255") ConstStr32Param = OpaqueArrayType("Str32", "PyMac_BuildStr255", "PyMac_GetStr255") #FSSpecArrayPtr #Ptr Str63 = OpaqueArrayType("Str63", "PyMac_BuildStr255", "PyMac_GetStr255") #void_ptr # class UniCharCountBuffer(InputOnlyType): # pass # # #CatPositionRec # ConstStr63Param = OpaqueArrayType("Str63", "PyMac_BuildStr255", "PyMac_GetStr255") # FInfo = OpaqueByValueStructType("FInfo", "PyMac_BuildFInfo", "PyMac_GetFInfo") # FInfo_ptr = OpaqueType("FInfo", "PyMac_BuildFInfo", "PyMac_GetFInfo") # FNMessage = Type("FNMessage", "l") # FSAllocationFlags = Type("FSAllocationFlags", "H") # #FSCatalogInfo # FSCatalogInfoBitmap = Type("FSCatalogInfoBitmap", "l") # #FSForkInfo # #FSIterator # FSIteratorFlags = Type("FSIteratorFlags", "l") # #FSVolumeInfo # FSVolumeRefNum = Type("FSVolumeRefNum", "h") # HFSUniStr255 = OpaqueType("HFSUniStr255", "PyMac_BuildHFSUniStr255", "PyMac_GetHFSUniStr255") # SInt64 = Type("SInt64", "L") # UInt64 = Type("UInt64", "L") # #UInt8_ptr # #UniCharCount # #char_ptr # #void_ptr includestuff = includestuff + """ #ifdef WITHOUT_FRAMEWORKS #include #else #include #endif """ execfile(string.lower(MODPREFIX) + 'typetest.py') # From here on it's basically all boiler plate... # Create the generator groups and link them module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) class AliasDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") def outputStructMembers(self): GlobalObjectDefinition.outputStructMembers(self) Output("void (*ob_freeit)(%s ptr);", self.itselftype) def outputInitStructMembers(self): GlobalObjectDefinition.outputInitStructMembers(self) Output("it->ob_freeit = NULL;") def outputCleanupStructMembers(self): Output("if (self->ob_freeit && self->ob_itself)") OutLbrace() Output("self->ob_freeit(self->ob_itself);") OutRbrace() Output("self->ob_itself = NULL;") aliasobject = AliasDefinition('Alias', 'AliasObj', 'AliasHandle') module.addobject(aliasobject) # Create the generator classes used to populate the lists Function = OSErrFunctionGenerator Method = OSErrMethodGenerator # Create and populate the lists functions = [] methods = [] execfile(INPUTFILE) # Manual generators: # add the populated lists to the generator groups # (in a different wordl the scan program would generate this) for f in methods: aliasobject.add(f) for f in functions: module.add(f) # generate output (open the output file as late as possible) SetOutputFileName(OUTPUTFILE) module.generate() From gvanrossum@users.sourceforge.net Fri Nov 22 15:56:32 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 22 Nov 2002 07:56:32 -0800 Subject: [Python-checkins] python/dist/src/Lib tempfile.py,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv12409 Modified Files: tempfile.py Log Message: Comment out the warnings about mktemp(). These are too annoying, and often unavoidable. Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** tempfile.py 21 Nov 2002 15:59:59 -0000 1.52 --- tempfile.py 22 Nov 2002 15:56:29 -0000 1.53 *************** *** 325,331 **** """ ! from warnings import warn as _warn ! _warn("mktemp is a potential security risk to your program", ! RuntimeWarning, stacklevel=2) if dir is None: --- 325,331 ---- """ ! ## from warnings import warn as _warn ! ## _warn("mktemp is a potential security risk to your program", ! ## RuntimeWarning, stacklevel=2) if dir is None: From jackjansen@users.sourceforge.net Fri Nov 22 16:13:00 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 22 Nov 2002 08:13:00 -0800 Subject: [Python-checkins] python/dist/src/Include py_curses.h,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv19751 Modified Files: py_curses.h Log Message: Fix for #641455: curses module doesn't build on MacOSX. It turns out the system headers have two declarations for wchar_t, with different guard macros. Not sure whether this is a bugfix candidate, that depends on what changed in the curses module. Index: py_curses.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/py_curses.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** py_curses.h 17 Jan 2002 23:08:27 -0000 1.4 --- py_curses.h 22 Nov 2002 16:12:57 -0000 1.5 *************** *** 4,7 **** --- 4,16 ---- #ifdef HAVE_NCURSES_H + #ifdef __APPLE__ + /* + ** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards + ** against multiple definition of wchar_t. + */ + #ifdef _BSD_WCHAR_T_DEFINED_ + #define _WCHAR_T + #endif + #endif #include #else From theller@users.sourceforge.net Fri Nov 22 19:31:23 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Fri, 22 Nov 2002 11:31:23 -0800 Subject: [Python-checkins] python/dist/src/PC/bdist_wininst - New directory Message-ID: Update of /cvsroot/python/python/dist/src/PC/bdist_wininst In directory sc8-pr-cvs1:/tmp/cvs-serv20209/bdist_wininst Log Message: Directory /cvsroot/python/python/dist/src/PC/bdist_wininst added to the repository From tim_one@users.sourceforge.net Fri Nov 22 20:00:35 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 22 Nov 2002 12:00:35 -0800 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.102,1.103 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv30034/python/Lib/test Modified Files: regrtest.py Log Message: Move Windows Python away from bsddb 1.85 and toward Sleepycat's latest. The bsddb subproject is gone. The _bsddb subproject is new. There are problems here, but I'm out of time to work on this now. If anyone can address an XXX comment or two in readme.txt, please do! Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** regrtest.py 19 Nov 2002 17:46:59 -0000 1.102 --- regrtest.py 22 Nov 2002 20:00:33 -0000 1.103 *************** *** 509,512 **** --- 509,513 ---- """ test_al + test_bsddb3 test_cd test_cl From tim_one@users.sourceforge.net Fri Nov 22 20:00:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 22 Nov 2002 12:00:36 -0800 Subject: [Python-checkins] python/dist/src/PCbuild _bsddb.dsp,NONE,1.1 bsddb_patch.txt,NONE,1.1 pcbuild.dsw,1.27,1.28 readme.txt,1.28,1.29 bsddb.dsp,1.15,NONE Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv30034/python/PCbuild Modified Files: pcbuild.dsw readme.txt Added Files: _bsddb.dsp bsddb_patch.txt Removed Files: bsddb.dsp Log Message: Move Windows Python away from bsddb 1.85 and toward Sleepycat's latest. The bsddb subproject is gone. The _bsddb subproject is new. There are problems here, but I'm out of time to work on this now. If anyone can address an XXX comment or two in readme.txt, please do! --- NEW FILE: _bsddb.dsp --- # Microsoft Developer Studio Project File - Name="_bsddb" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=_bsddb - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "_bsddb.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "_bsddb.mak" CFG="_bsddb - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "_bsddb - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "_bsddb - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "_bsddb" # PROP Scc_LocalPath ".." CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "_bsddb - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-release\_bsddb" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /I "..\..\db-4.0.14\build_win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 # ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\db-4.0.14\build_win32\Release\libdb40.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /out:"./_bsddb.pyd" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "_bsddb - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-debug\_bsddb" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /I "..\..\db-4.0.14\build_win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\db-4.0.14\build_win32\Release\libdb40.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"MSVCRT" /out:"./_bsddb_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ENDIF # Begin Target # Name "_bsddb - Win32 Release" # Name "_bsddb - Win32 Debug" # Begin Source File SOURCE=..\Modules\_bsddb.c # End Source File # End Target # End Project --- NEW FILE: bsddb_patch.txt --- This patch is against Sleepycat's db-4.0.14 release. It's not on the Sleepycat site. It fixes cases of database corruption Barry (Warsaw) was seeing, and Barry got it from Sleepycat. *** db/db_reclaim.c.orig 2002/04/05 16:16:17 11.22 --- db/db_reclaim.c 2002/04/10 18:53:13 11.23 *************** *** 195,202 **** dbp->log_fileid, p->pgno, &LSN(meta), PGNO_BASE_MD, &ldbt, meta->free)) != 0) goto err; - LSN(p) = LSN(meta); if ((ret = __db_pg_alloc_log(dbp->dbenv, param->dbc->txn, &LSN(meta), 0, --- 195,202 ---- dbp->log_fileid, p->pgno, &LSN(meta), PGNO_BASE_MD, &ldbt, meta->free)) != 0) goto err; LSN(p) = LSN(meta); + if ((ret = __db_pg_alloc_log(dbp->dbenv, param->dbc->txn, &LSN(meta), 0, *************** *** 206,211 **** --- 206,213 ---- (void)__TLPUT(param->dbc, metalock); return (ret); } + LSN(p) = LSN(meta); + if ((ret = mpf->put(mpf, (PAGE *)meta, DB_MPOOL_DIRTY)) != 0) { (void)__TLPUT(param->dbc, metalock); Index: pcbuild.dsw =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pcbuild.dsw,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** pcbuild.dsw 9 Nov 2002 04:48:58 -0000 1.27 --- pcbuild.dsw 22 Nov 2002 20:00:34 -0000 1.28 *************** *** 4,8 **** ############################################################################### ! Project: "_socket"=.\_socket.dsp - Package Owner=<4> Package=<5> --- 4,8 ---- ############################################################################### ! Project: "_bsddb"=.\_bsddb.dsp - Package Owner=<4> Package=<5> *************** *** 12,23 **** Package=<4> {{{ - Begin Project Dependency - Project_Dep_Name pythoncore - End Project Dependency }}} ############################################################################### ! Project: "_sre"=.\_sre.dsp - Package Owner=<4> Package=<5> --- 12,20 ---- Package=<4> {{{ }}} ############################################################################### ! Project: "_socket"=.\_socket.dsp - Package Owner=<4> Package=<5> *************** *** 34,38 **** ############################################################################### ! Project: "_symtable"=.\_symtable.dsp - Package Owner=<4> Package=<5> --- 31,35 ---- ############################################################################### ! Project: "_sre"=.\_sre.dsp - Package Owner=<4> Package=<5> *************** *** 49,53 **** ############################################################################### ! Project: "_testcapi"=.\_testcapi.dsp - Package Owner=<4> Package=<5> --- 46,50 ---- ############################################################################### ! Project: "_symtable"=.\_symtable.dsp - Package Owner=<4> Package=<5> *************** *** 64,68 **** ############################################################################### ! Project: "_tkinter"=.\_tkinter.dsp - Package Owner=<4> Package=<5> --- 61,65 ---- ############################################################################### ! Project: "_testcapi"=.\_testcapi.dsp - Package Owner=<4> Package=<5> *************** *** 79,83 **** ############################################################################### ! Project: "bsddb"=.\bsddb.dsp - Package Owner=<4> Package=<5> --- 76,80 ---- ############################################################################### ! Project: "_tkinter"=.\_tkinter.dsp - Package Owner=<4> Package=<5> Index: readme.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/readme.txt,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** readme.txt 19 Nov 2002 17:38:27 -0000 1.28 --- readme.txt 22 Nov 2002 20:00:34 -0000 1.29 *************** *** 161,177 **** ! bsddb ! Python wrapper for the BSD database 1.85. Requires db.1.85.win32.zip, ! from the "bsd db" link at ! http://www.nightmare.com/software.html ! Unpack into dist\bsddb. ! You then need to compile it: cd to dist\bsddb\Port\win32, and run ! nmake -f makefile_nt.msc ! This builds bsddb\Port\win32\db.lib, which the MSVC project links in. ! Note that if you're running Win9X, you'll need to run vcvars32.bat ! before running nmake (this batch file is in your MSVC installation). ! TODO: make this work like zlib (in particular, MSVC runs the prelink ! step in an enviroment that already has the correct envars set up). --- 161,196 ---- + _bsddb + Go to Sleepycat's patches page: + http://www.sleepycat.com/update/index.html + and download + 4.0.14.zip + from the download page. The file name is db-4.0.14.zip. Unpack into + dist\db-4.0.14 ! Apply the patch file bsddb_patch.txt in this (PCbuild) directory ! against the file ! dist\db-4.0.14\db\db_reclaim.c ! ! Go to ! http://www.sleepycat.com/docs/ref/build_win/intro.html ! and follow the instructions for building the Sleepycat software. ! Build the Release version. ! ! XXX You have to copy ! XXX dist\db-4.0.14\build_win32\Release\libdb40.dll ! XXX into PCbuild (or elsewhere on your path) before the tests ! XXX will run. ! ! XXX A debug-mode build blows up when running this, presumably because ! XXX I'm mixing debug-mode MS stuff with Sleepycat's release-mode ! XXX DLL. This gives me a headache. I would *like* to, as the old ! XXX bsddb 1.85 project apparently managed to do, link the Berkeley ! XXX DLL into the guts of our _bsddb.pyd. I don't know how to. ! ! XXX The installer needs to be changed accordingly. ! ! XXX The Sleepycat release we use will probably change before ! XXX 2.3a1. --- bsddb.dsp DELETED --- From fdrake@users.sourceforge.net Fri Nov 22 20:13:46 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 22 Nov 2002 12:13:46 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_tempfile.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv4164 Modified Files: test_tempfile.py Log Message: Two bugs: - assertRaises() wasn't being called correctly - test_warning() no longer applies Index: test_tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_tempfile.py 17 Oct 2002 22:09:03 -0000 1.11 --- test_tempfile.py 22 Nov 2002 20:13:43 -0000 1.12 *************** *** 525,535 **** extant[i] = self.do_create(pre="aa") ! def test_warning(self): ! # mktemp issues a warning when used ! warnings.filterwarnings("error", ! category=RuntimeWarning, ! message="mktemp") ! self.assertRaises(RuntimeWarning, ! tempfile.mktemp, (), { 'dir': self.dir }) test_classes.append(test_mktemp) --- 525,535 ---- extant[i] = self.do_create(pre="aa") ! ## def test_warning(self): ! ## # mktemp issues a warning when used ! ## warnings.filterwarnings("error", ! ## category=RuntimeWarning, ! ## message="mktemp") ! ## self.assertRaises(RuntimeWarning, ! ## tempfile.mktemp, dir=self.dir) test_classes.append(test_mktemp) From theller@users.sourceforge.net Fri Nov 22 20:39:36 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Fri, 22 Nov 2002 12:39:36 -0800 Subject: [Python-checkins] python/dist/src/PC/bdist_wininst .cvsignore,NONE,1.1 PythonPowered.bmp,NONE,1.1 README.txt,NONE,1.1 archive.h,NONE,1.1 extract.c,NONE,1.1 install.c,NONE,1.1 install.rc,NONE,1.1 resource.h,NONE,1.1 wininst.dsp,NONE,1.1 wininst.dsw,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/PC/bdist_wininst In directory sc8-pr-cvs1:/tmp/cvs-serv14098 Added Files: .cvsignore PythonPowered.bmp README.txt archive.h extract.c install.c install.rc resource.h wininst.dsp wininst.dsw Log Message: Copied the sources from the distutils CVS repository. Changed the MSVC project file to create the exe in the lib/distutils/command directory, bdist_wininst.py must still be changed to use it. Also changed to use the same zlib as the zlib module - this has the nice sideeffect that now the buggy 1.1.3 version is no longer used. Most of the source files now conform to PEP 7, except for the maximum line length. Windows api programming in 78 character lines =:(. README.txt is a new file, but still empty except for placeholders. --- NEW FILE: .cvsignore --- temp-debug temp-release wininst.ncb wininst.plg --- NEW FILE: PythonPowered.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: README.txt --- XXX Write description XXX Dont't forget to mention upx XXX Add pointer to this file into PC/README.txt --- NEW FILE: archive.h --- #pragma pack(1) /* zip-archive headers * See: http://www.pkware.com/appnote.html */ struct eof_cdir { long tag; /* must be 0x06054b50 */ short disknum; short firstdisk; short nTotalCDirThis; short nTotalCDir; long nBytesCDir; long ofsCDir; short commentlen; }; struct cdir { long tag; /* must be 0x02014b50 */ short version_made; short version_extract; short gp_bitflag; short comp_method; short last_mod_file_time; short last_mod_file_date; long crc32; long comp_size; long uncomp_size; short fname_length; short extra_length; short comment_length; short disknum_start; short int_file_attr; long ext_file_attr; long ofs_local_header; }; struct fhdr { long tag; /* must be 0x04034b50 */ short version_needed; short flags; short method; short last_mod_file_time; short last_mod_file_date; long crc32; long comp_size; long uncomp_size; short fname_length; short extra_length; }; struct meta_data_hdr { int tag; int uncomp_size; int bitmap_size; }; #pragma pack() /* installation scheme */ typedef struct tagSCHEME { char *name; char *prefix; } SCHEME; typedef int (*NOTIFYPROC)(int code, LPSTR text, ...); extern BOOL extract_file(char *dst, char *src, int method, int comp_size, int uncomp_size, NOTIFYPROC notify); extern BOOL unzip_archive(SCHEME *scheme, char *dirname, char *data, DWORD size, NOTIFYPROC notify); extern char * map_new_file(DWORD flags, char *filename, char *pathname_part, int size, WORD wFatDate, WORD wFatTime, NOTIFYPROC callback); extern BOOL ensure_directory (char *pathname, char *new_part, NOTIFYPROC callback); /* codes for NOITIFYPROC */ #define DIR_CREATED 1 #define CAN_OVERWRITE 2 #define FILE_CREATED 3 #define ZLIB_ERROR 4 #define SYSTEM_ERROR 5 #define NUM_FILES 6 #define FILE_OVERWRITTEN 7 --- NEW FILE: extract.c --- #include #include "zlib.h" #include #include #include "archive.h" /* Convert unix-path to dos-path */ static void normpath(char *path) { while (path && *path) { if (*path == '/') *path = '\\'; ++path; } } BOOL ensure_directory(char *pathname, char *new_part, NOTIFYPROC notify) { while (new_part && *new_part && (new_part = strchr(new_part, '\\'))) { DWORD attr; *new_part = '\0'; attr = GetFileAttributes(pathname); if (attr == -1) { /* nothing found */ if (!CreateDirectory(pathname, NULL) && notify) notify(SYSTEM_ERROR, "CreateDirectory (%s)", pathname); else notify(DIR_CREATED, pathname); } if (attr & FILE_ATTRIBUTE_DIRECTORY) { ; } else { SetLastError(183); if (notify) notify(SYSTEM_ERROR, "CreateDirectory (%s)", pathname); } *new_part = '\\'; ++new_part; } return TRUE; } /* XXX Should better explicitely specify * uncomp_size and file_times instead of pfhdr! */ char *map_new_file(DWORD flags, char *filename, char *pathname_part, int size, WORD wFatDate, WORD wFatTime, NOTIFYPROC notify) { HANDLE hFile, hFileMapping; char *dst; FILETIME ft; try_again: if (!flags) flags = CREATE_NEW; hFile = CreateFile(filename, GENERIC_WRITE | GENERIC_READ, 0, NULL, flags, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { DWORD x = GetLastError(); switch (x) { case ERROR_FILE_EXISTS: if (notify && notify(CAN_OVERWRITE, filename)) hFile = CreateFile(filename, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); else { if (notify) notify(FILE_OVERWRITTEN, filename); return NULL; } break; case ERROR_PATH_NOT_FOUND: if (ensure_directory(filename, pathname_part, notify)) goto try_again; else return FALSE; break; default: SetLastError(x); break; } } if (hFile == INVALID_HANDLE_VALUE) { if (notify) notify (SYSTEM_ERROR, "CreateFile (%s)", filename); return NULL; } if (notify) notify(FILE_CREATED, filename); DosDateTimeToFileTime(wFatDate, wFatTime, &ft); SetFileTime(hFile, &ft, &ft, &ft); if (size == 0) { /* We cannot map a zero-length file (Also it makes no sense */ CloseHandle(hFile); return NULL; } hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, size, NULL); CloseHandle(hFile); if (hFileMapping == INVALID_HANDLE_VALUE) { if (notify) notify(SYSTEM_ERROR, "CreateFileMapping (%s)", filename); return NULL; } dst = MapViewOfFile(hFileMapping, FILE_MAP_WRITE, 0, 0, 0); CloseHandle(hFileMapping); if (!dst) { if (notify) notify(SYSTEM_ERROR, "MapViewOfFile (%s)", filename); return NULL; } return dst; } BOOL extract_file(char *dst, char *src, int method, int comp_size, int uncomp_size, NOTIFYPROC notify) { z_stream zstream; int result; if (method == Z_DEFLATED) { int x; memset(&zstream, 0, sizeof(zstream)); zstream.next_in = src; zstream.avail_in = comp_size+1; zstream.next_out = dst; zstream.avail_out = uncomp_size; /* Apparently an undocumented feature of zlib: Set windowsize to negative values to supress the gzip header and be compatible with zip! */ result = TRUE; if (Z_OK != (x = inflateInit2(&zstream, -15))) { if (notify) notify(ZLIB_ERROR, "inflateInit2 returns %d", x); result = FALSE; goto cleanup; } if (Z_STREAM_END != (x = inflate(&zstream, Z_FINISH))) { if (notify) notify(ZLIB_ERROR, "inflate returns %d", x); result = FALSE; } cleanup: if (Z_OK != (x = inflateEnd(&zstream))) { if (notify) notify (ZLIB_ERROR, "inflateEnd returns %d", x); result = FALSE; } } else if (method == 0) { memcpy(dst, src, uncomp_size); result = TRUE; } else result = FALSE; UnmapViewOfFile(dst); return result; } /* Open a zip-compatible archive and extract all files * into the specified directory (which is assumed to exist) */ BOOL unzip_archive(SCHEME *scheme, char *dirname, char *data, DWORD size, NOTIFYPROC notify) { int n; char pathname[MAX_PATH]; char *new_part; /* read the end of central directory record */ struct eof_cdir *pe = (struct eof_cdir *)&data[size - sizeof (struct eof_cdir)]; int arc_start = size - sizeof (struct eof_cdir) - pe->nBytesCDir - pe->ofsCDir; /* set position to start of central directory */ int pos = arc_start + pe->ofsCDir; /* make sure this is a zip file */ if (pe->tag != 0x06054b50) return FALSE; /* Loop through the central directory, reading all entries */ for (n = 0; n < pe->nTotalCDir; ++n) { int i; char *fname; char *pcomp; char *dst; struct cdir *pcdir; struct fhdr *pfhdr; pcdir = (struct cdir *)&data[pos]; pfhdr = (struct fhdr *)&data[pcdir->ofs_local_header + arc_start]; if (pcdir->tag != 0x02014b50) return FALSE; if (pfhdr->tag != 0x04034b50) return FALSE; pos += sizeof(struct cdir); fname = (char *)&data[pos]; /* This is not null terminated! */ pos += pcdir->fname_length + pcdir->extra_length + pcdir->comment_length; pcomp = &data[pcdir->ofs_local_header + sizeof(struct fhdr) + arc_start + pfhdr->fname_length + pfhdr->extra_length]; /* dirname is the Python home directory (prefix) */ strcpy(pathname, dirname); if (pathname[strlen(pathname)-1] != '\\') strcat(pathname, "\\"); new_part = &pathname[lstrlen(pathname)]; /* we must now match the first part of the pathname * in the archive to a component in the installation * scheme (PURELIB, PLATLIB, HEADERS, SCRIPTS, or DATA) * and replace this part by the one in the scheme to use */ for (i = 0; scheme[i].name; ++i) { if (0 == strnicmp(scheme[i].name, fname, strlen(scheme[i].name))) { char *rest; int len; /* length of the replaced part */ int namelen = strlen(scheme[i].name); strcat(pathname, scheme[i].prefix); rest = fname + namelen; len = pfhdr->fname_length - namelen; if ((pathname[strlen(pathname)-1] != '\\') && (pathname[strlen(pathname)-1] != '/')) strcat(pathname, "\\"); /* Now that pathname ends with a separator, * we must make sure rest does not start with * an additional one. */ if ((rest[0] == '\\') || (rest[0] == '/')) { ++rest; --len; } strncat(pathname, rest, len); goto Done; } } /* no prefix to replace found, go unchanged */ strncat(pathname, fname, pfhdr->fname_length); Done: normpath(pathname); if (pathname[strlen(pathname)-1] != '\\') { /* * The local file header (pfhdr) does not always * contain the compressed and uncompressed sizes of * the data depending on bit 3 of the flags field. So * it seems better to use the data from the central * directory (pcdir). */ dst = map_new_file(0, pathname, new_part, pcdir->uncomp_size, pcdir->last_mod_file_date, pcdir->last_mod_file_time, notify); if (dst) { if (!extract_file(dst, pcomp, pfhdr->method, pcdir->comp_size, pcdir->uncomp_size, notify)) return FALSE; } /* else ??? */ } if (notify) notify(NUM_FILES, new_part, (int)pe->nTotalCDir, (int)n+1); } return TRUE; } --- NEW FILE: install.c --- /* * Written by Thomas Heller, May 2000 * * $Id: install.c,v 1.1 2002/11/22 20:39:33 theller Exp $ */ /* * Windows Installer program for distutils. * * (a kind of self-extracting zip-file) * * At runtime, the exefile has appended: * - compressed setup-data in ini-format, containing the following sections: * [metadata] * author=Greg Ward * author_email=gward@python.net * description=Python Distribution Utilities * licence=Python * name=Distutils [...2255 lines suppressed...] if (ini_file) return DoInstall(); if (!ini_file && __argc > 1) { return DoUninstall(__argc, __argv); } basename = strrchr(modulename, '\\'); if (basename) ++basename; /* Last guess about the purpose of this program */ if (basename && (0 == strncmp(basename, "Remove", 6))) SystemError(0, "This program is normally started by windows"); else SystemError(0, "Setup program invalid or damaged"); return 1; } --- NEW FILE: install.rc --- //Microsoft Developer Studio generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // Neutral resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) #ifdef _WIN32 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #pragma code_page(1252) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// // // Bitmap // IDB_BITMAP BITMAP DISCARDABLE "PythonPowered.bmp" #endif // Neutral resources ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // German (Germany) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) #ifdef _WIN32 LANGUAGE LANG_GERMAN, SUBLANG_GERMAN #pragma code_page(1252) #endif //_WIN32 #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE DISCARDABLE BEGIN "resource.h\0" END 2 TEXTINCLUDE DISCARDABLE BEGIN "#include ""afxres.h""\r\n" "\0" END 3 TEXTINCLUDE DISCARDABLE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED #endif // German (Germany) resources ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// // // Dialog // IDD_INTRO DIALOGEX 0, 0, 379, 178 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Setup" FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN LTEXT "This Wizard will install %s on your computer. Click Next to continue or Cancel to exit the Setup Wizard.", IDC_TITLE,125,10,247,20,NOT WS_GROUP EDITTEXT IDC_INTRO_TEXT,125,31,247,131,ES_MULTILINE | ES_READONLY | WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8, 104,163,WS_EX_CLIENTEDGE LTEXT "",IDC_BUILD_INFO,125,163,247,8 END IDD_SELECTPYTHON DIALOGEX 0, 0, 379, 178 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Setup" FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN LTEXT "Select python installation to use:",IDC_TITLE,125,10, 247,12,NOT WS_GROUP EDITTEXT IDC_PATH,191,136,181,14,ES_AUTOHSCROLL | ES_READONLY LTEXT "Python Directory:",IDC_STATIC,125,137,55,8 LISTBOX IDC_VERSIONS_LIST,125,24,247,106,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8, 104,163,WS_EX_CLIENTEDGE EDITTEXT IDC_INSTALL_PATH,191,157,181,14,ES_AUTOHSCROLL | ES_READONLY LTEXT "Installation Directory:",IDC_STATIC,125,158,66,8 PUSHBUTTON "Find other ...",IDC_OTHERPYTHON,322,7,50,14,NOT WS_VISIBLE END IDD_INSTALLFILES DIALOGEX 0, 0, 379, 178 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Setup" FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN LTEXT "Click Next to begin the installation. If you want to review or change any of your installation settings, click Back. Click Cancel to exit the Wizard.", IDC_TITLE,125,10,246,31,NOT WS_GROUP CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER, 125,157,246,14 CTEXT "Installation progress:",IDC_INFO,125,137,246,8 CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8, 104,163,WS_EX_CLIENTEDGE END IDD_FINISHED DIALOGEX 0, 0, 379, 178 STYLE WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Setup" FONT 8, "MS Sans Serif" BEGIN LTEXT "Click the Finish button to exit the Setup wizard.", IDC_TITLE,125,10,247,31,NOT WS_GROUP CONTROL 110,IDC_BITMAP,"Static",SS_BITMAP | SS_CENTERIMAGE,6,8, 104,163,WS_EX_CLIENTEDGE EDITTEXT IDC_INFO,125,40,247,131,ES_MULTILINE | ES_READONLY | WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP END ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO // #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO DISCARDABLE BEGIN IDD_INTRO, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 372 VERTGUIDE, 125 VERTGUIDE, 372 TOPMARGIN, 7 BOTTOMMARGIN, 171 HORZGUIDE, 8 HORZGUIDE, 31 END IDD_SELECTPYTHON, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 372 VERTGUIDE, 125 VERTGUIDE, 372 TOPMARGIN, 7 BOTTOMMARGIN, 171 HORZGUIDE, 8 HORZGUIDE, 41 END IDD_INSTALLFILES, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 372 VERTGUIDE, 125 VERTGUIDE, 371 TOPMARGIN, 7 BOTTOMMARGIN, 171 HORZGUIDE, 8 HORZGUIDE, 41 END IDD_FINISHED, DIALOG BEGIN LEFTMARGIN, 6 RIGHTMARGIN, 372 VERTGUIDE, 125 VERTGUIDE, 372 TOPMARGIN, 7 BOTTOMMARGIN, 171 HORZGUIDE, 8 HORZGUIDE, 41 END END #endif // APSTUDIO_INVOKED #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED --- NEW FILE: resource.h --- //{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by install.rc // #define IDD_DIALOG1 101 #define IDB_BITMAP1 103 #define IDD_INTRO 107 #define IDD_SELECTPYTHON 108 #define IDD_INSTALLFILES 109 #define IDD_FINISHED 110 #define IDB_BITMAP 110 #define IDC_EDIT1 1000 #define IDC_TITLE 1000 #define IDC_START 1001 #define IDC_PROGRESS 1003 #define IDC_INFO 1004 #define IDC_PYTHON15 1006 #define IDC_PATH 1007 #define IDC_PYTHON16 1008 #define IDC_INSTALL_PATH 1008 #define IDC_PYTHON20 1009 #define IDC_BROWSE 1010 #define IDC_INTRO_TEXT 1021 #define IDC_VERSIONS_LIST 1022 #define IDC_BUILD_INFO 1024 #define IDC_BITMAP 1025 #define IDC_OTHERPYTHON 1026 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 112 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1028 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif --- NEW FILE: wininst.dsp --- # Microsoft Developer Studio Project File - Name="wininst" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Application" 0x0101 CFG=wininst - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "wininst.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "wininst.mak" CFG="wininst - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "wininst - Win32 Release" (based on "Win32 (x86) Application") !MESSAGE "wininst - Win32 Debug" (based on "Win32 (x86) Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "wininst - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "." # PROP Intermediate_Dir "temp-release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /MD /W3 /O1 /I "zlib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x407 /d "NDEBUG" # ADD RSC /l 0x407 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 # ADD LINK32 imagehlp.lib comdlg32.lib ole32.lib zlibstat.lib comctl32.lib kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"LIBC" /libpath:"zlib\static32" # Begin Special Build Tool SOURCE="$(InputPath)" PostBuild_Cmds=c:\util\upx.exe --best wininst.exe # End Special Build Tool !ELSEIF "$(CFG)" == "wininst - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "." # PROP Intermediate_Dir "temp-debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /MD /W3 /Z7 /Od /I "zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x407 /d "_DEBUG" # ADD RSC /l 0x407 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept # ADD LINK32 imagehlp.lib comdlg32.lib ole32.lib zlibstat.lib comctl32.lib kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /nodefaultlib:"LIBC" /out:"./wininst_d.exe" /libpath:"zlib\static32" !ENDIF # Begin Target # Name "wininst - Win32 Release" # Name "wininst - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\extract.c # End Source File # Begin Source File SOURCE=.\install.c # End Source File # Begin Source File SOURCE=.\install.rc # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\archive.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # Begin Source File SOURCE=.\PythonPowered.bmp # End Source File # End Group # End Target # End Project --- NEW FILE: wininst.dsw --- Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "wininst"=.\wininst.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### From theller@users.sourceforge.net Fri Nov 22 20:43:32 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Fri, 22 Nov 2002 12:43:32 -0800 Subject: [Python-checkins] python/dist/src/PC/bdist_wininst wininst.dsp,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/PC/bdist_wininst In directory sc8-pr-cvs1:/tmp/cvs-serv15393 Modified Files: wininst.dsp Log Message: Oops, MSVC was still open, so the project file was not yet saved. Index: wininst.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/bdist_wininst/wininst.dsp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wininst.dsp 22 Nov 2002 20:39:33 -0000 1.1 --- wininst.dsp 22 Nov 2002 20:43:30 -0000 1.2 *************** *** 39,48 **** # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 ! # PROP Output_Dir "." # PROP Intermediate_Dir "temp-release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c ! # ADD CPP /nologo /MD /W3 /O1 /I "zlib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 --- 39,48 ---- # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 ! # PROP Output_Dir "..\..\lib\distutils\command" # PROP Intermediate_Dir "temp-release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c ! # ADD CPP /nologo /MD /W3 /O1 /I "..\..\Include" /I "..\..\..\zlib-1.1.4" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 *************** *** 54,61 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 ! # ADD LINK32 imagehlp.lib comdlg32.lib ole32.lib zlibstat.lib comctl32.lib kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"LIBC" /libpath:"zlib\static32" # Begin Special Build Tool SOURCE="$(InputPath)" ! PostBuild_Cmds=c:\util\upx.exe --best wininst.exe # End Special Build Tool --- 54,62 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 ! # ADD LINK32 ..\..\..\zlib-1.1.4\zlib.lib imagehlp.lib comdlg32.lib ole32.lib comctl32.lib kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"LIBC" # Begin Special Build Tool + TargetPath=\sf\python\dist\src\lib\distutils\command\wininst.exe SOURCE="$(InputPath)" ! PostBuild_Cmds=upx.exe --best $(TARGETPATH) || echo "wininst.exe not compressed" # End Special Build Tool *************** *** 74,78 **** # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c ! # ADD CPP /nologo /MD /W3 /Z7 /Od /I "zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 --- 75,79 ---- # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c ! # ADD CPP /nologo /MD /W3 /Z7 /Od /I "..\..\Include" /I "..\..\..\zlib-1.1.4" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 *************** *** 84,88 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 imagehlp.lib comdlg32.lib ole32.lib zlibstat.lib comctl32.lib kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /nodefaultlib:"LIBC" /out:"./wininst_d.exe" /libpath:"zlib\static32" !ENDIF --- 85,89 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 ..\..\..\zlib-1.1.4\zlib.lib imagehlp.lib comdlg32.lib ole32.lib comctl32.lib kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /nodefaultlib:"LIBC" /out:"./wininst_d.exe" !ENDIF From theller@users.sourceforge.net Fri Nov 22 20:57:23 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Fri, 22 Nov 2002 12:57:23 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_wininst.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1:/tmp/cvs-serv20487 Modified Files: bdist_wininst.py Log Message: get_python_version was not imported. Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_wininst.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** bdist_wininst.py 19 Nov 2002 13:12:28 -0000 1.43 --- bdist_wininst.py 22 Nov 2002 20:57:20 -0000 1.44 *************** *** 14,17 **** --- 14,18 ---- from distutils.dir_util import create_tree, remove_tree from distutils.errors import * + from distutils.sysconfig import get_python_version from distutils import log From theller@users.sourceforge.net Fri Nov 22 21:08:37 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Fri, 22 Nov 2002 13:08:37 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command wininst.exe,NONE,1.1 bdist_wininst.py,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1:/tmp/cvs-serv24441 Modified Files: bdist_wininst.py Added Files: wininst.exe Log Message: (This is hopefully the last large, funny checkin message for bdist_wininst.py we will see.) Removed the base64 encoded binary contents, wininst.exe must be in the same directory as this file now. wininst.exe must be recompiled and commited each time the sources in PC/bdist_wininst are changed. --- NEW FILE: wininst.exe --- (This appears to be a binary file; contents omitted.) Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_wininst.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** bdist_wininst.py 22 Nov 2002 20:57:20 -0000 1.44 --- bdist_wininst.py 22 Nov 2002 21:08:33 -0000 1.45 *************** *** 9,13 **** import sys, os, string - import base64 from distutils.core import Command from distutils.util import get_platform --- 9,12 ---- *************** *** 237,638 **** def get_exe_bytes (self): ! return base64.decodestring(EXEDATA) # class bdist_wininst - - if __name__ == '__main__': - # recreate EXEDATA from wininst.exe by rewriting this file - - # If you want to do this at home, you should: - # - checkout the *distutils* source code - # (see also http://sourceforge.net/cvs/?group_id=5470) - # by doing: - # cvs -d:pserver:anonymous@cvs.python.sourceforge.net:/cvsroot/python login - # and - # cvs -z3 -d:pserver:anonymous@cvs.python.sourceforge.net:/cvsroot/python co distutils - # - Built wininst.exe from the MSVC project file distutils/misc/wininst.dsw - # - Execute this file (distutils/distutils/command/bdist_wininst.py) - - import re - moddata = open("bdist_wininst.py", "r").read() - exedata = open("../../misc/wininst.exe", "rb").read() - print "wininst.exe length is %d bytes" % len(exedata) - print "wininst.exe encoded length is %d bytes" % len(base64.encodestring(exedata)) - exp = re.compile('EXE'+'DATA = """\\\\(\n.*)*\n"""', re.M) - data = exp.sub('EXE' + 'DATA = """\\\\\n%s"""' % - base64.encodestring(exedata), moddata) - open("bdist_wininst.py", "w").write(data) - print "bdist_wininst.py recreated" - - EXEDATA = """\ - TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAA8AAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1v - ZGUuDQ0KJAAAAAAAAAAjSEomZykkdWcpJHVnKSR1HDUodWQpJHUINi51bCkkdeQ1KnVlKSR1CDYg - dWUpJHVnKSR1aCkkdWcpJXXuKSR1BTY3dWwpJHVhCi51ZSkkdaAvInVmKSR1UmljaGcpJHUAAAAA - AAAAAAAAAAAAAAAAUEUAAEwBAwCllso9AAAAAAAAAADgAA8BCwEGAABQA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AAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAA== - """ - - # --- EOF --- --- 236,242 ---- def get_exe_bytes (self): ! # wininst.exe is in the same directory as this file ! directory = os.path.dirname(__file__) ! filename = os.path.join(directory, "wininst.exe") ! return open(filename, "rb").read() # class bdist_wininst From nnorwitz@users.sourceforge.net Fri Nov 22 23:29:34 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 22 Nov 2002 15:29:34 -0800 Subject: [Python-checkins] python/dist/src/Modules dbmmodule.c,2.33,2.34 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv8150/Modules Modified Files: dbmmodule.c Log Message: Fix SF # 640557, '64-bit' systems and the dbm module datum.dsize can apparently be long on some systems. Ensure we pass an int* to PyArg_Parse("s#"), not &datum.dsize Will backport. Index: dbmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/dbmmodule.c,v retrieving revision 2.33 retrieving revision 2.34 diff -C2 -d -r2.33 -r2.34 *** dbmmodule.c 2 Aug 2002 17:13:01 -0000 2.33 --- dbmmodule.c 22 Nov 2002 23:29:31 -0000 2.34 *************** *** 95,102 **** { datum drec, krec; ! if (!PyArg_Parse(key, "s#", &krec.dptr, &krec.dsize) ) return NULL; check_dbmobject_open(dp); drec = dbm_fetch(dp->di_dbm, krec); --- 95,104 ---- { datum drec, krec; + int tmp_size; ! if (!PyArg_Parse(key, "s#", &krec.dptr, &tmp_size) ) return NULL; + krec.dsize = tmp_size; check_dbmobject_open(dp); drec = dbm_fetch(dp->di_dbm, krec); *************** *** 118,127 **** { datum krec, drec; ! if ( !PyArg_Parse(v, "s#", &krec.dptr, &krec.dsize) ) { PyErr_SetString(PyExc_TypeError, "dbm mappings have string indices only"); return -1; } if (dp->di_dbm == NULL) { PyErr_SetString(DbmError, "DBM object has already been closed"); --- 120,131 ---- { datum krec, drec; + int tmp_size; ! if ( !PyArg_Parse(v, "s#", &krec.dptr, &tmp_size) ) { PyErr_SetString(PyExc_TypeError, "dbm mappings have string indices only"); return -1; } + krec.dsize = tmp_size; if (dp->di_dbm == NULL) { PyErr_SetString(DbmError, "DBM object has already been closed"); *************** *** 137,145 **** } } else { ! if ( !PyArg_Parse(w, "s#", &drec.dptr, &drec.dsize) ) { PyErr_SetString(PyExc_TypeError, "dbm mappings have string elements only"); return -1; } if ( dbm_store(dp->di_dbm, krec, drec, DBM_REPLACE) < 0 ) { dbm_clearerr(dp->di_dbm); --- 141,150 ---- } } else { ! if ( !PyArg_Parse(w, "s#", &drec.dptr, &tmp_size) ) { PyErr_SetString(PyExc_TypeError, "dbm mappings have string elements only"); return -1; } + drec.dsize = tmp_size; if ( dbm_store(dp->di_dbm, krec, drec, DBM_REPLACE) < 0 ) { dbm_clearerr(dp->di_dbm); *************** *** 209,215 **** { datum key, val; ! if (!PyArg_ParseTuple(args, "s#:has_key", &key.dptr, &key.dsize)) return NULL; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); --- 214,222 ---- { datum key, val; + int tmp_size; ! if (!PyArg_ParseTuple(args, "s#:has_key", &key.dptr, &tmp_size)) return NULL; + key.dsize = tmp_size; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); *************** *** 222,229 **** datum key, val; PyObject *defvalue = Py_None; if (!PyArg_ParseTuple(args, "s#|O:get", ! &key.dptr, &key.dsize, &defvalue)) return NULL; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); --- 229,238 ---- datum key, val; PyObject *defvalue = Py_None; + int tmp_size; if (!PyArg_ParseTuple(args, "s#|O:get", ! &key.dptr, &tmp_size, &defvalue)) return NULL; + key.dsize = tmp_size; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); *************** *** 241,248 **** datum key, val; PyObject *defvalue = NULL; if (!PyArg_ParseTuple(args, "s#|S:setdefault", ! &key.dptr, &key.dsize, &defvalue)) return NULL; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); --- 250,259 ---- datum key, val; PyObject *defvalue = NULL; + int tmp_size; if (!PyArg_ParseTuple(args, "s#|S:setdefault", ! &key.dptr, &tmp_size, &defvalue)) return NULL; + key.dsize = tmp_size; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); From nnorwitz@users.sourceforge.net Fri Nov 22 23:29:49 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 22 Nov 2002 15:29:49 -0800 Subject: [Python-checkins] python/dist/src/Modules dbmmodule.c,2.28,2.28.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv8539/Modules Modified Files: Tag: release22-maint dbmmodule.c Log Message: Fix SF # 640557, '64-bit' systems and the dbm module datum.dsize can apparently be long on some systems. Ensure we pass an int* to PyArg_Parse("s#"), not &datum.dsize Index: dbmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/dbmmodule.c,v retrieving revision 2.28 retrieving revision 2.28.6.1 diff -C2 -d -r2.28 -r2.28.6.1 *** dbmmodule.c 8 Dec 2001 18:02:56 -0000 2.28 --- dbmmodule.c 22 Nov 2002 23:29:47 -0000 2.28.6.1 *************** *** 91,98 **** { datum drec, krec; ! if (!PyArg_Parse(key, "s#", &krec.dptr, &krec.dsize) ) return NULL; check_dbmobject_open(dp); drec = dbm_fetch(dp->di_dbm, krec); --- 91,100 ---- { datum drec, krec; + int tmp_size; ! if (!PyArg_Parse(key, "s#", &krec.dptr, &tmp_size) ) return NULL; + krec.dsize = tmp_size; check_dbmobject_open(dp); drec = dbm_fetch(dp->di_dbm, krec); *************** *** 114,123 **** { datum krec, drec; ! if ( !PyArg_Parse(v, "s#", &krec.dptr, &krec.dsize) ) { PyErr_SetString(PyExc_TypeError, "dbm mappings have string indices only"); return -1; } if (dp->di_dbm == NULL) { PyErr_SetString(DbmError, "DBM object has already been closed"); --- 116,127 ---- { datum krec, drec; + int tmp_size; ! if ( !PyArg_Parse(v, "s#", &krec.dptr, &tmp_size) ) { PyErr_SetString(PyExc_TypeError, "dbm mappings have string indices only"); return -1; } + krec.dsize = tmp_size; if (dp->di_dbm == NULL) { PyErr_SetString(DbmError, "DBM object has already been closed"); *************** *** 133,141 **** } } else { ! if ( !PyArg_Parse(w, "s#", &drec.dptr, &drec.dsize) ) { PyErr_SetString(PyExc_TypeError, "dbm mappings have string elements only"); return -1; } if ( dbm_store(dp->di_dbm, krec, drec, DBM_REPLACE) < 0 ) { dbm_clearerr(dp->di_dbm); --- 137,146 ---- } } else { ! if ( !PyArg_Parse(w, "s#", &drec.dptr, &tmp_size) ) { PyErr_SetString(PyExc_TypeError, "dbm mappings have string elements only"); return -1; } + drec.dsize = tmp_size; if ( dbm_store(dp->di_dbm, krec, drec, DBM_REPLACE) < 0 ) { dbm_clearerr(dp->di_dbm); *************** *** 205,211 **** { datum key, val; ! if (!PyArg_ParseTuple(args, "s#:has_key", &key.dptr, &key.dsize)) return NULL; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); --- 210,218 ---- { datum key, val; + int tmp_size; ! if (!PyArg_ParseTuple(args, "s#:has_key", &key.dptr, &tmp_size)) return NULL; + key.dsize = tmp_size; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); *************** *** 218,225 **** datum key, val; PyObject *defvalue = Py_None; if (!PyArg_ParseTuple(args, "s#|O:get", ! &key.dptr, &key.dsize, &defvalue)) return NULL; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); --- 225,234 ---- datum key, val; PyObject *defvalue = Py_None; + int tmp_size; if (!PyArg_ParseTuple(args, "s#|O:get", ! &key.dptr, &tmp_size, &defvalue)) return NULL; + key.dsize = tmp_size; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); *************** *** 237,244 **** datum key, val; PyObject *defvalue = NULL; if (!PyArg_ParseTuple(args, "s#|S:setdefault", ! &key.dptr, &key.dsize, &defvalue)) return NULL; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); --- 246,255 ---- datum key, val; PyObject *defvalue = NULL; + int tmp_size; if (!PyArg_ParseTuple(args, "s#|S:setdefault", ! &key.dptr, &tmp_size, &defvalue)) return NULL; + key.dsize = tmp_size; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); From jackjansen@users.sourceforge.net Fri Nov 22 23:39:54 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 22 Nov 2002 15:39:54 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules Nav.c,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv11590 Modified Files: Nav.c Log Message: Allow access to the returned value(s) as FSRefs. Unfortunately for some reason getting at saveFileName doesn't work, so it currently only really works for opening files for reading. Index: Nav.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/Nav.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Nav.c 17 Jul 2002 16:30:34 -0000 1.18 --- Nav.c 22 Nov 2002 23:39:52 -0000 1.19 *************** *** 317,324 **** { FSSpec fss; if( strcmp(name, "__members__") == 0 ) ! return Py_BuildValue("sssssss", "version", "validRecord", "replacing", ! "isStationery", "translationNeeded", "selection", "fileTranslation"); if( strcmp(name, "version") == 0 ) return Py_BuildValue("h", self->itself.version); --- 317,326 ---- { FSSpec fss; + FSRef fsr; if( strcmp(name, "__members__") == 0 ) ! return Py_BuildValue("ssssssssss", "version", "validRecord", "replacing", ! "isStationery", "translationNeeded", "selection", "selection_fsr", ! "fileTranslation", "keyScript", "saveFileName"); if( strcmp(name, "version") == 0 ) return Py_BuildValue("h", self->itself.version); *************** *** 365,370 **** --- 367,406 ---- return rv; } + if( strcmp(name, "selection_fsr") == 0 ) { + SInt32 i, count; + OSErr err; + PyObject *rv, *rvitem; + AEDesc desc; + + if (err=AECountItems(&self->itself.selection, &count)) { + PyErr_Mac(ErrorObject, err); + return NULL; + } + if ( (rv=PyList_New(count)) == NULL ) + return NULL; + for(i=0; iitself.selection, i+1, typeFSRef, NULL, &desc)) { + Py_DECREF(rv); + PyErr_Mac(ErrorObject, err); + return NULL; + } + if (err=AEGetDescData(&desc, &fsr, sizeof(FSRef))) { + Py_DECREF(rv); + PyErr_Mac(ErrorObject, err); + return NULL; + } + rvitem = PyMac_BuildFSRef(&fsr); + PyList_SetItem(rv, i, rvitem); + AEDisposeDesc(&desc); + } + return rv; + } if( strcmp(name, "fileTranslation") == 0 ) return ResObj_New((Handle)self->itself.fileTranslation); + if( strcmp(name, "keyScript") == 0 ) + return Py_BuildValue("h", (short)self->itself.keyScript); + if( strcmp(name, "saveFileName") == 0 ) + return Py_BuildValue("O&", CFStringRefObj_New, self->itself.saveFileName); From tim_one@users.sourceforge.net Sat Nov 23 03:49:10 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 22 Nov 2002 19:49:10 -0800 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.106,1.107 readme.txt,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv16322/python/PCbuild Modified Files: python20.wse readme.txt Log Message: More bsddb-on-Windows fiddling: + News blurb, but as much XXX as news. + Updated installer (install the new bsddb package, and the Berkeley DLL; still don't know how to fold that into _bsddb.pyd). + Fleshed out build instructions. + Debug Python still blows up. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** python20.wse 19 Nov 2002 17:38:26 -0000 1.106 --- python20.wse 23 Nov 2002 03:49:08 -0000 1.107 *************** *** 1726,1731 **** end item: Install File ! Source=.\bsddb.pyd ! Destination=%MAINDIR%\DLLs\bsddb.pyd Flags=0000000000000010 end --- 1726,1731 ---- end item: Install File ! Source=.\_bsddb.pyd ! Destination=%MAINDIR%\DLLs\_bsddb.pyd Flags=0000000000000010 end *************** *** 1808,1813 **** end item: Install File ! Source=.\bsddb.lib ! Destination=%MAINDIR%\libs\bsddb.lib Flags=0000000000000010 end --- 1808,1813 ---- end item: Install File ! Source=.\_bsddb.lib ! Destination=%MAINDIR%\libs\_bsddb.lib Flags=0000000000000010 end *************** *** 1854,1857 **** --- 1854,1868 ---- item: Remark end + item: Remark + Text=Oddball -- the Sleepcat DLL + end + item: Install File + Source=..\..\db-4.0.14\build_win32\Release\libdb40.dll + Destination=%MAINDIR%\DLLs\libdb40.dll + Description=Sleepycat Berekely DB DLL + Flags=0000000000000010 + end + item: Remark + end item: Install File Source=.\python%_pymajor_%%_pyminor_%.lib *************** *** 1888,1891 **** --- 1899,1910 ---- Description=Library Modules Flags=0000000000000010 + end + item: Remark + end + item: Install File + Source=..\lib\bsddb\*.py + Destination=%MAINDIR%\Lib\bsddb + Description=Berkeley database package + Flags=0000000100000010 end item: Remark Index: readme.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/readme.txt,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** readme.txt 22 Nov 2002 20:00:34 -0000 1.29 --- readme.txt 23 Nov 2002 03:49:08 -0000 1.30 *************** *** 177,180 **** --- 177,185 ---- and follow the instructions for building the Sleepycat software. Build the Release version. + NOTE: The instructions are for a later release of the software, + so use your imagination. Berkeley_DB.dsw in this release was + also pre-MSVC6, so you'll be prompted to upgrade the format (say + yes, of course). Choose configuration "db_buildall - Win32 Release", + and build db_buildall.exe. XXX You have to copy *************** *** 188,193 **** XXX bsddb 1.85 project apparently managed to do, link the Berkeley XXX DLL into the guts of our _bsddb.pyd. I don't know how to. - - XXX The installer needs to be changed accordingly. XXX The Sleepycat release we use will probably change before --- 193,196 ---- From tim_one@users.sourceforge.net Sat Nov 23 03:49:10 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 22 Nov 2002 19:49:10 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.534,1.535 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv16322/python/Misc Modified Files: NEWS Log Message: More bsddb-on-Windows fiddling: + News blurb, but as much XXX as news. + Updated installer (install the new bsddb package, and the Berkeley DLL; still don't know how to fold that into _bsddb.pyd). + Fleshed out build instructions. + Debug Python still blows up. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.534 retrieving revision 1.535 diff -C2 -d -r1.534 -r1.535 *** NEWS 22 Nov 2002 08:36:54 -0000 1.534 --- NEWS 23 Nov 2002 03:49:05 -0000 1.535 *************** *** 808,811 **** --- 808,819 ---- ------- + - The Windows distribution now ships with version 4.0.14 of the + Sleepycat Berkeley database library. This should be a huge + improvement over the previous Berkeley DB 1.85, which had many + bugs. + XXX What are the licensing issues here? + XXX The debug Python still blows up (see PCbuild/readme.txt). + XXX The version # is likely to change before 2.3a1. + - The Windows distribution now ships with Tcl/Tk version 8.4.1 (it previously shipped with Tcl/Tk 8.3.2). From loewis@users.sourceforge.net Sat Nov 23 09:13:42 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 01:13:42 -0800 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.49,2.50 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv25570/Objects Modified Files: obmalloc.c Log Message: Remove MALLOC_ZERO_RETURNS_NULL. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -d -r2.49 -r2.50 *** obmalloc.c 26 Oct 2002 15:01:53 -0000 2.49 --- obmalloc.c 23 Nov 2002 09:13:40 -0000 2.50 *************** *** 689,696 **** * has been reached. */ - #ifdef MALLOC_ZERO_RETURNS_NULL if (nbytes == 0) nbytes = 1; - #endif return (void *)malloc(nbytes); } --- 689,694 ---- From loewis@users.sourceforge.net Sat Nov 23 09:13:42 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 01:13:42 -0800 Subject: [Python-checkins] python/dist/src/Include pymem.h,2.16,2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv25570/Include Modified Files: pymem.h Log Message: Remove MALLOC_ZERO_RETURNS_NULL. Index: pymem.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pymem.h,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -d -r2.16 -r2.17 *** pymem.h 12 Aug 2002 07:21:57 -0000 2.16 --- pymem.h 23 Nov 2002 09:13:40 -0000 2.17 *************** *** 63,76 **** #else /* ! PYMALLOC_DEBUG */ ! #ifdef MALLOC_ZERO_RETURNS_NULL #define PyMem_MALLOC(n) malloc((n) ? (n) : 1) - #else - #define PyMem_MALLOC malloc - #endif - - /* Caution: whether MALLOC_ZERO_RETURNS_NULL is #defined has nothing to - do with whether platform realloc(non-NULL, 0) normally frees the memory - or returns NULL. Rather than introduce yet another config variation, - just make a realloc to 0 bytes act as if to 1 instead. */ #define PyMem_REALLOC(p, n) realloc((p), (n) ? (n) : 1) --- 63,71 ---- #else /* ! PYMALLOC_DEBUG */ ! /* PyMem_MALLOC(0) means malloc(1). Some systems would return NULL ! for malloc(0), which would be treated as an error. Some platforms ! would return a pointer with no memory behind it, which would break ! pymalloc. To solve these problems, allocate an extra byte. */ #define PyMem_MALLOC(n) malloc((n) ? (n) : 1) #define PyMem_REALLOC(p, n) realloc((p), (n) ? (n) : 1) From loewis@users.sourceforge.net Sat Nov 23 09:13:43 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 01:13:43 -0800 Subject: [Python-checkins] python/dist/src/RISCOS pyconfig.h,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS In directory sc8-pr-cvs1:/tmp/cvs-serv25570/RISCOS Modified Files: pyconfig.h Log Message: Remove MALLOC_ZERO_RETURNS_NULL. Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/RISCOS/pyconfig.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pyconfig.h 7 Jul 2002 03:59:34 -0000 1.5 --- pyconfig.h 23 Nov 2002 09:13:40 -0000 1.6 *************** *** 185,191 **** #undef HAVE_BROKEN_NICE - /* Define if malloc(0) returns a NULL pointer */ - #undef MALLOC_ZERO_RETURNS_NULL - /* Define if you have POSIX threads */ #undef _POSIX_THREADS --- 185,188 ---- From loewis@users.sourceforge.net Sat Nov 23 09:13:42 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 01:13:42 -0800 Subject: [Python-checkins] python/dist/src configure,1.360,1.361 configure.in,1.371,1.372 pyconfig.h.in,1.62,1.63 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv25570 Modified Files: configure configure.in pyconfig.h.in Log Message: Remove MALLOC_ZERO_RETURNS_NULL. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.360 retrieving revision 1.361 diff -C2 -d -r1.360 -r1.361 *** configure 21 Nov 2002 20:41:21 -0000 1.360 --- configure 23 Nov 2002 09:13:38 -0000 1.361 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.370 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.371 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 15306,15372 **** LIBS=$LIBS_SAVE - - # check whether malloc(0) returns NULL or not - echo "$as_me:$LINENO: checking what malloc(0) returns" >&5 - echo $ECHO_N "checking what malloc(0) returns... $ECHO_C" >&6 - if test "${ac_cv_malloc_zero+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - if test "$cross_compiling" = yes; then - ac_cv_malloc_zero=nonnull - else - cat >conftest.$ac_ext <<_ACEOF - #line $LINENO "configure" - #include "confdefs.h" - #include - #ifdef HAVE_STDLIB - #include - #else - char *malloc(), *realloc(); - int *free(); - #endif - main() { - char *p; - p = malloc(0); - if (p == NULL) exit(1); - p = realloc(p, 0); - if (p == NULL) exit(1); - free(p); - exit(0); - } - _ACEOF - rm -f conftest$ac_exeext - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_malloc_zero=nonnull - else - echo "$as_me: program exited with status $ac_status" >&5 - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ( exit $ac_status ) - ac_cv_malloc_zero=null - fi - rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext - fi - fi - # XXX arm cross-compile? - echo "$as_me:$LINENO: result: $ac_cv_malloc_zero" >&5 - echo "${ECHO_T}$ac_cv_malloc_zero" >&6 - if test "$ac_cv_malloc_zero" = null - then - - cat >>confdefs.h <<\_ACEOF - #define MALLOC_ZERO_RETURNS_NULL 1 - _ACEOF - - fi # check for wchar.h --- 15306,15309 ---- Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.371 retrieving revision 1.372 diff -C2 -d -r1.371 -r1.372 *** configure.in 21 Nov 2002 20:41:28 -0000 1.371 --- configure.in 23 Nov 2002 09:13:40 -0000 1.372 *************** *** 2244,2276 **** LIBS=$LIBS_SAVE - # check whether malloc(0) returns NULL or not - AC_MSG_CHECKING(what malloc(0) returns) - AC_CACHE_VAL(ac_cv_malloc_zero, - [AC_TRY_RUN([#include - #ifdef HAVE_STDLIB - #include - #else - char *malloc(), *realloc(); - int *free(); - #endif - main() { - char *p; - p = malloc(0); - if (p == NULL) exit(1); - p = realloc(p, 0); - if (p == NULL) exit(1); - free(p); - exit(0); - }], - ac_cv_malloc_zero=nonnull, - ac_cv_malloc_zero=null, - ac_cv_malloc_zero=nonnull)]) # XXX arm cross-compile? - AC_MSG_RESULT($ac_cv_malloc_zero) - if test "$ac_cv_malloc_zero" = null - then - AC_DEFINE(MALLOC_ZERO_RETURNS_NULL, 1, - [Define if malloc(0) returns a NULL pointer.]) - fi - # check for wchar.h AC_CHECK_HEADER(wchar.h, [ --- 2244,2247 ---- Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** pyconfig.h.in 21 Nov 2002 20:41:28 -0000 1.62 --- pyconfig.h.in 23 Nov 2002 09:13:40 -0000 1.63 *************** *** 604,610 **** #undef MAJOR_IN_SYSMACROS - /* Define if malloc(0) returns a NULL pointer. */ - #undef MALLOC_ZERO_RETURNS_NULL - /* Define if mvwdelch in curses.h is an expression. */ #undef MVWDELCH_IS_EXPRESSION --- 604,607 ---- From loewis@users.sourceforge.net Sat Nov 23 09:16:21 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 01:16:21 -0800 Subject: [Python-checkins] python/dist/src/Modules bz2module.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv26428/Modules Modified Files: bz2module.c Log Message: Include Python.h first. Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** bz2module.c 9 Nov 2002 04:33:36 -0000 1.11 --- bz2module.c 23 Nov 2002 09:16:19 -0000 1.12 *************** *** 8,14 **** */ #include #include - #include "Python.h" #include "structmember.h" --- 8,14 ---- */ + #include "Python.h" #include #include #include "structmember.h" From jvr@users.sourceforge.net Sat Nov 23 09:45:06 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sat, 23 Nov 2002 01:45:06 -0800 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.130,2.131 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv31972/Objects Modified Files: dictobject.c Log Message: Patch #642500 with slight modifications: allow keyword arguments in dict() constructor. Example: >>> dict(a=1, b=2) {'a': 1, 'b': 2} >>> Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.130 retrieving revision 2.131 diff -C2 -d -r2.130 -r2.131 *** dictobject.c 4 Sep 2002 11:29:45 -0000 2.130 --- dictobject.c 23 Nov 2002 09:45:04 -0000 2.131 *************** *** 1706,1710 **** setdefault_doc__}, {"pop", (PyCFunction)dict_pop, METH_O, ! pop__doc__}, {"popitem", (PyCFunction)dict_popitem, METH_NOARGS, popitem__doc__}, --- 1706,1710 ---- setdefault_doc__}, {"pop", (PyCFunction)dict_pop, METH_O, ! pop__doc__}, {"popitem", (PyCFunction)dict_popitem, METH_NOARGS, popitem__doc__}, *************** *** 1782,1790 **** { PyObject *arg = NULL; - static char *kwlist[] = {"items", 0}; int result = 0; ! if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:dict", ! kwlist, &arg)) result = -1; --- 1782,1788 ---- { PyObject *arg = NULL; int result = 0; ! if (!PyArg_ParseTuple(args, "|O:dict", &arg)) result = -1; *************** *** 1795,1798 **** --- 1793,1798 ---- result = PyDict_MergeFromSeq2(self, arg, 1); } + if (result == 0 && kwds != NULL) + result = PyDict_Merge(self, kwds, 1); return result; } *************** *** 1818,1822 **** " d = {}\n" " for k, v in seq:\n" ! " d[k] = v"); PyTypeObject PyDict_Type = { --- 1818,1824 ---- " d = {}\n" " for k, v in seq:\n" ! " d[k] = v\n" ! "dict(**kwargs) -> new dictionary initialized with the name=value pairs\n" ! " in the keyword argument list. For example: dict(one=1, two=2)"); PyTypeObject PyDict_Type = { From jvr@users.sourceforge.net Sat Nov 23 09:45:06 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sat, 23 Nov 2002 01:45:06 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.159,1.160 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv31972/Lib/test Modified Files: test_descr.py Log Message: Patch #642500 with slight modifications: allow keyword arguments in dict() constructor. Example: >>> dict(a=1, b=2) {'a': 1, 'b': 2} >>> Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** test_descr.py 14 Nov 2002 19:50:14 -0000 1.159 --- test_descr.py 23 Nov 2002 09:45:04 -0000 1.160 *************** *** 185,194 **** d = dict({}) vereq(d, {}) ! d = dict(items={}) vereq(d, {}) d = dict({1: 2, 'a': 'b'}) vereq(d, {1: 2, 'a': 'b'}) vereq(d, dict(d.items())) ! vereq(d, dict(items=d.iteritems())) for badarg in 0, 0L, 0j, "0", [0], (0,): try: --- 185,201 ---- d = dict({}) vereq(d, {}) ! d = dict({}) vereq(d, {}) d = dict({1: 2, 'a': 'b'}) vereq(d, {1: 2, 'a': 'b'}) vereq(d, dict(d.items())) ! vereq(d, dict(d.iteritems())) ! d = dict({'one':1, 'two':2}) ! vereq(d, dict(one=1, two=2)) ! vereq(d, dict(**d)) ! vereq(d, dict({"one": 1}, two=2)) ! vereq(d, dict([("two", 2)], one=1)) ! vereq(d, dict([("one", 100), ("two", 200)], **d)) ! verify(d is not dict(**d)) for badarg in 0, 0L, 0j, "0", [0], (0,): try: *************** *** 206,215 **** else: raise TestFailed("no TypeError from dict(%r)" % badarg) - try: - dict(senseless={}) - except TypeError: - pass - else: - raise TestFailed("no TypeError from dict(senseless={})") try: --- 213,216 ---- *************** *** 233,237 **** Mapping.keys = lambda self: self.dict.keys() Mapping.__getitem__ = lambda self, i: self.dict[i] ! d = dict(items=Mapping()) vereq(d, Mapping.dict) --- 234,238 ---- Mapping.keys = lambda self: self.dict.keys() Mapping.__getitem__ = lambda self, i: self.dict[i] ! d = dict(Mapping()) vereq(d, Mapping.dict) *************** *** 2333,2340 **** vereq(tuple(sequence=range(3)), (0, 1, 2)) vereq(list(sequence=(0, 1, 2)), range(3)) ! vereq(dict(items={1: 2}), {1: 2}) for constructor in (int, float, long, complex, str, unicode, ! tuple, list, dict, file): try: constructor(bogus_keyword_arg=1) --- 2334,2341 ---- vereq(tuple(sequence=range(3)), (0, 1, 2)) vereq(list(sequence=(0, 1, 2)), range(3)) ! # note: as of Python 2.3, dict() no longer has an "items" keyword arg for constructor in (int, float, long, complex, str, unicode, ! tuple, list, file): try: constructor(bogus_keyword_arg=1) From jvr@users.sourceforge.net Sat Nov 23 09:45:06 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sat, 23 Nov 2002 01:45:06 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.120,1.121 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv31972/Doc/lib Modified Files: libfuncs.tex Log Message: Patch #642500 with slight modifications: allow keyword arguments in dict() constructor. Example: >>> dict(a=1, b=2) {'a': 1, 'b': 2} >>> Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -d -r1.120 -r1.121 *** libfuncs.tex 19 Nov 2002 20:49:13 -0000 1.120 --- libfuncs.tex 23 Nov 2002 09:45:03 -0000 1.121 *************** *** 190,214 **** \begin{funcdesc}{dict}{\optional{mapping-or-sequence}} ! Return a new dictionary initialized from the optional argument. ! If an argument is not specified, return a new empty dictionary. ! If the argument is a mapping object, return a dictionary mapping the ! same keys to the same values as does the mapping object. ! Else the argument must be a sequence, a container that supports ! iteration, or an iterator object. The elements of the argument must ! each also be of one of those kinds, and each must in turn contain exactly two objects. The first is used as a key in the new dictionary, and the second as the key's value. If a given key is seen more than once, the last value associated with it is retained in the new dictionary. For example, these all return a dictionary equal to ! \code{\{1: 2, 2: 3\}}: \begin{itemize} ! \item \code{dict(\{1: 2, 2: 3\})} ! \item \code{dict(\{1: 2, 2: 3\}.items())} ! \item \code{dict(\{1: 2, 2: 3\}.iteritems())} ! \item \code{dict(zip((1, 2), (2, 3)))} ! \item \code{dict([[2, 3], [1, 2]])} ! \item \code{dict([(i-1, i) for i in (2, 3)])} \end{itemize} --- 190,221 ---- \begin{funcdesc}{dict}{\optional{mapping-or-sequence}} ! Return a new dictionary initialized from an optional positional ! argument or from a set of keyword arguments. ! If no arguments are given, return a new empty dictionary. ! If the positional argument is a mapping object, return a dictionary ! mapping the same keys to the same values as does the mapping object. ! Otherwise the positional argument must be a sequence, a container that ! supports iteration, or an iterator object. The elements of the argument ! must each also be of one of those kinds, and each must in turn contain exactly two objects. The first is used as a key in the new dictionary, and the second as the key's value. If a given key is seen more than once, the last value associated with it is retained in the new dictionary. + + If keyword arguments are given, the keywords themselves with their + associated values are added as items to the dictionary. If a key + is specified both in the positional argument and as a keyword argument, + the value associated with the keyword is retained in the dictionary. For example, these all return a dictionary equal to ! \code{\{"one": 2, "two": 3\}}: \begin{itemize} ! \item \code{dict(\{'one': 2, 'two': 3\})} ! \item \code{dict(\{'one': 2, 'two': 3\}.items())} ! \item \code{dict(\{'one': 2, 'two': 3\}.iteritems())} ! \item \code{dict(zip(('one', 'two'), (2, 3)))} ! \item \code{dict([['two', 3], ['one', 2]])} ! \item \code{dict(one=2, two=3)} ! \item \code{dict([(['one', 'two'][i-2], i) for i in (2, 3)])} \end{itemize} From jvr@users.sourceforge.net Sat Nov 23 09:45:06 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sat, 23 Nov 2002 01:45:06 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.535,1.536 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv31972/Misc Modified Files: NEWS Log Message: Patch #642500 with slight modifications: allow keyword arguments in dict() constructor. Example: >>> dict(a=1, b=2) {'a': 1, 'b': 2} >>> Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.535 retrieving revision 1.536 diff -C2 -d -r1.535 -r1.536 *** NEWS 23 Nov 2002 03:49:05 -0000 1.535 --- NEWS 23 Nov 2002 09:45:04 -0000 1.536 *************** *** 12,15 **** --- 12,21 ---- Type/class unification and new-style classes -------------------------------------------- + - dict() now accepts keyword arguments so that dict(one=1,two=2) + is the equivalent of dict([('one',1),('two',2)]). Accordingly, + the existing (but undocumented) 'items' keyword argument has + been eliminated. This means that dict(items=someMapping) now has + a different meaning than before. + - int() now returns a long object if the argument is outside the integer range, so int("4"*1000), int(1e200) and int(1L<<1000) will From loewis@users.sourceforge.net Sat Nov 23 11:26:10 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 03:26:10 -0800 Subject: [Python-checkins] python/dist/src/Modules _bsddb.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv21585/Modules Modified Files: _bsddb.c Log Message: Merge with bsddb3 2002.11.23.10.42.36 Index: _bsddb.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _bsddb.c 19 Nov 2002 08:09:52 -0000 1.1 --- _bsddb.c 23 Nov 2002 11:26:07 -0000 1.2 *************** *** 76,85 **** /* Various macro definitions */ ! #define PY_BSDDB_VERSION "3.4.0" /* 40 = 4.0, 33 = 3.3; this will break if the second number is > 9 */ #define DBVER (DB_VERSION_MAJOR * 10 + DB_VERSION_MINOR) ! static char *orig_rcs_id = "/Id: _db.c,v 1.44 2002/06/07 18:24:00 greg Exp /"; static char *rcs_id = "$Id$"; --- 76,85 ---- /* Various macro definitions */ ! #define PY_BSDDB_VERSION "3.4.2" /* 40 = 4.0, 33 = 3.3; this will break if the second number is > 9 */ #define DBVER (DB_VERSION_MAJOR * 10 + DB_VERSION_MINOR) ! static char *orig_rcs_id = "/Id: _db.c,v 1.48 2002/11/21 19:11:19 greg Exp /"; static char *rcs_id = "$Id$"; *************** *** 1013,1017 **** secondaryDB->primaryDBType = _DB_get_type(self); ! MYDB_BEGIN_ALLOW_THREADS; err = self->db->associate(self->db, --- 1013,1027 ---- secondaryDB->primaryDBType = _DB_get_type(self); ! /* PyEval_InitThreads is called here due to a quirk in python 1.5 ! * - 2.2.1 (at least) according to Russell Williamson : ! * The global interepreter lock is not initialized until the first ! * thread is created using thread.start_new_thread() or fork() is ! * called. that would cause the ALLOW_THREADS here to segfault due ! * to a null pointer reference if no threads or child processes ! * have been created. This works around that and is a no-op if ! * threads have already been initialized. ! * (see pybsddb-users mailing list post on 2002-08-07) ! */ ! PyEval_InitThreads(); MYDB_BEGIN_ALLOW_THREADS; err = self->db->associate(self->db, *************** *** 2324,2329 **** return NULL; - CHECK_CURSOR_NOT_CLOSED(self); - if (self->dbc != NULL) { MYDB_BEGIN_ALLOW_THREADS; --- 2334,2337 ---- *************** *** 2414,2418 **** DBC_get(DBCursorObject* self, PyObject* args, PyObject *kwargs) { ! int err, flags; PyObject* keyobj = NULL; PyObject* dataobj = NULL; --- 2422,2426 ---- DBC_get(DBCursorObject* self, PyObject* args, PyObject *kwargs) { ! int err, flags=0; PyObject* keyobj = NULL; PyObject* dataobj = NULL; *************** *** 3299,3303 **** DB_LOCK_STAT* sp; PyObject* d = NULL; ! u_int32_t flags; if (!PyArg_ParseTuple(args, "|i:lock_stat", &flags)) --- 3307,3311 ---- DB_LOCK_STAT* sp; PyObject* d = NULL; ! u_int32_t flags = 0; if (!PyArg_ParseTuple(args, "|i:lock_stat", &flags)) *************** *** 3411,3415 **** DB_TXN_STAT* sp; PyObject* d = NULL; ! u_int32_t flags; if (!PyArg_ParseTuple(args, "|i:txn_stat", &flags)) --- 3419,3423 ---- DB_TXN_STAT* sp; PyObject* d = NULL; ! u_int32_t flags=0; if (!PyArg_ParseTuple(args, "|i:txn_stat", &flags)) From loewis@users.sourceforge.net Sat Nov 23 11:26:09 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 03:26:09 -0800 Subject: [Python-checkins] python/dist/src/Lib/bsddb dbtables.py,1.2,1.3 dbutils.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb In directory sc8-pr-cvs1:/tmp/cvs-serv21585/Lib/bsddb Modified Files: dbtables.py dbutils.py Log Message: Merge with bsddb3 2002.11.23.10.42.36 Index: dbtables.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/dbtables.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dbtables.py 19 Nov 2002 17:48:49 -0000 1.2 --- dbtables.py 23 Nov 2002 11:26:06 -0000 1.3 *************** *** 2,5 **** --- 2,6 ---- # # Copyright (C) 2000, 2001 by Autonomous Zone Industries + # Copyright (C) 2002 Gregory P. Smith # # License: This is free software. You may use this software for any *************** *** 55,58 **** --- 56,66 ---- return s[:len(self.prefix)] == self.prefix + class PostfixCond(Cond): + """Acts as a condition function for matching a string postfix""" + def __init__(self, postfix): + self.postfix = postfix + def __call__(self, s): + return s[-len(self.postfix):] == self.postfix + class LikeCond(Cond): """ *************** *** 524,538 **** # succeeds, add row to our match list. if not condition or condition(data) : ! # only create new entries in matcing_rowids on ! # the first pass, otherwise reject the ! # rowid as it must not have matched ! # the previous passes ! if column_num == 0 : ! if not matching_rowids.has_key(rowid) : ! matching_rowids[rowid] = {} ! if savethiscolumndata : ! matching_rowids[rowid][column] = data ! else : ! rejected_rowids[rowid] = rowid else : if matching_rowids.has_key(rowid) : --- 532,539 ---- # succeeds, add row to our match list. if not condition or condition(data) : ! if not matching_rowids.has_key(rowid) : ! matching_rowids[rowid] = {} ! if savethiscolumndata : ! matching_rowids[rowid][column] = data else : if matching_rowids.has_key(rowid) : Index: dbutils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/dbutils.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dbutils.py 19 Nov 2002 08:09:52 -0000 1.1 --- dbutils.py 23 Nov 2002 11:26:07 -0000 1.2 *************** *** 1,10 **** #------------------------------------------------------------------------ # - # In my performance tests, using this (as in dbtest.py test4) is - # slightly slower than simply compiling _db.c with MYDB_THREAD - # undefined to prevent multithreading support in the C module. - # Using NoDeadlockDb also prevent deadlocks from mutliple processes - # accessing the same database. - # # Copyright (C) 2000 Autonomous Zone Industries # --- 1,4 ---- *************** *** 19,23 **** # # Note: I don't know how useful this is in reality since when a ! # DBDeadlockError happens the current transaction is supposed to be # aborted. If it doesn't then when the operation is attempted again # the deadlock is still happening... --- 13,17 ---- # # Note: I don't know how useful this is in reality since when a ! # DBLockDeadlockError happens the current transaction is supposed to be # aborted. If it doesn't then when the operation is attempted again # the deadlock is still happening... *************** *** 35,43 **** del sleep ! import _db ! _deadlock_MinSleepTime = 1.0/64 # always sleep at least N seconds between retrys ! _deadlock_MaxSleepTime = 1.0 # never sleep more than N seconds between retrys def DeadlockWrap(function, *_args, **_kwargs): --- 29,39 ---- del sleep ! import _bsddb ! _deadlock_MinSleepTime = 1.0/64 # always sleep at least N seconds between retrys ! _deadlock_MaxSleepTime = 3.14159 # never sleep more than N seconds between retrys + _deadlock_VerboseFile = None # Assign a file object to this for a "sleeping" + # message to be written to it each retry def DeadlockWrap(function, *_args, **_kwargs): *************** *** 45,51 **** function in case of a database deadlock. ! This is a DeadlockWrapper method which DB calls can be made using to ! preform infinite retrys with sleeps in between when a DBLockDeadlockError ! exception is raised in a database call: d = DB(...) --- 41,50 ---- function in case of a database deadlock. ! This is a function intended to be used to wrap database calls such ! that they perform retrys with exponentially backing off sleeps in ! between when a DBLockDeadlockError exception is raised. ! ! A 'max_retries' parameter may optionally be passed to prevent it ! from retrying forever (in which case the exception will be reraised). d = DB(...) *************** *** 54,62 **** """ sleeptime = _deadlock_MinSleepTime ! while (1) : try: return apply(function, _args, _kwargs) except _db.DBLockDeadlockError: ! print 'DeadlockWrap sleeping ', sleeptime _sleep(sleeptime) # exponential backoff in the sleep time --- 53,65 ---- """ sleeptime = _deadlock_MinSleepTime ! max_retries = _kwargs.get('max_retries', -1) ! if _kwargs.has_key('max_retries'): ! del _kwargs['max_retries'] ! while 1: try: return apply(function, _args, _kwargs) except _db.DBLockDeadlockError: ! if _deadlock_VerboseFile: ! _deadlock_VerboseFile.write('dbutils.DeadlockWrap: sleeping %1.3f\n' % sleeptime) _sleep(sleeptime) # exponential backoff in the sleep time *************** *** 64,67 **** --- 67,73 ---- if sleeptime > _deadlock_MaxSleepTime : sleeptime = _deadlock_MaxSleepTime + max_retries = max_retries - 1 + if max_retries == -1: + raise From loewis@users.sourceforge.net Sat Nov 23 11:26:09 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 03:26:09 -0800 Subject: [Python-checkins] python/dist/src/Lib/bsddb/test test_dbshelve.py,1.1,1.2 test_dbtables.py,1.1,1.2 test_thread.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb/test In directory sc8-pr-cvs1:/tmp/cvs-serv21585/Lib/bsddb/test Modified Files: test_dbshelve.py test_dbtables.py test_thread.py Log Message: Merge with bsddb3 2002.11.23.10.42.36 Index: test_dbshelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_dbshelve.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_dbshelve.py 19 Nov 2002 17:47:04 -0000 1.1 --- test_dbshelve.py 23 Nov 2002 11:26:07 -0000 1.2 *************** *** 211,215 **** class HashShelveTestCase(BasicShelveTestCase): ! dbtype = db.DB_BTREE dbflags = db.DB_CREATE --- 211,215 ---- class HashShelveTestCase(BasicShelveTestCase): ! dbtype = db.DB_HASH dbflags = db.DB_CREATE *************** *** 221,225 **** class ThreadHashShelveTestCase(BasicShelveTestCase): ! dbtype = db.DB_BTREE dbflags = db.DB_CREATE | db.DB_THREAD --- 221,225 ---- class ThreadHashShelveTestCase(BasicShelveTestCase): ! dbtype = db.DB_HASH dbflags = db.DB_CREATE | db.DB_THREAD *************** *** 262,266 **** class EnvHashShelveTestCase(BasicEnvShelveTestCase): envflags = 0 ! dbtype = db.DB_BTREE dbflags = db.DB_CREATE --- 262,266 ---- class EnvHashShelveTestCase(BasicEnvShelveTestCase): envflags = 0 ! dbtype = db.DB_HASH dbflags = db.DB_CREATE *************** *** 274,278 **** class EnvThreadHashShelveTestCase(BasicEnvShelveTestCase): envflags = db.DB_THREAD ! dbtype = db.DB_BTREE dbflags = db.DB_CREATE | db.DB_THREAD --- 274,278 ---- class EnvThreadHashShelveTestCase(BasicEnvShelveTestCase): envflags = db.DB_THREAD ! dbtype = db.DB_HASH dbflags = db.DB_CREATE | db.DB_THREAD Index: test_dbtables.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_dbtables.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_dbtables.py 19 Nov 2002 17:47:04 -0000 1.1 --- test_dbtables.py 23 Nov 2002 11:26:07 -0000 1.2 *************** *** 6,9 **** --- 6,10 ---- # # Copyright (C) 2000, 2001 by Autonomous Zone Industries + # Copyright (C) 2002 Gregory P. Smith # # March 20, 2000 *************** *** 158,161 **** --- 159,196 ---- assert len(values) == 1 assert values[0]['b'] == "bad" + + + def test04_MultiCondSelect(self): + tabname = "test04_MultiCondSelect" + try: + self.tdb.Drop(tabname) + except dbtables.TableDBError: + pass + self.tdb.CreateTable(tabname, ['a', 'b', 'c', 'd', 'e']) + + try: + self.tdb.Insert(tabname, {'a': "", 'e': pickle.dumps([{4:5, 6:7}, 'foo'], 1), 'f': "Zero"}) + assert 0 + except dbtables.TableDBError: + pass + + self.tdb.Insert(tabname, {'a': "A", 'b': "B", 'c': "C", 'd': "D", 'e': "E"}) + self.tdb.Insert(tabname, {'a': "-A", 'b': "-B", 'c': "-C", 'd': "-D", 'e': "-E"}) + self.tdb.Insert(tabname, {'a': "A-", 'b': "B-", 'c': "C-", 'd': "D-", 'e': "E-"}) + + if verbose: + self.tdb._db_print() + + # This select should return 0 rows. it is designed to test + # the bug identified and fixed in sourceforge bug # 590449 + # (Big Thanks to "Rob Tillotson (n9mtb)" for tracking this down + # and supplying a fix!! This one caused many headaches to say + # the least...) + values = self.tdb.Select(tabname, ['b', 'a', 'd'], + conditions={'e': dbtables.ExactCond('E'), + 'a': dbtables.ExactCond('A'), + 'd': dbtables.PrefixCond('-') + } ) + assert len(values) == 0, values Index: test_thread.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_thread.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_thread.py 19 Nov 2002 17:47:07 -0000 1.1 --- test_thread.py 23 Nov 2002 11:26:07 -0000 1.2 *************** *** 19,23 **** from test.test_support import verbose ! from bsddb import db --- 19,23 ---- from test.test_support import verbose ! from bsddb import db, dbutils *************** *** 32,35 **** --- 32,38 ---- def setUp(self): + if verbose: + dbutils._deadlock_VerboseFile = sys.stdout + homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') self.homeDir = homeDir *************** *** 110,114 **** for x in range(start, stop): key = '%04d' % x ! d.put(key, self.makeData(key)) if verbose and x % 100 == 0: print "%s: records %d - %d finished" % (name, start, x) --- 113,117 ---- for x in range(start, stop): key = '%04d' % x ! dbutils.DeadlockWrap(d.put, key, self.makeData(key), max_retries=12) if verbose and x % 100 == 0: print "%s: records %d - %d finished" % (name, start, x) *************** *** 213,217 **** for x in xrange(start, stop): key = '%04d' % x ! d.put(key, self.makeData(key)) if verbose and x % 100 == 0: --- 216,220 ---- for x in xrange(start, stop): key = '%04d' % x ! dbutils.DeadlockWrap(d.put, key, self.makeData(key), max_retries=12) if verbose and x % 100 == 0: *************** *** 222,231 **** for y in xrange(start, x): key = '%04d' % x ! data = d.get(key) assert data == self.makeData(key) # flush them try: ! d.sync() except db.DBIncompleteError, val: if verbose: --- 225,234 ---- for y in xrange(start, x): key = '%04d' % x ! data = dbutils.DeadlockWrap(d.get, key, max_retries=12) assert data == self.makeData(key) # flush them try: ! dbutils.DeadlockWrap(d.sync, max_retries=12) except db.DBIncompleteError, val: if verbose: *************** *** 235,244 **** for x in xrange(start, stop): key = '%04d' % x ! data = d.get(key) if verbose and x % 100 == 0: print "%s: fetched record (%s, %s)" % (name, key, data) ! assert data == self.makeData(key) if random() <= 0.10: ! d.delete(key) if verbose: print "%s: deleted record %s" % (name, key) --- 238,247 ---- for x in xrange(start, stop): key = '%04d' % x ! data = dbutils.DeadlockWrap(d.get, key, max_retries=12) if verbose and x % 100 == 0: print "%s: fetched record (%s, %s)" % (name, key, data) ! assert data == self.makeData(key), (key, data, self.makeData(key)) if random() <= 0.10: ! dbutils.DeadlockWrap(d.delete, key, max_retries=12) if verbose: print "%s: deleted record %s" % (name, key) *************** *** 274,278 **** class HashSimpleThreaded(SimpleThreadedBase): ! dbtype = db.DB_BTREE --- 277,281 ---- class HashSimpleThreaded(SimpleThreadedBase): ! dbtype = db.DB_HASH From loewis@users.sourceforge.net Sat Nov 23 12:08:12 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 04:08:12 -0800 Subject: [Python-checkins] python/dist/src/Tools/scripts h2py.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv9410 Modified Files: h2py.py Log Message: Expand negative hexadecimal constants. Index: h2py.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/h2py.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** h2py.py 11 Jun 2002 06:22:31 -0000 1.17 --- h2py.py 23 Nov 2002 12:08:10 -0000 1.18 *************** *** 39,42 **** --- 39,44 ---- p_char = re.compile(r"'(\\.[^\\]*|[^\\])'") + p_hex = re.compile(r"0x([0-9a-fA-F]+)L?") + filedict = {} importable = {} *************** *** 89,92 **** --- 91,114 ---- fp.close() + def pytify(body): + # replace ignored patterns by spaces + for p in ignores: + body = p.sub(' ', body) + # replace char literals by ord(...) + body = p_char.sub('ord(\\0)', body) + # Compute negative hexadecimal constants + start = 0 + UMAX = 2*(sys.maxint+1) + while 1: + m = p_hex.search(body, start) + if not m: break + s,e = m.span() + val = long(body[slice(*m.span(1))], 16) + if val > sys.maxint: + val -= UMAX + body = body[:s] + "(" + str(val) + ")" + body[e:] + start = s + 1 + return body + def process(fp, outfp, env = {}): lineno = 0 *************** *** 105,115 **** name = match.group(1) body = line[match.end():] ! # replace ignored patterns by spaces ! for p in ignores: ! body = p.sub(' ', body) ! # replace char literals by ord(...) ! body = p_char.sub('ord(\\0)', body) ! stmt = '%s = %s\n' % (name, body.strip()) ok = 0 try: exec stmt in env --- 127,133 ---- name = match.group(1) body = line[match.end():] ! body = pytify(body) ok = 0 + stmt = '%s = %s\n' % (name, body.strip()) try: exec stmt in env *************** *** 122,128 **** macro, arg = match.group(1, 2) body = line[match.end():] ! for p in ignores: ! body = p.sub(' ', body) ! body = p_char.sub('ord(\\0)', body) stmt = 'def %s(%s): return %s\n' % (macro, arg, body) try: --- 140,144 ---- macro, arg = match.group(1, 2) body = line[match.end():] ! body = pytify(body) stmt = 'def %s(%s): return %s\n' % (macro, arg, body) try: From loewis@users.sourceforge.net Sat Nov 23 12:09:30 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 04:09:30 -0800 Subject: [Python-checkins] python/dist/src/Lib/plat-linux2 IN.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-linux2 In directory sc8-pr-cvs1:/tmp/cvs-serv9849 Modified Files: IN.py Log Message: Regenerate. Fixes #618012. Index: IN.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-linux2/IN.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IN.py 9 Aug 2001 12:48:17 -0000 1.4 --- IN.py 23 Nov 2002 12:09:28 -0000 1.5 *************** *** 95,111 **** --- 95,117 ---- INT16_MIN = (-32767-1) INT32_MIN = (-2147483647-1) + INT64_MIN = (-__INT64_C(9223372036854775807)-1) INT8_MAX = (127) INT16_MAX = (32767) INT32_MAX = (2147483647) + INT64_MAX = (__INT64_C(9223372036854775807)) UINT8_MAX = (255) UINT16_MAX = (65535) + UINT64_MAX = (__UINT64_C(18446744073709551615)) INT_LEAST8_MIN = (-128) INT_LEAST16_MIN = (-32767-1) INT_LEAST32_MIN = (-2147483647-1) + INT_LEAST64_MIN = (-__INT64_C(9223372036854775807)-1) INT_LEAST8_MAX = (127) INT_LEAST16_MAX = (32767) INT_LEAST32_MAX = (2147483647) + INT_LEAST64_MAX = (__INT64_C(9223372036854775807)) UINT_LEAST8_MAX = (255) UINT_LEAST16_MAX = (65535) + UINT_LEAST64_MAX = (__UINT64_C(18446744073709551615)) INT_FAST8_MIN = (-128) INT_FAST16_MIN = (-9223372036854775807L-1) *************** *** 113,116 **** --- 119,123 ---- INT_FAST16_MIN = (-2147483647-1) INT_FAST32_MIN = (-2147483647-1) + INT_FAST64_MIN = (-__INT64_C(9223372036854775807)-1) INT_FAST8_MAX = (127) INT_FAST16_MAX = (9223372036854775807L) *************** *** 118,126 **** --- 125,138 ---- INT_FAST16_MAX = (2147483647) INT_FAST32_MAX = (2147483647) + INT_FAST64_MAX = (__INT64_C(9223372036854775807)) UINT_FAST8_MAX = (255) + UINT_FAST64_MAX = (__UINT64_C(18446744073709551615)) INTPTR_MIN = (-9223372036854775807L-1) INTPTR_MAX = (9223372036854775807L) INTPTR_MIN = (-2147483647-1) INTPTR_MAX = (2147483647) + INTMAX_MIN = (-__INT64_C(9223372036854775807)-1) + INTMAX_MAX = (__INT64_C(9223372036854775807)) + UINTMAX_MAX = (__UINT64_C(18446744073709551615)) PTRDIFF_MIN = (-9223372036854775807L-1) PTRDIFF_MAX = (9223372036854775807L) *************** *** 180,207 **** CLONE_VFORK = 0x00004000 __defined_schedparam = 1 ! def IN_CLASSA(a): return ((((in_addr_t)(a)) & 0x80000000) == 0) ! IN_CLASSA_NET = 0xff000000 IN_CLASSA_NSHIFT = 24 ! IN_CLASSA_HOST = (0xffffffff & ~IN_CLASSA_NET) IN_CLASSA_MAX = 128 ! def IN_CLASSB(a): return ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000) ! IN_CLASSB_NET = 0xffff0000 IN_CLASSB_NSHIFT = 16 ! IN_CLASSB_HOST = (0xffffffff & ~IN_CLASSB_NET) IN_CLASSB_MAX = 65536 ! def IN_CLASSC(a): return ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000) ! IN_CLASSC_NET = 0xffffff00 IN_CLASSC_NSHIFT = 8 ! IN_CLASSC_HOST = (0xffffffff & ~IN_CLASSC_NET) ! def IN_CLASSD(a): return ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000) def IN_MULTICAST(a): return IN_CLASSD(a) ! def IN_EXPERIMENTAL(a): return ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000) ! def IN_BADCLASS(a): return ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000) IN_LOOPBACKNET = 127 --- 192,219 ---- CLONE_VFORK = 0x00004000 __defined_schedparam = 1 ! def IN_CLASSA(a): return ((((in_addr_t)(a)) & (-2147483648)) == 0) ! IN_CLASSA_NET = (-16777216) IN_CLASSA_NSHIFT = 24 ! IN_CLASSA_HOST = ((-1) & ~IN_CLASSA_NET) IN_CLASSA_MAX = 128 ! def IN_CLASSB(a): return ((((in_addr_t)(a)) & (-1073741824)) == (-2147483648)) ! IN_CLASSB_NET = (-65536) IN_CLASSB_NSHIFT = 16 ! IN_CLASSB_HOST = ((-1) & ~IN_CLASSB_NET) IN_CLASSB_MAX = 65536 ! def IN_CLASSC(a): return ((((in_addr_t)(a)) & (-536870912)) == (-1073741824)) ! IN_CLASSC_NET = (-256) IN_CLASSC_NSHIFT = 8 ! IN_CLASSC_HOST = ((-1) & ~IN_CLASSC_NET) ! def IN_CLASSD(a): return ((((in_addr_t)(a)) & (-268435456)) == (-536870912)) def IN_MULTICAST(a): return IN_CLASSD(a) ! def IN_EXPERIMENTAL(a): return ((((in_addr_t)(a)) & (-536870912)) == (-536870912)) ! def IN_BADCLASS(a): return ((((in_addr_t)(a)) & (-268435456)) == (-268435456)) IN_LOOPBACKNET = 127 *************** *** 276,280 **** MAX_INPUT = 255 NAME_MAX = 255 ! PATH_MAX = 4095 PIPE_BUF = 4096 RTSIG_MAX = 32 --- 288,292 ---- MAX_INPUT = 255 NAME_MAX = 255 ! PATH_MAX = 4096 PIPE_BUF = 4096 RTSIG_MAX = 32 *************** *** 288,292 **** PTHREAD_STACK_MIN = 16384 TIMER_MAX = 256 ! SSIZE_MAX = INT_MAX NGROUPS_MAX = _POSIX_NGROUPS_MAX --- 300,304 ---- PTHREAD_STACK_MIN = 16384 TIMER_MAX = 256 ! SSIZE_MAX = LONG_MAX NGROUPS_MAX = _POSIX_NGROUPS_MAX *************** *** 318,322 **** L_tmpnam = 20 TMP_MAX = 238328 ! FILENAME_MAX = 4095 L_ctermid = 9 L_cuserid = 9 --- 330,334 ---- L_tmpnam = 20 TMP_MAX = 238328 ! FILENAME_MAX = 4096 L_ctermid = 9 L_cuserid = 9 *************** *** 546,549 **** --- 558,562 ---- # Included from bits/byteswap.h + _BITS_BYTESWAP_H = 1 def __bswap_constant_16(x): return \ From loewis@users.sourceforge.net Sat Nov 23 12:22:34 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 04:22:34 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.536,1.537 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv13615/Misc Modified Files: NEWS Log Message: Patch #626548: Support Hangul syllable names. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.536 retrieving revision 1.537 diff -C2 -d -r1.536 -r1.537 *** NEWS 23 Nov 2002 09:45:04 -0000 1.536 --- NEWS 23 Nov 2002 12:22:32 -0000 1.537 *************** *** 317,320 **** --- 317,323 ---- is now named bsddb185. + - unicodedata was updated to Unicode 3.2. In now also supports names + for Hangul syllables. + - resource.getrlimit() now returns longs instead of ints. From loewis@users.sourceforge.net Sat Nov 23 12:22:35 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 04:22:35 -0800 Subject: [Python-checkins] python/dist/src/Modules unicodedata.c,2.20,2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv13615/Modules Modified Files: unicodedata.c Log Message: Patch #626548: Support Hangul syllable names. Index: unicodedata.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata.c,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** unicodedata.c 18 Oct 2002 16:11:51 -0000 2.20 --- unicodedata.c 23 Nov 2002 12:22:32 -0000 2.21 *************** *** 1,10 **** /* ------------------------------------------------------------------------ ! unicodedata -- Provides access to the Unicode 3.0 data base. ! Data was extracted from the Unicode 3.0 UnicodeData.txt file. Written by Marc-Andre Lemburg (mal@lemburg.com). Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com) Copyright (c) Corporation for National Research Initiatives. --- 1,11 ---- /* ------------------------------------------------------------------------ ! unicodedata -- Provides access to the Unicode 3.2 data base. ! Data was extracted from the Unicode 3.2 UnicodeData.txt file. Written by Marc-Andre Lemburg (mal@lemburg.com). Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com) + Modified by Martin v. Löwis (martin@v.loewis.de) Copyright (c) Corporation for National Research Initiatives. *************** *** 277,280 **** --- 278,322 ---- } + #define SBase 0xAC00 + #define LBase 0x1100 + #define VBase 0x1161 + #define TBase 0x11A7 + #define LCount 19 + #define VCount 21 + #define TCount 28 + #define NCount (VCount*TCount) + #define SCount (LCount*NCount) + + static char *hangul_syllables[][3] = { + { "G", "A", "" }, + { "GG", "AE", "G" }, + { "N", "YA", "GG" }, + { "D", "YAE", "GS" }, + { "DD", "EO", "N", }, + { "R", "E", "NJ" }, + { "M", "YEO", "NH" }, + { "B", "YE", "D" }, + { "BB", "O", "L" }, + { "S", "WA", "LG" }, + { "SS", "WAE", "LM" }, + { "", "OE", "LB" }, + { "J", "YO", "LS" }, + { "JJ", "U", "LT" }, + { "C", "WEO", "LP" }, + { "K", "WE", "LH" }, + { "T", "WI", "M" }, + { "P", "YU", "B" }, + { "H", "EU", "BS" }, + { 0, "YI", "S" }, + { 0, "I", "SS" }, + { 0, 0, "NG" }, + { 0, 0, "J" }, + { 0, 0, "C" }, + { 0, 0, "K" }, + { 0, 0, "T" }, + { 0, 0, "P" }, + { 0, 0, "H" } + }; + static int _getucname(Py_UCS4 code, char* buffer, int buflen) *************** *** 285,288 **** --- 327,352 ---- unsigned char* w; + if (SBase <= code && code <= SBase+SCount) { + /* Hangul syllable. */ + int SIndex = code - SBase; + int L = SIndex / NCount; + int V = (SIndex % NCount) / TCount; + int T = SIndex % TCount; + + if (buflen < 27) + /* Worst case: HANGUL SYLLABLE <10chars>. */ + return 0; + strcpy(buffer, "HANGUL SYLLABLE "); + buffer += 16; + strcpy(buffer, hangul_syllables[L][0]); + buffer += strlen(hangul_syllables[L][0]); + strcpy(buffer, hangul_syllables[V][1]); + buffer += strlen(hangul_syllables[V][1]); + strcpy(buffer, hangul_syllables[T][2]); + buffer += strlen(hangul_syllables[T][2]); + *buffer = '\0'; + return 1; + } + if (code >= 0x110000) return 0; *************** *** 344,347 **** --- 408,432 ---- } + static void + find_syllable(const char *str, int *len, int *pos, int count, int column) + { + int i, len1; + *len = -1; + for (i = 0; i < count; i++) { + char *s = hangul_syllables[i][column]; + len1 = strlen(s); + if (len1 <= *len) + continue; + if (strncmp(str, s, len1) == 0) { + *len = len1; + *pos = i; + } + } + if (*len == -1) { + *len = 0; + *pos = -1; + } + } + static int _getcode(const char* name, int namelen, Py_UCS4* code) *************** *** 351,354 **** --- 436,455 ---- unsigned int i, incr; + /* Check for hangul syllables. */ + if (strncmp(name, "HANGUL SYLLABLE ", 16) == 0) { + int L, V, T, len; + const char *pos = name + 16; + find_syllable(pos, &len, &L, LCount, 0); + pos += len; + find_syllable(pos, &len, &V, VCount, 1); + pos += len; + find_syllable(pos, &len, &T, TCount, 2); + pos += len; + if (V != -1 && V != -1 && T != -1 && pos-name == namelen) { + *code = SBase + (L*VCount+V)*TCount + T; + return 1; + } + } + /* the following is the same as python's dictionary lookup, with only minor changes. see the makeunicodedata script for more *************** *** 476,477 **** --- 577,584 ---- PyModule_AddObject(m, "ucnhash_CAPI", v); } + + /* + Local variables: + c-basic-offset: 4 + End: + */ From loewis@users.sourceforge.net Sat Nov 23 14:36:05 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 06:36:05 -0800 Subject: [Python-checkins] python/nondist/peps pep-0011.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv6312 Modified Files: pep-0011.txt Log Message: Add Linux 1 and Irix 4. Index: pep-0011.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0011.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pep-0011.txt 12 Nov 2002 19:58:38 -0000 1.7 --- pep-0011.txt 23 Nov 2002 14:36:03 -0000 1.8 *************** *** 97,100 **** --- 97,108 ---- Code removed in: Python 2.4 + Name: Irix 4 and --with-sgi-dl + Unsupported in: Python 2.3 + Code removed in: Python 2.4 + + Name: Linux 1 + Unsupported in: Python 2.3 + Code removed in: Python 2.4 + Name: Systems defining __d6_pthread_create (configure.in) Unsupported in: Python 2.3 From just@letterror.com Sat Nov 23 14:36:30 2002 From: just@letterror.com (Just van Rossum) Date: Sat, 23 Nov 2002 15:36:30 +0100 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.120,1.121 In-Reply-To: Message-ID: jvr@users.sourceforge.net wrote: > Modified Files: > libfuncs.tex > Log Message: > Patch #642500 with slight modifications: allow keyword arguments in > dict() constructor. Example: > >>> dict(a=1, b=2) > {'a': 1, 'b': 2} > >>> > > > Index: libfuncs.tex > =================================================================== I just realized that dict() is documented as "new in 2.2". I would like to add that the keyword argument stuff was added in 2.3, but don't know how to (never worked with Latex before). Would someone like to add this? Just From fdrake@users.sourceforge.net Sat Nov 23 15:02:15 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sat, 23 Nov 2002 07:02:15 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.121,1.122 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv25359 Modified Files: libfuncs.tex Log Message: Added change note about returning a dictionary based on keyword arguments. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** libfuncs.tex 23 Nov 2002 09:45:03 -0000 1.121 --- libfuncs.tex 23 Nov 2002 15:02:13 -0000 1.122 *************** *** 221,224 **** --- 221,226 ---- \versionadded{2.2} + \versionchanged[Support for building a dictionary from keyword + arguments added]{2.3} \end{funcdesc} From fdrake@acm.org Sat Nov 23 15:02:39 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Sat, 23 Nov 2002 10:02:39 -0500 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.120,1.121 In-Reply-To: References: Message-ID: <15839.39055.700748.779551@grendel.zope.com> Just van Rossum writes: > I just realized that dict() is documented as "new in 2.2". I would > like to add that the keyword argument stuff was added in 2.3, but > don't know how to (never worked with Latex before). Would someone > like to add this? Done! Thanks. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From gvanrossum@users.sourceforge.net Sat Nov 23 16:28:15 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 23 Nov 2002 08:28:15 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.537,1.538 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv31533 Modified Files: NEWS Log Message: Touch up the news for dict() keyword args. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.537 retrieving revision 1.538 diff -C2 -d -r1.537 -r1.538 *** NEWS 23 Nov 2002 12:22:32 -0000 1.537 --- NEWS 23 Nov 2002 16:28:12 -0000 1.538 *************** *** 12,19 **** Type/class unification and new-style classes -------------------------------------------- ! - dict() now accepts keyword arguments so that dict(one=1,two=2) ! is the equivalent of dict([('one',1),('two',2)]). Accordingly, the existing (but undocumented) 'items' keyword argument has ! been eliminated. This means that dict(items=someMapping) now has a different meaning than before. --- 12,20 ---- Type/class unification and new-style classes -------------------------------------------- ! ! - dict() now accepts keyword arguments so that dict(one=1, two=2) ! is the equivalent of {"one": 1, "two": 2}. Accordingly, the existing (but undocumented) 'items' keyword argument has ! been eliminated. This means that dict(items=someMapping) now has a different meaning than before. From nnorwitz@users.sourceforge.net Sat Nov 23 16:57:02 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 23 Nov 2002 08:57:02 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.160,1.161 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv16973/Lib/test Modified Files: test_descr.py Log Message: Remove duplicate test Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** test_descr.py 23 Nov 2002 09:45:04 -0000 1.160 --- test_descr.py 23 Nov 2002 16:57:00 -0000 1.161 *************** *** 185,190 **** d = dict({}) vereq(d, {}) - d = dict({}) - vereq(d, {}) d = dict({1: 2, 'a': 'b'}) vereq(d, {1: 2, 'a': 'b'}) --- 185,188 ---- From loewis@users.sourceforge.net Sat Nov 23 17:11:09 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 09:11:09 -0800 Subject: [Python-checkins] python/dist/src/Modules unicodedata.c,2.21,2.22 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv28452/Modules Modified Files: unicodedata.c Log Message: Fix off-by-one error. Index: unicodedata.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata.c,v retrieving revision 2.21 retrieving revision 2.22 diff -C2 -d -r2.21 -r2.22 *** unicodedata.c 23 Nov 2002 12:22:32 -0000 2.21 --- unicodedata.c 23 Nov 2002 17:11:06 -0000 2.22 *************** *** 327,331 **** unsigned char* w; ! if (SBase <= code && code <= SBase+SCount) { /* Hangul syllable. */ int SIndex = code - SBase; --- 327,331 ---- unsigned char* w; ! if (SBase <= code && code < SBase+SCount) { /* Hangul syllable. */ int SIndex = code - SBase; From loewis@users.sourceforge.net Sat Nov 23 17:11:44 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 09:11:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_ucn.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv28768/Lib/test Modified Files: test_ucn.py Log Message: Add test cases for Hangul syllables. Update output. Index: test_ucn.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ucn.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_ucn.py 23 Jul 2002 19:04:08 -0000 1.9 --- test_ucn.py 23 Nov 2002 17:11:42 -0000 1.10 *************** *** 57,60 **** --- 57,84 ---- print "done." + print "Testing hangul syllable names....", + exec r""" + verify(u"\N{HANGUL SYLLABLE GA}" == u"\uac00") + verify(u"\N{HANGUL SYLLABLE GGWEOSS}" == u"\uafe8") + verify(u"\N{HANGUL SYLLABLE DOLS}" == u"\ub3d0") + verify(u"\N{HANGUL SYLLABLE RYAN}" == u"\ub7b8") + verify(u"\N{HANGUL SYLLABLE MWIK}" == u"\ubba0") + verify(u"\N{HANGUL SYLLABLE BBWAEM}" == u"\ubf88") + verify(u"\N{HANGUL SYLLABLE SSEOL}" == u"\uc370") + verify(u"\N{HANGUL SYLLABLE YI}" == u"\uc758") + verify(u"\N{HANGUL SYLLABLE JJYOSS}" == u"\ucb40") + verify(u"\N{HANGUL SYLLABLE KYEOLS}" == u"\ucf28") + verify(u"\N{HANGUL SYLLABLE PAN}" == u"\ud310") + verify(u"\N{HANGUL SYLLABLE HWEOK}" == u"\ud6f8") + verify(u"\N{HANGUL SYLLABLE HIH}" == u"\ud7a3") + """ + try: + unicodedata.name(u"\ud7a4") + except ValueError: + pass + else: + raise AssertionError, "Found name for U+D7A4" + print "done." + print "Testing code to name mapping for all characters....", count = 0 From loewis@users.sourceforge.net Sat Nov 23 17:11:44 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 09:11:44 -0800 Subject: [Python-checkins] python/dist/src/Lib/test/output test_ucn,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv28768/Lib/test/output Modified Files: test_ucn Log Message: Add test cases for Hangul syllables. Update output. Index: test_ucn =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_ucn,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_ucn 18 Oct 2002 16:11:50 -0000 1.3 --- test_ucn 23 Nov 2002 17:11:42 -0000 1.4 *************** *** 2,7 **** Testing General Unicode Character Name, and case insensitivity... done. Testing name to code mapping.... done. Testing code to name mapping for all characters.... done. ! Found 11556 characters in the unicode name database Testing misc. symbols for unicode character name expansion.... done. Testing unicode character name expansion strict error handling.... done. --- 2,8 ---- Testing General Unicode Character Name, and case insensitivity... done. Testing name to code mapping.... done. + Testing hangul syllable names.... done. Testing code to name mapping for all characters.... done. ! Found 22728 characters in the unicode name database Testing misc. symbols for unicode character name expansion.... done. Testing unicode character name expansion strict error handling.... done. From loewis@users.sourceforge.net Sat Nov 23 18:01:34 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 10:01:34 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.538,1.539 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv18377/Misc Modified Files: NEWS Log Message: Implement names for CJK unified ideographs. Add name to KeyError output. Verify that the lookup for an existing name succeeds. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.538 retrieving revision 1.539 diff -C2 -d -r1.538 -r1.539 *** NEWS 23 Nov 2002 16:28:12 -0000 1.538 --- NEWS 23 Nov 2002 18:01:31 -0000 1.539 *************** *** 319,323 **** - unicodedata was updated to Unicode 3.2. In now also supports names ! for Hangul syllables. - resource.getrlimit() now returns longs instead of ints. --- 319,323 ---- - unicodedata was updated to Unicode 3.2. In now also supports names ! for Hangul syllables and CJK unified ideographs. - resource.getrlimit() now returns longs instead of ints. From loewis@users.sourceforge.net Sat Nov 23 18:01:35 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 10:01:35 -0800 Subject: [Python-checkins] python/dist/src/Modules unicodedata.c,2.22,2.23 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv18377/Modules Modified Files: unicodedata.c Log Message: Implement names for CJK unified ideographs. Add name to KeyError output. Verify that the lookup for an existing name succeeds. Index: unicodedata.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata.c,v retrieving revision 2.22 retrieving revision 2.23 diff -C2 -d -r2.22 -r2.23 *** unicodedata.c 23 Nov 2002 17:11:06 -0000 2.22 --- unicodedata.c 23 Nov 2002 18:01:32 -0000 2.23 *************** *** 349,352 **** --- 349,362 ---- } + if ((0x3400 <= code && code <= 0x4DB5) || /* CJK Ideograph Extension A */ + (0x4E00 <= code && code <= 0x9FA5) || /* CJK Ideograph */ + (0x20000 <= code && code <= 0x2A6D6)) {/* CJK Ideograph Extension B */ + if (buflen < 28) + /* Worst case: CJK UNIFIED IDEOGRAPH-20000 */ + return 0; + sprintf(buffer, "CJK UNIFIED IDEOGRAPH-%X", code); + return 1; + } + if (code >= 0x110000) return 0; *************** *** 450,453 **** --- 460,487 ---- return 1; } + /* Otherwise, it's an illegal syllable name. */ + return 0; + } + + /* Check for unified ideographs. */ + if (strncmp(name, "CJK UNIFIED IDEOGRAPH-", 22) == 0) { + /* Four or five hexdigits must follow. */ + v = 0; + name += 22; + namelen -= 22; + if (namelen != 4 && namelen != 5) + return 0; + while (namelen--) { + v *= 16; + if (*name >= '0' && *name <= '9') + v += *name - '0'; + else if (*name >= 'A' && *name <= 'F') + v += *name - 'A' + 10; + else + return 0; + name++; + } + *code = v; + return 1; } *************** *** 536,540 **** if (!_getcode(name, namelen, &code)) { ! PyErr_SetString(PyExc_KeyError, "undefined character name"); return NULL; } --- 570,578 ---- if (!_getcode(name, namelen, &code)) { ! char fmt[] = "undefined character name '%s'"; ! char *buf = PyMem_MALLOC(sizeof(fmt) + namelen); ! sprintf(buf, fmt, name); ! PyErr_SetString(PyExc_KeyError, buf); ! PyMem_FREE(buf); return NULL; } From loewis@users.sourceforge.net Sat Nov 23 18:01:33 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 10:01:33 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_ucn.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv18377/Lib/test Modified Files: test_ucn.py Log Message: Implement names for CJK unified ideographs. Add name to KeyError output. Verify that the lookup for an existing name succeeds. Index: test_ucn.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ucn.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_ucn.py 23 Nov 2002 17:11:42 -0000 1.10 --- test_ucn.py 23 Nov 2002 18:01:30 -0000 1.11 *************** *** 81,94 **** print "done." ! print "Testing code to name mapping for all characters....", count = 0 ! for code in range(65536): try: char = unichr(code) name = unicodedata.name(char) - verify(unicodedata.lookup(name) == char) - count += 1 except (KeyError, ValueError): pass print "done." --- 81,106 ---- print "done." ! print "Testing names of CJK unified ideographs....", ! exec r""" ! verify(u"\N{CJK UNIFIED IDEOGRAPH-3400}" == u"\u3400") ! verify(u"\N{CJK UNIFIED IDEOGRAPH-4DB5}" == u"\u4db5") ! verify(u"\N{CJK UNIFIED IDEOGRAPH-4E00}" == u"\u4e00") ! verify(u"\N{CJK UNIFIED IDEOGRAPH-9FA5}" == u"\u9fa5") ! verify(u"\N{CJK UNIFIED IDEOGRAPH-20000}" == u"\U00020000") ! verify(u"\N{CJK UNIFIED IDEOGRAPH-2A6D6}" == u"\U0002a6d6") ! """ ! print "done." ! ! print "Testing code to name mapping for all BMP characters....", count = 0 ! for code in range(0x10000): try: char = unichr(code) name = unicodedata.name(char) except (KeyError, ValueError): pass + else: + verify(unicodedata.lookup(name) == char) + count += 1 print "done." From loewis@users.sourceforge.net Sat Nov 23 18:01:33 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 10:01:33 -0800 Subject: [Python-checkins] python/dist/src/Lib/test/output test_ucn,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv18377/Lib/test/output Modified Files: test_ucn Log Message: Implement names for CJK unified ideographs. Add name to KeyError output. Verify that the lookup for an existing name succeeds. Index: test_ucn =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_ucn,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_ucn 23 Nov 2002 17:11:42 -0000 1.4 --- test_ucn 23 Nov 2002 18:01:31 -0000 1.5 *************** *** 3,8 **** Testing name to code mapping.... done. Testing hangul syllable names.... done. ! Testing code to name mapping for all characters.... done. ! Found 22728 characters in the unicode name database Testing misc. symbols for unicode character name expansion.... done. Testing unicode character name expansion strict error handling.... done. --- 3,9 ---- Testing name to code mapping.... done. Testing hangul syllable names.... done. ! Testing names of CJK unified ideographs.... done. ! Testing code to name mapping for all BMP characters.... done. ! Found 50212 characters in the unicode name database Testing misc. symbols for unicode character name expansion.... done. Testing unicode character name expansion strict error handling.... done. From tim_one@users.sourceforge.net Sat Nov 23 18:48:08 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 23 Nov 2002 10:48:08 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.539,1.540 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv887/python/Misc Modified Files: NEWS Log Message: Try linking the static Sleepycat lib into _bsddb.pyd. Hard to say whether this is a correct thing to do: + There are linker warnings (see PCbuild\readme.txt). + test_bsddb passes, in both release and debug builds now. + test_bsddb3 has several failures, but it did before too. Also made pythoncore a dependency of the _bsddb project, updated build instructions, added database conversion XXX to NEWS, and fiddled the Windows installer accordingly. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.539 retrieving revision 1.540 diff -C2 -d -r1.539 -r1.540 *** NEWS 23 Nov 2002 18:01:31 -0000 1.539 --- NEWS 23 Nov 2002 18:48:06 -0000 1.540 *************** *** 823,827 **** bugs. XXX What are the licensing issues here? ! XXX The debug Python still blows up (see PCbuild/readme.txt). XXX The version # is likely to change before 2.3a1. --- 823,829 ---- bugs. XXX What are the licensing issues here? ! XXX If a user has a database created with a previous verion of ! XXX Python, what must they do to convert it? ! XXX I'm still not sure how to link this thing (see PCbuild/readme.txt). XXX The version # is likely to change before 2.3a1. From tim_one@users.sourceforge.net Sat Nov 23 18:48:09 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 23 Nov 2002 10:48:09 -0800 Subject: [Python-checkins] python/dist/src/PCbuild _bsddb.dsp,1.1,1.2 pcbuild.dsw,1.28,1.29 python20.wse,1.107,1.108 readme.txt,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv887/python/PCbuild Modified Files: _bsddb.dsp pcbuild.dsw python20.wse readme.txt Log Message: Try linking the static Sleepycat lib into _bsddb.pyd. Hard to say whether this is a correct thing to do: + There are linker warnings (see PCbuild\readme.txt). + test_bsddb passes, in both release and debug builds now. + test_bsddb3 has several failures, but it did before too. Also made pythoncore a dependency of the _bsddb project, updated build instructions, added database conversion XXX to NEWS, and fiddled the Windows installer accordingly. Index: _bsddb.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_bsddb.dsp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _bsddb.dsp 22 Nov 2002 20:00:33 -0000 1.1 --- _bsddb.dsp 23 Nov 2002 18:48:06 -0000 1.2 *************** *** 55,59 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 ! # ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\db-4.0.14\build_win32\Release\libdb40.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /out:"./_bsddb.pyd" # SUBTRACT LINK32 /pdb:none --- 55,59 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 ! # ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\db-4.0.14\build_win32\Release_static\libdb40s.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"./_bsddb.pyd" # SUBTRACT LINK32 /pdb:none *************** *** 83,87 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\db-4.0.14\build_win32\Release\libdb40.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"MSVCRT" /out:"./_bsddb_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none --- 83,87 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\db-4.0.14\build_win32\Release_static\libdb40s.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrtd" /out:"./_bsddb_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none Index: pcbuild.dsw =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pcbuild.dsw,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** pcbuild.dsw 22 Nov 2002 20:00:34 -0000 1.28 --- pcbuild.dsw 23 Nov 2002 18:48:06 -0000 1.29 *************** *** 12,15 **** --- 12,18 ---- Package=<4> {{{ + Begin Project Dependency + Project_Dep_Name pythoncore + End Project Dependency }}} Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** python20.wse 23 Nov 2002 03:49:08 -0000 1.107 --- python20.wse 23 Nov 2002 18:48:06 -0000 1.108 *************** *** 1854,1868 **** item: Remark end - item: Remark - Text=Oddball -- the Sleepcat DLL - end - item: Install File - Source=..\..\db-4.0.14\build_win32\Release\libdb40.dll - Destination=%MAINDIR%\DLLs\libdb40.dll - Description=Sleepycat Berekely DB DLL - Flags=0000000000000010 - end - item: Remark - end item: Install File Source=.\python%_pymajor_%%_pyminor_%.lib --- 1854,1857 ---- Index: readme.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/readme.txt,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** readme.txt 23 Nov 2002 03:49:08 -0000 1.30 --- readme.txt 23 Nov 2002 18:48:06 -0000 1.31 *************** *** 162,165 **** --- 162,167 ---- _bsddb + XXX The Sleepycat release we use will probably change before + XXX 2.3a1. Go to Sleepycat's patches page: http://www.sleepycat.com/update/index.html *************** *** 183,199 **** and build db_buildall.exe. ! XXX You have to copy ! XXX dist\db-4.0.14\build_win32\Release\libdb40.dll ! XXX into PCbuild (or elsewhere on your path) before the tests ! XXX will run. ! ! XXX A debug-mode build blows up when running this, presumably because ! XXX I'm mixing debug-mode MS stuff with Sleepycat's release-mode ! XXX DLL. This gives me a headache. I would *like* to, as the old ! XXX bsddb 1.85 project apparently managed to do, link the Berkeley ! XXX DLL into the guts of our _bsddb.pyd. I don't know how to. - XXX The Sleepycat release we use will probably change before - XXX 2.3a1. --- 185,203 ---- and build db_buildall.exe. ! XXX We're actually linking against Release_static\libdb40s.lib. ! XXX This yields the following warnings: ! """ ! Compiling... ! _bsddb.c ! Linking... ! Creating library ./_bsddb.lib and object ./_bsddb.exp ! LINK : warning LNK4049: locally defined symbol "_malloc" imported ! LINK : warning LNK4049: locally defined symbol "_free" imported ! LINK : warning LNK4049: locally defined symbol "_fclose" imported ! LINK : warning LNK4049: locally defined symbol "_fopen" imported ! _bsddb.pyd - 0 error(s), 4 warning(s) ! """ ! XXX This isn't encouraging, but I don't know what to do about it. From loewis@users.sourceforge.net Sat Nov 23 19:41:03 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 11:41:03 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_codeccallbacks.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17096 Modified Files: test_codeccallbacks.py Log Message: Update character names. Index: test_codeccallbacks.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codeccallbacks.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_codeccallbacks.py 9 Nov 2002 05:26:14 -0000 1.3 --- test_codeccallbacks.py 23 Nov 2002 19:41:01 -0000 1.4 *************** *** 71,81 **** sin = u"\xac\u1234\u20ac\u8000" ! sout = "\033[1mNOT SIGN, ETHIOPIC SYLLABLE SEE, EURO SIGN, 0x8000\033[0m" self.assertEqual(sin.encode("ascii", "test.uninamereplace"), sout) ! sout = "\xac\033[1mETHIOPIC SYLLABLE SEE, EURO SIGN, 0x8000\033[0m" self.assertEqual(sin.encode("latin-1", "test.uninamereplace"), sout) ! sout = "\xac\033[1mETHIOPIC SYLLABLE SEE\033[0m\xa4\033[1m0x8000\033[0m" self.assertEqual(sin.encode("iso-8859-15", "test.uninamereplace"), sout) --- 71,81 ---- sin = u"\xac\u1234\u20ac\u8000" ! sout = "\033[1mNOT SIGN, ETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" self.assertEqual(sin.encode("ascii", "test.uninamereplace"), sout) ! sout = "\xac\033[1mETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" self.assertEqual(sin.encode("latin-1", "test.uninamereplace"), sout) ! sout = "\xac\033[1mETHIOPIC SYLLABLE SEE\033[0m\xa4\033[1mCJK UNIFIED IDEOGRAPH-8000\033[0m" self.assertEqual(sin.encode("iso-8859-15", "test.uninamereplace"), sout) From loewis@users.sourceforge.net Sat Nov 23 22:08:17 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 14:08:17 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_normalization.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv13362/Lib/test Added Files: test_normalization.py Log Message: Patch #626485: Support Unicode normalization. --- NEW FILE: test_normalization.py --- from test.test_support import verbose, TestFailed, TestSkipped, verify import sys from unicodedata import normalize try: data = open("NormalizationTest.txt","r").readlines() except IOError: raise TestSkipped("NormalizationTest.txt not found, download from http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt") class RangeError: pass def NFC(str): return normalize("NFC", str) def NFKC(str): return normalize("NFKC", str) def NFD(str): return normalize("NFD", str) def NFKD(str): return normalize("NFKD", str) def unistr(data): data = [int(x, 16) for x in data.split(" ")] for x in data: if x > sys.maxunicode: raise RangeError return u"".join([unichr(x) for x in data]) part1_data = {} for line in data: if '#' in line: line = line.split('#')[0] line = line.strip() if not line: continue if line.startswith("@Part"): part = line continue try: c1,c2,c3,c4,c5 = [unistr(x) for x in line.split(';')[:-1]] except RangeError: # Skip unsupported characters continue if verbose: print line # Perform tests verify(c2 == NFC(c1) == NFC(c2) == NFC(c3), line) verify(c4 == NFC(c4) == NFC(c5), line) verify(c3 == NFD(c1) == NFD(c2) == NFD(c3), line) verify(c5 == NFD(c4) == NFD(c5), line) verify(c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5), line) verify(c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5), line) # Record part 1 data if part == "@Part1": part1_data[c1] = 1 # Perform tests for all other data for c in range(sys.maxunicode+1): X = unichr(c) if X in part1_data: continue assert X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c From loewis@users.sourceforge.net Sat Nov 23 22:08:17 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 14:08:17 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.540,1.541 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv13362/Misc Modified Files: NEWS Log Message: Patch #626485: Support Unicode normalization. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.540 retrieving revision 1.541 diff -C2 -d -r1.540 -r1.541 *** NEWS 23 Nov 2002 18:48:06 -0000 1.540 --- NEWS 23 Nov 2002 22:08:15 -0000 1.541 *************** *** 318,323 **** is now named bsddb185. ! - unicodedata was updated to Unicode 3.2. In now also supports names ! for Hangul syllables and CJK unified ideographs. - resource.getrlimit() now returns longs instead of ints. --- 318,323 ---- is now named bsddb185. ! - unicodedata was updated to Unicode 3.2. It supports normalization ! and names for Hangul syllables and CJK unified ideographs. - resource.getrlimit() now returns longs instead of ints. From loewis@users.sourceforge.net Sat Nov 23 22:08:17 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 14:08:17 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libunicodedata.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv13362/Doc/lib Modified Files: libunicodedata.tex Log Message: Patch #626485: Support Unicode normalization. Index: libunicodedata.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunicodedata.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libunicodedata.tex 24 Jan 2001 08:10:07 -0000 1.3 --- libunicodedata.tex 23 Nov 2002 22:08:15 -0000 1.4 *************** *** 6,10 **** \moduleauthor{Marc-Andre Lemburg}{mal@lemburg.com} \sectionauthor{Marc-Andre Lemburg}{mal@lemburg.com} ! \index{Unicode} --- 6,10 ---- \moduleauthor{Marc-Andre Lemburg}{mal@lemburg.com} \sectionauthor{Marc-Andre Lemburg}{mal@lemburg.com} ! \sectionauthor{Martin v. L\"owis}{martin@v.loewis.de} \index{Unicode} *************** *** 15,22 **** defines character properties for all Unicode characters. The data in this database is based on the \file{UnicodeData.txt} file version ! 3.0.0 which is publically available from \url{ftp://ftp.unicode.org/}. The module uses the same names and symbols as defined by the ! UnicodeData File Format 3.0.0 (see \url{http://www.unicode.org/Public/UNIDATA/UnicodeData.html}). It defines the following functions: --- 15,22 ---- defines character properties for all Unicode characters. The data in this database is based on the \file{UnicodeData.txt} file version ! 3.2.0 which is publically available from \url{ftp://ftp.unicode.org/}. The module uses the same names and symbols as defined by the ! UnicodeData File Format 3.2.0 (see \url{http://www.unicode.org/Public/UNIDATA/UnicodeData.html}). It defines the following functions: *************** *** 84,85 **** --- 84,119 ---- no such mapping is defined. \end{funcdesc} + + \begin{funcdesc}{normalize}{form, unistr} + + Return the normal form \var{form} for the Unicode string \var{unistr}. + Valid values for \var{form} are 'NFC', 'NFKC', 'NFD', and 'NFKD'. + + The Unicode standard defines various normalization forms of a Unicode + string, based on the definition of canonical equivalence and + compatibility equivalence. In Unicode, several characters can be + expressed in various way. For example, the character U+00C7 (LATIN + CAPITAL LETTER C WITH CEDILLA) can also be expressed as the sequence + U+0043 (LATIN CAPITAL LETTER C) U+0327 (COMBINING CEDILLA). + + For each character, there are two normal forms: normal form C and + normal form D. Normal form D (NFD) is also known as canonical + decomposition, and translates each character into its decomposed form. + Normal form C (NFC) first applies a canonical decomposition, then + composes pre-combined characters again. + + In addition to these two forms, there two additional normal forms + based on compatibility equivalence. In Unicode, certain characters are + supported which normally would be unified with other characters. For + example, U+2160 (ROMAN NUMERAL ONE) is really the same thing as U+0049 + (LATIN CAPITAL LETTER I). However, it is supported in Unicode for + compatibility with existing character sets (e.g. gb2312). + + The normal form KD (NFKD) will apply the compatibility decomposition, + i.e. replace all compatibility characters with their equivalents. The + normal form KC (NFKC) first applies the compatibility decomposition, + followed by the canonical composition. + + \versionadded{2.3} + \end{funcdesc} + From loewis@users.sourceforge.net Sat Nov 23 22:08:18 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 14:08:18 -0800 Subject: [Python-checkins] python/dist/src/Tools/unicode makeunicodedata.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/unicode In directory sc8-pr-cvs1:/tmp/cvs-serv13362/Tools/unicode Modified Files: makeunicodedata.py Log Message: Patch #626485: Support Unicode normalization. Index: makeunicodedata.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/unicode/makeunicodedata.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** makeunicodedata.py 18 Oct 2002 17:34:18 -0000 1.14 --- makeunicodedata.py 23 Nov 2002 22:08:15 -0000 1.15 *************** *** 14,17 **** --- 14,20 ---- # 2001-01-19 fl added character name tables (2.1) # 2001-01-21 fl added decomp compression; dynamic phrasebook threshold + # 2002-09-11 wd use string methods + # 2002-10-18 mvl update to Unicode 3.2 + # 2002-10-22 mvl generate NFC tables # # written by Fredrik Lundh (fredrik@pythonware.com) *************** *** 23,27 **** VERSION = "2.1" ! UNICODE_DATA = "UnicodeData-Latest.txt" CATEGORY_NAMES = [ "Cn", "Lu", "Ll", "Lt", "Mn", "Mc", "Me", "Nd", --- 26,31 ---- VERSION = "2.1" ! UNICODE_DATA = "UnicodeData.txt" ! COMPOSITION_EXCLUSIONS = "CompositionExclusions.txt" CATEGORY_NAMES = [ "Cn", "Lu", "Ll", "Lt", "Mn", "Mc", "Me", "Nd", *************** *** 48,52 **** print "--- Reading", UNICODE_DATA, "..." ! unicode = UnicodeData(UNICODE_DATA) print len(filter(None, unicode.table)), "characters" --- 52,56 ---- print "--- Reading", UNICODE_DATA, "..." ! unicode = UnicodeData(UNICODE_DATA, COMPOSITION_EXCLUSIONS) print len(filter(None, unicode.table)), "characters" *************** *** 97,100 **** --- 101,108 ---- decomp_size = 0 + comp_pairs = [] + comp_first = [None] * len(unicode.chars) + comp_last = [None] * len(unicode.chars) + for char in unicode.chars: record = unicode.table[char] *************** *** 117,120 **** --- 125,136 ---- decomp = [prefix + (len(decomp)<<8)] +\ map(lambda s: int(s, 16), decomp) + # Collect NFC pairs + if not prefix and len(decomp) == 3 and \ + char not in unicode.exclusions and \ + unicode.table[decomp[1]][3] == "0": + p, l, r = decomp + comp_first[l] = 1 + comp_last[r] = 1 + comp_pairs.append((l,r,char)) try: i = decomp_data.index(decomp) *************** *** 127,134 **** --- 143,189 ---- decomp_index[char] = i + f = l = 0 + comp_first_ranges = [] + comp_last_ranges = [] + prev_f = prev_l = None + for i in unicode.chars: + if comp_first[i] is not None: + comp_first[i] = f + f += 1 + if prev_f is None: + prev_f = (i,i) + elif prev_f[1]+1 == i: + prev_f = prev_f[0],i + else: + comp_first_ranges.append(prev_f) + prev_f = (i,i) + if comp_last[i] is not None: + comp_last[i] = l + l += 1 + if prev_l is None: + prev_l = (i,i) + elif prev_l[1]+1 == i: + prev_l = prev_l[0],i + else: + comp_last_ranges.append(prev_l) + prev_l = (i,i) + comp_first_ranges.append(prev_f) + comp_last_ranges.append(prev_l) + total_first = f + total_last = l + + comp_data = [0]*(total_first*total_last) + for f,l,char in comp_pairs: + f = comp_first[f] + l = comp_last[l] + comp_data[f*total_last+l] = char + print len(table), "unique properties" print len(decomp_prefix), "unique decomposition prefixes" print len(decomp_data), "unique decomposition entries:", print decomp_size, "bytes" + print total_first, "first characters in NFC" + print total_last, "last characters in NFC" + print len(comp_pairs), "NFC pairs" print "--- Writing", FILE, "..." *************** *** 145,148 **** --- 200,218 ---- print >>fp + print >>fp, "/* Reindexing of NFC first characters. */" + print >>fp, "#define TOTAL_FIRST",total_first + print >>fp, "#define TOTAL_LAST",total_last + print >>fp, "struct reindex{int start;short count,index;};" + print >>fp, "struct reindex nfc_first[] = {" + for start,end in comp_first_ranges: + print >>fp," { %d, %d, %d}," % (start,end-start,comp_first[start]) + print >>fp," {0,0,0}" + print >>fp,"};\n" + print >>fp, "struct reindex nfc_last[] = {" + for start,end in comp_last_ranges: + print >>fp," { %d, %d, %d}," % (start,end-start,comp_last[start]) + print >>fp," {0,0,0}" + print >>fp,"};\n" + # FIXME: the following tables could be made static, and # the support code moved into unicodedatabase.c *************** *** 186,189 **** --- 256,265 ---- Array("decomp_index2", index2).dump(fp, trace) + index, index2, shift = splitbins(comp_data, trace) + print >>fp, "/* NFC pairs */" + print >>fp, "#define COMP_SHIFT", shift + Array("comp_index", index).dump(fp, trace) + Array("comp_data", index2).dump(fp, trace) + fp.close() *************** *** 455,459 **** class UnicodeData: ! def __init__(self, filename, expand=1): file = open(filename) table = [None] * 0x110000 --- 531,535 ---- class UnicodeData: ! def __init__(self, filename, exclusions, expand=1): file = open(filename) table = [None] * 0x110000 *************** *** 486,489 **** --- 562,576 ---- self.table = table self.chars = range(0x110000) # unicode 3.2 + + file = open(exclusions) + self.exclusions = {} + for s in file: + s = s.strip() + if not s: + continue + if s[0] == '#': + continue + char = int(s.split()[0],16) + self.exclusions[char] = 1 def uselatin1(self): From loewis@users.sourceforge.net Sat Nov 23 22:08:18 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 23 Nov 2002 14:08:18 -0800 Subject: [Python-checkins] python/dist/src/Modules unicodedata.c,2.23,2.24 unicodedata_db.h,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv13362/Modules Modified Files: unicodedata.c unicodedata_db.h Log Message: Patch #626485: Support Unicode normalization. Index: unicodedata.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata.c,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -d -r2.23 -r2.24 *** unicodedata.c 23 Nov 2002 18:01:32 -0000 2.23 --- unicodedata.c 23 Nov 2002 22:08:15 -0000 2.24 *************** *** 31,41 **** static const _PyUnicode_DatabaseRecord* ! _getrecord(PyUnicodeObject* v) { - int code; int index; - - code = (int) *PyUnicode_AS_UNICODE(v); - if (code < 0 || code >= 0x110000) index = 0; --- 31,37 ---- static const _PyUnicode_DatabaseRecord* ! _getrecord_ex(Py_UCS4 code) { int index; if (code < 0 || code >= 0x110000) index = 0; *************** *** 48,51 **** --- 44,53 ---- } + static const _PyUnicode_DatabaseRecord* + _getrecord(PyUnicodeObject* v) + { + return _getrecord_ex(*PyUnicode_AS_UNICODE(v)); + } + /* --- Module API --------------------------------------------------------- */ *************** *** 254,257 **** --- 256,529 ---- } + void + get_decomp_record(Py_UCS4 code, int *index, int *prefix, int *count) + { + if (code < 0 || code >= 0x110000) { + *index = 0; + } + else { + *index = decomp_index1[(code>>DECOMP_SHIFT)]; + *index = decomp_index2[(*index<> 8; + *prefix = decomp_data[*index] & 255; + + (*index)++; + } + + #define SBase 0xAC00 + #define LBase 0x1100 + #define VBase 0x1161 + #define TBase 0x11A7 + #define LCount 19 + #define VCount 21 + #define TCount 28 + #define NCount (VCount*TCount) + #define SCount (LCount*NCount) + + static PyObject* + nfd_nfkd(PyObject *input, int k) + { + PyObject *result; + Py_UNICODE *i, *end, *o; + /* Longest decomposition in Unicode 3.2: U+FDFA */ + Py_UNICODE stack[20]; + int space, stackptr, isize; + int index, prefix, count; + unsigned char prev, cur; + + stackptr = 0; + isize = PyUnicode_GET_SIZE(input); + /* Overallocate atmost 10 characters. */ + space = (isize > 10 ? 10 : isize) + isize; + result = PyUnicode_FromUnicode(NULL, space); + if (!result) + return NULL; + i = PyUnicode_AS_UNICODE(input); + end = i + isize; + o = PyUnicode_AS_UNICODE(result); + + while (i < end) { + stack[stackptr++] = *i++; + while(stackptr) { + Py_UNICODE code = stack[--stackptr]; + if (!space) { + space = PyString_GET_SIZE(result) + 10; + if (PyUnicode_Resize(&result, space) == -1) + return NULL; + o = PyUnicode_AS_UNICODE(result) + space - 10; + space = 10; + } + /* Hangul Decomposition. */ + if (SBase <= code && code < (SBase+SCount)) { + int SIndex = code - SBase; + int L = LBase + SIndex / NCount; + int V = VBase + (SIndex % NCount) / TCount; + int T = TBase + SIndex % TCount; + *o++ = L; + *o++ = V; + space -= 2; + if (T != TBase) { + *o++ = T; + space --; + } + continue; + } + /* Other decompoistions. */ + get_decomp_record(code, &index, &prefix, &count); + + /* Copy character if it is not decomposable, or has a + compatibility decomposition, but we do NFD. */ + if (!count || (prefix && !k)) { + *o++ = code; + space--; + continue; + } + /* Copy decomposition onto the stack, in reverse + order. */ + while(count) { + code = decomp_data[index + (--count)]; + stack[stackptr++] = code; + } + } + } + + /* Drop overallocation. Cannot fail. */ + PyUnicode_Resize(&result, PyUnicode_GET_SIZE(result) - space); + + /* Sort canonically. */ + i = PyUnicode_AS_UNICODE(result); + prev = _getrecord_ex(*i)->combining; + end = i + PyUnicode_GET_SIZE(result); + for (i++; i < end; i++) { + cur = _getrecord_ex(*i)->combining; + if (prev == 0 || cur == 0 || prev <= cur) { + prev = cur; + continue; + } + /* Non-canonical order. Need to switch *i with previous. */ + o = i - 1; + while (1) { + Py_UNICODE tmp = o[1]; + o[1] = o[0]; + o[0] = tmp; + o--; + if (o < PyUnicode_AS_UNICODE(result)) + break; + prev = _getrecord_ex(*o)->combining; + if (prev == 0 || prev <= cur) + break; + } + prev = _getrecord_ex(*i)->combining; + } + return result; + } + + static int + find_nfc_index(struct reindex* nfc, Py_UNICODE code) + { + int index; + for (index = 0; nfc[index].start; index++) { + int start = nfc[index].start; + if (code < start) + return -1; + if (code <= start + nfc[index].count) { + int delta = code - start; + return nfc[index].index + delta; + } + } + return -1; + } + + static PyObject* + nfc_nfkc(PyObject *input, int k) + { + PyObject *result; + Py_UNICODE *i, *i1, *o, *end; + int f,l,index,index1,comb; + Py_UNICODE code; + Py_UNICODE *skipped[20]; + int cskipped = 0; + + result = nfd_nfkd(input, k); + if (!result) + return NULL; + + /* We are going to modify result in-place. + If nfd_nfkd is changed to sometimes return the input, + this code needs to be reviewed. */ + assert(result != input); + + i = PyUnicode_AS_UNICODE(result); + end = i + PyUnicode_GET_SIZE(result); + o = PyUnicode_AS_UNICODE(result); + + again: + while (i < end) { + for (index = 0; index < cskipped; index++) { + if (skipped[index] == i) { + /* *i character is skipped. + Remove from list. */ + skipped[index] = skipped[cskipped-1]; + cskipped--; + i++; + goto again; // continue while + } + } + /* Hangul Composition. We don't need to check for + pairs, since we always have decomposed data. */ + if (LBase <= *i && *i < (LBase+LCount) && + i + 1 < end && + VBase <= i[1] && i[1] <= (VBase+VCount)) { + int LIndex, VIndex; + LIndex = i[0] - LBase; + VIndex = i[1] - VBase; + code = SBase + (LIndex*VCount+VIndex)*TCount; + i+=2; + if (i < end && + TBase <= *i && *i <= (TBase+TCount)) { + code += *i-TBase; + i++; + } + *o++ = code; + continue; + } + + f = find_nfc_index(nfc_first, *i); + if (f == -1) { + *o++ = *i++; + continue; + } + /* Find next unblocked character. */ + i1 = i+1; + comb = 0; + while (i1 < end) { + int comb1 = _getrecord_ex(*i1)->combining; + if (comb1 && comb == comb1) { + /* Character is blocked. */ + i1++; + continue; + } + l = find_nfc_index(nfc_last, *i1); + /* *i1 cannot be combined with *i. If *i1 + is a starter, we don't need to look further. + Otherwise, record the combining class. */ + if (l == -1) { + not_combinable: + if (comb1 == 0) + break; + comb = comb1; + i1++; + continue; + } + index = f*TOTAL_LAST + l; + index1 = comp_index[index >> COMP_SHIFT]; + code = comp_data[(index1< Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv14419/Modules Modified Files: unicodedata.c Log Message: Verify that the code in CJK UNIFIED IDEOGRAPH- actually denotes an ideograph. Index: unicodedata.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata.c,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** unicodedata.c 23 Nov 2002 22:08:15 -0000 2.24 --- unicodedata.c 23 Nov 2002 22:10:29 -0000 2.25 *************** *** 582,585 **** --- 582,594 ---- static int + is_unified_ideograph(Py_UCS4 code) + { + return ( + (0x3400 <= code && code <= 0x4DB5) || /* CJK Ideograph Extension A */ + (0x4E00 <= code && code <= 0x9FA5) || /* CJK Ideograph */ + (0x20000 <= code && code <= 0x2A6D6));/* CJK Ideograph Extension B */ + } + + static int _getucname(Py_UCS4 code, char* buffer, int buflen) { *************** *** 611,617 **** } ! if ((0x3400 <= code && code <= 0x4DB5) || /* CJK Ideograph Extension A */ ! (0x4E00 <= code && code <= 0x9FA5) || /* CJK Ideograph */ ! (0x20000 <= code && code <= 0x2A6D6)) {/* CJK Ideograph Extension B */ if (buflen < 28) /* Worst case: CJK UNIFIED IDEOGRAPH-20000 */ --- 620,624 ---- } ! if (is_unified_ideograph(code)) { if (buflen < 28) /* Worst case: CJK UNIFIED IDEOGRAPH-20000 */ *************** *** 744,747 **** --- 751,756 ---- name++; } + if (!is_unified_ideograph(v)) + return 0; *code = v; return 1; From jvr@users.sourceforge.net Sat Nov 23 22:26:46 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sat, 23 Nov 2002 14:26:46 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib bundlebuilder.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv21197 Modified Files: bundlebuilder.py Log Message: cleaned up __init__ argument mess with a funky base class Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/bundlebuilder.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** bundlebuilder.py 22 Nov 2002 11:43:10 -0000 1.5 --- bundlebuilder.py 23 Nov 2002 22:26:44 -0000 1.6 *************** *** 36,110 **** import sys import os, errno, shutil import getopt from plistlib import Plist ! plistDefaults = Plist( ! CFBundleDevelopmentRegion = "English", ! CFBundleInfoDictionaryVersion = "6.0", ! ) ! class BundleBuilder: """BundleBuilder is a barebones class for assembling bundles. It knows nothing about executables or icons, it only copies files and creates the PkgInfo and Info.plist files. ! Constructor arguments: ! name: Name of the bundle, with or without extension. ! plist: A plistlib.Plist object. ! type: The type of the bundle. Defaults to "APPL". ! creator: The creator code of the bundle. Defaults to "????". ! resources: List of files that have to be copied to ! /Contents/Resources. Defaults to an empty list. ! files: List of (src, dest) tuples; dest should be a path relative ! to the bundle (eg. "Contents/Resources/MyStuff/SomeFile.ext. ! Defaults to an empty list. ! builddir: Directory where the bundle will be assembled. Defaults ! to "build" (in the current directory). ! symlink: Make symlinks instead copying files. This is handy during ! debugging, but makes the bundle non-distributable. Defaults to ! False. ! verbosity: verbosity level, defaults to 1 ! """ ! def __init__(self, name=None, plist=None, type="APPL", creator="????", ! resources=None, files=None, builddir="build", platform="MacOS", ! symlink=0, verbosity=1): ! """See the class doc string for a description of the arguments.""" ! if plist is None: ! plist = Plist() ! if resources is None: ! resources = [] ! if files is None: ! files = [] ! self.name = name ! self.plist = plist ! self.type = type ! self.creator = creator ! self.resources = resources ! self.files = files ! self.builddir = builddir ! self.platform = platform ! self.symlink = symlink ! self.verbosity = verbosity def setup(self): self.name, ext = os.path.splitext(self.name) if not ext: ext = ".bundle" ! self.bundleextension = ext # misc (derived) attributes ! self.bundlepath = pathjoin(self.builddir, self.name + self.bundleextension) self.execdir = pathjoin("Contents", self.platform) ! plist = plistDefaults.copy() plist.CFBundleName = self.name plist.CFBundlePackageType = self.type plist.CFBundleSignature = self.creator - plist.update(self.plist) - self.plist = plist def build(self): --- 36,126 ---- import sys import os, errno, shutil + from copy import deepcopy import getopt from plistlib import Plist + from types import FunctionType as function ! class Defaults: + """Class attributes that don't start with an underscore and are + not functions or classmethods are (deep)copied to self.__dict__. + This allows for mutable default values. + """ + + def __init__(self, **kwargs): + defaults = self._getDefaults() + defaults.update(kwargs) + self.__dict__.update(defaults) + + def _getDefaults(cls): + defaults = {} + for name, value in cls.__dict__.items(): + if name[0] != "_" and not isinstance(value, + (function, classmethod)): + defaults[name] = deepcopy(value) + for base in cls.__bases__: + if hasattr(base, "_getDefaults"): + defaults.update(base._getDefaults()) + return defaults + _getDefaults = classmethod(_getDefaults) ! ! class BundleBuilder(Defaults): """BundleBuilder is a barebones class for assembling bundles. It knows nothing about executables or icons, it only copies files and creates the PkgInfo and Info.plist files. + """ ! # (Note that Defaults.__init__ (deep)copies these values to ! # instance variables. Mutable defaults are therefore safe.) ! # Name of the bundle, with or without extension. ! name = None ! # The property list ("plist") ! plist = Plist(CFBundleDevelopmentRegion = "English", ! CFBundleInfoDictionaryVersion = "6.0") ! ! # The type of the bundle. ! type = "APPL" ! # The creator code of the bundle. ! creator = "????" ! ! # List of files that have to be copied to /Contents/Resources. ! resources = [] ! ! # List of (src, dest) tuples; dest should be a path relative to the bundle ! # (eg. "Contents/Resources/MyStuff/SomeFile.ext). ! files = [] ! ! # Directory where the bundle will be assembled. ! builddir = "build" ! ! # platform, name of the subfolder of Contents that contains the executable. ! platform = "MacOS" ! ! # Make symlinks instead copying files. This is handy during debugging, but ! # makes the bundle non-distributable. ! symlink = 0 ! ! # Verbosity level. ! verbosity = 1 def setup(self): + # XXX rethink self.name munging, this is brittle. self.name, ext = os.path.splitext(self.name) if not ext: ext = ".bundle" ! bundleextension = ext # misc (derived) attributes ! self.bundlepath = pathjoin(self.builddir, self.name + bundleextension) self.execdir = pathjoin("Contents", self.platform) ! plist = self.plist plist.CFBundleName = self.name plist.CFBundlePackageType = self.type plist.CFBundleSignature = self.creator def build(self): *************** *** 201,229 **** class AppBuilder(BundleBuilder): ! """This class extends the BundleBuilder constructor with these ! arguments: ! mainprogram: A Python main program. If this argument is given, ! the main executable in the bundle will be a small wrapper ! that invokes the main program. (XXX Discuss why.) ! executable: The main executable. If a Python main program is ! specified the executable will be copied to Resources and ! be invoked by the wrapper program mentioned above. Else ! it will simply be used as the main executable. ! nibname: The name of the main nib, for Cocoa apps. Defaults ! to None, but must be specified when building a Cocoa app. ! symlink_exec: Symlink the executable instead of copying it. ! For the other keyword arguments see the BundleBuilder doc string. ! """ ! def __init__(self, name=None, mainprogram=None, executable=None, ! nibname=None, symlink_exec=0, **kwargs): ! """See the class doc string for a description of the arguments.""" ! self.mainprogram = mainprogram ! self.executable = executable ! self.nibname = nibname ! self.symlink_exec = symlink_exec ! BundleBuilder.__init__(self, name=name, **kwargs) def setup(self): --- 217,237 ---- class AppBuilder(BundleBuilder): ! # A Python main program. If this argument is given, the main ! # executable in the bundle will be a small wrapper that invokes ! # the main program. (XXX Discuss why.) ! mainprogram = None ! # The main executable. If a Python main program is specified ! # the executable will be copied to Resources and be invoked ! # by the wrapper program mentioned above. Otherwise it will ! # simply be used as the main executable. ! executable = None ! # The name of the main nib, for Cocoa apps. *Must* be specified ! # when building a Cocoa app. ! nibname = None ! # Symlink the executable instead of copying it. ! symlink_exec = 0 def setup(self): *************** *** 259,264 **** if not self.symlink_exec: self.files.append((self.executable, execpath)) ! else: ! self.execpath = execpath # For execve wrapper setexecutable = setExecutableTemplate % os.path.basename(self.executable) --- 267,271 ---- if not self.symlink_exec: self.files.append((self.executable, execpath)) ! self.execpath = execpath # For execve wrapper setexecutable = setExecutableTemplate % os.path.basename(self.executable) From jvr@users.sourceforge.net Sun Nov 24 01:01:09 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sat, 23 Nov 2002 17:01:09 -0800 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE Wbase.py,1.9,1.10 Wmenus.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv20813 Modified Files: Wbase.py Wmenus.py Log Message: hardcode some resources, removing annoying Widgets.rsrc dependency Index: Wbase.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wbase.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Wbase.py 8 Dec 2001 10:37:40 -0000 1.9 --- Wbase.py 24 Nov 2002 01:01:07 -0000 1.10 *************** *** 696,712 **** _cursors = { ! "watch" : Qd.GetCursor(QuickDraw.watchCursor).data, ! "arrow" : Qd.qd.arrow, ! "iBeam" : Qd.GetCursor(QuickDraw.iBeamCursor).data, ! "cross" : Qd.GetCursor(QuickDraw.crossCursor).data, ! "plus" : Qd.GetCursor(QuickDraw.plusCursor).data, ! "hand" : Qd.GetCursor(468).data, ! "fist" : Qd.GetCursor(469).data, ! "hmover" : Qd.GetCursor(470).data, ! "vmover" : Qd.GetCursor(471).data, ! "zoomin" : Qd.GetCursor(472).data, ! "zoomout" : Qd.GetCursor(473).data, ! "zoom" : Qd.GetCursor(474).data, } --- 696,790 ---- + # + # To remove the dependence of Widgets.rsrc we hardcode the cursor + # data below. + #_cursors = { + # "watch" : Qd.GetCursor(QuickDraw.watchCursor).data, + # "arrow" : Qd.qd.arrow, + # "iBeam" : Qd.GetCursor(QuickDraw.iBeamCursor).data, + # "cross" : Qd.GetCursor(QuickDraw.crossCursor).data, + # "plus" : Qd.GetCursor(QuickDraw.plusCursor).data, + # "hand" : Qd.GetCursor(468).data, + # "fist" : Qd.GetCursor(469).data, + # "hmover" : Qd.GetCursor(470).data, + # "vmover" : Qd.GetCursor(471).data, + # "zoomin" : Qd.GetCursor(472).data, + # "zoomout" : Qd.GetCursor(473).data, + # "zoom" : Qd.GetCursor(474).data, + #} + _cursors = { ! 'arrow': ! '\x00\x00\x40\x00\x60\x00\x70\x00\x78\x00\x7c\x00\x7e\x00\x7f\x00' ! '\x7f\x80\x7c\x00\x6c\x00\x46\x00\x06\x00\x03\x00\x03\x00\x00\x00' ! '\xc0\x00\xe0\x00\xf0\x00\xf8\x00\xfc\x00\xfe\x00\xff\x00\xff\x80' ! '\xff\xc0\xff\xe0\xfe\x00\xef\x00\xcf\x00\x87\x80\x07\x80\x03\x80' ! '\x00\x01\x00\x01', ! 'cross': ! '\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\xff\xe0\x04\x00\x04\x00' ! '\x04\x00\x04\x00\x04\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00' ! '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' ! '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' ! '\x00\x05\x00\x05', ! 'fist': ! '\x00\x00\x00\x00\x0d\x80\x12\x70\x12\x4c\x12\x4a\x28\x0a\x28\x02' ! '\x48\x02\x40\x02\x20\x02\x20\x04\x10\x04\x08\x08\x04\x08\x04\x08' ! '\x00\x00\x00\x00\x0d\x80\x1f\xf0\x1f\xfc\x1f\xfe\x3f\xfe\x3f\xfe' ! '\x7f\xfe\x7f\xfe\x3f\xfe\x3f\xfc\x1f\xfc\x0f\xf8\x07\xf8\x07\xf8' ! '\x00\x09\x00\x08', ! 'hand': ! '\x01\x80\x1a\x70\x26\x48\x26\x4a\x12\x4d\x12\x49\x68\x09\x98\x01' ! '\x88\x02\x40\x02\x20\x02\x20\x04\x10\x04\x08\x08\x04\x08\x04\x08' ! '\x01\x80\x1b\xf0\x3f\xf8\x3f\xfa\x1f\xff\x1f\xff\x6f\xff\xff\xff' ! '\xff\xfe\x7f\xfe\x3f\xfe\x3f\xfc\x1f\xfc\x0f\xf8\x07\xf8\x07\xf8' ! '\x00\x09\x00\x08', ! 'hmover': ! '\x00\x00\x01\x80\x01\x80\x01\x80\x01\x80\x11\x88\x31\x8c\x7f\xfe' ! '\x31\x8c\x11\x88\x01\x80\x01\x80\x01\x80\x01\x80\x00\x00\x00\x00' ! '\x03\xc0\x03\xc0\x03\xc0\x03\xc0\x1b\xd8\x3b\xdc\x7f\xfe\xff\xff' ! '\x7f\xfe\x3b\xdc\x1b\xd8\x03\xc0\x03\xc0\x03\xc0\x03\xc0\x00\x00' ! '\x00\x07\x00\x07', ! 'iBeam': ! '\x0c\x60\x02\x80\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00' ! '\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x02\x80\x0c\x60' ! '\x0c\x60\x02\x80\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00' ! '\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x02\x80\x0c\x60' ! '\x00\x04\x00\x07', ! 'plus': ! '\x00\x00\x07\xc0\x04\x60\x04\x60\x04\x60\x7c\x7c\x43\x86\x42\x86' ! '\x43\x86\x7c\x7e\x3c\x7e\x04\x60\x04\x60\x07\xe0\x03\xe0\x00\x00' ! '\x0f\xc0\x0f\xe0\x0f\xf0\x0f\xf0\xff\xff\xff\xfe\xfc\x7f\xfc\x7f' ! '\xfc\x7f\xff\xff\x7f\xff\x7f\xff\x0f\xf0\x0f\xf0\x07\xf0\x03\xe0' ! '\x00\x08\x00\x08', ! 'vmover': ! '\x00\x00\x01\x00\x03\x80\x07\xc0\x01\x00\x01\x00\x01\x00\x7f\xfc' ! '\x7f\xfc\x01\x00\x01\x00\x01\x00\x07\xc0\x03\x80\x01\x00\x00\x00' ! '\x01\x00\x03\x80\x07\xc0\x0f\xe0\x0f\xe0\x03\x80\xff\xfe\xff\xfe' ! '\xff\xfe\xff\xfe\x03\x80\x0f\xe0\x0f\xe0\x07\xc0\x03\x80\x01\x00' ! '\x00\x07\x00\x07', ! 'watch': ! '\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x40\x80\x84\x40\x84\x40\x84\x60' ! '\x9c\x60\x80\x40\x80\x40\x40\x80\x3f\x00\x3f\x00\x3f\x00\x3f\x00' ! '\x3f\x00\x3f\x00\x3f\x00\x3f\x00\x7f\x80\xff\xc0\xff\xc0\xff\xc0' ! '\xff\xc0\xff\xc0\xff\xc0\x7f\x80\x3f\x00\x3f\x00\x3f\x00\x3f\x00' ! '\x00\x08\x00\x08', ! 'zoom': ! '\x0f\x00\x30\xc0\x40\x20\x40\x20\x80\x10\x80\x10\x80\x10\x80\x10' ! '\x40\x20\x40\x20\x30\xf0\x0f\x38\x00\x1c\x00\x0e\x00\x07\x00\x02' ! '\x0f\x00\x3f\xc0\x7f\xe0\x7f\xe0\xff\xf0\xff\xf0\xff\xf0\xff\xf0' ! '\x7f\xe0\x7f\xe0\x3f\xf0\x0f\x38\x00\x1c\x00\x0e\x00\x07\x00\x02' ! '\x00\x06\x00\x06', ! 'zoomin': ! '\x0f\x00\x30\xc0\x40\x20\x46\x20\x86\x10\x9f\x90\x9f\x90\x86\x10' ! '\x46\x20\x40\x20\x30\xf0\x0f\x38\x00\x1c\x00\x0e\x00\x07\x00\x02' ! '\x0f\x00\x3f\xc0\x7f\xe0\x7f\xe0\xff\xf0\xff\xf0\xff\xf0\xff\xf0' ! '\x7f\xe0\x7f\xe0\x3f\xf0\x0f\x38\x00\x1c\x00\x0e\x00\x07\x00\x02' ! '\x00\x06\x00\x06', ! 'zoomout': ! '\x0f\x00\x30\xc0\x40\x20\x40\x20\x80\x10\x9f\x90\x9f\x90\x80\x10' ! '\x40\x20\x40\x20\x30\xf0\x0f\x38\x00\x1c\x00\x0e\x00\x07\x00\x02' ! '\x0f\x00\x3f\xc0\x7f\xe0\x7f\xe0\xff\xf0\xff\xf0\xff\xf0\xff\xf0' ! '\x7f\xe0\x7f\xe0\x3f\xf0\x0f\x38\x00\x1c\x00\x0e\x00\x07\x00\x02' ! '\x00\x06\x00\x06', } Index: Wmenus.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wmenus.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Wmenus.py 2 Nov 2001 19:09:34 -0000 1.6 --- Wmenus.py 24 Nov 2002 01:01:07 -0000 1.7 *************** *** 1,10 **** import FrameWork import Wbase, Wcontrols ! from Carbon import Ctl, Controls, Qd from types import * import Wapplication ! _arrowright = Qd.GetPicture(472) ! _arrowdown = Qd.GetPicture(473) --- 1,17 ---- import FrameWork import Wbase, Wcontrols ! from Carbon import Ctl, Controls, Qd, Res from types import * import Wapplication ! #_arrowright = Qd.GetPicture(472) ! #_arrowdown = Qd.GetPicture(473) ! ! _arrowright = Res.Resource( ! '\x00I\x00\x00\x00\x00\x00\n\x00\n\x11\x01\x01\x00\n\x00\x00\x00' ! '\x00\x00\n\x00\n\x90\x00\x02\x00\x00\x00\x00\x00\n\x00\n\x00\x00' ! '\x00\x00\x00\n\x00\n\x00\x00\x00\x00\x00\n\x00\n\x00\x00\x10\x00' ! '\x18\x00\x1c\x00\x1e\x00\x1f\x00\x1f\x00\x1e\x00\x1c\x00\x18\x00' ! '\x10\x00\xff') From nascheme@users.sourceforge.net Sun Nov 24 01:07:45 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sat, 23 Nov 2002 17:07:45 -0800 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.107,2.108 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv23381/Objects Modified Files: abstract.c Log Message: Remove special handling of str and unicode in PyNumber_InPlaceRemainder. They both have a nb_remainer slot. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.107 retrieving revision 2.108 diff -C2 -d -r2.107 -r2.108 *** abstract.c 18 Nov 2002 16:04:52 -0000 2.107 --- abstract.c 24 Nov 2002 01:07:42 -0000 2.108 *************** *** 765,777 **** PyNumber_InPlaceRemainder(PyObject *v, PyObject *w) { ! if (PyString_Check(v)) ! return PyString_Format(v, w); ! #ifdef Py_USING_UNICODE ! else if (PyUnicode_Check(v)) ! return PyUnicode_Format(v, w); ! #endif ! else ! return binary_iop(v, w, NB_SLOT(nb_inplace_remainder), ! NB_SLOT(nb_remainder), "%="); } --- 765,770 ---- PyNumber_InPlaceRemainder(PyObject *v, PyObject *w) { ! return binary_iop(v, w, NB_SLOT(nb_inplace_remainder), ! NB_SLOT(nb_remainder), "%="); } From jvr@users.sourceforge.net Sun Nov 24 01:15:22 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sat, 23 Nov 2002 17:15:22 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib bundlebuilder.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv26389 Modified Files: bundlebuilder.py Log Message: whoops, -p actually has an argument Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/bundlebuilder.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** bundlebuilder.py 23 Nov 2002 22:26:44 -0000 1.6 --- bundlebuilder.py 24 Nov 2002 01:15:20 -0000 1.7 *************** *** 366,370 **** builder = AppBuilder(verbosity=1) ! shortopts = "b:n:r:e:m:c:plhvq" longopts = ("builddir=", "name=", "resource=", "executable=", "mainprogram=", "creator=", "nib=", "plist=", "link", --- 366,370 ---- builder = AppBuilder(verbosity=1) ! shortopts = "b:n:r:e:m:c:p:lhvq" longopts = ("builddir=", "name=", "resource=", "executable=", "mainprogram=", "creator=", "nib=", "plist=", "link", From jvr@users.sourceforge.net Sun Nov 24 01:23:48 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sat, 23 Nov 2002 17:23:48 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib bundlebuilder.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv31085 Modified Files: bundlebuilder.py Log Message: get creator code from plist if available, instead of overriding with default Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/bundlebuilder.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** bundlebuilder.py 24 Nov 2002 01:15:20 -0000 1.7 --- bundlebuilder.py 24 Nov 2002 01:23:45 -0000 1.8 *************** *** 87,91 **** type = "APPL" # The creator code of the bundle. ! creator = "????" # List of files that have to be copied to /Contents/Resources. --- 87,91 ---- type = "APPL" # The creator code of the bundle. ! creator = None # List of files that have to be copied to /Contents/Resources. *************** *** 122,125 **** --- 122,130 ---- plist.CFBundleName = self.name plist.CFBundlePackageType = self.type + if self.creator is None: + if hasattr(plist, "CFBundleSignature"): + self.creator = plist.CFBundleSignature + else: + self.creator = "????" plist.CFBundleSignature = self.creator From nascheme@users.sourceforge.net Sun Nov 24 01:34:51 2002 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sat, 23 Nov 2002 17:34:51 -0800 Subject: [Python-checkins] python/dist/src/Objects abstract.c,2.108,2.109 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv2511/Objects Modified Files: abstract.c Log Message: Simplify use of NB_BINOP and NB_TERNOP by making them do the pointer dereference rather than the caller. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.108 retrieving revision 2.109 diff -C2 -d -r2.108 -r2.109 *** abstract.c 24 Nov 2002 01:07:42 -0000 2.108 --- abstract.c 24 Nov 2002 01:34:49 -0000 2.109 *************** *** 319,325 **** #define NB_SLOT(x) offsetof(PyNumberMethods, x) #define NB_BINOP(nb_methods, slot) \ ! ((binaryfunc*)(& ((char*)nb_methods)[slot] )) #define NB_TERNOP(nb_methods, slot) \ ! ((ternaryfunc*)(& ((char*)nb_methods)[slot] )) /* --- 319,325 ---- #define NB_SLOT(x) offsetof(PyNumberMethods, x) #define NB_BINOP(nb_methods, slot) \ ! (*(binaryfunc*)(& ((char*)nb_methods)[slot])) #define NB_TERNOP(nb_methods, slot) \ ! (*(ternaryfunc*)(& ((char*)nb_methods)[slot])) /* *************** *** 353,360 **** if (v->ob_type->tp_as_number != NULL && NEW_STYLE_NUMBER(v)) ! slotv = *NB_BINOP(v->ob_type->tp_as_number, op_slot); if (w->ob_type != v->ob_type && w->ob_type->tp_as_number != NULL && NEW_STYLE_NUMBER(w)) { ! slotw = *NB_BINOP(w->ob_type->tp_as_number, op_slot); if (slotw == slotv) slotw = NULL; --- 353,360 ---- if (v->ob_type->tp_as_number != NULL && NEW_STYLE_NUMBER(v)) ! slotv = NB_BINOP(v->ob_type->tp_as_number, op_slot); if (w->ob_type != v->ob_type && w->ob_type->tp_as_number != NULL && NEW_STYLE_NUMBER(w)) { ! slotw = NB_BINOP(w->ob_type->tp_as_number, op_slot); if (slotw == slotv) slotw = NULL; *************** *** 388,392 **** if (mv) { binaryfunc slot; ! slot = *NB_BINOP(mv, op_slot); if (slot) { PyObject *x = slot(v, w); --- 388,392 ---- if (mv) { binaryfunc slot; ! slot = NB_BINOP(mv, op_slot); if (slot) { PyObject *x = slot(v, w); *************** *** 467,474 **** mw = w->ob_type->tp_as_number; if (mv != NULL && NEW_STYLE_NUMBER(v)) ! slotv = *NB_TERNOP(mv, op_slot); if (w->ob_type != v->ob_type && mv != NULL && NEW_STYLE_NUMBER(w)) { ! slotw = *NB_TERNOP(mw, op_slot); if (slotw == slotv) slotw = NULL; --- 467,474 ---- mw = w->ob_type->tp_as_number; if (mv != NULL && NEW_STYLE_NUMBER(v)) ! slotv = NB_TERNOP(mv, op_slot); if (w->ob_type != v->ob_type && mv != NULL && NEW_STYLE_NUMBER(w)) { ! slotw = NB_TERNOP(mw, op_slot); if (slotw == slotv) slotw = NULL; *************** *** 495,499 **** mz = z->ob_type->tp_as_number; if (mz != NULL && NEW_STYLE_NUMBER(z)) { ! slotz = *NB_TERNOP(mz, op_slot); if (slotz == slotv || slotz == slotw) slotz = NULL; --- 495,499 ---- mz = z->ob_type->tp_as_number; if (mz != NULL && NEW_STYLE_NUMBER(z)) { ! slotz = NB_TERNOP(mz, op_slot); if (slotz == slotv || slotz == slotw) slotz = NULL; *************** *** 520,525 **** if (z == Py_None) { if (v->ob_type->tp_as_number) { ! slotz = *NB_TERNOP(v->ob_type->tp_as_number, ! op_slot); if (slotz) x = slotz(v, w, z); --- 520,525 ---- if (z == Py_None) { if (v->ob_type->tp_as_number) { ! slotz = NB_TERNOP(v->ob_type->tp_as_number, ! op_slot); if (slotz) x = slotz(v, w, z); *************** *** 543,548 **** if (v1->ob_type->tp_as_number != NULL) { ! slotv = *NB_TERNOP(v1->ob_type->tp_as_number, ! op_slot); if (slotv) x = slotv(v1, w2, z2); --- 543,548 ---- if (v1->ob_type->tp_as_number != NULL) { ! slotv = NB_TERNOP(v1->ob_type->tp_as_number, ! op_slot); if (slotv) x = slotv(v1, w2, z2); *************** *** 674,680 **** PyNumberMethods *mv = v->ob_type->tp_as_number; if (mv != NULL && HASINPLACE(v)) { ! binaryfunc *slot = NB_BINOP(mv, iop_slot); ! if (*slot) { ! PyObject *x = (*slot)(v, w); if (x != Py_NotImplemented) { return x; --- 674,680 ---- PyNumberMethods *mv = v->ob_type->tp_as_number; if (mv != NULL && HASINPLACE(v)) { ! binaryfunc slot = NB_BINOP(mv, iop_slot); ! if (slot) { ! PyObject *x = (slot)(v, w); if (x != Py_NotImplemented) { return x; From tim_one@users.sourceforge.net Sun Nov 24 02:35:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 23 Nov 2002 18:35:36 -0800 Subject: [Python-checkins] python/dist/src/Lib/bsddb dbobj.py,1.1,1.2 dbshelve.py,1.2,1.3 dbtables.py,1.3,1.4 dbutils.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb In directory sc8-pr-cvs1:/tmp/cvs-serv14671/Lib/bsddb Modified Files: dbobj.py dbshelve.py dbtables.py dbutils.py Log Message: Whitespace normalization. Index: dbobj.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/dbobj.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dbobj.py 19 Nov 2002 08:09:52 -0000 1.1 --- dbobj.py 24 Nov 2002 02:35:34 -0000 1.2 *************** *** 176,178 **** def set_get_returns_none(self, *args, **kwargs): return apply(self._cobj.set_get_returns_none, args, kwargs) - --- 176,177 ---- Index: dbshelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/dbshelve.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dbshelve.py 19 Nov 2002 17:48:49 -0000 1.2 --- dbshelve.py 24 Nov 2002 02:35:34 -0000 1.3 *************** *** 287,291 **** #--------------------------------------------------------------------------- - - - --- 287,288 ---- Index: dbtables.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/dbtables.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dbtables.py 23 Nov 2002 11:26:06 -0000 1.3 --- dbtables.py 24 Nov 2002 02:35:34 -0000 1.4 *************** *** 628,630 **** txn.abort() raise TableDBError, dberror[1] - --- 628,629 ---- Index: dbutils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/dbutils.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dbutils.py 23 Nov 2002 11:26:07 -0000 1.2 --- dbutils.py 24 Nov 2002 02:35:34 -0000 1.3 *************** *** 73,75 **** #------------------------------------------------------------------------ - --- 73,74 ---- From tim_one@users.sourceforge.net Sun Nov 24 02:35:36 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 23 Nov 2002 18:35:36 -0800 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.69,1.70 imaplib.py,1.57,1.58 nntplib.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv14671/Lib Modified Files: httplib.py imaplib.py nntplib.py Log Message: Whitespace normalization. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** httplib.py 13 Nov 2002 17:30:32 -0000 1.69 --- httplib.py 24 Nov 2002 02:35:33 -0000 1.70 *************** *** 353,357 **** if self.msg.getheader('keep-alive'): return False ! # Proxy-Connection is a netscape hack. pconn = self.msg.getheader('proxy-connection') --- 353,357 ---- if self.msg.getheader('keep-alive'): return False ! # Proxy-Connection is a netscape hack. pconn = self.msg.getheader('proxy-connection') Index: imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** imaplib.py 22 Nov 2002 05:53:04 -0000 1.57 --- imaplib.py 24 Nov 2002 02:35:33 -0000 1.58 *************** *** 331,335 **** mech = mechanism.upper() cap = 'AUTH=%s' % mech ! #if not cap in self.capabilities: # Let the server decide! # raise self.error("Server doesn't allow %s authentication." % mech) self.literal = _Authenticator(authobject).process --- 331,335 ---- mech = mechanism.upper() cap = 'AUTH=%s' % mech ! #if not cap in self.capabilities: # Let the server decide! # raise self.error("Server doesn't allow %s authentication." % mech) self.literal = _Authenticator(authobject).process *************** *** 1402,1406 **** M = IMAP4(host) if M.state == 'AUTH': ! test_seq1 = test_seq1[1:] # Login not needed M._mesg('PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION) M._mesg('CAPABILITIES = %s' % `M.capabilities`) --- 1402,1406 ---- M = IMAP4(host) if M.state == 'AUTH': ! test_seq1 = test_seq1[1:] # Login not needed M._mesg('PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION) M._mesg('CAPABILITIES = %s' % `M.capabilities`) Index: nntplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/nntplib.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** nntplib.py 17 Nov 2002 17:53:12 -0000 1.33 --- nntplib.py 24 Nov 2002 02:35:34 -0000 1.34 *************** *** 591,593 **** resp = s.quit() print resp - --- 591,592 ---- From tim_one@users.sourceforge.net Sun Nov 24 02:35:37 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 23 Nov 2002 18:35:37 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_bsddb3.py,1.1,1.2 test_format.py,1.18,1.19 test_normalization.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14671/Lib/test Modified Files: test_bsddb3.py test_format.py test_normalization.py Log Message: Whitespace normalization. Index: test_bsddb3.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bsddb3.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_bsddb3.py 19 Nov 2002 17:47:02 -0000 1.1 --- test_bsddb3.py 24 Nov 2002 02:35:35 -0000 1.2 *************** *** 58,60 **** unittest.main( defaultTest='suite' ) - --- 58,59 ---- Index: test_format.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_format.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_format.py 12 Nov 2002 23:01:12 -0000 1.18 --- test_format.py 24 Nov 2002 02:35:35 -0000 1.19 *************** *** 222,232 **** test_exc('%d', '1', TypeError, "int argument required") test_exc('%g', '1', TypeError, "float argument required") ! test_exc('no format', '1', TypeError, "not all arguments converted during string formatting") ! test_exc('no format', u'1', TypeError, "not all arguments converted during string formatting") ! test_exc(u'no format', '1', TypeError, "not all arguments converted during string formatting") ! test_exc(u'no format', u'1', TypeError, "not all arguments converted during string formatting") --- 222,232 ---- test_exc('%d', '1', TypeError, "int argument required") test_exc('%g', '1', TypeError, "float argument required") ! test_exc('no format', '1', TypeError, "not all arguments converted during string formatting") ! test_exc('no format', u'1', TypeError, "not all arguments converted during string formatting") ! test_exc(u'no format', '1', TypeError, "not all arguments converted during string formatting") ! test_exc(u'no format', u'1', TypeError, "not all arguments converted during string formatting") Index: test_normalization.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_normalization.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_normalization.py 23 Nov 2002 22:08:15 -0000 1.1 --- test_normalization.py 24 Nov 2002 02:35:35 -0000 1.2 *************** *** 47,51 **** if verbose: print line ! # Perform tests verify(c2 == NFC(c1) == NFC(c2) == NFC(c3), line) --- 47,51 ---- if verbose: print line ! # Perform tests verify(c2 == NFC(c1) == NFC(c2) == NFC(c3), line) *************** *** 66,68 **** continue assert X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c - --- 66,67 ---- From tim_one@users.sourceforge.net Sun Nov 24 02:35:37 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 23 Nov 2002 18:35:37 -0800 Subject: [Python-checkins] python/dist/src/Lib/bsddb/test test_associate.py,1.1,1.2 test_basics.py,1.1,1.2 test_compat.py,1.1,1.2 test_dbobj.py,1.1,1.2 test_dbshelve.py,1.2,1.3 test_dbtables.py,1.2,1.3 test_env_close.py,1.1,1.2 test_get_none.py,1.1,1.2 test_join.py,1.1,1.2 test_recno.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb/test In directory sc8-pr-cvs1:/tmp/cvs-serv14671/Lib/bsddb/test Modified Files: test_associate.py test_basics.py test_compat.py test_dbobj.py test_dbshelve.py test_dbtables.py test_env_close.py test_get_none.py test_join.py test_recno.py Log Message: Whitespace normalization. Index: test_associate.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_associate.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_associate.py 19 Nov 2002 17:47:04 -0000 1.1 --- test_associate.py 24 Nov 2002 02:35:34 -0000 1.2 *************** *** 249,256 **** class ShelveAssociateHashTestCase(ShelveAssociateTestCase): ! dbtype = db.DB_HASH class ShelveAssociateBTreeTestCase(ShelveAssociateTestCase): ! dbtype = db.DB_BTREE class ShelveAssociateRecnoTestCase(ShelveAssociateTestCase): --- 249,256 ---- class ShelveAssociateHashTestCase(ShelveAssociateTestCase): ! dbtype = db.DB_HASH class ShelveAssociateBTreeTestCase(ShelveAssociateTestCase): ! dbtype = db.DB_BTREE class ShelveAssociateRecnoTestCase(ShelveAssociateTestCase): *************** *** 288,295 **** class ThreadedAssociateHashTestCase(ShelveAssociateTestCase): ! dbtype = db.DB_HASH class ThreadedAssociateBTreeTestCase(ShelveAssociateTestCase): ! dbtype = db.DB_BTREE class ThreadedAssociateRecnoTestCase(ShelveAssociateTestCase): --- 288,295 ---- class ThreadedAssociateHashTestCase(ShelveAssociateTestCase): ! dbtype = db.DB_HASH class ThreadedAssociateBTreeTestCase(ShelveAssociateTestCase): ! dbtype = db.DB_BTREE class ThreadedAssociateRecnoTestCase(ShelveAssociateTestCase): Index: test_basics.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_basics.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_basics.py 19 Nov 2002 17:47:04 -0000 1.1 --- test_basics.py 24 Nov 2002 02:35:34 -0000 1.2 *************** *** 812,814 **** if __name__ == '__main__': unittest.main( defaultTest='suite' ) - --- 812,813 ---- Index: test_compat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_compat.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_compat.py 19 Nov 2002 17:47:04 -0000 1.1 --- test_compat.py 24 Nov 2002 02:35:34 -0000 1.2 *************** *** 166,169 **** if __name__ == '__main__': unittest.main( defaultTest='suite' ) - - --- 166,167 ---- Index: test_dbobj.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_dbobj.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_dbobj.py 19 Nov 2002 17:47:04 -0000 1.1 --- test_dbobj.py 24 Nov 2002 02:35:34 -0000 1.2 *************** *** 70,72 **** if __name__ == '__main__': unittest.main( defaultTest='suite' ) - --- 70,71 ---- Index: test_dbshelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_dbshelve.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_dbshelve.py 23 Nov 2002 11:26:07 -0000 1.2 --- test_dbshelve.py 24 Nov 2002 02:35:34 -0000 1.3 *************** *** 302,305 **** if __name__ == '__main__': unittest.main( defaultTest='suite' ) - - --- 302,303 ---- Index: test_dbtables.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_dbtables.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_dbtables.py 23 Nov 2002 11:26:07 -0000 1.2 --- test_dbtables.py 24 Nov 2002 02:35:34 -0000 1.3 *************** *** 234,238 **** assert values[0]['d'] == "is for dog", values assert values[0]['a'] == "is for aardvark", values ! def test_Delete(self): tabname = "test_Delete" --- 234,238 ---- assert values[0]['d'] == "is for dog", values assert values[0]['a'] == "is for aardvark", values ! def test_Delete(self): tabname = "test_Delete" Index: test_env_close.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_env_close.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_env_close.py 19 Nov 2002 17:47:04 -0000 1.1 --- test_env_close.py 24 Nov 2002 02:35:34 -0000 1.2 *************** *** 83,86 **** if __name__ == '__main__': unittest.main( defaultTest='suite' ) - - --- 83,84 ---- Index: test_get_none.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_get_none.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_get_none.py 19 Nov 2002 17:47:04 -0000 1.1 --- test_get_none.py 24 Nov 2002 02:35:34 -0000 1.2 *************** *** 95,98 **** if __name__ == '__main__': unittest.main( defaultTest='suite' ) - - --- 95,96 ---- Index: test_join.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_join.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_join.py 19 Nov 2002 17:47:04 -0000 1.1 --- test_join.py 24 Nov 2002 02:35:34 -0000 1.2 *************** *** 11,14 **** from test.test_support import verbose - - --- 11,12 ---- Index: test_recno.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_recno.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_recno.py 19 Nov 2002 17:47:07 -0000 1.1 --- test_recno.py 24 Nov 2002 02:35:34 -0000 1.2 *************** *** 255,258 **** if __name__ == '__main__': unittest.main( defaultTest='suite' ) - - --- 255,256 ---- From tim_one@users.sourceforge.net Sun Nov 24 02:37:31 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 23 Nov 2002 18:37:31 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_normalization.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv15172/Lib/test Modified Files: test_normalization.py Log Message: Split long line. XXX If NormalizationTest.txt is required to run this test, why isn't it checked into the project? Index: test_normalization.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_normalization.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_normalization.py 24 Nov 2002 02:35:35 -0000 1.2 --- test_normalization.py 24 Nov 2002 02:37:29 -0000 1.3 *************** *** 3,9 **** from unicodedata import normalize try: ! data = open("NormalizationTest.txt","r").readlines() except IOError: ! raise TestSkipped("NormalizationTest.txt not found, download from http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt") class RangeError: --- 3,10 ---- from unicodedata import normalize try: ! data = open("NormalizationTest.txt", "r").readlines() except IOError: ! raise TestSkipped("NormalizationTest.txt not found, download from " ! "http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt") class RangeError: From tim_one@users.sourceforge.net Sun Nov 24 02:40:42 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 23 Nov 2002 18:40:42 -0800 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.103,1.104 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv16052/Lib/test Modified Files: regrtest.py Log Message: Skip test_normalization on Windows until it's at least clear why the data it needs doesn't exist in the project. If it's a huge file, maybe the test should be changed to be one of the -u thingies. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** regrtest.py 22 Nov 2002 20:00:33 -0000 1.103 --- regrtest.py 24 Nov 2002 02:40:40 -0000 1.104 *************** *** 529,532 **** --- 529,533 ---- test_mpz test_nis + test_normalization test_openpty test_poll From loewis@users.sourceforge.net Sun Nov 24 08:26:03 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 24 Nov 2002 00:26:03 -0800 Subject: [Python-checkins] python/dist/src/Lib/bsddb __init__.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb In directory sc8-pr-cvs1:/tmp/cvs-serv6734/Lib/bsddb Modified Files: __init__.py Log Message: Delete bsddb from sys.modules if _bsddb cannot be imported. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 19 Nov 2002 08:09:52 -0000 1.1 --- __init__.py 24 Nov 2002 08:26:01 -0000 1.2 *************** *** 44,48 **** """ ! import _bsddb # bsddb3 calls it _db _db = _bsddb --- 44,55 ---- """ ! try: ! import _bsddb ! except ImportError: ! # Remove ourselves from sys.modules ! import sys ! del sys.modules[__name__] ! raise ! # bsddb3 calls it _db _db = _bsddb From tim_one@users.sourceforge.net Sun Nov 24 18:53:13 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 24 Nov 2002 10:53:13 -0800 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.104,1.105 test_normalization.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv7280/python/Lib/test Modified Files: regrtest.py test_normalization.py Log Message: Fiddled things so that test_normalization is expected to be skipped if and only if the test input file doesn't exist. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** regrtest.py 24 Nov 2002 02:40:40 -0000 1.104 --- regrtest.py 24 Nov 2002 18:53:11 -0000 1.105 *************** *** 504,507 **** --- 504,511 ---- # The _ExpectedSkips constructor adds this to the set of expected # skips if not os.path.supports_unicode_filenames. + # test_normalization + # Whether a skip is expected here depends on whether a large test + # input file has been downloaded. test_normalization.skip_expected + # controls that _expectations = { *************** *** 529,533 **** test_mpz test_nis - test_normalization test_openpty test_poll --- 533,536 ---- *************** *** 830,839 **** --- 833,849 ---- def __init__(self): import os.path + from test import test_normalization + self.valid = False if sys.platform in _expectations: s = _expectations[sys.platform] self.expected = Set(s.split()) + if not os.path.supports_unicode_filenames: self.expected.add('test_pep277') + + if test_normalization.skip_expected: + self.expected.add('test_normalization') + self.valid = True Index: test_normalization.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_normalization.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_normalization.py 24 Nov 2002 02:37:29 -0000 1.3 --- test_normalization.py 24 Nov 2002 18:53:11 -0000 1.4 *************** *** 1,10 **** from test.test_support import verbose, TestFailed, TestSkipped, verify import sys from unicodedata import normalize ! try: ! data = open("NormalizationTest.txt", "r").readlines() ! except IOError: ! raise TestSkipped("NormalizationTest.txt not found, download from " ! "http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt") class RangeError: --- 1,9 ---- from test.test_support import verbose, TestFailed, TestSkipped, verify import sys + import os from unicodedata import normalize ! ! TESTDATAFILE = "NormalizationTest.txt" ! skip_expected = not os.path.exists(TESTDATAFILE) class RangeError: *************** *** 30,68 **** return u"".join([unichr(x) for x in data]) ! part1_data = {} ! for line in data: ! if '#' in line: ! line = line.split('#')[0] ! line = line.strip() ! if not line: ! continue ! if line.startswith("@Part"): ! part = line ! continue ! try: ! c1,c2,c3,c4,c5 = [unistr(x) for x in line.split(';')[:-1]] ! except RangeError: ! # Skip unsupported characters ! continue ! if verbose: ! print line ! # Perform tests ! verify(c2 == NFC(c1) == NFC(c2) == NFC(c3), line) ! verify(c4 == NFC(c4) == NFC(c5), line) ! verify(c3 == NFD(c1) == NFD(c2) == NFD(c3), line) ! verify(c5 == NFD(c4) == NFD(c5), line) ! verify(c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5), line) ! verify(c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5), line) ! # Record part 1 data ! if part == "@Part1": ! part1_data[c1] = 1 ! # Perform tests for all other data ! for c in range(sys.maxunicode+1): ! X = unichr(c) ! if X in part1_data: ! continue ! assert X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c --- 29,79 ---- return u"".join([unichr(x) for x in data]) ! def test_main(): ! if skip_expected: ! raise TestSkipped(TESTDATAFILE + " not found, download from " + ! "http://www.unicode.org/Public/UNIDATA/" + TESTDATAFILE) ! data = open(TESTDATAFILE).readlines() ! part1_data = {} ! for line in data: ! if '#' in line: ! line = line.split('#')[0] ! line = line.strip() ! if not line: ! continue ! if line.startswith("@Part"): ! part = line ! continue ! try: ! c1,c2,c3,c4,c5 = [unistr(x) for x in line.split(';')[:-1]] ! except RangeError: ! # Skip unsupported characters ! continue ! if verbose: ! print line ! # Perform tests ! verify(c2 == NFC(c1) == NFC(c2) == NFC(c3), line) ! verify(c4 == NFC(c4) == NFC(c5), line) ! verify(c3 == NFD(c1) == NFD(c2) == NFD(c3), line) ! verify(c5 == NFD(c4) == NFD(c5), line) ! verify(c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5), ! line) ! verify(c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5), ! line) ! ! # Record part 1 data ! if part == "@Part1": ! part1_data[c1] = 1 ! ! # Perform tests for all other data ! for c in range(sys.maxunicode+1): ! X = unichr(c) ! if X in part1_data: ! continue ! assert X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X), c ! ! if __name__ == "__main__": ! test_main() From tim_one@users.sourceforge.net Sun Nov 24 19:19:11 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 24 Nov 2002 11:19:11 -0800 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.105,1.106 test_normalization.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25255/python/Lib/test Modified Files: regrtest.py test_normalization.py Log Message: Reduced memory burden by iterating over the normalization test input file directly (instead of sucking it all into a list of lines first). Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** regrtest.py 24 Nov 2002 18:53:11 -0000 1.105 --- regrtest.py 24 Nov 2002 19:19:09 -0000 1.106 *************** *** 507,511 **** # Whether a skip is expected here depends on whether a large test # input file has been downloaded. test_normalization.skip_expected ! # controls that _expectations = { --- 507,511 ---- # Whether a skip is expected here depends on whether a large test # input file has been downloaded. test_normalization.skip_expected ! # controls that. _expectations = { Index: test_normalization.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_normalization.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_normalization.py 24 Nov 2002 18:53:11 -0000 1.4 --- test_normalization.py 24 Nov 2002 19:19:09 -0000 1.5 *************** *** 34,41 **** "http://www.unicode.org/Public/UNIDATA/" + TESTDATAFILE) - data = open(TESTDATAFILE).readlines() - part1_data = {} ! for line in data: if '#' in line: line = line.split('#')[0] --- 34,39 ---- "http://www.unicode.org/Public/UNIDATA/" + TESTDATAFILE) part1_data = {} ! for line in open(TESTDATAFILE): if '#' in line: line = line.split('#')[0] From tim_one@users.sourceforge.net Sun Nov 24 20:23:06 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 24 Nov 2002 12:23:06 -0800 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv1233/python/Doc/ref Modified Files: ref5.tex Log Message: Repaired inaccuracies in the % docs. In particular, we don't (and can't) guarantee abs(x%y) < abs(y) in all cases when a float is involved. math.fmod() should, though, so noted that too. Bugfix candidate. Someone should check the LaTeX here first, though. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** ref5.tex 13 Nov 2002 15:32:34 -0000 1.68 --- ref5.tex 24 Nov 2002 20:23:04 -0000 1.69 *************** *** 695,700 **** \code{3.14} equals \code{4*0.7 + 0.34}.) The modulo operator always yields a result with the same sign as its second operand (or zero); ! the absolute value of the result is strictly smaller than the second ! operand. \index{modulo} --- 695,711 ---- \code{3.14} equals \code{4*0.7 + 0.34}.) The modulo operator always yields a result with the same sign as its second operand (or zero); ! the absolute value of the result is strictly smaller than the absolute ! value of the second operand\footnote{ ! While \code{abs(x\%y) < abs(y)) is true mathematically, for ! floats it may not be true numerically due to roundoff. For ! example, and assuming a platform on which a Python float is an ! IEEE 754 double-precision number, in order that \code{-1e-100 \% 1e100} ! have the same sign as \code{1e100}, the computed result is ! \code{-1e-100 + 1e100}, which is numerically exactly equal ! to \code{1e100}. Function \function{fmod()} in the \module{math} ! module returns a result whose sign matches the sign of the ! first argument instead, and so returns \code{-1e-100} in this case. ! Which approach is more appropriate depends on the application. ! }. \index{modulo} *************** *** 705,709 **** floating point numbers; there similar identities hold approximately where \code{x/y} is replaced by \code{floor(x/y)}) or ! \code{floor(x/y) - 1} (for floats),\footnote{ If x is very close to an exact integer multiple of y, it's possible for \code{floor(x/y)} to be one larger than --- 716,720 ---- floating point numbers; there similar identities hold approximately where \code{x/y} is replaced by \code{floor(x/y)}) or ! \code{floor(x/y) - 1}\footnote{ If x is very close to an exact integer multiple of y, it's possible for \code{floor(x/y)} to be one larger than From loewis@users.sourceforge.net Sun Nov 24 23:05:12 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 24 Nov 2002 15:05:12 -0800 Subject: [Python-checkins] python/dist/src/Tools/unicode makeunicodedata.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/unicode In directory sc8-pr-cvs1:/tmp/cvs-serv10896/Tools/unicode Modified Files: makeunicodedata.py Log Message: Sort names independent of the Python version. Fix hex constant warning. Include all First/Last blocks. Index: makeunicodedata.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/unicode/makeunicodedata.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** makeunicodedata.py 23 Nov 2002 22:08:15 -0000 1.15 --- makeunicodedata.py 24 Nov 2002 23:05:09 -0000 1.16 *************** *** 17,20 **** --- 17,21 ---- # 2002-10-18 mvl update to Unicode 3.2 # 2002-10-22 mvl generate NFC tables + # 2002-11-24 mvl expand all ranges, sort names version-independently # # written by Fredrik Lundh (fredrik@pythonware.com) *************** *** 404,411 **** wordlist = words.items() ! # sort on falling frequency ! # XXX: different Python versions produce a different order ! # for words with equal frequency ! wordlist.sort(lambda a, b: len(b[1])-len(a[1])) # figure out how many phrasebook escapes we need --- 405,415 ---- wordlist = words.items() ! # sort on falling frequency, then by name ! def cmpwords((aword, alist),(bword, blist)): ! r = -cmp(len(alist),len(blist)) ! if r: ! return r ! return cmp(aword, bword) ! wordlist.sort(cmpwords) # figure out how many phrasebook escapes we need *************** *** 542,549 **** table[char] = s ! # expand first-last ranges (ignore surrogates and private use) if expand: field = None ! for i in range(0, 0xD800): s = table[i] if s: --- 546,553 ---- table[char] = s ! # expand first-last ranges if expand: field = None ! for i in range(0, 0x110000): s = table[i] if s: *************** *** 588,592 **** for c in map(ord, s.upper()): h = (h * magic) + c ! ix = h & 0xff000000 if ix: h = (h ^ ((ix>>24) & 0xff)) & 0x00ffffff --- 592,596 ---- for c in map(ord, s.upper()): h = (h * magic) + c ! ix = h & 0xff000000L if ix: h = (h ^ ((ix>>24) & 0xff)) & 0x00ffffff From loewis@users.sourceforge.net Sun Nov 24 23:10:09 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 24 Nov 2002 15:10:09 -0800 Subject: [Python-checkins] python/dist/src/Lib/test/output test_unicodedata,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv14646/Lib/test/output Modified Files: test_unicodedata Log Message: Regenerate from Unicode 3.2.0 to include all First/Last ranges. Index: test_unicodedata =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_unicodedata,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_unicodedata 18 Oct 2002 16:11:51 -0000 1.6 --- test_unicodedata 24 Nov 2002 23:10:06 -0000 1.7 *************** *** 2,5 **** Testing Unicode Database... Methods: a37276dc2c158bef6dfd908ad34525c97180fad9 ! Functions: 79b4425f140f5f31179fde6db05772d21e75c228 API: ok --- 2,5 ---- Testing Unicode Database... Methods: a37276dc2c158bef6dfd908ad34525c97180fad9 ! Functions: cfe20a967a450ebc82ca68c3e4eed344164e11af API: ok From loewis@users.sourceforge.net Sun Nov 24 23:10:11 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 24 Nov 2002 15:10:11 -0800 Subject: [Python-checkins] python/dist/src/Objects unicodetype_db.h,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv14646/Objects Modified Files: unicodetype_db.h Log Message: Regenerate from Unicode 3.2.0 to include all First/Last ranges. Index: unicodetype_db.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodetype_db.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** unicodetype_db.h 18 Oct 2002 16:11:54 -0000 1.5 --- unicodetype_db.h 24 Nov 2002 23:10:08 -0000 1.6 *************** *** 144,180 **** 8, 8, 8, 8, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, ! 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 43, 44, 8, 8, 45, 44, 8, 8, 46, ! 44, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ! 46, 21, 47, 48, 21, 49, 50, 51, 8, 8, 8, 52, 53, 8, 8, 8, 8, 8, 8, 8, 8, ! 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ! 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ! 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ! 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ! 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ! 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ! 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ! 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ! 8, 8, 8, 54, 55, 8, 8, 56, 57, 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 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, *************** *** 184,191 **** --- 155,174 ---- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 51, 52, 8, 8, 53, 54, 55, 56, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 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, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ! 8, 8, 8, 8, 8, 64, }; --- 298,330 ---- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ! 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 60, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, ! 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 60, }; *************** *** 865,901 **** 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, --- 874,878 ---- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, *************** *** 1063,1090 **** 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 4, 5, 6, ! 7, 8, 9, 10, 11, 12, 13, 41, 0, 0, 0, 0, 0, 0, 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, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, ! 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, ! 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, ! 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, ! 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, ! 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, ! 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, ! 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, ! 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, ! 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, ! 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, ! 41, 41, 41, 41, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, ! 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, ! 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, *************** ***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1, 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 0, 0, }; From loewis@users.sourceforge.net Sun Nov 24 23:10:15 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 24 Nov 2002 15:10:15 -0800 Subject: [Python-checkins] python/dist/src/Modules unicodedata_db.h,1.7,1.8 unicodename_db.h,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv14646/Modules Modified Files: unicodedata_db.h unicodename_db.h Log Message: Regenerate from Unicode 3.2.0 to include all First/Last ranges. Index: unicodedata_db.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata_db.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** unicodedata_db.h 23 Nov 2002 22:08:15 -0000 1.7 --- unicodedata_db.h 24 Nov 2002 23:10:07 -0000 1.8 *************** *** 455,491 **** 8, 8, 8, 8, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21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, 8, 8, 8, 8, 8, *************** *** 495,502 **** --- 466,485 ---- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 58, 59, 8, 8, 60, 61, 62, 63, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 64, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,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, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ! 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 67, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, ! 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 67, }; *************** *** 1274,1337 **** 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0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, 30, 30, 30, 30, 30, 30, 30, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, --- 1283,1329 ---- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, ! 116, 116, 116, 116, 116, 116, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, ! 30, 30, 30, 30, 0, 0, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, ! 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, *************** *** 1339,1343 **** 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 21, 21, 21, 21, 21, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 21, 21, 21, 21, 0, 0, 0, 0, 0, 65, 118, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 11, 65, 65, 65, --- 1331,1335 ---- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 21, 21, 21, 21, 21, 21, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, --- 1506,1526 ---- 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, ! 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 30, 30, 30, ! 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, ! 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, ! 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, ! 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, ! 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, ! 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, ! 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, ! 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, ! 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, ! 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, ! 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, ! 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, *************** *** 1547,1573 **** 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, ! 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 0, 0, }; --- 1531,1565 ---- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, ! 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, ! 82, 82, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, ! 117, 117, 117, 117, 117, 117, 117, 117, 117, 0, 0, }; Index: unicodename_db.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodename_db.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** unicodename_db.h 18 Oct 2002 16:11:51 -0000 1.4 --- unicodename_db.h 24 Nov 2002 23:10:07 -0000 1.5 *************** *** 9,14 **** 203, 77, 65, 84, 72, 69, 77, 65, 84, 73, 67, 65, 204, 76, 65, 84, 73, 206, 65, 82, 65, 66, 73, 195, 67, 79, 77, 80, 65, 84, 73, 66, 73, 76, 73, ! 84, 217, 70, 79, 82, 77, 128, 83, 89, 77, 66, 79, 204, 83, 89, 76, 76, ! 65, 66, 73, 67, 211, 67, 65, 78, 65, 68, 73, 65, 206, 66, 79, 76, 196, 76, 73, 71, 65, 84, 85, 82, 197, 65, 78, 196, 77, 85, 83, 73, 67, 65, 204, 72, 65, 78, 71, 85, 204, 73, 84, 65, 76, 73, 195, 82, 65, 68, 73, --- 9,14 ---- 203, 77, 65, 84, 72, 69, 77, 65, 84, 73, 67, 65, 204, 76, 65, 84, 73, 206, 65, 82, 65, 66, 73, 195, 67, 79, 77, 80, 65, 84, 73, 66, 73, 76, 73, ! 84, 217, 70, 79, 82, 77, 128, 83, 89, 77, 66, 79, 204, 67, 65, 78, 65, [...16677 lines suppressed...] ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57426, 57436, 57446, 57456, 57466, ! 57478, 57487, 57496, 57506, 57516, 57528, 57540, 57551, 57562, 57572, ! 57582, 57591, 57600, 57610, 57620, 57631, 57642, 57645, 0, 0, 57649, ! 57653, 57657, 57661, 57666, 57672, 57678, 57684, 57687, 57691, 0, 57694, ! 57697, 57700, 57704, 57708, 57713, 57717, 57721, 57726, 57731, 57738, ! 57745, 57748, 57751, 57754, 57758, 57761, 57764, 57767, 0, 57771, 57776, ! 57780, 57784, 0, 0, 0, 0, 57789, 57794, 57801, 57806, 57811, 0, 57816, ! 57821, 57826, 57831, 57836, 57841, 57846, 57851, 57856, 57861, 57866, ! 57871, 57880, 57889, 57897, 57905, 57914, 57923, 57932, 57941, 57949, ! 57957, 57965, 57973, 57978, 57983, 57989, 57995, 58001, 58007, 58014, ! 58021, 58026, 58031, 58036, 58041, 58047, 58053, 58059, 58065, 58070, ! 58075, 58080, 58085, 58090, 58095, 58100, 58105, 58110, 58115, 58120, ! 58125, 58131, 58137, 58143, 58149, 58155, 58161, 58167, 58173, 58178, ! 58183, 58188, 58193, 58198, 58203, 58208, 58213, 58219, 58225, 58231, ! 58237, 58243, 58249, 58255, 58261, 58267, 58273, 58279, 58285, 58291, ! 58297, 58303, 58309, 58315, 58321, 58327, 58333, 58339, 58345, 58351, ! 58357, 58363, 58369, 58375, 58381, 58387, 58393, 58399, 58405, 58411, ! 58417, 58423, 58429, 58434, 58439, 58444, 58449, 58454, 58459, 58464, 58469, 58474, 58479, 58484, 58489, 58494, 58499, 58504, 58509, 58515, 58521, 58527, 58533, 58538, 58543, 58548, 58553, 58564, 58575, 58585, From jvr@users.sourceforge.net Sun Nov 24 23:16:00 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sun, 24 Nov 2002 15:16:00 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.119,1.120 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv15966 Modified Files: setup.py Log Message: Don't disable building Mac-specific modules for a non-framework build: whether they crash or not is not a matter of using a framework or not, but whether the code is run from an app bundle or not. And that it _can_ crash (instead of tracing back) is Apple's bug anyway, not ours. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** setup.py 22 Nov 2002 15:53:32 -0000 1.119 --- setup.py 24 Nov 2002 23:15:57 -0000 1.120 *************** *** 695,806 **** if platform == 'darwin': ! # Mac OS X specific modules. Modules linked against the Carbon ! # framework are only built for framework-enabled Pythons. As ! # of MacOSX 10.1 importing the Carbon framework from a non-windowing ! # application (MacOSX server, not logged in on the console) may ! # result in Python crashing. ! # ! # I would like to trigger on WITH_NEXT_FRAMEWORK but that isn't ! # available here. This Makefile variable is also what the install ! # procedure triggers on. exts.append( Extension('_CF', ['cf/_CFmodule.c', 'cf/pycfbridge.c'], extra_link_args=['-framework', 'CoreFoundation']) ) ! framework = sysconfig.get_config_var('PYTHONFRAMEWORK') ! if framework: ! exts.append( Extension('gestalt', ['gestaltmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('MacOS', ['macosmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('icglue', ['icgluemodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('macfs', ! ['macfsmodule.c', ! '../Python/getapplbycreator.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Res', ['res/_Resmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Snd', ['snd/_Sndmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('Nav', ['Nav.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_AE', ['ae/_AEmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_AH', ['ah/_AHmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Alias', ['alias/_Aliasmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_App', ['app/_Appmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_CarbonEvt', ['carbonevt/_CarbonEvtmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_CG', ['cg/_CGmodule.c'], ! extra_link_args=['-framework', 'ApplicationServices', ! '-framework', 'Carbon']) ) ! exts.append( Extension('_Cm', ['cm/_Cmmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Ctl', ['ctl/_Ctlmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Dlg', ['dlg/_Dlgmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Drag', ['drag/_Dragmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Evt', ['evt/_Evtmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_File', ['file/_Filemodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Folder', ['folder/_Foldermodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Fm', ['fm/_Fmmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Help', ['help/_Helpmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Icn', ['icn/_Icnmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_IBCarbon', ['ibcarbon/_IBCarbon.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_List', ['list/_Listmodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Menu', ['menu/_Menumodule.c'], ! extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Mlte', ['mlte/_Mltemodule.c'], extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Qd', ['qd/_Qdmodule.c'], extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Qdoffs', ['qdoffs/_Qdoffsmodule.c'], extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Qt', ['qt/_Qtmodule.c'], ! extra_link_args=['-framework', 'QuickTime', ! '-framework', 'Carbon']) ) ! exts.append( Extension('_Scrap', ['scrap/_Scrapmodule.c'], extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_TE', ['te/_TEmodule.c'], extra_link_args=['-framework', 'Carbon']) ) ! # As there is no standardized place (yet) to put ! # user-installed Mac libraries on OSX, we search for "waste" ! # in parent directories of the Python source tree. You ! # should put a symlink to your Waste installation in the ! # same folder as your python source tree. Or modify the ! # next few lines:-) ! waste_incs = find_file("WASTE.h", [], ! ['../'*n + 'waste/C_C++ Headers' for n in (0,1,2,3,4)]) ! waste_libs = find_library_file(self.compiler, "WASTE", [], ! [ "../"*n + "waste/Static Libraries" for n in (0,1,2,3,4)]) ! if waste_incs != None and waste_libs != None: ! (srcdir,) = sysconfig.get_config_vars('srcdir') ! exts.append( Extension('waste', ! ['waste/wastemodule.c'] + [ ! os.path.join(srcdir, d) for d in ! 'Mac/Wastemods/WEObjectHandlers.c', ! 'Mac/Wastemods/WETabHooks.c', ! 'Mac/Wastemods/WETabs.c' ! ], ! include_dirs = waste_incs + [os.path.join(srcdir, 'Mac/Wastemods')], ! library_dirs = waste_libs, ! libraries = ['WASTE'], ! extra_link_args = ['-framework', 'Carbon'], ! ) ) ! exts.append( Extension('_Win', ['win/_Winmodule.c'], extra_link_args=['-framework', 'Carbon']) ) self.extensions.extend(exts) --- 695,796 ---- if platform == 'darwin': ! # Mac OS X specific modules. exts.append( Extension('_CF', ['cf/_CFmodule.c', 'cf/pycfbridge.c'], extra_link_args=['-framework', 'CoreFoundation']) ) ! exts.append( Extension('gestalt', ['gestaltmodule.c'], extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('MacOS', ['macosmodule.c'], extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('icglue', ['icgluemodule.c'], extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('macfs', ! ['macfsmodule.c', ! '../Python/getapplbycreator.c'], extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Res', ['res/_Resmodule.c'], extra_link_args=['-framework', 'Carbon']) ) ! exts.append( Extension('_Snd', ['snd/_Sndmodule.c'], extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('Nav', ['Nav.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_AE', ['ae/_AEmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_AH', ['ah/_AHmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Alias', ['alias/_Aliasmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_App', ['app/_Appmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_CarbonEvt', ['carbonevt/_CarbonEvtmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_CG', ['cg/_CGmodule.c'], + extra_link_args=['-framework', 'ApplicationServices', + '-framework', 'Carbon']) ) + exts.append( Extension('_Cm', ['cm/_Cmmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Ctl', ['ctl/_Ctlmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Dlg', ['dlg/_Dlgmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Drag', ['drag/_Dragmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Evt', ['evt/_Evtmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_File', ['file/_Filemodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Folder', ['folder/_Foldermodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Fm', ['fm/_Fmmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Help', ['help/_Helpmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Icn', ['icn/_Icnmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_IBCarbon', ['ibcarbon/_IBCarbon.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_List', ['list/_Listmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Menu', ['menu/_Menumodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Mlte', ['mlte/_Mltemodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Qd', ['qd/_Qdmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Qdoffs', ['qdoffs/_Qdoffsmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Qt', ['qt/_Qtmodule.c'], + extra_link_args=['-framework', 'QuickTime', + '-framework', 'Carbon']) ) + exts.append( Extension('_Scrap', ['scrap/_Scrapmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_TE', ['te/_TEmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) + # As there is no standardized place (yet) to put + # user-installed Mac libraries on OSX, we search for "waste" + # in parent directories of the Python source tree. You + # should put a symlink to your Waste installation in the + # same folder as your python source tree. Or modify the + # next few lines:-) + waste_incs = find_file("WASTE.h", [], + ['../'*n + 'waste/C_C++ Headers' for n in (0,1,2,3,4)]) + waste_libs = find_library_file(self.compiler, "WASTE", [], + ["../"*n + "waste/Static Libraries" for n in (0,1,2,3,4)]) + if waste_incs != None and waste_libs != None: + (srcdir,) = sysconfig.get_config_vars('srcdir') + exts.append( Extension('waste', + ['waste/wastemodule.c'] + [ + os.path.join(srcdir, d) for d in + 'Mac/Wastemods/WEObjectHandlers.c', + 'Mac/Wastemods/WETabHooks.c', + 'Mac/Wastemods/WETabs.c' + ], + include_dirs = waste_incs + [os.path.join(srcdir, 'Mac/Wastemods')], + library_dirs = waste_libs, + libraries = ['WASTE'], + extra_link_args = ['-framework', 'Carbon'], + ) ) + exts.append( Extension('_Win', ['win/_Winmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) self.extensions.extend(exts) From loewis@users.sourceforge.net Mon Nov 25 09:13:37 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 25 Nov 2002 01:13:37 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libunicodedata.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19232/Doc/lib Modified Files: libunicodedata.tex Log Message: Add unidata_version. Bump generator version number. Index: libunicodedata.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunicodedata.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** libunicodedata.tex 23 Nov 2002 22:08:15 -0000 1.4 --- libunicodedata.tex 25 Nov 2002 09:13:35 -0000 1.5 *************** *** 118,119 **** --- 118,126 ---- \end{funcdesc} + In addition, the module exposes the following constant: + + \begin{datadesc}{unidata_version} + The version of the Unicode database used in this module. + + \versionadded{2.3} + \end{datadesc} \ No newline at end of file From loewis@users.sourceforge.net Mon Nov 25 09:13:39 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 25 Nov 2002 01:13:39 -0800 Subject: [Python-checkins] python/dist/src/Modules unicodedata.c,2.25,2.26 unicodedata_db.h,1.8,1.9 unicodename_db.h,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv19232/Modules Modified Files: unicodedata.c unicodedata_db.h unicodename_db.h Log Message: Add unidata_version. Bump generator version number. Index: unicodedata.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata.c,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -d -r2.25 -r2.26 *** unicodedata.c 23 Nov 2002 22:10:29 -0000 2.25 --- unicodedata.c 25 Nov 2002 09:13:35 -0000 2.26 *************** *** 882,885 **** --- 882,887 ---- return; + PyModule_AddStringConstant(m, "unidata_version", UNIDATA_VERSION); + /* Export C API */ v = PyCObject_FromVoidPtr((void *) &hashAPI, NULL); Index: unicodedata_db.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata_db.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** unicodedata_db.h 24 Nov 2002 23:10:07 -0000 1.8 --- unicodedata_db.h 25 Nov 2002 09:13:35 -0000 1.9 *************** *** 1,4 **** ! /* this file was generated by Tools/unicode/makeunicodedata.py 2.1 */ /* a list of unique database records */ const _PyUnicode_DatabaseRecord _PyUnicode_Database_Records[] = { --- 1,5 ---- ! /* this file was generated by Tools/unicode/makeunicodedata.py 2.2 */ + #define UNIDATA_VERSION "3.2.0" /* a list of unique database records */ const _PyUnicode_DatabaseRecord _PyUnicode_Database_Records[] = { Index: unicodename_db.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodename_db.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** unicodename_db.h 24 Nov 2002 23:10:07 -0000 1.5 --- unicodename_db.h 25 Nov 2002 09:13:36 -0000 1.6 *************** *** 1,3 **** ! /* this file was generated by Tools/unicode/makeunicodedata.py 2.1 */ #define NAME_MAXLEN 256 --- 1,3 ---- ! /* this file was generated by Tools/unicode/makeunicodedata.py 2.2 */ #define NAME_MAXLEN 256 From loewis@users.sourceforge.net Mon Nov 25 09:13:39 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 25 Nov 2002 01:13:39 -0800 Subject: [Python-checkins] python/dist/src/Objects unicodetype_db.h,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv19232/Objects Modified Files: unicodetype_db.h Log Message: Add unidata_version. Bump generator version number. Index: unicodetype_db.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodetype_db.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** unicodetype_db.h 24 Nov 2002 23:10:08 -0000 1.6 --- unicodetype_db.h 25 Nov 2002 09:13:36 -0000 1.7 *************** *** 1,3 **** ! /* this file was generated by Tools/unicode/makeunicodedata.py 2.1 */ /* a list of unique character type descriptors */ --- 1,3 ---- ! /* this file was generated by Tools/unicode/makeunicodedata.py 2.2 */ /* a list of unique character type descriptors */ From loewis@users.sourceforge.net Mon Nov 25 09:13:39 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 25 Nov 2002 01:13:39 -0800 Subject: [Python-checkins] python/dist/src/Tools/unicode makeunicodedata.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/unicode In directory sc8-pr-cvs1:/tmp/cvs-serv19232/Tools/unicode Modified Files: makeunicodedata.py Log Message: Add unidata_version. Bump generator version number. Index: makeunicodedata.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/unicode/makeunicodedata.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** makeunicodedata.py 24 Nov 2002 23:05:09 -0000 1.16 --- makeunicodedata.py 25 Nov 2002 09:13:37 -0000 1.17 *************** *** 2,6 **** # (re)generate unicode property and type databases # ! # this script converts a unicode 3.0 database file to # Modules/unicodedata_db.h, Modules/unicodename_db.h, # and Objects/unicodetype_db.h --- 2,6 ---- # (re)generate unicode property and type databases # ! # this script converts a unicode 3.2 database file to # Modules/unicodedata_db.h, Modules/unicodename_db.h, # and Objects/unicodetype_db.h *************** *** 18,21 **** --- 18,22 ---- # 2002-10-22 mvl generate NFC tables # 2002-11-24 mvl expand all ranges, sort names version-independently + # 2002-11-25 mvl add UNIDATA_VERSION # # written by Fredrik Lundh (fredrik@pythonware.com) *************** *** 25,30 **** SCRIPT = sys.argv[0] ! VERSION = "2.1" UNICODE_DATA = "UnicodeData.txt" COMPOSITION_EXCLUSIONS = "CompositionExclusions.txt" --- 26,33 ---- SCRIPT = sys.argv[0] ! VERSION = "2.2" + # The Unicode Database + UNIDATA_VERSION = "3.2.0" UNICODE_DATA = "UnicodeData.txt" COMPOSITION_EXCLUSIONS = "CompositionExclusions.txt" *************** *** 193,196 **** --- 196,200 ---- print >>fp, "/* this file was generated by %s %s */" % (SCRIPT, VERSION) print >>fp + print >>fp, '#define UNIDATA_VERSION "%s"' % UNIDATA_VERSION print >>fp, "/* a list of unique database records */" print >>fp, \ From jackjansen@users.sourceforge.net Mon Nov 25 13:11:09 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 25 Nov 2002 05:11:09 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj project.pbxproj,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj In directory sc8-pr-cvs1:/tmp/cvs-serv4673/PythonLauncher.pbproj Modified Files: project.pbxproj Log Message: Lots of restructuring, mostly suggested by Bill Bumgarner. Main externally visible difference is that the factory defaults are now in a plist file in the bundle, in stead of being hard-coded in the application. Index: project.pbxproj =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** project.pbxproj 20 Nov 2002 14:14:14 -0000 1.6 --- project.pbxproj 25 Nov 2002 13:11:06 -0000 1.7 *************** *** 236,239 **** --- 236,240 ---- F5A4C13E02F203F601000102, 089C165FFE840EACC02AAC07, + F5A42167038BDD8E0110C447, ); isa = PBXGroup; *************** *** 292,295 **** --- 293,297 ---- INSTALL_PATH = /Applications/Python; LIBRARY_SEARCH_PATHS = ""; + OPTIMIZATION_CFLAGS = "-O0"; OTHER_LDFLAGS = ""; PRODUCT_NAME = PythonLauncher; *************** *** 431,434 **** --- 433,437 ---- F5A4C13F02F203F701000102, F5449B4C02FB3F7E01000102, + F5A42168038BDD8E0110C447, ); isa = PBXResourcesBuildPhase; *************** *** 574,577 **** --- 577,591 ---- F58D4A3F02F1F94B01000102 = { fileRef = F58D4A3C02F1F94B01000102; + isa = PBXBuildFile; + settings = { + }; + }; + F5A42167038BDD8E0110C447 = { + isa = PBXFileReference; + path = factorySettings.plist; + refType = 4; + }; + F5A42168038BDD8E0110C447 = { + fileRef = F5A42167038BDD8E0110C447; isa = PBXBuildFile; settings = { From jackjansen@users.sourceforge.net Mon Nov 25 13:11:09 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 25 Nov 2002 05:11:09 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher factorySettings.plist,NONE,1.1 FileSettings.h,1.1,1.2 FileSettings.m,1.3,1.4 MyDocument.m,1.2,1.3 PreferencesWindowController.m,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher In directory sc8-pr-cvs1:/tmp/cvs-serv4673 Modified Files: FileSettings.h FileSettings.m MyDocument.m PreferencesWindowController.m Added Files: factorySettings.plist Log Message: Lots of restructuring, mostly suggested by Bill Bumgarner. Main externally visible difference is that the factory defaults are now in a plist file in the bundle, in stead of being hard-coded in the application. --- NEW FILE: factorySettings.plist --- Python GUI Script debug inspect interpreter_list /usr/local/bin/pythonw /sw/bin/pythonw /Library/Frameworks/Python.framework/Versions/Current/Resources/Python.app/Contents/MacOS/python /usr/bin/pythonw /Applications/MacPython-OSX/python-additions/Python.app/Contents/MacOS/python nosite optimize others verbose with_terminal Python Script debug inspect interpreter_list /usr/local/bin/python /sw/bin/python /Library/Frameworks/Python.framework/Versions/Current/bin/python /usr/bin/python nosite optimize others verbose with_terminal Python Bytecode Document debug inspect interpreter_list /usr/local/bin/python /sw/bin/python /Library/Frameworks/Python.framework/Versions/Current/bin/python /usr/bin/python nosite optimize others verbose with_terminal Index: FileSettings.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/FileSettings.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FileSettings.h 29 Jul 2002 21:36:34 -0000 1.1 --- FileSettings.h 25 Nov 2002 13:11:03 -0000 1.2 *************** *** 38,53 **** + (id)getDefaultsForFileType: (NSString *)filetype; + (id)newSettingsForFileType: (NSString *)filetype; ! - (id)init; ! - (id)initWithFileSettings: (FileSettings *)source; - (void)updateFromSource: (id )source; - (NSString *)commandLineForScript: (NSString *)script; ! - (id)factorySettingsForFileType: (NSString *)filetype; ! - (void)saveDefaults; ! - (void)updateFromUserDefaults: (NSString *)filetype; ! @end --- 38,58 ---- + (id)getDefaultsForFileType: (NSString *)filetype; + + (id)getFactorySettingsForFileType: (NSString *)filetype; + (id)newSettingsForFileType: (NSString *)filetype; ! //- (id)init; ! - (id)initForFileType: (NSString *)filetype; ! - (id)initForFSDefaultFileType: (NSString *)filetype; ! - (id)initForDefaultFileType: (NSString *)filetype; ! //- (id)initWithFileSettings: (FileSettings *)source; - (void)updateFromSource: (id )source; - (NSString *)commandLineForScript: (NSString *)script; ! //- (void)applyFactorySettingsForFileType: (NSString *)filetype; ! //- (void)saveDefaults; ! //- (void)applyUserDefaults: (NSString *)filetype; ! - (void)applyValuesFromDict: (NSDictionary *)dict; ! - (void)reset; @end Index: FileSettings.m =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/FileSettings.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FileSettings.m 1 Aug 2002 21:14:06 -0000 1.3 --- FileSettings.m 25 Nov 2002 13:11:05 -0000 1.4 *************** *** 10,13 **** --- 10,36 ---- @implementation FileSettings + + + (id)getFactorySettingsForFileType: (NSString *)filetype + { + static FileSettings *fsdefault_py, *fsdefault_pyw, *fsdefault_pyc; + FileSettings **curdefault; + + if ([filetype isEqualToString: @"Python Script"]) { + curdefault = &fsdefault_py; + } else if ([filetype isEqualToString: @"Python GUI Script"]) { + curdefault = &fsdefault_pyw; + } else if ([filetype isEqualToString: @"Python Bytecode Document"]) { + curdefault = &fsdefault_pyc; + } else { + NSLog(@"Funny File Type: %@\n", filetype); + curdefault = &fsdefault_py; + filetype = @"Python Script"; + } + if (!*curdefault) { + *curdefault = [[FileSettings new] initForFSDefaultFileType: filetype]; + } + return *curdefault; + } + + (id)getDefaultsForFileType: (NSString *)filetype { *************** *** 27,33 **** } if (!*curdefault) { ! *curdefault = [[FileSettings new] init]; ! [*curdefault factorySettingsForFileType: filetype]; ! [*curdefault updateFromUserDefaults: filetype]; } return *curdefault; --- 50,54 ---- } if (!*curdefault) { ! *curdefault = [[FileSettings new] initForDefaultFileType: filetype]; } return *curdefault; *************** *** 38,77 **** FileSettings *cur; ! cur = [[FileSettings new] init]; ! [cur initWithFileSettings: [FileSettings getDefaultsForFileType: filetype]]; ! return cur; ! } ! ! - (id)init ! { ! self = [super init]; ! return [self factorySettingsForFileType: @"Python Script"]; ! } ! ! - (id)factorySettingsForFileType: (NSString *)filetype ! { ! debug = NO; ! verbose = NO; ! inspect = NO; ! optimize = NO; ! nosite = NO; ! tabs = NO; ! others = @""; ! if ([filetype isEqualToString: @"Python Script"] || ! [filetype isEqualToString: @"Python Bytecode Document"]) { ! interpreter = @"/Library/Frameworks/Python.framework/Versions/Current/bin/python"; ! with_terminal = YES; ! } else if ([filetype isEqualToString: @"Python GUI Script"]) { ! interpreter = @"/Library/Frameworks/Python.framework/Versions/Current/Resources/Python.app/Contents/MacOS/python"; ! with_terminal = NO; ! } else { ! NSLog(@"Funny File Type: %@\n", filetype); ! } ! origsource = NULL; ! return self; } - (id)initWithFileSettings: (FileSettings *)source { interpreter = [source->interpreter retain]; debug = source->debug; --- 59,72 ---- FileSettings *cur; ! cur = [FileSettings new]; ! [cur initForFileType: filetype]; ! return [cur retain]; } - (id)initWithFileSettings: (FileSettings *)source { + self = [super init]; + if (!self) return self; + interpreter = [source->interpreter retain]; debug = source->debug; *************** *** 83,94 **** others = [source->others retain]; with_terminal = source->with_terminal; - origsource = [source retain]; return self; } ! - (void)saveDefaults { ! [origsource updateFromSource: self]; } --- 78,181 ---- others = [source->others retain]; with_terminal = source->with_terminal; + prefskey = source->prefskey; + if (prefskey) [prefskey retain]; return self; } ! - (id)initForFileType: (NSString *)filetype { ! FileSettings *defaults; ! ! defaults = [FileSettings getDefaultsForFileType: filetype]; ! self = [self initWithFileSettings: defaults]; ! origsource = [defaults retain]; ! return self; ! } ! ! //- (id)init ! //{ ! // self = [self initForFileType: @"Python Script"]; ! // return self; ! //} ! ! - (id)initForFSDefaultFileType: (NSString *)filetype ! { ! int i; ! NSString *filename; ! NSDictionary *dict; ! NSArray *interpreters; ! static NSDictionary *factorySettings; ! ! self = [super init]; ! if (!self) return self; ! ! if (factorySettings == NULL) { ! NSBundle *bdl = [NSBundle mainBundle]; ! NSString *path = [ bdl pathForResource: @"factorySettings" ! ofType: @"plist"]; ! factorySettings = [[NSDictionary dictionaryWithContentsOfFile: ! path] retain]; ! if (factorySettings == NULL) { ! NSLog(@"Missing %@", path); ! return NULL; ! } ! } ! dict = [factorySettings objectForKey: filetype]; ! if (dict == NULL) { ! NSLog(@"factorySettings.plist misses file type \"%@\"", filetype); ! interpreter = [@"no default found" retain]; ! return NULL; ! } ! [self applyValuesFromDict: dict]; ! interpreters = [dict objectForKey: @"interpreter_list"]; ! interpreter = NULL; ! for (i=0; i < [interpreters count]; i++) { ! filename = [interpreters objectAtIndex: i]; ! filename = [filename stringByExpandingTildeInPath]; ! if ([[NSFileManager defaultManager] fileExistsAtPath: filename]) { ! interpreter = [filename retain]; ! break; ! } ! } ! if (interpreter == NULL) ! interpreter = [@"no default found" retain]; ! origsource = NULL; ! return self; ! } ! ! - (void)applyUserDefaults: (NSString *)filetype ! { ! NSUserDefaults *defaults; ! NSDictionary *dict; ! ! defaults = [NSUserDefaults standardUserDefaults]; ! dict = [defaults dictionaryForKey: filetype]; ! if (!dict) ! return; ! [self applyValuesFromDict: dict]; ! } ! ! - (id)initForDefaultFileType: (NSString *)filetype ! { ! FileSettings *fsdefaults; ! ! fsdefaults = [FileSettings getFactorySettingsForFileType: filetype]; ! self = [self initWithFileSettings: fsdefaults]; ! if (!self) return self; ! [self applyUserDefaults: filetype]; ! prefskey = [filetype retain]; ! return self; ! } ! ! - (void)reset ! { ! if (origsource) { ! [self updateFromSource: origsource]; ! } else { ! FileSettings *fsdefaults; ! fsdefaults = [FileSettings getFactorySettingsForFileType: prefskey]; ! [self updateFromSource: fsdefaults]; ! } } *************** *** 104,107 **** --- 191,196 ---- others = [[source others] retain]; with_terminal = [source with_terminal]; + // And if this is a user defaults object we also save the + // values if (!origsource) { NSUserDefaults *defaults; *************** *** 122,136 **** } ! - (void)updateFromUserDefaults: (NSString *)filetype { - NSUserDefaults *defaults; - NSDictionary *dict; id value; - prefskey = [filetype retain]; - defaults = [NSUserDefaults standardUserDefaults]; - dict = [defaults dictionaryForKey: filetype]; - if (!dict) - return; value = [dict objectForKey: @"interpreter"]; if (value) interpreter = [value retain]; --- 211,218 ---- } ! - (void)applyValuesFromDict: (NSDictionary *)dict { id value; value = [dict objectForKey: @"interpreter"]; if (value) interpreter = [value retain]; Index: MyDocument.m =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/MyDocument.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MyDocument.m 31 Jul 2002 13:15:59 -0000 1.2 --- MyDocument.m 25 Nov 2002 13:11:05 -0000 1.3 *************** *** 15,25 **** - (id)init { ! [super init]; if (self) { // Add your subclass-specific initialization here. // If an error occurs here, send a [self dealloc] message and return nil. ! script = @".py"; ! filetype = @"Python Script"; } return self; --- 15,26 ---- - (id)init { ! self = [super init]; if (self) { // Add your subclass-specific initialization here. // If an error occurs here, send a [self dealloc] message and return nil. ! script = [@".py" retain]; ! filetype = [@"Python Script" retain]; ! settings = NULL; } return self; *************** *** 43,46 **** --- 44,48 ---- - (void)load_defaults { + // if (settings) [settings release]; settings = [FileSettings newSettingsForFileType: filetype]; } *************** *** 107,112 **** --- 109,117 ---- // ask the app delegate whether we should show the UI or not. show_ui = [[[NSApplication sharedApplication] delegate] shouldShowUI]; + [script release]; script = [fileName retain]; + [filetype release]; filetype = [type retain]; + // if (settings) [settings release]; settings = [FileSettings newSettingsForFileType: filetype]; if (show_ui) { *************** *** 136,140 **** - (IBAction)do_reset:(id)sender { ! [self load_defaults]; [self update_display]; } --- 141,145 ---- - (IBAction)do_reset:(id)sender { ! [settings reset]; [self update_display]; } Index: PreferencesWindowController.m =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PreferencesWindowController.m,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PreferencesWindowController.m 29 Jul 2002 21:36:35 -0000 1.1 --- PreferencesWindowController.m 25 Nov 2002 13:11:05 -0000 1.2 *************** *** 63,67 **** - (IBAction)do_reset:(id)sender { ! [self load_defaults]; [self update_display]; } --- 63,67 ---- - (IBAction)do_reset:(id)sender { ! [settings reset]; [self update_display]; } From akuchling@users.sourceforge.net Mon Nov 25 13:56:14 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 25 Nov 2002 05:56:14 -0800 Subject: [Python-checkins] python/dist/src/Doc/inst inst.tex,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/inst In directory sc8-pr-cvs1:/tmp/cvs-serv32493 Modified Files: inst.tex Log Message: Mention that .pth files can't be used to override standard modules (suggested by Jack Jansen) Index: inst.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/inst/inst.tex,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** inst.tex 15 Nov 2002 02:52:44 -0000 1.44 --- inst.tex 25 Nov 2002 13:56:12 -0000 1.45 *************** *** 729,736 **** \file{.../site-packages/} directory. Path configuration files have an extension of \file{.pth}, and each line must contain a single path ! that will be added to \code{sys.path}. Paths can be absolute or ! relative, in which case they're relative to the directory containing ! the \file{.pth} file. Any directories added to the search path will ! be scanned in turn for \file{.pth} files. See \citetitle[http://www.python.org/dev/doc/devel/lib/module-site.html]{the documentation for the \module{site} module} for more information. --- 729,740 ---- \file{.../site-packages/} directory. Path configuration files have an extension of \file{.pth}, and each line must contain a single path ! that will be appended to \code{sys.path}. (Because the new paths are ! appended to \code{sys.path}, modules in the added directories will not ! override standard modules. This means you can't use this mechanism ! for installing fixed versions of standard modules.) ! ! Paths can be absolute or relative, in which case they're relative to ! the directory containing the \file{.pth} file. Any directories added ! to the search path will be scanned in turn for \file{.pth} files. See \citetitle[http://www.python.org/dev/doc/devel/lib/module-site.html]{the documentation for the \module{site} module} for more information. From mwh@users.sourceforge.net Mon Nov 25 15:06:31 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon, 25 Nov 2002 07:06:31 -0800 Subject: [Python-checkins] python/dist/src/Include abstract.h,2.45,2.46 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv18164 Modified Files: abstract.h Log Message: James Henstridge pointed out a misleading comment. Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.45 retrieving revision 2.46 diff -C2 -d -r2.45 -r2.46 *** abstract.h 12 Aug 2002 07:21:56 -0000 2.45 --- abstract.h 25 Nov 2002 15:06:29 -0000 2.46 *************** *** 385,394 **** int PyObject_IsTrue(PyObject *o); ! Returns 1 if the object, o, is considered to be true, and ! 0 otherwise. This is equivalent to the Python expression: ! not not o - This function always succeeds. - */ --- 385,392 ---- int PyObject_IsTrue(PyObject *o); ! Returns 1 if the object, o, is considered to be true, 0 if o is ! considered to be false and -1 on failure. This is equivalent to the ! Python expression: not not o */ *************** *** 397,406 **** int PyObject_Not(PyObject *o); ! Returns 0 if the object, o, is considered to be true, and ! 1 otherwise. This is equivalent to the Python expression: ! not o - This function always succeeds. - */ --- 395,402 ---- int PyObject_Not(PyObject *o); ! Returns 0 if the object, o, is considered to be true, 1 if o is ! considered to be false and -1 on failure. This is equivalent to the ! Python expression: not o */ From akuchling@users.sourceforge.net Mon Nov 25 16:01:15 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 25 Nov 2002 08:01:15 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib liblogging.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv17612 Modified Files: liblogging.tex Log Message: Remove extra word Index: liblogging.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblogging.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** liblogging.tex 15 Nov 2002 18:49:57 -0000 1.2 --- liblogging.tex 25 Nov 2002 16:01:08 -0000 1.3 *************** *** 13,17 **** There is a need for a standard logging system in Python, as documented in ! {}\pep{282} and enthusiastically endorsed by the Guido van Rossum in the {}\citetitle[http://www.python.org/doc/essays/pepparade.html]{Parade of the PEPs}. By a happy coincidence, the package described here was already in --- 13,17 ---- There is a need for a standard logging system in Python, as documented in ! {}\pep{282} and enthusiastically endorsed by Guido van Rossum in the {}\citetitle[http://www.python.org/doc/essays/pepparade.html]{Parade of the PEPs}. By a happy coincidence, the package described here was already in From akuchling@users.sourceforge.net Mon Nov 25 16:02:19 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Mon, 25 Nov 2002 08:02:19 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv18126 Modified Files: whatsnew23.tex Log Message: Remove \module{} in link text to avoid HTML generation bug Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** whatsnew23.tex 20 Nov 2002 13:50:15 -0000 1.72 --- whatsnew23.tex 25 Nov 2002 16:02:13 -0000 1.73 *************** *** 521,527 **** is only a partial overview of the \module{logging} package's features, so please see the ! \ulink{\module{logging} package's reference documentation}{http://www.python.org/dev/doc/devel/lib/module-logging.html} ! for all of the details. Reading ! \pep{282} will also be helpful. --- 521,526 ---- is only a partial overview of the \module{logging} package's features, so please see the ! \ulink{package's reference documentation}{http://www.python.org/dev/doc/devel/lib/module-logging.html} ! for all of the details. Reading \pep{282} will also be helpful. From jackjansen@users.sourceforge.net Mon Nov 25 16:36:51 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 25 Nov 2002 08:36:51 -0800 Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen bgenObjectDefinition.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory sc8-pr-cvs1:/tmp/cvs-serv2312 Modified Files: bgenObjectDefinition.py Log Message: Added a class PEP252Mixin. By adding this to your ObjectDefinition you get PEP-252 style objects in stead of old-fashioned objects. In stead of defining a GetattrHook you declare a class variable getsetlist, which contains tuples (name, getcode, setcode, docstring). Only lightly tested: the code still works if you don't inherit PEP252Mixin and the code works if you inherit it but don't define any getters or setters. Also, this will not work together with the "poor mans inheritance" offered by method chains, so the CF module will remain with old-style objects until PEP253 is supported too. Index: bgenObjectDefinition.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenObjectDefinition.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** bgenObjectDefinition.py 17 Jul 2002 16:30:38 -0000 1.17 --- bgenObjectDefinition.py 25 Nov 2002 16:36:49 -0000 1.18 *************** *** 24,27 **** --- 24,29 ---- self.static = "static " # set to "" to make _New and _Convert public self.modulename = None + if hasattr(self, "assertions"): + self.assertions() def add(self, g, dupcheck=0): *************** *** 63,68 **** Output() ! Output("%sPyMethodChain %s_chain = { %s_methods, %s };", ! self.static, self.prefix, self.prefix, self.basechain) self.outputGetattr() --- 65,69 ---- Output() ! self.outputMethodChain() self.outputGetattr() *************** *** 79,82 **** --- 80,87 ---- OutHeader2("End object type " + self.name) + + def outputMethodChain(self): + Output("%sPyMethodChain %s_chain = { %s_methods, %s };", + self.static, self.prefix, self.prefix, self.basechain) def outputStructMembers(self): *************** *** 201,205 **** --- 206,330 ---- DedentLevel() + 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. + assert self.outputGetattr.im_func == PEP252Mixin.outputGetattr.im_func + assert self.outputSetattr.im_func == PEP252Mixin.outputSetattr.im_func + assert self.outputGetattrBody == None + assert self.outputGetattrHook == None + + 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): + func = getattr(self, methodname) + func() + else: + Output("0, /*%s*/", methodname) + + def outputTypeObject(self): + sf = self.static and "static " + Output() + Output("%sPyTypeObject %s = {", sf, self.typename) + IndentLevel() + Output("PyObject_HEAD_INIT(NULL)") + Output("0, /*ob_size*/") + if self.modulename: + Output("\"%s.%s\", /*tp_name*/", self.modulename, self.name) + else: + 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*/") + Output("(getattrfunc)0, /*tp_getattr*/") + 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) + Output("0, /*tp_call*/") + Output("0, /*tp_str*/") + Output("PyObject_GenericGetAttr, /*tp_getattro*/") + Output("PyObject_GenericSetAttr, /*tp_setattro */") + + self.outputHook("tp_as_buffer") + self.outputHook("tp_flags") + self.outputHook("tp_doc") + self.outputHook("tp_traverse") + self.outputHook("tp_clear") + self.outputHook("tp_richcompare") + self.outputHook("tp_weaklistoffset") + self.outputHook("tp_iter") + self.outputHook("tp_iternext") + Output("%s_methods, /* tp_methods */", self.prefix) + self.outputHook("tp_members") + Output("%s_getsetlist, /*tp_getset*/", self.prefix) + self.outputHook("tp_base") + DedentLevel() + Output("};") + + def outputGetSetList(self): + if self.getsetlist: + for name, get, set, doc in self.getsetlist: + if get: + self.outputGetter(name, get) + else: + Output("#define %s_get_%s NULL", self.prefix, name) + if set: + self.outputSetter(name, set) + else: + Output("#define %s_set_%s NULL", self.prefix, name) + + Output("static PyGetSetDef %s_getsetlist[] = {", self.prefix) + IndentLevel() + for name, get, set, doc in self.getsetlist: + if doc: + doc = `doc` + else: + doc = "NULL" + Output("{\"%s\", (getter)%s_get_%s, (setter)%s_set_%s, %s}", + name, self.prefix, name, self.prefix, name, doc) + DedentLevel() + Output("};") + else: + Output("#define %s_getsetlist NULL", self.prefix) + + def outputGetter(self, name, code): + Output("static PyObject *%s_get_%s(%s *self, void *closure)", + self.prefix, name, self.objecttype) + OutLbrace() + Output(code) + OutRbrace() + + def outputSetter(self, name, code): + Output("static int %s_get_%s(%s *self, PyObject *v, void *closure)", + self.prefix, name, self.objecttype) + OutLbrace() + Output(code) + Output("return 0;") + OutRbrace() class GlobalObjectDefinition(ObjectDefinition): From niemeyer@users.sourceforge.net Mon Nov 25 17:25:12 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Mon, 25 Nov 2002 09:25:12 -0800 Subject: [Python-checkins] python/dist/src/Lib webbrowser.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv29323/Lib Modified Files: webbrowser.py Log Message: Fixed bug [#495695] webbrowser.py: selection of browser * Lib/webbrowser.py Only include graphic browsers in _tryorder if DISPLAY is set. Also, included skipstone support, as suggested by Fred in the mentioned bug. * Misc/NEWS Mention fix and skipstone inclusion. Index: webbrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/webbrowser.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** webbrowser.py 11 Oct 2002 22:04:22 -0000 1.34 --- webbrowser.py 25 Nov 2002 17:25:04 -0000 1.35 *************** *** 262,267 **** # an xterm. if os.environ.get("TERM") or os.environ.get("DISPLAY"): ! _tryorder = ["galeon", "mozilla", "netscape", "kfm", ! "grail", "links", "lynx", "w3m",] # Easy cases first -- register console browsers if we have them. --- 262,266 ---- # an xterm. if os.environ.get("TERM") or os.environ.get("DISPLAY"): ! _tryorder = ["links", "lynx", "w3m"] # Easy cases first -- register console browsers if we have them. *************** *** 279,282 **** --- 278,284 ---- # X browsers have more in the way of options if os.environ.get("DISPLAY"): + _tryorder = ["galeon", "skipstone", "mozilla", "netscape", + "kfm", "grail"] + _tryorder + # First, the Netscape series if _iscommand("mozilla"): *************** *** 293,296 **** --- 295,303 ---- if _iscommand("galeon"): register("galeon", None, Galeon("galeon")) + + # Skipstone, another Gtk/Mozilla based browser + if _iscommand("skipstone"): + register("skipstone", None, GenericBrowser( + "skipstone '%s' >/dev/null &")) # Konqueror/kfm, the KDE browser. From niemeyer@users.sourceforge.net Mon Nov 25 17:25:38 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Mon, 25 Nov 2002 09:25:38 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.541,1.542 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv29323/Misc Modified Files: NEWS Log Message: Fixed bug [#495695] webbrowser.py: selection of browser * Lib/webbrowser.py Only include graphic browsers in _tryorder if DISPLAY is set. Also, included skipstone support, as suggested by Fred in the mentioned bug. * Misc/NEWS Mention fix and skipstone inclusion. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.541 retrieving revision 1.542 diff -C2 -d -r1.541 -r1.542 *** NEWS 23 Nov 2002 22:08:15 -0000 1.541 --- NEWS 25 Nov 2002 17:25:01 -0000 1.542 *************** *** 629,632 **** --- 629,636 ---- the "%verifyscript" section of the rpm spec file. + - Fixed bug #495695: webbrowser module would run graphic browsers in a + unix environment even if DISPLAY was not set. Also, support for + skipstone browser was included. + Tools/Demos ----------- From doerwalter@users.sourceforge.net Mon Nov 25 17:58:05 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 25 Nov 2002 09:58:05 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_codeccallbacks.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv27326/Lib/test Modified Files: test_codeccallbacks.py Log Message: Fix typo in comment. Index: test_codeccallbacks.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codeccallbacks.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_codeccallbacks.py 23 Nov 2002 19:41:01 -0000 1.4 --- test_codeccallbacks.py 25 Nov 2002 17:58:02 -0000 1.5 *************** *** 52,56 **** def test_uninamereplace(self): # We're using the names from the unicode database this time, ! # and we're doing "systax highlighting" here, i.e. we include # the replaced text in ANSI escape sequences. For this it is # useful that the error handler is not called for every single --- 52,56 ---- def test_uninamereplace(self): # We're using the names from the unicode database this time, ! # and we're doing "syntax highlighting" here, i.e. we include # the replaced text in ANSI escape sequences. For this it is # useful that the error handler is not called for every single From niemeyer@users.sourceforge.net Mon Nov 25 18:51:46 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Mon, 25 Nov 2002 10:51:46 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libbz2.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30334 Modified Files: libbz2.tex Log Message: * libbz2.tex Fixed minor typo, suggested by Drew Perttula . Index: libbz2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbz2.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** libbz2.tex 15 Nov 2002 16:38:06 -0000 1.4 --- libbz2.tex 25 Nov 2002 18:51:43 -0000 1.5 *************** *** 46,50 **** \code{0} means unbuffered, and larger numbers specify the buffer size; the default is \code{0}. If ! \var{compresslevel} is given, must be a number between \code{1} and \code{9}; the default is \code{9}. Add a \character{U} to mode to open the file for input with universal newline --- 46,50 ---- \code{0} means unbuffered, and larger numbers specify the buffer size; the default is \code{0}. If ! \var{compresslevel} is given, it must be a number between \code{1} and \code{9}; the default is \code{9}. Add a \character{U} to mode to open the file for input with universal newline From theller@users.sourceforge.net Mon Nov 25 20:22:02 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Mon, 25 Nov 2002 12:22:02 -0800 Subject: [Python-checkins] python/dist/src/Tools/freeze modulefinder.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/freeze In directory sc8-pr-cvs1:/tmp/cvs-serv10952 Modified Files: modulefinder.py Log Message: Add a note that this file should be kept compatible with Python 1.5.2, per PEP 291 (although there are currently string methods used). This patch makes it compatible with 2.2, at least, by detecting universal newline support. Index: modulefinder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/modulefinder.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** modulefinder.py 14 Nov 2002 18:45:11 -0000 1.23 --- modulefinder.py 25 Nov 2002 20:21:59 -0000 1.24 *************** *** 1,4 **** --- 1,6 ---- """Find modules used by a script, using introspection.""" + # This module should be kept compatible with Python 1.5.2, see PEP 291. + import dis import imp *************** *** 128,132 **** def run_script(self, pathname): self.msg(2, "run_script", pathname) ! fp = open(pathname, "U") stuff = ("", "r", imp.PY_SOURCE) self.load_module('__main__', fp, pathname, stuff) --- 130,137 ---- def run_script(self, pathname): self.msg(2, "run_script", pathname) ! if hasattr(sys.stdout, "newlines"): # detect universal newline support ! fp = open(pathname, "U") ! else: ! fp = open(pathname, "r") stuff = ("", "r", imp.PY_SOURCE) self.load_module('__main__', fp, pathname, stuff) *************** *** 135,139 **** dir, name = os.path.split(pathname) name, ext = os.path.splitext(name) ! fp = open(pathname, "U") stuff = (ext, "r", imp.PY_SOURCE) self.load_module(name, fp, pathname, stuff) --- 140,147 ---- dir, name = os.path.split(pathname) name, ext = os.path.splitext(name) ! if hasattr(sys.stdout, "newlines"): ! fp = open(pathname, "U") ! else: ! fp = open(pathname, "r") stuff = (ext, "r", imp.PY_SOURCE) self.load_module(name, fp, pathname, stuff) From rhettinger@users.sourceforge.net Mon Nov 25 20:43:57 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 25 Nov 2002 12:43:57 -0800 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv21003 Modified Files: sets.py Log Message: SF 643115: Set._update() had a special case for dictionaries which allowed non-true values to leak in. This threw-off equality testing which depends on the underlying dictionaries having both the same keys and values. Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** sets.py 13 Nov 2002 19:34:25 -0000 1.35 --- sets.py 25 Nov 2002 20:43:54 -0000 1.36 *************** *** 316,322 **** data.update(iterable._data) return - if isinstance(iterable, dict): - data.update(iterable) - return value = True --- 316,319 ---- From rhettinger@users.sourceforge.net Mon Nov 25 20:43:58 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 25 Nov 2002 12:43:58 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_sets.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv21003/test Modified Files: test_sets.py Log Message: SF 643115: Set._update() had a special case for dictionaries which allowed non-true values to leak in. This threw-off equality testing which depends on the underlying dictionaries having both the same keys and values. Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_sets.py 13 Nov 2002 22:00:02 -0000 1.17 --- test_sets.py 25 Nov 2002 20:43:55 -0000 1.18 *************** *** 180,183 **** --- 180,186 ---- self.set = Set((2, 4, 6)) + def test_eq(self): # SF bug 643115 + self.assertEqual(self.set, Set({2:1,4:3,6:5})) + def test_union_subset(self): result = self.set | Set([2]) From tim_one@users.sourceforge.net Mon Nov 25 21:09:11 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 25 Nov 2002 13:09:11 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.py,1.64,1.65 test_datetime.py,1.45,1.46 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv2016 Modified Files: datetime.py test_datetime.py Log Message: SF patch 641958: time and timetz for the datetime module, from Marius Gedminas. This is subject to change, as the design is still being discussed on the wiki: http://www.zope.org/Members/fdrake/DateTimeWiki/TimeType Index: datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.py,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** datetime.py 22 Nov 2002 03:34:42 -0000 1.64 --- datetime.py 25 Nov 2002 21:09:05 -0000 1.65 *************** *** 694,697 **** --- 694,1000 ---- + class time(object): + """Concrete time type. + + Constructors: + + __init__() + + Operators: + + __repr__, __str__ + __cmp__, __hash__ + + Methods: + + strftime() + isoformat() + + Properties (readonly): + hour, minute, second, microsecond + """ + + def __init__(self, hour, minute, second=0, microsecond=0): + """Constructor. + + Arguments: + + hour, minute (required) + second, microsecond (default to zero) + """ + if not 0 <= hour <= 23: + raise ValueError('hour must be in 0..23', hour) + if not 0 <= minute <= 59: + raise ValueError('minute must be in 0..59', minute) + if not 0 <= second <= 59: + raise ValueError('second must be in 0..59', second) + if not 0 <= microsecond <= 999999: + raise ValueError('microsecond must be in 0..999999', microsecond) + self.__hour = hour + self.__minute = minute + self.__second = second + self.__microsecond = microsecond + + # Read-only field accessors + hour = property(lambda self: self.__hour, doc="hour (0-23)") + minute = property(lambda self: self.__minute, doc="minute (0-59)") + second = property(lambda self: self.__second, doc="second (0-59)") + microsecond = property(lambda self: self.__microsecond, + doc="microsecond (0-999999)") + + # Standard conversions, __cmp__, __hash__ (and helpers) + + def __cmp__(self, other): + """Three-way comparison.""" + if isinstance(other, time): + return cmp((self.__hour, self.__minute, self.__second, + self.__microsecond), + (other.__hour, other.__minute, other.__second, + other.__microsecond)) + raise TypeError, ("can't compare time to %s instance" % + type(other).__name__) + + def __hash__(self): + """Hash.""" + return hash((self.__hour, self.__minute, self.__second, + self.__microsecond)) + + # Conversions to string + + def __repr__(self): + """Convert to formal string, for repr().""" + if self.__microsecond != 0: + s = ", %d, %d" % (self.__second, self.__microsecond) + elif self.__second != 0: + s = ", %d" % self.__second + else: + s = "" + return "%s(%d, %d%s)" % (self.__class__.__name__, + self.__hour, self.__minute, s) + + def __str__(self): + """Convert to pretty string, for str().""" + pretty = "%d:%02d:%02d.%06d" % ( + self.__hour, self.__minute, self.__second, + self.__microsecond) + # trim microseconds: hh:mm:ss.xxx000 -> hh:mm:ss.xxx + while pretty.endswith('0'): + pretty = pretty[:-1] + # trim microseconds: hh:mm:ss.000000 -> hh:mm:ss + if pretty.endswith('.'): + pretty = pretty[:-1] + # trim seconds: hh:mm:00 -> hh:mm + if pretty.endswith(':00'): + pretty = pretty[:-3] + return pretty + + def isoformat(self): + """Return the time formatted according to ISO. + + This is 'HH:MM:SS.mmmmmm'. + """ + return "%02d:%02d:%02d.%06d" % ( + self.__hour, self.__minute, self.__second, + self.__microsecond) + + def strftime(self, fmt): + """Format using strftime(). The date part of the timestamp passed + to underlying strftime should not be used. + """ + return _time.strftime(fmt, (0, 0, 0, self.__hour, self.__minute, + self.__second, 0, 0, -1)) + + + time.min = time(0, 0, 0) + time.max = time(23, 59, 59, 999999) + time.resolution = timedelta(microseconds=1) + + + class timetz(time): + """Time with time zone. + + Constructors: + + __init__() + + Operators: + + __repr__, __str__ + __cmp__, __hash__ + + Methods: + + strftime() + isoformat() + utcoffset() + tzname() + dst() + + Properties (readonly): + hour, minute, second, microsecond, tzinfo + """ + + def __init__(self, hour, minute, second=0, microsecond=0, tzinfo=None): + """Constructor. + + Arguments: + + hour, minute (required) + second, microsecond (default to zero) + tzinfo (default to None) + """ + super(timetz, self).__init__(hour, minute, second, microsecond) + if tzinfo is not None: + # Better fail now than later + assert hasattr(tzinfo, 'utcoffset') + assert hasattr(tzinfo, 'dst') + assert hasattr(tzinfo, 'tzname') + self.__tzinfo = tzinfo + + # Read-only field accessors + tzinfo = property(lambda self: self.__tzinfo, doc="timezone info object") + + # Standard conversions, __cmp__, __hash__ (and helpers) + + def __cmp__(self, other): + """Three-way comparison.""" + if not isinstance(other, time): + raise TypeError("can't compare timetz to %s instance" % + type(other).__name__) + superself = super(timetz, self) + supercmp = superself.__cmp__ + mytz = self.__tzinfo + ottz = None + if isinstance(other, timetz): + ottz = other.__tzinfo + if mytz is ottz: + return supercmp(other) + myoff = otoff = None + if mytz is not None: + myoff = mytz.utcoffset(self) + if ottz is not None: + otoff = ottz.utcoffset(other) + if myoff == otoff: + return supercmp(other) + if myoff is None or otoff is None: + raise ValueError, "cannot mix naive and timezone-aware time" + myhhmm = self.hour * 60 + self.minute - myoff + othhmm = other.hour * 60 + other.minute - otoff + return cmp((myhhmm, self.second, self.microsecond), + (othhmm, other.second, other.microsecond)) + + def __hash__(self): + """Hash.""" + tz = self.__tzinfo + if tz == None: + return super(timetz, self).__hash__() + tzoff = tz.utcoffset(self) + if not tzoff: # zero or None! + return super(timetz, self).__hash__() + h, m = divmod(self.hour * 60 + self.minute - tzoff, 60) + # Unfortunately it is not possible to construct a new timetz object + # and use super().__hash__(), since hour may exceed the range of + # allowed values + return hash((h, m, self.second, self.microsecond)) + + # Conversion to string + + def _tzstr(self, sep=":"): + """Return formatted timezone offset (+xx:xx) or None.""" + if self.__tzinfo is not None: + off = self.__tzinfo.utcoffset(self) + if off is not None: + if off < 0: + sign = "-" + off = -off + else: + sign = "+" + hh, mm = divmod(off, 60) + return "%s%02d%s%02d" % (sign, hh, sep, mm) + + def __repr__(self): + """Convert to formal string, for repr().""" + s = super(timetz, self).__repr__() + if self.__tzinfo is not None: + assert s[-1:] == ")" + s = s[:-1] + ", tzinfo=%r" % self.__tzinfo + ")" + return s + + def __str__(self): + """Convert to pretty string, for str().""" + s = super(timetz, self).__str__() + tz = self._tzstr() + if tz: s = "%s %s" % (s, tz) + return s + + def isoformat(self): + """Return the time formatted according to ISO. + + This is 'HH:MM:SS.mmmmmm+zz:zz'. + """ + s = super(timetz, self).isoformat() + tz = self._tzstr() + if tz: s += tz + return s + + def strftime(self, fmt): + """Format using strftime(). The date part of the timestamp passed + to underlying strftime should not be used. + + You can use %Z to refer to the timezone name and %z to refer to its + UTC offset (+zzzz). + """ + tz = self._tzstr(sep="") + if tz: + fmt = fmt.replace("%z", tz).replace("%Z", self.tzinfo.tzname(None)) + else: + fmt = fmt.replace("%z", "").replace("%Z", "") + return super(timetz, self).strftime(fmt) + + # Timezone functions + + def utcoffset(self): + """Return the timezone offset in minutes east of UTC (negative west of + UTC).""" + tz = self.__tzinfo + if tz is None: + return None + else: + return tz.utcoffset(self) + + def tzname(self): + """Return the timezone name. + + Note that the name is 100% informational -- there's no requirement that + it mean anything in particular. For example, "GMT", "UTC", "-500", + "-5:00", "EDT", "US/Eastern", "America/New York" are all valid replies. + """ + tz = self.__tzinfo + if tz is None: + return None + else: + return tz.tzname(self) + + def dst(self): + """Return 0 if DST is not in effect, or the DST offset (in minutes + eastward) if DST is in effect. + + This is purely informational; the DST offset has already been added to + the UTC offset returned by utcoffset() if applicable, so there's no + need to consult dst() unless you're interested in displaying the DST + info. + """ + tz = self.__tzinfo + if tz is None: + return None + else: + return tz.dst(self) + + + timetz.min = timetz(0, 0, 0) + timetz.max = timetz(23, 59, 59, 999999) + timetz.resolution = timedelta(microseconds=1) + + class datetime(date): """Concrete date/time type, inheriting from date. *************** *** 778,781 **** --- 1081,1090 ---- utcnow = classmethod(utcnow) + def combine(cls, date, time): + "Construct a datetime from a given date and a given time." + return cls(date.year, date.month, date.day, + time.hour, time.minute, time.second, time.microsecond) + combine = classmethod(combine) + # Conversions to string *************** *** 808,811 **** --- 1117,1129 ---- self.weekday(), self._yday(), -1) + def date(self): + "Return the date part." + return date(self.__year, self.__month, self.__day) + + def time(self): + "Return the time part." + return time(self.__hour, self.__minute, self.__second, + self.__microsecond) + def __cmp__(self, other): "Three-way comparison." *************** *** 942,945 **** --- 1260,1271 ---- now = classmethod(now) + def combine(cls, date, time): + "Construct a datetime from a given date and a given time." + return cls(date.year, date.month, date.day, + time.hour, time.minute, time.second, time.microsecond, + getattr(time, 'tzinfo', None)) + combine = classmethod(combine) + + def utctimetuple(self): "Return UTC time tuple compatible with time.gmtime()." *************** *** 952,955 **** --- 1278,1286 ---- dt = timedelta(minutes=offset) return (ts - dt).timetuple() + + def timetz(self): + "Return the time part." + return timetz(self.hour, self.minute, self.second, self.microsecond, + self.__tzinfo) def isoformat(self, sep=' '): Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_datetime.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** test_datetime.py 20 Nov 2002 03:29:43 -0000 1.45 --- test_datetime.py 25 Nov 2002 21:09:06 -0000 1.46 *************** *** 7,11 **** import unittest ! from datetime import date, datetime, datetimetz, timedelta, MINYEAR, MAXYEAR --- 7,12 ---- import unittest ! from datetime import date, time, timetz, datetime, datetimetz, timedelta, \ ! MINYEAR, MAXYEAR *************** *** 327,330 **** --- 328,490 ---- self.assertEqual(t, (1956, 3, 1+i, 0, 0, 0, (3+i)%7, 61+i, -1)) + + class TestTime(unittest.TestCase): + + theclass = time + + def test_basic_attributes(self): + t = self.theclass(12, 0) + self.assertEqual(t.hour, 12) + self.assertEqual(t.minute, 0) + self.assertEqual(t.second, 0) + self.assertEqual(t.microsecond, 0) + + def test_basic_attributes_nonzero(self): + # Make sure all attributes are non-zero so bugs in + # bit-shifting access show up. + t = self.theclass(12, 59, 59, 8000) + self.assertEqual(t.hour, 12) + self.assertEqual(t.minute, 59) + self.assertEqual(t.second, 59) + self.assertEqual(t.microsecond, 8000) + + def test_roundtrip(self): + for t in (self.theclass(1, 2, 3, 4),): + # Verify t -> string -> time identity. + s = repr(t) + t2 = eval(s) + self.assertEqual(t, t2) + + # Verify identity via reconstructing from pieces. + t2 = self.theclass(t.hour, t.minute, t.second, + t.microsecond) + self.assertEqual(t, t2) + + def test_comparing(self): + t1 = self.theclass(9, 0, 0) + t2 = self.theclass(10, 0, 0) + t3 = self.theclass(9, 0, 0) + self.assertEqual(t1, t3) + self.assert_(t2 > t3) + + def test_bad_constructor_arguments(self): + # bad hours + self.theclass(0, 0) # no exception + self.theclass(23, 0) # no exception + self.assertRaises(ValueError, self.theclass, -1, 0) + self.assertRaises(ValueError, self.theclass, 24, 0) + # bad minutes + self.theclass(23, 0) # no exception + self.theclass(23, 59) # no exception + self.assertRaises(ValueError, self.theclass, 23, -1) + self.assertRaises(ValueError, self.theclass, 23, 60) + # bad seconds + self.theclass(23, 59, 0) # no exception + self.theclass(23, 59, 59) # no exception + self.assertRaises(ValueError, self.theclass, 23, 59, -1) + self.assertRaises(ValueError, self.theclass, 23, 59, 60) + # bad microseconds + self.theclass(23, 59, 59, 0) # no exception + self.theclass(23, 59, 59, 999999) # no exception + self.assertRaises(ValueError, self.theclass, 23, 59, 59, -1) + self.assertRaises(ValueError, self.theclass, 23, 59, 59, 1000000) + + def test_hash_equality(self): + d = self.theclass(23, 30, 17) + e = self.theclass(23, 30, 17) + self.assertEqual(d, e) + self.assertEqual(hash(d), hash(e)) + + dic = {d: 1} + dic[e] = 2 + self.assertEqual(len(dic), 1) + self.assertEqual(dic[d], 2) + self.assertEqual(dic[e], 2) + + d = self.theclass(0, 5, 17) + e = self.theclass(0, 5, 17) + self.assertEqual(d, e) + self.assertEqual(hash(d), hash(e)) + + dic = {d: 1} + dic[e] = 2 + self.assertEqual(len(dic), 1) + self.assertEqual(dic[d], 2) + self.assertEqual(dic[e], 2) + + def test_isoformat(self): + t = self.theclass(4, 5, 1, 123) + self.assertEqual(t.isoformat(), "04:05:01.000123") + + def test_strftime(self): + t = self.theclass(1, 2, 3, 4) + self.assertEqual(t.strftime('%H %M %S'), "01 02 03") + + def test_str(self): + self.assertEqual(str(self.theclass(1, 2, 3, 4)), "1:02:03.000004") + self.assertEqual(str(self.theclass(10, 2, 3, 4000)), "10:02:03.004") + self.assertEqual(str(self.theclass(0, 2, 3, 400000)), "0:02:03.4") + self.assertEqual(str(self.theclass(12, 2, 3, 0)), "12:02:03") + self.assertEqual(str(self.theclass(23, 15, 0, 0)), "23:15") + + def test_repr(self): + self.assertEqual(repr(self.theclass(1, 2, 3, 4)), + "%s(1, 2, 3, 4)" % self.theclass.__name__) + self.assertEqual(repr(self.theclass(10, 2, 3, 4000)), + "%s(10, 2, 3, 4000)" % self.theclass.__name__) + self.assertEqual(repr(self.theclass(0, 2, 3, 400000)), + "%s(0, 2, 3, 400000)" % self.theclass.__name__) + self.assertEqual(repr(self.theclass(12, 2, 3, 0)), + "%s(12, 2, 3)" % self.theclass.__name__) + self.assertEqual(repr(self.theclass(23, 15, 0, 0)), + "%s(23, 15)" % self.theclass.__name__) + + def test_resolution_info(self): + self.assert_(isinstance(self.theclass.min, self.theclass)) + self.assert_(isinstance(self.theclass.max, self.theclass)) + self.assert_(isinstance(self.theclass.resolution, timedelta)) + self.assert_(self.theclass.max > self.theclass.min) + + + class TestTimeTZ(TestTime): + + theclass = timetz + + def test_zones(self): + est = FixedOffset(-300, "EST") + utc = FixedOffset(0, "UTC") + met = FixedOffset(60, "MET") + t1 = timetz( 7, 47, tzinfo=est) + t2 = timetz(12, 47, tzinfo=utc) + t3 = timetz(13, 47, tzinfo=met) + self.assertEqual(t1.tzinfo, est) + self.assertEqual(t2.tzinfo, utc) + self.assertEqual(t3.tzinfo, met) + self.assertEqual(t1.utcoffset(), -300) + self.assertEqual(t2.utcoffset(), 0) + self.assertEqual(t3.utcoffset(), 60) + self.assertEqual(t1.tzname(), "EST") + self.assertEqual(t2.tzname(), "UTC") + self.assertEqual(t3.tzname(), "MET") + self.assertEqual(hash(t1), hash(t2)) + self.assertEqual(hash(t1), hash(t3)) + self.assertEqual(hash(t2), hash(t3)) + self.assertEqual(t1, t2) + self.assertEqual(t1, t3) + self.assertEqual(t2, t3) + self.assertEqual(str(t1), "7:47 -05:00") + self.assertEqual(str(t2), "12:47 +00:00") + self.assertEqual(str(t3), "13:47 +01:00") + self.assertEqual(repr(t1), "timetz(7, 47, tzinfo=est)") + self.assertEqual(repr(t2), "timetz(12, 47, tzinfo=utc)") + self.assertEqual(repr(t3), "timetz(13, 47, tzinfo=met)") + self.assertEqual(t1.isoformat(), "07:47:00.000000-05:00") + self.assertEqual(t2.isoformat(), "12:47:00.000000+00:00") + self.assertEqual(t3.isoformat(), "13:47:00.000000+01:00") + self.assertEqual(t1.strftime("%H:%M:%S %Z %z"), "07:47:00 EST -0500") + self.assertEqual(t2.strftime("%H:%M:%S %Z %z"), "12:47:00 UTC +0000") + self.assertEqual(t3.strftime("%H:%M:%S %Z %z"), "13:47:00 MET +0100") + + class TestDateTime(TestDate): *************** *** 531,534 **** --- 691,705 ---- self.assertEqual(t.ctime(), "Sat Mar 2 18:03:05 2002") + def test_combine(self): + d = date(2002, 3, 4) + t = time(18, 45, 3, 1234) + dt = datetime.combine(d, t) + self.assertEqual(dt, datetime(2002, 3, 4, 18, 45, 3, 1234)) + + def test_extract(self): + dt = self.theclass(2002, 3, 4, 18, 45, 3, 1234) + self.assertEqual(dt.date(), date(2002, 3, 4)) + self.assertEqual(dt.time(), time(18, 45, 3, 1234)) + class FixedOffset(object): *************** *** 582,592 **** "datetimetz(2002, 3, 19, 13, 47, tzinfo=met)") def test_suite(): s1 = unittest.makeSuite(TestTimeDelta, 'test') s2 = unittest.makeSuite(TestDate, 'test') ! s3 = unittest.makeSuite(TestDateTime, 'test') ! s4 = unittest.makeSuite(TestDateTimeTZ, 'test') ! return unittest.TestSuite([s1, s2, s3, s4]) def test_main(): --- 753,780 ---- "datetimetz(2002, 3, 19, 13, 47, tzinfo=met)") + def test_combine(self): + met = FixedOffset(60, "MET") + d = date(2002, 3, 4) + tz = timetz(18, 45, 3, 1234, tzinfo=met) + dt = datetimetz.combine(d, tz) + self.assertEqual(dt, datetimetz(2002, 3, 4, 18, 45, 3, 1234, + tzinfo=met)) + + def test_extract(self): + met = FixedOffset(60, "MET") + dt = self.theclass(2002, 3, 4, 18, 45, 3, 1234, tzinfo=met) + self.assertEqual(dt.date(), date(2002, 3, 4)) + self.assertEqual(dt.time(), time(18, 45, 3, 1234)) + self.assertEqual(dt.timetz(), timetz(18, 45, 3, 1234, tzinfo=met)) + def test_suite(): s1 = unittest.makeSuite(TestTimeDelta, 'test') s2 = unittest.makeSuite(TestDate, 'test') ! s3 = unittest.makeSuite(TestTime, 'test') ! s4 = unittest.makeSuite(TestTimeTZ, 'test') ! s5 = unittest.makeSuite(TestDateTime, 'test') ! s6 = unittest.makeSuite(TestDateTimeTZ, 'test') ! return unittest.TestSuite([s1, s2, s3, s4, s5, s6]) def test_main(): From tim_one@users.sourceforge.net Mon Nov 25 21:13:18 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 25 Nov 2002 13:13:18 -0800 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.217,1.218 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv5096/python/Misc Modified Files: ACKS Log Message: Added Marius Gedminas, for contributions to the datetime code. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.217 retrieving revision 1.218 diff -C2 -d -r1.217 -r1.218 *** ACKS 22 Nov 2002 08:36:54 -0000 1.217 --- ACKS 25 Nov 2002 21:13:13 -0000 1.218 *************** *** 183,186 **** --- 183,187 ---- Lars Marius Garshol Harry Henry Gebel + Marius Gedminas Thomas Gellekum Christos Georgiou From gvanrossum@users.sourceforge.net Mon Nov 25 21:37:01 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 25 Nov 2002 13:37:01 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.187,2.188 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv17929 Modified Files: typeobject.c Log Message: A tweaked version of Jeremy's patch #642489, to produce better error messages about MRO conflicts. (The tweaks include correcting spelling errors, some refactoring to get the name of classic classes, and a style nit or two.) Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.187 retrieving revision 2.188 diff -C2 -d -r2.187 -r2.188 *** typeobject.c 14 Nov 2002 23:22:33 -0000 2.187 --- typeobject.c 25 Nov 2002 21:36:54 -0000 2.188 *************** *** 662,665 **** --- 662,684 ---- (OOPSLA 1996) + Some notes about the rules implied by C3: + + No duplicate bases. + It isn't legal to repeat a class in a list of base classes. + + The next three properties are the 3 constraints in "C3". + + Local precendece order. + If A precedes B in C's MRO, then A will precede B in the MRO of all + subclasses of C. + + Monotonicity. + The MRO of a class must be an extension without reordering of the + MRO of each of its superclasses. + + Extended Precedence Graph (EPG). + Linearization is consistent if there is a path in the EPG from + each class to all its successors in the linearization. See + the paper for definition of EPG. */ *************** *** 676,679 **** --- 695,784 ---- } + static PyObject * + class_name(PyObject *cls) + { + PyObject *name = PyObject_GetAttrString(cls, "__name__"); + if (name == NULL) { + PyErr_Clear(); + Py_XDECREF(name); + name = PyObject_Repr(cls); + } + if (name == NULL) + return NULL; + if (!PyString_Check(name)) { + Py_DECREF(name); + return NULL; + } + return name; + } + + static int + check_duplicates(PyObject *list) + { + int i, j, n; + /* Let's use a quadratic time algorithm, + assuming that the bases lists is short. + */ + n = PyList_GET_SIZE(list); + for (i = 0; i < n; i++) { + PyObject *o = PyList_GET_ITEM(list, i); + for (j = i + 1; j < n; j++) { + if (PyList_GET_ITEM(list, j) == o) { + o = class_name(o); + PyErr_Format(PyExc_TypeError, + "duplicate base class %s", + o ? PyString_AS_STRING(o) : "?"); + Py_XDECREF(o); + return -1; + } + } + } + return 0; + } + + /* Raise a TypeError for an MRO order disagreement. + + It's hard to produce a good error message. In the absence of better + insight into error reporting, report the classes that were candidates + to be put next into the MRO. There is some conflict between the + order in which they should be put in the MRO, but it's hard to + diagnose what constraint can't be satisfied. + */ + + static void + set_mro_error(PyObject *to_merge, int *remain) + { + int i, n, off, to_merge_size; + char buf[1000]; + PyObject *k, *v; + PyObject *set = PyDict_New(); + + to_merge_size = PyList_GET_SIZE(to_merge); + for (i = 0; i < to_merge_size; i++) { + PyObject *L = PyList_GET_ITEM(to_merge, i); + if (remain[i] < PyList_GET_SIZE(L)) { + PyObject *c = PyList_GET_ITEM(L, remain[i]); + if (PyDict_SetItem(set, c, Py_None) < 0) + return; + } + } + n = PyDict_Size(set); + + off = PyOS_snprintf(buf, sizeof(buf), "MRO conflict among bases"); + i = 0; + while (PyDict_Next(set, &i, &k, &v) && off < sizeof(buf)) { + PyObject *name = class_name(k); + off += PyOS_snprintf(buf + off, sizeof(buf) - off, " %s", + name ? PyString_AS_STRING(name) : "?"); + Py_XDECREF(name); + if (--n && off+1 < sizeof(buf)) { + buf[off++] = ','; + buf[off] = '\0'; + } + } + PyErr_SetString(PyExc_TypeError, buf); + Py_DECREF(set); + } + static int pmerge(PyObject *acc, PyObject* to_merge) { *************** *** 684,687 **** --- 789,796 ---- to_merge_size = PyList_GET_SIZE(to_merge); + /* remain stores an index into each sublist of to_merge. + remain[i] is the index of the next base in to_merge[i] + that is not included in acc. + */ remain = PyMem_MALLOC(SIZEOF_INT*to_merge_size); if (remain == NULL) *************** *** 702,710 **** } candidate = PyList_GET_ITEM(cur_list, remain[i]); for (j = 0; j < to_merge_size; j++) { PyObject *j_lst = PyList_GET_ITEM(to_merge, j); ! if (tail_contains(j_lst, remain[j], candidate)) goto skip; /* continue outer loop */ } ok = PyList_Append(acc, candidate); --- 811,827 ---- } + /* Choose next candidate for MRO. + + The input sequences alone can determine the choice. + If not, choose the class which appears in the MRO + of the earliest direct superclass of the new class. + */ + candidate = PyList_GET_ITEM(cur_list, remain[i]); for (j = 0; j < to_merge_size; j++) { PyObject *j_lst = PyList_GET_ITEM(to_merge, j); ! if (tail_contains(j_lst, remain[j], candidate)) { goto skip; /* continue outer loop */ + } } ok = PyList_Append(acc, candidate); *************** *** 723,730 **** } ! PyMem_FREE(remain); ! if (empty_cnt == to_merge_size) return 0; ! PyErr_SetString(PyExc_TypeError, "MRO order disagreement"); return -1; } --- 840,849 ---- } ! if (empty_cnt == to_merge_size) { ! PyMem_FREE(remain); return 0; ! } ! set_mro_error(to_merge, remain); ! PyMem_FREE(remain); return -1; } *************** *** 742,745 **** --- 861,873 ---- } + /* Find a superclass linearization that honors the constraints + of the explicit lists of bases and the constraints implied by + each base class. + + to_merge is a list of lists, where each list is a superclass + linearization implied by a base class. The last element of + to_merge is the declared list of bases. + */ + bases = type->tp_bases; n = PyTuple_GET_SIZE(bases); *************** *** 768,771 **** --- 896,905 ---- if (bases_aslist == NULL) { Py_DECREF(to_merge); + return NULL; + } + /* This is just a basic sanity check. */ + if (check_duplicates(bases_aslist) < 0) { + Py_DECREF(to_merge); + Py_DECREF(bases_aslist); return NULL; } From gvanrossum@users.sourceforge.net Mon Nov 25 21:39:08 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 25 Nov 2002 13:39:08 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.161,1.162 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv18947 Modified Files: test_descr.py Log Message: A tweaked version of Jeremy's patch #642489, to produce better error messages about MRO conflicts. (Tweaks here: don't print the message, but compare it with an expected string.) Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -d -r1.161 -r1.162 *** test_descr.py 23 Nov 2002 16:57:00 -0000 1.161 --- test_descr.py 25 Nov 2002 21:38:52 -0000 1.162 *************** *** 1055,1058 **** --- 1055,1088 ---- Pane, ScrollingMixin, EditingMixin, object)) + def mro_disagreement(): + if verbose: print "Testing error messages for MRO disagreement..." + def raises(exc, expected, callable, *args): + try: + callable(*args) + except exc, msg: + if str(msg) != expected: + raise TestFailed, "Message %r, expected %r" % (str(msg), + expected) + else: + raise TestFailed, "Expected %s" % exc + class A(object): pass + class B(A): pass + class C(object): pass + # Test some very simple errors + raises(TypeError, "duplicate base class A", + type, "X", (A, A), {}) + raises(TypeError, "MRO conflict among bases B, A", + type, "X", (A, B), {}) + raises(TypeError, "MRO conflict among bases C, B, A", + type, "X", (A, C, B), {}) + # Test a slightly more complex error + class GridLayout(object): pass + class HorizontalGrid(GridLayout): pass + class VerticalGrid(GridLayout): pass + class HVGrid(HorizontalGrid, VerticalGrid): pass + class VHGrid(VerticalGrid, HorizontalGrid): pass + raises(TypeError, "MRO conflict among bases VerticalGrid, HorizontalGrid", + type, "ConfusedGrid", (HVGrid, VHGrid), {}) + def objects(): if verbose: print "Testing object class..." *************** *** 3423,3426 **** --- 3453,3457 ---- pymods() multi() + mro_disagreement() diamond() ex5() From jvr@users.sourceforge.net Tue Nov 26 00:34:54 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Mon, 25 Nov 2002 16:34:54 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib bundlebuilder.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv10039 Modified Files: bundlebuilder.py Log Message: added support for building standalone applications - requires modulefinder.py to be on sys.path - does *not* work for Python.framework (yet), only for static builds Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/bundlebuilder.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** bundlebuilder.py 24 Nov 2002 01:23:45 -0000 1.8 --- bundlebuilder.py 26 Nov 2002 00:34:52 -0000 1.9 *************** *** 25,39 **** """ - # - # XXX Todo: - # - modulefinder support to build standalone apps - # - consider turning this into a distutils extension - # ! __all__ = ["BundleBuilder", "AppBuilder", "buildapp"] import sys import os, errno, shutil from copy import deepcopy import getopt --- 25,36 ---- """ ! __all__ = ["BundleBuilder", "BundleBuilderError", "AppBuilder", "buildapp"] import sys import os, errno, shutil + import imp, marshal + import re from copy import deepcopy import getopt *************** *** 42,45 **** --- 39,45 ---- + class BundleBuilderError(Exception): pass + + class Defaults: *************** *** 177,180 **** --- 177,181 ---- self.message("Copying files", 1) msg = "Copying" + files.sort() for src, dst in files: if os.path.isdir(src): *************** *** 201,205 **** ! mainWrapperTemplate = """\ #!/usr/bin/env python --- 202,241 ---- ! ! if __debug__: ! PYC_EXT = ".pyc" ! else: ! PYC_EXT = ".pyo" ! ! MAGIC = imp.get_magic() ! USE_FROZEN = hasattr(imp, "set_frozenmodules") ! ! # For standalone apps, we have our own minimal site.py. We don't need ! # all the cruft of the real site.py. ! SITE_PY = """\ ! import sys ! del sys.path[1:] # sys.path[0] is Contents/Resources/ ! """ ! ! if USE_FROZEN: ! FROZEN_ARCHIVE = "FrozenModules.marshal" ! SITE_PY += """\ ! # bootstrapping ! import imp, marshal ! f = open(sys.path[0] + "/%s", "rb") ! imp.set_frozenmodules(marshal.load(f)) ! f.close() ! """ % FROZEN_ARCHIVE ! ! SITE_CO = compile(SITE_PY, "<-bundlebuilder->", "exec") ! ! MAYMISS_MODULES = ['mac', 'os2', 'nt', 'ntpath', 'dos', 'dospath', ! 'win32api', 'ce', '_winreg', 'nturl2path', 'sitecustomize', ! 'org.python.core', 'riscos', 'riscosenviron', 'riscospath' ! ] ! ! STRIP_EXEC = "/usr/bin/strip" ! ! EXECVE_WRAPPER = """\ #!/usr/bin/env python *************** *** 212,216 **** argv.insert(1, mainprogram) os.environ["PYTHONPATH"] = resources - %(setpythonhome)s %(setexecutable)s os.execve(executable, argv, os.environ) --- 248,251 ---- *************** *** 220,223 **** --- 255,259 ---- pythonhomeSnippet = """os.environ["home"] = resources""" + class AppBuilder(BundleBuilder): *************** *** 240,246 **** symlink_exec = 0 def setup(self): if self.mainprogram is None and self.executable is None: ! raise TypeError, ("must specify either or both of " "'executable' and 'mainprogram'") --- 276,314 ---- symlink_exec = 0 + # If True, build standalone app. + standalone = 0 + + # The following attributes are only used when building a standalone app. + + # Exclude these modules. + excludeModules = [] + + # Include these modules. + includeModules = [] + + # Include these packages. + includePackages = [] + + # Strip binaries. + strip = 0 + + # Found C extension modules: [(name, path), ...] + extensions = [] + + # Found Python modules: [(name, codeobject, ispkg), ...] + pymodules = [] + + # Modules that modulefinder couldn't find: + missingModules = [] + + # List of all binaries (executables or shared libs), for stripping purposes + binaries = [] + def setup(self): + if self.standalone and self.mainprogram is None: + raise BundleBuilderError, ("must specify 'mainprogram' when " + "building a standalone application.") if self.mainprogram is None and self.executable is None: ! raise BundleBuilderError, ("must specify either or both of " "'executable' and 'mainprogram'") *************** *** 263,268 **** self.plist.CFBundleExecutable = self.name def preProcess(self): ! resdir = pathjoin("Contents", "Resources") if self.executable is not None: if self.mainprogram is None: --- 331,341 ---- self.plist.CFBundleExecutable = self.name + if self.standalone: + if self.executable is None: # *assert* that it is None? + self.executable = sys.executable + self.findDependencies() + def preProcess(self): ! resdir = "Contents/Resources" if self.executable is not None: if self.mainprogram is None: *************** *** 272,275 **** --- 345,349 ---- if not self.symlink_exec: self.files.append((self.executable, execpath)) + self.binaries.append(execpath) self.execpath = execpath # For execve wrapper *************** *** 279,283 **** if self.mainprogram is not None: - setpythonhome = "" # pythonhomeSnippet if we're making a standalone app mainname = os.path.basename(self.mainprogram) self.files.append((self.mainprogram, pathjoin(resdir, mainname))) --- 353,356 ---- *************** *** 287,294 **** mainwrapperpath = pathjoin(execdir, self.name) makedirs(execdir) ! open(mainwrapperpath, "w").write(mainWrapperTemplate % locals()) os.chmod(mainwrapperpath, 0777) def postProcess(self): if self.symlink_exec and self.executable: self.message("Symlinking executable %s to %s" % (self.executable, --- 360,371 ---- mainwrapperpath = pathjoin(execdir, self.name) makedirs(execdir) ! open(mainwrapperpath, "w").write(EXECVE_WRAPPER % locals()) os.chmod(mainwrapperpath, 0777) def postProcess(self): + self.addPythonModules() + if self.strip and not self.symlink: + self.stripBinaries() + if self.symlink_exec and self.executable: self.message("Symlinking executable %s to %s" % (self.executable, *************** *** 298,301 **** --- 375,529 ---- os.symlink(os.path.abspath(self.executable), dst) + if self.missingModules: + self.reportMissing() + + def addPythonModules(self): + self.message("Adding Python modules", 1) + pymodules = self.pymodules + + if USE_FROZEN: + # This anticipates the acceptance of this patch: + # http://www.python.org/sf/642578 + # Create a file containing all modules, frozen. + frozenmodules = [] + for name, code, ispkg in pymodules: + if ispkg: + self.message("Adding Python package %s" % name, 2) + else: + self.message("Adding Python module %s" % name, 2) + frozenmodules.append((name, marshal.dumps(code), ispkg)) + frozenmodules = tuple(frozenmodules) + relpath = "Contents/Resources/" + FROZEN_ARCHIVE + abspath = pathjoin(self.bundlepath, relpath) + f = open(abspath, "wb") + marshal.dump(frozenmodules, f) + f.close() + # add site.pyc + sitepath = pathjoin(self.bundlepath, "Contents/Resources/site" + PYC_EXT) + writePyc(SITE_CO, sitepath) + else: + # Create individual .pyc files. + for name, code, ispkg in pymodules: + if ispkg: + name += ".__init__" + path = name.split(".") + path = pathjoin("Contents/Resources/", *path) + PYC_EXT + + if ispkg: + self.message("Adding Python package %s" % path, 2) + else: + self.message("Adding Python module %s" % path, 2) + + abspath = pathjoin(self.bundlepath, path) + makedirs(os.path.dirname(abspath)) + writePyc(code, abspath) + + def stripBinaries(self): + if not os.path.exists(STRIP_EXEC): + self.message("Error: can't strip binaries: no strip program at " + "%s" % STRIP_EXEC, 0) + else: + self.message("Stripping binaries", 1) + for relpath in self.binaries: + self.message("Stripping %s" % relpath, 2) + abspath = pathjoin(self.bundlepath, relpath) + assert not os.path.islink(abspath) + rv = os.system("%s -S \"%s\"" % (STRIP_EXEC, abspath)) + + def findDependencies(self): + self.message("Finding module dependencies", 1) + import modulefinder + mf = modulefinder.ModuleFinder(excludes=self.excludeModules) + # manually add our own site.py + site = mf.add_module("site") + site.__code__ = SITE_CO + mf.scan_code(SITE_CO, site) + + includeModules = self.includeModules[:] + for name in self.includePackages: + includeModules.extend(findPackageContents(name).keys()) + for name in includeModules: + try: + mf.import_hook(name) + except ImportError: + self.missingModules.append(name) + + + mf.run_script(self.mainprogram) + modules = mf.modules.items() + modules.sort() + for name, mod in modules: + if mod.__file__ and mod.__code__ is None: + # C extension + path = mod.__file__ + ext = os.path.splitext(path)[1] + if USE_FROZEN: # "proper" freezing + # rename extensions that are submodules of packages to + # .. + dstpath = "Contents/Resources/" + name + ext + else: + dstpath = name.split(".") + dstpath = pathjoin("Contents/Resources/", *dstpath) + ext + self.files.append((path, dstpath)) + self.extensions.append((name, path, dstpath)) + self.binaries.append(dstpath) + elif mod.__code__ is not None: + ispkg = mod.__path__ is not None + if not USE_FROZEN or name != "site": + # Our site.py is doing the bootstrapping, so we must + # include a real .pyc file if USE_FROZEN is True. + self.pymodules.append((name, mod.__code__, ispkg)) + + self.missingModules.extend(mf.any_missing()) + + def reportMissing(self): + missing = [name for name in self.missingModules + if name not in MAYMISS_MODULES] + missingsub = [name for name in missing if "." in name] + missing = [name for name in missing if "." not in name] + missing.sort() + missingsub.sort() + if missing: + self.message("Warning: couldn't find the following modules:", 1) + self.message(" " + ", ".join(missing)) + if missingsub: + self.message("Warning: couldn't find the following submodules " + "(but it's probably OK since modulefinder can't distinguish " + "between from \"module import submodule\" and " + "\"from module import name\"):", 1) + self.message(" " + ", ".join(missingsub)) + + # + # Utilities. + # + + SUFFIXES = [_suf for _suf, _mode, _tp in imp.get_suffixes()] + identifierRE = re.compile(r"[_a-zA-z][_a-zA-Z0-9]*$") + + def findPackageContents(name, searchpath=None): + head = name.split(".")[-1] + if identifierRE.match(head) is None: + return {} + try: + fp, path, (ext, mode, tp) = imp.find_module(head, searchpath) + except ImportError: + return {} + modules = {name: None} + if tp == imp.PKG_DIRECTORY and path: + files = os.listdir(path) + for sub in files: + sub, ext = os.path.splitext(sub) + fullname = name + "." + sub + if sub != "__init__" and fullname not in modules: + modules.update(findPackageContents(fullname, [path])) + return modules + + def writePyc(code, path): + f = open(path, "wb") + f.write("\0" * 8) # don't bother about a time stamp + marshal.dump(code, f) + f.seek(0, 0) + f.write(MAGIC) + f.close() def copy(src, dst, mkdirs=0): *************** *** 356,359 **** --- 584,593 ---- -l, --link symlink files/folder instead of copying them --link-exec symlink the executable instead of copying it + --standalone build a standalone application, which is fully + independent of a Python installation + -x, --exclude=MODULE exclude module (with --standalone) + -i, --include=MODULE include module (with --standalone) + --package=PACKAGE include a whole package (with --standalone) + --strip strip binaries (remove debug info) -v, --verbose increase verbosity level -q, --quiet decrease verbosity level *************** *** 371,378 **** builder = AppBuilder(verbosity=1) ! shortopts = "b:n:r:e:m:c:p:lhvq" longopts = ("builddir=", "name=", "resource=", "executable=", "mainprogram=", "creator=", "nib=", "plist=", "link", ! "link-exec", "help", "verbose", "quiet") try: --- 605,613 ---- builder = AppBuilder(verbosity=1) ! shortopts = "b:n:r:e:m:c:p:lx:i:hvq" longopts = ("builddir=", "name=", "resource=", "executable=", "mainprogram=", "creator=", "nib=", "plist=", "link", ! "link-exec", "help", "verbose", "quiet", "standalone", ! "exclude=", "include=", "package=", "strip") try: *************** *** 408,411 **** --- 643,656 ---- elif opt in ('-q', '--quiet'): builder.verbosity -= 1 + elif opt == '--standalone': + builder.standalone = 1 + elif opt in ('-x', '--exclude'): + builder.excludeModules.append(arg) + elif opt in ('-i', '--include'): + builder.includeModules.append(arg) + elif opt == '--package': + builder.includePackages.append(arg) + elif opt == '--strip': + builder.strip = 1 if len(args) != 1: From tim_one@users.sourceforge.net Tue Nov 26 01:43:05 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 25 Nov 2002 17:43:05 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime test_both.py,NONE,1.1 obj_date.c,1.4,1.5 test_cdatetime.py,1.5,1.6 test_datetime.py,1.46,1.47 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv28454 Modified Files: obj_date.c test_cdatetime.py test_datetime.py Added Files: test_both.py Log Message: Eww. The Python and C implementations, and test suites, have diverged too much to straighten out in my head. New plan: the new file test_both.py will be used to test *both* implementations. The union of the Python and C test suites will be moved into the new file, a batch at a time, until they all work. At the end of this process, test_datetime.py and test_cdatetime.py will go away, and test_both will become test_datetime. To test the Python implementation: python test_both.py To test the C implementation: python test_both.py c This starts here with the date class, the union of whose test cases have been moved into test_both, with some exceptions: + The C implementation doesn't apppear to have a visible ord->date function, so a weakened version of test_ordinal_conversions was adapted from test_datetime (no such test existed in test_cdatetime). I left the full test in test_datetime so that it will be easy to restore the full test if there's time to write a C ord->date function (the audience is people using proleptic Gregorian ordinals to convert to and from other calendar systems). + The C code didn't support the new(?) timetuple() method. I added an implementation, and moved test_datetime's test case for that into test_both. + 3 tests still fail in the C version, when fully enabled. I left the crippled (but passing) versions of these tests in test_cdatetime, and moved the full versions from test_datetime into test_both. test_both fails on these 3 tests (test_extreme_timedelta, test_isocalendar, test_overflow) when testing the C implementation. I'll work on fixing those next, or, if someone else is eager , I'll work on straightening out the timedelta story next. --- NEW FILE: test_both.py --- """Test date/time type. See http://www.zope.org/Members/fdrake/DateTimeWiki/TestCases Pass c on the cmdline to test the C implementation; else the Python implementation is tested. """ # This file should eventually become test_datetime.py, and the existing # test_datetime.py and test_cdatetime.py should go away then. Right now, # the latter two test suites differ in complicated ways, largely because # the C implementation isn't yet finished. While this lasts, tests that # work under both implementations will be *moved* from test_datetime and # test_cdatetime into this file. import sys import unittest # Import the right implementation, under name "datetime". if 'c' in sys.argv: print "Testing the C implementation." import _datetime as datetime else: print "Testing the Python implementation." import datetime # Always use datetime.this or datetime.that. If, e.g., you do # from datetime import this # you're going to pick up the Python implementation. date = datetime.date timedelta = datetime.timedelta MINYEAR = datetime.MINYEAR MAXYEAR = datetime.MAXYEAR ############################################################################# # date tests class TestDate(unittest.TestCase): theclass = date def test_basic_attributes(self): dt = self.theclass(2002, 3, 1) self.assertEqual(dt.year, 2002) self.assertEqual(dt.month, 3) self.assertEqual(dt.day, 1) def test_roundtrip(self): for dt in (self.theclass(1, 2, 3), self.theclass.today()): # Verify dt -> string -> date identity. s = repr(dt) dt2 = eval(s) self.assertEqual(dt, dt2) # Verify identity via reconstructing from pieces. dt2 = self.theclass(dt.year, dt.month, dt.day) self.assertEqual(dt, dt2) def test_ordinal_conversions(self): # Check some fixed values. for y, m, d, n in [(1, 1, 1, 1), # calendar origin (1, 12, 31, 365), (2, 1, 1, 366), # first example from "Calendrical Calculations" (1945, 11, 12, 710347)]: d = date(y, m, d) self.assertEqual(d.toordinal(), n) # Check first and last days of year exhaustively across the whole # range of years date objects support. n = 1 for year in range(MINYEAR, MAXYEAR+1): self.assertEqual(date(year, 1, 1).toordinal(), n) # Verify that moving back a day gets to the end of year-1. if year > 1: self.assertEqual(date(year - 1, 12, 31).toordinal(), n-1) n += 365 n += year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) # Check every day in a leap-year and a non-leap year. dim = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] for year, isleap in (2000, True), (2002, False): n = date(year, 1, 1).toordinal() for month, maxday in zip(range(1, 13), dim): if month == 2 and isleap: maxday += 1 for day in range(1, maxday+1): self.assertEqual(date(year, month, day).toordinal(), n) n += 1 def test_bad_constructor_arguments(self): # bad years self.theclass(MINYEAR, 1, 1) # no exception self.theclass(MAXYEAR, 1, 1) # no exception self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1) self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1) # bad months self.theclass(2000, 1, 1) # no exception self.theclass(2000, 12, 1) # no exception self.assertRaises(ValueError, self.theclass, 2000, 0, 1) self.assertRaises(ValueError, self.theclass, 2000, 13, 1) # bad days self.theclass(2000, 2, 29) # no exception self.theclass(2004, 2, 29) # no exception self.theclass(2400, 2, 29) # no exception self.assertRaises(ValueError, self.theclass, 2000, 2, 30) self.assertRaises(ValueError, self.theclass, 2001, 2, 29) self.assertRaises(ValueError, self.theclass, 2100, 2, 29) self.assertRaises(ValueError, self.theclass, 1900, 2, 29) self.assertRaises(ValueError, self.theclass, 2000, 1, 0) self.assertRaises(ValueError, self.theclass, 2000, 1, 32) def test_hash_equality(self): d = self.theclass(2000, 12, 31) # same thing e = self.theclass(2000, 12, 31) self.assertEqual(d, e) self.assertEqual(hash(d), hash(e)) dic = {d: 1} dic[e] = 2 self.assertEqual(len(dic), 1) self.assertEqual(dic[d], 2) self.assertEqual(dic[e], 2) d = self.theclass(2001, 1, 1) # same thing e = self.theclass(2001, 1, 1) self.assertEqual(d, e) self.assertEqual(hash(d), hash(e)) dic = {d: 1} dic[e] = 2 self.assertEqual(len(dic), 1) self.assertEqual(dic[d], 2) self.assertEqual(dic[e], 2) def test_computations(self): a = self.theclass(2002, 1, 31) b = self.theclass(1956, 1, 31) diff = a-b self.assertEqual(diff.days, 46*365 + len(range(1956, 2002, 4))) self.assertEqual(diff.seconds, 0) self.assertEqual(diff.microseconds, 0) day = timedelta(1) week = timedelta(7) a = self.theclass(2002, 3, 2) self.assertEqual(a + day, self.theclass(2002, 3, 3)) self.assertEqual(a - day, self.theclass(2002, 3, 1)) self.assertEqual(a + week, self.theclass(2002, 3, 9)) self.assertEqual(a - week, self.theclass(2002, 2, 23)) self.assertEqual(a + 52*week, self.theclass(2003, 3, 1)) self.assertEqual(a - 52*week, self.theclass(2001, 3, 3)) self.assertEqual((a + week) - a, week) self.assertEqual((a + day) - a, day) self.assertEqual((a - week) - a, -week) self.assertEqual((a - day) - a, -day) self.assertEqual(a - (a + week), -week) self.assertEqual(a - (a + day), -day) self.assertEqual(a - (a - week), week) self.assertEqual(a - (a - day), day) # Add/sub ints, longs, floats should be illegal for i in 1, 1L, 1.0: self.assertRaises(TypeError, lambda: a+i) self.assertRaises(TypeError, lambda: a-i) self.assertRaises(TypeError, lambda: i+a) self.assertRaises(TypeError, lambda: i-a) def test_overflow(self): tiny = self.theclass.resolution dt = self.theclass.min + tiny dt -= tiny # no problem self.assertRaises(OverflowError, dt.__sub__, tiny) self.assertRaises(OverflowError, dt.__add__, -tiny) dt = self.theclass.max - tiny dt += tiny # no problem self.assertRaises(OverflowError, dt.__add__, tiny) self.assertRaises(OverflowError, dt.__sub__, -tiny) def test_weekday(self): for i in range(7): # March 4, 2002 is a Monday self.assertEqual(self.theclass(2002, 3, 4+i).weekday(), i) self.assertEqual(self.theclass(2002, 3, 4+i).isoweekday(), i+1) # January 2, 1956 is a Monday self.assertEqual(self.theclass(1956, 1, 2+i).weekday(), i) self.assertEqual(self.theclass(1956, 1, 2+i).isoweekday(), i+1) def test_isocalendar(self): # Check examples from # http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm for i in range(7): d = self.theclass(2003, 12, 22+i) self.assertEqual(d.isocalendar(), (2003, 52, i+1)) d = self.theclass(2003, 12, 29) + timedelta(i) self.assertEqual(d.isocalendar(), (2004, 1, i+1)) d = self.theclass(2004, 1, 5+i) self.assertEqual(d.isocalendar(), (2004, 2, i+1)) d = self.theclass(2009, 12, 21+i) self.assertEqual(d.isocalendar(), (2009, 52, i+1)) d = self.theclass(2009, 12, 28) + timedelta(i) self.assertEqual(d.isocalendar(), (2009, 53, i+1)) d = self.theclass(2010, 1, 4+i) self.assertEqual(d.isocalendar(), (2010, 1, i+1)) def test_iso_long_years(self): # Calculate long ISO years and compare to table from # http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm ISO_LONG_YEARS_TABLE = """ 4 32 60 88 9 37 65 93 15 43 71 99 20 48 76 26 54 82 105 133 161 189 111 139 167 195 116 144 172 122 150 178 128 156 184 201 229 257 285 207 235 263 291 212 240 268 296 218 246 274 224 252 280 303 331 359 387 308 336 364 392 314 342 370 398 320 348 376 325 353 381 """ iso_long_years = map(int, ISO_LONG_YEARS_TABLE.split()) iso_long_years.sort() L = [] for i in range(400): d = self.theclass(2000+i, 12, 31) d1 = self.theclass(1600+i, 12, 31) self.assertEqual(d.isocalendar()[1:], d1.isocalendar()[1:]) if d.isocalendar()[1] == 53: L.append(i) self.assertEqual(L, iso_long_years) def test_isoformat(self): t = self.theclass(2, 3, 2) self.assertEqual(t.isoformat(), "0002-03-02") def test_ctime(self): t = self.theclass(2002, 3, 2) self.assertEqual(t.ctime(), "Sat Mar 2 00:00:00 2002") def test_resolution_info(self): self.assert_(isinstance(self.theclass.min, self.theclass)) self.assert_(isinstance(self.theclass.max, self.theclass)) self.assert_(isinstance(self.theclass.resolution, timedelta)) self.assert_(self.theclass.max > self.theclass.min) def test_extreme_timedelta(self): big = self.theclass.max - self.theclass.min # 3652058 days, 23 hours, 59 minutes, 59 seconds, 999999 microseconds n = (big.days*24*3600 + big.seconds)*1000000 + big.microseconds # n = 315537897599999999 ~= 2**58.13 justasbig = timedelta(0, 0, n) self.assertEqual(big, justasbig) self.assertEqual(self.theclass.min + big, self.theclass.max) self.assertEqual(self.theclass.max - big, self.theclass.min) def test_timetuple(self): for i in range(7): # January 2, 1956 is a Monday (0) d = self.theclass(1956, 1, 2+i) t = d.timetuple() self.assertEqual(t, (1956, 1, 2+i, 0, 0, 0, i, 2+i, -1)) # February 1, 1956 is a Wednesday (2) d = self.theclass(1956, 2, 1+i) t = d.timetuple() self.assertEqual(t, (1956, 2, 1+i, 0, 0, 0, (2+i)%7, 32+i, -1)) # March 1, 1956 is a Thursday (3), and is the 31+29+1 = 61st day # of the year. d = self.theclass(1956, 3, 1+i) t = d.timetuple() self.assertEqual(t, (1956, 3, 1+i, 0, 0, 0, (3+i)%7, 61+i, -1)) def test_suite(): s1 = unittest.makeSuite(TestDate, 'test') return unittest.TestSuite([s1]) def test_main(): r = unittest.TextTestRunner(stream=sys.stdout, verbosity=2) s = test_suite() r.run(s) if __name__ == "__main__": test_main() Index: obj_date.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_date.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** obj_date.c 21 Nov 2002 19:29:12 -0000 1.4 --- obj_date.c 26 Nov 2002 01:43:03 -0000 1.5 *************** *** 158,161 **** --- 158,182 ---- } + static PyObject * + date_timetuple(PyDateTime_Date *self) + { + PyObject *result; + const int year = GET_YEAR(self); + const int month = GET_MONTH(self); + const int day = GET_DAY(self); + + result = Py_BuildValue("iiiiiiiii", + year, + month, + day, + 0, + 0, + 0, + weekday(year, month, day), + days_before_month(year, month) + day, + -1); + return result; + } + static int date_hash(PyDateTime_Date *self) *************** *** 403,406 **** --- 424,429 ---- {"ctime", (PyCFunction)date_ctime, METH_NOARGS, "Return ctime() style string."}, + {"timetuple", (PyCFunction)date_timetuple, METH_NOARGS, + "Return time tuple, compatible with time.localtime()."}, {"isocalendar", (PyCFunction)date_isocalendar, METH_NOARGS, "Return a 3-tuple containing ISO year, week number, and weekday.\n\n" Index: test_cdatetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_cdatetime.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_cdatetime.py 20 Aug 2002 18:53:07 -0000 1.5 --- test_cdatetime.py 26 Nov 2002 01:43:03 -0000 1.6 *************** *** 15,115 **** theclass = date - def test_basic_attributes(self): - dt = self.theclass(2002, 3, 1) - self.assertEqual(dt.year, 2002) - self.assertEqual(dt.month, 3) - self.assertEqual(dt.day, 1) - - def test_roundtrip(self): - for dt in (self.theclass(1, 2, 3), - self.theclass.today()): - # Verify dt -> string -> date identity. - s = repr(dt) - dt2 = eval(s) - self.assertEqual(dt, dt2) - - # Verify identity via reconstructing from pieces. - dt2 = self.theclass(dt.year, dt.month, dt.day) - self.assertEqual(dt, dt2) - - def test_bad_constructor_arguments(self): - # bad years - self.theclass(MINYEAR, 1, 1) # no exception - self.theclass(MAXYEAR, 1, 1) # no exception - self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1) - self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1) - # bad months - self.theclass(2000, 1, 1) # no exception - self.theclass(2000, 12, 1) # no exception - self.assertRaises(ValueError, self.theclass, 2000, 0, 1) - self.assertRaises(ValueError, self.theclass, 2000, 13, 1) - # bad days - self.theclass(2000, 2, 29) # no exception - self.theclass(2004, 2, 29) # no exception - self.theclass(2400, 2, 29) # no exception - self.assertRaises(ValueError, self.theclass, 2000, 2, 30) - self.assertRaises(ValueError, self.theclass, 2001, 2, 29) - self.assertRaises(ValueError, self.theclass, 2100, 2, 29) - self.assertRaises(ValueError, self.theclass, 1900, 2, 29) - self.assertRaises(ValueError, self.theclass, 2000, 1, 0) - self.assertRaises(ValueError, self.theclass, 2000, 1, 32) - - def test_hash_equality(self): - d = self.theclass(2000, 12, 31) - # same thing - e = self.theclass(2000, 12, 31) - self.assertEqual(d, e) - self.assertEqual(hash(d), hash(e)) - - dic = {d: 1} - dic[e] = 2 - self.assertEqual(len(dic), 1) - self.assertEqual(dic[d], 2) - self.assertEqual(dic[e], 2) - - d = self.theclass(2001, 1, 1) - # same thing - e = self.theclass(2001, 1, 1) - self.assertEqual(d, e) - self.assertEqual(hash(d), hash(e)) - - dic = {d: 1} - dic[e] = 2 - self.assertEqual(len(dic), 1) - self.assertEqual(dic[d], 2) - self.assertEqual(dic[e], 2) - - def test_computations(self): - a = self.theclass(2002, 1, 31) - b = self.theclass(1956, 1, 31) - ## print >>sys.__stderr__, a, b - ## diff = a-b - ## self.assertEqual(diff.days, 46*365 + len(range(1956, 2002, 4))) - ## self.assertEqual(diff.seconds, 0) - ## self.assertEqual(diff.microseconds, 0) - day = timedelta(1) - week = timedelta(7) - a = self.theclass(2002, 3, 2) - self.assertEqual(a + day, self.theclass(2002, 3, 3)) - self.assertEqual(a - day, self.theclass(2002, 3, 1)) - self.assertEqual(a + week, self.theclass(2002, 3, 9)) - self.assertEqual(a - week, self.theclass(2002, 2, 23)) - self.assertEqual(a + 52*week, self.theclass(2003, 3, 1)) - self.assertEqual(a - 52*week, self.theclass(2001, 3, 3)) - self.assertEqual((a + week) - a, week) - self.assertEqual((a + day) - a, day) - self.assertEqual((a - week) - a, -week) - self.assertEqual((a - day) - a, -day) - self.assertEqual(a - (a + week), -week) - self.assertEqual(a - (a + day), -day) - self.assertEqual(a - (a - week), week) - self.assertEqual(a - (a - day), day) - # Add/sub ints, longs, floats should be illegal - for i in 1, 1L, 1.0: - self.assertRaises(TypeError, lambda: a+i) - self.assertRaises(TypeError, lambda: a-i) - self.assertRaises(TypeError, lambda: i+a) - self.assertRaises(TypeError, lambda: i-a) def test_overflow(self): tiny = self.theclass.resolution --- 15,20 ---- theclass = date + # XXX This still fails if fully enabled. def test_overflow(self): tiny = self.theclass.resolution *************** *** 125,137 **** ## self.assertRaises(OverflowError, dt.__sub__, -tiny) - def test_weekday(self): - for i in range(7): - # March 4, 2002 is a Monday - self.assertEqual(self.theclass(2002, 3, 4+i).weekday(), i) - self.assertEqual(self.theclass(2002, 3, 4+i).isoweekday(), i+1) - # January 2, 1956 is a Monday - self.assertEqual(self.theclass(1956, 1, 2+i).weekday(), i) - self.assertEqual(self.theclass(1956, 1, 2+i).isoweekday(), i+1) def test_isocalendar(self): # Check examples from --- 30,35 ---- ## self.assertRaises(OverflowError, dt.__sub__, -tiny) + # XXX This still fails if fully enabled. def test_isocalendar(self): # Check examples from *************** *** 152,208 **** self.assertEqual(d.isocalendar(), (2010, 1, i+1)) - def test_iso_long_years(self): - # Calculate long ISO years and compare to table from - # http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm - ISO_LONG_YEARS_TABLE = """ - 4 32 60 88 - 9 37 65 93 - 15 43 71 99 - 20 48 76 - 26 54 82 - - 105 133 161 189 - 111 139 167 195 - 116 144 172 - 122 150 178 - 128 156 184 - - 201 229 257 285 - 207 235 263 291 - 212 240 268 296 - 218 246 274 - 224 252 280 - - 303 331 359 387 - 308 336 364 392 - 314 342 370 398 - 320 348 376 - 325 353 381 - """ - iso_long_years = map(int, ISO_LONG_YEARS_TABLE.split()) - iso_long_years.sort() - L = [] - for i in range(400): - d = self.theclass(2000+i, 12, 31) - d1 = self.theclass(1600+i, 12, 31) - self.assertEqual(d.isocalendar()[1:], d1.isocalendar()[1:]) - if d.isocalendar()[1] == 53: - L.append(i) - self.assertEqual(L, iso_long_years) - - def test_isoformat(self): - t = self.theclass(2, 3, 2) - self.assertEqual(t.isoformat(), "0002-03-02") - - def test_ctime(self): - t = self.theclass(2002, 3, 2) - self.assertEqual(t.ctime(), "Sat Mar 2 00:00:00 2002") - - def test_resolution_info(self): - self.assert_(isinstance(self.theclass.min, self.theclass)) - self.assert_(isinstance(self.theclass.max, self.theclass)) - self.assert_(isinstance(self.theclass.resolution, timedelta)) - self.assert_(self.theclass.max > self.theclass.min) def test_extreme_timedelta(self): big = self.theclass.max - self.theclass.min --- 50,55 ---- self.assertEqual(d.isocalendar(), (2010, 1, i+1)) + # XXX This still fails if fully enabled. def test_extreme_timedelta(self): big = self.theclass.max - self.theclass.min Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_datetime.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** test_datetime.py 25 Nov 2002 21:09:06 -0000 1.46 --- test_datetime.py 26 Nov 2002 01:43:03 -0000 1.47 *************** *** 11,14 **** --- 11,55 ---- + class TestDate(unittest.TestCase): + + theclass = date + + # All the other tests here have been moved into test_both. This one + # relies on stuff only the Python version implements. + def test_ordinal_conversions(self): + from datetime import _ymd2ord, _ord2ymd + + # Check some fixed values. + for y, m, d, n in [(1, 1, 1, 1), # calendar origin + (0, 12, 31, 0), + (0, 12, 30, -1), + # first example from "Calendrical Calculations" + (1945, 11, 12, 710347)]: + self.assertEqual(n, _ymd2ord(y, m, d)) + self.assertEqual((y, m, d), _ord2ymd(n)) + + # Check first and last days of year exhaustively across 2000 years + # centered at the origin, and spottily over the whole range of + # years datetime objects support. + for year in range(-1001, 1002) + range(MINYEAR, MAXYEAR+1, 7): + # Verify (year, 1, 1) -> ordinal -> y, m, d is identity. + n = _ymd2ord(year, 1, 1) + self.assertEqual((year, 1, 1), _ord2ymd(n)) + # Verify that moving back a day gets to the end of year-1. + self.assertEqual((year-1, 12, 31), _ord2ymd(n-1)) + self.assertEqual(_ymd2ord(year-1, 12, 31), n-1) + + # Test every day in a leap-year and a non-leap year. + dim = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + for year, isleap in (2000, 1), (2002, 0): + n = _ymd2ord(year, 1, 1) + for month, maxday in zip(range(1, 13), dim): + if month == 2 and isleap: + maxday += 1 + for day in range(1, maxday+1): + self.assertEqual((year, month, day), _ord2ymd(n)) + self.assertEqual(n, _ymd2ord(year, month, day)) + n += 1 + class TestTimeDelta(unittest.TestCase): *************** *** 74,330 **** eq(td(milliseconds=0.001), td(microseconds=1)) - - class TestDate(unittest.TestCase): - - theclass = date - - def test_basic_attributes(self): - dt = self.theclass(2002, 3, 1) - self.assertEqual(dt.year, 2002) - self.assertEqual(dt.month, 3) - self.assertEqual(dt.day, 1) - - def test_roundtrip(self): - for dt in (self.theclass(1, 2, 3), - self.theclass.today()): - # Verify dt -> string -> date identity. - s = repr(dt) - dt2 = eval(s) - self.assertEqual(dt, dt2) - - # Verify identity via reconstructing from pieces. - dt2 = self.theclass(dt.year, dt.month, dt.day) - self.assertEqual(dt, dt2) - - def test_ordinal_conversions(self): - from datetime import _ymd2ord, _ord2ymd - - # Check some fixed values. - for y, m, d, n in [(1, 1, 1, 1), # calendar origin - (0, 12, 31, 0), - (0, 12, 30, -1), - # first example from "Calendrical Calculations" - (1945, 11, 12, 710347)]: - self.assertEqual(n, _ymd2ord(y, m, d)) - self.assertEqual((y, m, d), _ord2ymd(n)) - - # Check first and last days of year exhaustively across 2000 years - # centered at the origin, and spottily over the whole range of - # years datetime objects support. - for year in range(-1001, 1002) + range(MINYEAR, MAXYEAR+1, 7): - # Verify (year, 1, 1) -> ordinal -> y, m, d is identity. - n = _ymd2ord(year, 1, 1) - self.assertEqual((year, 1, 1), _ord2ymd(n)) - # Verify that moving back a day gets to the end of year-1. - self.assertEqual((year-1, 12, 31), _ord2ymd(n-1)) - self.assertEqual(_ymd2ord(year-1, 12, 31), n-1) - - # Test every day in a leap-year and a non-leap year. - dim = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] - for year, isleap in (2000, 1), (2002, 0): - n = _ymd2ord(year, 1, 1) - for month, maxday in zip(range(1, 13), dim): - if month == 2 and isleap: - maxday += 1 - for day in range(1, maxday+1): - self.assertEqual((year, month, day), _ord2ymd(n)) - self.assertEqual(n, _ymd2ord(year, month, day)) - n += 1 - - def test_bad_constructor_arguments(self): - # bad years - self.theclass(MINYEAR, 1, 1) # no exception - self.theclass(MAXYEAR, 1, 1) # no exception - self.assertRaises(ValueError, self.theclass, MINYEAR-1, 1, 1) - self.assertRaises(ValueError, self.theclass, MAXYEAR+1, 1, 1) - # bad months - self.theclass(2000, 1, 1) # no exception - self.theclass(2000, 12, 1) # no exception - self.assertRaises(ValueError, self.theclass, 2000, 0, 1) - self.assertRaises(ValueError, self.theclass, 2000, 13, 1) - # bad days - self.theclass(2000, 2, 29) # no exception - self.theclass(2004, 2, 29) # no exception - self.theclass(2400, 2, 29) # no exception - self.assertRaises(ValueError, self.theclass, 2000, 2, 30) - self.assertRaises(ValueError, self.theclass, 2001, 2, 29) - self.assertRaises(ValueError, self.theclass, 2100, 2, 29) - self.assertRaises(ValueError, self.theclass, 1900, 2, 29) - self.assertRaises(ValueError, self.theclass, 2000, 1, 0) - self.assertRaises(ValueError, self.theclass, 2000, 1, 32) - - def test_hash_equality(self): - d = self.theclass(2000, 12, 31) - # same thing - e = self.theclass(2000, 12, 31) - self.assertEqual(d, e) - self.assertEqual(hash(d), hash(e)) - - dic = {d: 1} - dic[e] = 2 - self.assertEqual(len(dic), 1) - self.assertEqual(dic[d], 2) - self.assertEqual(dic[e], 2) - - d = self.theclass(2001, 1, 1) - # same thing - e = self.theclass(2001, 1, 1) - self.assertEqual(d, e) - self.assertEqual(hash(d), hash(e)) - - dic = {d: 1} - dic[e] = 2 - self.assertEqual(len(dic), 1) - self.assertEqual(dic[d], 2) - self.assertEqual(dic[e], 2) - - def test_computations(self): - a = self.theclass(2002, 1, 31) - b = self.theclass(1956, 1, 31) - diff = a-b - self.assertEqual(diff.days, 46*365 + len(range(1956, 2002, 4))) - self.assertEqual(diff.seconds, 0) - self.assertEqual(diff.microseconds, 0) - day = timedelta(1) - week = timedelta(7) - a = self.theclass(2002, 3, 2) - self.assertEqual(a + day, self.theclass(2002, 3, 3)) - self.assertEqual(a - day, self.theclass(2002, 3, 1)) - self.assertEqual(a + week, self.theclass(2002, 3, 9)) - self.assertEqual(a - week, self.theclass(2002, 2, 23)) - self.assertEqual(a + 52*week, self.theclass(2003, 3, 1)) - self.assertEqual(a - 52*week, self.theclass(2001, 3, 3)) - self.assertEqual((a + week) - a, week) - self.assertEqual((a + day) - a, day) - self.assertEqual((a - week) - a, -week) - self.assertEqual((a - day) - a, -day) - self.assertEqual(a - (a + week), -week) - self.assertEqual(a - (a + day), -day) - self.assertEqual(a - (a - week), week) - self.assertEqual(a - (a - day), day) - # Add/sub ints, longs, floats should be illegal - for i in 1, 1L, 1.0: - self.assertRaises(TypeError, lambda: a+i) - self.assertRaises(TypeError, lambda: a-i) - self.assertRaises(TypeError, lambda: i+a) - self.assertRaises(TypeError, lambda: i-a) - - def test_overflow(self): - tiny = self.theclass.resolution - - dt = self.theclass.min + tiny - dt -= tiny # no problem - self.assertRaises(OverflowError, dt.__sub__, tiny) - self.assertRaises(OverflowError, dt.__add__, -tiny) - - dt = self.theclass.max - tiny - dt += tiny # no problem - self.assertRaises(OverflowError, dt.__add__, tiny) - self.assertRaises(OverflowError, dt.__sub__, -tiny) - - def test_weekday(self): - for i in range(7): - # March 4, 2002 is a Monday - self.assertEqual(self.theclass(2002, 3, 4+i).weekday(), i) - self.assertEqual(self.theclass(2002, 3, 4+i).isoweekday(), i+1) - # January 2, 1956 is a Monday - self.assertEqual(self.theclass(1956, 1, 2+i).weekday(), i) - self.assertEqual(self.theclass(1956, 1, 2+i).isoweekday(), i+1) - - def test_isocalendar(self): - # Check examples from - # http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm - for i in range(7): - d = self.theclass(2003, 12, 22+i) - self.assertEqual(d.isocalendar(), (2003, 52, i+1)) - d = self.theclass(2003, 12, 29) + timedelta(i) - self.assertEqual(d.isocalendar(), (2004, 1, i+1)) - d = self.theclass(2004, 1, 5+i) - self.assertEqual(d.isocalendar(), (2004, 2, i+1)) - d = self.theclass(2009, 12, 21+i) - self.assertEqual(d.isocalendar(), (2009, 52, i+1)) - d = self.theclass(2009, 12, 28) + timedelta(i) - self.assertEqual(d.isocalendar(), (2009, 53, i+1)) - d = self.theclass(2010, 1, 4+i) - self.assertEqual(d.isocalendar(), (2010, 1, i+1)) - - def test_iso_long_years(self): - # Calculate long ISO years and compare to table from - # http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm - ISO_LONG_YEARS_TABLE = """ - 4 32 60 88 - 9 37 65 93 - 15 43 71 99 - 20 48 76 - 26 54 82 - - 105 133 161 189 - 111 139 167 195 - 116 144 172 - 122 150 178 - 128 156 184 - - 201 229 257 285 - 207 235 263 291 - 212 240 268 296 - 218 246 274 - 224 252 280 - - 303 331 359 387 - 308 336 364 392 - 314 342 370 398 - 320 348 376 - 325 353 381 - """ - iso_long_years = map(int, ISO_LONG_YEARS_TABLE.split()) - iso_long_years.sort() - L = [] - for i in range(400): - d = self.theclass(2000+i, 12, 31) - d1 = self.theclass(1600+i, 12, 31) - self.assertEqual(d.isocalendar()[1:], d1.isocalendar()[1:]) - if d.isocalendar()[1] == 53: - L.append(i) - self.assertEqual(L, iso_long_years) - - def test_isoformat(self): - t = self.theclass(2, 3, 2) - self.assertEqual(t.isoformat(), "0002-03-02") - - def test_ctime(self): - t = self.theclass(2002, 3, 2) - self.assertEqual(t.ctime(), "Sat Mar 2 00:00:00 2002") - - def test_resolution_info(self): - self.assert_(isinstance(self.theclass.min, self.theclass)) - self.assert_(isinstance(self.theclass.max, self.theclass)) - self.assert_(isinstance(self.theclass.resolution, timedelta)) - self.assert_(self.theclass.max > self.theclass.min) - - def test_extreme_timedelta(self): - big = self.theclass.max - self.theclass.min - # 3652058 days, 23 hours, 59 minutes, 59 seconds, 999999 microseconds - n = (big.days*24*3600 + big.seconds)*1000000 + big.microseconds - # n = 315537897599999999 ~= 2**58.13 - justasbig = timedelta(0, 0, n) - self.assertEqual(big, justasbig) - self.assertEqual(self.theclass.min + big, self.theclass.max) - self.assertEqual(self.theclass.max - big, self.theclass.min) - - def test_timetuple(self): - for i in range(7): - # January 2, 1956 is a Monday (0) - d = self.theclass(1956, 1, 2+i) - t = d.timetuple() - self.assertEqual(t, (1956, 1, 2+i, 0, 0, 0, i, 2+i, -1)) - # February 1, 1956 is a Wednesday (2) - d = self.theclass(1956, 2, 1+i) - t = d.timetuple() - self.assertEqual(t, (1956, 2, 1+i, 0, 0, 0, (2+i)%7, 32+i, -1)) - # March 1, 1956 is a Thursday (3), and is the 31+29+1 = 61st day - # of the year. - d = self.theclass(1956, 3, 1+i) - t = d.timetuple() - self.assertEqual(t, (1956, 3, 1+i, 0, 0, 0, (3+i)%7, 61+i, -1)) --- 115,118 ---- From tim_one@users.sourceforge.net Tue Nov 26 03:14:12 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 25 Nov 2002 19:14:12 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime test_both.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv13704 Modified Files: test_both.py Log Message: Use MINYEAR instead of a literal 1. Index: test_both.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_both.py 26 Nov 2002 01:43:03 -0000 1.1 --- test_both.py 26 Nov 2002 03:14:10 -0000 1.2 *************** *** 76,80 **** self.assertEqual(date(year, 1, 1).toordinal(), n) # Verify that moving back a day gets to the end of year-1. ! if year > 1: self.assertEqual(date(year - 1, 12, 31).toordinal(), n-1) n += 365 --- 76,80 ---- self.assertEqual(date(year, 1, 1).toordinal(), n) # Verify that moving back a day gets to the end of year-1. ! if year > MINYEAR: self.assertEqual(date(year - 1, 12, 31).toordinal(), n-1) n += 365 From tim_one@users.sourceforge.net Tue Nov 26 03:23:12 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 25 Nov 2002 19:23:12 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime obj_delta.c,1.3,1.4 test_both.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv18625 Modified Files: obj_delta.c test_both.py Log Message: Just lining stuff up. Index: obj_delta.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_delta.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** obj_delta.c 21 Nov 2002 19:24:53 -0000 1.3 --- obj_delta.c 26 Nov 2002 03:23:10 -0000 1.4 *************** *** 53,57 **** diff = GET_TD_SECONDS(self) - GET_TD_SECONDS(other); if (diff == 0) ! diff = GET_TD_MICROSECONDS(self) - GET_TD_MICROSECONDS(other); } --- 53,57 ---- diff = GET_TD_SECONDS(self) - GET_TD_SECONDS(other); if (diff == 0) ! diff = GET_TD_MICROSECONDS(self) - GET_TD_MICROSECONDS(other); } *************** *** 191,196 **** static PyNumberMethods delta_as_number = { delta_add, /* nb_add */ ! delta_subtract, /* nb_subtract */ ! delta_multiply, /* nb_multiply */ 0, /* nb_divide */ 0, /* nb_remainder */ --- 191,196 ---- static PyNumberMethods delta_as_number = { delta_add, /* nb_add */ ! delta_subtract, /* nb_subtract */ ! delta_multiply, /* nb_multiply */ 0, /* nb_divide */ 0, /* nb_remainder */ *************** *** 200,204 **** 0, /* nb_positive */ 0, /* nb_absolute */ ! (inquiry)delta_nonzero, /* nb_nonzero */ }; --- 200,204 ---- 0, /* nb_positive */ 0, /* nb_absolute */ ! (inquiry)delta_nonzero, /* nb_nonzero */ }; *************** *** 206,210 **** PyObject_HEAD_INIT(NULL) 0, /* ob_size */ ! "timedelta", /* tp_name */ sizeof(PyDateTime_Delta), /* tp_basicsize */ 0, /* tp_itemsize */ --- 206,210 ---- PyObject_HEAD_INIT(NULL) 0, /* ob_size */ ! "timedelta", /* tp_name */ sizeof(PyDateTime_Delta), /* tp_basicsize */ 0, /* tp_itemsize */ *************** *** 213,222 **** 0, /* tp_getattr */ 0, /* tp_setattr */ ! (cmpfunc)delta_compare, /* tp_compare */ ! (reprfunc)delta_repr, /* tp_repr */ &delta_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ ! (hashfunc)delta_hash, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ --- 213,222 ---- 0, /* tp_getattr */ 0, /* tp_setattr */ ! (cmpfunc)delta_compare, /* tp_compare */ ! (reprfunc)delta_repr, /* tp_repr */ &delta_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ ! (hashfunc)delta_hash, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ *************** *** 233,237 **** 0, /* tp_iternext */ 0, /* tp_methods */ ! delta_members, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ --- 233,237 ---- 0, /* tp_iternext */ 0, /* tp_methods */ ! delta_members, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ *************** *** 243,246 **** 0, /* tp_alloc */ delta_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 243,246 ---- 0, /* tp_alloc */ delta_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; Index: test_both.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_both.py 26 Nov 2002 03:14:10 -0000 1.2 --- test_both.py 26 Nov 2002 03:23:10 -0000 1.3 *************** *** 35,40 **** ############################################################################# ! # date tests class TestDate(unittest.TestCase): --- 35,105 ---- ############################################################################# ! # timedelta tests ! ! class TestTimeDelta(unittest.TestCase): ! ! def test_timedelta(self): ! a = timedelta(7) # One week ! b = timedelta(0, 60) # One minute ! c = timedelta(0, 0, 1000) # One millisecond ! self.assertEqual(a+b+c, timedelta(7, 60, 1000)) ! self.assertEqual(a-b, timedelta(6, 24*3600 - 60)) ! self.assertEqual(-a, timedelta(-7)) ! self.assertEqual(+a, timedelta(7)) ! self.assertEqual(-b, timedelta(-1, 24*3600 - 60)) ! self.assertEqual(-c, timedelta(-1, 24*3600 - 1, 999000)) ! self.assertEqual(abs(a), a) ! self.assertEqual(abs(-a), a) ! self.assertEqual(timedelta(6, 24*3600), a) ! self.assertEqual(timedelta(0, 0, 60*1000000), b) ! self.assertEqual(a*10, timedelta(70)) ! self.assertEqual(a*10, 10*a) ! self.assertEqual(a*10L, 10*a) ! self.assertEqual(b*10, timedelta(0, 600)) ! self.assertEqual(10*b, timedelta(0, 600)) ! self.assertEqual(b*10L, timedelta(0, 600)) ! self.assertEqual(c*10, timedelta(0, 0, 10000)) ! self.assertEqual(10*c, timedelta(0, 0, 10000)) ! self.assertEqual(c*10L, timedelta(0, 0, 10000)) ! self.assertEqual(a*-1, -a) ! self.assertEqual(b*-2, -b-b) ! self.assertEqual(c*-2, -c+-c) ! self.assertEqual(b*(60*24), (b*60)*24) ! self.assertEqual(b*(60*24), (60*b)*24) ! self.assertEqual(c*1000, timedelta(0, 1)) ! self.assertEqual(1000*c, timedelta(0, 1)) ! self.assertEqual(a//7, timedelta(1)) ! self.assertEqual(b//10, timedelta(0, 6)) ! self.assertEqual(c//1000, timedelta(0, 0, 1)) ! self.assertEqual(a//10, timedelta(0, 7*24*360)) ! self.assertEqual(a//3600000, timedelta(0, 0, 7*24*1000)) ! # Add/sub ints, longs, floats should be illegal ! for i in 1, 1L, 1.0: ! self.assertRaises(TypeError, lambda: a+i) ! self.assertRaises(TypeError, lambda: a-i) ! self.assertRaises(TypeError, lambda: i+a) ! self.assertRaises(TypeError, lambda: i-a) ! # Check keyword args to constructor ! eq = self.assertEqual ! td = timedelta ! eq(td(1), td(days=1)) ! eq(td(0, 1), td(seconds=1)) ! eq(td(0, 0, 1), td(microseconds=1)) ! eq(td(weeks=1), td(days=7)) ! eq(td(days=1), td(hours=24)) ! eq(td(hours=1), td(minutes=60)) ! eq(td(minutes=1), td(seconds=60)) ! eq(td(seconds=1), td(milliseconds=1000)) ! eq(td(milliseconds=1), td(microseconds=1000)) ! # Check float args to constructor ! eq(td(weeks=1.0/7), td(days=1)) ! eq(td(days=1.0/24), td(hours=1)) ! eq(td(hours=1.0/60), td(minutes=1)) ! eq(td(minutes=1.0/60), td(seconds=1)) ! eq(td(seconds=0.001), td(milliseconds=1)) ! eq(td(milliseconds=0.001), td(microseconds=1)) + ############################################################################# + # date tests class TestDate(unittest.TestCase): *************** *** 291,296 **** def test_suite(): ! s1 = unittest.makeSuite(TestDate, 'test') ! return unittest.TestSuite([s1]) def test_main(): --- 356,362 ---- def test_suite(): ! s1 = unittest.makeSuite(TestTimeDelta, 'test') ! s2 = unittest.makeSuite(TestDate, 'test') ! return unittest.TestSuite([s1, s2]) def test_main(): From tim_one@users.sourceforge.net Tue Nov 26 03:29:20 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 25 Nov 2002 19:29:20 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime obj_delta.c,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv21119 Modified Files: obj_delta.c Log Message: delta_add(): Fiddled decls; XXX comments about useless code; this looks unfinished. Index: obj_delta.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_delta.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** obj_delta.c 26 Nov 2002 03:23:10 -0000 1.4 --- obj_delta.c 26 Nov 2002 03:29:17 -0000 1.5 *************** *** 19,30 **** if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) { /* delta + delta */ ! long int days = GET_TD_DAYS(delta) + ! GET_TD_DAYS(right); ! long int seconds = GET_TD_SECONDS(delta) + ! GET_TD_SECONDS(right); ! long int microseconds = GET_TD_MICROSECONDS(delta) + ! GET_TD_MICROSECONDS(right); return new_delta(days, seconds, microseconds); } other = right; other_type = right_type; --- 19,31 ---- if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) { /* delta + delta */ ! const long days = GET_TD_DAYS(delta) + ! GET_TD_DAYS(right); ! const long seconds = GET_TD_SECONDS(delta) + ! GET_TD_SECONDS(right); ! const long microseconds = GET_TD_MICROSECONDS(delta) + ! GET_TD_MICROSECONDS(right); return new_delta(days, seconds, microseconds); } + /* XXX This code is unused. */ other = right; other_type = right_type; *************** *** 32,35 **** --- 33,37 ---- else { /* !delta + delta */ + /* XXX This code is unused. */ delta = (PyDateTime_Delta *) right; other = left; From tim_one@users.sourceforge.net Tue Nov 26 05:11:28 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 25 Nov 2002 21:11:28 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.23,1.24 obj_delta.c,1.5,1.6 test_datetime.py,1.47,1.48 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv24895 Modified Files: datetime.c obj_delta.c test_datetime.py Log Message: Deeper into the weeds! Moved the timedelta tests from the Python test suite into test_both. The C test suite didn't have any tests of this, and there were, and still are, lots of problems. Added a bunch of new numeric methods to the timedelta C implementation, removed needless bounds checks, added needed bounds checks, and generally recovered from that C "/" doesn't compute the floor as these algorithms need. Much more is still needed here, but I'm hitting the wall for one day. Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** datetime.c 22 Nov 2002 03:34:42 -0000 1.23 --- datetime.c 26 Nov 2002 05:11:25 -0000 1.24 *************** *** 19,24 **** long hashcode; long days; ! long seconds; ! long microseconds; } PyDateTime_Delta; --- 19,24 ---- long hashcode; long days; ! long seconds; /* 0 <= seconds < 24*3600 is invariant */ ! long microseconds; /* 0 <= microseconds < 1000000 is invariant */ } PyDateTime_Delta; *************** *** 64,67 **** --- 64,91 ---- */ + /* Compute Python divmod(x, y), returning the quotient and storing the + * remainder into *r. The quotient is the floor of x/y, and that's + * the real point of this. C will probably truncate instead (C89 + * requires truncation; C89 left it implementation-defined). + * Simplification: we *require* that y > 0 here. That's appropriate + * for all the uses made of it. This simplifies the code and makes + * the overflow case impossible. + */ + static long + divmod(long x, long y, long *r) + { + long quo; + + assert(y > 0); + quo = x / y; + *r = x - quo * y; + if (*r < 0) { + --quo; + *r += y; + } + assert(0 <= *r && *r < y); + return quo; + } + /* For each month ordinal in 1..12, the number of days in that month, * and the number of days before that month in the same year. These *************** *** 333,347 **** static PyObject * ! new_delta(long int days, long int seconds, long int microseconds) { ! PyDateTime_Delta *self; ! if (microseconds >= 1000000 || microseconds <= -1000000) { ! seconds += microseconds / 1000000; ! microseconds %= 1000000; } ! if (seconds >= 24*3600 || seconds <= 24*3600) { ! days += seconds / (24*3600); ! seconds %= (24*3600); } self = PyObject_New(PyDateTime_Delta, &PyDateTime_DeltaType); --- 357,396 ---- static PyObject * ! new_delta(long days, long seconds, long microseconds) { ! PyDateTime_Delta *self = NULL; ! /* k = i+j overflows iff k differs in sign from both inputs, ! * iff k^i has sign bit set and k^j has sign bit set, ! * iff (k^i)&(k^j) has sign bit set. ! */ ! if (microseconds < 0 || microseconds >= 1000000) { ! long whole_seconds; ! long new_seconds; ! ! whole_seconds = divmod(microseconds, 1000000, µseconds); ! assert(microseconds >= 0); ! new_seconds = seconds + whole_seconds; ! if (((new_seconds ^ seconds) & ! (new_seconds ^ whole_seconds)) < 0) { ! PyErr_SetString(PyExc_OverflowError, "timedelta " ! "seconds component too large"); ! goto done; ! } ! seconds = new_seconds; } ! if (seconds < 0 || seconds >= 24*3600) { ! long whole_days; ! long new_days; ! ! whole_days = divmod(seconds, 24*3600, &seconds); ! assert(seconds >= 0); ! new_days = days + whole_days; ! if (((new_days ^ days) & (new_days ^ whole_days)) < 0) { ! PyErr_SetString(PyExc_OverflowError, "timedelta " ! "days component too large"); ! goto done; ! } ! days = new_days; } self = PyObject_New(PyDateTime_Delta, &PyDateTime_DeltaType); *************** *** 352,355 **** --- 401,405 ---- SET_TD_MICROSECONDS(self, microseconds); } + done: return (PyObject *) self; } Index: obj_delta.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_delta.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** obj_delta.c 26 Nov 2002 03:29:17 -0000 1.5 --- obj_delta.c 26 Nov 2002 05:11:25 -0000 1.6 *************** *** 19,22 **** --- 19,23 ---- if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) { /* delta + delta */ + /* XXX Overflow checking is needed here. */ const long days = GET_TD_DAYS(delta) + GET_TD_DAYS(right); *************** *** 42,45 **** --- 43,103 ---- } + static PyObject * + delta_negative(PyDateTime_Delta *self) + { + return new_delta(-GET_TD_DAYS(self), + -GET_TD_SECONDS(self), + -GET_TD_MICROSECONDS(self)); + } + + static PyObject * + delta_positive(PyDateTime_Delta *self) + { + /* Could optimize this (by returning self) if this isn't a + * subclass -- but who uses unary + ? Approximately nobody. + */ + return new_delta(GET_TD_DAYS(self), + GET_TD_SECONDS(self), + GET_TD_MICROSECONDS(self)); + } + + static PyObject * + delta_abs(PyDateTime_Delta *self) + { + PyObject *result; + + assert(GET_TD_MICROSECONDS(self) >= 0); + assert(GET_TD_SECONDS(self) >= 0); + + if (GET_TD_DAYS(self) < 0) + result = delta_negative(self); + else + result = delta_positive(self); + + return result; + } + + static PyObject * + delta_subtract(PyObject *left, PyObject *right) + { + PyObject *result = NULL; + + /* XXX It's unclear to me exactly which rules we intend here. */ + if (PyType_IsSubtype(left->ob_type, &PyDateTime_DeltaType) && + PyType_IsSubtype(right->ob_type, &PyDateTime_DeltaType)) { + /* delta - delta */ + PyObject *minus_right = PyNumber_Negative(right); + if (minus_right) { + result = delta_add(left, minus_right); + Py_DECREF(minus_right); + } + } + else + result = Py_NotImplemented; + + Py_XINCREF(result); + return result; + } + static int delta_compare(PyDateTime_Delta *self, PyObject *other) *************** *** 107,118 **** static PyObject * - delta_negative(PyDateTime_Delta *self) - { - return new_delta(-GET_TD_DAYS(self), - -GET_TD_SECONDS(self), - -GET_TD_MICROSECONDS(self)); - } - - static PyObject * delta_new(PyTypeObject *type, PyObject *args, PyObject *kw) { --- 165,168 ---- *************** *** 120,123 **** --- 170,175 ---- long int days, seconds = 0, microseconds = 0; + /* XXX We're missing 4 keyword args from the Python version. */ + /* XXX The Python version doesn't require a days argument. */ static char *keywords[] = { "days", "seconds", "microseconds", NULL *************** *** 126,139 **** if (PyArg_ParseTupleAndKeywords(args, kw, "l|ll:__new__", keywords, &days, &seconds, µseconds)) { - if (seconds < 0 || seconds >= (24 * 3600)) { - PyErr_SetString(PyExc_ValueError, - "seconds must be in 0..86399"); - return NULL; - } - if (microseconds < 0 || microseconds >= 1000000) { - PyErr_SetString(PyExc_ValueError, - "microseconds must be in 0..999999"); - return NULL; - } self = new_delta(days, seconds, microseconds); } --- 178,181 ---- *************** *** 141,151 **** } - static PyObject * - delta_subtract(PyObject *left, PyObject *right) - { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - static int delta_nonzero(PyDateTime_Delta *self) --- 183,186 ---- *************** *** 200,205 **** 0, /* nb_power */ (unaryfunc)delta_negative, /* nb_negative */ ! 0, /* nb_positive */ ! 0, /* nb_absolute */ (inquiry)delta_nonzero, /* nb_nonzero */ }; --- 235,240 ---- 0, /* nb_power */ (unaryfunc)delta_negative, /* nb_negative */ ! (unaryfunc)delta_positive, /* nb_positive */ ! (unaryfunc)delta_abs, /* nb_absolute */ (inquiry)delta_nonzero, /* nb_nonzero */ }; Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_datetime.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** test_datetime.py 26 Nov 2002 01:43:03 -0000 1.47 --- test_datetime.py 26 Nov 2002 05:11:25 -0000 1.48 *************** *** 52,119 **** n += 1 - class TestTimeDelta(unittest.TestCase): - - def test_timedelta(self): - a = timedelta(7) # One week - b = timedelta(0, 60) # One minute - c = timedelta(0, 0, 1000) # One millisecond - self.assertEqual(a+b+c, timedelta(7, 60, 1000)) - self.assertEqual(a-b, timedelta(6, 24*3600 - 60)) - self.assertEqual(-a, timedelta(-7)) - self.assertEqual(+a, timedelta(7)) - self.assertEqual(-b, timedelta(-1, 24*3600 - 60)) - self.assertEqual(-c, timedelta(-1, 24*3600 - 1, 999000)) - self.assertEqual(abs(a), a) - self.assertEqual(abs(-a), a) - self.assertEqual(timedelta(6, 24*3600), a) - self.assertEqual(timedelta(0, 0, 60*1000000), b) - self.assertEqual(a*10, timedelta(70)) - self.assertEqual(a*10, 10*a) - self.assertEqual(a*10L, 10*a) - self.assertEqual(b*10, timedelta(0, 600)) - self.assertEqual(10*b, timedelta(0, 600)) - self.assertEqual(b*10L, timedelta(0, 600)) - self.assertEqual(c*10, timedelta(0, 0, 10000)) - self.assertEqual(10*c, timedelta(0, 0, 10000)) - self.assertEqual(c*10L, timedelta(0, 0, 10000)) - self.assertEqual(a*-1, -a) - self.assertEqual(b*-2, -b-b) - self.assertEqual(c*-2, -c+-c) - self.assertEqual(b*(60*24), (b*60)*24) - self.assertEqual(b*(60*24), (60*b)*24) - self.assertEqual(c*1000, timedelta(0, 1)) - self.assertEqual(1000*c, timedelta(0, 1)) - self.assertEqual(a//7, timedelta(1)) - self.assertEqual(b//10, timedelta(0, 6)) - self.assertEqual(c//1000, timedelta(0, 0, 1)) - self.assertEqual(a//10, timedelta(0, 7*24*360)) - self.assertEqual(a//3600000, timedelta(0, 0, 7*24*1000)) - # Add/sub ints, longs, floats should be illegal - for i in 1, 1L, 1.0: - self.assertRaises(TypeError, lambda: a+i) - self.assertRaises(TypeError, lambda: a-i) - self.assertRaises(TypeError, lambda: i+a) - self.assertRaises(TypeError, lambda: i-a) - # Check keyword args to constructor - eq = self.assertEqual - td = timedelta - eq(td(1), td(days=1)) - eq(td(0, 1), td(seconds=1)) - eq(td(0, 0, 1), td(microseconds=1)) - eq(td(weeks=1), td(days=7)) - eq(td(days=1), td(hours=24)) - eq(td(hours=1), td(minutes=60)) - eq(td(minutes=1), td(seconds=60)) - eq(td(seconds=1), td(milliseconds=1000)) - eq(td(milliseconds=1), td(microseconds=1000)) - # Check float args to constructor - eq(td(weeks=1.0/7), td(days=1)) - eq(td(days=1.0/24), td(hours=1)) - eq(td(hours=1.0/60), td(minutes=1)) - eq(td(minutes=1.0/60), td(seconds=1)) - eq(td(seconds=0.001), td(milliseconds=1)) - eq(td(milliseconds=0.001), td(microseconds=1)) - - class TestTime(unittest.TestCase): --- 52,55 ---- *************** *** 558,562 **** def test_suite(): - s1 = unittest.makeSuite(TestTimeDelta, 'test') s2 = unittest.makeSuite(TestDate, 'test') s3 = unittest.makeSuite(TestTime, 'test') --- 494,497 ---- *************** *** 564,568 **** s5 = unittest.makeSuite(TestDateTime, 'test') s6 = unittest.makeSuite(TestDateTimeTZ, 'test') ! return unittest.TestSuite([s1, s2, s3, s4, s5, s6]) def test_main(): --- 499,503 ---- s5 = unittest.makeSuite(TestDateTime, 'test') s6 = unittest.makeSuite(TestDateTimeTZ, 'test') ! return unittest.TestSuite([s2, s3, s4, s5, s6]) def test_main(): From tim_one@users.sourceforge.net Tue Nov 26 05:17:29 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 25 Nov 2002 21:17:29 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.24,1.25 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv27304 Modified Files: datetime.c Log Message: Typo repair. Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** datetime.c 26 Nov 2002 05:11:25 -0000 1.24 --- datetime.c 26 Nov 2002 05:17:27 -0000 1.25 *************** *** 18,22 **** PyObject_HEAD long hashcode; ! long days; long seconds; /* 0 <= seconds < 24*3600 is invariant */ long microseconds; /* 0 <= microseconds < 1000000 is invariant */ --- 18,22 ---- PyObject_HEAD long hashcode; ! long days; /* this may be negative */ long seconds; /* 0 <= seconds < 24*3600 is invariant */ long microseconds; /* 0 <= microseconds < 1000000 is invariant */ *************** *** 66,74 **** /* Compute Python divmod(x, y), returning the quotient and storing the * remainder into *r. The quotient is the floor of x/y, and that's ! * the real point of this. C will probably truncate instead (C89 * requires truncation; C89 left it implementation-defined). * Simplification: we *require* that y > 0 here. That's appropriate * for all the uses made of it. This simplifies the code and makes ! * the overflow case impossible. */ static long --- 66,75 ---- /* Compute Python divmod(x, y), returning the quotient and storing the * remainder into *r. The quotient is the floor of x/y, and that's ! * the real point of this. C will probably truncate instead (C99 * requires truncation; C89 left it implementation-defined). * Simplification: we *require* that y > 0 here. That's appropriate * for all the uses made of it. This simplifies the code and makes ! * the overflow case impossible (divmod(LONG_MIN, -1) is the only ! * overflow case). */ static long From tim_one@users.sourceforge.net Tue Nov 26 05:32:09 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 25 Nov 2002 21:32:09 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.25,1.26 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv31253 Modified Files: datetime.c Log Message: Reworked the signed-add-overflowed logic into a macro, as it's already used twice and will be needed again. Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** datetime.c 26 Nov 2002 05:17:27 -0000 1.25 --- datetime.c 26 Nov 2002 05:32:06 -0000 1.26 *************** *** 64,67 **** --- 64,74 ---- */ + /* k = i+j overflows iff k differs in sign from both inputs, + * iff k^i has sign bit set and k^j has sign bit set, + * iff (k^i)&(k^j) has sign bit set. + */ + #define SIGNED_ADD_OVERFLOWED(RESULT, I, J) \ + ((((RESULT) ^ (I)) & ((RESULT) ^ (J))) < 0) + /* Compute Python divmod(x, y), returning the quotient and storing the * remainder into *r. The quotient is the floor of x/y, and that's *************** *** 362,369 **** PyDateTime_Delta *self = NULL; - /* k = i+j overflows iff k differs in sign from both inputs, - * iff k^i has sign bit set and k^j has sign bit set, - * iff (k^i)&(k^j) has sign bit set. - */ if (microseconds < 0 || microseconds >= 1000000) { long whole_seconds; --- 369,372 ---- *************** *** 373,378 **** assert(microseconds >= 0); new_seconds = seconds + whole_seconds; ! if (((new_seconds ^ seconds) & ! (new_seconds ^ whole_seconds)) < 0) { PyErr_SetString(PyExc_OverflowError, "timedelta " "seconds component too large"); --- 376,381 ---- assert(microseconds >= 0); new_seconds = seconds + whole_seconds; ! if (SIGNED_ADD_OVERFLOWED(new_seconds, seconds, ! whole_seconds)) { PyErr_SetString(PyExc_OverflowError, "timedelta " "seconds component too large"); *************** *** 388,392 **** assert(seconds >= 0); new_days = days + whole_days; ! if (((new_days ^ days) & (new_days ^ whole_days)) < 0) { PyErr_SetString(PyExc_OverflowError, "timedelta " "days component too large"); --- 391,395 ---- assert(seconds >= 0); new_days = days + whole_days; ! if (SIGNED_ADD_OVERFLOWED(new_days, days, whole_days)) { PyErr_SetString(PyExc_OverflowError, "timedelta " "days component too large"); From tim_one@users.sourceforge.net Tue Nov 26 05:37:11 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 25 Nov 2002 21:37:11 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime obj_delta.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv32615 Modified Files: obj_delta.c Log Message: delta_add: Catch C long+long overflow (it's certainly possible, and can't be ignored). Index: obj_delta.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_delta.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** obj_delta.c 26 Nov 2002 05:11:25 -0000 1.6 --- obj_delta.c 26 Nov 2002 05:37:09 -0000 1.7 *************** *** 19,29 **** if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) { /* delta + delta */ ! /* XXX Overflow checking is needed here. */ ! const long days = GET_TD_DAYS(delta) + ! GET_TD_DAYS(right); const long seconds = GET_TD_SECONDS(delta) + GET_TD_SECONDS(right); const long microseconds = GET_TD_MICROSECONDS(delta) + GET_TD_MICROSECONDS(right); return new_delta(days, seconds, microseconds); } --- 19,38 ---- if (PyType_IsSubtype(right_type, &PyDateTime_DeltaType)) { /* delta + delta */ ! /* seconds and microseconds can't overflow, due to ! * the invariant bounds on them. ! */ const long seconds = GET_TD_SECONDS(delta) + GET_TD_SECONDS(right); const long microseconds = GET_TD_MICROSECONDS(delta) + GET_TD_MICROSECONDS(right); + /* But days can overflow. */ + const long days1 = GET_TD_DAYS(delta); + const long days2 = GET_TD_DAYS(right); + const long days = days1 + days2; + if (SIGNED_ADD_OVERFLOWED(days, days1, days2)) { + PyErr_SetString(PyExc_OverflowError, + "timedelta addition"); + return NULL; + } return new_delta(days, seconds, microseconds); } From tim_one@users.sourceforge.net Tue Nov 26 05:58:22 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 25 Nov 2002 21:58:22 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime obj_date.c,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv7785 Modified Files: obj_date.c Log Message: Fixed one cause for test_overflow() failing in the C implemenyation, but the line after that now fails in a different way. Index: obj_date.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_date.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** obj_date.c 26 Nov 2002 01:43:03 -0000 1.5 --- obj_date.c 26 Nov 2002 05:58:20 -0000 1.6 *************** *** 4,29 **** */ static int ! normalize_date(long int *year, long int *month, long int *day) { ! long int carry, dim; /* This is muddy: the proper range for day can't be determined * without knowing the correct month and year, but if day is, * e.g., plus or minus a million, the current month and year ! * values make no sense (and may also be out of bounds ! * themselves). Saying 12 months == 1 year should be ! * non-controversial. */ ! if (*month > 12) { ! carry = (*month - 1) / 12; ! *month -= (carry * 12); *year += carry; assert(*month >= 1); assert(*month <= 12); } ! /* Now only day can be out of bounds (year may also be out of ! * bounds for a datetime object, but we don't care about that ! * here). If day is out of bounds, what to do is arguable, but at * least the method here is principled and explainable. */ --- 4,33 ---- */ + /* Fiddle out-of-bounds months and days so that the result makes some kind + * of sense. The parameters are both inputs and outputs. Returns 0 on + * failure and > 0 for success. Failure means the adjusted year is out of + * bounds. + */ static int ! normalize_date(long *year, long *month, long *day) { ! long carry, dim; /* This is muddy: the proper range for day can't be determined * without knowing the correct month and year, but if day is, * e.g., plus or minus a million, the current month and year ! * values make no sense (and may also be out of bounds themselves). ! * Saying 12 months == 1 year should be non-controversial. */ ! if (*month < 1 || *month > 12) { ! long m = *month; ! carry = divmod(m-1, 12, &m); ! *month = m+1; *year += carry; assert(*month >= 1); assert(*month <= 12); } ! /* ! * If day is out of bounds, what to do is arguable, but at * least the method here is principled and explainable. */ *************** *** 54,59 **** } else { ! long int ordinal = ymd_to_ord(*year, *month, 1) + ! *day - 1; ord_to_ymd(ordinal, year, month, day); } --- 58,63 ---- } else { ! long ordinal = ymd_to_ord(*year, *month, 1) + ! *day - 1; ord_to_ymd(ordinal, year, month, day); } *************** *** 61,65 **** assert(*month > 0); assert(*day > 0); ! if (*year < MINYEAR) { PyErr_SetString(PyExc_OverflowError, "date value out of range"); --- 65,69 ---- assert(*month > 0); assert(*day > 0); ! if (*year < MINYEAR || *year > MAXYEAR) { PyErr_SetString(PyExc_OverflowError, "date value out of range"); From tim_one@users.sourceforge.net Tue Nov 26 06:01:18 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 25 Nov 2002 22:01:18 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime obj_date.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv10137 Modified Files: obj_date.c Log Message: Minor reformat. Index: obj_date.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_date.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** obj_date.c 26 Nov 2002 05:58:20 -0000 1.6 --- obj_date.c 26 Nov 2002 06:01:16 -0000 1.7 *************** *** 341,350 **** if (PyType_IsSubtype(right_type, &PyDateTime_DateType)) { /* date - date */ ! long int left_ord = ymd_to_ord(GET_YEAR(left), ! GET_MONTH(left), ! GET_DAY(left)); ! long int right_ord = ymd_to_ord(GET_YEAR(right), ! GET_MONTH(right), ! GET_DAY(right)); return new_delta(left_ord - right_ord, 0, 0); } --- 341,350 ---- if (PyType_IsSubtype(right_type, &PyDateTime_DateType)) { /* date - date */ ! long left_ord = ymd_to_ord(GET_YEAR(left), ! GET_MONTH(left), ! GET_DAY(left)); ! long right_ord = ymd_to_ord(GET_YEAR(right), ! GET_MONTH(right), ! GET_DAY(right)); return new_delta(left_ord - right_ord, 0, 0); } *************** *** 369,376 **** } else { ! long int year, month, day; ! long int ord = ymd_to_ord(GET_YEAR(left), ! GET_MONTH(left), ! GET_DAY(left)); ord -= GET_TD_DAYS(right); if (ord < 1) --- 369,376 ---- } else { ! long year, month, day; ! long ord = ymd_to_ord(GET_YEAR(left), ! GET_MONTH(left), ! GET_DAY(left)); ord -= GET_TD_DAYS(right); if (ord < 1) From tim_one@users.sourceforge.net Tue Nov 26 06:09:55 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 25 Nov 2002 22:09:55 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime obj_date.c,1.7,1.8 test_cdatetime.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv11895 Modified Files: obj_date.c test_cdatetime.py Log Message: date_subtract(): this didn't realize that date - timedelta could overflow in the positive direction (it's easy, if timedelta < 0!). Repaired that. test_overflow() finally passes in the C implementation, so removed the crippled version of that test from test_cdatetime too. Index: obj_date.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_date.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** obj_date.c 26 Nov 2002 06:01:16 -0000 1.7 --- obj_date.c 26 Nov 2002 06:09:53 -0000 1.8 *************** *** 375,385 **** ord -= GET_TD_DAYS(right); if (ord < 1) ! PyErr_SetString(PyExc_OverflowError, ! "resulting value " ! "out of range"); ! else { ! ord_to_ymd(ord, &year, &month, &day); ! result = new_date(year, month, day); ! } } return result; --- 375,383 ---- ord -= GET_TD_DAYS(right); if (ord < 1) ! goto Overflow; ! ord_to_ymd(ord, &year, &month, &day); ! if (year < MINYEAR || year > MAXYEAR) ! goto Overflow; ! result = new_date(year, month, day); } return result; *************** *** 388,391 **** --- 386,393 ---- Py_INCREF(Py_NotImplemented); return Py_NotImplemented; + + Overflow: + PyErr_SetString(PyExc_OverflowError, "date subtraction"); + return NULL; } Index: test_cdatetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_cdatetime.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_cdatetime.py 26 Nov 2002 01:43:03 -0000 1.6 --- test_cdatetime.py 26 Nov 2002 06:09:53 -0000 1.7 *************** *** 15,34 **** theclass = date - - # XXX This still fails if fully enabled. - def test_overflow(self): - tiny = self.theclass.resolution - - dt = self.theclass.min + tiny - dt -= tiny # no problem - self.assertRaises(OverflowError, dt.__sub__, tiny) - self.assertRaises(OverflowError, dt.__add__, -tiny) - - dt = self.theclass.max - tiny - dt += tiny # no problem - ## self.assertRaises(OverflowError, dt.__add__, tiny) - ## self.assertRaises(OverflowError, dt.__sub__, -tiny) - - # XXX This still fails if fully enabled. def test_isocalendar(self): --- 15,18 ---- From tim_one@users.sourceforge.net Tue Nov 26 06:27:26 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 25 Nov 2002 22:27:26 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime obj_date.c,1.8,1.9 test_cdatetime.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv16679 Modified Files: obj_date.c test_cdatetime.py Log Message: date_isocalendar(): This suffered two instances of mistaking C "/" for Python's floor division. Repaired them. test_isocalendar now passes in the C implementation, so removed its test from test_cdatetime too. Index: obj_date.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_date.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** obj_date.c 26 Nov 2002 06:09:53 -0000 1.8 --- obj_date.c 26 Nov 2002 06:27:24 -0000 1.9 *************** *** 260,278 **** int week1_monday = iso_week1_monday(year); long today = ymd_to_ord(year, GET_MONTH(self), GET_DAY(self)); ! int week = (today - week1_monday) / 7; ! int day = (today - week1_monday) % 7; if (week < 0) { --year; week1_monday = iso_week1_monday(year); ! week = (today - week1_monday) / 7; ! day = (today - week1_monday) % 7; } ! else if (week >= 52 && ! today >= iso_week1_monday(year + 1)) { ++year; week = 0; } ! return Py_BuildValue("iii", year, week + 1, day + 1); } --- 260,277 ---- int week1_monday = iso_week1_monday(year); long today = ymd_to_ord(year, GET_MONTH(self), GET_DAY(self)); ! long week; ! long day; + week = divmod(today - week1_monday, 7, &day); if (week < 0) { --year; week1_monday = iso_week1_monday(year); ! week = divmod(today - week1_monday, 7, &day); } ! else if (week >= 52 && today >= iso_week1_monday(year + 1)) { ++year; week = 0; } ! return Py_BuildValue("iii", year, (int)week + 1, (int)day + 1); } Index: test_cdatetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_cdatetime.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_cdatetime.py 26 Nov 2002 06:09:53 -0000 1.7 --- test_cdatetime.py 26 Nov 2002 06:27:24 -0000 1.8 *************** *** 16,39 **** # XXX This still fails if fully enabled. - def test_isocalendar(self): - # Check examples from - # http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm - for i in range(7): - d = self.theclass(2003, 12, 22+i) - self.assertEqual(d.isocalendar(), (2003, 52, i+1)) - d = self.theclass(2003, 12, 29) + timedelta(i) - self.assertEqual(d.isocalendar(), (2004, 1, i+1)) - d = self.theclass(2004, 1, 5+i) - self.assertEqual(d.isocalendar(), (2004, 2, i+1)) - d = self.theclass(2009, 12, 21+i) - self.assertEqual(d.isocalendar(), (2009, 52, i+1)) - d = self.theclass(2009, 12, 28) + timedelta(i) - ## print >>sys.__stderr__, i, `d`, d.isocalendar() - ## self.assertEqual(d.isocalendar(), (2009, 53, i+1)) - d = self.theclass(2010, 1, 4+i) - self.assertEqual(d.isocalendar(), (2010, 1, i+1)) - - - # XXX This still fails if fully enabled. def test_extreme_timedelta(self): big = self.theclass.max - self.theclass.min --- 16,19 ---- From theller@users.sourceforge.net Tue Nov 26 08:05:11 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 26 Nov 2002 00:05:11 -0800 Subject: [Python-checkins] python/dist/src/Tools/freeze modulefinder.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/freeze In directory sc8-pr-cvs1:/tmp/cvs-serv28451 Modified Files: modulefinder.py Log Message: Don't look for modules in the registry any longer. Mark writes in private email: "Modules listed in the registry was a dumb idea. This whole scheme can die. AFAIK, no one in the world uses it (including win32all since the last build)." (See also SF #643711) Index: modulefinder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/modulefinder.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** modulefinder.py 25 Nov 2002 20:21:59 -0000 1.24 --- modulefinder.py 26 Nov 2002 08:05:09 -0000 1.25 *************** *** 60,96 **** return s - _warned = 0 - - def _try_registry(name): - # Emulate the Registered Module support on Windows. - try: - import _winreg - RegQueryValue = _winreg.QueryValue - HKLM = _winreg.HKEY_LOCAL_MACHINE - exception = _winreg.error - except ImportError: - try: - import win32api - RegQueryValue = win32api.RegQueryValue - HKLM = 0x80000002 # HKEY_LOCAL_MACHINE - exception = win32api.error - except ImportError: - global _warned - if not _warned: - _warned = 1 - print "Warning: Neither _winreg nor win32api is available - modules" - print "listed in the registry will not be found" - return None - try: - pathname = RegQueryValue(HKLM, \ - r"Software\Python\PythonCore\%s\Modules\%s" % (sys.winver, name)) - fp = open(pathname, "rb") - except exception: - return None - else: - # XXX - To do - remove the hard code of C_EXTENSION. - stuff = "", "rb", imp.C_EXTENSION - return fp, pathname, stuff - class ModuleFinder: --- 60,63 ---- *************** *** 390,398 **** return (None, None, ("", "", imp.C_BUILTIN)) - if sys.platform=="win32": - result = _try_registry(name) - if result: - return result - path = self.path return imp.find_module(name, path) --- 357,360 ---- From theller@users.sourceforge.net Tue Nov 26 08:06:52 2002 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Tue, 26 Nov 2002 00:06:52 -0800 Subject: [Python-checkins] python/dist/src/Tools/freeze modulefinder.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/freeze In directory sc8-pr-cvs1:/tmp/cvs-serv29143 Modified Files: modulefinder.py Log Message: Polish some bits to silence pychecker. Index: modulefinder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/modulefinder.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** modulefinder.py 26 Nov 2002 08:05:09 -0000 1.25 --- modulefinder.py 26 Nov 2002 08:06:50 -0000 1.26 *************** *** 7,11 **** import marshal import os - import re import sys import new --- 7,10 ---- *************** *** 123,126 **** --- 122,126 ---- if m.__path__: self.ensure_fromlist(m, fromlist) + return None def determine_parent(self, caller): From loewis@users.sourceforge.net Tue Nov 26 09:05:38 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 26 Nov 2002 01:05:38 -0800 Subject: [Python-checkins] python/dist/src/Modules _localemodule.c,2.35,2.36 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv20873/Modules Modified Files: _localemodule.c Log Message: Patch #632973: Implement _getdefaultlocale for OS X. Index: _localemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_localemodule.c,v retrieving revision 2.35 retrieving revision 2.36 diff -C2 -d -r2.35 -r2.36 *** _localemodule.c 2 Aug 2002 02:27:13 -0000 2.35 --- _localemodule.c 26 Nov 2002 09:05:36 -0000 2.36 *************** *** 31,35 **** #endif ! #ifdef macintosh #include "macglue.h" #endif --- 31,35 ---- #endif ! #if __APPLE__ #include "macglue.h" #endif *************** *** 401,405 **** #endif ! #if defined(macintosh) static PyObject* PyLocale_getdefaultlocale(PyObject* self) --- 401,405 ---- #endif ! #if defined(__APPLE__) static PyObject* PyLocale_getdefaultlocale(PyObject* self) *************** *** 628,632 **** {"strxfrm", (PyCFunction) PyLocale_strxfrm, METH_VARARGS, strxfrm__doc__}, ! #if defined(MS_WINDOWS) || defined(macintosh) {"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, METH_NOARGS}, #endif --- 628,632 ---- {"strxfrm", (PyCFunction) PyLocale_strxfrm, METH_VARARGS, strxfrm__doc__}, ! #if defined(MS_WINDOWS) || defined(__APPLE__) {"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, METH_NOARGS}, #endif From loewis@users.sourceforge.net Tue Nov 26 09:05:38 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 26 Nov 2002 01:05:38 -0800 Subject: [Python-checkins] python/dist/src/Python mactoolboxglue.c,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv20873/Python Modified Files: mactoolboxglue.c Log Message: Patch #632973: Implement _getdefaultlocale for OS X. Index: mactoolboxglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/mactoolboxglue.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** mactoolboxglue.c 9 Nov 2002 14:47:18 -0000 1.13 --- mactoolboxglue.c 26 Nov 2002 09:05:36 -0000 1.14 *************** *** 39,47 **** { #if TARGET_API_MAC_OSX ! /* We cannot use GetSysFont because it requires the window manager ! ** There are other APIs to query the default 8 bit encoding, but ! ** I don't know about them (yet). ! */ ! return "ascii"; #else int font, script, lang; --- 39,58 ---- { #if TARGET_API_MAC_OSX ! CFStringEncoding enc = CFStringGetSystemEncoding(); ! static CFStringRef name = NULL; ! /* Return the code name for the encodings for which we have codecs. */ ! switch(enc) { ! case kCFStringEncodingMacRoman: return "mac-roman"; ! case kCFStringEncodingMacGreek: return "mac-greek"; ! case kCFStringEncodingMacCyrillic: return "mac-cyrillic"; ! case kCFStringEncodingMacTurkish: return "mac-turkish"; ! case kCFStringEncodingMacIcelandic: return "mac-icelandic"; ! /* XXX which one is mac-latin2? */ ! } ! if (!name) { ! /* This leaks a an object. */ ! name = CFStringConvertEncodingToIANACharSetName(enc); ! } ! return CFStringGetCStringPtr(name, 0); #else int font, script, lang; From loewis@users.sourceforge.net Tue Nov 26 09:28:07 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 26 Nov 2002 01:28:07 -0800 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tkinter.py,1.165,1.166 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv30260/Lib/lib-tk Modified Files: Tkinter.py Log Message: Patch #518625: Return objects in Tkinter. Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.165 retrieving revision 1.166 diff -C2 -d -r1.165 -r1.166 *** Tkinter.py 13 Oct 2002 10:22:06 -0000 1.165 --- Tkinter.py 26 Nov 2002 09:28:04 -0000 1.166 *************** *** 46,49 **** --- 46,51 ---- _MacOS = None + want_objects = 1 + TkVersion = float(_tkinter.TK_VERSION) TclVersion = float(_tkinter.TCL_VERSION) *************** *** 1522,1525 **** --- 1524,1528 ---- baseName = baseName + ext self.tk = _tkinter.create(screenName, baseName, className) + self.tk.wantobjects(want_objects) if _MacOS and hasattr(_MacOS, 'SchedParams'): # Disable event scanning except for Command-Period From loewis@users.sourceforge.net Tue Nov 26 09:28:07 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 26 Nov 2002 01:28:07 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.542,1.543 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv30260/Misc Modified Files: NEWS Log Message: Patch #518625: Return objects in Tkinter. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.542 retrieving revision 1.543 diff -C2 -d -r1.542 -r1.543 *** NEWS 25 Nov 2002 17:25:01 -0000 1.542 --- NEWS 26 Nov 2002 09:28:05 -0000 1.543 *************** *** 313,316 **** --- 313,321 ---- ----------------- + - _tkinter now returns Tcl objects, instead of strings. Objects which + have Python equivalents are converted to Python objects, other objects + are wrapped. This can be configured through the wantobjects method, + or Tkinter.want_objects. + - The PyBSDDB wrapper around the Sleepycat Berkely DB library has been added as the package bsddb. The traditional bsddb module is still From loewis@users.sourceforge.net Tue Nov 26 09:28:07 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 26 Nov 2002 01:28:07 -0800 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.130,1.131 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv30260/Modules Modified Files: _tkinter.c Log Message: Patch #518625: Return objects in Tkinter. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.130 retrieving revision 1.131 diff -C2 -d -r1.130 -r1.131 *** _tkinter.c 1 Oct 2002 18:50:56 -0000 1.130 --- _tkinter.c 26 Nov 2002 09:28:05 -0000 1.131 *************** *** 51,57 **** --- 51,59 ---- #ifdef TK_FRAMEWORK #include + #include #include #else #include + #include #include #endif *************** *** 220,223 **** --- 222,226 ---- PyObject_HEAD Tcl_Interp *interp; + int want_objects; } TkappObject; *************** *** 425,428 **** --- 428,492 ---- } + /* In some cases, Tcl will still return strings that are supposed to be + lists. SplitObj walks through a nested tuple, finding string objects that + need to be split. */ + + PyObject * + SplitObj(PyObject *arg) + { + if (PyTuple_Check(arg)) { + int i, size; + PyObject *elem, *newelem, *result; + + size = PyTuple_Size(arg); + result = NULL; + /* Recursively invoke SplitObj for all tuple items. + If this does not return a new object, no action is + needed. */ + for(i = 0; i < size; i++) { + elem = PyTuple_GetItem(arg, i); + newelem = SplitObj(elem); + if (!newelem) { + Py_XDECREF(result); + return NULL; + } + if (!result) { + int k; + if (newelem == elem) { + Py_DECREF(newelem); + continue; + } + result = PyTuple_New(size); + if (!result) + return NULL; + for(k = 0; k < i; k++) { + elem = PyTuple_GetItem(arg, k); + Py_INCREF(elem); + PyTuple_SetItem(result, k, elem); + } + } + PyTuple_SetItem(result, i, newelem); + } + if (result) + return result; + /* Fall through, returning arg. */ + } + else if (PyString_Check(arg)) { + int argc; + char **argv; + char *list = PyString_AsString(arg); + + if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) { + Py_INCREF(arg); + return arg; + } + Tcl_Free(FREECAST argv); + if (argc > 1) + return Split(PyString_AsString(arg)); + /* Fall through, returning arg. */ + } + Py_INCREF(arg); + return arg; + } *************** *** 459,463 **** static TkappObject * ! Tkapp_New(char *screenName, char *baseName, char *className, int interactive) { TkappObject *v; --- 523,528 ---- static TkappObject * ! Tkapp_New(char *screenName, char *baseName, char *className, ! int interactive, int want_objects) { TkappObject *v; *************** *** 469,472 **** --- 534,538 ---- v->interp = Tcl_CreateInterp(); + v->want_objects = want_objects; #if defined(macintosh) *************** *** 514,517 **** --- 580,681 ---- /** Tcl Eval **/ + typedef struct { + PyObject_HEAD + Tcl_Obj *value; + } PyTclObject; + + staticforward PyTypeObject PyTclObject_Type; + #define PyTclObject_Check(v) ((v)->ob_type == &PyTclObject_Type) + + static PyObject * + newPyTclObject(Tcl_Obj *arg) + { + PyTclObject *self; + self = PyObject_New(PyTclObject, &PyTclObject_Type); + if (self == NULL) + return NULL; + Tcl_IncrRefCount(arg); + self->value = arg; + return (PyObject*)self; + } + + static void + PyTclObject_dealloc(PyTclObject *self) + { + Tcl_DecrRefCount(self->value); + PyObject_Del(self); + } + + static PyObject * + PyTclObject_str(PyTclObject *self) + { + return PyString_FromString(Tcl_GetString(self->value)); + } + + static PyObject * + PyTclObject_repr(PyTclObject *self) + { + char buf[50]; + PyOS_snprintf(buf, 50, "<%s object at 0x%.8x>", + self->value->typePtr->name, (int)self->value); + return PyString_FromString(buf); + } + + static PyObject* + get_typename(PyTclObject* obj, void* ignored) + { + return PyString_FromString(obj->value->typePtr->name); + } + + static PyGetSetDef PyTclObject_getsetlist[] = { + {"typename", (getter)get_typename, NULL, "name of the Tcl type"}, + {0}, + }; + + statichere PyTypeObject PyTclObject_Type = { + PyObject_HEAD_INIT(NULL) + 0, /*ob_size*/ + "_tkinter.Tcl_Obj", /*tp_name*/ + sizeof(PyTclObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor)PyTclObject_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + (reprfunc)PyTclObject_repr, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + (reprfunc)PyTclObject_str, /*tp_str*/ + PyObject_GenericGetAttr,/*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + PyTclObject_getsetlist, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + }; + static Tcl_Obj* AsObj(PyObject *value) *************** *** 571,574 **** --- 735,743 ---- } #endif + else if(PyTclObject_Check(value)) { + Tcl_Obj *v = ((PyTclObject*)value)->value; + Tcl_IncrRefCount(v); + return v; + } else { PyObject *v = PyObject_Str(value); *************** *** 581,584 **** --- 750,846 ---- } + static PyObject* + FromObj(PyObject* tkapp, Tcl_Obj *value) + { + PyObject *result = NULL; + + if (value->typePtr == NULL) + return PyString_FromStringAndSize(value->bytes, value->length); + + if (value->typePtr == &tclBooleanType) { + result = value->internalRep.longValue ? Py_True : Py_False; + Py_INCREF(result); + return result; + } + + if (value->typePtr == &tclByteArrayType) { + int size; + char *data = Tcl_GetByteArrayFromObj(value, &size); + return PyString_FromStringAndSize(data, size); + } + + if (value->typePtr == &tclDoubleType) { + return PyFloat_FromDouble(value->internalRep.doubleValue); + } + + if (value->typePtr == &tclIntType) { + return PyInt_FromLong(value->internalRep.longValue); + } + + if (value->typePtr == &tclListType) { + int size; + int i, status; + PyObject *elem; + Tcl_Obj *tcl_elem; + + status = Tcl_ListObjLength(Tkapp_Interp(tkapp), value, &size); + if (status == TCL_ERROR) + return Tkinter_Error(tkapp); + result = PyTuple_New(size); + if (!result) + return NULL; + for (i = 0; i < size; i++) { + status = Tcl_ListObjIndex(Tkapp_Interp(tkapp), + value, i, &tcl_elem); + if (status == TCL_ERROR) { + Py_DECREF(result); + return Tkinter_Error(tkapp); + } + elem = FromObj(tkapp, tcl_elem); + if (!elem) { + Py_DECREF(result); + return NULL; + } + PyTuple_SetItem(result, i, elem); + } + return result; + } + + if (value->typePtr == &tclProcBodyType) { + // fall through: return tcl object + } + + if (value->typePtr == &tclStringType) { + #ifdef Py_USING_UNICODE + #ifdef Py_UNICODE_WIDE + PyObject *result; + int size; + Tcl_UniChar *input; + Py_UNICODE *output; + + size = Tcl_GetCharLength(value); + result = PyUnicode_FromUnicode(NULL, size); + if (!result) + return NULL; + input = Tcl_GetUnicode(value); + output = PyUnicode_AS_UNICODE(result); + while (size--) + *output++ = *input++; + return result; + #else + return PyUnicode_FromUnicode(Tcl_GetUnicode(value), + Tcl_GetCharLength(value)); + #endif + #else + int size; + char *c; + c = Tcl_GetStringFromObj(value, &size); + return PyString_FromStringAndSize(c, size); + #endif + } + + return newPyTclObject(value); + } + static PyObject * Tkapp_Call(PyObject *self, PyObject *args) *************** *** 640,646 **** if (i == TCL_ERROR) Tkinter_Error(self); ! else { ! /* We could request the object result here, but doing ! so would confuse applications that expect a string. */ const char *s = Tcl_GetStringResult(interp); const char *p = s; --- 902,914 ---- if (i == TCL_ERROR) Tkinter_Error(self); ! else if(((TkappObject*)self)->want_objects) { ! Tcl_Obj *value = Tcl_GetObjResult(interp); ! /* Not sure whether the IncrRef is necessary, but something ! may overwrite the interpreter result while we are ! converting it. */ ! Tcl_IncrRefCount(value); ! res = FromObj(self, value); ! Tcl_DecrRefCount(value); ! } else { const char *s = Tcl_GetStringResult(interp); const char *p = s; *************** *** 965,968 **** --- 1233,1243 ---- int v; + if (PyTuple_Size(args) == 1) { + PyObject* o = PyTuple_GetItem(args, 0); + if (PyInt_Check(o)) { + Py_INCREF(o); + return o; + } + } if (!PyArg_ParseTuple(args, "s:getint", &s)) return NULL; *************** *** 978,981 **** --- 1253,1263 ---- double v; + if (PyTuple_Size(args) == 1) { + PyObject *o = PyTuple_GetItem(args, 0); + if (PyFloat_Check(o)) { + Py_INCREF(o); + return o; + } + } if (!PyArg_ParseTuple(args, "s:getdouble", &s)) return NULL; *************** *** 991,994 **** --- 1273,1283 ---- int v; + if (PyTuple_Size(args) == 1) { + PyObject *o = PyTuple_GetItem(args, 0); + if (PyInt_Check(o)) { + Py_INCREF(o); + return o; + } + } if (!PyArg_ParseTuple(args, "s:getboolean", &s)) return NULL; *************** *** 1094,1097 **** --- 1383,1393 ---- int i; + if (PyTuple_Size(args) == 1) { + v = PyTuple_GetItem(args, 0); + if (PyTuple_Check(v)) { + Py_INCREF(v); + return v; + } + } if (!PyArg_ParseTuple(args, "et:splitlist", "utf-8", &list)) return NULL; *************** *** 1122,1125 **** --- 1418,1428 ---- char *list; + if (PyTuple_Size(args) == 1) { + PyObject* o = PyTuple_GetItem(args, 0); + if (PyTuple_Check(o)) { + o = SplitObj(o); + return o; + } + } if (!PyArg_ParseTuple(args, "et:split", "utf-8", &list)) return NULL; *************** *** 1661,1664 **** --- 1964,1981 ---- + static PyObject * + Tkapp_WantObjects(PyObject *self, PyObject *args) + { + + int want_objects; + if (!PyArg_ParseTuple(args, "i:wantobjects", &want_objects)) + return NULL; + ((TkappObject*)self)->want_objects = want_objects; + + Py_INCREF(Py_None); + return Py_None; + } + + /**** Tkapp Method List ****/ *************** *** 1666,1669 **** --- 1983,1987 ---- static PyMethodDef Tkapp_methods[] = { + {"wantobjects", Tkapp_WantObjects, METH_VARARGS}, {"call", Tkapp_Call, METH_OLDARGS}, {"globalcall", Tkapp_GlobalCall, METH_OLDARGS}, *************** *** 1862,1865 **** --- 2180,2184 ---- char *className = NULL; int interactive = 0; + int want_objects = 0; baseName = strrchr(Py_GetProgramName(), '/'); *************** *** 1872,1880 **** if (!PyArg_ParseTuple(args, "|zssi:create", &screenName, &baseName, &className, ! &interactive)) return NULL; return (PyObject *) Tkapp_New(screenName, baseName, className, ! interactive); } --- 2191,2199 ---- if (!PyArg_ParseTuple(args, "|zssi:create", &screenName, &baseName, &className, ! &interactive, &want_objects)) return NULL; return (PyObject *) Tkapp_New(screenName, baseName, className, ! interactive, want_objects); } *************** *** 2046,2049 **** --- 2365,2370 ---- PyDict_SetItemString(d, "TkttType", (PyObject *)&Tktt_Type); + PyTclObject_Type.ob_type = &PyType_Type; + PyDict_SetItemString(d, "Tcl_Obj", (PyObject *)&PyTclObject_Type); #ifdef TK_AQUA From mwh@users.sourceforge.net Tue Nov 26 09:42:59 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 26 Nov 2002 01:42:59 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils sysconfig.py,1.44.6.2,1.44.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv4620 Modified Files: Tag: release22-maint sysconfig.py Log Message: Backport my (!) revision 1.50: Well, Fred never did explain why the code to determine whether the calling Python was installed was so complicated, so I simplified it. This should get the snake-farm's build scripts working again. Index: sysconfig.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/sysconfig.py,v retrieving revision 1.44.6.2 retrieving revision 1.44.6.3 diff -C2 -d -r1.44.6.2 -r1.44.6.3 *** sysconfig.py 8 Oct 2002 14:59:43 -0000 1.44.6.2 --- sysconfig.py 26 Nov 2002 09:42:57 -0000 1.44.6.3 *************** *** 30,40 **** argv0_path = os.path.dirname(os.path.abspath(sys.executable)) landmark = os.path.join(argv0_path, "Modules", "Setup") ! if not os.path.isfile(landmark): ! python_build = 0 ! elif os.path.isfile(os.path.join(argv0_path, "Lib", "os.py")): ! python_build = 1 ! else: ! python_build = os.path.isfile(os.path.join(os.path.dirname(argv0_path), ! "Lib", "os.py")) del argv0_path, landmark --- 30,36 ---- argv0_path = os.path.dirname(os.path.abspath(sys.executable)) landmark = os.path.join(argv0_path, "Modules", "Setup") ! ! python_build = os.path.isfile(landmark) ! del argv0_path, landmark From loewis@users.sourceforge.net Tue Nov 26 09:47:27 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 26 Nov 2002 01:47:27 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.73,1.74 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv6823/Doc/whatsnew Modified Files: whatsnew23.tex Log Message: Report Tkinter changes. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** whatsnew23.tex 25 Nov 2002 16:02:13 -0000 1.73 --- whatsnew23.tex 26 Nov 2002 09:47:25 -0000 1.74 *************** *** 1277,1280 **** --- 1277,1304 ---- per-use basis. + \item Calling Tcl methods through \module{_tkinter} now does not + always return strings anymore. Instead, if Tcl returns other objects, + those objects are converted to their Python equivalent, if one exists, + or wrapped with a \class{_tkinter.Tcl_Obj} object if no Python + equivalent exists. This behaviour can be controlled through the + \method{wantobjects} method of \class{tkapp} objects. + + When using _tkinter through Tkinter.py (i.e. for most _tkinter + applications), this feature is always activated. It should not cause + compatibility problems, since Tkinter would always convert string + results to Python types were possible. + + If any incompatibilities are found, the old behaviour can be restored + by invoking + + \begin{verbatim} + import Tkinter + Tkinter.want_objects = 0 + \end{verbatim} + + before creating the first \class{tkapp} object. + + Please report any such breakage as a bug. + \end{itemize} From jvr@users.sourceforge.net Tue Nov 26 09:53:19 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Tue, 26 Nov 2002 01:53:19 -0800 Subject: [Python-checkins] python/dist/src/Tools/freeze modulefinder.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/freeze In directory sc8-pr-cvs1:/tmp/cvs-serv9368 Modified Files: modulefinder.py Log Message: refactor universal line endings detection Index: modulefinder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/modulefinder.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** modulefinder.py 26 Nov 2002 08:06:50 -0000 1.26 --- modulefinder.py 26 Nov 2002 09:53:16 -0000 1.27 *************** *** 10,13 **** --- 10,19 ---- import new + if hasattr(sys.__stdout__, "newlines"): + READ_MODE = "U" # universal line endings + else: + # remain compatible with Python < 2.3 + READ_MODE = "r" + IMPORT_NAME = dis.opname.index('IMPORT_NAME') IMPORT_FROM = dis.opname.index('IMPORT_FROM') *************** *** 96,103 **** def run_script(self, pathname): self.msg(2, "run_script", pathname) ! if hasattr(sys.stdout, "newlines"): # detect universal newline support ! fp = open(pathname, "U") ! else: ! fp = open(pathname, "r") stuff = ("", "r", imp.PY_SOURCE) self.load_module('__main__', fp, pathname, stuff) --- 102,106 ---- def run_script(self, pathname): self.msg(2, "run_script", pathname) ! fp = open(pathname, READ_MODE) stuff = ("", "r", imp.PY_SOURCE) self.load_module('__main__', fp, pathname, stuff) *************** *** 106,113 **** dir, name = os.path.split(pathname) name, ext = os.path.splitext(name) ! if hasattr(sys.stdout, "newlines"): ! fp = open(pathname, "U") ! else: ! fp = open(pathname, "r") stuff = (ext, "r", imp.PY_SOURCE) self.load_module(name, fp, pathname, stuff) --- 109,113 ---- dir, name = os.path.split(pathname) name, ext = os.path.splitext(name) ! fp = open(pathname, READ_MODE) stuff = (ext, "r", imp.PY_SOURCE) self.load_module(name, fp, pathname, stuff) From akuchling@users.sourceforge.net Tue Nov 26 12:31:11 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 26 Nov 2002 04:31:11 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.543,1.544 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv325 Modified Files: NEWS Log Message: Fix typo Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.543 retrieving revision 1.544 diff -C2 -d -r1.543 -r1.544 *** NEWS 26 Nov 2002 09:28:05 -0000 1.543 --- NEWS 26 Nov 2002 12:31:09 -0000 1.544 *************** *** 318,322 **** or Tkinter.want_objects. ! - The PyBSDDB wrapper around the Sleepycat Berkely DB library has been added as the package bsddb. The traditional bsddb module is still available in source code, but not built automatically anymore, and --- 318,322 ---- or Tkinter.want_objects. ! - The PyBSDDB wrapper around the Sleepycat Berkeley DB library has been added as the package bsddb. The traditional bsddb module is still available in source code, but not built automatically anymore, and From guido@python.org Tue Nov 26 13:23:20 2002 From: guido@python.org (Guido van Rossum) Date: Tue, 26 Nov 2002 08:23:20 -0500 Subject: [Python-checkins] python/dist/src/Tools/freeze modulefinder.py,1.24,1.25 In-Reply-To: Your message of "Tue, 26 Nov 2002 00:05:11 PST." References: Message-ID: <200211261323.gAQDNLv05469@pcp02138704pcs.reston01.va.comcast.net> > Log Message: > Don't look for modules in the registry any longer. > > Mark writes in private email: > > "Modules listed in the registry was a dumb idea. This whole scheme > can die. AFAIK, no one in the world uses it (including win32all > since the last build)." > > (See also SF #643711) Woo hoo! Hurray! --Guido van Rossum (home page: http://www.python.org/~guido/) From mwh@users.sourceforge.net Tue Nov 26 14:47:29 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 26 Nov 2002 06:47:29 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.162,1.163 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv18876/Lib/test Modified Files: test_descr.py Log Message: This is my patch: [ 635933 ] make some type attrs writable Plus a couple of extra tests beyond what's up there. It hasn't been as carefully reviewed as it perhaps should, so all readers are encouraged, nay exhorted, to give this a close reading. There are still a couple of oddities related to assigning to __name__, but I intend to solicit python-dev's opinions on these. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.162 retrieving revision 1.163 diff -C2 -d -r1.162 -r1.163 *** test_descr.py 25 Nov 2002 21:38:52 -0000 1.162 --- test_descr.py 26 Nov 2002 14:47:27 -0000 1.163 *************** *** 3435,3438 **** --- 3435,3525 ---- type.mro(tuple) + def mutable_bases(): + # stuff that should work: + class C(object): + pass + class C2(object): + def __getattribute__(self, attr): + if attr == 'a': + return 2 + else: + return super(C2, self).__getattribute__(attr) + def meth(self): + return 1 + class D(C): + pass + class E(D): + pass + d = D() + e = E() + D.__bases__ = (C2,) + vereq(d.meth(), 1) + vereq(e.meth(), 1) + vereq(d.a, 2) + vereq(e.a, 2) + vereq(C2.__subclasses__(), [D]) + + # stuff that shouldn't: + class L(list): + pass + + try: + L.__bases__ = (dict,) + except TypeError: + pass + else: + raise TestFailed, "shouldn't turn list subclass into dict subclass" + + try: + list.__bases__ = (dict,) + except TypeError: + pass + else: + raise TestFailed, "shouldn't be able to assign to list.__bases__" + + try: + del D.__bases__ + except TypeError: + pass + else: + raise TestFailed, "shouldn't be able to delete .__bases__" + + try: + D.__bases__ = (D,) + except TypeError: + pass + else: + # actually, we'll have crashed by here... + raise TestFailed, "shouldn't be able to create inheritance cycles" + + # let's throw a classic class into the mix: + class Classic: + def meth2(self): + return 3 + + D.__bases__ = (C, Classic) + + vereq(d.meth2(), 3) + vereq(e.meth2(), 3) + try: + d.a + except AttributeError: + pass + else: + raise TestFailed, "attribute should have vanished" + + try: + D.__bases__ = (Classic,) + except TypeError: + pass + else: + raise TestFailed, "new-style class must have a new-style base" + + def mutable_names(): + class C(object): + pass + + C.__name__ = 'C' + def test_main(): do_this_first() *************** *** 3514,3517 **** --- 3601,3606 ---- testrmul() testipow() + mutable_bases() + mutable_names() if verbose: print "All OK" From mwh@users.sourceforge.net Tue Nov 26 14:47:29 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 26 Nov 2002 06:47:29 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.188,2.189 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv18876/Objects Modified Files: typeobject.c Log Message: This is my patch: [ 635933 ] make some type attrs writable Plus a couple of extra tests beyond what's up there. It hasn't been as carefully reviewed as it perhaps should, so all readers are encouraged, nay exhorted, to give this a close reading. There are still a couple of oddities related to assigning to __name__, but I intend to solicit python-dev's opinions on these. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.188 retrieving revision 2.189 diff -C2 -d -r2.188 -r2.189 *** typeobject.c 25 Nov 2002 21:36:54 -0000 2.188 --- typeobject.c 26 Nov 2002 14:47:26 -0000 2.189 *************** *** 33,37 **** {"__dictoffset__", T_LONG, offsetof(PyTypeObject, tp_dictoffset), READONLY}, - {"__bases__", T_OBJECT, offsetof(PyTypeObject, tp_bases), READONLY}, {"__mro__", T_OBJECT, offsetof(PyTypeObject, tp_mro), READONLY}, {0} --- 33,36 ---- *************** *** 51,54 **** --- 50,93 ---- } + static int + type_set_name(PyTypeObject *type, PyObject *value, void *context) + { + etype* et; + + if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { + PyErr_Format(PyExc_TypeError, + "can't set %s.__name__", type->tp_name); + return -1; + } + if (!value) { + PyErr_Format(PyExc_TypeError, + "can't delete %s.__name__", type->tp_name); + return -1; + } + if (!PyString_Check(value)) { + PyErr_Format(PyExc_TypeError, + "can only assign string to %s.__name__, not '%s'", + type->tp_name, value->ob_type->tp_name); + return -1; + } + if (strlen(PyString_AS_STRING(value)) + != (size_t)PyString_GET_SIZE(value)) { + PyErr_Format(PyExc_ValueError, + "__name__ must not contain null bytes"); + return -1; + } + + et = (etype*)type; + + Py_INCREF(value); + + Py_DECREF(et->name); + et->name = value; + + type->tp_name = PyString_AS_STRING(value); + + return 0; + } + static PyObject * type_module(PyTypeObject *type, void *context) *************** *** 64,68 **** return PyString_FromString("__builtin__"); mod = PyDict_GetItemString(type->tp_dict, "__module__"); ! if (mod != NULL && PyString_Check(mod)) { Py_INCREF(mod); return mod; --- 103,107 ---- return PyString_FromString("__builtin__"); mod = PyDict_GetItemString(type->tp_dict, "__module__"); ! if (mod != NULL) { Py_INCREF(mod); return mod; *************** *** 75,80 **** type_set_module(PyTypeObject *type, PyObject *value, void *context) { ! if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) || ! strrchr(type->tp_name, '.')) { PyErr_Format(PyExc_TypeError, "can't set %s.__module__", type->tp_name); --- 114,118 ---- type_set_module(PyTypeObject *type, PyObject *value, void *context) { ! if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { PyErr_Format(PyExc_TypeError, "can't set %s.__module__", type->tp_name); *************** *** 86,93 **** --- 124,286 ---- return -1; } + return PyDict_SetItemString(type->tp_dict, "__module__", value); } static PyObject * + type_get_bases(PyTypeObject *type, void *context) + { + Py_INCREF(type->tp_bases); + return type->tp_bases; + } + + static PyTypeObject *best_base(PyObject *); + static int mro_internal(PyTypeObject *); + static int compatible_for_assignment(PyTypeObject *, PyTypeObject *, char *); + static int add_subclass(PyTypeObject*, PyTypeObject*); + static void remove_subclass(PyTypeObject *, PyTypeObject *); + static void update_all_slots(PyTypeObject *); + + static int + mro_subclasses(PyTypeObject *type) + { + PyTypeObject *subclass; + PyObject *ref, *subclasses, *old_mro; + int i, n, r; + + subclasses = type->tp_subclasses; + if (subclasses == NULL) + return 0; + assert(PyList_Check(subclasses)); + n = PyList_GET_SIZE(subclasses); + for (i = 0; i < n; i++) { + ref = PyList_GET_ITEM(subclasses, i); + assert(PyWeakref_CheckRef(ref)); + subclass = (PyTypeObject *)PyWeakref_GET_OBJECT(ref); + assert(subclass != NULL); + if ((PyObject *)subclass == Py_None) + continue; + assert(PyType_Check(subclass)); + old_mro = subclass->tp_mro; + if (mro_internal(subclass) < 0) { + subclass->tp_mro = old_mro; + r = -1; + } + else { + Py_DECREF(old_mro); + } + if (mro_subclasses(subclass) < 0) + r = -1; + } + return r; + } + + static int + type_set_bases(PyTypeObject *type, PyObject *value, void *context) + { + int i, r = 0; + PyObject* ob; + PyTypeObject *new_base, *old_base; + PyObject *old_bases, *old_mro; + + if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { + PyErr_Format(PyExc_TypeError, + "can't set %s.__bases__", type->tp_name); + return -1; + } + if (!value) { + PyErr_Format(PyExc_TypeError, + "can't delete %s.__bases__", type->tp_name); + return -1; + } + if (!PyTuple_Check(value)) { + PyErr_Format(PyExc_TypeError, + "can only assign tuple to %s.__bases__, not %s", + type->tp_name, value->ob_type->tp_name); + return -1; + } + for (i = 0; i < PyTuple_GET_SIZE(value); i++) { + ob = PyTuple_GET_ITEM(value, i); + if (!PyClass_Check(ob) && !PyType_Check(ob)) { + PyErr_Format( + PyExc_TypeError, + "%s.__bases__ must be tuple of old- or new-style classes, not '%s'", + type->tp_name, ob->ob_type->tp_name); + return -1; + } + if (PyType_IsSubtype(type, (PyTypeObject*)ob)) { + PyErr_SetString(PyExc_TypeError, + "a __bases__ item causes an inheritance cycle"); + return -1; + } + } + + new_base = best_base(value); + + if (!new_base) { + return -1; + } + + if (!compatible_for_assignment(type->tp_base, new_base, "__bases__")) + return -1; + + Py_INCREF(new_base); + Py_INCREF(value); + + old_bases = type->tp_bases; + old_base = type->tp_base; + old_mro = type->tp_mro; + + type->tp_bases = value; + type->tp_base = new_base; + + if (mro_internal(type) < 0) { + type->tp_bases = old_bases; + type->tp_base = old_base; + type->tp_mro = old_mro; + + Py_DECREF(value); + Py_DECREF(new_base); + + return -1; + } + + if (mro_subclasses(type) < 0) + r = -1; + + /* any base that was in __bases__ but now isn't, we + need to remove |type| from it's tp_subclasses. + conversely, any class now in __bases__ that wasn't + needs to have |type| added to it's subclasses. */ + + /* for now, sod that: just remove from all old_bases, + add to all new_bases */ + + for (i = PyTuple_GET_SIZE(old_bases) - 1; i >= 0; i--) { + ob = PyTuple_GET_ITEM(old_bases, i); + if (PyType_Check(ob)) { + remove_subclass( + (PyTypeObject*)ob, type); + } + } + + for (i = PyTuple_GET_SIZE(value) - 1; i >= 0; i--) { + ob = PyTuple_GET_ITEM(value, i); + if (PyType_Check(ob)) { + if (add_subclass((PyTypeObject*)ob, type) < 0) + r = -1; + } + } + + update_all_slots(type); + + Py_DECREF(old_bases); + Py_DECREF(old_base); + Py_DECREF(old_mro); + + return r; + } + + static PyObject * type_dict(PyTypeObject *type, void *context) { *************** *** 121,125 **** static PyGetSetDef type_getsets[] = { ! {"__name__", (getter)type_name, NULL, NULL}, {"__module__", (getter)type_module, (setter)type_set_module, NULL}, {"__dict__", (getter)type_dict, NULL, NULL}, --- 314,319 ---- static PyGetSetDef type_getsets[] = { ! {"__name__", (getter)type_name, (setter)type_set_name, NULL}, ! {"__bases__", (getter)type_get_bases, (setter)type_set_bases, NULL}, {"__module__", (getter)type_module, (setter)type_set_module, NULL}, {"__dict__", (getter)type_dict, NULL, NULL}, *************** *** 2027,2034 **** static int object_set_class(PyObject *self, PyObject *value, void *closure) { PyTypeObject *old = self->ob_type; ! PyTypeObject *new, *newbase, *oldbase; if (value == NULL) { --- 2221,2265 ---- static int + compatible_for_assignment(PyTypeObject* old, PyTypeObject* new, char* attr) + { + PyTypeObject *newbase, *oldbase; + + if (new->tp_dealloc != old->tp_dealloc || + new->tp_free != old->tp_free) + { + PyErr_Format(PyExc_TypeError, + "%s assignment: " + "'%s' deallocator differs from '%s'", + attr, + new->tp_name, + old->tp_name); + return 0; + } + newbase = new; + oldbase = old; + while (equiv_structs(newbase, newbase->tp_base)) + newbase = newbase->tp_base; + while (equiv_structs(oldbase, oldbase->tp_base)) + oldbase = oldbase->tp_base; + if (newbase != oldbase && + (newbase->tp_base != oldbase->tp_base || + !same_slots_added(newbase, oldbase))) { + PyErr_Format(PyExc_TypeError, + "%s assignment: " + "'%s' object layout differs from '%s'", + attr, + new->tp_name, + old->tp_name); + return 0; + } + + return 1; + } + + static int object_set_class(PyObject *self, PyObject *value, void *closure) { PyTypeObject *old = self->ob_type; ! PyTypeObject *new; if (value == NULL) { *************** *** 2051,2084 **** return -1; } ! if (new->tp_dealloc != old->tp_dealloc || ! new->tp_free != old->tp_free) ! { ! PyErr_Format(PyExc_TypeError, ! "__class__ assignment: " ! "'%s' deallocator differs from '%s'", ! new->tp_name, ! old->tp_name); ! return -1; } ! newbase = new; ! oldbase = old; ! while (equiv_structs(newbase, newbase->tp_base)) ! newbase = newbase->tp_base; ! while (equiv_structs(oldbase, oldbase->tp_base)) ! oldbase = oldbase->tp_base; ! if (newbase != oldbase && ! (newbase->tp_base != oldbase->tp_base || ! !same_slots_added(newbase, oldbase))) { ! PyErr_Format(PyExc_TypeError, ! "__class__ assignment: " ! "'%s' object layout differs from '%s'", ! new->tp_name, ! old->tp_name); return -1; } - Py_INCREF(new); - self->ob_type = new; - Py_DECREF(old); - return 0; } --- 2282,2294 ---- return -1; } ! if (compatible_for_assignment(new, old, "__class__")) { ! Py_INCREF(new); ! self->ob_type = new; ! Py_DECREF(old); ! return 0; } ! else { return -1; } } *************** *** 2479,2483 **** static int add_operators(PyTypeObject *); - static int add_subclass(PyTypeObject *base, PyTypeObject *type); int --- 2689,2692 ---- *************** *** 2642,2645 **** --- 2851,2876 ---- } + static void + remove_subclass(PyTypeObject *base, PyTypeObject *type) + { + int i; + PyObject *list, *ref; + + list = base->tp_subclasses; + if (list == NULL) { + return; + } + assert(PyList_Check(list)); + i = PyList_GET_SIZE(list); + while (--i >= 0) { + ref = PyList_GET_ITEM(list, i); + assert(PyWeakref_CheckRef(ref)); + if (PyWeakref_GET_OBJECT(ref) == (PyObject*)type) { + /* this can't fail, right? */ + PySequence_DelItem(list, i); + return; + } + } + } /* Generic wrappers for overloadable 'operators' such as __getitem__ */ *************** *** 4555,4558 **** --- 4786,4801 ---- for (p = slotdefs; p->name; ) p = update_one_slot(type, p); + } + + static void + update_all_slots(PyTypeObject* type) + { + slotdef *p; + + init_slotdefs(); + for (p = slotdefs; p->name; p++) { + /* update_slot returns int but can't actually fail */ + update_slot(type, p->name_strobj); + } } From mwh@users.sourceforge.net Tue Nov 26 14:48:25 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 26 Nov 2002 06:48:25 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.544,1.545 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv21144/Misc Modified Files: NEWS Log Message: This is not part of my patch [ 635933 ] make some type attrs writable but should have been! News about the above. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.544 retrieving revision 1.545 diff -C2 -d -r1.544 -r1.545 *** NEWS 26 Nov 2002 12:31:09 -0000 1.544 --- NEWS 26 Nov 2002 14:48:23 -0000 1.545 *************** *** 13,16 **** --- 13,18 ---- -------------------------------------------- + - One can now assign to __bases__ and __name__ of new-style classes. + - dict() now accepts keyword arguments so that dict(one=1, two=2) is the equivalent of {"one": 1, "two": 2}. Accordingly, From mwh@users.sourceforge.net Tue Nov 26 14:48:26 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 26 Nov 2002 06:48:26 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.74,1.75 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv21144/Doc/whatsnew Modified Files: whatsnew23.tex Log Message: This is not part of my patch [ 635933 ] make some type attrs writable but should have been! News about the above. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** whatsnew23.tex 26 Nov 2002 09:47:25 -0000 1.74 --- whatsnew23.tex 26 Nov 2002 14:48:23 -0000 1.75 *************** *** 897,900 **** --- 897,907 ---- \end{verbatim} + \item One of the noted incompatibilities between old- and new-style + classes has been removed: you can now assign to the + \member{__name__} and \member{__bases__} attributes of new-style + classes. There are some restrictions on what can be assigned to + \member{__bases__} along the lines of those relating to assigning to + an instance's \member{__class__} attribute. + \end{itemize} From tim_one@users.sourceforge.net Tue Nov 26 17:18:10 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 26 Nov 2002 09:18:10 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime test_both.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv23171 Modified Files: test_both.py Log Message: Simplified test-suite creation code. Index: test_both.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_both.py 26 Nov 2002 03:23:10 -0000 1.3 --- test_both.py 26 Nov 2002 17:18:07 -0000 1.4 *************** *** 356,362 **** def test_suite(): s1 = unittest.makeSuite(TestTimeDelta, 'test') s2 = unittest.makeSuite(TestDate, 'test') ! return unittest.TestSuite([s1, s2]) def test_main(): --- 356,367 ---- def test_suite(): + allsuites = [unittest.makeSuite(klass, 'test') + for klass in (TestTimeDelta, + TestDate, + ) + ] s1 = unittest.makeSuite(TestTimeDelta, 'test') s2 = unittest.makeSuite(TestDate, 'test') ! return unittest.TestSuite(allsuites) def test_main(): From tim_one@users.sourceforge.net Tue Nov 26 17:19:41 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 26 Nov 2002 09:19:41 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime test_both.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv23694 Modified Files: test_both.py Log Message: Heh -- deleted the code that the last checkin made redundant (which was the point of the last checkin!). Index: test_both.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_both.py 26 Nov 2002 17:18:07 -0000 1.4 --- test_both.py 26 Nov 2002 17:19:39 -0000 1.5 *************** *** 361,366 **** ) ] - s1 = unittest.makeSuite(TestTimeDelta, 'test') - s2 = unittest.makeSuite(TestDate, 'test') return unittest.TestSuite(allsuites) --- 361,364 ---- From tim_one@users.sourceforge.net Tue Nov 26 17:26:21 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 26 Nov 2002 09:26:21 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime test_both.py,1.5,1.6 test_cdatetime.py,1.8,1.9 test_datetime.py,1.48,1.49 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv27057 Modified Files: test_both.py test_cdatetime.py test_datetime.py Log Message: XXX-commented the two tests that still fail in the C implementation. Began the process of moving datetime tests into test_both. Index: test_both.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_both.py 26 Nov 2002 17:19:39 -0000 1.5 --- test_both.py 26 Nov 2002 17:26:17 -0000 1.6 *************** *** 55,58 **** --- 55,59 ---- self.assertEqual(a*10, timedelta(70)) self.assertEqual(a*10, 10*a) + # XXX Next one fails in the C implementation. self.assertEqual(a*10L, 10*a) self.assertEqual(b*10, timedelta(0, 600)) *************** *** 332,336 **** # 3652058 days, 23 hours, 59 minutes, 59 seconds, 999999 microseconds n = (big.days*24*3600 + big.seconds)*1000000 + big.microseconds ! # n = 315537897599999999 ~= 2**58.13 justasbig = timedelta(0, 0, n) self.assertEqual(big, justasbig) --- 333,338 ---- # 3652058 days, 23 hours, 59 minutes, 59 seconds, 999999 microseconds n = (big.days*24*3600 + big.seconds)*1000000 + big.microseconds ! # n == 315537897599999999 ~= 2**58.13 ! # XXX Next line fails in the C implementation. justasbig = timedelta(0, 0, n) self.assertEqual(big, justasbig) *************** *** 354,357 **** --- 356,376 ---- self.assertEqual(t, (1956, 3, 1+i, 0, 0, 0, (3+i)%7, 61+i, -1)) + ############################################################################# + # datetime tests + + class TestDateTime(unittest.TestCase): + + theclass = datetime.datetime + + def test_basic_attributes(self): + dt = self.theclass(2002, 3, 1, 12, 0) + self.assertEqual(dt.year, 2002) + self.assertEqual(dt.month, 3) + self.assertEqual(dt.day, 1) + self.assertEqual(dt.hour, 12) + self.assertEqual(dt.minute, 0) + self.assertEqual(dt.second, 0) + self.assertEqual(dt.microsecond, 0) + def test_suite(): *************** *** 359,362 **** --- 378,382 ---- for klass in (TestTimeDelta, TestDate, + TestDateTime, ) ] Index: test_cdatetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_cdatetime.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_cdatetime.py 26 Nov 2002 06:27:24 -0000 1.8 --- test_cdatetime.py 26 Nov 2002 17:26:18 -0000 1.9 *************** *** 31,44 **** theclass = datetime - def test_basic_attributes(self): - dt = self.theclass(2002, 3, 1, 12, 0) - self.assertEqual(dt.year, 2002) - self.assertEqual(dt.month, 3) - self.assertEqual(dt.day, 1) - self.assertEqual(dt.hour, 12) - self.assertEqual(dt.minute, 0) - self.assertEqual(dt.second, 0) - self.assertEqual(dt.microsecond, 0) - def test_basic_attributes_nonzero(self): # Make sure all attributes are non-zero so bugs in --- 31,34 ---- Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_datetime.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** test_datetime.py 26 Nov 2002 05:11:25 -0000 1.48 --- test_datetime.py 26 Nov 2002 17:26:18 -0000 1.49 *************** *** 215,228 **** theclass = datetime - def test_basic_attributes(self): - dt = self.theclass(2002, 3, 1, 12, 0, 0) - self.assertEqual(dt.year, 2002) - self.assertEqual(dt.month, 3) - self.assertEqual(dt.day, 1) - self.assertEqual(dt.hour, 12) - self.assertEqual(dt.minute, 0) - self.assertEqual(dt.second, 0) - self.assertEqual(dt.microsecond, 0) - def test_basic_attributes_nonzero(self): # Make sure all attributes are non-zero so bugs in --- 215,218 ---- From tim_one@users.sourceforge.net Tue Nov 26 17:31:24 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 26 Nov 2002 09:31:24 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime test_both.py,1.6,1.7 test_cdatetime.py,1.9,1.10 test_datetime.py,1.49,1.50 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv29160 Modified Files: test_both.py test_cdatetime.py test_datetime.py Log Message: Moving more datetime tests into test_both. Index: test_both.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_both.py 26 Nov 2002 17:26:17 -0000 1.6 --- test_both.py 26 Nov 2002 17:31:20 -0000 1.7 *************** *** 373,376 **** --- 373,403 ---- self.assertEqual(dt.microsecond, 0) + def test_basic_attributes_nonzero(self): + # Make sure all attributes are non-zero so bugs in + # bit-shifting access show up. + dt = self.theclass(2002, 3, 1, 12, 59, 59, 8000) + self.assertEqual(dt.year, 2002) + self.assertEqual(dt.month, 3) + self.assertEqual(dt.day, 1) + self.assertEqual(dt.hour, 12) + self.assertEqual(dt.minute, 59) + self.assertEqual(dt.second, 59) + self.assertEqual(dt.microsecond, 8000) + + def test_roundtrip(self): + for dt in (self.theclass(1, 2, 3, 4, 5, 6, 7), + self.theclass.now()): + # Verify dt -> string -> datetime identity. + s = 'datetime.' + repr(dt) + dt2 = eval(s) + self.assertEqual(dt, dt2) + + # Verify identity via reconstructing from pieces. + dt2 = self.theclass(dt.year, dt.month, dt.day, + dt.hour, dt.minute, dt.second, + dt.microsecond) + self.assertEqual(dt, dt2) + + def test_suite(): Index: test_cdatetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_cdatetime.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_cdatetime.py 26 Nov 2002 17:26:18 -0000 1.9 --- test_cdatetime.py 26 Nov 2002 17:31:20 -0000 1.10 *************** *** 31,60 **** theclass = datetime - def test_basic_attributes_nonzero(self): - # Make sure all attributes are non-zero so bugs in - # bit-shifting access show up. - dt = self.theclass(2002, 3, 1, 12, 59, 59, 8000) - self.assertEqual(dt.year, 2002) - self.assertEqual(dt.month, 3) - self.assertEqual(dt.day, 1) - self.assertEqual(dt.hour, 12) - self.assertEqual(dt.minute, 59) - self.assertEqual(dt.second, 59) - self.assertEqual(dt.microsecond, 8000) - - def test_roundtrip(self): - for dt in (self.theclass(1, 2, 3, 4, 5, 6, 7), - self.theclass.now()): - # Verify dt -> string -> datetime identity. - s = repr(dt) - dt2 = eval(s) - self.assertEqual(dt, dt2) - - # Verify identity via reconstructing from pieces. - dt2 = self.theclass(dt.year, dt.month, dt.day, - dt.hour, dt.minute, dt.second, - dt.microsecond) - self.assertEqual(dt, dt2) - def test_isocalendar(self): # Check examples from --- 31,34 ---- Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_datetime.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** test_datetime.py 26 Nov 2002 17:26:18 -0000 1.49 --- test_datetime.py 26 Nov 2002 17:31:21 -0000 1.50 *************** *** 215,244 **** theclass = datetime - def test_basic_attributes_nonzero(self): - # Make sure all attributes are non-zero so bugs in - # bit-shifting access show up. - dt = self.theclass(2002, 3, 1, 12, 59, 59, 8000) - self.assertEqual(dt.year, 2002) - self.assertEqual(dt.month, 3) - self.assertEqual(dt.day, 1) - self.assertEqual(dt.hour, 12) - self.assertEqual(dt.minute, 59) - self.assertEqual(dt.second, 59) - self.assertEqual(dt.microsecond, 8000) - - def test_roundtrip(self): - for dt in (self.theclass(1, 2, 3, 4, 5, 6, 7), - self.theclass.now()): - # Verify dt -> string -> datetime identity. - s = repr(dt) - dt2 = eval(s) - self.assertEqual(dt, dt2) - - # Verify identity via reconstructing from pieces. - dt2 = self.theclass(dt.year, dt.month, dt.day, - dt.hour, dt.minute, dt.second, - dt.microsecond) - self.assertEqual(dt, dt2) - def test_tz_independent_comparing(self): dt1 = self.theclass(2002, 3, 1, 9, 0, 0) --- 215,218 ---- From tim_one@users.sourceforge.net Tue Nov 26 17:37:00 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 26 Nov 2002 09:37:00 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime test_both.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv30734 Modified Files: test_both.py Log Message: Eek! There's a subtle discrepancy between the Python and C versions of the TestDateTime class I hadn't noticed at first. Just noted it here; since "fixing it" causes more problems, I'm skipping that for now. It should be fixed, though. Index: test_both.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_both.py 26 Nov 2002 17:31:20 -0000 1.7 --- test_both.py 26 Nov 2002 17:36:56 -0000 1.8 *************** *** 359,362 **** --- 359,366 ---- # datetime tests + # XXX The Python version of this test class inherits from TestDate. And + # XXX it should. Trying it here, though, causes 4 new errors when the + # XXX C implementation is getting tested. + class TestDateTime(unittest.TestCase): From akuchling@users.sourceforge.net Tue Nov 26 17:42:51 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 26 Nov 2002 09:42:51 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils dir_util.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv974 Modified Files: dir_util.py Log Message: Part of the fix for bug #410541: add ensure_relative() function Index: dir_util.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dir_util.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dir_util.py 19 Nov 2002 13:12:27 -0000 1.11 --- dir_util.py 26 Nov 2002 17:42:48 -0000 1.12 *************** *** 7,11 **** __revision__ = "$Id$" ! import os from types import * from distutils.errors import DistutilsFileError, DistutilsInternalError --- 7,11 ---- __revision__ = "$Id$" ! import os, sys from types import * from distutils.errors import DistutilsFileError, DistutilsInternalError *************** *** 213,214 **** --- 213,228 ---- log.warn(grok_environment_error( exc, "error removing %s: " % directory)) + + + def ensure_relative (path): + """Take the full path 'path', and make it a relative path so + it can be the second argument to os.path.join(). + """ + drive, path = os.path.splitdrive(path) + if sys.platform == 'mac': + return os.sep + path + else: + if path[0:1] == os.sep: + path = drive + path[1:] + return path + From akuchling@users.sourceforge.net Tue Nov 26 17:45:22 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 26 Nov 2002 09:45:22 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_dumb.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1:/tmp/cvs-serv1427 Modified Files: bdist_dumb.py Log Message: Fix for bug #410541: bdist builds bogus .zips This adds a --relative option to the bdist_dumb command that defaults to false; if true, the .tar.gz or .zip will be assembled using relative paths. Index: bdist_dumb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_dumb.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** bdist_dumb.py 19 Nov 2002 13:12:28 -0000 1.22 --- bdist_dumb.py 26 Nov 2002 17:45:19 -0000 1.23 *************** *** 12,16 **** from distutils.core import Command from distutils.util import get_platform ! from distutils.dir_util import create_tree, remove_tree from distutils.errors import * from distutils import log --- 12,16 ---- from distutils.core import Command from distutils.util import get_platform ! from distutils.dir_util import create_tree, remove_tree, ensure_relative from distutils.errors import * from distutils import log *************** *** 34,40 **** ('skip-build', None, "skip rebuilding everything (for testing/debugging)"), ] ! boolean_options = ['keep-temp', 'skip-build'] default_format = { 'posix': 'gztar', --- 34,43 ---- ('skip-build', None, "skip rebuilding everything (for testing/debugging)"), + ('relative', None, + "build the archive using relative paths" + "(default: false)"), ] ! boolean_options = ['keep-temp', 'skip-build', 'relative'] default_format = { 'posix': 'gztar', *************** *** 50,54 **** self.dist_dir = None self.skip_build = 0 ! # initialize_options() --- 53,58 ---- self.dist_dir = None self.skip_build = 0 ! self.relative = 0 ! # initialize_options() *************** *** 98,104 **** archive_basename = archive_basename.replace(":", "-") ! self.make_archive(os.path.join(self.dist_dir, archive_basename), ! self.format, ! root_dir=self.bdist_dir) if not self.keep_temp: --- 102,123 ---- archive_basename = archive_basename.replace(":", "-") ! pseudoinstall_root = os.path.join(self.dist_dir, archive_basename) ! if not self.relative: ! archive_root = self.bdist_dir ! else: ! if (self.distribution.has_ext_modules() and ! (install.install_base != install.install_platbase)): ! raise DistutilsPlatformError, \ ! ("can't make a dumb built distribution where " ! "base and platbase are different (%s, %s)" ! % (repr(install.install_base), ! repr(install.install_platbase))) ! else: ! archive_root = os.path.join(self.bdist_dir, ! ensure_relative(install.install_base)) ! ! # Make the archive ! self.make_archive(pseudoinstall_root, ! self.format, root_dir=archive_root) if not self.keep_temp: From mwh@users.sourceforge.net Tue Nov 26 17:49:14 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Tue, 26 Nov 2002 09:49:14 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.189,2.190 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv3465 Modified Files: typeobject.c Log Message: Initialize a variable. Hope this makes things work for Guido. It's odd that gcc on my ibook didn't complain about this. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.189 retrieving revision 2.190 diff -C2 -d -r2.189 -r2.190 *** typeobject.c 26 Nov 2002 14:47:26 -0000 2.189 --- typeobject.c 26 Nov 2002 17:49:11 -0000 2.190 *************** *** 147,151 **** PyTypeObject *subclass; PyObject *ref, *subclasses, *old_mro; ! int i, n, r; subclasses = type->tp_subclasses; --- 147,151 ---- PyTypeObject *subclass; PyObject *ref, *subclasses, *old_mro; ! int i, n, r = 0; subclasses = type->tp_subclasses; From tim_one@users.sourceforge.net Tue Nov 26 18:03:29 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 26 Nov 2002 10:03:29 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.py,1.65,1.66 test_both.py,1.8,1.9 test_cdatetime.py,1.10,1.11 test_datetime.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv8408 Modified Files: datetime.py test_both.py test_cdatetime.py test_datetime.py Log Message: Moved test_isoformat into test_both. This was complicated in that test_datetime expected a blank to be used as the date-time separator, but test_cdatetime expected 'T'. After discussion with Fred, Guido, and JimF, 'T' was the winner. So changed the Python implementation to match. Also added a one-liner check that str(datetime) uses a blank. Index: datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.py,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** datetime.py 25 Nov 2002 21:09:05 -0000 1.65 --- datetime.py 26 Nov 2002 18:03:19 -0000 1.66 *************** *** 1205,1209 **** # ISO formats including time ! def isoformat(self, sep=' '): """Return the time formatted according to ISO. --- 1205,1209 ---- # ISO formats including time ! def isoformat(self, sep='T'): """Return the time formatted according to ISO. *************** *** 1212,1216 **** Optional argument sep specifies the separator between date and ! time, default ' ' (use 'T' for strict ISO conformance). """ return "%04d-%02d-%02d%c%02d:%02d:%02d.%06d" % ( --- 1212,1216 ---- Optional argument sep specifies the separator between date and ! time, default 'T'. """ return "%04d-%02d-%02d%c%02d:%02d:%02d.%06d" % ( Index: test_both.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_both.py 26 Nov 2002 17:36:56 -0000 1.8 --- test_both.py 26 Nov 2002 18:03:23 -0000 1.9 *************** *** 403,406 **** --- 403,414 ---- self.assertEqual(dt, dt2) + def test_isoformat(self): + t = self.theclass(2, 3, 2, 4, 5, 1, 123) + self.assertEqual(t.isoformat(), "0002-03-02T04:05:01.000123") + self.assertEqual(t.isoformat('T'), "0002-03-02T04:05:01.000123") + self.assertEqual(t.isoformat(' '), "0002-03-02 04:05:01.000123") + # str is ISO format with the separator forced to a blank. + self.assertEqual(str(t), "0002-03-02 04:05:01.000123") + Index: test_cdatetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_cdatetime.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_cdatetime.py 26 Nov 2002 17:31:20 -0000 1.10 --- test_cdatetime.py 26 Nov 2002 18:03:24 -0000 1.11 *************** *** 87,96 **** self.assertEqual(L, iso_long_years) - def test_isoformat(self): - t = self.theclass(2, 3, 2, 4, 5, 1, 123) - self.assertEqual(t.isoformat(), "0002-03-02T04:05:01.000123") - self.assertEqual(t.isoformat('T'), "0002-03-02T04:05:01.000123") - self.assertEqual(t.isoformat(' '), "0002-03-02 04:05:01.000123") - def test_weekday(self): for i in range(7): --- 87,90 ---- Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_datetime.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** test_datetime.py 26 Nov 2002 17:31:21 -0000 1.50 --- test_datetime.py 26 Nov 2002 18:03:24 -0000 1.51 *************** *** 355,364 **** self.assertRaises(TypeError, lambda: i-a) - def test_isoformat(self): - t = self.theclass(2, 3, 2, 4, 5, 1, 123) - self.assertEqual(t.isoformat(), "0002-03-02 04:05:01.000123") - self.assertEqual(t.isoformat('T'), "0002-03-02T04:05:01.000123") - self.assertEqual(t.isoformat(' '), "0002-03-02 04:05:01.000123") - def test_tmxxx(self): from datetime import tmxxx --- 355,358 ---- From niemeyer@users.sourceforge.net Tue Nov 26 18:14:39 2002 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Tue, 26 Nov 2002 10:14:39 -0800 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.69,1.70 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv15024/ref Modified Files: ref5.tex Log Message: * Doc/ref/ref5.tex Fixed minor bug preventing documentation compilation. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** ref5.tex 24 Nov 2002 20:23:04 -0000 1.69 --- ref5.tex 26 Nov 2002 18:14:35 -0000 1.70 *************** *** 697,701 **** the absolute value of the result is strictly smaller than the absolute value of the second operand\footnote{ ! While \code{abs(x\%y) < abs(y)) is true mathematically, for floats it may not be true numerically due to roundoff. For example, and assuming a platform on which a Python float is an --- 697,701 ---- the absolute value of the result is strictly smaller than the absolute value of the second operand\footnote{ ! While \code{abs(x\%y) < abs(y)} is true mathematically, for floats it may not be true numerically due to roundoff. For example, and assuming a platform on which a Python float is an From tim_one@users.sourceforge.net Tue Nov 26 21:22:40 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 26 Nov 2002 13:22:40 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime test_both.py,1.9,1.10 test_cdatetime.py,1.11,1.12 test_datetime.py,1.51,1.52 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv1058 Modified Files: test_both.py test_cdatetime.py test_datetime.py Log Message: Moved test_ctime into test_both. Index: test_both.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_both.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_both.py 26 Nov 2002 18:03:23 -0000 1.9 --- test_both.py 26 Nov 2002 21:22:38 -0000 1.10 *************** *** 411,414 **** --- 411,418 ---- self.assertEqual(str(t), "0002-03-02 04:05:01.000123") + def test_ctime(self): + t = self.theclass(2002, 3, 2, 18, 3, 5, 123) + self.assertEqual(t.ctime(), "Sat Mar 2 18:03:05 2002") + Index: test_cdatetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_cdatetime.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_cdatetime.py 26 Nov 2002 18:03:24 -0000 1.11 --- test_cdatetime.py 26 Nov 2002 21:22:38 -0000 1.12 *************** *** 96,102 **** self.assertEqual(self.theclass(1956, 1, 2+i).isoweekday(), i+1) - def test_ctime(self): - t = self.theclass(2002, 3, 2, 18, 3, 5, 123) - self.assertEqual(t.ctime(), "Sat Mar 2 18:03:05 2002") --- 96,99 ---- Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_datetime.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** test_datetime.py 26 Nov 2002 18:03:24 -0000 1.51 --- test_datetime.py 26 Nov 2002 21:22:38 -0000 1.52 *************** *** 369,376 **** self.assertEqual(timestamp, tm.time()) - def test_ctime(self): - t = self.theclass(2002, 3, 2, 18, 3, 5, 123) - self.assertEqual(t.ctime(), "Sat Mar 2 18:03:05 2002") - def test_combine(self): d = date(2002, 3, 4) --- 369,372 ---- From fdrake@users.sourceforge.net Tue Nov 26 21:28:26 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 26 Nov 2002 13:28:26 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command install_data.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1:/tmp/cvs-serv3243 Modified Files: install_data.py Log Message: Use "is" to test type objects, not "==". Index: install_data.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install_data.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** install_data.py 19 Nov 2002 13:12:28 -0000 1.20 --- install_data.py 26 Nov 2002 21:28:23 -0000 1.21 *************** *** 49,53 **** self.mkpath(self.install_dir) for f in self.data_files: ! if type(f) == StringType: # it's a simple file, so copy it f = convert_path(f) --- 49,53 ---- self.mkpath(self.install_dir) for f in self.data_files: ! if type(f) is StringType: # it's a simple file, so copy it f = convert_path(f) From tim_one@users.sourceforge.net Tue Nov 26 21:30:38 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 26 Nov 2002 13:30:38 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime test_cdatetime.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv3650 Modified Files: test_cdatetime.py Log Message: I'm not sure what TestDateTime in test_cdatetime has its own test_isocalendar, but the commented-out failing part got fixed yesterday, so uncommented it. Index: test_cdatetime.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/test_cdatetime.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_cdatetime.py 26 Nov 2002 21:22:38 -0000 1.12 --- test_cdatetime.py 26 Nov 2002 21:30:36 -0000 1.13 *************** *** 44,48 **** self.assertEqual(d.isocalendar(), (2009, 52, i+1)) d = self.theclass(2009, 12, 28) + timedelta(i) ! ## self.assertEqual(d.isocalendar(), (2009, 53, i+1)) d = self.theclass(2010, 1, 4+i) self.assertEqual(d.isocalendar(), (2010, 1, i+1)) --- 44,48 ---- self.assertEqual(d.isocalendar(), (2009, 52, i+1)) d = self.theclass(2009, 12, 28) + timedelta(i) ! self.assertEqual(d.isocalendar(), (2009, 53, i+1)) d = self.theclass(2010, 1, 4+i) self.assertEqual(d.isocalendar(), (2010, 1, i+1)) From loewis@users.sourceforge.net Tue Nov 26 21:39:50 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 26 Nov 2002 13:39:50 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.75,1.76 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv7410/Doc/whatsnew Modified Files: whatsnew23.tex Log Message: Rename want_objects to wantobjects throughout, for consistency. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** whatsnew23.tex 26 Nov 2002 14:48:23 -0000 1.75 --- whatsnew23.tex 26 Nov 2002 21:39:47 -0000 1.76 *************** *** 1301,1305 **** \begin{verbatim} import Tkinter ! Tkinter.want_objects = 0 \end{verbatim} --- 1301,1305 ---- \begin{verbatim} import Tkinter ! Tkinter.wantobjects = 0 \end{verbatim} From loewis@users.sourceforge.net Tue Nov 26 21:39:50 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 26 Nov 2002 13:39:50 -0800 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.131,1.132 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv7410/Modules Modified Files: _tkinter.c Log Message: Rename want_objects to wantobjects throughout, for consistency. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** _tkinter.c 26 Nov 2002 09:28:05 -0000 1.131 --- _tkinter.c 26 Nov 2002 21:39:48 -0000 1.132 *************** *** 222,226 **** PyObject_HEAD Tcl_Interp *interp; ! int want_objects; } TkappObject; --- 222,226 ---- PyObject_HEAD Tcl_Interp *interp; ! int wantobjects; } TkappObject; *************** *** 524,528 **** static TkappObject * Tkapp_New(char *screenName, char *baseName, char *className, ! int interactive, int want_objects) { TkappObject *v; --- 524,528 ---- static TkappObject * Tkapp_New(char *screenName, char *baseName, char *className, ! int interactive, int wantobjects) { TkappObject *v; *************** *** 534,538 **** v->interp = Tcl_CreateInterp(); ! v->want_objects = want_objects; #if defined(macintosh) --- 534,538 ---- v->interp = Tcl_CreateInterp(); ! v->wantobjects = wantobjects; #if defined(macintosh) *************** *** 902,906 **** if (i == TCL_ERROR) Tkinter_Error(self); ! else if(((TkappObject*)self)->want_objects) { Tcl_Obj *value = Tcl_GetObjResult(interp); /* Not sure whether the IncrRef is necessary, but something --- 902,906 ---- if (i == TCL_ERROR) Tkinter_Error(self); ! else if(((TkappObject*)self)->wantobjects) { Tcl_Obj *value = Tcl_GetObjResult(interp); /* Not sure whether the IncrRef is necessary, but something *************** *** 1968,1975 **** { ! int want_objects; ! if (!PyArg_ParseTuple(args, "i:wantobjects", &want_objects)) return NULL; ! ((TkappObject*)self)->want_objects = want_objects; Py_INCREF(Py_None); --- 1968,1975 ---- { ! int wantobjects; ! if (!PyArg_ParseTuple(args, "i:wantobjects", &wantobjects)) return NULL; ! ((TkappObject*)self)->wantobjects = wantobjects; Py_INCREF(Py_None); *************** *** 2180,2184 **** char *className = NULL; int interactive = 0; ! int want_objects = 0; baseName = strrchr(Py_GetProgramName(), '/'); --- 2180,2184 ---- char *className = NULL; int interactive = 0; ! int wantobjects = 0; baseName = strrchr(Py_GetProgramName(), '/'); *************** *** 2191,2199 **** if (!PyArg_ParseTuple(args, "|zssi:create", &screenName, &baseName, &className, ! &interactive, &want_objects)) return NULL; return (PyObject *) Tkapp_New(screenName, baseName, className, ! interactive, want_objects); } --- 2191,2199 ---- if (!PyArg_ParseTuple(args, "|zssi:create", &screenName, &baseName, &className, ! &interactive, &wantobjects)) return NULL; return (PyObject *) Tkapp_New(screenName, baseName, className, ! interactive, wantobjects); } From loewis@users.sourceforge.net Tue Nov 26 21:39:50 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 26 Nov 2002 13:39:50 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.545,1.546 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv7410/Misc Modified Files: NEWS Log Message: Rename want_objects to wantobjects throughout, for consistency. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.545 retrieving revision 1.546 diff -C2 -d -r1.545 -r1.546 *** NEWS 26 Nov 2002 14:48:23 -0000 1.545 --- NEWS 26 Nov 2002 21:39:48 -0000 1.546 *************** *** 318,322 **** have Python equivalents are converted to Python objects, other objects are wrapped. This can be configured through the wantobjects method, ! or Tkinter.want_objects. - The PyBSDDB wrapper around the Sleepycat Berkeley DB library has been --- 318,322 ---- have Python equivalents are converted to Python objects, other objects are wrapped. This can be configured through the wantobjects method, ! or Tkinter.wantobjects. - The PyBSDDB wrapper around the Sleepycat Berkeley DB library has been From loewis@users.sourceforge.net Tue Nov 26 21:39:50 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 26 Nov 2002 13:39:50 -0800 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tkinter.py,1.166,1.167 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv7410/Lib/lib-tk Modified Files: Tkinter.py Log Message: Rename want_objects to wantobjects throughout, for consistency. Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.166 retrieving revision 1.167 diff -C2 -d -r1.166 -r1.167 *** Tkinter.py 26 Nov 2002 09:28:04 -0000 1.166 --- Tkinter.py 26 Nov 2002 21:39:48 -0000 1.167 *************** *** 46,50 **** _MacOS = None ! want_objects = 1 TkVersion = float(_tkinter.TK_VERSION) --- 46,50 ---- _MacOS = None ! wantobjects = 1 TkVersion = float(_tkinter.TK_VERSION) *************** *** 1524,1528 **** baseName = baseName + ext self.tk = _tkinter.create(screenName, baseName, className) ! self.tk.wantobjects(want_objects) if _MacOS and hasattr(_MacOS, 'SchedParams'): # Disable event scanning except for Command-Period --- 1524,1528 ---- baseName = baseName + ext self.tk = _tkinter.create(screenName, baseName, className) ! self.tk.wantobjects(wantobjects) if _MacOS and hasattr(_MacOS, 'SchedParams'): # Disable event scanning except for Command-Period From fdrake@users.sourceforge.net Tue Nov 26 21:41:01 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 26 Nov 2002 13:41:01 -0800 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.106,1.107 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv8024 Modified Files: regrtest.py Log Message: Add a way to say "use any resource except A". For example, to run allow the use of any resource except bsddb, give the option "-uall,-bsddb". Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** regrtest.py 24 Nov 2002 19:19:09 -0000 1.106 --- regrtest.py 26 Nov 2002 21:40:59 -0000 1.107 *************** *** 59,62 **** --- 59,66 ---- bsddb - It is okay to run the bsddb testsuite, which takes a long time to complete. + + To enable all resources except one, use '-uall,-'. For + example, to run all the tests except for the bsddb tests, give the + option '-uall,-bsddb'. """ *************** *** 156,164 **** for r in u: if r == 'all': ! use_resources = RESOURCE_NAMES ! break if r not in RESOURCE_NAMES: usage(1, 'Invalid -u/--use option: ' + a) ! if r not in use_resources: use_resources.append(r) if generate and verbose: --- 160,175 ---- for r in u: if r == 'all': ! use_resources[:] = RESOURCE_NAMES ! continue ! remove = False ! if r[0] == '-': ! remove = True ! r = r[1:] if r not in RESOURCE_NAMES: usage(1, 'Invalid -u/--use option: ' + a) ! if remove: ! if r in use_resources: ! use_resources.remove(r) ! elif r not in use_resources: use_resources.append(r) if generate and verbose: From fdrake@users.sourceforge.net Tue Nov 26 21:44:58 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 26 Nov 2002 13:44:58 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.546,1.547 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv9612 Modified Files: NEWS Log Message: Add a way to say "use any resource except A". For example, to run allow the use of any resource except bsddb, give the option "-uall,-bsddb". Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.546 retrieving revision 1.547 diff -C2 -d -r1.546 -r1.547 *** NEWS 26 Nov 2002 21:39:48 -0000 1.546 --- NEWS 26 Nov 2002 21:44:56 -0000 1.547 *************** *** 824,828 **** ----- ! Yet to be written. Windows --- 824,830 ---- ----- ! - The regrtest.py script's -u option now provides a way to say "allow ! all resources except this one." For example, to allow everything ! except bsddb, give the option '-uall,-bsddb'. Windows From fdrake@users.sourceforge.net Tue Nov 26 22:07:41 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 26 Nov 2002 14:07:41 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.76,1.77 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv19310 Modified Files: whatsnew23.tex Log Message: Noted the support for resource exclusion for regrtest. Some people use regrtest, so it might be interesting. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** whatsnew23.tex 26 Nov 2002 21:39:47 -0000 1.76 --- whatsnew23.tex 26 Nov 2002 22:07:35 -0000 1.77 *************** *** 1605,1608 **** --- 1605,1615 ---- \begin{itemize} + \item The \file{regrtest.py} script now provides a way to allow ``all + resources except \var{foo}.'' A resource name passed to the + \programopt{-u} option can now be prefixed with a hyphen + (\character{-}) to mean ``remove this resource.'' For example, the + option `\code{\programopt{-u}all,-bsddb}' could be used to enable the + use of all resources except \code{bsddb}. + \item The tools used to build the documentation now work under Cygwin as well as \UNIX. From loewis@users.sourceforge.net Tue Nov 26 22:12:15 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue, 26 Nov 2002 14:12:15 -0800 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.132,1.133 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv21576 Modified Files: _tkinter.c Log Message: Avoid including tclInt.h. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -d -r1.132 -r1.133 *** _tkinter.c 26 Nov 2002 21:39:48 -0000 1.132 --- _tkinter.c 26 Nov 2002 22:12:12 -0000 1.133 *************** *** 51,59 **** #ifdef TK_FRAMEWORK #include - #include #include #else #include - #include #include #endif --- 51,57 ---- *************** *** 223,226 **** --- 221,233 ---- Tcl_Interp *interp; int wantobjects; + /* We cannot include tclInt.h, as this is internal. + So we cache interesting types here. */ + Tcl_ObjType *BooleanType; + Tcl_ObjType *ByteArrayType; + Tcl_ObjType *DoubleType; + Tcl_ObjType *IntType; + Tcl_ObjType *ListType; + Tcl_ObjType *ProcBodyType; + Tcl_ObjType *StringType; } TkappObject; *************** *** 536,539 **** --- 543,554 ---- v->wantobjects = wantobjects; + v->BooleanType = Tcl_GetObjType("boolean"); + v->ByteArrayType = Tcl_GetObjType("bytearray"); + v->DoubleType = Tcl_GetObjType("double"); + v->IntType = Tcl_GetObjType("int"); + v->ListType = Tcl_GetObjType("list"); + v->ProcBodyType = Tcl_GetObjType("procbody"); + v->StringType = Tcl_GetObjType("string"); + #if defined(macintosh) /* This seems to be needed */ *************** *** 754,762 **** { PyObject *result = NULL; if (value->typePtr == NULL) return PyString_FromStringAndSize(value->bytes, value->length); ! if (value->typePtr == &tclBooleanType) { result = value->internalRep.longValue ? Py_True : Py_False; Py_INCREF(result); --- 769,778 ---- { PyObject *result = NULL; + TkappObject *app = (TkappObject*)tkapp; if (value->typePtr == NULL) return PyString_FromStringAndSize(value->bytes, value->length); ! if (value->typePtr == app->BooleanType) { result = value->internalRep.longValue ? Py_True : Py_False; Py_INCREF(result); *************** *** 764,768 **** } ! if (value->typePtr == &tclByteArrayType) { int size; char *data = Tcl_GetByteArrayFromObj(value, &size); --- 780,784 ---- } ! if (value->typePtr == app->ByteArrayType) { int size; char *data = Tcl_GetByteArrayFromObj(value, &size); *************** *** 770,782 **** } ! if (value->typePtr == &tclDoubleType) { return PyFloat_FromDouble(value->internalRep.doubleValue); } ! if (value->typePtr == &tclIntType) { return PyInt_FromLong(value->internalRep.longValue); } ! if (value->typePtr == &tclListType) { int size; int i, status; --- 786,798 ---- } ! if (value->typePtr == app->DoubleType) { return PyFloat_FromDouble(value->internalRep.doubleValue); } ! if (value->typePtr == app->IntType) { return PyInt_FromLong(value->internalRep.longValue); } ! if (value->typePtr == app->ListType) { int size; int i, status; *************** *** 807,815 **** } ! if (value->typePtr == &tclProcBodyType) { // fall through: return tcl object } ! if (value->typePtr == &tclStringType) { #ifdef Py_USING_UNICODE #ifdef Py_UNICODE_WIDE --- 823,831 ---- } ! if (value->typePtr == app->ProcBodyType) { // fall through: return tcl object } ! if (value->typePtr == app->StringType) { #ifdef Py_USING_UNICODE #ifdef Py_UNICODE_WIDE *************** *** 2189,2193 **** className = "Tk"; ! if (!PyArg_ParseTuple(args, "|zssi:create", &screenName, &baseName, &className, &interactive, &wantobjects)) --- 2205,2209 ---- className = "Tk"; ! if (!PyArg_ParseTuple(args, "|zssii:create", &screenName, &baseName, &className, &interactive, &wantobjects)) From fdrake@users.sourceforge.net Tue Nov 26 22:13:47 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 26 Nov 2002 14:13:47 -0800 Subject: [Python-checkins] python/dist/src/Doc Makefile,1.248,1.249 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv22563 Modified Files: Makefile Log Message: Add missing dependency information for the "What's New" document. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.248 retrieving revision 1.249 diff -C2 -d -r1.248 -r1.249 *** Makefile 30 Oct 2002 17:07:02 -0000 1.248 --- Makefile 26 Nov 2002 22:13:41 -0000 1.249 *************** *** 284,291 **** # What's New in Python X.Y ! paper-$(PAPER)/$(WHATSNEW).dvi: cd paper-$(PAPER) && $(MKDVI) ../whatsnew/$(WHATSNEW).tex ! paper-$(PAPER)/$(WHATSNEW).pdf: cd paper-$(PAPER) && $(MKPDF) ../whatsnew/$(WHATSNEW).tex --- 284,291 ---- # What's New in Python X.Y ! paper-$(PAPER)/$(WHATSNEW).dvi: whatsnew/$(WHATSNEW).tex cd paper-$(PAPER) && $(MKDVI) ../whatsnew/$(WHATSNEW).tex ! paper-$(PAPER)/$(WHATSNEW).pdf: whatsnew/$(WHATSNEW).tex cd paper-$(PAPER) && $(MKPDF) ../whatsnew/$(WHATSNEW).tex From fdrake@users.sourceforge.net Tue Nov 26 22:14:21 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 26 Nov 2002 14:14:21 -0800 Subject: [Python-checkins] python/dist/src/Doc Makefile,1.235.2.1.2.15,1.235.2.1.2.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv22806 Modified Files: Tag: release22-maint Makefile Log Message: Add missing dependency information for the "What's New" document. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.235.2.1.2.15 retrieving revision 1.235.2.1.2.16 diff -C2 -d -r1.235.2.1.2.15 -r1.235.2.1.2.16 *** Makefile 22 Oct 2002 21:20:24 -0000 1.235.2.1.2.15 --- Makefile 26 Nov 2002 22:14:19 -0000 1.235.2.1.2.16 *************** *** 281,288 **** # What's New in Python X.Y ! paper-$(PAPER)/$(WHATSNEW).dvi: cd paper-$(PAPER) && $(MKDVI) ../whatsnew/$(WHATSNEW).tex ! paper-$(PAPER)/$(WHATSNEW).pdf: cd paper-$(PAPER) && $(MKPDF) ../whatsnew/$(WHATSNEW).tex --- 281,288 ---- # What's New in Python X.Y ! paper-$(PAPER)/$(WHATSNEW).dvi: whatsnew/$(WHATSNEW).tex cd paper-$(PAPER) && $(MKDVI) ../whatsnew/$(WHATSNEW).tex ! paper-$(PAPER)/$(WHATSNEW).pdf: whatsnew/$(WHATSNEW).tex cd paper-$(PAPER) && $(MKPDF) ../whatsnew/$(WHATSNEW).tex From tim_one@users.sourceforge.net Tue Nov 26 22:51:08 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 26 Nov 2002 14:51:08 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.26,1.27 obj_date.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv4249 Modified Files: datetime.c obj_date.c Log Message: Some of the unimplemented routines for datetime and datetimetz require heftier normalization helpers than have been written so far. So recoded a larger part of datetime.py's "struct tmxxx" gimmick in C, and switched date normalization to use it. Will switch *all* normalization to use it. This is slower; I don't care. Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** datetime.c 26 Nov 2002 05:32:06 -0000 1.26 --- datetime.c 26 Nov 2002 22:51:03 -0000 1.27 *************** *** 364,367 **** --- 364,505 ---- } + /* An internal struct used for miserable normalization tasks. */ + typedef struct s_tmxxx { + long year; /* may be negative on output */ + long month; /* in 1..12 on output */ + long day; /* in 1 .. days_in_month(year, month) on output */ + long hour; /* in 0..59 on output */ + long minute; /* in 0..59 on output */ + long second; /* in 0 .. 59 on output */ + long microsecond; /* in 0..999999 on output */ + } tmxxx; + + #define TMXXX_CLEAR(PTR_TO_TMXXX) \ + memset(PTR_TO_TMXXX, 0, sizeof(struct s_tmxxx)) + + /* One step of mixed-radix conversion. *lower is the lower unit and *higher + * the higher unit, such that 1 higher unit is equal to bound lower units. + * Normalize *lower to lie in range(bound), adding carries (if needed) to + * higher. + * If a carry is needed, adding into *higher may overflow. In that case, + * retuns a non-zero value. If everything is OK, returns 0. + */ + static int + norm1(long *higher, long *lower, long bound) + { + assert(bound > 0); + if (*lower < 0 || *lower >= bound) { + long carry; + long new_higher; + + carry = divmod(*lower, bound, lower); + assert(0 <= *lower && *lower < bound); + new_higher = *higher + carry; + if (SIGNED_ADD_OVERFLOWED(new_higher, *higher, carry)) + return 1; + *higher = new_higher; + } + return 0; + } + + static int + tmxxx_normalize(tmxxx *p) + { + int dim; /* days in month */ + char *msg; + + if (norm1(&p->second, &p->microsecond, 1000000)) { + msg = "second component too large"; + goto Overflow; + } + assert(0 <= p->microsecond && p->microsecond < 1000000); + + if (norm1(&p->minute, &p->second, 60)) { + msg = "minute component too large"; + goto Overflow; + } + assert(0 <= p->second && p->second < 60); + + if (norm1(&p->hour, &p->minute, 60)) { + msg = "hour component too large"; + goto Overflow; + } + assert(0 <= p->minute && p->minute < 60); + + if (norm1(&p->day, &p->hour, 60)) { + msg = "hour component too large"; + goto Overflow; + } + assert(0 <= p->hour && p->hour < 24); + + /* That was easy. Now it gets muddy: the proper range for day + * can't be determined without knowing the correct month and year, + * but if day is, e.g., plus or minus a million, the current month + * and year values make no sense (and may also be out of bounds + * themselves). + * Saying 12 months == 1 year should be non-controversial. + */ + if (p->month < 1 || p->month > 12) { + --p->month; + if (norm1(&p->year, &p->month, 12)) { + msg = "year component too large"; + goto Overflow; + } + ++p->month; + assert (1 <= p->month && p->month <= 12); + } + + /* The other routines don't deal correctly with years < 0, so cut + * that off now. + */ + if (p->year < 0) { + msg = "year component is negative"; + goto Overflow; + } + /* Now only day can be out of bounds (year may also be out of bounds + * for a datetime object, but we don't care about that here). + * If day is out of bounds, what to do is arguable, but at least the + * method here is principled and explainable. + */ + dim = days_in_month(p->year, p->month); + if (p->day < 1 || p->day > dim) { + /* Move day-1 days from the first of the month. First try to + * get off cheap if we're only one day out of range + * (adjustments for timezone alone can't be worse than that). + */ + if (p->day == 0) { + --p->month; + if (p->month > 0) + p->day = days_in_month(p->year, p->month); + else { + --p->year; + p->month = 12; + p->day = 31; + } + } + else if (p->day == dim + 1) { + /* move forward a day */ + ++p->month; + p->day = 1; + if (p->month > 12) { + p->month = 1; + ++p->year; + } + } + else { + long ordinal = ymd_to_ord(p->year, p->month, 1) + + p->day - 1; + ord_to_ymd(ordinal, &p->year, &p->month, &p->day); + } + } + assert(p->month > 0); + assert(p->day > 0); + return 1; + + Overflow: + PyErr_SetString(PyExc_OverflowError, msg); + return 0; + } + static PyObject * new_delta(long days, long seconds, long microseconds) Index: obj_date.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/obj_date.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** obj_date.c 26 Nov 2002 06:27:24 -0000 1.9 --- obj_date.c 26 Nov 2002 22:51:04 -0000 1.10 *************** *** 12,74 **** normalize_date(long *year, long *month, long *day) { ! long carry, dim; ! /* This is muddy: the proper range for day can't be determined ! * without knowing the correct month and year, but if day is, ! * e.g., plus or minus a million, the current month and year ! * values make no sense (and may also be out of bounds themselves). ! * Saying 12 months == 1 year should be non-controversial. ! */ ! if (*month < 1 || *month > 12) { ! long m = *month; ! carry = divmod(m-1, 12, &m); ! *month = m+1; ! *year += carry; ! assert(*month >= 1); ! assert(*month <= 12); ! } ! /* ! * If day is out of bounds, what to do is arguable, but at ! * least the method here is principled and explainable. ! */ ! dim = days_in_month(*year, *month); ! if (*day < 1 || *day > dim) { ! /* Move day-1 days from the first of the month. First try to ! * get off cheap if we're only one day out of range ! * (adjustments for timezone alone can't be worse than that). ! */ ! if (*day == 0) { ! *month -= 1; ! if (*month > 0) ! *day = days_in_month(*year, *month); ! else { ! *year -= 1; ! *month = 12; ! *day = 31; ! } ! } ! else if (*day == dim + 1) { ! /* move forward a day */ ! *month += 1; ! *day = 1; ! if (*month > 12) { ! *month = 1; ! *year += 1; ! } ! } ! else { ! long ordinal = ymd_to_ord(*year, *month, 1) + ! *day - 1; ! ord_to_ymd(ordinal, year, month, day); } } ! assert(*month > 0); ! assert(*day > 0); ! if (*year < MINYEAR || *year > MAXYEAR) { ! PyErr_SetString(PyExc_OverflowError, ! "date value out of range"); ! return 0; ! } ! return 1; } --- 12,36 ---- normalize_date(long *year, long *month, long *day) { ! tmxxx t; ! int result; ! TMXXX_CLEAR(&t); ! t.year = *year; ! t.month = *month; ! t.day = *day; ! result = tmxxx_normalize(&t); ! if (result > 0) { ! /* looks good */ ! *year = t.year; ! *month = t.month; ! *day = t.day; ! ! if (*year < MINYEAR || *year > MAXYEAR) { ! PyErr_SetString(PyExc_OverflowError, ! "date value out of range"); ! result = 0; } } ! return result; } From tim_one@users.sourceforge.net Tue Nov 26 23:02:55 2002 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue, 26 Nov 2002 15:02:55 -0800 Subject: [Python-checkins] python/nondist/sandbox/datetime datetime.c,1.27,1.28 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/datetime In directory sc8-pr-cvs1:/tmp/cvs-serv9072 Modified Files: datetime.c Log Message: Repaired typo in comment. Index: datetime.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** datetime.c 26 Nov 2002 22:51:03 -0000 1.27 --- datetime.c 26 Nov 2002 23:02:52 -0000 1.28 *************** *** 369,373 **** long month; /* in 1..12 on output */ long day; /* in 1 .. days_in_month(year, month) on output */ ! long hour; /* in 0..59 on output */ long minute; /* in 0..59 on output */ long second; /* in 0 .. 59 on output */ --- 369,373 ---- long month; /* in 1..12 on output */ long day; /* in 1 .. days_in_month(year, month) on output */ ! long hour; /* in 0..23 on output */ long minute; /* in 0..59 on output */ long second; /* in 0 .. 59 on output */ From gvanrossum@users.sourceforge.net Wed Nov 27 04:01:07 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 26 Nov 2002 20:01:07 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.163,1.164 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv3841 Modified Files: test_descr.py Log Message: The MRO conflict error message depends on dictionary hash order. Avoid depending on this in the test. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -d -r1.163 -r1.164 *** test_descr.py 26 Nov 2002 14:47:27 -0000 1.163 --- test_descr.py 27 Nov 2002 04:00:59 -0000 1.164 *************** *** 1061,1065 **** callable(*args) except exc, msg: ! if str(msg) != expected: raise TestFailed, "Message %r, expected %r" % (str(msg), expected) --- 1061,1065 ---- callable(*args) except exc, msg: ! if not str(msg).startswith(expected): raise TestFailed, "Message %r, expected %r" % (str(msg), expected) *************** *** 1072,1078 **** raises(TypeError, "duplicate base class A", type, "X", (A, A), {}) ! raises(TypeError, "MRO conflict among bases B, A", type, "X", (A, B), {}) ! raises(TypeError, "MRO conflict among bases C, B, A", type, "X", (A, C, B), {}) # Test a slightly more complex error --- 1072,1078 ---- raises(TypeError, "duplicate base class A", type, "X", (A, A), {}) ! raises(TypeError, "MRO conflict among bases ", type, "X", (A, B), {}) ! raises(TypeError, "MRO conflict among bases ", type, "X", (A, C, B), {}) # Test a slightly more complex error *************** *** 1082,1086 **** class HVGrid(HorizontalGrid, VerticalGrid): pass class VHGrid(VerticalGrid, HorizontalGrid): pass ! raises(TypeError, "MRO conflict among bases VerticalGrid, HorizontalGrid", type, "ConfusedGrid", (HVGrid, VHGrid), {}) --- 1082,1086 ---- class HVGrid(HorizontalGrid, VerticalGrid): pass class VHGrid(VerticalGrid, HorizontalGrid): pass ! raises(TypeError, "MRO conflict among bases ", type, "ConfusedGrid", (HVGrid, VHGrid), {}) From fdrake@users.sourceforge.net Wed Nov 27 05:26:27 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 26 Nov 2002 21:26:27 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libpickle.tex,1.33.6.1,1.33.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv24235 Modified Files: Tag: release22-maint libpickle.tex Log Message: Clarify the interpretation of the __getstate__() return value for new-style classes. Closes SF bug #637941. Index: libpickle.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpickle.tex,v retrieving revision 1.33.6.1 retrieving revision 1.33.6.2 diff -C2 -d -r1.33.6.1 -r1.33.6.2 *** libpickle.tex 6 Oct 2002 02:24:00 -0000 1.33.6.1 --- libpickle.tex 27 Nov 2002 05:26:24 -0000 1.33.6.2 *************** *** 407,417 **** state\footnote{These methods can also be used to implement copying class instances.}. If there is no \method{__setstate__()} method, the ! pickled object must be a dictionary and its items are assigned to the new instance's dictionary. If a class defines both \method{__getstate__()} and \method{__setstate__()}, the state object needn't be a dictionary and these methods can do what they ! want\footnote{This protocol is also used by the shallow and deep copying operations defined in the ! \refmodule{copy} module.}. \subsubsection{Pickling and unpickling extension types} --- 407,423 ---- state\footnote{These methods can also be used to implement copying class instances.}. If there is no \method{__setstate__()} method, the ! pickled state must be a dictionary and its items are assigned to the new instance's dictionary. If a class defines both \method{__getstate__()} and \method{__setstate__()}, the state object needn't be a dictionary and these methods can do what they ! want.\footnote{This protocol is also used by the shallow and deep copying operations defined in the ! \refmodule{copy} module.} ! ! \begin{notice}[warning] ! For new-style classes, if \method{__getstate__()} returns a false ! value, the \method{__setstate__()} method will not be called. ! \end{notice} ! \subsubsection{Pickling and unpickling extension types} From fdrake@users.sourceforge.net Wed Nov 27 05:26:48 2002 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 26 Nov 2002 21:26:48 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libpickle.tex,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv24308 Modified Files: libpickle.tex Log Message: Clarify the interpretation of the __getstate__() return value for new-style classes. Closes SF bug #637941. Index: libpickle.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpickle.tex,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** libpickle.tex 5 Aug 2002 03:55:36 -0000 1.37 --- libpickle.tex 27 Nov 2002 05:26:46 -0000 1.38 *************** *** 413,423 **** state\footnote{These methods can also be used to implement copying class instances.}. If there is no \method{__setstate__()} method, the ! pickled object must be a dictionary and its items are assigned to the new instance's dictionary. If a class defines both \method{__getstate__()} and \method{__setstate__()}, the state object needn't be a dictionary and these methods can do what they ! want\footnote{This protocol is also used by the shallow and deep copying operations defined in the ! \refmodule{copy} module.}. \subsubsection{Pickling and unpickling extension types} --- 413,429 ---- state\footnote{These methods can also be used to implement copying class instances.}. If there is no \method{__setstate__()} method, the ! pickled state must be a dictionary and its items are assigned to the new instance's dictionary. If a class defines both \method{__getstate__()} and \method{__setstate__()}, the state object needn't be a dictionary and these methods can do what they ! want.\footnote{This protocol is also used by the shallow and deep copying operations defined in the ! \refmodule{copy} module.} ! ! \begin{notice}[warning] ! For new-style classes, if \method{__getstate__()} returns a false ! value, the \method{__setstate__()} method will not be called. ! \end{notice} ! \subsubsection{Pickling and unpickling extension types} From rhettinger@users.sourceforge.net Wed Nov 27 07:29:35 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 26 Nov 2002 23:29:35 -0800 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.131,2.132 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv24449a/Objects Modified Files: dictobject.c Log Message: SF Patch 643443. Added dict.fromkeys(iterable, value=None), a class method for constructing new dictionaries from sequences of keys. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.131 retrieving revision 2.132 diff -C2 -d -r2.131 -r2.132 *** dictobject.c 23 Nov 2002 09:45:04 -0000 2.131 --- dictobject.c 27 Nov 2002 07:29:33 -0000 2.132 *************** *** 964,967 **** --- 964,1017 ---- static PyObject * + dict_fromkeys(PyObject *mp, PyObject *args) + { + PyObject *seq; + PyObject *value = Py_None; + PyObject *it; /* iter(seq) */ + PyObject *key; + PyObject *d; + PyObject *cls; + int status; + + if (!PyArg_ParseTuple(args, "OO|O:fromkeys", &cls, &seq, &value)) + return NULL; + + d = PyObject_CallObject(cls, NULL); + if (d == NULL) + return NULL; + if (!PyDict_Check(d)) { + PyErr_BadInternalCall(); + return NULL; + } + + it = PyObject_GetIter(seq); + if (it == NULL){ + Py_DECREF(d); + return NULL; + } + + for (;;) { + key = PyIter_Next(it); + if (key == NULL) { + if (PyErr_Occurred()) + goto Fail; + break; + } + status = PyDict_SetItem(d, key, value); + Py_DECREF(key); + if (status < 0) + goto Fail; + } + + Py_DECREF(it); + return d; + + Fail: + Py_DECREF(it); + Py_DECREF(d); + return NULL; + } + + static PyObject * dict_update(PyObject *mp, PyObject *other) { *************** *** 1683,1686 **** --- 1733,1740 ---- "D.update(E) -> None. Update D from E: for k in E.keys(): D[k] = E[k]"); + PyDoc_STRVAR(fromkeys__doc__, + "dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.\n\ + v defaults to None."); + PyDoc_STRVAR(clear__doc__, "D.clear() -> None. Remove all items from D."); *************** *** 1717,1720 **** --- 1771,1776 ---- {"update", (PyCFunction)dict_update, METH_O, update__doc__}, + {"fromkeys", (PyCFunction)dict_fromkeys, METH_VARARGS | METH_CLASS, + fromkeys__doc__}, {"clear", (PyCFunction)dict_clear, METH_NOARGS, clear__doc__}, From rhettinger@users.sourceforge.net Wed Nov 27 07:29:35 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 26 Nov 2002 23:29:35 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.547,1.548 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv24449a/Misc Modified Files: NEWS Log Message: SF Patch 643443. Added dict.fromkeys(iterable, value=None), a class method for constructing new dictionaries from sequences of keys. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.547 retrieving revision 1.548 diff -C2 -d -r1.547 -r1.548 *** NEWS 26 Nov 2002 21:44:56 -0000 1.547 --- NEWS 27 Nov 2002 07:29:32 -0000 1.548 *************** *** 271,274 **** --- 271,279 ---- example, "Foo!!!?!?!?".rstrip("?!") -> "Foo". + - Dictionaries have a new class method, fromkeys(iterable, value=None). + It constructs a new dictionary with keys taken from the iterable and + all values set to a single value. It is used for building membership + tests and for removing duplicates from sequences. + - Added a new dict method pop(key). This removes and returns the value corresponding to key. [SF patch #539949] From rhettinger@users.sourceforge.net Wed Nov 27 07:29:35 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 26 Nov 2002 23:29:35 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.110,1.111 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv24449a/Doc/lib Modified Files: libstdtypes.tex Log Message: SF Patch 643443. Added dict.fromkeys(iterable, value=None), a class method for constructing new dictionaries from sequences of keys. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** libstdtypes.tex 16 Nov 2002 00:44:00 -0000 1.110 --- libstdtypes.tex 27 Nov 2002 07:29:33 -0000 1.111 *************** *** 1056,1061 **** \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(3)} \lineiii{\var{a}.update(\var{b})} ! {\code{for k in \var{b}.keys(): \var{a}[k] = \var{b}[k]}} {} \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(3)} \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})} --- 1056,1064 ---- \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(3)} \lineiii{\var{a}.update(\var{b})} ! {\code{for \var{k} in \var{b}.keys(): \var{a}[\var{k}] = \var{b}[\var{k}]}} {} + \lineiii{\var{a}.fromkeys(\var{seq}\optional{, \var{value}})} + {Creates a new dictionary with keys from \var{seq} and values set to \var{value}} + {(7)} \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(3)} \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})} *************** *** 1115,1118 **** --- 1118,1125 ---- \item[(6)] \function{popitem()} is useful to destructively iterate over a dictionary, as often used in set algorithms. + \end{description} + + \item[(7)] \function{fromkeys()} is a class method that returns a + new dictionary. \var{value} defaults to \code{None}. \versionadded{2.3} \end{description} From rhettinger@users.sourceforge.net Wed Nov 27 07:29:36 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 26 Nov 2002 23:29:36 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_types.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24449a/Lib/test Modified Files: test_types.py Log Message: SF Patch 643443. Added dict.fromkeys(iterable, value=None), a class method for constructing new dictionaries from sequences of keys. Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** test_types.py 19 Nov 2002 20:49:13 -0000 1.40 --- test_types.py 27 Nov 2002 07:29:33 -0000 1.41 *************** *** 531,534 **** --- 531,562 ---- except ValueError: pass else: raise TestFailed, 'dict.update(), __getitem__ expected ValueError' + # dict.fromkeys() + if dict.fromkeys('abc') != {'a':None, 'b':None, 'c':None}: + raise TestFailed, 'dict.fromkeys did not work as a class method' + d = {} + if d.fromkeys('abc') is d: + raise TestFailed, 'dict.fromkeys did not return a new dict' + if d.fromkeys('abc') != {'a':None, 'b':None, 'c':None}: + raise TestFailed, 'dict.fromkeys failed with default value' + if d.fromkeys((4,5),0) != {4:0, 5:0}: + raise TestFailed, 'dict.fromkeys failed with specified value' + if d.fromkeys([]) != {}: + raise TestFailed, 'dict.fromkeys failed with null sequence' + def g(): + yield 1 + if d.fromkeys(g()) != {1:None}: + raise TestFailed, 'dict.fromkeys failed with a generator' + try: {}.fromkeys(3) + except TypeError: pass + else: raise TestFailed, 'dict.fromkeys failed to raise TypeError' + class dictlike(dict): pass + if dictlike.fromkeys('a') != {'a':None}: + raise TestFailed, 'dictsubclass.fromkeys did not inherit' + if dictlike().fromkeys('a') != {'a':None}: + raise TestFailed, 'dictsubclass.fromkeys did not inherit' + if type(dictlike.fromkeys('a')) is not dictlike: + raise TestFailed, 'dictsubclass.fromkeys created wrong type' + if type(dictlike().fromkeys('a')) is not dictlike: + raise TestFailed, 'dictsubclass.fromkeys created wrong type' # dict.copy() d = {1:1, 2:2, 3:3} From rhettinger@users.sourceforge.net Wed Nov 27 08:29:13 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 27 Nov 2002 00:29:13 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_userdict.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv10075/test Modified Files: test_userdict.py Log Message: Bring UserDict in-sync with changes to dict. Constructor accepts optional keyword arguments after a optional items list. Add fromkeys() as an alternate constructor from an iterable over keys. Expand related unittests. Index: test_userdict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userdict.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_userdict.py 22 Nov 2002 00:07:40 -0000 1.9 --- test_userdict.py 27 Nov 2002 08:29:11 -0000 1.10 *************** *** 7,10 **** --- 7,13 ---- d1 = {"one": 1} d2 = {"one": 1, "two": 2} + d3 = {"one": 1, "two": 3, "three": 5} + d4 = {"one": None, "two": None} + d5 = {"one": 1, "two": 1} # Test constructors *************** *** 22,25 **** --- 25,38 ---- verify(UserDict(one=1, two=2) == d2) # keyword arg constructor verify(UserDict([('one',1), ('two',2)]) == d2) # item sequence constructor + verify(UserDict(dict=[('one',1), ('two',2)]) == d2) + verify(UserDict([('one',1), ('two',2)], two=3, three=5) == d3) # both together + + verify(UserDict.fromkeys('one two'.split()) == d4) # alternate constructor + verify(UserDict().fromkeys('one two'.split()) == d4) + verify(UserDict.fromkeys('one two'.split(), 1) == d5) + verify(UserDict().fromkeys('one two'.split(), 1) == d5) + verify(u1.fromkeys('one two'.split()) is not u1) + verify(isinstance(u1.fromkeys('one two'.split()), UserDict)) + verify(isinstance(u2.fromkeys('one two'.split()), IterableUserDict)) # Test __repr__ From rhettinger@users.sourceforge.net Wed Nov 27 08:29:13 2002 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 27 Nov 2002 00:29:13 -0800 Subject: [Python-checkins] python/dist/src/Lib UserDict.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv10075 Modified Files: UserDict.py Log Message: Bring UserDict in-sync with changes to dict. Constructor accepts optional keyword arguments after a optional items list. Add fromkeys() as an alternate constructor from an iterable over keys. Expand related unittests. Index: UserDict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserDict.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** UserDict.py 22 Nov 2002 00:07:39 -0000 1.20 --- UserDict.py 27 Nov 2002 08:29:10 -0000 1.21 *************** *** 3,13 **** class UserDict: def __init__(self, dict=None, **kwargs): ! self.data = kwargs # defaults to {} if dict is not None: ! if hasattr(dict,'keys'): # handle mapping (possibly a UserDict) ! self.update(dict) ! else: # handle sequence ! DICT = type({}) # because builtin dict is locally overridden ! self.data.update(DICT(dict)) def __repr__(self): return repr(self.data) def __cmp__(self, dict): --- 3,13 ---- class UserDict: def __init__(self, dict=None, **kwargs): ! self.data = {} if dict is not None: ! if not hasattr(dict,'keys'): ! dict = type({})(dict) # make mapping from a sequence ! self.update(dict) ! if len(kwargs): ! self.update(kwargs) def __repr__(self): return repr(self.data) def __cmp__(self, dict): *************** *** 62,65 **** --- 62,71 ---- def __contains__(self, key): return key in self.data + def fromkeys(cls, iterable, value=None): + d = cls() + for key in iterable: + d[key] = value + return d + fromkeys = classmethod(fromkeys) class IterableUserDict(UserDict): From loewis@users.sourceforge.net Wed Nov 27 08:30:27 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 27 Nov 2002 00:30:27 -0800 Subject: [Python-checkins] python/dist/src/Lib _strptime.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv11560/Lib Modified Files: _strptime.py Log Message: Patch #639112: fixes for None locale and tz. Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** _strptime.py 23 Sep 2002 22:46:33 -0000 1.5 --- _strptime.py 27 Nov 2002 08:30:25 -0000 1.6 *************** *** 27,31 **** from string import whitespace as whitespace_string - __version__ = (2,1,6) __author__ = "Brett Cannon" __email__ = "drifty@bigfoot.com" --- 27,30 ---- *************** *** 288,298 **** def __calc_lang(self): ! # Set self.lang by using locale.getlocale() or ! # locale.getdefaultlocale(). current_lang = locale.getlocale(locale.LC_TIME)[0] if current_lang: self.__lang = current_lang else: ! self.__lang = locale.getdefaultlocale()[0] --- 287,303 ---- def __calc_lang(self): ! # Set self.__lang by using locale.getlocale() or ! # locale.getdefaultlocale(). If both turn up empty, set the attribute ! # to ''. This is to stop calls to this method and to make sure ! # strptime() can produce an re object correctly. current_lang = locale.getlocale(locale.LC_TIME)[0] if current_lang: self.__lang = current_lang else: ! current_lang = locale.getdefaultlocale()[0] ! if current_lang: ! self.__lang = current_lang ! else: ! self.__lang = '' *************** *** 464,468 **** elif group_key == 'Z': found_zone = found_dict['Z'].lower() ! if locale_time.timezone[0].lower() == found_zone: tz = 0 elif locale_time.timezone[1].lower() == found_zone: --- 469,476 ---- elif group_key == 'Z': found_zone = found_dict['Z'].lower() ! if locale_time.timezone[0] == locale_time.timezone[1]: ! pass #Deals with bad locale setup where timezone info is ! # the same; first found on FreeBSD 4.4 -current ! elif locale_time.timezone[0].lower() == found_zone: tz = 0 elif locale_time.timezone[1].lower() == found_zone: From loewis@users.sourceforge.net Wed Nov 27 08:30:27 2002 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 27 Nov 2002 00:30:27 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_strptime.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv11560/Lib/test Modified Files: test_strptime.py Log Message: Patch #639112: fixes for None locale and tz. Index: test_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_strptime.py 23 Sep 2002 22:46:49 -0000 1.6 --- test_strptime.py 27 Nov 2002 08:30:25 -0000 1.7 *************** *** 9,14 **** import _strptime - __version__ = (1,0,5) - class LocaleTime_Tests(unittest.TestCase): """Tests for _strptime.LocaleTime.""" --- 9,12 ---- *************** *** 19,23 **** self.LT_ins = _strptime.LocaleTime() ! def compare_against_time(self, testing, directive, tuple_position, error_msg): """Helper method that tests testing against directive based on the tuple_position of time_tuple. Uses error_msg as error message. --- 17,22 ---- self.LT_ins = _strptime.LocaleTime() ! def compare_against_time(self, testing, directive, tuple_position, ! error_msg): """Helper method that tests testing against directive based on the tuple_position of time_tuple. Uses error_msg as error message. *************** *** 26,56 **** strftime_output = time.strftime(directive, self.time_tuple) comparison = testing[self.time_tuple[tuple_position]] ! self.failUnless(strftime_output in testing, "%s: not found in tuple" % error_msg) ! self.failUnless(comparison == strftime_output, "%s: position within tuple incorrect; %s != %s" % (error_msg, comparison, strftime_output)) def test_weekday(self): # Make sure that full and abbreviated weekday names are correct in # both string and position with tuple ! self.compare_against_time(self.LT_ins.f_weekday, '%A', 6, "Testing of full weekday name failed") ! self.compare_against_time(self.LT_ins.a_weekday, '%a', 6, "Testing of abbreviated weekday name failed") def test_month(self): # Test full and abbreviated month names; both string and position # within the tuple ! self.compare_against_time(self.LT_ins.f_month, '%B', 1, "Testing against full month name failed") ! self.compare_against_time(self.LT_ins.a_month, '%b', 1, "Testing against abbreviated month name failed") def test_am_pm(self): # Make sure AM/PM representation done properly strftime_output = time.strftime("%p", self.time_tuple) ! self.failUnless(strftime_output in self.LT_ins.am_pm, "AM/PM representation not in tuple") if self.time_tuple[3] < 12: position = 0 else: position = 1 ! self.failUnless(strftime_output == self.LT_ins.am_pm[position], "AM/PM representation in the wrong position within the tuple") def test_timezone(self): # Make sure timezone is correct if time.strftime("%Z", self.time_tuple): ! self.compare_against_time(self.LT_ins.timezone, '%Z', 8, "Testing against timezone failed") def test_date_time(self): --- 25,65 ---- strftime_output = time.strftime(directive, self.time_tuple) comparison = testing[self.time_tuple[tuple_position]] ! self.failUnless(strftime_output in testing, "%s: not found in tuple" % ! error_msg) ! self.failUnless(comparison == strftime_output, ! "%s: position within tuple incorrect; %s != %s" % ! (error_msg, comparison, strftime_output)) def test_weekday(self): # Make sure that full and abbreviated weekday names are correct in # both string and position with tuple ! self.compare_against_time(self.LT_ins.f_weekday, '%A', 6, ! "Testing of full weekday name failed") ! self.compare_against_time(self.LT_ins.a_weekday, '%a', 6, ! "Testing of abbreviated weekday name failed") def test_month(self): # Test full and abbreviated month names; both string and position # within the tuple ! self.compare_against_time(self.LT_ins.f_month, '%B', 1, ! "Testing against full month name failed") ! self.compare_against_time(self.LT_ins.a_month, '%b', 1, ! "Testing against abbreviated month name failed") def test_am_pm(self): # Make sure AM/PM representation done properly strftime_output = time.strftime("%p", self.time_tuple) ! self.failUnless(strftime_output in self.LT_ins.am_pm, ! "AM/PM representation not in tuple") if self.time_tuple[3] < 12: position = 0 else: position = 1 ! self.failUnless(strftime_output == self.LT_ins.am_pm[position], ! "AM/PM representation in the wrong position within the tuple") def test_timezone(self): # Make sure timezone is correct if time.strftime("%Z", self.time_tuple): ! self.compare_against_time(self.LT_ins.timezone, '%Z', 8, ! "Testing against timezone failed") def test_date_time(self): *************** *** 63,71 **** magic_date = (1999, 3, 17, 22, 44, 55, 2, 76, 0) strftime_output = time.strftime("%c", magic_date) ! self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date_time, magic_date), "LC_date_time incorrect") strftime_output = time.strftime("%x", magic_date) ! self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date, magic_date), "LC_date incorrect") strftime_output = time.strftime("%X", magic_date) ! self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_time, magic_date), "LC_time incorrect") LT = _strptime.LocaleTime(am_pm=('','')) self.failUnless(LT.LC_time, "LocaleTime's LC directives cannot handle " --- 72,86 ---- magic_date = (1999, 3, 17, 22, 44, 55, 2, 76, 0) strftime_output = time.strftime("%c", magic_date) ! self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date_time, ! magic_date), ! "LC_date_time incorrect") strftime_output = time.strftime("%x", magic_date) ! self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_date, ! magic_date), ! "LC_date incorrect") strftime_output = time.strftime("%X", magic_date) ! self.failUnless(strftime_output == time.strftime(self.LT_ins.LC_time, ! magic_date), ! "LC_time incorrect") LT = _strptime.LocaleTime(am_pm=('','')) self.failUnless(LT.LC_time, "LocaleTime's LC directives cannot handle " *************** *** 74,99 **** def test_lang(self): # Make sure lang is set ! self.failUnless(self.LT_ins.lang in (locale.getdefaultlocale()[0], locale.getlocale(locale.LC_TIME)), "Setting of lang failed") def test_by_hand_input(self): # Test passed-in initialization value checks ! self.failUnless(_strptime.LocaleTime(f_weekday=range(7)), "Argument size check for f_weekday failed") self.assertRaises(TypeError, _strptime.LocaleTime, f_weekday=range(8)) self.assertRaises(TypeError, _strptime.LocaleTime, f_weekday=range(6)) ! self.failUnless(_strptime.LocaleTime(a_weekday=range(7)), "Argument size check for a_weekday failed") self.assertRaises(TypeError, _strptime.LocaleTime, a_weekday=range(8)) self.assertRaises(TypeError, _strptime.LocaleTime, a_weekday=range(6)) ! self.failUnless(_strptime.LocaleTime(f_month=range(12)), "Argument size check for f_month failed") self.assertRaises(TypeError, _strptime.LocaleTime, f_month=range(11)) self.assertRaises(TypeError, _strptime.LocaleTime, f_month=range(13)) ! self.failUnless(len(_strptime.LocaleTime(f_month=range(12)).f_month) == 13, "dummy value for f_month not added") ! self.failUnless(_strptime.LocaleTime(a_month=range(12)), "Argument size check for a_month failed") self.assertRaises(TypeError, _strptime.LocaleTime, a_month=range(11)) self.assertRaises(TypeError, _strptime.LocaleTime, a_month=range(13)) ! self.failUnless(len(_strptime.LocaleTime(a_month=range(12)).a_month) == 13, "dummy value for a_month not added") ! self.failUnless(_strptime.LocaleTime(am_pm=range(2)), "Argument size check for am_pm failed") self.assertRaises(TypeError, _strptime.LocaleTime, am_pm=range(1)) self.assertRaises(TypeError, _strptime.LocaleTime, am_pm=range(3)) ! self.failUnless(_strptime.LocaleTime(timezone=range(2)), "Argument size check for timezone failed") self.assertRaises(TypeError, _strptime.LocaleTime, timezone=range(1)) self.assertRaises(TypeError, _strptime.LocaleTime, timezone=range(3)) --- 89,125 ---- def test_lang(self): # Make sure lang is set ! self.failUnless(self.LT_ins.lang in (locale.getdefaultlocale()[0], ! locale.getlocale(locale.LC_TIME), ! ''), ! "Setting of lang failed") def test_by_hand_input(self): # Test passed-in initialization value checks ! self.failUnless(_strptime.LocaleTime(f_weekday=range(7)), ! "Argument size check for f_weekday failed") self.assertRaises(TypeError, _strptime.LocaleTime, f_weekday=range(8)) self.assertRaises(TypeError, _strptime.LocaleTime, f_weekday=range(6)) ! self.failUnless(_strptime.LocaleTime(a_weekday=range(7)), ! "Argument size check for a_weekday failed") self.assertRaises(TypeError, _strptime.LocaleTime, a_weekday=range(8)) self.assertRaises(TypeError, _strptime.LocaleTime, a_weekday=range(6)) ! self.failUnless(_strptime.LocaleTime(f_month=range(12)), ! "Argument size check for f_month failed") self.assertRaises(TypeError, _strptime.LocaleTime, f_month=range(11)) self.assertRaises(TypeError, _strptime.LocaleTime, f_month=range(13)) ! self.failUnless(len(_strptime.LocaleTime(f_month=range(12)).f_month) == 13, ! "dummy value for f_month not added") ! self.failUnless(_strptime.LocaleTime(a_month=range(12)), ! "Argument size check for a_month failed") self.assertRaises(TypeError, _strptime.LocaleTime, a_month=range(11)) self.assertRaises(TypeError, _strptime.LocaleTime, a_month=range(13)) ! self.failUnless(len(_strptime.LocaleTime(a_month=range(12)).a_month) == 13, ! "dummy value for a_month not added") ! self.failUnless(_strptime.LocaleTime(am_pm=range(2)), ! "Argument size check for am_pm failed") self.assertRaises(TypeError, _strptime.LocaleTime, am_pm=range(1)) self.assertRaises(TypeError, _strptime.LocaleTime, am_pm=range(3)) ! self.failUnless(_strptime.LocaleTime(timezone=range(2)), ! "Argument size check for timezone failed") self.assertRaises(TypeError, _strptime.LocaleTime, timezone=range(1)) self.assertRaises(TypeError, _strptime.LocaleTime, timezone=range(3)) *************** *** 109,118 **** def test_getitem(self): # Make sure that __getitem__ works properly ! self.failUnless(self.time_re['m'], "Fetching 'm' directive (built-in) failed") ! self.failUnless(self.time_re['b'], "Fetching 'b' directive (built w/ __tupleToRE) failed") for name in self.locale_time.a_month: ! self.failUnless(self.time_re['b'].find(name) != -1, "Not all abbreviated month names in regex") ! self.failUnless(self.time_re['c'], "Fetching 'c' directive (built w/ format) failed") ! self.failUnless(self.time_re['c'].find('%') == -1, "Conversion of 'c' directive failed; '%' found") self.assertRaises(KeyError, self.time_re.__getitem__, '1') --- 135,149 ---- def test_getitem(self): # Make sure that __getitem__ works properly ! self.failUnless(self.time_re['m'], ! "Fetching 'm' directive (built-in) failed") ! self.failUnless(self.time_re['b'], ! "Fetching 'b' directive (built w/ __tupleToRE) failed") for name in self.locale_time.a_month: ! self.failUnless(self.time_re['b'].find(name) != -1, ! "Not all abbreviated month names in regex") ! self.failUnless(self.time_re['c'], ! "Fetching 'c' directive (built w/ format) failed") ! self.failUnless(self.time_re['c'].find('%') == -1, ! "Conversion of 'c' directive failed; '%' found") self.assertRaises(KeyError, self.time_re.__getitem__, '1') *************** *** 120,141 **** # Test TimeRE.pattern pattern_string = self.time_re.pattern(r"%a %A %d") ! self.failUnless(pattern_string.find(self.locale_time.a_weekday[2]) != -1, "did not find abbreviated weekday in pattern string '%s'" % pattern_string) ! self.failUnless(pattern_string.find(self.locale_time.f_weekday[4]) != -1, "did not find full weekday in pattern string '%s'" % pattern_string) ! self.failUnless(pattern_string.find(self.time_re['d']) != -1, "did not find 'd' directive pattern string '%s'" % pattern_string) def test_compile(self): # Check that compiled regex is correct found = self.time_re.compile(r"%A").match(self.locale_time.f_weekday[6]) ! self.failUnless(found and found.group('A') == self.locale_time.f_weekday[6], "re object for '%A' failed") compiled = self.time_re.compile(r"%a %b") ! found = compiled.match("%s %s" % (self.locale_time.a_weekday[4], self.locale_time.a_month[4])) self.failUnless(found, ! "Match failed with '%s' regex and '%s' string" % (compiled.pattern, "%s %s" % (self.locale_time.a_weekday[4], self.locale_time.a_month[4]))) ! self.failUnless(found.group('a') == self.locale_time.a_weekday[4] and found.group('b') == self.locale_time.a_month[4], ! "re object couldn't find the abbreviated weekday month in '%s' using '%s'; group 'a' = '%s', group 'b' = %s'" % (found.string, found.re.pattern, found.group('a'), found.group('b'))) ! for directive in ('a','A','b','B','c','d','H','I','j','m','M','p','S','U','w','W','x','X','y','Y','Z','%'): compiled = self.time_re.compile("%%%s"% directive) found = compiled.match(time.strftime("%%%s" % directive)) ! self.failUnless(found, "Matching failed on '%s' using '%s' regex" % (time.strftime("%%%s" % directive), compiled.pattern)) class StrptimeTests(unittest.TestCase): --- 151,189 ---- # Test TimeRE.pattern pattern_string = self.time_re.pattern(r"%a %A %d") ! self.failUnless(pattern_string.find(self.locale_time.a_weekday[2]) != -1, ! "did not find abbreviated weekday in pattern string '%s'" % ! pattern_string) ! self.failUnless(pattern_string.find(self.locale_time.f_weekday[4]) != -1, ! "did not find full weekday in pattern string '%s'" % ! pattern_string) ! self.failUnless(pattern_string.find(self.time_re['d']) != -1, ! "did not find 'd' directive pattern string '%s'" % ! pattern_string) def test_compile(self): # Check that compiled regex is correct found = self.time_re.compile(r"%A").match(self.locale_time.f_weekday[6]) ! self.failUnless(found and found.group('A') == self.locale_time.f_weekday[6], ! "re object for '%A' failed") compiled = self.time_re.compile(r"%a %b") ! found = compiled.match("%s %s" % (self.locale_time.a_weekday[4], ! self.locale_time.a_month[4])) self.failUnless(found, ! "Match failed with '%s' regex and '%s' string" % ! (compiled.pattern, "%s %s" % (self.locale_time.a_weekday[4], ! self.locale_time.a_month[4]))) ! self.failUnless(found.group('a') == self.locale_time.a_weekday[4] and ! found.group('b') == self.locale_time.a_month[4], ! "re object couldn't find the abbreviated weekday month in " ! "'%s' using '%s'; group 'a' = '%s', group 'b' = %s'" % ! (found.string, found.re.pattern, found.group('a'), ! found.group('b'))) ! for directive in ('a','A','b','B','c','d','H','I','j','m','M','p','S', ! 'U','w','W','x','X','y','Y','Z','%'): compiled = self.time_re.compile("%%%s"% directive) found = compiled.match(time.strftime("%%%s" % directive)) ! self.failUnless(found, "Matching failed on '%s' using '%s' regex" % ! (time.strftime("%%%s" % directive), ! compiled.pattern)) class StrptimeTests(unittest.TestCase): *************** *** 148,160 **** def test_TypeError(self): # Make sure ValueError is raised when match fails ! self.assertRaises(ValueError,_strptime.strptime, data_string="%d", format="%A") def test_returning_RE(self): # Make sure that an re can be returned strp_output = _strptime.strptime(False, "%Y") ! self.failUnless(isinstance(strp_output, type(re.compile(''))), "re object not returned correctly") ! self.failUnless(_strptime.strptime("1999", strp_output), "Use or re object failed") bad_locale_time = _strptime.LocaleTime(lang="gibberish") ! self.assertRaises(TypeError, _strptime.strptime, data_string='1999', format=strp_output, locale_time=bad_locale_time) def helper(self, directive, position): --- 196,212 ---- def test_TypeError(self): # Make sure ValueError is raised when match fails ! self.assertRaises(ValueError, _strptime.strptime, data_string="%d", ! format="%A") def test_returning_RE(self): # Make sure that an re can be returned strp_output = _strptime.strptime(False, "%Y") ! self.failUnless(isinstance(strp_output, type(re.compile(''))), ! "re object not returned correctly") ! self.failUnless(_strptime.strptime("1999", strp_output), ! "Use of re object failed") bad_locale_time = _strptime.LocaleTime(lang="gibberish") ! self.assertRaises(TypeError, _strptime.strptime, data_string='1999', ! format=strp_output, locale_time=bad_locale_time) def helper(self, directive, position): *************** *** 162,166 **** strf_output = time.strftime("%%%s" % directive, self.time_tuple) strp_output = _strptime.strptime(strf_output, "%%%s" % directive) ! self.failUnless(strp_output[position] == self.time_tuple[position], "testing of '%s' directive failed; '%s' -> %s != %s" % (directive, strf_output, strp_output[position], self.time_tuple[position])) def test_year(self): --- 214,221 ---- strf_output = time.strftime("%%%s" % directive, self.time_tuple) strp_output = _strptime.strptime(strf_output, "%%%s" % directive) ! self.failUnless(strp_output[position] == self.time_tuple[position], ! "testing of '%s' directive failed; '%s' -> %s != %s" % ! (directive, strf_output, strp_output[position], ! self.time_tuple[position])) def test_year(self): *************** *** 183,187 **** strf_output = time.strftime("%I %p", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%I %p") ! self.failUnless(strp_output[3] == self.time_tuple[3], "testing of '%%I %%p' directive failed; '%s' -> %s != %s" % (strf_output, strp_output[3], self.time_tuple[3])) def test_minute(self): --- 238,244 ---- strf_output = time.strftime("%I %p", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%I %p") ! self.failUnless(strp_output[3] == self.time_tuple[3], ! "testing of '%%I %%p' directive failed; '%s' -> %s != %s" % ! (strf_output, strp_output[3], self.time_tuple[3])) def test_minute(self): *************** *** 205,212 **** # Test timezone directives. # When gmtime() is used with %Z, entire result of strftime() is empty. time_tuple = time.localtime() strf_output = time.strftime("%Z") #UTC does not have a timezone strp_output = _strptime.strptime(strf_output, "%Z") ! self.failUnless(strp_output[8] == time_tuple[8], "timezone check failed; '%s' -> %s != %s" % (strf_output, strp_output[8], time_tuple[8])) def test_date_time(self): --- 262,279 ---- # Test timezone directives. # When gmtime() is used with %Z, entire result of strftime() is empty. + # Check for equal timezone names deals with bad locale info when this + # occurs; first found in FreeBSD 4.4 -current time_tuple = time.localtime() strf_output = time.strftime("%Z") #UTC does not have a timezone strp_output = _strptime.strptime(strf_output, "%Z") ! locale_time = _strptime.LocaleTime() ! if locale_time.timezone[0] != locale_time.timezone[1]: ! self.failUnless(strp_output[8] == time_tuple[8], ! "timezone check failed; '%s' -> %s != %s" % ! (strf_output, strp_output[8], time_tuple[8])) ! else: ! self.failUnless(strp_output[8] == -1, ! "LocaleTime().timezone has duplicate values but " ! "timzone value not set to -1") def test_date_time(self): *************** *** 229,233 **** strf_output = time.strftime("%m %% %Y", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%m %% %Y") ! self.failUnless(strp_output[0] == self.time_tuple[0] and strp_output[1] == self.time_tuple[1], "handling of percent sign failed") def test_caseinsensitive(self): --- 296,302 ---- strf_output = time.strftime("%m %% %Y", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%m %% %Y") ! self.failUnless(strp_output[0] == self.time_tuple[0] and ! strp_output[1] == self.time_tuple[1], ! "handling of percent sign failed") def test_caseinsensitive(self): *************** *** 242,246 **** class FxnTests(unittest.TestCase): ! """Test functions that fill in info by validating result and are triggered properly.""" def setUp(self): --- 311,316 ---- class FxnTests(unittest.TestCase): ! """Test functions that fill in info by validating result and are triggered ! properly.""" def setUp(self): *************** *** 250,255 **** def test_julianday_result(self): # Test julianday ! result = _strptime.julianday(self.time_tuple[0], self.time_tuple[1], self.time_tuple[2]) ! self.failUnless(result == self.time_tuple[7], "julianday failed; %s != %s" % (result, self.time_tuple[7])) def test_julianday_trigger(self): --- 320,328 ---- def test_julianday_result(self): # Test julianday ! result = _strptime.julianday(self.time_tuple[0], self.time_tuple[1], ! self.time_tuple[2]) ! self.failUnless(result == self.time_tuple[7], ! "julianday failed; %s != %s" % ! (result, self.time_tuple[7])) def test_julianday_trigger(self): *************** *** 257,261 **** strf_output = time.strftime("%Y-%m-%d", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%Y-%m-%d") ! self.failUnless(strp_output[7] == self.time_tuple[7], "strptime did not trigger julianday(); %s != %s" % (strp_output[7], self.time_tuple[7])) def test_gregorian_result(self): --- 330,336 ---- strf_output = time.strftime("%Y-%m-%d", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%Y-%m-%d") ! self.failUnless(strp_output[7] == self.time_tuple[7], ! "strptime did not trigger julianday(); %s != %s" % ! (strp_output[7], self.time_tuple[7])) def test_gregorian_result(self): *************** *** 263,267 **** result = _strptime.gregorian(self.time_tuple[7], self.time_tuple[0]) comparison = [self.time_tuple[0], self.time_tuple[1], self.time_tuple[2]] ! self.failUnless(result == comparison, "gregorian() failed; %s != %s" % (result, comparison)) def test_gregorian_trigger(self): --- 338,343 ---- result = _strptime.gregorian(self.time_tuple[7], self.time_tuple[0]) comparison = [self.time_tuple[0], self.time_tuple[1], self.time_tuple[2]] ! self.failUnless(result == comparison, ! "gregorian() failed; %s != %s" % (result, comparison)) def test_gregorian_trigger(self): *************** *** 269,279 **** strf_output = time.strftime("%j %Y", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%j %Y") ! self.failUnless(strp_output[1] == self.time_tuple[1] and strp_output[2] == self.time_tuple[2], "gregorian() not triggered; month -- %s != %s, day -- %s != %s" % (strp_output[1], self.time_tuple[1], strp_output[2], self.time_tuple[2])) def test_dayofweek_result(self): # Test dayofweek ! result = _strptime.dayofweek(self.time_tuple[0], self.time_tuple[1], self.time_tuple[2]) comparison = self.time_tuple[6] ! self.failUnless(result == comparison, "dayofweek() failed; %s != %s" % (result, comparison)) def test_dayofweek_trigger(self): --- 345,362 ---- strf_output = time.strftime("%j %Y", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%j %Y") ! self.failUnless(strp_output[1] == self.time_tuple[1] and ! strp_output[2] == self.time_tuple[2], ! "gregorian() not triggered; month -- %s != %s, " ! "day -- %s != %s" % ! (strp_output[1], self.time_tuple[1], strp_output[2], ! self.time_tuple[2])) def test_dayofweek_result(self): # Test dayofweek ! result = _strptime.dayofweek(self.time_tuple[0], self.time_tuple[1], ! self.time_tuple[2]) comparison = self.time_tuple[6] ! self.failUnless(result == comparison, ! "dayofweek() failed; %s != %s" % (result, comparison)) def test_dayofweek_trigger(self): *************** *** 281,285 **** strf_output = time.strftime("%Y-%m-%d", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%Y-%m-%d") ! self.failUnless(strp_output[6] == self.time_tuple[6], "triggering of dayofweek() failed; %s != %s" % (strp_output[6], self.time_tuple[6])) --- 364,370 ---- strf_output = time.strftime("%Y-%m-%d", self.time_tuple) strp_output = _strptime.strptime(strf_output, "%Y-%m-%d") ! self.failUnless(strp_output[6] == self.time_tuple[6], ! "triggering of dayofweek() failed; %s != %s" % ! (strp_output[6], self.time_tuple[6])) From mwh@users.sourceforge.net Wed Nov 27 10:24:46 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 27 Nov 2002 02:24:46 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.190,2.191 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv17140/Objects Modified Files: typeobject.c Log Message: I had the inheritance cycle stuff backwards. Oops! Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.190 retrieving revision 2.191 diff -C2 -d -r2.190 -r2.191 *** typeobject.c 26 Nov 2002 17:49:11 -0000 2.190 --- typeobject.c 27 Nov 2002 10:24:43 -0000 2.191 *************** *** 209,216 **** return -1; } ! if (PyType_IsSubtype(type, (PyTypeObject*)ob)) { ! PyErr_SetString(PyExc_TypeError, ! "a __bases__ item causes an inheritance cycle"); ! return -1; } } --- 209,218 ---- return -1; } ! if (PyType_Check(ob)) { ! if (PyType_IsSubtype((PyTypeObject*)ob, type)) { ! PyErr_SetString(PyExc_TypeError, ! "a __bases__ item causes an inheritance cycle"); ! return -1; ! } } } From mwh@users.sourceforge.net Wed Nov 27 10:24:46 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 27 Nov 2002 02:24:46 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.164,1.165 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17140/Lib/test Modified Files: test_descr.py Log Message: I had the inheritance cycle stuff backwards. Oops! Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.164 retrieving revision 1.165 diff -C2 -d -r1.164 -r1.165 *** test_descr.py 27 Nov 2002 04:00:59 -0000 1.164 --- test_descr.py 27 Nov 2002 10:24:44 -0000 1.165 *************** *** 3453,3456 **** --- 3453,3457 ---- d = D() e = E() + D.__bases__ = (C,) D.__bases__ = (C2,) vereq(d.meth(), 1) *************** *** 3491,3494 **** --- 3492,3502 ---- else: # actually, we'll have crashed by here... + raise TestFailed, "shouldn't be able to create inheritance cycles" + + try: + D.__bases__ = (E,) + except TypeError: + pass + else: raise TestFailed, "shouldn't be able to create inheritance cycles" From gvanrossum@users.sourceforge.net Wed Nov 27 13:10:43 2002 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed, 27 Nov 2002 05:10:43 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.548,1.549 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv12051 Modified Files: NEWS Log Message: Rephrase dict.fromkeys() news. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.548 retrieving revision 1.549 diff -C2 -d -r1.548 -r1.549 *** NEWS 27 Nov 2002 07:29:32 -0000 1.548 --- NEWS 27 Nov 2002 13:10:40 -0000 1.549 *************** *** 271,278 **** example, "Foo!!!?!?!?".rstrip("?!") -> "Foo". ! - Dictionaries have a new class method, fromkeys(iterable, value=None). ! It constructs a new dictionary with keys taken from the iterable and ! all values set to a single value. It is used for building membership ! tests and for removing duplicates from sequences. - Added a new dict method pop(key). This removes and returns the --- 271,279 ---- example, "Foo!!!?!?!?".rstrip("?!") -> "Foo". ! - There's a new dictionary constructor (a class method of the dict ! class), dict.fromkeys(iterable, value=None). It constructs a ! dictionary with keys taken from the iterable and all values set to a ! single value. It can be used for building sets and for removing ! duplicates from sequences. - Added a new dict method pop(key). This removes and returns the From akuchling@users.sourceforge.net Wed Nov 27 13:34:23 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 27 Nov 2002 05:34:23 -0800 Subject: [Python-checkins] python/dist/src/Doc/inst inst.tex,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/inst In directory sc8-pr-cvs1:/tmp/cvs-serv19528 Modified Files: inst.tex Log Message: Bug #643631: MacOS 9 details missing from inst.tex Fill in the missing details. (From Jack Jansen) Index: inst.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/inst/inst.tex,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** inst.tex 25 Nov 2002 13:56:12 -0000 1.45 --- inst.tex 27 Nov 2002 13:34:20 -0000 1.46 *************** *** 169,188 **** \end{verbatim} ! On Mac OS, you have to go through a bit more effort to supply ! command-line arguments to the setup script: ! \begin{itemize} ! \item hit option-double-click on the script's icon (or option-drop it ! onto the Python interpreter's icon) ! \item press the ``Set unix-style command line'' button ! \item set the ``Keep stdio window open on termination'' if you're ! interested in seeing the output of the setup script (which is usually ! voluminous and often useful) ! \item when the command-line dialog pops up, enter ``install'' (you ! can, of course, enter any Distutils command-line as described in this ! document or in \citetitle[../dist/dist.html]{Distributing Python ! Modules}: just leave off the initial \code{python setup.py} and ! you'll be fine) ! \end{itemize} ! \subsection{Splitting the job up} --- 169,177 ---- \end{verbatim} ! On Mac OS 9, you double-click the \file{setup.py} script. It will bring ! up a dialog where you can select the \command{install} command. Then ! selecting the \command{run} button will install your distribution. ! The dialog is built dynamically, so all commands and options for this ! specific distribution are listed. \subsection{Splitting the job up} *************** *** 321,325 **** Under \UNIX, just type \code{python} at the shell prompt. Under Windows, choose \menuselection{Start \sub Programs \sub Python ! 2.1 \sub Python (command line)}. Under Mac OS, \XXX{???}. Once the interpreter is started, you type Python code at the prompt. For example, on my Linux system, I type the three Python --- 310,314 ---- Under \UNIX, just type \code{python} at the shell prompt. Under Windows, choose \menuselection{Start \sub Programs \sub Python ! 2.1 \sub Python (command line)}. Under Mac OS 9, start \file{PythonInterpreter}. Once the interpreter is started, you type Python code at the prompt. For example, on my Linux system, I type the three Python *************** *** 681,685 **** define a few extra variables that may not be in your environment, such as \code{\$PLAT}. (And of course, on systems that don't have ! environment variables, such as Mac OS (\XXX{true?}), the configuration variables supplied by the Distutils are the only ones you can use.) See section~\ref{config-files} for details. --- 670,674 ---- define a few extra variables that may not be in your environment, such as \code{\$PLAT}. (And of course, on systems that don't have ! environment variables, such as Mac OS 9, the configuration variables supplied by the Distutils are the only ones you can use.) See section~\ref{config-files} for details. From akuchling@users.sourceforge.net Wed Nov 27 13:43:49 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 27 Nov 2002 05:43:49 -0800 Subject: [Python-checkins] python/dist/src setup.py,1.120,1.121 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv22120 Modified Files: setup.py Log Message: [Patch #641685] setup.py contained code for finding libraries, instead of using the CCompiler.find_library_file() provided by the Distutils. This patch fixes it to use the Distutils method at the cost of some additional glue. (The duplication resulted in the SSL module not being automatically built on Macs; the Distutils knew that shared libraries on OS X have a .dylib extension, but the setup.py code didn't.) Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -d -r1.120 -r1.121 *** setup.py 24 Nov 2002 23:15:57 -0000 1.120 --- setup.py 27 Nov 2002 13:43:46 -0000 1.121 *************** *** 49,60 **** def find_library_file(compiler, libname, std_dirs, paths): ! filename = compiler.library_filename(libname, lib_type='shared') ! result = find_file(filename, std_dirs, paths) ! if result is not None: return result ! filename = compiler.library_filename(libname, lib_type='static') ! result = find_file(filename, std_dirs, paths) ! return result def module_enabled(extlist, modname): """Returns whether the module 'modname' is present in the list --- 49,76 ---- def find_library_file(compiler, libname, std_dirs, paths): ! result = compiler.find_library_file(std_dirs + paths, libname) ! if result is None: ! return None ! # Check whether the found file is in one of the standard directories ! dirname = os.path.dirname(result) ! for p in std_dirs: ! # Ensure path doesn't end with path separator ! if p.endswith(os.sep): ! p = p.strip(os.sep) ! if p == dirname: ! return [ ] + # Otherwise, it must have been in one of the additional directories, + # so we have to figure out which one. + for p in paths: + # Ensure path doesn't end with path separator + if p.endswith(os.sep): + p = p.strip(os.sep) + if p == dirname: + return [p] + else: + assert False, "Internal error: Path not found in std_dirs or paths" + def module_enabled(extlist, modname): """Returns whether the module 'modname' is present in the list From akuchling@users.sourceforge.net Wed Nov 27 13:45:29 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 27 Nov 2002 05:45:29 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils extension.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv24105 Modified Files: extension.py Log Message: [Part of patch #641685] Add .dylib as an extension for shared libraries Index: extension.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/extension.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** extension.py 20 Nov 2002 16:10:29 -0000 1.16 --- extension.py 27 Nov 2002 13:45:26 -0000 1.17 *************** *** 215,219 **** if not value: append_next_word = ext.extra_link_args ! elif suffix in (".a", ".so", ".sl", ".o"): # NB. a really faithful emulation of makesetup would # append a .o file to extra_objects only if it --- 215,219 ---- if not value: append_next_word = ext.extra_link_args ! elif suffix in (".a", ".so", ".sl", ".o", ".dylib"): # NB. a really faithful emulation of makesetup would # append a .o file to extra_objects only if it From neal@metaslash.com Wed Nov 27 13:59:22 2002 From: neal@metaslash.com (Neal Norwitz) Date: Wed, 27 Nov 2002 08:59:22 -0500 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.131,2.132 In-Reply-To: References: Message-ID: <20021127135922.GA17931@epoch.metaslash.com> On Tue, Nov 26, 2002 at 11:29:35PM -0800, rhettinger@users.sourceforge.net wrote: > Modified Files: > dictobject.c > > + d = PyObject_CallObject(cls, NULL); > + if (d == NULL) > + return NULL; > + if (!PyDict_Check(d)) { > + PyErr_BadInternalCall(); > + return NULL; > + } Shouldn't there be a Py_DECREF(d) if type(d) is not dict? Neal From mwh@users.sourceforge.net Wed Nov 27 15:20:21 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 27 Nov 2002 07:20:21 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.191,2.192 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv8099/Objects Modified Files: typeobject.c Log Message: Readjustments to the way we cope with exceptions from subclasses' mro() methods. Now any exception aborts the whole __bases__ change. And more tests. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.191 retrieving revision 2.192 diff -C2 -d -r2.191 -r2.192 *** typeobject.c 27 Nov 2002 10:24:43 -0000 2.191 --- typeobject.c 27 Nov 2002 15:20:18 -0000 2.192 *************** *** 143,151 **** static int ! mro_subclasses(PyTypeObject *type) { PyTypeObject *subclass; PyObject *ref, *subclasses, *old_mro; ! int i, n, r = 0; subclasses = type->tp_subclasses; --- 143,151 ---- static int ! mro_subclasses(PyTypeObject *type, PyObject* temp) { PyTypeObject *subclass; PyObject *ref, *subclasses, *old_mro; ! int i, n; subclasses = type->tp_subclasses; *************** *** 165,177 **** if (mro_internal(subclass) < 0) { subclass->tp_mro = old_mro; ! r = -1; } else { ! Py_DECREF(old_mro); } ! if (mro_subclasses(subclass) < 0) ! r = -1; } ! return r; } --- 165,182 ---- if (mro_internal(subclass) < 0) { subclass->tp_mro = old_mro; ! return -1; } else { ! PyObject* tuple; ! tuple = Py_BuildValue("OO", subclass, old_mro); ! if (!tuple) ! return -1; ! if (PyList_Append(temp, tuple) < 0) ! return -1; } ! if (mro_subclasses(subclass, temp) < 0) ! return -1; } ! return 0; } *************** *** 180,184 **** { int i, r = 0; ! PyObject* ob; PyTypeObject *new_base, *old_base; PyObject *old_bases, *old_mro; --- 185,189 ---- { int i, r = 0; ! PyObject *ob, *temp; PyTypeObject *new_base, *old_base; PyObject *old_bases, *old_mro; *************** *** 248,253 **** } ! if (mro_subclasses(type) < 0) ! r = -1; /* any base that was in __bases__ but now isn't, we --- 253,275 ---- } ! temp = PyList_New(0); ! ! r = mro_subclasses(type, temp); ! ! if (r < 0) { ! for (i = 0; i < PyList_Size(temp); i++) { ! PyTypeObject* cls; ! PyObject* mro; ! PyArg_ParseTuple(PyList_GetItem(temp, i), ! "OO", &cls, &mro); ! Py_DECREF(cls->tp_mro); ! cls->tp_mro = mro; ! Py_INCREF(cls->tp_mro); ! } ! Py_DECREF(temp); ! return r; ! } ! ! Py_DECREF(temp); /* any base that was in __bases__ but now isn't, we From mwh@users.sourceforge.net Wed Nov 27 15:20:21 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 27 Nov 2002 07:20:21 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.165,1.166 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv8099/Lib/test Modified Files: test_descr.py Log Message: Readjustments to the way we cope with exceptions from subclasses' mro() methods. Now any exception aborts the whole __bases__ change. And more tests. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.165 retrieving revision 1.166 diff -C2 -d -r1.165 -r1.166 *** test_descr.py 27 Nov 2002 10:24:44 -0000 1.165 --- test_descr.py 27 Nov 2002 15:20:19 -0000 1.166 *************** *** 3435,3439 **** type.mro(tuple) ! def mutable_bases(): # stuff that should work: class C(object): --- 3435,3439 ---- type.mro(tuple) ! def test_mutable_bases(): # stuff that should work: class C(object): *************** *** 3524,3527 **** --- 3524,3601 ---- raise TestFailed, "new-style class must have a new-style base" + def test_mutable_bases_with_failing_mro(): + class WorkOnce(type): + def __new__(self, name, bases, ns): + self.flag = 0 + return super(WorkOnce, self).__new__(WorkOnce, name, bases, ns) + def mro(self): + if self.flag > 0: + raise RuntimeError, "bozo" + else: + self.flag += 1 + return type.mro(self) + + class WorkAlways(type): + def mro(self): + # this is here to make sure that .mro()s aren't called + # with an exception set (which was possible at one point). + # An error message will be printed in a debug build. + # What's a good way to test for this? + return type.mro(self) + + class C(object): + pass + + class C2(object): + pass + + class D(C): + pass + + class E(D): + pass + + class F(D): + __metaclass__ = WorkOnce + + class G(D): + __metaclass__ = WorkAlways + + # Immediate subclasses have their mro's adjusted in alphabetical + # order, so E's will get adjusted before adjusting F's fails. We + # check here that E's gets restored. + + E_mro_before = E.__mro__ + + try: + D.__bases__ = (C2,) + except RuntimeError: + vereq(E.__mro__, E_mro_before) + else: + raise TestFailed, "exception not propagated" + + def test_mutable_bases_catch_mro_conflict(): + class A(object): + pass + + class B(object): + pass + + class C(A, B): + pass + + class D(A, B): + pass + + class E(C, D): + pass + + try: + C.__bases__ = (B, A) + except TypeError: + pass + else: + raise TestFailed, "didn't catch MRO conflict" + def mutable_names(): class C(object): *************** *** 3609,3614 **** testrmul() testipow() ! mutable_bases() mutable_names() if verbose: print "All OK" --- 3683,3691 ---- testrmul() testipow() ! test_mutable_bases() ! test_mutable_bases_with_failing_mro() ! test_mutable_bases_catch_mro_conflict() mutable_names() + if verbose: print "All OK" From mwh@users.sourceforge.net Wed Nov 27 15:40:11 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 27 Nov 2002 07:40:11 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.166,1.167 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv19018/Lib/test Modified Files: test_descr.py Log Message: I don't know why staring at the email to python-checkins made me see problems with my code that I didn't see before the checkin, but: When a subtype .mro() fails, we need to reset the type whose __bases__ are being changed, too. Fix + test. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.166 retrieving revision 1.167 diff -C2 -d -r1.166 -r1.167 *** test_descr.py 27 Nov 2002 15:20:19 -0000 1.166 --- test_descr.py 27 Nov 2002 15:40:09 -0000 1.167 *************** *** 3567,3570 **** --- 3567,3571 ---- E_mro_before = E.__mro__ + D_mro_before = D.__mro__ try: *************** *** 3572,3575 **** --- 3573,3577 ---- except RuntimeError: vereq(E.__mro__, E_mro_before) + vereq(D.__mro__, D_mro_before) else: raise TestFailed, "exception not propagated" From mwh@users.sourceforge.net Wed Nov 27 15:40:11 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 27 Nov 2002 07:40:11 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.192,2.193 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv19018/Objects Modified Files: typeobject.c Log Message: I don't know why staring at the email to python-checkins made me see problems with my code that I didn't see before the checkin, but: When a subtype .mro() fails, we need to reset the type whose __bases__ are being changed, too. Fix + test. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.192 retrieving revision 2.193 diff -C2 -d -r2.192 -r2.193 *** typeobject.c 27 Nov 2002 15:20:18 -0000 2.192 --- typeobject.c 27 Nov 2002 15:40:08 -0000 2.193 *************** *** 243,257 **** if (mro_internal(type) < 0) { ! type->tp_bases = old_bases; ! type->tp_base = old_base; ! type->tp_mro = old_mro; ! ! Py_DECREF(value); ! Py_DECREF(new_base); ! ! return -1; } temp = PyList_New(0); r = mro_subclasses(type, temp); --- 243,252 ---- if (mro_internal(type) < 0) { ! goto bail; } temp = PyList_New(0); + if (!temp) + goto bail; r = mro_subclasses(type, temp); *************** *** 268,272 **** } Py_DECREF(temp); ! return r; } --- 263,267 ---- } Py_DECREF(temp); ! goto bail; } *************** *** 304,307 **** --- 299,312 ---- return r; + + bail: + type->tp_bases = old_bases; + type->tp_base = old_base; + type->tp_mro = old_mro; + + Py_DECREF(value); + Py_DECREF(new_base); + + return -1; } From nnorwitz@users.sourceforge.net Wed Nov 27 15:47:12 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 27 Nov 2002 07:47:12 -0800 Subject: [Python-checkins] python/dist/src/Lib/test README,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv22890/Lib/test Modified Files: README Log Message: SF #641170, reST version of Lib/test/README Convert test/README to reST Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/README,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** README 22 Aug 2002 20:08:14 -0000 1.16 --- README 27 Nov 2002 15:47:10 -0000 1.17 *************** *** 1,9 **** ! Writing Python Regression Tests ! ------------------------------- ! Skip Montanaro ! (skip@mojam.com) Introduction If you add a new module to Python or modify the functionality of an existing --- 1,11 ---- ! +++++++++++++++++++++++++++++++ ! Writing Python Regression Tests ! +++++++++++++++++++++++++++++++ + :Author: Skip Montanaro + :Contact: skip@mojam.com Introduction + ============ If you add a new module to Python or modify the functionality of an existing *************** *** 14,19 **** conventions of the the selected option: ! - PyUnit based tests ! - doctest based tests - "traditional" Python test modules --- 16,21 ---- conventions of the the selected option: ! - PyUnit_ based tests ! - doctest_ based tests - "traditional" Python test modules *************** *** 27,50 **** your regression test cases. PyUnit based tests ! ! The PyUnit framework is based on the ideas of unit testing as espoused ! by Kent Beck and the Extreme Programming (XP) movement. The specific ! interface provided by the framework is tightly based on the JUnit Java implementation of Beck's original SmallTalk test framework. Please ! see the documentation of the unittest module for detailed information on the interface and general guidelines on writing PyUnit based tests. The test_support helper module provides a two functions for use by PyUnit based tests in the Python regression testing framework: ! run_unittest() takes a unittest.TestCase derived class as a parameter ! and runs the tests defined in that class, and run_suite() takes a ! populated TestSuite instance and runs the tests. run_suite() is ! preferred because unittest files typically grow multiple test classes, ! and you might as well be prepared. All test methods in the Python regression framework have names that ! start with "test_" and use lower-case names with words separated with underscores. --- 29,59 ---- your regression test cases. + .. _PyUnit: + .. _unittest: http://www.python.org/doc/current/lib/module-unittest.html + .. _doctest: http://www.python.org/doc/current/lib/module-doctest.html PyUnit based tests ! ------------------ ! The PyUnit_ framework is based on the ideas of unit testing as espoused ! by Kent Beck and the `Extreme Programming`_ (XP) movement. The specific ! interface provided by the framework is tightly based on the JUnit_ Java implementation of Beck's original SmallTalk test framework. Please ! see the documentation of the unittest_ module for detailed information on the interface and general guidelines on writing PyUnit based tests. The test_support helper module provides a two functions for use by PyUnit based tests in the Python regression testing framework: ! ! - ``run_unittest()`` takes a ``unittest.TestCase`` derived class as a ! parameter and runs the tests defined in that class ! ! - ``run_suite()`` takes a populated ``TestSuite`` instance and runs the ! tests ! ! ``run_suite()`` is preferred because unittest files typically grow multiple ! test classes, and you might as well be prepared. All test methods in the Python regression framework have names that ! start with "``test_``" and use lower-case names with words separated with underscores. *************** *** 56,60 **** All PyUnit-based tests in the Python test suite use boilerplate that ! looks like this (with minor variations): import unittest --- 65,69 ---- All PyUnit-based tests in the Python test suite use boilerplate that ! looks like this (with minor variations):: import unittest *************** *** 102,109 **** regrtest framework. doctest based tests ! ! Tests written to use doctest are actually part of the docstrings for the module being tested. Each test is written as a display of an interactive session, including the Python prompts, statements that would --- 111,120 ---- regrtest framework. + .. _Extreme Programming: http://www.extremeprogramming.org/ + .. _JUnit: http://www.junit.org/ doctest based tests ! ------------------- ! Tests written to use doctest_ are actually part of the docstrings for the module being tested. Each test is written as a display of an interactive session, including the Python prompts, statements that would *************** *** 112,116 **** The module in the test package is simply a wrapper that causes doctest to run over the tests in the module. The test for the difflib module ! provides a convenient example: import difflib --- 123,127 ---- The module in the test package is simply a wrapper that causes doctest to run over the tests in the module. The test for the difflib module ! provides a convenient example:: import difflib *************** *** 123,132 **** A second argument can be passed to run_doctest to tell doctest to search ! sys.argv for -v instead of using test_support's idea of verbosity. This is useful for writing doctest-based tests that aren't simply running a doctest'ed Lib module, but contain the doctests themselves. Then at times you may want to run such a test directly as a doctest, independent of the regrtest framework. The tail end of test_descrtut.py is a good ! example: def test_main(verbose=None): --- 134,143 ---- A second argument can be passed to run_doctest to tell doctest to search ! ``sys.argv`` for -v instead of using test_support's idea of verbosity. This is useful for writing doctest-based tests that aren't simply running a doctest'ed Lib module, but contain the doctests themselves. Then at times you may want to run such a test directly as a doctest, independent of the regrtest framework. The tail end of test_descrtut.py is a good ! example:: def test_main(verbose=None): *************** *** 137,161 **** test_main(1) ! If run via regrtest, test_main() is called (by regrtest) without specifying ! verbose, and then test_support's idea of verbosity is used. But when ! run directly, test_main(1) is called, and then doctest's idea of verbosity ! is used. See the documentation for the doctest module for information on writing tests using the doctest framework. - "traditional" Python test modules ! The mechanics of how the "traditional" test system operates are fairly straightforward. When a test case is run, the output is compared with the expected output that is stored in .../Lib/test/output. If the test runs to completion and the actual and expected outputs match, the test succeeds, if ! not, it fails. If an ImportError or test_support.TestSkipped error is ! raised, the test is not run. ! Executing Test Cases ! If you are writing test cases for module spam, you need to create a file in .../Lib/test named test_spam.py. In addition, if the tests are expected --- 148,170 ---- test_main(1) ! If run via regrtest, ``test_main()`` is called (by regrtest) without ! specifying verbose, and then test_support's idea of verbosity is used. But ! when run directly, ``test_main(1)`` is called, and then doctest's idea of ! verbosity is used. See the documentation for the doctest module for information on writing tests using the doctest framework. "traditional" Python test modules ! --------------------------------- The mechanics of how the "traditional" test system operates are fairly straightforward. When a test case is run, the output is compared with the expected output that is stored in .../Lib/test/output. If the test runs to completion and the actual and expected outputs match, the test succeeds, if ! not, it fails. If an ``ImportError`` or ``test_support.TestSkipped`` error ! is raised, the test is not run. Executing Test Cases ! ==================== If you are writing test cases for module spam, you need to create a file in .../Lib/test named test_spam.py. In addition, if the tests are expected *************** *** 164,168 **** represents the top-level directory in the Python source tree, the directory containing the configure script). If needed, generate the initial version ! of the test output file by executing: ./python Lib/test/regrtest.py -g test_spam.py --- 173,177 ---- represents the top-level directory in the Python source tree, the directory containing the configure script). If needed, generate the initial version ! of the test output file by executing:: ./python Lib/test/regrtest.py -g test_spam.py *************** *** 177,186 **** To run a single test after modifying a module, simply run regrtest.py ! without the -g flag: ./python Lib/test/regrtest.py test_spam.py While debugging a regression test, you can of course execute it ! independently of the regression testing framework and see what it prints: ./python Lib/test/test_spam.py --- 186,195 ---- To run a single test after modifying a module, simply run regrtest.py ! without the -g flag:: ./python Lib/test/regrtest.py test_spam.py While debugging a regression test, you can of course execute it ! independently of the regression testing framework and see what it prints:: ./python Lib/test/test_spam.py *************** *** 188,202 **** To run the entire test suite: ! [UNIX, + other platforms where "make" works] Make the "test" target at the ! top level: make test ! [WINDOWS] Run rt.bat from your PCBuild directory. Read the comments at ! the top of rt.bat for the use of special -d, -O and -q options processed ! by rt.bat. ! [OTHER] You can simply execute the two runs of regrtest (optimized and ! non-optimized) directly: ./python Lib/test/regrtest.py --- 197,211 ---- To run the entire test suite: ! - [UNIX, + other platforms where "make" works] Make the "test" target at the ! top level:: make test ! - [WINDOWS] Run rt.bat from your PCBuild directory. Read the comments at ! the top of rt.bat for the use of special -d, -O and -q options processed ! by rt.bat. ! - [OTHER] You can simply execute the two runs of regrtest (optimized and ! non-optimized) directly:: ./python Lib/test/regrtest.py *************** *** 218,226 **** Test Case Writing Tips ! Writing good test cases is a skilled task and is too complex to discuss in detail in this short document. Many books have been written on the subject. ! I'll show my age by suggesting that Glenford Myers' "The Art of Software ! Testing", published in 1979, is still the best introduction to the subject available. It is short (177 pages), easy to read, and discusses the major elements of software testing, though its publication predates the --- 227,235 ---- Test Case Writing Tips ! ====================== Writing good test cases is a skilled task and is too complex to discuss in detail in this short document. Many books have been written on the subject. ! I'll show my age by suggesting that Glenford Myers' `"The Art of Software ! Testing"`_, published in 1979, is still the best introduction to the subject available. It is short (177 pages), easy to read, and discusses the major elements of software testing, though its publication predates the *************** *** 265,282 **** * If you need to create a temporary file, you can use the filename in ! test_support.TESTFN to do so. It is important to remove the file when done; other tests should be able to use the name without cleaning up after your test. Regression Test Writing Rules ! Each test case is different. There is no "standard" form for a Python regression test case, though there are some general rules (note that ! these mostly apply only to the "classic" tests; unittest- and doctest- ! based tests should follow the conventions natural to those frameworks): ! * If your test case detects a failure, raise TestFailed (found in ! test.test_support). * Import everything you'll need as early as possible. --- 274,293 ---- * If you need to create a temporary file, you can use the filename in ! ``test_support.TESTFN`` to do so. It is important to remove the file when done; other tests should be able to use the name without cleaning up after your test. + .. _"The Art of Software Testing": + http://www.amazon.com/exec/obidos/ISBN=0471043281 Regression Test Writing Rules ! ============================= Each test case is different. There is no "standard" form for a Python regression test case, though there are some general rules (note that ! these mostly apply only to the "classic" tests; unittest_- and doctest_- ! based tests should follow the conventions natural to those frameworks):: ! * If your test case detects a failure, raise ``TestFailed`` (found in ! ``test.test_support``). * Import everything you'll need as early as possible. *************** *** 284,298 **** * If you'll be importing objects from a module that is at least partially platform-dependent, only import those objects you need for ! the current test case to avoid spurious ImportError exceptions that ! prevent the test from running to completion. ! * Print all your test case results using the print statement. For non-fatal errors, print an error message (or omit a successful completion print) to indicate the failure, but proceed instead of ! raising TestFailed. ! * Use "assert" sparingly, if at all. It's usually better to just print what you got, and rely on regrtest's got-vs-expected comparison to ! catch deviations from what you expect. assert statements aren't executed at all when regrtest is run in -O mode; and, because they cause the test to stop immediately, can lead to a long & tedious --- 295,309 ---- * If you'll be importing objects from a module that is at least partially platform-dependent, only import those objects you need for ! the current test case to avoid spurious ``ImportError`` exceptions ! that prevent the test from running to completion. ! * Print all your test case results using the ``print`` statement. For non-fatal errors, print an error message (or omit a successful completion print) to indicate the failure, but proceed instead of ! raising ``TestFailed``. ! * Use ``assert`` sparingly, if at all. It's usually better to just print what you got, and rely on regrtest's got-vs-expected comparison to ! catch deviations from what you expect. ``assert`` statements aren't executed at all when regrtest is run in -O mode; and, because they cause the test to stop immediately, can lead to a long & tedious *************** *** 302,314 **** the language). - Miscellaneous ! There is a test_support module in the test package you can import for ! your test case. Import this module using either import test.test_support ! or from test import test_support --- 313,324 ---- the language). Miscellaneous ! ============= There is a test_support module in the test package you can import for ! your test case. Import this module using either:: import test.test_support ! or:: from test import test_support *************** *** 316,358 **** test_support provides the following useful objects: ! * TestFailed - raise this exception when your regression test detects a ! failure. ! * TestSkipped - raise this if the test could not be run because the platform doesn't offer all the required facilities (like large file support), even if all the required modules are available. ! * verbose - you can use this variable to control print output. Many modules use it. Search for "verbose" in the test_*.py files to see lots of examples. ! * verify(condition, reason='test failed'). Use this instead of assert condition[, reason] ! verify() has two advantages over assert: it works even in -O mode, ! and it raises TestFailed on failure instead of AssertionError. ! * TESTFN - a string that should always be used as the filename when you ! need to create a temp file. Also use try/finally to ensure that your ! temp files are deleted before your test completes. Note that you ! cannot unlink an open file on all operating systems, so also be sure ! to close temp files before trying to unlink them. ! * sortdict(dict) - acts like repr(dict.items()), but sorts the items ! first. This is important when printing a dict value, because the ! order of items produced by dict.items() is not defined by the language. ! * findfile(file) - you can call this function to locate a file somewhere ! along sys.path or in the Lib/test tree - see test_linuxaudiodev.py for ! an example of its use. ! * use_large_resources - true iff tests requiring large time or space should be run. ! * fcmp(x,y) - you can call this function to compare two floating point ! numbers when you expect them to only be approximately equal withing a ! fuzz factor (test_support.FUZZ, which defaults to 1e-6). --- 326,369 ---- test_support provides the following useful objects: ! * ``TestFailed`` - raise this exception when your regression test detects ! a failure. ! * ``TestSkipped`` - raise this if the test could not be run because the platform doesn't offer all the required facilities (like large file support), even if all the required modules are available. ! * ``verbose`` - you can use this variable to control print output. Many modules use it. Search for "verbose" in the test_*.py files to see lots of examples. ! * ``verify(condition, reason='test failed')``. Use this instead of:: assert condition[, reason] ! ``verify()`` has two advantages over ``assert``: it works even in -O ! mode, and it raises ``TestFailed`` on failure instead of ! ``AssertionError``. ! * ``TESTFN`` - a string that should always be used as the filename when ! you need to create a temp file. Also use ``try``/``finally`` to ! ensure that your temp files are deleted before your test completes. ! Note that you cannot unlink an open file on all operating systems, so ! also be sure to close temp files before trying to unlink them. ! * ``sortdict(dict)`` - acts like ``repr(dict.items())``, but sorts the ! items first. This is important when printing a dict value, because ! the order of items produced by ``dict.items()`` is not defined by the language. ! * ``findfile(file)`` - you can call this function to locate a file ! somewhere along sys.path or in the Lib/test tree - see ! test_linuxaudiodev.py for an example of its use. ! * ``use_large_resources`` - true iff tests requiring large time or space should be run. ! * ``fcmp(x,y)`` - you can call this function to compare two floating ! point numbers when you expect them to only be approximately equal ! withing a fuzz factor (``test_support.FUZZ``, which defaults to 1e-6). *************** *** 366,372 **** coverage. - Some Non-Obvious regrtest Features ! * Automagic test detection: When you create a new test file test_spam.py, you do not need to modify regrtest (or anything else) --- 377,382 ---- coverage. Some Non-Obvious regrtest Features ! ================================== * Automagic test detection: When you create a new test file test_spam.py, you do not need to modify regrtest (or anything else) *************** *** 386,396 **** as a module. Most tests run to completion as a side-effect of getting imported. After importing test_spam, regrtest also executes ! test_spam.test_main(), if test_spam has a "test_main" attribute. This is rarely required with the "traditional" Python tests, and you shouldn't create a module global with name test_main unless you're specifically exploiting this gimmick. This usage does prove useful with PyUnit-based tests as well, however; defining ! a test_main() which is run by regrtest and a script-stub in the ! test module ("if __name__ == '__main__': test_main()") allows the test to be used like any other Python test and also work with the unittest.py-as-a-script approach, allowing a developer --- 396,406 ---- as a module. Most tests run to completion as a side-effect of getting imported. After importing test_spam, regrtest also executes ! ``test_spam.test_main()``, if test_spam has a ``test_main`` attribute. This is rarely required with the "traditional" Python tests, and you shouldn't create a module global with name test_main unless you're specifically exploiting this gimmick. This usage does prove useful with PyUnit-based tests as well, however; defining ! a ``test_main()`` which is run by regrtest and a script-stub in the ! test module ("``if __name__ == '__main__': test_main()``") allows the test to be used like any other Python test and also work with the unittest.py-as-a-script approach, allowing a developer From mwh@users.sourceforge.net Wed Nov 27 16:29:28 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 27 Nov 2002 08:29:28 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.167,1.168 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv12610/Lib/test Modified Files: test_descr.py Log Message: Nudge getting __module__ and __name__ for new-style classes so that the results of *setting* __name__ are not so surprising. If people can suggest more tests, that'd be grand, or is what's there sufficient? Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.167 retrieving revision 1.168 diff -C2 -d -r1.167 -r1.168 *** test_descr.py 27 Nov 2002 15:40:09 -0000 1.167 --- test_descr.py 27 Nov 2002 16:29:26 -0000 1.168 *************** *** 3604,3608 **** pass ! C.__name__ = 'C' def test_main(): --- 3604,3616 ---- pass ! # C.__module__ could be 'test_descr' or '__main__' ! mod = C.__module__ ! ! C.__name__ = 'D' ! vereq((C.__module__, C.__name__), (mod, 'D')) ! ! C.__name__ = 'D.E' ! vereq((C.__module__, C.__name__), (mod, 'D.E')) ! def test_main(): From mwh@users.sourceforge.net Wed Nov 27 16:29:28 2002 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed, 27 Nov 2002 08:29:28 -0800 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.193,2.194 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv12610/Objects Modified Files: typeobject.c Log Message: Nudge getting __module__ and __name__ for new-style classes so that the results of *setting* __name__ are not so surprising. If people can suggest more tests, that'd be grand, or is what's there sufficient? Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.193 retrieving revision 2.194 diff -C2 -d -r2.193 -r2.194 *** typeobject.c 27 Nov 2002 15:40:08 -0000 2.193 --- typeobject.c 27 Nov 2002 16:29:25 -0000 2.194 *************** *** 42,51 **** char *s; ! s = strrchr(type->tp_name, '.'); ! if (s == NULL) ! s = type->tp_name; ! else ! s++; ! return PyString_FromString(s); } --- 42,59 ---- char *s; ! if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) { ! etype* et = (etype*)type; ! ! Py_INCREF(et->name); ! return et->name; ! } ! else { ! s = strrchr(type->tp_name, '.'); ! if (s == NULL) ! s = type->tp_name; ! else ! s++; ! return PyString_FromString(s); ! } } *************** *** 96,112 **** char *s; ! s = strrchr(type->tp_name, '.'); ! if (s != NULL) ! return PyString_FromStringAndSize(type->tp_name, ! (int)(s - type->tp_name)); ! if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) ! return PyString_FromString("__builtin__"); ! mod = PyDict_GetItemString(type->tp_dict, "__module__"); ! if (mod != NULL) { ! Py_INCREF(mod); return mod; } ! PyErr_SetString(PyExc_AttributeError, "__module__"); ! return NULL; } --- 104,119 ---- char *s; ! if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) { ! mod = PyDict_GetItemString(type->tp_dict, "__module__"); ! Py_XINCREF(mod); return mod; } ! else { ! s = strrchr(type->tp_name, '.'); ! if (s != NULL) ! return PyString_FromStringAndSize( ! type->tp_name, (int)(s - type->tp_name)); ! return PyString_FromString("__builtin__"); ! } } From akuchling@users.sourceforge.net Wed Nov 27 18:53:41 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 27 Nov 2002 10:53:41 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew20.tex,1.46,1.47 whatsnew21.tex,1.28,1.29 whatsnew22.tex,1.60,1.61 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv30047 Modified Files: whatsnew20.tex whatsnew21.tex whatsnew22.tex Log Message: Update e-mail address Index: whatsnew20.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew20.tex,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** whatsnew20.tex 2 May 2002 14:48:26 -0000 1.46 --- whatsnew20.tex 27 Nov 2002 18:53:38 -0000 1.47 *************** *** 6,10 **** \release{1.02} \author{A.M. Kuchling and Moshe Zadka} ! \authoraddress{\email{akuchlin@mems-exchange.org}, \email{moshez@twistedmatrix.com} } \begin{document} \maketitle\tableofcontents --- 6,10 ---- \release{1.02} \author{A.M. Kuchling and Moshe Zadka} ! \authoraddress{\email{amk@amk.ca}, \email{moshez@twistedmatrix.com} } \begin{document} \maketitle\tableofcontents Index: whatsnew21.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew21.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** whatsnew21.tex 5 Nov 2001 21:25:42 -0000 1.28 --- whatsnew21.tex 27 Nov 2002 18:53:38 -0000 1.29 *************** *** 8,12 **** \release{1.00} \author{A.M. Kuchling} ! \authoraddress{\email{akuchlin@mems-exchange.org}} \begin{document} \maketitle\tableofcontents --- 8,12 ---- \release{1.00} \author{A.M. Kuchling} ! \authoraddress{\email{amk@amk.ca}} \begin{document} \maketitle\tableofcontents Index: whatsnew22.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew22.tex,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** whatsnew22.tex 15 Nov 2002 14:37:46 -0000 1.60 --- whatsnew22.tex 27 Nov 2002 18:53:38 -0000 1.61 *************** *** 6,10 **** \release{1.02} \author{A.M. Kuchling} ! \authoraddress{\email{akuchlin@mems-exchange.org}} \begin{document} \maketitle\tableofcontents --- 6,10 ---- \release{1.02} \author{A.M. Kuchling} ! \authoraddress{\email{amk@amk.ca}} \begin{document} \maketitle\tableofcontents From akuchling@users.sourceforge.net Wed Nov 27 18:58:24 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 27 Nov 2002 10:58:24 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew22.tex,1.54.2.2,1.54.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv32584 Modified Files: Tag: release22-maint whatsnew22.tex Log Message: Update 2.2 document Index: whatsnew22.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew22.tex,v retrieving revision 1.54.2.2 retrieving revision 1.54.2.3 diff -C2 -d -r1.54.2.2 -r1.54.2.3 *** whatsnew22.tex 12 Nov 2002 19:01:04 -0000 1.54.2.2 --- whatsnew22.tex 27 Nov 2002 18:58:22 -0000 1.54.2.3 *************** *** 6,10 **** \release{1.02} \author{A.M. Kuchling} ! \authoraddress{\email{akuchlin@mems-exchange.org}} \begin{document} \maketitle\tableofcontents --- 6,10 ---- \release{1.02} \author{A.M. Kuchling} ! \authoraddress{\email{amk@amk.ca}} \begin{document} \maketitle\tableofcontents *************** *** 315,318 **** --- 315,321 ---- New-style classes follow a different algorithm that's a bit more complicated to explain, but does the right thing in this situation. + (Note that Python 2.3 changes this algorithm to one that produces the + same results in most cases, but produces more useful results for + really complicated inheritance graphs.) \begin{enumerate} From akuchling@users.sourceforge.net Wed Nov 27 19:11:12 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 27 Nov 2002 11:11:12 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.77,1.78 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv6085 Modified Files: whatsnew23.tex Log Message: Mention dict.fromkeys() Various edits Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** whatsnew23.tex 26 Nov 2002 22:07:35 -0000 1.77 --- whatsnew23.tex 27 Nov 2002 19:11:10 -0000 1.78 *************** *** 616,624 **** \exception{UnicodeError}), ``ignore'' (skip the character), or ``replace'' (with question mark), defaulting to ``strict''. It may be ! desirable to specify an alternative processing of the error, e.g. by inserting an XML character reference or HTML entity reference into the converted string. ! Python now has a flexible framework to add additional processing strategies. New error handlers can be added with \function{codecs.register_error}. Codecs then can access the error --- 616,624 ---- \exception{UnicodeError}), ``ignore'' (skip the character), or ``replace'' (with question mark), defaulting to ``strict''. It may be ! desirable to specify an alternative processing of the error, such as inserting an XML character reference or HTML entity reference into the converted string. ! Python now has a flexible framework to add different processing strategies. New error handlers can be added with \function{codecs.register_error}. Codecs then can access the error *************** *** 632,636 **** Two additional error handlers have been implemented using this framework: ``backslashreplace'' uses Python backslash quoting to ! represent the unencodable character, and ``xmlcharrefreplace'' emits XML character references. --- 632,636 ---- Two additional error handlers have been implemented using this framework: ``backslashreplace'' uses Python backslash quoting to ! represent unencodable characters and ``xmlcharrefreplace'' emits XML character references. *************** *** 822,826 **** \end{verbatim} ! (Patch contributed by Raymond Hettinger.) \item The \keyword{assert} statement no longer checks the \code{__debug__} --- 822,832 ---- \end{verbatim} ! There's also a new class method, ! \method{dict.fromkeys(\var{iterable}, \var{value})}, that ! creates a dictionary with keys taken from the supplied iterator ! \var{iterable} and all values set to \var{value}, defaulting to ! \code{None}. ! ! (Patches contributed by Raymond Hettinger.) \item The \keyword{assert} statement no longer checks the \code{__debug__} *************** *** 1284,1301 **** per-use basis. ! \item Calling Tcl methods through \module{_tkinter} now does not ! always return strings anymore. Instead, if Tcl returns other objects, ! those objects are converted to their Python equivalent, if one exists, ! or wrapped with a \class{_tkinter.Tcl_Obj} object if no Python ! equivalent exists. This behaviour can be controlled through the ! \method{wantobjects} method of \class{tkapp} objects. ! When using _tkinter through Tkinter.py (i.e. for most _tkinter ! applications), this feature is always activated. It should not cause ! compatibility problems, since Tkinter would always convert string ! results to Python types were possible. If any incompatibilities are found, the old behaviour can be restored ! by invoking \begin{verbatim} --- 1290,1308 ---- per-use basis. ! \item Calling Tcl methods through \module{_tkinter} no longer ! returns only strings. Instead, if Tcl returns other objects those ! objects are converted to their Python equivalent, if one exists, or ! wrapped with a \class{_tkinter.Tcl_Obj} object if no Python equivalent ! exists. This behaviour can be controlled through the ! \method{wantobjects()} method of \class{tkapp} objects. ! When using \module{_tkinter} through the \module{Tkinter} module (as ! most Tkinter applications will), this feature is always activated. It ! should not cause compatibility problems, since Tkinter would always ! convert string results to Python types where possible. If any incompatibilities are found, the old behaviour can be restored ! by setting the \member{wantobjects} variable in the \module{Tkinter} ! module to false before creating the first \class{tkapp} object. \begin{verbatim} *************** *** 1304,1310 **** \end{verbatim} ! before creating the first \class{tkapp} object. ! ! Please report any such breakage as a bug. \end{itemize} --- 1311,1315 ---- \end{verbatim} ! Please report any breakage caused by this change as a bug. \end{itemize} *************** *** 1652,1655 **** --- 1657,1666 ---- integer instead of raising an \exception{OverflowError} when a string or floating-point number is too large to fit into an integer. + + \item Calling Tcl methods through \module{_tkinter} no longer + returns only strings. Instead, if Tcl returns other objects those + objects are converted to their Python equivalent, if one exists, or + wrapped with a \class{_tkinter.Tcl_Obj} object if no Python equivalent + exists. \item You can no longer disable assertions by assigning to \code{__debug__}. From nnorwitz@users.sourceforge.net Wed Nov 27 19:38:03 2002 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 27 Nov 2002 11:38:03 -0800 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.132,2.133 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv20631/Objects Modified Files: dictobject.c Log Message: Add missing decref Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.132 retrieving revision 2.133 diff -C2 -d -r2.132 -r2.133 *** dictobject.c 27 Nov 2002 07:29:33 -0000 2.132 --- dictobject.c 27 Nov 2002 19:38:00 -0000 2.133 *************** *** 982,985 **** --- 982,986 ---- if (!PyDict_Check(d)) { PyErr_BadInternalCall(); + Py_DECREF(d); return NULL; } From tim_one@email.msn.com Wed Nov 27 22:12:57 2002 From: tim_one@email.msn.com (Tim Peters) Date: Wed, 27 Nov 2002 17:12:57 -0500 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.192,2.193 In-Reply-To: Message-ID: [mwh@users.sourceforge.net] > I don't know why staring at the email to python-checkins made me > see problems with my code that I didn't see before the checkin, but: Don't tell anyone, but that happens to me so frequently that I often *plan* to do my intense code review based on staring at checkin email. Partly seeing diffs in a different format, partly because there's a mental shift of gears after a checkin, ..., don't know why for sure either, but it works. From gward@users.sourceforge.net Wed Nov 27 22:19:18 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Wed, 27 Nov 2002 14:19:18 -0800 Subject: [Python-checkins] python/dist/src/Modules linuxaudiodev.c,2.19,2.20 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv22157 Modified Files: linuxaudiodev.c Log Message: Allow the device name to be passed to linuxaudiodev.open(), for consistency with the built-in open() (and every other sane open() function, for that matter). The two valid ways to call this open() are now open(mode) and open(device, mode). For backwards compatibility, retain the old open(mode) calling syntax -- this makes the error message when you call open(device) a bit confusing, but oh well. Index: linuxaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/linuxaudiodev.c,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -d -r2.19 -r2.20 *** linuxaudiodev.c 17 Jul 2002 16:30:36 -0000 2.19 --- linuxaudiodev.c 27 Nov 2002 22:19:15 -0000 2.20 *************** *** 80,88 **** lad_t *xp; int fd, afmts, imode; ! char *mode; ! char *basedev; - /* Check arg for r/w/rw */ - if (!PyArg_ParseTuple(arg, "s:open", &mode)) return NULL; if (strcmp(mode, "r") == 0) imode = O_RDONLY; --- 80,98 ---- lad_t *xp; int fd, afmts, imode; ! char *basedev = NULL; ! char *mode = NULL; ! ! /* Two ways to call linuxaudiodev.open(): ! open(device, mode) (for consistency with builtin open()) ! open(mode) (for backwards compatibility) ! because the *first* argument is optional, parsing args is ! a wee bit tricky. */ ! if (!PyArg_ParseTuple(arg, "s|s:open", &basedev, &mode)) ! return NULL; ! if (mode == NULL) { /* only one arg supplied */ ! mode = basedev; ! basedev = NULL; ! } if (strcmp(mode, "r") == 0) imode = O_RDONLY; *************** *** 103,109 **** */ ! basedev = getenv("AUDIODEV"); ! if (!basedev) ! basedev = "/dev/dsp"; if ((fd = open(basedev, imode)) == -1) { --- 113,121 ---- */ ! if (basedev == NULL) { /* called with one arg */ ! basedev = getenv("AUDIODEV"); ! if (basedev == NULL) /* $AUDIODEV not set */ ! basedev = "/dev/dsp"; ! } if ((fd = open(basedev, imode)) == -1) { From goodger@users.sourceforge.net Thu Nov 28 03:59:52 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Wed, 27 Nov 2002 19:59:52 -0800 Subject: [Python-checkins] python/nondist/peps pep-0257.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv376 Modified Files: pep-0257.txt Log Message: Clarified algorithm for stripping indentation from docstrings. Index: pep-0257.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0257.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0257.txt 30 Aug 2002 03:10:51 -0000 1.6 --- pep-0257.txt 28 Nov 2002 03:59:50 -0000 1.7 *************** *** 140,148 **** The entire docstring is indented the same as the quotes at its first ! line (see example below). Docstring processing tools will strip an ! amount of indentation from the second and further lines of the ! docstring equal to the indentation of the first non-blank line after ! the first line of the docstring. Relative indentation of later lines ! in the docstring is retained. Insert a blank line before and after all docstrings (one-line or --- 140,149 ---- The entire docstring is indented the same as the quotes at its first ! line (see example below). Docstring processing tools will strip a ! uniform amount of indentation from the second and further lines of the ! docstring, equal to the minimum indentation of all non-blank lines ! after the first line of the docstring. Relative indentation of later ! lines in the docstring is retained. Any indentation on the first line ! of the docstring (i.e., before the first newline) is removed. Insert a blank line before and after all docstrings (one-line or From guido@python.org Thu Nov 28 04:08:17 2002 From: guido@python.org (Guido van Rossum) Date: Wed, 27 Nov 2002 23:08:17 -0500 Subject: [Python-checkins] python/nondist/peps pep-0257.txt,1.6,1.7 In-Reply-To: Your message of "Wed, 27 Nov 2002 19:59:52 PST." References: Message-ID: <200211280408.gAS48Hi19189@pcp02138704pcs.reston01.va.comcast.net> > The entire docstring is indented the same as the quotes at its first > ! line (see example below). Docstring processing tools will strip a > ! uniform amount of indentation from the second and further lines of the > ! docstring, equal to the minimum indentation of all non-blank lines > ! after the first line of the docstring. Relative indentation of later > ! lines in the docstring is retained. Any indentation on the first line > ! of the docstring (i.e., before the first newline) is removed. I've seen many people write docstrings like this: def foo(self): """ The foo algorithm. Blah, blah, blah. """ This could be accommodated by using the first non-blank line rather than the first line. --Guido van Rossum (home page: http://www.python.org/~guido/) From goodger@python.org Thu Nov 28 06:09:19 2002 From: goodger@python.org (David Goodger) Date: Thu, 28 Nov 2002 01:09:19 -0500 Subject: [Python-checkins] Re: python/nondist/peps pep-0257.txt,1.6,1.7 Message-ID: [CVS] > The entire docstring is indented the same as the quotes at its first > ! line (see example below). Docstring processing tools will strip a > ! uniform amount of indentation from the second and further lines of the > ! docstring, equal to the minimum indentation of all non-blank lines > ! after the first line of the docstring. Relative indentation of later > ! lines in the docstring is retained. Any indentation on the first line > ! of the docstring (i.e., before the first newline) is removed. [GvR] > I've seen many people write docstrings like this: > > def foo(self): > """ > The foo algorithm. > > Blah, blah, blah. > """ > > This could be accommodated by using the first non-blank line rather > than the first line. The indentation of the first line is *not* being used. I don't think "the first non-blank line" is enough. I saw a problem with the old text: Docstring processing tools will strip an amount of indentation from the second and further lines of the docstring equal to the indentation of the first non-blank line after the first line of the docstring. This could cause problems if too-literally applied in the unlikely (but possible!) case of a docstring like this: def foo(self): """ indented not indented """ The indentation of the first line is still intentionally ignored. In both examples (yours & mine), each first line (up to the first newline) is blank. Perhaps that needs more explanation. Is the new text unclear? Does this issue deserve elaboration in a new subsection? Perhaps some well-commented code. Even the inspect.py docstring-trimming code has a subtle bug, in the case of a docstring like this (also common): def foo(): """ Space at start of the first line and the second line is flush-left. """ That first space ought to be removed. I'll prepare a patch. -- David Goodger From jvr@users.sourceforge.net Thu Nov 28 11:30:58 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Thu, 28 Nov 2002 03:30:58 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib bundlebuilder.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv19365 Modified Files: bundlebuilder.py Log Message: - Rewrote bootstapping code in sh so we're really independent of an installed Python. So we don't use os.execve any longer, which means we need an actual executable in .app/Contents/MacOS. For applets we make a symlink to the Python executable used to build the applet, for standalone apps we simply copy it. - Added support for the new any_missing_maybe() feature of modulefinder.py, which is pending as patch #643711. Its use is optional so it still works with the existing version of modulefinder.py Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/bundlebuilder.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** bundlebuilder.py 26 Nov 2002 00:34:52 -0000 1.9 --- bundlebuilder.py 28 Nov 2002 11:30:56 -0000 1.10 *************** *** 198,203 **** def report(self): # XXX something decent ! import pprint ! pprint.pprint(self.__dict__) --- 198,202 ---- def report(self): # XXX something decent ! pass *************** *** 228,232 **** """ % FROZEN_ARCHIVE ! SITE_CO = compile(SITE_PY, "<-bundlebuilder->", "exec") MAYMISS_MODULES = ['mac', 'os2', 'nt', 'ntpath', 'dos', 'dospath', --- 227,231 ---- """ % FROZEN_ARCHIVE ! SITE_CO = compile(SITE_PY, "<-bundlebuilder.py->", "exec") MAYMISS_MODULES = ['mac', 'os2', 'nt', 'ntpath', 'dos', 'dospath', *************** *** 237,258 **** STRIP_EXEC = "/usr/bin/strip" ! EXECVE_WRAPPER = """\ ! #!/usr/bin/env python ! import os ! from sys import argv, executable ! resources = os.path.join(os.path.dirname(os.path.dirname(argv[0])), ! "Resources") ! mainprogram = os.path.join(resources, "%(mainprogram)s") ! assert os.path.exists(mainprogram) ! argv.insert(1, mainprogram) ! os.environ["PYTHONPATH"] = resources ! %(setexecutable)s ! os.execve(executable, argv, os.environ) """ - setExecutableTemplate = """executable = os.path.join(resources, "%s")""" - pythonhomeSnippet = """os.environ["home"] = resources""" - class AppBuilder(BundleBuilder): --- 236,251 ---- STRIP_EXEC = "/usr/bin/strip" ! BOOTSTRAP_SCRIPT = """\ ! #!/bin/sh ! execdir=$(dirname ${0}) ! executable=${execdir}/%(executable)s ! resdir=$(dirname ${execdir})/Resources ! main=${resdir}/%(mainprogram)s ! PYTHONPATH=$resdir ! export PYTHONPATH ! exec ${executable} ${main} ${1} """ class AppBuilder(BundleBuilder): *************** *** 301,304 **** --- 294,298 ---- # Modules that modulefinder couldn't find: missingModules = [] + maybeMissingModules = [] # List of all binaries (executables or shared libs), for stripping purposes *************** *** 322,325 **** --- 316,324 ---- self.name += ".app" + if self.executable is None: + if not self.standalone: + self.symlink_exec = 1 + self.executable = sys.executable + if self.nibname: self.plist.NSMainNibFile = self.nibname *************** *** 332,337 **** if self.standalone: - if self.executable is None: # *assert* that it is None? - self.executable = sys.executable self.findDependencies() --- 331,334 ---- *************** *** 340,354 **** if self.executable is not None: if self.mainprogram is None: ! execpath = pathjoin(self.execdir, self.name) else: ! execpath = pathjoin(resdir, os.path.basename(self.executable)) if not self.symlink_exec: self.files.append((self.executable, execpath)) self.binaries.append(execpath) self.execpath = execpath - # For execve wrapper - setexecutable = setExecutableTemplate % os.path.basename(self.executable) - else: - setexecutable = "" # XXX for locals() call if self.mainprogram is not None: --- 337,348 ---- if self.executable is not None: if self.mainprogram is None: ! execname = self.name else: ! execname = os.path.basename(self.executable) ! execpath = pathjoin(self.execdir, execname) if not self.symlink_exec: self.files.append((self.executable, execpath)) self.binaries.append(execpath) self.execpath = execpath if self.mainprogram is not None: *************** *** 357,364 **** # Create execve wrapper mainprogram = self.mainprogram # XXX for locals() call execdir = pathjoin(self.bundlepath, self.execdir) mainwrapperpath = pathjoin(execdir, self.name) makedirs(execdir) ! open(mainwrapperpath, "w").write(EXECVE_WRAPPER % locals()) os.chmod(mainwrapperpath, 0777) --- 351,359 ---- # Create execve wrapper mainprogram = self.mainprogram # XXX for locals() call + executable = os.path.basename(self.executable) execdir = pathjoin(self.bundlepath, self.execdir) mainwrapperpath = pathjoin(execdir, self.name) makedirs(execdir) ! open(mainwrapperpath, "w").write(BOOTSTRAP_SCRIPT % locals()) os.chmod(mainwrapperpath, 0777) *************** *** 375,379 **** os.symlink(os.path.abspath(self.executable), dst) ! if self.missingModules: self.reportMissing() --- 370,374 ---- os.symlink(os.path.abspath(self.executable), dst) ! if self.missingModules or self.maybeMissingModules: self.reportMissing() *************** *** 475,496 **** self.pymodules.append((name, mod.__code__, ispkg)) ! self.missingModules.extend(mf.any_missing()) def reportMissing(self): missing = [name for name in self.missingModules if name not in MAYMISS_MODULES] ! missingsub = [name for name in missing if "." in name] ! missing = [name for name in missing if "." not in name] missing.sort() ! missingsub.sort() if missing: self.message("Warning: couldn't find the following modules:", 1) ! self.message(" " + ", ".join(missing)) ! if missingsub: ! self.message("Warning: couldn't find the following submodules " ! "(but it's probably OK since modulefinder can't distinguish " ! "between from \"module import submodule\" and " ! "\"from module import name\"):", 1) ! self.message(" " + ", ".join(missingsub)) # --- 470,510 ---- self.pymodules.append((name, mod.__code__, ispkg)) ! if hasattr(mf, "any_missing_maybe"): ! missing, maybe = mf.any_missing_maybe() ! else: ! missing = mf.any_missing() ! maybe = [] ! self.missingModules.extend(missing) ! self.maybeMissingModules.extend(maybe) def reportMissing(self): missing = [name for name in self.missingModules if name not in MAYMISS_MODULES] ! if self.maybeMissingModules: ! maybe = self.maybeMissingModules ! else: ! maybe = [name for name in missing if "." in name] ! missing = [name for name in missing if "." not in name] missing.sort() ! maybe.sort() ! if maybe: ! self.message("Warning: couldn't find the following submodules:", 1) ! self.message(" (Note that these could be false alarms -- " ! "it's not always", 1) ! self.message(" possible to distinguish between from \"package import submodule\" ", 1) ! self.message(" and \"from package import name\")", 1) ! for name in maybe: ! self.message(" ? " + name, 1) if missing: self.message("Warning: couldn't find the following modules:", 1) ! for name in missing: ! self.message(" ? " + name, 1) ! ! def report(self): ! # XXX something decent ! import pprint ! pprint.pprint(self.__dict__) ! if self.standalone: ! self.reportMissing() # From jvr@users.sourceforge.net Thu Nov 28 18:56:52 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Thu, 28 Nov 2002 10:56:52 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib bundlebuilder.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv28398 Modified Files: bundlebuilder.py Log Message: fixed typo and wrapping Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/bundlebuilder.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** bundlebuilder.py 28 Nov 2002 11:30:56 -0000 1.10 --- bundlebuilder.py 28 Nov 2002 18:56:50 -0000 1.11 *************** *** 492,496 **** self.message(" (Note that these could be false alarms -- " "it's not always", 1) ! self.message(" possible to distinguish between from \"package import submodule\" ", 1) self.message(" and \"from package import name\")", 1) for name in maybe: --- 492,497 ---- self.message(" (Note that these could be false alarms -- " "it's not always", 1) ! self.message(" possible to distinguish between \"from package " ! "import submodule\" ", 1) self.message(" and \"from package import name\")", 1) for name in maybe: From jackjansen@users.sourceforge.net Thu Nov 28 23:23:16 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 28 Nov 2002 15:23:16 -0800 Subject: [Python-checkins] python/dist/src/Tools/bgen/bgen bgenObjectDefinition.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory sc8-pr-cvs1:/tmp/cvs-serv19152 Modified Files: bgenObjectDefinition.py Log Message: Fixed two silly bugs in the PEP252 support code, added an assert that basechain isn't set, and made the output a bit prettier. Index: bgenObjectDefinition.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenObjectDefinition.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** bgenObjectDefinition.py 25 Nov 2002 16:36:49 -0000 1.18 --- bgenObjectDefinition.py 28 Nov 2002 23:23:14 -0000 1.19 *************** *** 216,219 **** --- 216,220 ---- assert self.outputGetattrBody == None assert self.outputGetattrHook == None + assert self.basechain == "NULL" def outputGetattr(self): *************** *** 294,301 **** --- 295,304 ---- else: Output("#define %s_get_%s NULL", self.prefix, name) + Output() if set: self.outputSetter(name, set) else: Output("#define %s_set_%s NULL", self.prefix, name) + Output() Output("static PyGetSetDef %s_getsetlist[] = {", self.prefix) *************** *** 303,315 **** for name, get, set, doc in self.getsetlist: if doc: ! doc = `doc` else: doc = "NULL" ! Output("{\"%s\", (getter)%s_get_%s, (setter)%s_set_%s, %s}", name, self.prefix, name, self.prefix, name, doc) DedentLevel() Output("};") else: Output("#define %s_getsetlist NULL", self.prefix) def outputGetter(self, name, code): --- 306,320 ---- for name, get, set, doc in self.getsetlist: if doc: ! doc = '"' + doc + '"' else: doc = "NULL" ! 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() Output("};") else: Output("#define %s_getsetlist NULL", self.prefix) + Output() def outputGetter(self, name, code): *************** *** 319,325 **** Output(code) OutRbrace() def outputSetter(self, name, code): ! Output("static int %s_get_%s(%s *self, PyObject *v, void *closure)", self.prefix, name, self.objecttype) OutLbrace() --- 324,331 ---- 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) OutLbrace() *************** *** 327,330 **** --- 333,337 ---- Output("return 0;") OutRbrace() + Output() class GlobalObjectDefinition(ObjectDefinition): From doerwalter@users.sourceforge.net Fri Nov 29 16:39:11 2002 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Fri, 29 Nov 2002 08:39:11 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.78,1.79 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv28710/whatsnew Modified Files: whatsnew23.tex Log Message: Fix typo. Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** whatsnew23.tex 27 Nov 2002 19:11:10 -0000 1.78 --- whatsnew23.tex 29 Nov 2002 16:39:07 -0000 1.79 *************** *** 745,749 **** To make implementing sequences that support extended slicing in Python ! easier, slice ojects now have a method \method{indices} which given the length of a sequence returns \code{(start, stop, step)} handling omitted and out-of-bounds indices in a manner consistent with regular --- 745,749 ---- To make implementing sequences that support extended slicing in Python ! easier, slice objects now have a method \method{indices} which given the length of a sequence returns \code{(start, stop, step)} handling omitted and out-of-bounds indices in a manner consistent with regular From akuchling@users.sourceforge.net Fri Nov 29 19:43:47 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri, 29 Nov 2002 11:43:47 -0800 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.79,1.80 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv28511 Modified Files: whatsnew23.tex Log Message: Fix value of 'propagate' (noted by Chris Reedy) Rewrite paragraph Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** whatsnew23.tex 29 Nov 2002 16:39:07 -0000 1.79 --- whatsnew23.tex 29 Nov 2002 19:43:45 -0000 1.80 *************** *** 515,519 **** logged to \samp{server.auth} is also seen by \samp{server} and \samp{root}, but a handler can prevent this by setting its ! \member{propagate} attribute to \code{True}. With all of these features the \module{logging} package should provide --- 515,519 ---- logged to \samp{server.auth} is also seen by \samp{server} and \samp{root}, but a handler can prevent this by setting its ! \member{propagate} attribute to \code{False}. With all of these features the \module{logging} package should provide *************** *** 744,753 **** \end{verbatim} ! To make implementing sequences that support extended slicing in Python ! easier, slice objects now have a method \method{indices} which given ! the length of a sequence returns \code{(start, stop, step)} handling ! omitted and out-of-bounds indices in a manner consistent with regular ! slices (and this innocuous phrase hides a welter of confusing ! details!). The method is intended to be used like this: \begin{verbatim} --- 744,755 ---- \end{verbatim} ! To simplify implementing sequences that support extended slicing, ! slice objects now have a method \method{indices(\var{length})} which, ! given the length of a sequence, returns a \code{(start, stop, step)} ! tuple that can be passed directly to \function{range()}. ! \method{indices()} handles omitted and out-of-bounds indices in a ! manner consistent with regular slices (and this innocuous phrase hides ! a welter of confusing details!). The method is intended to be used ! like this: \begin{verbatim} *************** *** 1700,1704 **** Fred~L. Drake, Jr., Michael Hudson, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, Lalo Martins, Gustavo Niemeyer, Neal ! Norwitz, Neil Schemenauer, Jason Tishler. \end{document} --- 1702,1706 ---- Fred~L. Drake, Jr., Michael Hudson, Detlef Lannert, Martin von L\"owis, Andrew MacIntyre, Lalo Martins, Gustavo Niemeyer, Neal ! Norwitz, Chris Reedy, Neil Schemenauer, Jason Tishler. \end{document} From akuchling@users.sourceforge.net Fri Nov 29 19:46:01 2002 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Fri, 29 Nov 2002 11:46:01 -0800 Subject: [Python-checkins] python/dist/src/Lib/distutils/command install_scripts.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1:/tmp/cvs-serv29636 Modified Files: install_scripts.py Log Message: Fix mode on scripts to have the read bit set (noted by Nicholas Riley) Index: install_scripts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install_scripts.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** install_scripts.py 19 Nov 2002 13:12:28 -0000 1.14 --- install_scripts.py 29 Nov 2002 19:45:58 -0000 1.15 *************** *** 54,58 **** log.info("changing mode of %s", file) else: ! mode = ((os.stat(file)[ST_MODE]) | 0111) & 07777 log.info("changing mode of %s to %o", file, mode) os.chmod(file, mode) --- 54,58 ---- log.info("changing mode of %s", file) else: ! mode = ((os.stat(file)[ST_MODE]) | 0555) & 07777 log.info("changing mode of %s to %o", file, mode) os.chmod(file, mode) From jvr@users.sourceforge.net Fri Nov 29 20:06:55 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 29 Nov 2002 12:06:55 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib bundlebuilder.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv6425 Modified Files: bundlebuilder.py Log Message: added Thomas H's LOADER code for importing extension (sub)modules; little tweaks Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/bundlebuilder.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** bundlebuilder.py 28 Nov 2002 18:56:50 -0000 1.11 --- bundlebuilder.py 29 Nov 2002 20:06:52 -0000 1.12 *************** *** 142,145 **** --- 142,146 ---- self._addMetaFiles() self.postProcess() + self.message("Done.", 1) def preProcess(self): *************** *** 201,205 **** - if __debug__: PYC_EXT = ".pyc" --- 202,205 ---- *************** *** 229,232 **** --- 229,239 ---- SITE_CO = compile(SITE_PY, "<-bundlebuilder.py->", "exec") + EXT_LOADER = """\ + import imp, sys, os + path = os.path.join(sys.path[0], "%(filename)s") + mod = imp.load_dynamic("%(name)s", path) + sys.modules["%(name)s"] = mod + """ + MAYMISS_MODULES = ['mac', 'os2', 'nt', 'ntpath', 'dos', 'dospath', 'win32api', 'ce', '_winreg', 'nturl2path', 'sitecustomize', *************** *** 286,292 **** strip = 0 - # Found C extension modules: [(name, path), ...] - extensions = [] - # Found Python modules: [(name, codeobject, ispkg), ...] pymodules = [] --- 293,296 ---- *************** *** 356,360 **** makedirs(execdir) open(mainwrapperpath, "w").write(BOOTSTRAP_SCRIPT % locals()) ! os.chmod(mainwrapperpath, 0777) def postProcess(self): --- 360,364 ---- makedirs(execdir) open(mainwrapperpath, "w").write(BOOTSTRAP_SCRIPT % locals()) ! os.chmod(mainwrapperpath, 0775) def postProcess(self): *************** *** 375,379 **** def addPythonModules(self): self.message("Adding Python modules", 1) - pymodules = self.pymodules if USE_FROZEN: --- 379,382 ---- *************** *** 382,386 **** # Create a file containing all modules, frozen. frozenmodules = [] ! for name, code, ispkg in pymodules: if ispkg: self.message("Adding Python package %s" % name, 2) --- 385,389 ---- # Create a file containing all modules, frozen. frozenmodules = [] ! for name, code, ispkg in self.pymodules: if ispkg: self.message("Adding Python package %s" % name, 2) *************** *** 389,393 **** frozenmodules.append((name, marshal.dumps(code), ispkg)) frozenmodules = tuple(frozenmodules) ! relpath = "Contents/Resources/" + FROZEN_ARCHIVE abspath = pathjoin(self.bundlepath, relpath) f = open(abspath, "wb") --- 392,396 ---- frozenmodules.append((name, marshal.dumps(code), ispkg)) frozenmodules = tuple(frozenmodules) ! relpath = pathjoin("Contents", "Resources", FROZEN_ARCHIVE) abspath = pathjoin(self.bundlepath, relpath) f = open(abspath, "wb") *************** *** 395,407 **** f.close() # add site.pyc ! sitepath = pathjoin(self.bundlepath, "Contents/Resources/site" + PYC_EXT) writePyc(SITE_CO, sitepath) else: # Create individual .pyc files. ! for name, code, ispkg in pymodules: if ispkg: name += ".__init__" path = name.split(".") ! path = pathjoin("Contents/Resources/", *path) + PYC_EXT if ispkg: --- 398,411 ---- f.close() # add site.pyc ! sitepath = pathjoin(self.bundlepath, "Contents", "Resources", ! "site" + PYC_EXT) writePyc(SITE_CO, sitepath) else: # Create individual .pyc files. ! for name, code, ispkg in self.pymodules: if ispkg: name += ".__init__" path = name.split(".") ! path = pathjoin("Contents", "Resources", *path) + PYC_EXT if ispkg: *************** *** 444,448 **** self.missingModules.append(name) - mf.run_script(self.mainprogram) modules = mf.modules.items() --- 448,451 ---- *************** *** 452,467 **** # C extension path = mod.__file__ ! ext = os.path.splitext(path)[1] ! if USE_FROZEN: # "proper" freezing ! # rename extensions that are submodules of packages to ! # .. ! dstpath = "Contents/Resources/" + name + ext else: ! dstpath = name.split(".") ! dstpath = pathjoin("Contents/Resources/", *dstpath) + ext self.files.append((path, dstpath)) - self.extensions.append((name, path, dstpath)) self.binaries.append(dstpath) ! elif mod.__code__ is not None: ispkg = mod.__path__ is not None if not USE_FROZEN or name != "site": --- 455,473 ---- # C extension path = mod.__file__ ! filename = os.path.basename(path) ! if USE_FROZEN: ! # "proper" freezing, put extensions in Contents/Resources/, ! # freeze a tiny "loader" program. Due to Thomas Heller. ! dstpath = pathjoin("Contents", "Resources", filename) ! source = EXT_LOADER % {"name": name, "filename": filename} ! code = compile(source, "" % name, "exec") ! mod.__code__ = code else: ! # just copy the file ! dstpath = name.split(".")[:-1] + [filename] ! dstpath = pathjoin("Contents", "Resources", *dstpath) self.files.append((path, dstpath)) self.binaries.append(dstpath) ! if mod.__code__ is not None: ispkg = mod.__path__ is not None if not USE_FROZEN or name != "site": From jvr@users.sourceforge.net Fri Nov 29 20:47:41 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 29 Nov 2002 12:47:41 -0800 Subject: [Python-checkins] python/dist/src/Doc/lib libimp.tex,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20813/Doc/lib Modified Files: libimp.tex Log Message: Slightly improved version of patch #642578: "Expose PyImport_FrozenModules in imp". This adds two functions to the imp module: get_frozenmodules() and set_frozenmodules(). Index: libimp.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libimp.tex,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** libimp.tex 9 Apr 2002 18:14:59 -0000 1.32 --- libimp.tex 29 Nov 2002 20:47:37 -0000 1.33 *************** *** 107,110 **** --- 107,125 ---- \end{funcdesc} + \begin{funcdesc}{set_frozenmodules}{seq_of_tuples} + Set the global list of frozen modules. \var{seq_of_tuples} is a sequence + of tuples of length 3: (\var{modulename}, \var{codedata}, \var{ispkg}) + \var{modulename} is the name of the frozen module (may contain dots). + \var{codedata} is a marshalled code object. \var{ispkg} is a boolean + indicating whether the module is a package. + \versionadded{2.3} + \end{funcdesc} + + \begin{funcdesc}{get_frozenmodules}{} + Return the global list of frozen modules as a tuple of tuples. See + \function{set_frozenmodules()} for a description of its contents. + \versionadded{2.3} + \end{funcdesc} + The following constants with integer values, defined in this module, are used to indicate the search result of \function{find_module()}. From jvr@users.sourceforge.net Fri Nov 29 20:47:42 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 29 Nov 2002 12:47:42 -0800 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.549,1.550 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv20813/Misc Modified Files: NEWS Log Message: Slightly improved version of patch #642578: "Expose PyImport_FrozenModules in imp". This adds two functions to the imp module: get_frozenmodules() and set_frozenmodules(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.549 retrieving revision 1.550 diff -C2 -d -r1.549 -r1.550 *** NEWS 27 Nov 2002 13:10:40 -0000 1.549 --- NEWS 29 Nov 2002 20:47:39 -0000 1.550 *************** *** 13,16 **** --- 13,21 ---- -------------------------------------------- + - Exposed the PyImport_FrozenModules variable in import.c through + imp.get_frozenmodules() and imp.set_frozenmodules(). This is + useful for freezing tools written in Python that use Python for + bootstrapping the frozen application. + - One can now assign to __bases__ and __name__ of new-style classes. From jvr@users.sourceforge.net Fri Nov 29 20:47:43 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 29 Nov 2002 12:47:43 -0800 Subject: [Python-checkins] python/dist/src/Python import.c,2.210,2.211 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv20813/Python Modified Files: import.c Log Message: Slightly improved version of patch #642578: "Expose PyImport_FrozenModules in imp". This adds two functions to the imp module: get_frozenmodules() and set_frozenmodules(). Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.210 retrieving revision 2.211 diff -C2 -d -r2.210 -r2.211 *** import.c 31 Aug 2002 15:16:14 -0000 2.210 --- import.c 29 Nov 2002 20:47:40 -0000 2.211 *************** *** 2296,2299 **** --- 2296,2428 ---- } + /* Keep a reference to the tuple used to build PyImport_FrozenModules, + as it points to the raw string data inside the tuple. */ + static PyObject *frozenmodulestuple = NULL; + + static PyObject * + imp_set_frozenmodules(PyObject *self, PyObject *args) + { + PyObject *t, *item, *name, *code, *ispkg; + struct _frozen *frozenmodules; + int n, i; + + if (!PyArg_ParseTuple(args, "O:set_frozenmodules", &t)) + return NULL; + + /* turn the argument into a tuple so we're sure our list + isn't being tampered with behind our backs */ + t = PySequence_Tuple(t); + if (t == NULL) + return NULL; + + n = PyTuple_Size(t); + frozenmodules = PyMem_Malloc((n + 1)* sizeof(struct _frozen)); + if (frozenmodules == NULL) { + PyErr_SetString(PyExc_MemoryError, + "no memory to allocate frozen array"); + goto error; + } + for (i = 0; i < n; i++) { + item = PyTuple_GetItem(t, i); + if (item == NULL) + goto error; + if (!PyTuple_Check(item) || PyTuple_Size(item) != 3) + goto typeerror; + name = PyTuple_GetItem(item, 0); + code = PyTuple_GetItem(item, 1); + ispkg = PyTuple_GetItem(item, 2); + if (!PyString_Check(name) || (PyObject_IsTrue(code) && + !PyString_Check(code))) + goto typeerror; + frozenmodules[i].name = PyString_AsString(name); + if (PyObject_IsTrue(code)) { + frozenmodules[i].code = PyString_AsString(code); + frozenmodules[i].size = PyString_Size(code); + } else { + frozenmodules[i].code = NULL; + frozenmodules[i].size = 0; + } + if (PyObject_IsTrue(ispkg)) + frozenmodules[i].size = -frozenmodules[i].size; + } + frozenmodules[n].name = NULL; /* sentinel */ + frozenmodules[n].code = NULL; + frozenmodules[n].size = 0; + + if (frozenmodulestuple != NULL) { + Py_DECREF(frozenmodulestuple); + PyMem_Free(PyImport_FrozenModules); + } /* else we don't know how or if PyImport_FrozenModules were + allocated, so we can't do anything. */ + + frozenmodulestuple = t; + PyImport_FrozenModules = frozenmodules; + + Py_INCREF(Py_None); + return Py_None; + + typeerror: + PyErr_SetString(PyExc_TypeError, + "items must be tuples of length 3, " + "containing two strings and a bool"); + error: + Py_DECREF(t); + PyMem_Free(frozenmodules); + return NULL; + } + + static PyObject * + imp_get_frozenmodules(PyObject *self, PyObject *args) + { + PyObject *t, *item, *ob; + int i; + struct _frozen *p; + if (!PyArg_ParseTuple(args, ":get_frozenmodules")) + return NULL; + + /* We could just return frozenmodulestuple if it isn't + NULL, but it's possible a C extension stepped on + PyImport_FrozenModules after us, so we always build + a new tuple. */ + + for (p = PyImport_FrozenModules, i = 0; ; p++, i++) { + if (p->name == NULL) + break; + } + t = PyTuple_New(i); + if (t == NULL) + return NULL; + for (p = PyImport_FrozenModules, i = 0; ; p++, i++) { + if (p->name == NULL) + break; + item = PyTuple_New(3); + if (item == NULL) + goto error; + ob = PyString_FromString(p->name); + if (ob == NULL) + goto error; + Py_INCREF(ob); + PyTuple_SET_ITEM(item, 0, ob); + if (p->code != NULL) { + ob = PyString_FromStringAndSize(p->code, + p->size >= 0 ? p->size : -(p->size)); + if (ob == NULL) + goto error; + } + else + ob = Py_None; + Py_INCREF(ob); + PyTuple_SET_ITEM(item, 1, ob); + ob = p->size >= 0 ? Py_False : Py_True; + Py_INCREF(ob); + PyTuple_SET_ITEM(item, 2, ob); + PyTuple_SET_ITEM(t, i, item); + } + return t; + error: + Py_DECREF(t); + return NULL; + } + static PyObject * imp_get_frozen_object(PyObject *self, PyObject *args) *************** *** 2522,2525 **** --- 2651,2668 ---- On platforms without threads, return 0."); + PyDoc_STRVAR(doc_set_frozenmodules, + "set_frozenmodules(seq_of_tuples) -> None\n\ + Set the global list of frozen modules.\n\ + The single argument is a sequence of tuples of length 3:\n\ + (modulename, codedata, ispkg)\n\ + 'modulename' is the name of the frozen module (may contain dots).\n\ + 'codedata' is a marshalled code object. 'ispkg' is a boolean\n\ + indicating whether the module is a package."); + + PyDoc_STRVAR(doc_get_frozenmodules, + "get_frozenmodules() -> tuple_of_tuples\n\ + Return the global list of frozen modules as a tuple of tuples. See\n\ + the set_frozenmodules() doc string for a description of its contents."); + static PyMethodDef imp_methods[] = { {"find_module", imp_find_module, METH_VARARGS, doc_find_module}, *************** *** 2529,2532 **** --- 2672,2679 ---- {"new_module", imp_new_module, METH_VARARGS, doc_new_module}, {"lock_held", imp_lock_held, METH_VARARGS, doc_lock_held}, + {"set_frozenmodules", imp_set_frozenmodules, METH_VARARGS, + doc_set_frozenmodules}, + {"get_frozenmodules", imp_get_frozenmodules, METH_VARARGS, + doc_get_frozenmodules}, /* The rest are obsolete */ {"get_frozen_object", imp_get_frozen_object, METH_VARARGS}, From jvr@users.sourceforge.net Fri Nov 29 21:22:36 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 29 Nov 2002 13:22:36 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib bundlebuilder.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv31817 Modified Files: bundlebuilder.py Log Message: Forgot to do os.path.basename() on mainprogram: a nonworking app was built if the mainprogram wan't in the current directory. Fixed. Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/bundlebuilder.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** bundlebuilder.py 29 Nov 2002 20:06:52 -0000 1.12 --- bundlebuilder.py 29 Nov 2002 21:22:33 -0000 1.13 *************** *** 351,364 **** if self.mainprogram is not None: ! mainname = os.path.basename(self.mainprogram) ! self.files.append((self.mainprogram, pathjoin(resdir, mainname))) ! # Create execve wrapper ! mainprogram = self.mainprogram # XXX for locals() call executable = os.path.basename(self.executable) execdir = pathjoin(self.bundlepath, self.execdir) ! mainwrapperpath = pathjoin(execdir, self.name) makedirs(execdir) ! open(mainwrapperpath, "w").write(BOOTSTRAP_SCRIPT % locals()) ! os.chmod(mainwrapperpath, 0775) def postProcess(self): --- 351,363 ---- if self.mainprogram is not None: ! mainprogram = os.path.basename(self.mainprogram) ! self.files.append((self.mainprogram, pathjoin(resdir, mainprogram))) ! # Write bootstrap script executable = os.path.basename(self.executable) execdir = pathjoin(self.bundlepath, self.execdir) ! bootstrappath = pathjoin(execdir, self.name) makedirs(execdir) ! open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals()) ! os.chmod(bootstrappath, 0775) def postProcess(self): From jackjansen@users.sourceforge.net Fri Nov 29 23:41:14 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:14 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/ctl _Ctlmodule.c,1.19,1.20 ctlsupport.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl In directory sc8-pr-cvs1:/tmp/cvs-serv8673/ctl Modified Files: _Ctlmodule.c ctlsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Ctlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/_Ctlmodule.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** _Ctlmodule.c 16 Aug 2002 09:09:19 -0000 1.19 --- _Ctlmodule.c 29 Nov 2002 23:40:42 -0000 1.20 *************** *** 4544,4555 **** }; ! PyMethodChain CtlObj_chain = { CtlObj_methods, NULL }; ! ! static PyObject *CtlObj_getattr(ControlObject *self, char *name) ! { ! return Py_FindMethodInChain(&CtlObj_chain, (PyObject *)self, name); ! } ! ! #define CtlObj_setattr NULL static int CtlObj_compare(ControlObject *self, ControlObject *other) --- 4544,4548 ---- }; ! #define CtlObj_getsetlist NULL static int CtlObj_compare(ControlObject *self, ControlObject *other) *************** *** 4588,4593 **** (destructor) CtlObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) CtlObj_getattr, /*tp_getattr*/ ! (setattrfunc) CtlObj_setattr, /*tp_setattr*/ (cmpfunc) CtlObj_compare, /*tp_compare*/ (reprfunc) CtlObj_repr, /*tp_repr*/ --- 4581,4586 ---- (destructor) CtlObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) CtlObj_compare, /*tp_compare*/ (reprfunc) CtlObj_repr, /*tp_repr*/ *************** *** 4596,4599 **** --- 4589,4609 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) CtlObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + CtlObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + CtlObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: ctlsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/ctlsupport.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** ctlsupport.py 5 Aug 2002 15:36:56 -0000 1.50 --- ctlsupport.py 29 Nov 2002 23:40:42 -0000 1.51 *************** *** 491,495 **** """ ! class MyObjectDefinition(ObjectIdentityMixin, GlobalObjectDefinition): def outputStructMembers(self): GlobalObjectDefinition.outputStructMembers(self) --- 491,495 ---- """ ! class MyObjectDefinition(PEP252Mixin, ObjectIdentityMixin, GlobalObjectDefinition): def outputStructMembers(self): GlobalObjectDefinition.outputStructMembers(self) From jackjansen@users.sourceforge.net Fri Nov 29 23:41:16 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:16 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/icn icnsupport.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/icn In directory sc8-pr-cvs1:/tmp/cvs-serv8673/icn Modified Files: icnsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: icnsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icn/icnsupport.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** icnsupport.py 25 Mar 2002 00:31:49 -0000 1.7 --- icnsupport.py 29 Nov 2002 23:40:43 -0000 1.8 *************** *** 55,59 **** """ ! class MyObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") --- 55,59 ---- """ ! class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") From jackjansen@users.sourceforge.net Fri Nov 29 23:41:15 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:15 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/help helpsupport.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/help In directory sc8-pr-cvs1:/tmp/cvs-serv8673/help Modified Files: helpsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: helpsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/help/helpsupport.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** helpsupport.py 18 Nov 2002 15:26:39 -0000 1.7 --- helpsupport.py 29 Nov 2002 23:40:43 -0000 1.8 *************** *** 47,51 **** """ ! class MyObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") --- 47,51 ---- """ ! class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") From jackjansen@users.sourceforge.net Fri Nov 29 23:41:13 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:13 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/alias _Aliasmodule.c,1.1,1.2 aliassupport.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/alias In directory sc8-pr-cvs1:/tmp/cvs-serv8673/alias Modified Files: _Aliasmodule.c aliassupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Aliasmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/alias/_Aliasmodule.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _Aliasmodule.c 22 Nov 2002 15:53:32 -0000 1.1 --- _Aliasmodule.c 29 Nov 2002 23:40:41 -0000 1.2 *************** *** 96,107 **** }; ! PyMethodChain AliasObj_chain = { AliasObj_methods, NULL }; ! ! static PyObject *AliasObj_getattr(AliasObject *self, char *name) ! { ! return Py_FindMethodInChain(&AliasObj_chain, (PyObject *)self, name); ! } ! ! #define AliasObj_setattr NULL #define AliasObj_compare NULL --- 96,100 ---- }; ! #define AliasObj_getsetlist NULL #define AliasObj_compare NULL *************** *** 120,125 **** (destructor) AliasObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) AliasObj_getattr, /*tp_getattr*/ ! (setattrfunc) AliasObj_setattr, /*tp_setattr*/ (cmpfunc) AliasObj_compare, /*tp_compare*/ (reprfunc) AliasObj_repr, /*tp_repr*/ --- 113,118 ---- (destructor) AliasObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) AliasObj_compare, /*tp_compare*/ (reprfunc) AliasObj_repr, /*tp_repr*/ *************** *** 128,131 **** --- 121,141 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) AliasObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + AliasObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + AliasObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: aliassupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/alias/aliassupport.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** aliassupport.py 22 Nov 2002 15:53:32 -0000 1.1 --- aliassupport.py 29 Nov 2002 23:40:41 -0000 1.2 *************** *** 73,77 **** module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) ! class AliasDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): --- 73,77 ---- module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) ! class AliasDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): From jackjansen@users.sourceforge.net Fri Nov 29 23:41:15 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:15 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/dlg _Dlgmodule.c,1.11,1.12 dlgsupport.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/dlg In directory sc8-pr-cvs1:/tmp/cvs-serv8673/dlg Modified Files: _Dlgmodule.c dlgsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Dlgmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/dlg/_Dlgmodule.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _Dlgmodule.c 16 Aug 2002 09:09:20 -0000 1.11 --- _Dlgmodule.c 29 Nov 2002 23:40:42 -0000 1.12 *************** *** 965,976 **** }; ! PyMethodChain DlgObj_chain = { DlgObj_methods, NULL }; ! ! static PyObject *DlgObj_getattr(DialogObject *self, char *name) ! { ! return Py_FindMethodInChain(&DlgObj_chain, (PyObject *)self, name); ! } ! ! #define DlgObj_setattr NULL static int DlgObj_compare(DialogObject *self, DialogObject *other) --- 965,969 ---- }; ! #define DlgObj_getsetlist NULL static int DlgObj_compare(DialogObject *self, DialogObject *other) *************** *** 997,1002 **** (destructor) DlgObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) DlgObj_getattr, /*tp_getattr*/ ! (setattrfunc) DlgObj_setattr, /*tp_setattr*/ (cmpfunc) DlgObj_compare, /*tp_compare*/ (reprfunc) DlgObj_repr, /*tp_repr*/ --- 990,995 ---- (destructor) DlgObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) DlgObj_compare, /*tp_compare*/ (reprfunc) DlgObj_repr, /*tp_repr*/ *************** *** 1005,1008 **** --- 998,1018 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) DlgObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + DlgObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + DlgObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: dlgsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/dlg/dlgsupport.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** dlgsupport.py 16 Dec 2001 20:18:01 -0000 1.28 --- dlgsupport.py 29 Nov 2002 23:40:42 -0000 1.29 *************** *** 202,206 **** # Define a class which specializes our object definition ! class MyObjectDefinition(GlobalObjectDefinition): def __init__(self, name, prefix = None, itselftype = None): GlobalObjectDefinition.__init__(self, name, prefix, itselftype) --- 202,206 ---- # Define a class which specializes our object definition ! class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def __init__(self, name, prefix = None, itselftype = None): GlobalObjectDefinition.__init__(self, name, prefix, itselftype) From jackjansen@users.sourceforge.net Fri Nov 29 23:41:14 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:14 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/cm _Cmmodule.c,1.10,1.11 cmsupport.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cm In directory sc8-pr-cvs1:/tmp/cvs-serv8673/cm Modified Files: _Cmmodule.c cmsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Cmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/_Cmmodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _Cmmodule.c 16 Aug 2002 09:09:19 -0000 1.10 --- _Cmmodule.c 29 Nov 2002 23:40:42 -0000 1.11 *************** *** 306,317 **** }; ! PyMethodChain CmpInstObj_chain = { CmpInstObj_methods, NULL }; ! ! static PyObject *CmpInstObj_getattr(ComponentInstanceObject *self, char *name) ! { ! return Py_FindMethodInChain(&CmpInstObj_chain, (PyObject *)self, name); ! } ! ! #define CmpInstObj_setattr NULL #define CmpInstObj_compare NULL --- 306,310 ---- }; ! #define CmpInstObj_getsetlist NULL #define CmpInstObj_compare NULL *************** *** 330,335 **** (destructor) CmpInstObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) CmpInstObj_getattr, /*tp_getattr*/ ! (setattrfunc) CmpInstObj_setattr, /*tp_setattr*/ (cmpfunc) CmpInstObj_compare, /*tp_compare*/ (reprfunc) CmpInstObj_repr, /*tp_repr*/ --- 323,328 ---- (destructor) CmpInstObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) CmpInstObj_compare, /*tp_compare*/ (reprfunc) CmpInstObj_repr, /*tp_repr*/ *************** *** 338,341 **** --- 331,351 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) CmpInstObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + CmpInstObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + CmpInstObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 702,713 **** }; ! PyMethodChain CmpObj_chain = { CmpObj_methods, NULL }; ! ! static PyObject *CmpObj_getattr(ComponentObject *self, char *name) ! { ! return Py_FindMethodInChain(&CmpObj_chain, (PyObject *)self, name); ! } ! ! #define CmpObj_setattr NULL #define CmpObj_compare NULL --- 712,716 ---- }; ! #define CmpObj_getsetlist NULL #define CmpObj_compare NULL *************** *** 726,731 **** (destructor) CmpObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) CmpObj_getattr, /*tp_getattr*/ ! (setattrfunc) CmpObj_setattr, /*tp_setattr*/ (cmpfunc) CmpObj_compare, /*tp_compare*/ (reprfunc) CmpObj_repr, /*tp_repr*/ --- 729,734 ---- (destructor) CmpObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) CmpObj_compare, /*tp_compare*/ (reprfunc) CmpObj_repr, /*tp_repr*/ *************** *** 734,737 **** --- 737,757 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) CmpObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + CmpObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + CmpObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: cmsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/cmsupport.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** cmsupport.py 25 Mar 2002 00:32:13 -0000 1.6 --- cmsupport.py 29 Nov 2002 23:40:42 -0000 1.7 *************** *** 80,84 **** ComponentResourceHandle = OpaqueByValueType("ComponentResourceHandle", "ResObj") ! class MyCIObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { --- 80,84 ---- ComponentResourceHandle = OpaqueByValueType("ComponentResourceHandle", "ResObj") ! class MyCIObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { *************** *** 87,91 **** }""") ! class MyCObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { --- 87,91 ---- }""") ! class MyCObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { From jackjansen@users.sourceforge.net Fri Nov 29 23:41:14 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:14 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/app _Appmodule.c,1.12,1.13 appsupport.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/app In directory sc8-pr-cvs1:/tmp/cvs-serv8673/app Modified Files: _Appmodule.c appsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Appmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/_Appmodule.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** _Appmodule.c 16 Aug 2002 09:09:13 -0000 1.12 --- _Appmodule.c 29 Nov 2002 23:40:41 -0000 1.13 *************** *** 114,125 **** }; ! PyMethodChain ThemeDrawingStateObj_chain = { ThemeDrawingStateObj_methods, NULL }; ! ! static PyObject *ThemeDrawingStateObj_getattr(ThemeDrawingStateObject *self, char *name) ! { ! return Py_FindMethodInChain(&ThemeDrawingStateObj_chain, (PyObject *)self, name); ! } ! ! #define ThemeDrawingStateObj_setattr NULL #define ThemeDrawingStateObj_compare NULL --- 114,118 ---- }; ! #define ThemeDrawingStateObj_getsetlist NULL #define ThemeDrawingStateObj_compare NULL *************** *** 138,143 **** (destructor) ThemeDrawingStateObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) ThemeDrawingStateObj_getattr, /*tp_getattr*/ ! (setattrfunc) ThemeDrawingStateObj_setattr, /*tp_setattr*/ (cmpfunc) ThemeDrawingStateObj_compare, /*tp_compare*/ (reprfunc) ThemeDrawingStateObj_repr, /*tp_repr*/ --- 131,136 ---- (destructor) ThemeDrawingStateObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) ThemeDrawingStateObj_compare, /*tp_compare*/ (reprfunc) ThemeDrawingStateObj_repr, /*tp_repr*/ *************** *** 146,149 **** --- 139,159 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) ThemeDrawingStateObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + ThemeDrawingStateObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + ThemeDrawingStateObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: appsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/appsupport.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** appsupport.py 22 Aug 2002 23:30:48 -0000 1.15 --- appsupport.py 29 Nov 2002 23:40:41 -0000 1.16 *************** *** 95,99 **** """ ! class MyObjectDefinition(GlobalObjectDefinition): pass ## def outputCheckNewArg(self): --- 95,99 ---- """ ! class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition): pass ## def outputCheckNewArg(self): From jackjansen@users.sourceforge.net Fri Nov 29 23:41:14 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:14 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/cg _CGmodule.c,1.7,1.8 cgsupport.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cg In directory sc8-pr-cvs1:/tmp/cvs-serv8673/cg Modified Files: _CGmodule.c cgsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _CGmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cg/_CGmodule.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** _CGmodule.c 16 Aug 2002 09:09:19 -0000 1.7 --- _CGmodule.c 29 Nov 2002 23:40:42 -0000 1.8 *************** *** 1267,1278 **** }; ! PyMethodChain CGContextRefObj_chain = { CGContextRefObj_methods, NULL }; ! ! static PyObject *CGContextRefObj_getattr(CGContextRefObject *self, char *name) ! { ! return Py_FindMethodInChain(&CGContextRefObj_chain, (PyObject *)self, name); ! } ! ! #define CGContextRefObj_setattr NULL #define CGContextRefObj_compare NULL --- 1267,1271 ---- }; ! #define CGContextRefObj_getsetlist NULL #define CGContextRefObj_compare NULL *************** *** 1291,1296 **** (destructor) CGContextRefObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) CGContextRefObj_getattr, /*tp_getattr*/ ! (setattrfunc) CGContextRefObj_setattr, /*tp_setattr*/ (cmpfunc) CGContextRefObj_compare, /*tp_compare*/ (reprfunc) CGContextRefObj_repr, /*tp_repr*/ --- 1284,1289 ---- (destructor) CGContextRefObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) CGContextRefObj_compare, /*tp_compare*/ (reprfunc) CGContextRefObj_repr, /*tp_repr*/ *************** *** 1299,1302 **** --- 1292,1312 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) CGContextRefObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + CGContextRefObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + CGContextRefObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: cgsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cg/cgsupport.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** cgsupport.py 4 Mar 2002 10:31:32 -0000 1.4 --- cgsupport.py 29 Nov 2002 23:40:42 -0000 1.5 *************** *** 251,255 **** ! class MyObjectDefinition(GlobalObjectDefinition): def outputStructMembers(self): ObjectDefinition.outputStructMembers(self) --- 251,255 ---- ! class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputStructMembers(self): ObjectDefinition.outputStructMembers(self) From jackjansen@users.sourceforge.net Fri Nov 29 23:41:15 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:15 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/evt evtsupport.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/evt In directory sc8-pr-cvs1:/tmp/cvs-serv8673/evt Modified Files: evtsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: evtsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/evt/evtsupport.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** evtsupport.py 25 Mar 2002 00:31:58 -0000 1.15 --- evtsupport.py 29 Nov 2002 23:40:43 -0000 1.16 *************** *** 44,66 **** """ - class MyObjectDefinition(GlobalObjectDefinition): - def outputCheckNewArg(self): - Output("if (itself == NULL) return PyMac_Error(resNotFound);") - def outputCheckConvertArg(self): - OutLbrace("if (DlgObj_Check(v))") - Output("*p_itself = ((WindowObject *)v)->ob_itself;") - Output("return 1;") - OutRbrace() - Out(""" - if (v == Py_None) { *p_itself = NULL; return 1; } - if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; } - """) - # From here on it's basically all boiler plate... # Create the generator groups and link them module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) - ##object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE) - ##module.addobject(object) # Create the generator classes used to populate the lists --- 44,51 ---- *************** *** 70,74 **** # Create and populate the lists functions = [] - ##methods = [] execfile(INPUTFILE) --- 55,58 ---- *************** *** 81,85 **** # (in a different wordl the scan program would generate this) for f in functions: module.add(f) - ##for f in methods: object.add(f) WaitNextEvent_body = """ --- 65,68 ---- From jackjansen@users.sourceforge.net Fri Nov 29 23:41:15 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:15 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/ibcarbon IBCarbonsupport.py,1.2,1.3 _IBCarbon.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon In directory sc8-pr-cvs1:/tmp/cvs-serv8673/ibcarbon Modified Files: IBCarbonsupport.py _IBCarbon.c Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: IBCarbonsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon/IBCarbonsupport.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IBCarbonsupport.py 22 Aug 2002 23:30:48 -0000 1.2 --- IBCarbonsupport.py 29 Nov 2002 23:40:43 -0000 1.3 *************** *** 32,40 **** module = MacModule('_IBCarbon', 'IBCarbon', includestuff, finalstuff, initstuff) ! class CFReleaserObject(GlobalObjectDefinition): def outputFreeIt(self, name): Output("CFRelease(%s);" % name) ! class CFNibDesc(GlobalObjectDefinition): def outputFreeIt(self, name): Output("DisposeNibReference(%s);" % name) --- 32,40 ---- module = MacModule('_IBCarbon', 'IBCarbon', includestuff, finalstuff, initstuff) ! class CFReleaserObject(PEP252Mixin, GlobalObjectDefinition): def outputFreeIt(self, name): Output("CFRelease(%s);" % name) ! class CFNibDesc(PEP252Mixin, GlobalObjectDefinition): def outputFreeIt(self, name): Output("DisposeNibReference(%s);" % name) Index: _IBCarbon.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ibcarbon/_IBCarbon.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** _IBCarbon.c 16 Aug 2002 09:09:26 -0000 1.3 --- _IBCarbon.c 29 Nov 2002 23:40:43 -0000 1.4 *************** *** 141,152 **** }; ! PyMethodChain IBNibRefObj_chain = { IBNibRefObj_methods, NULL }; ! ! static PyObject *IBNibRefObj_getattr(IBNibRefObject *self, char *name) ! { ! return Py_FindMethodInChain(&IBNibRefObj_chain, (PyObject *)self, name); ! } ! ! #define IBNibRefObj_setattr NULL #define IBNibRefObj_compare NULL --- 141,145 ---- }; ! #define IBNibRefObj_getsetlist NULL #define IBNibRefObj_compare NULL *************** *** 165,170 **** (destructor) IBNibRefObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) IBNibRefObj_getattr, /*tp_getattr*/ ! (setattrfunc) IBNibRefObj_setattr, /*tp_setattr*/ (cmpfunc) IBNibRefObj_compare, /*tp_compare*/ (reprfunc) IBNibRefObj_repr, /*tp_repr*/ --- 158,163 ---- (destructor) IBNibRefObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) IBNibRefObj_compare, /*tp_compare*/ (reprfunc) IBNibRefObj_repr, /*tp_repr*/ *************** *** 173,176 **** --- 166,186 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) IBNibRefObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + IBNibRefObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + IBNibRefObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; From jackjansen@users.sourceforge.net Fri Nov 29 23:41:15 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:15 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/drag _Dragmodule.c,1.10,1.11 dragsupport.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/drag In directory sc8-pr-cvs1:/tmp/cvs-serv8673/drag Modified Files: _Dragmodule.c dragsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Dragmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/_Dragmodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _Dragmodule.c 16 Aug 2002 09:09:25 -0000 1.10 --- _Dragmodule.c 29 Nov 2002 23:40:43 -0000 1.11 *************** *** 741,752 **** }; ! PyMethodChain DragObj_chain = { DragObj_methods, NULL }; ! ! static PyObject *DragObj_getattr(DragObjObject *self, char *name) ! { ! return Py_FindMethodInChain(&DragObj_chain, (PyObject *)self, name); ! } ! ! #define DragObj_setattr NULL #define DragObj_compare NULL --- 741,745 ---- }; ! #define DragObj_getsetlist NULL #define DragObj_compare NULL *************** *** 765,770 **** (destructor) DragObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) DragObj_getattr, /*tp_getattr*/ ! (setattrfunc) DragObj_setattr, /*tp_setattr*/ (cmpfunc) DragObj_compare, /*tp_compare*/ (reprfunc) DragObj_repr, /*tp_repr*/ --- 758,763 ---- (destructor) DragObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) DragObj_compare, /*tp_compare*/ (reprfunc) DragObj_repr, /*tp_repr*/ *************** *** 773,776 **** --- 766,786 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) DragObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + DragObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + DragObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: dragsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/dragsupport.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dragsupport.py 25 Mar 2002 00:32:04 -0000 1.10 --- dragsupport.py 29 Nov 2002 23:40:43 -0000 1.11 *************** *** 184,188 **** """ ! class MyObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { --- 184,188 ---- """ ! class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { From jackjansen@users.sourceforge.net Fri Nov 29 23:41:13 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:13 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/ae _AEmodule.c,1.12,1.13 aesupport.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ae In directory sc8-pr-cvs1:/tmp/cvs-serv8673/ae Modified Files: _AEmodule.c aesupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _AEmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ae/_AEmodule.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** _AEmodule.c 16 Aug 2002 09:09:13 -0000 1.12 --- _AEmodule.c 29 Nov 2002 23:40:41 -0000 1.13 *************** *** 21,24 **** --- 21,27 ---- + #ifndef PyDoc_STR + #define PyDoc_STR(x) (x) + #endif #ifdef WITHOUT_FRAMEWORKS #include *************** *** 36,40 **** #endif ! static pascal OSErr GenericEventHandler(); /* Forward */ AEEventHandlerUPP upp_GenericEventHandler; --- 39,49 ---- #endif ! #if UNIVERSAL_INTERFACES_VERSION >= 0x0340 ! typedef long refcontype; ! #else ! typedef unsigned long refcontype; ! #endif ! ! static pascal OSErr GenericEventHandler(const AppleEvent *request, AppleEvent *reply, refcontype refcon); /* Forward */ AEEventHandlerUPP upp_GenericEventHandler; *************** *** 821,864 **** }; ! PyMethodChain AEDesc_chain = { AEDesc_methods, NULL }; ! ! static PyObject *AEDesc_getattr(AEDescObject *self, char *name) { ! if (strcmp(name, "type") == 0) ! return PyMac_BuildOSType(self->ob_itself.descriptorType); ! if (strcmp(name, "data") == 0) { ! PyObject *res; ! #if !TARGET_API_MAC_CARBON ! char state; ! state = HGetState(self->ob_itself.dataHandle); ! HLock(self->ob_itself.dataHandle); ! res = PyString_FromStringAndSize( ! *self->ob_itself.dataHandle, ! GetHandleSize(self->ob_itself.dataHandle)); ! HUnlock(self->ob_itself.dataHandle); ! HSetState(self->ob_itself.dataHandle, state); ! #else ! Size size; ! char *ptr; ! OSErr err; ! ! size = AEGetDescDataSize(&self->ob_itself); ! if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL ) ! return NULL; ! if ( (ptr = PyString_AsString(res)) == NULL ) ! return NULL; ! if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 ) ! return PyMac_Error(err); ! #endif ! return res; ! } ! if (strcmp(name, "__members__") == 0) ! return Py_BuildValue("[ss]", "data", "type"); ! return Py_FindMethodInChain(&AEDesc_chain, (PyObject *)self, name); } ! #define AEDesc_setattr NULL #define AEDesc_compare NULL --- 830,867 ---- }; ! static PyObject *AEDesc_get_type(AEDescObject *self, void *closure) { + return PyMac_BuildOSType(self->ob_itself.descriptorType); + } ! #define AEDesc_set_type NULL ! static PyObject *AEDesc_get_data(AEDescObject *self, void *closure) ! { ! ! PyObject *res; ! Size size; ! char *ptr; ! OSErr err; ! ! size = AEGetDescDataSize(&self->ob_itself); ! if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL ) ! return NULL; ! if ( (ptr = PyString_AsString(res)) == NULL ) ! return NULL; ! if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 ) ! return PyMac_Error(err); ! return res; ! } ! #define AEDesc_set_data NULL ! ! static PyGetSetDef AEDesc_getsetlist[] = { ! {"type", (getter)AEDesc_get_type, (setter)AEDesc_set_type, "Type of this AEDesc"}, ! {"data", (getter)AEDesc_get_data, (setter)AEDesc_set_data, "The raw data in this AEDesc"}, ! {NULL, NULL, NULL, NULL}, ! }; ! #define AEDesc_compare NULL *************** *** 877,882 **** (destructor) AEDesc_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) AEDesc_getattr, /*tp_getattr*/ ! (setattrfunc) AEDesc_setattr, /*tp_setattr*/ (cmpfunc) AEDesc_compare, /*tp_compare*/ (reprfunc) AEDesc_repr, /*tp_repr*/ --- 880,885 ---- (destructor) AEDesc_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) AEDesc_compare, /*tp_compare*/ (reprfunc) AEDesc_repr, /*tp_repr*/ *************** *** 885,888 **** --- 888,908 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) AEDesc_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + AEDesc_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + AEDesc_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 1350,1359 **** - - #if UNIVERSAL_INTERFACES_VERSION >= 0x0340 - typedef long refcontype; - #else - typedef unsigned long refcontype; - #endif static pascal OSErr --- 1370,1373 ---- Index: aesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ae/aesupport.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** aesupport.py 25 Mar 2002 00:32:17 -0000 1.26 --- aesupport.py 29 Nov 2002 23:40:41 -0000 1.27 *************** *** 83,86 **** --- 83,89 ---- includestuff = includestuff + """ + #ifndef PyDoc_STR + #define PyDoc_STR(x) (x) + #endif #ifdef WITHOUT_FRAMEWORKS #include *************** *** 98,102 **** #endif ! static pascal OSErr GenericEventHandler(); /* Forward */ AEEventHandlerUPP upp_GenericEventHandler; --- 101,111 ---- #endif ! #if UNIVERSAL_INTERFACES_VERSION >= 0x0340 ! typedef long refcontype; ! #else ! typedef unsigned long refcontype; ! #endif ! ! static pascal OSErr GenericEventHandler(const AppleEvent *request, AppleEvent *reply, refcontype refcon); /* Forward */ AEEventHandlerUPP upp_GenericEventHandler; *************** *** 119,128 **** finalstuff = finalstuff + """ - #if UNIVERSAL_INTERFACES_VERSION >= 0x0340 - typedef long refcontype; - #else - typedef unsigned long refcontype; - #endif - static pascal OSErr GenericEventHandler(const AppleEvent *request, AppleEvent *reply, refcontype refcon) --- 128,131 ---- *************** *** 172,176 **** module = MacModule('_AE', 'AE', includestuff, finalstuff, initstuff) ! class AEDescDefinition(GlobalObjectDefinition): def __init__(self, name, prefix = None, itselftype = None): --- 175,204 ---- module = MacModule('_AE', 'AE', includestuff, finalstuff, initstuff) ! class AEDescDefinition(PEP252Mixin, GlobalObjectDefinition): ! getsetlist = [( ! 'type', ! 'return PyMac_BuildOSType(self->ob_itself.descriptorType);', ! None, ! 'Type of this AEDesc' ! ), ( ! 'data', ! """ ! PyObject *res; ! Size size; ! char *ptr; ! OSErr err; ! ! size = AEGetDescDataSize(&self->ob_itself); ! if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL ) ! return NULL; ! if ( (ptr = PyString_AsString(res)) == NULL ) ! return NULL; ! if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 ) ! return PyMac_Error(err); ! return res; ! """, ! None, ! 'The raw data in this AEDesc' ! )] def __init__(self, name, prefix = None, itselftype = None): *************** *** 180,218 **** def outputFreeIt(self, name): Output("AEDisposeDesc(&%s);", name) - - def outputGetattrHook(self): - Output(""" - if (strcmp(name, "type") == 0) - return PyMac_BuildOSType(self->ob_itself.descriptorType); - if (strcmp(name, "data") == 0) { - PyObject *res; - #if !TARGET_API_MAC_CARBON - char state; - state = HGetState(self->ob_itself.dataHandle); - HLock(self->ob_itself.dataHandle); - res = PyString_FromStringAndSize( - *self->ob_itself.dataHandle, - GetHandleSize(self->ob_itself.dataHandle)); - HUnlock(self->ob_itself.dataHandle); - HSetState(self->ob_itself.dataHandle, state); - #else - Size size; - char *ptr; - OSErr err; - - size = AEGetDescDataSize(&self->ob_itself); - if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL ) - return NULL; - if ( (ptr = PyString_AsString(res)) == NULL ) - return NULL; - if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 ) - return PyMac_Error(err); - #endif - return res; - } - if (strcmp(name, "__members__") == 0) - return Py_BuildValue("[ss]", "data", "type"); - """) - aedescobject = AEDescDefinition('AEDesc') --- 208,211 ---- From jackjansen@users.sourceforge.net Fri Nov 29 23:41:16 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:16 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/menu _Menumodule.c,1.12,1.13 menusupport.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/menu In directory sc8-pr-cvs1:/tmp/cvs-serv8673/menu Modified Files: _Menumodule.c menusupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Menumodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/_Menumodule.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** _Menumodule.c 16 Aug 2002 09:09:28 -0000 1.12 --- _Menumodule.c 29 Nov 2002 23:40:44 -0000 1.13 *************** *** 3001,3012 **** }; ! PyMethodChain MenuObj_chain = { MenuObj_methods, NULL }; ! ! static PyObject *MenuObj_getattr(MenuObject *self, char *name) ! { ! return Py_FindMethodInChain(&MenuObj_chain, (PyObject *)self, name); ! } ! ! #define MenuObj_setattr NULL #define MenuObj_compare NULL --- 3001,3005 ---- }; ! #define MenuObj_getsetlist NULL #define MenuObj_compare NULL *************** *** 3025,3030 **** (destructor) MenuObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) MenuObj_getattr, /*tp_getattr*/ ! (setattrfunc) MenuObj_setattr, /*tp_setattr*/ (cmpfunc) MenuObj_compare, /*tp_compare*/ (reprfunc) MenuObj_repr, /*tp_repr*/ --- 3018,3023 ---- (destructor) MenuObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) MenuObj_compare, /*tp_compare*/ (reprfunc) MenuObj_repr, /*tp_repr*/ *************** *** 3033,3036 **** --- 3026,3046 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) MenuObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + MenuObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + MenuObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: menusupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/menusupport.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** menusupport.py 22 Aug 2002 23:30:48 -0000 1.17 --- menusupport.py 29 Nov 2002 23:40:44 -0000 1.18 *************** *** 99,103 **** """ ! class MyObjectDefinition(GlobalObjectDefinition): pass --- 99,103 ---- """ ! class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition): pass From jackjansen@users.sourceforge.net Fri Nov 29 23:41:14 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:14 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/carbonevt CarbonEvtsupport.py,1.10,1.11 _CarbonEvtmodule.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/carbonevt In directory sc8-pr-cvs1:/tmp/cvs-serv8673/carbonevt Modified Files: CarbonEvtsupport.py _CarbonEvtmodule.c Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: CarbonEvtsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/carbonevt/CarbonEvtsupport.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CarbonEvtsupport.py 8 Jan 2002 11:49:31 -0000 1.10 --- CarbonEvtsupport.py 29 Nov 2002 23:40:42 -0000 1.11 *************** *** 216,220 **** ! class EventHandlerRefObjectDefinition(GlobalObjectDefinition): def outputStructMembers(self): Output("%s ob_itself;", self.itselftype) --- 216,220 ---- ! class EventHandlerRefObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputStructMembers(self): Output("%s ob_itself;", self.itselftype) *************** *** 228,231 **** --- 228,234 ---- Output("Py_DECREF(self->ob_callback);") OutRbrace() + + class MyGlobalObjectDefinition(PEP252Mixin, GlobalObjectDefinition): + pass for typ in RefObjectTypes: *************** *** 233,237 **** EventHandlerRefobject = EventHandlerRefObjectDefinition('EventHandlerRef') else: ! execstr = typ + 'object = GlobalObjectDefinition(typ)' exec execstr module.addobject(eval(typ + 'object')) --- 236,240 ---- EventHandlerRefobject = EventHandlerRefObjectDefinition('EventHandlerRef') else: ! execstr = typ + 'object = MyGlobalObjectDefinition(typ)' exec execstr module.addobject(eval(typ + 'object')) Index: _CarbonEvtmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/carbonevt/_CarbonEvtmodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _CarbonEvtmodule.c 16 Aug 2002 09:09:14 -0000 1.10 --- _CarbonEvtmodule.c 29 Nov 2002 23:40:42 -0000 1.11 *************** *** 409,420 **** }; ! PyMethodChain EventRef_chain = { EventRef_methods, NULL }; ! ! static PyObject *EventRef_getattr(EventRefObject *self, char *name) ! { ! return Py_FindMethodInChain(&EventRef_chain, (PyObject *)self, name); ! } ! ! #define EventRef_setattr NULL #define EventRef_compare NULL --- 409,413 ---- }; ! #define EventRef_getsetlist NULL #define EventRef_compare NULL *************** *** 433,438 **** (destructor) EventRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) EventRef_getattr, /*tp_getattr*/ ! (setattrfunc) EventRef_setattr, /*tp_setattr*/ (cmpfunc) EventRef_compare, /*tp_compare*/ (reprfunc) EventRef_repr, /*tp_repr*/ --- 426,431 ---- (destructor) EventRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) EventRef_compare, /*tp_compare*/ (reprfunc) EventRef_repr, /*tp_repr*/ *************** *** 441,444 **** --- 434,454 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) EventRef_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + EventRef_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + EventRef_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 592,603 **** }; ! PyMethodChain EventQueueRef_chain = { EventQueueRef_methods, NULL }; ! ! static PyObject *EventQueueRef_getattr(EventQueueRefObject *self, char *name) ! { ! return Py_FindMethodInChain(&EventQueueRef_chain, (PyObject *)self, name); ! } ! ! #define EventQueueRef_setattr NULL #define EventQueueRef_compare NULL --- 602,606 ---- }; ! #define EventQueueRef_getsetlist NULL #define EventQueueRef_compare NULL *************** *** 616,621 **** (destructor) EventQueueRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) EventQueueRef_getattr, /*tp_getattr*/ ! (setattrfunc) EventQueueRef_setattr, /*tp_setattr*/ (cmpfunc) EventQueueRef_compare, /*tp_compare*/ (reprfunc) EventQueueRef_repr, /*tp_repr*/ --- 619,624 ---- (destructor) EventQueueRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) EventQueueRef_compare, /*tp_compare*/ (reprfunc) EventQueueRef_repr, /*tp_repr*/ *************** *** 624,627 **** --- 627,647 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) EventQueueRef_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + EventQueueRef_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + EventQueueRef_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 684,695 **** }; ! PyMethodChain EventLoopRef_chain = { EventLoopRef_methods, NULL }; ! ! static PyObject *EventLoopRef_getattr(EventLoopRefObject *self, char *name) ! { ! return Py_FindMethodInChain(&EventLoopRef_chain, (PyObject *)self, name); ! } ! ! #define EventLoopRef_setattr NULL #define EventLoopRef_compare NULL --- 704,708 ---- }; ! #define EventLoopRef_getsetlist NULL #define EventLoopRef_compare NULL *************** *** 708,713 **** (destructor) EventLoopRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) EventLoopRef_getattr, /*tp_getattr*/ ! (setattrfunc) EventLoopRef_setattr, /*tp_setattr*/ (cmpfunc) EventLoopRef_compare, /*tp_compare*/ (reprfunc) EventLoopRef_repr, /*tp_repr*/ --- 721,726 ---- (destructor) EventLoopRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) EventLoopRef_compare, /*tp_compare*/ (reprfunc) EventLoopRef_repr, /*tp_repr*/ *************** *** 716,719 **** --- 729,749 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) EventLoopRef_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + EventLoopRef_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + EventLoopRef_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 794,805 **** }; ! PyMethodChain EventLoopTimerRef_chain = { EventLoopTimerRef_methods, NULL }; ! ! static PyObject *EventLoopTimerRef_getattr(EventLoopTimerRefObject *self, char *name) ! { ! return Py_FindMethodInChain(&EventLoopTimerRef_chain, (PyObject *)self, name); ! } ! ! #define EventLoopTimerRef_setattr NULL #define EventLoopTimerRef_compare NULL --- 824,828 ---- }; ! #define EventLoopTimerRef_getsetlist NULL #define EventLoopTimerRef_compare NULL *************** *** 818,823 **** (destructor) EventLoopTimerRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) EventLoopTimerRef_getattr, /*tp_getattr*/ ! (setattrfunc) EventLoopTimerRef_setattr, /*tp_setattr*/ (cmpfunc) EventLoopTimerRef_compare, /*tp_compare*/ (reprfunc) EventLoopTimerRef_repr, /*tp_repr*/ --- 841,846 ---- (destructor) EventLoopTimerRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) EventLoopTimerRef_compare, /*tp_compare*/ (reprfunc) EventLoopTimerRef_repr, /*tp_repr*/ *************** *** 826,829 **** --- 849,869 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) EventLoopTimerRef_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + EventLoopTimerRef_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + EventLoopTimerRef_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 949,960 **** }; ! PyMethodChain EventHandlerRef_chain = { EventHandlerRef_methods, NULL }; ! ! static PyObject *EventHandlerRef_getattr(EventHandlerRefObject *self, char *name) ! { ! return Py_FindMethodInChain(&EventHandlerRef_chain, (PyObject *)self, name); ! } ! ! #define EventHandlerRef_setattr NULL #define EventHandlerRef_compare NULL --- 989,993 ---- }; ! #define EventHandlerRef_getsetlist NULL #define EventHandlerRef_compare NULL *************** *** 973,978 **** (destructor) EventHandlerRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) EventHandlerRef_getattr, /*tp_getattr*/ ! (setattrfunc) EventHandlerRef_setattr, /*tp_setattr*/ (cmpfunc) EventHandlerRef_compare, /*tp_compare*/ (reprfunc) EventHandlerRef_repr, /*tp_repr*/ --- 1006,1011 ---- (destructor) EventHandlerRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) EventHandlerRef_compare, /*tp_compare*/ (reprfunc) EventHandlerRef_repr, /*tp_repr*/ *************** *** 981,984 **** --- 1014,1034 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) EventHandlerRef_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + EventHandlerRef_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + EventHandlerRef_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 1044,1055 **** }; ! PyMethodChain EventHandlerCallRef_chain = { EventHandlerCallRef_methods, NULL }; ! ! static PyObject *EventHandlerCallRef_getattr(EventHandlerCallRefObject *self, char *name) ! { ! return Py_FindMethodInChain(&EventHandlerCallRef_chain, (PyObject *)self, name); ! } ! ! #define EventHandlerCallRef_setattr NULL #define EventHandlerCallRef_compare NULL --- 1094,1098 ---- }; ! #define EventHandlerCallRef_getsetlist NULL #define EventHandlerCallRef_compare NULL *************** *** 1068,1073 **** (destructor) EventHandlerCallRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) EventHandlerCallRef_getattr, /*tp_getattr*/ ! (setattrfunc) EventHandlerCallRef_setattr, /*tp_setattr*/ (cmpfunc) EventHandlerCallRef_compare, /*tp_compare*/ (reprfunc) EventHandlerCallRef_repr, /*tp_repr*/ --- 1111,1116 ---- (destructor) EventHandlerCallRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) EventHandlerCallRef_compare, /*tp_compare*/ (reprfunc) EventHandlerCallRef_repr, /*tp_repr*/ *************** *** 1076,1079 **** --- 1119,1139 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) EventHandlerCallRef_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + EventHandlerCallRef_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + EventHandlerCallRef_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 1161,1172 **** }; ! PyMethodChain EventTargetRef_chain = { EventTargetRef_methods, NULL }; ! ! static PyObject *EventTargetRef_getattr(EventTargetRefObject *self, char *name) ! { ! return Py_FindMethodInChain(&EventTargetRef_chain, (PyObject *)self, name); ! } ! ! #define EventTargetRef_setattr NULL #define EventTargetRef_compare NULL --- 1221,1225 ---- }; ! #define EventTargetRef_getsetlist NULL #define EventTargetRef_compare NULL *************** *** 1185,1190 **** (destructor) EventTargetRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) EventTargetRef_getattr, /*tp_getattr*/ ! (setattrfunc) EventTargetRef_setattr, /*tp_setattr*/ (cmpfunc) EventTargetRef_compare, /*tp_compare*/ (reprfunc) EventTargetRef_repr, /*tp_repr*/ --- 1238,1243 ---- (destructor) EventTargetRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) EventTargetRef_compare, /*tp_compare*/ (reprfunc) EventTargetRef_repr, /*tp_repr*/ *************** *** 1193,1196 **** --- 1246,1266 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) EventTargetRef_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + EventTargetRef_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + EventTargetRef_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 1253,1264 **** }; ! PyMethodChain EventHotKeyRef_chain = { EventHotKeyRef_methods, NULL }; ! ! static PyObject *EventHotKeyRef_getattr(EventHotKeyRefObject *self, char *name) ! { ! return Py_FindMethodInChain(&EventHotKeyRef_chain, (PyObject *)self, name); ! } ! ! #define EventHotKeyRef_setattr NULL #define EventHotKeyRef_compare NULL --- 1323,1327 ---- }; ! #define EventHotKeyRef_getsetlist NULL #define EventHotKeyRef_compare NULL *************** *** 1277,1282 **** (destructor) EventHotKeyRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) EventHotKeyRef_getattr, /*tp_getattr*/ ! (setattrfunc) EventHotKeyRef_setattr, /*tp_setattr*/ (cmpfunc) EventHotKeyRef_compare, /*tp_compare*/ (reprfunc) EventHotKeyRef_repr, /*tp_repr*/ --- 1340,1345 ---- (destructor) EventHotKeyRef_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) EventHotKeyRef_compare, /*tp_compare*/ (reprfunc) EventHotKeyRef_repr, /*tp_repr*/ *************** *** 1285,1288 **** --- 1348,1368 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) EventHotKeyRef_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + EventHotKeyRef_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + EventHotKeyRef_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; From jackjansen@users.sourceforge.net Fri Nov 29 23:41:16 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:16 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/list _Listmodule.c,1.11,1.12 listscan.py,1.11,1.12 listsupport.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/list In directory sc8-pr-cvs1:/tmp/cvs-serv8673/list Modified Files: _Listmodule.c listscan.py listsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Listmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/_Listmodule.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _Listmodule.c 16 Aug 2002 09:09:28 -0000 1.11 --- _Listmodule.c 29 Nov 2002 23:40:44 -0000 1.12 *************** *** 543,546 **** --- 543,678 ---- } + static PyObject *ListObj_GetListPort(ListObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + CGrafPtr _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetListPort(_self->ob_itself); + _res = Py_BuildValue("O&", + GrafObj_New, _rv); + return _res; + } + + static PyObject *ListObj_GetListVerticalScrollBar(ListObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + ControlHandle _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetListVerticalScrollBar(_self->ob_itself); + _res = Py_BuildValue("O&", + CtlObj_New, _rv); + return _res; + } + + static PyObject *ListObj_GetListHorizontalScrollBar(ListObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + ControlHandle _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetListHorizontalScrollBar(_self->ob_itself); + _res = Py_BuildValue("O&", + CtlObj_New, _rv); + return _res; + } + + static PyObject *ListObj_GetListActive(ListObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Boolean _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetListActive(_self->ob_itself); + _res = Py_BuildValue("b", + _rv); + return _res; + } + + static PyObject *ListObj_GetListClickTime(ListObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + SInt32 _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetListClickTime(_self->ob_itself); + _res = Py_BuildValue("l", + _rv); + return _res; + } + + static PyObject *ListObj_GetListRefCon(ListObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + SInt32 _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetListRefCon(_self->ob_itself); + _res = Py_BuildValue("l", + _rv); + return _res; + } + + static PyObject *ListObj_GetListDefinition(ListObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Handle _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetListDefinition(_self->ob_itself); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; + } + + static PyObject *ListObj_GetListUserHandle(ListObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Handle _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetListUserHandle(_self->ob_itself); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; + } + + static PyObject *ListObj_GetListDataHandle(ListObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + DataHandle _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetListDataHandle(_self->ob_itself); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; + } + + static PyObject *ListObj_GetListFlags(ListObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OptionBits _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetListFlags(_self->ob_itself); + _res = Py_BuildValue("l", + _rv); + return _res; + } + + static PyObject *ListObj_GetListSelectionFlags(ListObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OptionBits _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetListSelectionFlags(_self->ob_itself); + _res = Py_BuildValue("l", + _rv); + return _res; + } + static PyObject *ListObj_as_Resource(ListObject *_self, PyObject *_args) { *************** *** 602,605 **** --- 734,759 ---- {"LGetCellDataLocation", (PyCFunction)ListObj_LGetCellDataLocation, 1, PyDoc_STR("(Point theCell) -> (short offset, short len)")}, + {"GetListPort", (PyCFunction)ListObj_GetListPort, 1, + PyDoc_STR("() -> (CGrafPtr _rv)")}, + {"GetListVerticalScrollBar", (PyCFunction)ListObj_GetListVerticalScrollBar, 1, + PyDoc_STR("() -> (ControlHandle _rv)")}, + {"GetListHorizontalScrollBar", (PyCFunction)ListObj_GetListHorizontalScrollBar, 1, + PyDoc_STR("() -> (ControlHandle _rv)")}, + {"GetListActive", (PyCFunction)ListObj_GetListActive, 1, + PyDoc_STR("() -> (Boolean _rv)")}, + {"GetListClickTime", (PyCFunction)ListObj_GetListClickTime, 1, + PyDoc_STR("() -> (SInt32 _rv)")}, + {"GetListRefCon", (PyCFunction)ListObj_GetListRefCon, 1, + PyDoc_STR("() -> (SInt32 _rv)")}, + {"GetListDefinition", (PyCFunction)ListObj_GetListDefinition, 1, + PyDoc_STR("() -> (Handle _rv)")}, + {"GetListUserHandle", (PyCFunction)ListObj_GetListUserHandle, 1, + PyDoc_STR("() -> (Handle _rv)")}, + {"GetListDataHandle", (PyCFunction)ListObj_GetListDataHandle, 1, + PyDoc_STR("() -> (DataHandle _rv)")}, + {"GetListFlags", (PyCFunction)ListObj_GetListFlags, 1, + PyDoc_STR("() -> (OptionBits _rv)")}, + {"GetListSelectionFlags", (PyCFunction)ListObj_GetListSelectionFlags, 1, + PyDoc_STR("() -> (OptionBits _rv)")}, {"as_Resource", (PyCFunction)ListObj_as_Resource, 1, PyDoc_STR("() -> (Handle _rv)")}, *************** *** 607,647 **** }; ! PyMethodChain ListObj_chain = { ListObj_methods, NULL }; ! static PyObject *ListObj_getattr(ListObject *self, char *name) { ! { ! if ( strcmp(name, "listFlags") == 0 ) ! return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff); ! if ( strcmp(name, "selFlags") == 0 ) ! return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff); ! if ( strcmp(name, "cellSize") == 0 ) ! return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->cellSize); ! } ! return Py_FindMethodInChain(&ListObj_chain, (PyObject *)self, name); } ! static int ! ListObj_setattr(ListObject *self, char *name, PyObject *value) { ! long intval; ! int err = 0; ! ! if ( value == NULL ) { ! PyErr_SetString(PyExc_AttributeError, "Cannot delete attribute"); ! return -1; ! } ! if (strcmp(name, "listFlags") == 0 ) ! err = PyArg_Parse(value, "B", &(*self->ob_itself)->listFlags); ! else if (strcmp(name, "selFlags") == 0 ) ! err = PyArg_Parse(value, "B", &(*self->ob_itself)->selFlags); ! else if (strcmp(name, "cellSize") == 0 ) ! err = PyArg_Parse(value, "O&", PyMac_GetPoint, &(*self->ob_itself)->cellSize); ! else ! PyErr_SetString(PyExc_AttributeError, "No such attribute"); ! if (err) return 0; ! else return -1; } #define ListObj_compare NULL --- 761,804 ---- }; ! static PyObject *ListObj_get_listFlags(ListObject *self, void *closure) ! { ! return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff); ! } ! static int ListObj_set_listFlags(ListObject *self, PyObject *v, void *closure) { ! if (!PyArg_Parse(v, "B", &(*self->ob_itself)->listFlags)) return -1; ! return 0; } ! static PyObject *ListObj_get_selFlags(ListObject *self, void *closure) { ! return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff); ! } ! ! static int ListObj_set_selFlags(ListObject *self, PyObject *v, void *closure) ! { ! if (!PyArg_Parse(v, "B", &(*self->ob_itself)->selFlags)) return -1; ! return 0; ! } ! ! static PyObject *ListObj_get_cellSize(ListObject *self, void *closure) ! { ! return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->cellSize); ! } ! ! static int ListObj_set_cellSize(ListObject *self, PyObject *v, void *closure) ! { ! if (!PyArg_Parse(v, "O&", PyMac_GetPoint, &(*self->ob_itself)->cellSize)) return -1; ! return 0; } + static PyGetSetDef ListObj_getsetlist[] = { + {"listFlags", (getter)ListObj_get_listFlags, (setter)ListObj_set_listFlags, NULL}, + {"selFlags", (getter)ListObj_get_selFlags, (setter)ListObj_set_selFlags, NULL}, + {"cellSize", (getter)ListObj_get_cellSize, (setter)ListObj_set_cellSize, NULL}, + {NULL, NULL, NULL, NULL}, + }; + #define ListObj_compare NULL *************** *** 660,665 **** (destructor) ListObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) ListObj_getattr, /*tp_getattr*/ ! (setattrfunc) ListObj_setattr, /*tp_setattr*/ (cmpfunc) ListObj_compare, /*tp_compare*/ (reprfunc) ListObj_repr, /*tp_repr*/ --- 817,822 ---- (destructor) ListObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) ListObj_compare, /*tp_compare*/ (reprfunc) ListObj_repr, /*tp_repr*/ *************** *** 668,671 **** --- 825,845 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) ListObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + ListObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + ListObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 784,941 **** } - static PyObject *List_GetListPort(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - CGrafPtr _rv; - ListHandle list; - if (!PyArg_ParseTuple(_args, "O&", - ListObj_Convert, &list)) - return NULL; - _rv = GetListPort(list); - _res = Py_BuildValue("O&", - GrafObj_New, _rv); - return _res; - } - - static PyObject *List_GetListVerticalScrollBar(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - ControlHandle _rv; - ListHandle list; - if (!PyArg_ParseTuple(_args, "O&", - ListObj_Convert, &list)) - return NULL; - _rv = GetListVerticalScrollBar(list); - _res = Py_BuildValue("O&", - CtlObj_New, _rv); - return _res; - } - - static PyObject *List_GetListHorizontalScrollBar(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - ControlHandle _rv; - ListHandle list; - if (!PyArg_ParseTuple(_args, "O&", - ListObj_Convert, &list)) - return NULL; - _rv = GetListHorizontalScrollBar(list); - _res = Py_BuildValue("O&", - CtlObj_New, _rv); - return _res; - } - - static PyObject *List_GetListActive(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - Boolean _rv; - ListHandle list; - if (!PyArg_ParseTuple(_args, "O&", - ListObj_Convert, &list)) - return NULL; - _rv = GetListActive(list); - _res = Py_BuildValue("b", - _rv); - return _res; - } - - static PyObject *List_GetListClickTime(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - SInt32 _rv; - ListHandle list; - if (!PyArg_ParseTuple(_args, "O&", - ListObj_Convert, &list)) - return NULL; - _rv = GetListClickTime(list); - _res = Py_BuildValue("l", - _rv); - return _res; - } - - static PyObject *List_GetListRefCon(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - SInt32 _rv; - ListHandle list; - if (!PyArg_ParseTuple(_args, "O&", - ListObj_Convert, &list)) - return NULL; - _rv = GetListRefCon(list); - _res = Py_BuildValue("l", - _rv); - return _res; - } - - static PyObject *List_GetListDefinition(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - Handle _rv; - ListHandle list; - if (!PyArg_ParseTuple(_args, "O&", - ListObj_Convert, &list)) - return NULL; - _rv = GetListDefinition(list); - _res = Py_BuildValue("O&", - ResObj_New, _rv); - return _res; - } - - static PyObject *List_GetListUserHandle(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - Handle _rv; - ListHandle list; - if (!PyArg_ParseTuple(_args, "O&", - ListObj_Convert, &list)) - return NULL; - _rv = GetListUserHandle(list); - _res = Py_BuildValue("O&", - ResObj_New, _rv); - return _res; - } - - static PyObject *List_GetListDataHandle(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - DataHandle _rv; - ListHandle list; - if (!PyArg_ParseTuple(_args, "O&", - ListObj_Convert, &list)) - return NULL; - _rv = GetListDataHandle(list); - _res = Py_BuildValue("O&", - ResObj_New, _rv); - return _res; - } - - static PyObject *List_GetListFlags(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - OptionBits _rv; - ListHandle list; - if (!PyArg_ParseTuple(_args, "O&", - ListObj_Convert, &list)) - return NULL; - _rv = GetListFlags(list); - _res = Py_BuildValue("l", - _rv); - return _res; - } - - static PyObject *List_GetListSelectionFlags(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - OptionBits _rv; - ListHandle list; - if (!PyArg_ParseTuple(_args, "O&", - ListObj_Convert, &list)) - return NULL; - _rv = GetListSelectionFlags(list); - _res = Py_BuildValue("l", - _rv); - return _res; - } - static PyObject *List_SetListViewBounds(PyObject *_self, PyObject *_args) { --- 958,961 ---- *************** *** 1086,1111 **** {"LNew", (PyCFunction)List_LNew, 1, PyDoc_STR("(Rect rView, Rect dataBounds, Point cSize, short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle _rv)")}, - {"GetListPort", (PyCFunction)List_GetListPort, 1, - PyDoc_STR("(ListHandle list) -> (CGrafPtr _rv)")}, - {"GetListVerticalScrollBar", (PyCFunction)List_GetListVerticalScrollBar, 1, - PyDoc_STR("(ListHandle list) -> (ControlHandle _rv)")}, - {"GetListHorizontalScrollBar", (PyCFunction)List_GetListHorizontalScrollBar, 1, - PyDoc_STR("(ListHandle list) -> (ControlHandle _rv)")}, - {"GetListActive", (PyCFunction)List_GetListActive, 1, - PyDoc_STR("(ListHandle list) -> (Boolean _rv)")}, - {"GetListClickTime", (PyCFunction)List_GetListClickTime, 1, - PyDoc_STR("(ListHandle list) -> (SInt32 _rv)")}, - {"GetListRefCon", (PyCFunction)List_GetListRefCon, 1, - PyDoc_STR("(ListHandle list) -> (SInt32 _rv)")}, - {"GetListDefinition", (PyCFunction)List_GetListDefinition, 1, - PyDoc_STR("(ListHandle list) -> (Handle _rv)")}, - {"GetListUserHandle", (PyCFunction)List_GetListUserHandle, 1, - PyDoc_STR("(ListHandle list) -> (Handle _rv)")}, - {"GetListDataHandle", (PyCFunction)List_GetListDataHandle, 1, - PyDoc_STR("(ListHandle list) -> (DataHandle _rv)")}, - {"GetListFlags", (PyCFunction)List_GetListFlags, 1, - PyDoc_STR("(ListHandle list) -> (OptionBits _rv)")}, - {"GetListSelectionFlags", (PyCFunction)List_GetListSelectionFlags, 1, - PyDoc_STR("(ListHandle list) -> (OptionBits _rv)")}, {"SetListViewBounds", (PyCFunction)List_SetListViewBounds, 1, PyDoc_STR("(ListHandle list, Rect view) -> None")}, --- 1106,1109 ---- Index: listscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/listscan.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** listscan.py 15 Aug 2002 21:48:14 -0000 1.11 --- listscan.py 29 Nov 2002 23:40:44 -0000 1.12 *************** *** 32,36 **** t, n, m = arglist[-1] # This is non-functional today ! if t == OBJECT and m == "InMode": classname = "Method" listname = "methods" --- 32,36 ---- t, n, m = arglist[-1] # This is non-functional today ! if t in ('ListHandle', 'ListRef') and m == "InMode": classname = "Method" listname = "methods" Index: listsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/listsupport.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** listsupport.py 16 Dec 2001 20:18:11 -0000 1.14 --- listsupport.py 29 Nov 2002 23:40:44 -0000 1.15 *************** *** 138,176 **** self.argumentList.append(self.itself) ! getattrHookCode = """{ ! if ( strcmp(name, "listFlags") == 0 ) ! return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff); ! if ( strcmp(name, "selFlags") == 0 ) ! return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff); ! if ( strcmp(name, "cellSize") == 0 ) ! return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->cellSize); ! }""" ! ! setattrCode = """ ! static int ! ListObj_setattr(ListObject *self, char *name, PyObject *value) ! { ! long intval; ! int err = 0; ! ! if ( value == NULL ) { ! PyErr_SetString(PyExc_AttributeError, "Cannot delete attribute"); ! return -1; ! } ! if (strcmp(name, "listFlags") == 0 ) ! err = PyArg_Parse(value, "B", &(*self->ob_itself)->listFlags); ! else if (strcmp(name, "selFlags") == 0 ) ! err = PyArg_Parse(value, "B", &(*self->ob_itself)->selFlags); ! else if (strcmp(name, "cellSize") == 0 ) ! err = PyArg_Parse(value, "O&", PyMac_GetPoint, &(*self->ob_itself)->cellSize); ! else ! PyErr_SetString(PyExc_AttributeError, "No such attribute"); ! if (err) return 0; ! else return -1; ! } ! """ ! ! ! class MyObjectDefinition(GlobalObjectDefinition): def outputStructMembers(self): --- 138,158 ---- self.argumentList.append(self.itself) ! class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition): ! getsetlist = [( ! 'listFlags', ! 'return Py_BuildValue("l", (long)GetListFlags(self->ob_itself) & 0xff);', ! 'if (!PyArg_Parse(v, "B", &(*self->ob_itself)->listFlags)) return -1;', ! None, ! ), ( ! 'selFlags', ! 'return Py_BuildValue("l", (long)GetListSelectionFlags(self->ob_itself) & 0xff);', ! 'if (!PyArg_Parse(v, "B", &(*self->ob_itself)->selFlags)) return -1;', ! None, ! ), ( ! 'cellSize', ! 'return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->cellSize);', ! 'if (!PyArg_Parse(v, "O&", PyMac_GetPoint, &(*self->ob_itself)->cellSize)) return -1;', ! None ! )] def outputStructMembers(self): *************** *** 201,210 **** Output("SetListRefCon(self->ob_itself, (long)0);") Output("if (self->ob_must_be_disposed && %s) LDispose(%s);", itselfname, itselfname) - - def outputGetattrHook(self): - Output(getattrHookCode) - - def outputSetattr(self): - Output(setattrCode) # From here on it's basically all boiler plate... --- 183,186 ---- From jackjansen@users.sourceforge.net Fri Nov 29 23:40:49 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:40:49 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/scrap scrapsupport.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/scrap In directory sc8-pr-cvs1:/tmp/cvs-serv8673/scrap Modified Files: scrapsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: scrapsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/scrap/scrapsupport.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** scrapsupport.py 18 Nov 2002 15:26:42 -0000 1.6 --- scrapsupport.py 29 Nov 2002 23:40:47 -0000 1.7 *************** *** 56,60 **** putscrapbuffer = FixedInputBufferType('void *') ! class MyObjectDefinition(GlobalObjectDefinition): pass --- 56,60 ---- putscrapbuffer = FixedInputBufferType('void *') ! class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition): pass From jackjansen@users.sourceforge.net Fri Nov 29 23:40:49 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:40:49 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/snd _Sndmodule.c,1.10,1.11 sndsupport.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/snd In directory sc8-pr-cvs1:/tmp/cvs-serv8673/snd Modified Files: _Sndmodule.c sndsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Sndmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/snd/_Sndmodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _Sndmodule.c 16 Aug 2002 09:09:30 -0000 1.10 --- _Sndmodule.c 29 Nov 2002 23:40:47 -0000 1.11 *************** *** 301,312 **** }; ! static PyMethodChain SndCh_chain = { SndCh_methods, NULL }; ! ! static PyObject *SndCh_getattr(SndChannelObject *self, char *name) ! { ! return Py_FindMethodInChain(&SndCh_chain, (PyObject *)self, name); ! } - #define SndCh_setattr NULL #define SndCh_compare NULL --- 301,306 ---- }; ! #define SndCh_getsetlist NULL #define SndCh_compare NULL *************** *** 325,330 **** (destructor) SndCh_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) SndCh_getattr, /*tp_getattr*/ ! (setattrfunc) SndCh_setattr, /*tp_setattr*/ (cmpfunc) SndCh_compare, /*tp_compare*/ (reprfunc) SndCh_repr, /*tp_repr*/ --- 319,324 ---- (destructor) SndCh_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) SndCh_compare, /*tp_compare*/ (reprfunc) SndCh_repr, /*tp_repr*/ *************** *** 333,336 **** --- 327,347 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) SndCh_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + SndCh_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + SndCh_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 392,441 **** }; ! static PyMethodChain SPBObj_chain = { SPBObj_methods, NULL }; ! static PyObject *SPBObj_getattr(SPBObject *self, char *name) { ! if (strcmp(name, "inRefNum") == 0) ! return Py_BuildValue("l", self->ob_spb.inRefNum); ! else if (strcmp(name, "count") == 0) ! return Py_BuildValue("l", self->ob_spb.count); ! else if (strcmp(name, "milliseconds") == 0) ! return Py_BuildValue("l", self->ob_spb.milliseconds); ! else if (strcmp(name, "error") == 0) ! return Py_BuildValue("h", self->ob_spb.error); ! return Py_FindMethodInChain(&SPBObj_chain, (PyObject *)self, name); } ! static int SPBObj_setattr(SPBObject *self, char *name, PyObject *value) { ! int rv = 0; ! ! if (strcmp(name, "inRefNum") == 0) ! rv = PyArg_Parse(value, "l", &self->ob_spb.inRefNum); ! else if (strcmp(name, "count") == 0) ! rv = PyArg_Parse(value, "l", &self->ob_spb.count); ! else if (strcmp(name, "milliseconds") == 0) ! rv = PyArg_Parse(value, "l", &self->ob_spb.milliseconds); ! else if (strcmp(name, "buffer") == 0) ! rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength); ! else if (strcmp(name, "completionRoutine") == 0) { ! self->ob_spb.completionRoutine = NewSICompletionUPP(SPB_completion); ! self->ob_completion = value; ! Py_INCREF(value); ! rv = 1; ! #if !TARGET_API_MAC_CARBON ! } else if (strcmp(name, "interruptRoutine") == 0) { ! self->ob_spb.completionRoutine = NewSIInterruptUPP(SPB_interrupt); ! self->ob_interrupt = value; ! Py_INCREF(value); ! rv = 1; ! #endif ! } ! if ( rv ) return 0; ! else return -1; } #define SPBObj_compare NULL --- 403,466 ---- }; ! static PyObject *SPBObj_get_inRefNum(SPBObject *self, void *closure) ! { ! return Py_BuildValue("l", self->ob_spb.inRefNum); ! } ! static int SPBObj_set_inRefNum(SPBObject *self, PyObject *v, void *closure) { + return -1 + PyArg_Parse(v, "l", &self->ob_spb.inRefNum); + return 0; + } ! static PyObject *SPBObj_get_count(SPBObject *self, void *closure) ! { ! return Py_BuildValue("l", self->ob_spb.count); } ! static int SPBObj_set_count(SPBObject *self, PyObject *v, void *closure) { + return -1 + PyArg_Parse(v, "l", &self->ob_spb.count); + return 0; + } ! static PyObject *SPBObj_get_milliseconds(SPBObject *self, void *closure) ! { ! return Py_BuildValue("l", self->ob_spb.milliseconds); } + static int SPBObj_set_milliseconds(SPBObject *self, PyObject *v, void *closure) + { + return -1 + PyArg_Parse(v, "l", &self->ob_spb.milliseconds); + return 0; + } + + static PyObject *SPBObj_get_error(SPBObject *self, void *closure) + { + return Py_BuildValue("h", self->ob_spb.error); + } + + #define SPBObj_set_error NULL + + #define SPBObj_get_completionRoutine NULL + + static int SPBObj_set_completionRoutine(SPBObject *self, PyObject *v, void *closure) + { + self->ob_spb.completionRoutine = NewSICompletionUPP(SPB_completion); + self->ob_completion = v; + Py_INCREF(v); + return 0; + return 0; + } + + static PyGetSetDef SPBObj_getsetlist[] = { + {"inRefNum", (getter)SPBObj_get_inRefNum, (setter)SPBObj_set_inRefNum, NULL}, + {"count", (getter)SPBObj_get_count, (setter)SPBObj_set_count, NULL}, + {"milliseconds", (getter)SPBObj_get_milliseconds, (setter)SPBObj_set_milliseconds, NULL}, + {"error", (getter)SPBObj_get_error, (setter)SPBObj_set_error, NULL}, + {"completionRoutine", (getter)SPBObj_get_completionRoutine, (setter)SPBObj_set_completionRoutine, NULL}, + }; + + #define SPBObj_compare NULL *************** *** 453,458 **** (destructor) SPBObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) SPBObj_getattr, /*tp_getattr*/ ! (setattrfunc) SPBObj_setattr, /*tp_setattr*/ (cmpfunc) SPBObj_compare, /*tp_compare*/ (reprfunc) SPBObj_repr, /*tp_repr*/ --- 478,483 ---- (destructor) SPBObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) SPBObj_compare, /*tp_compare*/ (reprfunc) SPBObj_repr, /*tp_repr*/ *************** *** 461,464 **** --- 486,506 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) SPBObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + SPBObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + SPBObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: sndsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/snd/sndsupport.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** sndsupport.py 5 Feb 2002 22:35:36 -0000 1.19 --- sndsupport.py 29 Nov 2002 23:40:47 -0000 1.20 *************** *** 212,216 **** # create the module and object definition and link them ! class SndObjectDefinition(ObjectDefinition): def outputStructMembers(self): --- 212,216 ---- # create the module and object definition and link them ! class SndObjectDefinition(PEP252Mixin, ObjectDefinition): def outputStructMembers(self): *************** *** 238,242 **** # ! class SpbObjectDefinition(ObjectDefinition): def outputStructMembers(self): --- 238,272 ---- # ! class SpbObjectDefinition(PEP252Mixin, ObjectDefinition): ! getsetlist = [ ! ( ! 'inRefNum', ! 'return Py_BuildValue("l", self->ob_spb.inRefNum);', ! 'return -1 + PyArg_Parse(v, "l", &self->ob_spb.inRefNum);', ! None, ! ), ( ! 'count', ! 'return Py_BuildValue("l", self->ob_spb.count);', ! 'return -1 + PyArg_Parse(v, "l", &self->ob_spb.count);', ! None ! ), ( ! 'milliseconds', ! 'return Py_BuildValue("l", self->ob_spb.milliseconds);', ! 'return -1 + PyArg_Parse(v, "l", &self->ob_spb.milliseconds);', ! None, ! ), ( ! 'error', ! 'return Py_BuildValue("h", self->ob_spb.error);', ! None, ! None ! ), ( ! 'completionRoutine', ! None, ! """self->ob_spb.completionRoutine = NewSICompletionUPP(SPB_completion); ! self->ob_completion = v; ! Py_INCREF(v); ! return 0;""", ! None, ! )] def outputStructMembers(self): *************** *** 287,338 **** Output("return 1;") OutRbrace() - - def outputSetattr(self): - Output() - Output("static int %s_setattr(%s *self, char *name, PyObject *value)", - self.prefix, self.objecttype) - OutLbrace() - self.outputSetattrBody() - OutRbrace() - - def outputSetattrBody(self): - Output(""" - int rv = 0; - - if (strcmp(name, "inRefNum") == 0) - rv = PyArg_Parse(value, "l", &self->ob_spb.inRefNum); - else if (strcmp(name, "count") == 0) - rv = PyArg_Parse(value, "l", &self->ob_spb.count); - else if (strcmp(name, "milliseconds") == 0) - rv = PyArg_Parse(value, "l", &self->ob_spb.milliseconds); - else if (strcmp(name, "buffer") == 0) - rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength); - else if (strcmp(name, "completionRoutine") == 0) { - self->ob_spb.completionRoutine = NewSICompletionUPP(SPB_completion); - self->ob_completion = value; - Py_INCREF(value); - rv = 1; - #if !TARGET_API_MAC_CARBON - } else if (strcmp(name, "interruptRoutine") == 0) { - self->ob_spb.completionRoutine = NewSIInterruptUPP(SPB_interrupt); - self->ob_interrupt = value; - Py_INCREF(value); - rv = 1; - #endif - } - if ( rv ) return 0; - else return -1;""") - - def outputGetattrHook(self): - Output(""" - if (strcmp(name, "inRefNum") == 0) - return Py_BuildValue("l", self->ob_spb.inRefNum); - else if (strcmp(name, "count") == 0) - return Py_BuildValue("l", self->ob_spb.count); - else if (strcmp(name, "milliseconds") == 0) - return Py_BuildValue("l", self->ob_spb.milliseconds); - else if (strcmp(name, "error") == 0) - return Py_BuildValue("h", self->ob_spb.error);""") - --- 317,320 ---- From jackjansen@users.sourceforge.net Fri Nov 29 23:40:49 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:40:49 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/res _Resmodule.c,1.14,1.15 ressupport.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/res In directory sc8-pr-cvs1:/tmp/cvs-serv8673/res Modified Files: _Resmodule.c ressupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Resmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/_Resmodule.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** _Resmodule.c 18 Nov 2002 15:26:41 -0000 1.14 --- _Resmodule.c 29 Nov 2002 23:40:47 -0000 1.15 *************** *** 552,603 **** }; ! PyMethodChain ResObj_chain = { ResObj_methods, NULL }; ! ! static PyObject *ResObj_getattr(ResourceObject *self, char *name) { ! if (strcmp(name, "size") == 0) ! return PyInt_FromLong(GetHandleSize(self->ob_itself)); ! if (strcmp(name, "data") == 0) { ! PyObject *res; ! char state; ! state = HGetState(self->ob_itself); ! HLock(self->ob_itself); ! res = PyString_FromStringAndSize( ! *self->ob_itself, ! GetHandleSize(self->ob_itself)); ! HUnlock(self->ob_itself); ! HSetState(self->ob_itself, state); ! return res; ! } ! if (strcmp(name, "__members__") == 0) ! return Py_BuildValue("[ss]", "data", "size"); ! return Py_FindMethodInChain(&ResObj_chain, (PyObject *)self, name); } ! static int ! ResObj_setattr(ResourceObject *self, char *name, PyObject *value) { ! char *data; ! long size; ! ! if (strcmp(name, "data") != 0 || value == NULL ) ! return -1; ! if ( !PyString_Check(value) ) ! return -1; ! size = PyString_Size(value); ! data = PyString_AsString(value); ! /* XXXX Do I need the GetState/SetState calls? */ ! SetHandleSize(self->ob_itself, size); ! if ( MemError()) ! return -1; ! HLock(self->ob_itself); ! memcpy((char *)*self->ob_itself, data, size); ! HUnlock(self->ob_itself); ! /* XXXX Should I do the Changed call immedeately? */ return 0; } #define ResObj_compare NULL --- 552,610 ---- }; ! static PyObject *ResObj_get_data(ResourceObject *self, void *closure) { ! PyObject *res; ! char state; ! state = HGetState(self->ob_itself); ! HLock(self->ob_itself); ! res = PyString_FromStringAndSize( ! *self->ob_itself, ! GetHandleSize(self->ob_itself)); ! HUnlock(self->ob_itself); ! HSetState(self->ob_itself, state); ! return res; ! } ! static int ResObj_set_data(ResourceObject *self, PyObject *v, void *closure) { ! ! char *data; ! long size; ! ! if ( v == NULL ) ! return -1; ! if ( !PyString_Check(v) ) ! return -1; ! size = PyString_Size(v); ! data = PyString_AsString(v); ! /* XXXX Do I need the GetState/SetState calls? */ ! SetHandleSize(self->ob_itself, size); ! if ( MemError()) ! return -1; ! HLock(self->ob_itself); ! memcpy((char *)*self->ob_itself, data, size); ! HUnlock(self->ob_itself); ! /* XXXX Should I do the Changed call immedeately? */ ! return 0; ! return 0; } + static PyObject *ResObj_get_size(ResourceObject *self, void *closure) + { + return PyInt_FromLong(GetHandleSize(self->ob_itself)); + } + + #define ResObj_set_size NULL + + static PyGetSetDef ResObj_getsetlist[] = { + {"data", (getter)ResObj_get_data, (setter)ResObj_set_data, "The resource data"}, + {"size", (getter)ResObj_get_size, (setter)ResObj_set_size, "The length of the resource data"}, + {NULL, NULL, NULL, NULL}, + }; + #define ResObj_compare NULL *************** *** 616,621 **** (destructor) ResObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) ResObj_getattr, /*tp_getattr*/ ! (setattrfunc) ResObj_setattr, /*tp_setattr*/ (cmpfunc) ResObj_compare, /*tp_compare*/ (reprfunc) ResObj_repr, /*tp_repr*/ --- 623,628 ---- (destructor) ResObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) ResObj_compare, /*tp_compare*/ (reprfunc) ResObj_repr, /*tp_repr*/ *************** *** 624,627 **** --- 631,651 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) ResObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + ResObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + ResObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: ressupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/ressupport.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ressupport.py 18 Nov 2002 15:26:42 -0000 1.22 --- ressupport.py 29 Nov 2002 23:40:47 -0000 1.23 *************** *** 101,149 **** module = MacModule('_Res', 'Res', includestuff, finalstuff, initstuff) ! getattrHookCode = """ ! if (strcmp(name, "size") == 0) ! return PyInt_FromLong(GetHandleSize(self->ob_itself)); ! if (strcmp(name, "data") == 0) { ! PyObject *res; ! char state; ! state = HGetState(self->ob_itself); ! HLock(self->ob_itself); ! res = PyString_FromStringAndSize( ! *self->ob_itself, ! GetHandleSize(self->ob_itself)); ! HUnlock(self->ob_itself); ! HSetState(self->ob_itself, state); ! return res; ! } ! if (strcmp(name, "__members__") == 0) ! return Py_BuildValue("[ss]", "data", "size"); ! """ ! setattrCode = """ ! static int ! ResObj_setattr(ResourceObject *self, char *name, PyObject *value) ! { ! char *data; ! long size; ! if (strcmp(name, "data") != 0 || value == NULL ) ! return -1; ! if ( !PyString_Check(value) ) ! return -1; ! size = PyString_Size(value); ! data = PyString_AsString(value); ! /* XXXX Do I need the GetState/SetState calls? */ ! SetHandleSize(self->ob_itself, size); ! if ( MemError()) ! return -1; ! HLock(self->ob_itself); ! memcpy((char *)*self->ob_itself, data, size); ! HUnlock(self->ob_itself); ! /* XXXX Should I do the Changed call immedeately? */ ! return 0; ! } ! """ ! ! class ResDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): --- 101,147 ---- module = MacModule('_Res', 'Res', includestuff, finalstuff, initstuff) ! class ResDefinition(PEP252Mixin, GlobalObjectDefinition): ! getsetlist = [ ! ('data', ! """ ! PyObject *res; ! char state; ! state = HGetState(self->ob_itself); ! HLock(self->ob_itself); ! res = PyString_FromStringAndSize( ! *self->ob_itself, ! GetHandleSize(self->ob_itself)); ! HUnlock(self->ob_itself); ! HSetState(self->ob_itself, state); ! return res; ! """, ! """ ! char *data; ! long size; ! if ( v == NULL ) ! return -1; ! if ( !PyString_Check(v) ) ! return -1; ! size = PyString_Size(v); ! data = PyString_AsString(v); ! /* XXXX Do I need the GetState/SetState calls? */ ! SetHandleSize(self->ob_itself, size); ! if ( MemError()) ! return -1; ! HLock(self->ob_itself); ! memcpy((char *)*self->ob_itself, data, size); ! HUnlock(self->ob_itself); ! /* XXXX Should I do the Changed call immedeately? */ ! return 0; ! """, ! 'The resource data' ! ), ( ! 'size', ! 'return PyInt_FromLong(GetHandleSize(self->ob_itself));', ! None, ! 'The length of the resource data' ! )] def outputCheckNewArg(self): *************** *** 163,172 **** Output("PyErr_Clear();") OutRbrace() - - def outputGetattrHook(self): - Output(getattrHookCode) - - def outputSetattr(self): - Output(setattrCode) def outputStructMembers(self): --- 161,164 ---- From jackjansen@users.sourceforge.net Fri Nov 29 23:40:49 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:40:49 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/qt _Qtmodule.c,1.9,1.10 qtsupport.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qt In directory sc8-pr-cvs1:/tmp/cvs-serv8673/qt Modified Files: _Qtmodule.c qtsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Qtmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qt/_Qtmodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _Qtmodule.c 16 Aug 2002 09:09:30 -0000 1.9 --- _Qtmodule.c 29 Nov 2002 23:40:46 -0000 1.10 *************** *** 1091,1102 **** }; ! PyMethodChain MovieCtlObj_chain = { MovieCtlObj_methods, NULL }; ! ! static PyObject *MovieCtlObj_getattr(MovieControllerObject *self, char *name) ! { ! return Py_FindMethodInChain(&MovieCtlObj_chain, (PyObject *)self, name); ! } ! ! #define MovieCtlObj_setattr NULL #define MovieCtlObj_compare NULL --- 1091,1095 ---- }; ! #define MovieCtlObj_getsetlist NULL #define MovieCtlObj_compare NULL *************** *** 1115,1120 **** (destructor) MovieCtlObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) MovieCtlObj_getattr, /*tp_getattr*/ ! (setattrfunc) MovieCtlObj_setattr, /*tp_setattr*/ (cmpfunc) MovieCtlObj_compare, /*tp_compare*/ (reprfunc) MovieCtlObj_repr, /*tp_repr*/ --- 1108,1113 ---- (destructor) MovieCtlObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) MovieCtlObj_compare, /*tp_compare*/ (reprfunc) MovieCtlObj_repr, /*tp_repr*/ *************** *** 1123,1126 **** --- 1116,1136 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) MovieCtlObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + MovieCtlObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + MovieCtlObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 1542,1553 **** }; ! PyMethodChain TimeBaseObj_chain = { TimeBaseObj_methods, NULL }; ! ! static PyObject *TimeBaseObj_getattr(TimeBaseObject *self, char *name) ! { ! return Py_FindMethodInChain(&TimeBaseObj_chain, (PyObject *)self, name); ! } ! ! #define TimeBaseObj_setattr NULL #define TimeBaseObj_compare NULL --- 1552,1556 ---- }; ! #define TimeBaseObj_getsetlist NULL #define TimeBaseObj_compare NULL *************** *** 1566,1571 **** (destructor) TimeBaseObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) TimeBaseObj_getattr, /*tp_getattr*/ ! (setattrfunc) TimeBaseObj_setattr, /*tp_setattr*/ (cmpfunc) TimeBaseObj_compare, /*tp_compare*/ (reprfunc) TimeBaseObj_repr, /*tp_repr*/ --- 1569,1574 ---- (destructor) TimeBaseObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) TimeBaseObj_compare, /*tp_compare*/ (reprfunc) TimeBaseObj_repr, /*tp_repr*/ *************** *** 1574,1577 **** --- 1577,1597 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) TimeBaseObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + TimeBaseObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + TimeBaseObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 1846,1857 **** }; ! PyMethodChain UserDataObj_chain = { UserDataObj_methods, NULL }; ! ! static PyObject *UserDataObj_getattr(UserDataObject *self, char *name) ! { ! return Py_FindMethodInChain(&UserDataObj_chain, (PyObject *)self, name); ! } ! ! #define UserDataObj_setattr NULL #define UserDataObj_compare NULL --- 1866,1870 ---- }; ! #define UserDataObj_getsetlist NULL #define UserDataObj_compare NULL *************** *** 1870,1875 **** (destructor) UserDataObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) UserDataObj_getattr, /*tp_getattr*/ ! (setattrfunc) UserDataObj_setattr, /*tp_setattr*/ (cmpfunc) UserDataObj_compare, /*tp_compare*/ (reprfunc) UserDataObj_repr, /*tp_repr*/ --- 1883,1888 ---- (destructor) UserDataObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) UserDataObj_compare, /*tp_compare*/ (reprfunc) UserDataObj_repr, /*tp_repr*/ *************** *** 1878,1881 **** --- 1891,1911 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) UserDataObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + UserDataObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + UserDataObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 3021,3032 **** }; ! PyMethodChain MediaObj_chain = { MediaObj_methods, NULL }; ! ! static PyObject *MediaObj_getattr(MediaObject *self, char *name) ! { ! return Py_FindMethodInChain(&MediaObj_chain, (PyObject *)self, name); ! } ! ! #define MediaObj_setattr NULL #define MediaObj_compare NULL --- 3051,3055 ---- }; ! #define MediaObj_getsetlist NULL #define MediaObj_compare NULL *************** *** 3045,3050 **** (destructor) MediaObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) MediaObj_getattr, /*tp_getattr*/ ! (setattrfunc) MediaObj_setattr, /*tp_setattr*/ (cmpfunc) MediaObj_compare, /*tp_compare*/ (reprfunc) MediaObj_repr, /*tp_repr*/ --- 3068,3073 ---- (destructor) MediaObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) MediaObj_compare, /*tp_compare*/ (reprfunc) MediaObj_repr, /*tp_repr*/ *************** *** 3053,3056 **** --- 3076,3096 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) MediaObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + MediaObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + MediaObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 4302,4313 **** }; ! PyMethodChain TrackObj_chain = { TrackObj_methods, NULL }; ! ! static PyObject *TrackObj_getattr(TrackObject *self, char *name) ! { ! return Py_FindMethodInChain(&TrackObj_chain, (PyObject *)self, name); ! } ! ! #define TrackObj_setattr NULL #define TrackObj_compare NULL --- 4342,4346 ---- }; ! #define TrackObj_getsetlist NULL #define TrackObj_compare NULL *************** *** 4326,4331 **** (destructor) TrackObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) TrackObj_getattr, /*tp_getattr*/ ! (setattrfunc) TrackObj_setattr, /*tp_setattr*/ (cmpfunc) TrackObj_compare, /*tp_compare*/ (reprfunc) TrackObj_repr, /*tp_repr*/ --- 4359,4364 ---- (destructor) TrackObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) TrackObj_compare, /*tp_compare*/ (reprfunc) TrackObj_repr, /*tp_repr*/ *************** *** 4334,4337 **** --- 4367,4387 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) TrackObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + TrackObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + TrackObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 6723,6734 **** }; ! PyMethodChain MovieObj_chain = { MovieObj_methods, NULL }; ! ! static PyObject *MovieObj_getattr(MovieObject *self, char *name) ! { ! return Py_FindMethodInChain(&MovieObj_chain, (PyObject *)self, name); ! } ! ! #define MovieObj_setattr NULL #define MovieObj_compare NULL --- 6773,6777 ---- }; ! #define MovieObj_getsetlist NULL #define MovieObj_compare NULL *************** *** 6747,6752 **** (destructor) MovieObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) MovieObj_getattr, /*tp_getattr*/ ! (setattrfunc) MovieObj_setattr, /*tp_setattr*/ (cmpfunc) MovieObj_compare, /*tp_compare*/ (reprfunc) MovieObj_repr, /*tp_repr*/ --- 6790,6795 ---- (destructor) MovieObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) MovieObj_compare, /*tp_compare*/ (reprfunc) MovieObj_repr, /*tp_repr*/ *************** *** 6755,6758 **** --- 6798,6818 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) MovieObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + MovieObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + MovieObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: qtsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qt/qtsupport.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** qtsupport.py 25 Mar 2002 00:31:32 -0000 1.19 --- qtsupport.py 29 Nov 2002 23:40:47 -0000 1.20 *************** *** 182,186 **** dummyStringPtr = FakeType('(StringPtr)0') ! class MovieObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { --- 182,186 ---- dummyStringPtr = FakeType('(StringPtr)0') ! class MovieObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { *************** *** 191,195 **** Output("DisposeMovie(%s);", itselfname) ! class TrackObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { --- 191,195 ---- Output("DisposeMovie(%s);", itselfname) ! class TrackObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { *************** *** 200,204 **** Output("DisposeMovieTrack(%s);", itselfname) ! class MediaObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { --- 200,204 ---- Output("DisposeMovieTrack(%s);", itselfname) ! class MediaObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { *************** *** 209,213 **** Output("DisposeTrackMedia(%s);", itselfname) ! class UserDataObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { --- 209,213 ---- Output("DisposeTrackMedia(%s);", itselfname) ! class UserDataObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { *************** *** 218,222 **** Output("DisposeUserData(%s);", itselfname) ! class TimeBaseObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { --- 218,222 ---- Output("DisposeUserData(%s);", itselfname) ! class TimeBaseObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { *************** *** 227,231 **** ## Output("DisposeTimeBase(%s);", itselfname) ! class MovieCtlObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { --- 227,231 ---- ## Output("DisposeTimeBase(%s);", itselfname) ! class MovieCtlObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { From jackjansen@users.sourceforge.net Fri Nov 29 23:40:48 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:40:48 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/qdoffs _Qdoffsmodule.c,1.9,1.10 qdoffssupport.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qdoffs In directory sc8-pr-cvs1:/tmp/cvs-serv8673/qdoffs Modified Files: _Qdoffsmodule.c qdoffssupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Qdoffsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qdoffs/_Qdoffsmodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _Qdoffsmodule.c 16 Aug 2002 09:09:30 -0000 1.9 --- _Qdoffsmodule.c 29 Nov 2002 23:40:46 -0000 1.10 *************** *** 132,143 **** }; ! PyMethodChain GWorldObj_chain = { GWorldObj_methods, NULL }; ! ! static PyObject *GWorldObj_getattr(GWorldObject *self, char *name) ! { ! return Py_FindMethodInChain(&GWorldObj_chain, (PyObject *)self, name); ! } ! ! #define GWorldObj_setattr NULL #define GWorldObj_compare NULL --- 132,136 ---- }; ! #define GWorldObj_getsetlist NULL #define GWorldObj_compare NULL *************** *** 156,161 **** (destructor) GWorldObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) GWorldObj_getattr, /*tp_getattr*/ ! (setattrfunc) GWorldObj_setattr, /*tp_setattr*/ (cmpfunc) GWorldObj_compare, /*tp_compare*/ (reprfunc) GWorldObj_repr, /*tp_repr*/ --- 149,154 ---- (destructor) GWorldObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) GWorldObj_compare, /*tp_compare*/ (reprfunc) GWorldObj_repr, /*tp_repr*/ *************** *** 164,167 **** --- 157,177 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) GWorldObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + GWorldObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + GWorldObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: qdoffssupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qdoffs/qdoffssupport.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** qdoffssupport.py 25 Mar 2002 00:31:38 -0000 1.8 --- qdoffssupport.py 29 Nov 2002 23:40:46 -0000 1.9 *************** *** 58,62 **** """ ! class MyObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") --- 58,62 ---- """ ! class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") From jackjansen@users.sourceforge.net Fri Nov 29 23:40:49 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:40:49 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/te _TEmodule.c,1.10,1.11 tesupport.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/te In directory sc8-pr-cvs1:/tmp/cvs-serv8673/te Modified Files: _TEmodule.c tesupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _TEmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/te/_TEmodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** _TEmodule.c 16 Aug 2002 09:09:31 -0000 1.10 --- _TEmodule.c 29 Nov 2002 23:40:47 -0000 1.11 *************** *** 851,900 **** }; ! PyMethodChain TEObj_chain = { TEObj_methods, NULL }; ! static PyObject *TEObj_getattr(TEObject *self, char *name) { ! if( strcmp(name, "destRect") == 0 ) ! return Py_BuildValue("O&", PyMac_BuildRect, ! &(*self->ob_itself)->destRect); ! if( strcmp(name, "viewRect") == 0 ) ! return Py_BuildValue("O&", PyMac_BuildRect, ! &(*self->ob_itself)->viewRect); ! if( strcmp(name, "selRect") == 0 ) ! return Py_BuildValue("O&", PyMac_BuildRect, ! &(*self->ob_itself)->selRect); ! if( strcmp(name, "lineHeight") == 0 ) ! return Py_BuildValue("h", (*self->ob_itself)->lineHeight); ! if( strcmp(name, "fontAscent") == 0 ) ! return Py_BuildValue("h", (*self->ob_itself)->fontAscent); ! if( strcmp(name, "selPoint") == 0 ) ! return Py_BuildValue("O&", PyMac_BuildPoint, ! (*self->ob_itself)->selPoint); ! if( strcmp(name, "selStart") == 0 ) ! return Py_BuildValue("h", (*self->ob_itself)->selStart); ! if( strcmp(name, "selEnd") == 0 ) ! return Py_BuildValue("h", (*self->ob_itself)->selEnd); ! if( strcmp(name, "active") == 0 ) ! return Py_BuildValue("h", (*self->ob_itself)->active); ! if( strcmp(name, "just") == 0 ) ! return Py_BuildValue("h", (*self->ob_itself)->just); ! if( strcmp(name, "teLength") == 0 ) ! return Py_BuildValue("h", (*self->ob_itself)->teLength); ! if( strcmp(name, "txFont") == 0 ) ! return Py_BuildValue("h", (*self->ob_itself)->txFont); ! if( strcmp(name, "txFace") == 0 ) ! return Py_BuildValue("h", (*self->ob_itself)->txFace); ! if( strcmp(name, "txMode") == 0 ) ! return Py_BuildValue("h", (*self->ob_itself)->txMode); ! if( strcmp(name, "txSize") == 0 ) ! return Py_BuildValue("h", (*self->ob_itself)->txSize); ! if( strcmp(name, "nLines") == 0 ) ! return Py_BuildValue("h", (*self->ob_itself)->nLines); ! ! return Py_FindMethodInChain(&TEObj_chain, (PyObject *)self, name); } ! #define TEObj_setattr NULL #define TEObj_compare NULL --- 851,985 ---- }; ! static PyObject *TEObj_get_destRect(TEObject *self, void *closure) ! { ! return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->destRect); ! } ! #define TEObj_set_destRect NULL ! ! static PyObject *TEObj_get_viewRect(TEObject *self, void *closure) { + return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->viewRect); + } ! #define TEObj_set_viewRect NULL ! ! static PyObject *TEObj_get_selRect(TEObject *self, void *closure) ! { ! return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->selRect); } ! #define TEObj_set_selRect NULL ! ! static PyObject *TEObj_get_lineHeight(TEObject *self, void *closure) ! { ! return Py_BuildValue("h", (*self->ob_itself)->lineHeight); ! } ! ! #define TEObj_set_lineHeight NULL ! ! static PyObject *TEObj_get_fontAscent(TEObject *self, void *closure) ! { ! return Py_BuildValue("h", (*self->ob_itself)->fontAscent); ! } ! ! #define TEObj_set_fontAscent NULL ! ! static PyObject *TEObj_get_selPoint(TEObject *self, void *closure) ! { ! return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->selPoint); ! } ! ! #define TEObj_set_selPoint NULL ! ! static PyObject *TEObj_get_selStart(TEObject *self, void *closure) ! { ! return Py_BuildValue("h", (*self->ob_itself)->selStart); ! } ! ! #define TEObj_set_selStart NULL ! ! static PyObject *TEObj_get_selEnd(TEObject *self, void *closure) ! { ! return Py_BuildValue("h", (*self->ob_itself)->selEnd); ! } ! ! #define TEObj_set_selEnd NULL ! ! static PyObject *TEObj_get_active(TEObject *self, void *closure) ! { ! return Py_BuildValue("h", (*self->ob_itself)->active); ! } ! ! #define TEObj_set_active NULL ! ! static PyObject *TEObj_get_just(TEObject *self, void *closure) ! { ! return Py_BuildValue("h", (*self->ob_itself)->just); ! } ! ! #define TEObj_set_just NULL ! ! static PyObject *TEObj_get_teLength(TEObject *self, void *closure) ! { ! return Py_BuildValue("h", (*self->ob_itself)->teLength); ! } ! ! #define TEObj_set_teLength NULL ! ! static PyObject *TEObj_get_txFont(TEObject *self, void *closure) ! { ! return Py_BuildValue("h", (*self->ob_itself)->txFont); ! } ! ! #define TEObj_set_txFont NULL ! ! static PyObject *TEObj_get_txFace(TEObject *self, void *closure) ! { ! return Py_BuildValue("h", (*self->ob_itself)->txFace); ! } ! ! #define TEObj_set_txFace NULL ! ! static PyObject *TEObj_get_txMode(TEObject *self, void *closure) ! { ! return Py_BuildValue("h", (*self->ob_itself)->txMode); ! } ! ! #define TEObj_set_txMode NULL ! ! static PyObject *TEObj_get_txSize(TEObject *self, void *closure) ! { ! return Py_BuildValue("h", (*self->ob_itself)->txSize); ! } ! ! #define TEObj_set_txSize NULL ! ! static PyObject *TEObj_get_nLines(TEObject *self, void *closure) ! { ! return Py_BuildValue("h", (*self->ob_itself)->nLines); ! } ! ! #define TEObj_set_nLines NULL ! ! static PyGetSetDef TEObj_getsetlist[] = { ! {"destRect", (getter)TEObj_get_destRect, (setter)TEObj_set_destRect, "Destination rectangle"}, ! {"viewRect", (getter)TEObj_get_viewRect, (setter)TEObj_set_viewRect, "Viewing rectangle"}, ! {"selRect", (getter)TEObj_get_selRect, (setter)TEObj_set_selRect, "Selection rectangle"}, ! {"lineHeight", (getter)TEObj_get_lineHeight, (setter)TEObj_set_lineHeight, "Height of a line"}, ! {"fontAscent", (getter)TEObj_get_fontAscent, (setter)TEObj_set_fontAscent, "Ascent of a line"}, ! {"selPoint", (getter)TEObj_get_selPoint, (setter)TEObj_set_selPoint, "Selection Point"}, ! {"selStart", (getter)TEObj_get_selStart, (setter)TEObj_set_selStart, "Start of selection"}, ! {"selEnd", (getter)TEObj_get_selEnd, (setter)TEObj_set_selEnd, "End of selection"}, ! {"active", (getter)TEObj_get_active, (setter)TEObj_set_active, "TBD"}, ! {"just", (getter)TEObj_get_just, (setter)TEObj_set_just, "Justification"}, ! {"teLength", (getter)TEObj_get_teLength, (setter)TEObj_set_teLength, "TBD"}, ! {"txFont", (getter)TEObj_get_txFont, (setter)TEObj_set_txFont, "Current font"}, ! {"txFace", (getter)TEObj_get_txFace, (setter)TEObj_set_txFace, "Current font variant"}, ! {"txMode", (getter)TEObj_get_txMode, (setter)TEObj_set_txMode, "Current text-drawing mode"}, ! {"txSize", (getter)TEObj_get_txSize, (setter)TEObj_set_txSize, "Current font size"}, ! {"nLines", (getter)TEObj_get_nLines, (setter)TEObj_set_nLines, "TBD"}, ! }; ! #define TEObj_compare NULL *************** *** 913,918 **** (destructor) TEObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) TEObj_getattr, /*tp_getattr*/ ! (setattrfunc) TEObj_setattr, /*tp_setattr*/ (cmpfunc) TEObj_compare, /*tp_compare*/ (reprfunc) TEObj_repr, /*tp_repr*/ --- 998,1003 ---- (destructor) TEObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) TEObj_compare, /*tp_compare*/ (reprfunc) TEObj_repr, /*tp_repr*/ *************** *** 921,924 **** --- 1006,1026 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) TEObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + TEObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + TEObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: tesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/te/tesupport.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tesupport.py 25 Mar 2002 00:31:27 -0000 1.10 --- tesupport.py 29 Nov 2002 23:40:47 -0000 1.11 *************** *** 94,98 **** ! class MyObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { --- 94,182 ---- ! class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition): ! # Attributes that can be set. ! getsetlist = [ ! ( ! 'destRect', ! 'return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->destRect);', ! None, ! 'Destination rectangle' ! ), ( ! 'viewRect', ! 'return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->viewRect);', ! None, ! 'Viewing rectangle' ! ), ( ! 'selRect', ! 'return Py_BuildValue("O&", PyMac_BuildRect, &(*self->ob_itself)->selRect);', ! None, ! 'Selection rectangle' ! ), ( ! 'lineHeight', ! 'return Py_BuildValue("h", (*self->ob_itself)->lineHeight);', ! None, ! 'Height of a line' ! ), ( ! 'fontAscent', ! 'return Py_BuildValue("h", (*self->ob_itself)->fontAscent);', ! None, ! 'Ascent of a line' ! ), ( ! "selPoint", ! 'return Py_BuildValue("O&", PyMac_BuildPoint, (*self->ob_itself)->selPoint);', ! None, ! 'Selection Point' ! ), ( ! 'selStart', ! 'return Py_BuildValue("h", (*self->ob_itself)->selStart);', ! None, ! 'Start of selection' ! ), ( ! 'selEnd', ! 'return Py_BuildValue("h", (*self->ob_itself)->selEnd);', ! None, ! 'End of selection' ! ), ( ! 'active', ! 'return Py_BuildValue("h", (*self->ob_itself)->active);', ! None, ! 'TBD' ! ), ( ! 'just', ! 'return Py_BuildValue("h", (*self->ob_itself)->just);', ! None, ! 'Justification' ! ), ( ! 'teLength', ! 'return Py_BuildValue("h", (*self->ob_itself)->teLength);', ! None, ! 'TBD' ! ), ( ! 'txFont', ! 'return Py_BuildValue("h", (*self->ob_itself)->txFont);', ! None, ! 'Current font' ! ), ( ! 'txFace', ! 'return Py_BuildValue("h", (*self->ob_itself)->txFace);', ! None, ! 'Current font variant' ! ), ( ! 'txMode', ! 'return Py_BuildValue("h", (*self->ob_itself)->txMode);', ! None, ! 'Current text-drawing mode' ! ), ( ! 'txSize', ! 'return Py_BuildValue("h", (*self->ob_itself)->txSize);', ! None, ! 'Current font size' ! ), ( ! 'nLines', ! 'return Py_BuildValue("h", (*self->ob_itself)->nLines);', ! None, ! 'TBD' ! )] ! def outputCheckNewArg(self): Output("""if (itself == NULL) { *************** *** 103,145 **** Output("TEDispose(%s);", itselfname) - def outputGetattrHook(self): - Output(""" - if( strcmp(name, "destRect") == 0 ) - return Py_BuildValue("O&", PyMac_BuildRect, - &(*self->ob_itself)->destRect); - if( strcmp(name, "viewRect") == 0 ) - return Py_BuildValue("O&", PyMac_BuildRect, - &(*self->ob_itself)->viewRect); - if( strcmp(name, "selRect") == 0 ) - return Py_BuildValue("O&", PyMac_BuildRect, - &(*self->ob_itself)->selRect); - if( strcmp(name, "lineHeight") == 0 ) - return Py_BuildValue("h", (*self->ob_itself)->lineHeight); - if( strcmp(name, "fontAscent") == 0 ) - return Py_BuildValue("h", (*self->ob_itself)->fontAscent); - if( strcmp(name, "selPoint") == 0 ) - return Py_BuildValue("O&", PyMac_BuildPoint, - (*self->ob_itself)->selPoint); - if( strcmp(name, "selStart") == 0 ) - return Py_BuildValue("h", (*self->ob_itself)->selStart); - if( strcmp(name, "selEnd") == 0 ) - return Py_BuildValue("h", (*self->ob_itself)->selEnd); - if( strcmp(name, "active") == 0 ) - return Py_BuildValue("h", (*self->ob_itself)->active); - if( strcmp(name, "just") == 0 ) - return Py_BuildValue("h", (*self->ob_itself)->just); - if( strcmp(name, "teLength") == 0 ) - return Py_BuildValue("h", (*self->ob_itself)->teLength); - if( strcmp(name, "txFont") == 0 ) - return Py_BuildValue("h", (*self->ob_itself)->txFont); - if( strcmp(name, "txFace") == 0 ) - return Py_BuildValue("h", (*self->ob_itself)->txFace); - if( strcmp(name, "txMode") == 0 ) - return Py_BuildValue("h", (*self->ob_itself)->txMode); - if( strcmp(name, "txSize") == 0 ) - return Py_BuildValue("h", (*self->ob_itself)->txSize); - if( strcmp(name, "nLines") == 0 ) - return Py_BuildValue("h", (*self->ob_itself)->nLines); - """) # From here on it's basically all boiler plate... --- 187,190 ---- From jackjansen@users.sourceforge.net Fri Nov 29 23:40:48 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:40:48 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/qd _Qdmodule.c,1.11,1.12 qdscan.py,1.27,1.28 qdsupport.py,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qd In directory sc8-pr-cvs1:/tmp/cvs-serv8673/qd Modified Files: _Qdmodule.c qdscan.py qdsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Qdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/_Qdmodule.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _Qdmodule.c 16 Aug 2002 09:09:29 -0000 1.11 --- _Qdmodule.c 29 Nov 2002 23:40:44 -0000 1.12 *************** *** 206,369 **** } static PyMethodDef GrafObj_methods[] = { {NULL, NULL, 0} }; ! PyMethodChain GrafObj_chain = { GrafObj_methods, NULL }; ! ! static PyObject *GrafObj_getattr(GrafPortObject *self, char *name) { [...2392 lines suppressed...] *** 7173,7190 **** if (PyDict_SetItemString(d, "BitMapType", (PyObject *)&BitMap_Type) != 0) Py_FatalError("can't initialize BitMapType"); - QDGlobalsAccess_Type.ob_type = &PyType_Type; - Py_INCREF(&QDGlobalsAccess_Type); - if (PyDict_SetItemString(d, "QDGlobalsAccessType", (PyObject *)&QDGlobalsAccess_Type) != 0) - Py_FatalError("can't initialize QDGlobalsAccessType"); - - { - PyObject *o; - - o = QDGA_New(); - if (o == NULL || PyDict_SetItemString(d, "qd", o) != 0) - return; - } - - } --- 6879,6882 ---- Index: qdscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/qdscan.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** qdscan.py 15 Aug 2002 21:48:15 -0000 1.27 --- qdscan.py 29 Nov 2002 23:40:46 -0000 1.28 *************** *** 54,57 **** --- 54,63 ---- if arglist: t, n, m = arglist[0] + if t in ('GrafPtr', 'CGrafPtr') and m == 'InMode': + classname = "Method" + listname = "gr_methods" + elif t == 'BitMapPtr' and m == 'InMode': + classname = "Method" + listname = "bm_methods" ## elif t == "PolyHandle" and m == "InMode": ## classname = "Method" Index: qdsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/qdsupport.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** qdsupport.py 5 Aug 2002 15:36:57 -0000 1.39 --- qdsupport.py 29 Nov 2002 23:40:46 -0000 1.40 *************** *** 212,224 **** """ ! variablestuff = """ ! { ! PyObject *o; ! ! o = QDGA_New(); ! if (o == NULL || PyDict_SetItemString(d, "qd", o) != 0) ! return; ! } ! """ initstuff = initstuff + """ --- 212,216 ---- """ ! variablestuff = "" initstuff = initstuff + """ *************** *** 245,249 **** ## Output("KillPoly(%s);", itselfname) ! class MyGRObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") --- 237,256 ---- ## Output("KillPoly(%s);", itselfname) ! class MyGRObjectDefinition(PEP252Mixin, GlobalObjectDefinition): ! getsetlist = [ ! ('visRgn', ! """RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */ ! return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(self->ob_itself, h)); ! """, ! None, ! "Convenience attribute: return a copy of the visible region" ! ), ( ! 'clipRgn', ! """RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */ ! return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(self->ob_itself, h)); ! """, ! None, ! "Convenience attribute: return a copy of the clipping region" ! )] def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") *************** *** 270,424 **** OutRbrace() Output("#endif") - def outputGetattrHook(self): - Output("#if !ACCESSOR_CALLS_ARE_FUNCTIONS") - Output(""" - { CGrafPtr itself_color = (CGrafPtr)self->ob_itself; - - if ( strcmp(name, "data") == 0 ) - return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(GrafPort)); - - if ( (itself_color->portVersion&0xc000) == 0xc000 ) { - /* Color-only attributes */ - - if ( strcmp(name, "portBits") == 0 ) - /* XXXX Do we need HLock() stuff here?? */ - return BMObj_New((BitMapPtr)*itself_color->portPixMap); - if ( strcmp(name, "grafVars") == 0 ) - return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->visRgn); - if ( strcmp(name, "chExtra") == 0 ) - return Py_BuildValue("h", itself_color->chExtra); - if ( strcmp(name, "pnLocHFrac") == 0 ) - return Py_BuildValue("h", itself_color->pnLocHFrac); - if ( strcmp(name, "bkPixPat") == 0 ) - return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->bkPixPat); - if ( strcmp(name, "rgbFgColor") == 0 ) - return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbFgColor); - if ( strcmp(name, "rgbBkColor") == 0 ) - return Py_BuildValue("O&", QdRGB_New, &itself_color->rgbBkColor); - if ( strcmp(name, "pnPixPat") == 0 ) - return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->pnPixPat); - if ( strcmp(name, "fillPixPat") == 0 ) - return Py_BuildValue("O&", ResObj_New, (Handle)itself_color->fillPixPat); - } else { - /* Mono-only attributes */ - if ( strcmp(name, "portBits") == 0 ) - return BMObj_New(&self->ob_itself->portBits); - if ( strcmp(name, "bkPat") == 0 ) - return Py_BuildValue("s#", (char *)&self->ob_itself->bkPat, sizeof(Pattern)); - if ( strcmp(name, "fillPat") == 0 ) - return Py_BuildValue("s#", (char *)&self->ob_itself->fillPat, sizeof(Pattern)); - if ( strcmp(name, "pnPat") == 0 ) - return Py_BuildValue("s#", (char *)&self->ob_itself->pnPat, sizeof(Pattern)); - } - /* - ** Accessible for both color/mono windows. - ** portVersion is really color-only, but we put it here - ** for convenience - */ - if ( strcmp(name, "portVersion") == 0 ) - return Py_BuildValue("h", itself_color->portVersion); - if ( strcmp(name, "device") == 0 ) - return PyInt_FromLong((long)self->ob_itself->device); - if ( strcmp(name, "portRect") == 0 ) - return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->portRect); - if ( strcmp(name, "visRgn") == 0 ) - return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->visRgn); - if ( strcmp(name, "clipRgn") == 0 ) - return Py_BuildValue("O&", ResObj_New, (Handle)self->ob_itself->clipRgn); - if ( strcmp(name, "pnLoc") == 0 ) - return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnLoc); - if ( strcmp(name, "pnSize") == 0 ) - return Py_BuildValue("O&", PyMac_BuildPoint, self->ob_itself->pnSize); - if ( strcmp(name, "pnMode") == 0 ) - return Py_BuildValue("h", self->ob_itself->pnMode); - if ( strcmp(name, "pnVis") == 0 ) - return Py_BuildValue("h", self->ob_itself->pnVis); - if ( strcmp(name, "txFont") == 0 ) - return Py_BuildValue("h", self->ob_itself->txFont); - if ( strcmp(name, "txFace") == 0 ) - return Py_BuildValue("h", (short)self->ob_itself->txFace); - if ( strcmp(name, "txMode") == 0 ) - return Py_BuildValue("h", self->ob_itself->txMode); - if ( strcmp(name, "txSize") == 0 ) - return Py_BuildValue("h", self->ob_itself->txSize); - if ( strcmp(name, "spExtra") == 0 ) - return Py_BuildValue("O&", PyMac_BuildFixed, self->ob_itself->spExtra); - /* XXXX Add more, as needed */ - /* This one is so we can compare grafports: */ - if ( strcmp(name, "_id") == 0 ) - return Py_BuildValue("l", (long)self->ob_itself); - }""") - Output("#else") - Output(""" - { CGrafPtr itself_color = (CGrafPtr)self->ob_itself; - if ( strcmp(name, "portBits") == 0 ) - return BMObj_New((BitMapPtr)GetPortBitMapForCopyBits(itself_color)); - if ( strcmp(name, "chExtra") == 0 ) - return Py_BuildValue("h", GetPortChExtra(itself_color)); - if ( strcmp(name, "pnLocHFrac") == 0 ) - return Py_BuildValue("h", GetPortFracHPenLocation(itself_color)); - if ( strcmp(name, "bkPixPat") == 0 ) { - PixPatHandle h=0; - return Py_BuildValue("O&", ResObj_New, (Handle)GetPortBackPixPat(itself_color, h)); - } - if ( strcmp(name, "rgbFgColor") == 0 ) { - RGBColor c; - return Py_BuildValue("O&", QdRGB_New, GetPortForeColor(itself_color, &c)); - } - if ( strcmp(name, "rgbBkColor") == 0 ) { - RGBColor c; - return Py_BuildValue("O&", QdRGB_New, GetPortBackColor(itself_color, &c)); - } - if ( strcmp(name, "pnPixPat") == 0 ) { - PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */ - - return Py_BuildValue("O&", ResObj_New, (Handle)GetPortPenPixPat(itself_color, h)); - } - if ( strcmp(name, "fillPixPat") == 0 ) { - PixPatHandle h=NewPixPat(); /* XXXX wrong dispose routine */ - return Py_BuildValue("O&", ResObj_New, (Handle)GetPortFillPixPat(itself_color, h)); - } - if ( strcmp(name, "portRect") == 0 ) { - Rect r; - return Py_BuildValue("O&", PyMac_BuildRect, GetPortBounds(itself_color, &r)); - } - if ( strcmp(name, "visRgn") == 0 ) { - RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */ - return Py_BuildValue("O&", ResObj_New, (Handle)GetPortVisibleRegion(itself_color, h)); - } - if ( strcmp(name, "clipRgn") == 0 ) { - RgnHandle h=NewRgn(); /* XXXX wrong dispose routine */ - return Py_BuildValue("O&", ResObj_New, (Handle)GetPortClipRegion(itself_color, h)); - } - if ( strcmp(name, "pnLoc") == 0 ) { - Point p; - return Py_BuildValue("O&", PyMac_BuildPoint, *GetPortPenLocation(itself_color, &p)); - } - if ( strcmp(name, "pnSize") == 0 ) { - Point p; - return Py_BuildValue("O&", PyMac_BuildPoint, *GetPortPenSize(itself_color, &p)); - } - if ( strcmp(name, "pnMode") == 0 ) - return Py_BuildValue("h", GetPortPenMode(itself_color)); - if ( strcmp(name, "pnVis") == 0 ) - return Py_BuildValue("h", GetPortPenVisibility(itself_color)); - if ( strcmp(name, "txFont") == 0 ) - return Py_BuildValue("h", GetPortTextFont(itself_color)); - if ( strcmp(name, "txFace") == 0 ) - return Py_BuildValue("h", (short)GetPortTextFace(itself_color)); - if ( strcmp(name, "txMode") == 0 ) - return Py_BuildValue("h", GetPortTextMode(itself_color)); - if ( strcmp(name, "txSize") == 0 ) - return Py_BuildValue("h", GetPortTextSize(itself_color)); - if ( strcmp(name, "spExtra") == 0 ) - return Py_BuildValue("O&", PyMac_BuildFixed, GetPortSpExtra(itself_color)); - /* XXXX Add more, as needed */ - /* This one is so we can compare grafports: */ - if ( strcmp(name, "_id") == 0 ) - return Py_BuildValue("l", (long)self->ob_itself); - }""") - Output("#endif") ! class MyBMObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") --- 277,309 ---- OutRbrace() Output("#endif") ! class MyBMObjectDefinition(PEP252Mixin, GlobalObjectDefinition): ! getsetlist = [ ! ( ! 'baseAddr', ! 'return PyInt_FromLong((long)self->ob_itself->baseAddr);', ! None, ! None ! ), ( ! 'rowBytes', ! 'return PyInt_FromLong((long)self->ob_itself->rowBytes);', ! None, ! None ! ), ( ! 'bounds', ! 'return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds);', ! None, ! None ! ), ( ! 'bitmap_data', ! 'return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap));', ! None, ! None ! ), ( ! 'pixmap_data', ! 'return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap));', ! None, ! None ! )] def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") *************** *** 435,536 **** def outputCleanupStructMembers(self): Output("Py_XDECREF(self->referred_object);") ! Output("if (self->referred_bitmap) free(self->referred_bitmap);") ! def outputGetattrHook(self): ! Output("""if ( strcmp(name, "baseAddr") == 0 ) ! return PyInt_FromLong((long)self->ob_itself->baseAddr); ! if ( strcmp(name, "rowBytes") == 0 ) ! return PyInt_FromLong((long)self->ob_itself->rowBytes); ! if ( strcmp(name, "bounds") == 0 ) ! return Py_BuildValue("O&", PyMac_BuildRect, &self->ob_itself->bounds); ! /* XXXX Add more, as needed */ ! if ( strcmp(name, "bitmap_data") == 0 ) ! return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap)); ! if ( strcmp(name, "pixmap_data") == 0 ) ! return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap)); ! """) ! ! # This object is instanciated once, and will access qd globals. ! class QDGlobalsAccessObjectDefinition(ObjectDefinition): ! def outputStructMembers(self): ! pass ! def outputNew(self): ! Output() ! Output("%sPyObject *%s_New(void)", self.static, self.prefix) ! OutLbrace() ! Output("%s *it;", self.objecttype) ! Output("it = PyObject_NEW(%s, &%s);", self.objecttype, self.typename) ! Output("if (it == NULL) return NULL;") ! Output("return (PyObject *)it;") ! OutRbrace() ! def outputConvert(self): ! pass ! def outputCleanupStructMembers(self): ! pass ! ! def outputGetattrHook(self): ! Output("#if !ACCESSOR_CALLS_ARE_FUNCTIONS") ! Output(""" ! if ( strcmp(name, "arrow") == 0 ) ! return PyString_FromStringAndSize((char *)&qd.arrow, sizeof(qd.arrow)); ! if ( strcmp(name, "black") == 0 ) ! return PyString_FromStringAndSize((char *)&qd.black, sizeof(qd.black)); ! if ( strcmp(name, "white") == 0 ) ! return PyString_FromStringAndSize((char *)&qd.white, sizeof(qd.white)); ! if ( strcmp(name, "gray") == 0 ) ! return PyString_FromStringAndSize((char *)&qd.gray, sizeof(qd.gray)); ! if ( strcmp(name, "ltGray") == 0 ) ! return PyString_FromStringAndSize((char *)&qd.ltGray, sizeof(qd.ltGray)); ! if ( strcmp(name, "dkGray") == 0 ) ! return PyString_FromStringAndSize((char *)&qd.dkGray, sizeof(qd.dkGray)); ! if ( strcmp(name, "screenBits") == 0 ) ! return BMObj_New(&qd.screenBits); ! if ( strcmp(name, "thePort") == 0 ) ! return GrafObj_New(qd.thePort); ! if ( strcmp(name, "randSeed") == 0 ) ! return Py_BuildValue("l", &qd.randSeed); ! """) ! Output("#else") ! Output(""" ! if ( strcmp(name, "arrow") == 0 ) { ! Cursor rv; ! GetQDGlobalsArrow(&rv); ! return PyString_FromStringAndSize((char *)&rv, sizeof(rv)); ! } ! if ( strcmp(name, "black") == 0 ) { ! Pattern rv; ! GetQDGlobalsBlack(&rv); ! return PyString_FromStringAndSize((char *)&rv, sizeof(rv)); ! } ! if ( strcmp(name, "white") == 0 ) { ! Pattern rv; ! GetQDGlobalsWhite(&rv); ! return PyString_FromStringAndSize((char *)&rv, sizeof(rv)); ! } ! if ( strcmp(name, "gray") == 0 ) { ! Pattern rv; ! GetQDGlobalsGray(&rv); ! return PyString_FromStringAndSize((char *)&rv, sizeof(rv)); ! } ! if ( strcmp(name, "ltGray") == 0 ) { ! Pattern rv; ! GetQDGlobalsLightGray(&rv); ! return PyString_FromStringAndSize((char *)&rv, sizeof(rv)); ! } ! if ( strcmp(name, "dkGray") == 0 ) { ! Pattern rv; ! GetQDGlobalsDarkGray(&rv); ! return PyString_FromStringAndSize((char *)&rv, sizeof(rv)); ! } ! if ( strcmp(name, "screenBits") == 0 ) { ! BitMap rv; ! GetQDGlobalsScreenBits(&rv); ! return BMObj_NewCopied(&rv); ! } ! if ( strcmp(name, "thePort") == 0 ) ! return GrafObj_New(GetQDGlobalsThePort()); ! if ( strcmp(name, "randSeed") == 0 ) ! return Py_BuildValue("l", GetQDGlobalsRandomSeed()); ! """) ! Output("#endif") # Create the generator groups and link them --- 320,324 ---- def outputCleanupStructMembers(self): Output("Py_XDECREF(self->referred_object);") ! Output("if (self->referred_bitmap) free(self->referred_bitmap);") # Create the generator groups and link them *************** *** 544,549 **** bm_object = MyBMObjectDefinition("BitMap", "BMObj", "BitMapPtr") module.addobject(bm_object) - qd_object = QDGlobalsAccessObjectDefinition("QDGlobalsAccess", "QDGA", "XXXX") - module.addobject(qd_object) --- 332,335 ---- *************** *** 554,558 **** # Create and populate the lists functions = [] ! methods = [] execfile(INPUTFILE) execfile(EXTRAFILE) --- 340,346 ---- # Create and populate the lists functions = [] ! gr_methods = [] ! bm_methods = [] ! #methods = [] execfile(INPUTFILE) execfile(EXTRAFILE) *************** *** 561,566 **** # (in a different wordl the scan program would generate this) for f in functions: module.add(f) ! ##for f in r_methods: r_object.add(f) ! ##for f in po_methods: po_object.add(f) # Manual generator: get data out of a bitmap --- 349,354 ---- # (in a different wordl the scan program would generate this) for f in functions: module.add(f) ! for f in gr_methods: gr_object.add(f) ! for f in bm_methods: bm_object.add(f) # Manual generator: get data out of a bitmap From jackjansen@users.sourceforge.net Fri Nov 29 23:41:16 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:41:16 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/mlte _Mltemodule.c,1.12,1.13 mltesupport.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/mlte In directory sc8-pr-cvs1:/tmp/cvs-serv8673/mlte Modified Files: _Mltemodule.c mltesupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Mltemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/_Mltemodule.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** _Mltemodule.c 22 Aug 2002 23:30:48 -0000 1.12 --- _Mltemodule.c 29 Nov 2002 23:40:44 -0000 1.13 *************** *** 1296,1307 **** }; ! PyMethodChain TXNObj_chain = { TXNObj_methods, NULL }; ! ! static PyObject *TXNObj_getattr(TXNObjectObject *self, char *name) ! { ! return Py_FindMethodInChain(&TXNObj_chain, (PyObject *)self, name); ! } ! ! #define TXNObj_setattr NULL #define TXNObj_compare NULL --- 1296,1300 ---- }; ! #define TXNObj_getsetlist NULL #define TXNObj_compare NULL *************** *** 1320,1325 **** (destructor) TXNObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) TXNObj_getattr, /*tp_getattr*/ ! (setattrfunc) TXNObj_setattr, /*tp_setattr*/ (cmpfunc) TXNObj_compare, /*tp_compare*/ (reprfunc) TXNObj_repr, /*tp_repr*/ --- 1313,1318 ---- (destructor) TXNObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) TXNObj_compare, /*tp_compare*/ (reprfunc) TXNObj_repr, /*tp_repr*/ *************** *** 1328,1331 **** --- 1321,1341 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) TXNObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + TXNObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + TXNObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 1412,1423 **** }; ! PyMethodChain TXNFontMenuObj_chain = { TXNFontMenuObj_methods, NULL }; ! ! static PyObject *TXNFontMenuObj_getattr(TXNFontMenuObjectObject *self, char *name) ! { ! return Py_FindMethodInChain(&TXNFontMenuObj_chain, (PyObject *)self, name); ! } ! ! #define TXNFontMenuObj_setattr NULL #define TXNFontMenuObj_compare NULL --- 1422,1426 ---- }; ! #define TXNFontMenuObj_getsetlist NULL #define TXNFontMenuObj_compare NULL *************** *** 1436,1441 **** (destructor) TXNFontMenuObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) TXNFontMenuObj_getattr, /*tp_getattr*/ ! (setattrfunc) TXNFontMenuObj_setattr, /*tp_setattr*/ (cmpfunc) TXNFontMenuObj_compare, /*tp_compare*/ (reprfunc) TXNFontMenuObj_repr, /*tp_repr*/ --- 1439,1444 ---- (destructor) TXNFontMenuObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) TXNFontMenuObj_compare, /*tp_compare*/ (reprfunc) TXNFontMenuObj_repr, /*tp_repr*/ *************** *** 1444,1447 **** --- 1447,1467 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) TXNFontMenuObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + TXNFontMenuObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + TXNFontMenuObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: mltesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/mltesupport.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mltesupport.py 22 Aug 2002 23:30:48 -0000 1.10 --- mltesupport.py 29 Nov 2002 23:40:44 -0000 1.11 *************** *** 137,145 **** # Our (opaque) objects ! class TXNObjDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") ! class TXNFontMenuObjDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") --- 137,145 ---- # Our (opaque) objects ! class TXNObjDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") ! class TXNFontMenuObjDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") From jackjansen@users.sourceforge.net Fri Nov 29 23:40:50 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:40:50 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/win _Winmodule.c,1.11,1.12 winsupport.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/win In directory sc8-pr-cvs1:/tmp/cvs-serv8673/win Modified Files: _Winmodule.c winsupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: _Winmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/_Winmodule.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _Winmodule.c 16 Aug 2002 09:09:31 -0000 1.11 --- _Winmodule.c 29 Nov 2002 23:40:47 -0000 1.12 *************** *** 2927,2938 **** }; ! PyMethodChain WinObj_chain = { WinObj_methods, NULL }; ! ! static PyObject *WinObj_getattr(WindowObject *self, char *name) ! { ! return Py_FindMethodInChain(&WinObj_chain, (PyObject *)self, name); ! } ! ! #define WinObj_setattr NULL static int WinObj_compare(WindowObject *self, WindowObject *other) --- 2927,2931 ---- }; ! #define WinObj_getsetlist NULL static int WinObj_compare(WindowObject *self, WindowObject *other) *************** *** 2964,2969 **** (destructor) WinObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) WinObj_getattr, /*tp_getattr*/ ! (setattrfunc) WinObj_setattr, /*tp_setattr*/ (cmpfunc) WinObj_compare, /*tp_compare*/ (reprfunc) WinObj_repr, /*tp_repr*/ --- 2957,2962 ---- (destructor) WinObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) WinObj_compare, /*tp_compare*/ (reprfunc) WinObj_repr, /*tp_repr*/ *************** *** 2972,2975 **** --- 2965,2985 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) WinObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + WinObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + WinObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: winsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/winsupport.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** winsupport.py 22 Aug 2002 23:30:49 -0000 1.31 --- winsupport.py 29 Nov 2002 23:40:48 -0000 1.32 *************** *** 129,133 **** """ ! class MyObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") --- 129,133 ---- """ ! class MyObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") From jackjansen@users.sourceforge.net Fri Nov 29 23:40:50 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:40:50 -0800 Subject: [Python-checkins] python/dist/src/Mac/Modules/waste wastemodule.c,1.26,1.27 wastesupport.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/waste In directory sc8-pr-cvs1:/tmp/cvs-serv8673/waste Modified Files: wastemodule.c wastesupport.py Log Message: Converted the Carbon modules to use PEP252-style objects, with descriptors in stead of manual getattr hooks to get at attributes of the objects. For Qd I have in stead gotten rid of most of the attribute access in favor of the carbon-style accessor methods (with the exception of visRgn, to be done later), and of the Carbon.Qd.qd global object, for which accessor functions are also available. For List I have fixed the fact that various methods were incorrectly generated as functions. CF is untouched: PEP252 doesn't allow "poor-mans-inheritance" with basechain, so it will have to wait for PEP253 support. Index: wastemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/waste/wastemodule.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** wastemodule.c 18 Nov 2002 15:26:43 -0000 1.26 --- wastemodule.c 29 Nov 2002 23:40:47 -0000 1.27 *************** *** 385,396 **** }; ! PyMethodChain WEOObj_chain = { WEOObj_methods, NULL }; ! ! static PyObject *WEOObj_getattr(WEOObject *self, char *name) ! { ! return Py_FindMethodInChain(&WEOObj_chain, (PyObject *)self, name); ! } ! ! #define WEOObj_setattr NULL #define WEOObj_compare NULL --- 385,389 ---- }; ! #define WEOObj_getsetlist NULL #define WEOObj_compare NULL *************** *** 409,414 **** (destructor) WEOObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) WEOObj_getattr, /*tp_getattr*/ ! (setattrfunc) WEOObj_setattr, /*tp_setattr*/ (cmpfunc) WEOObj_compare, /*tp_compare*/ (reprfunc) WEOObj_repr, /*tp_repr*/ --- 402,407 ---- (destructor) WEOObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) WEOObj_compare, /*tp_compare*/ (reprfunc) WEOObj_repr, /*tp_repr*/ *************** *** 417,420 **** --- 410,430 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) WEOObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + WEOObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + WEOObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; *************** *** 2097,2108 **** }; ! PyMethodChain wasteObj_chain = { wasteObj_methods, NULL }; ! ! static PyObject *wasteObj_getattr(wasteObject *self, char *name) ! { ! return Py_FindMethodInChain(&wasteObj_chain, (PyObject *)self, name); ! } ! ! #define wasteObj_setattr NULL #define wasteObj_compare NULL --- 2107,2111 ---- }; ! #define wasteObj_getsetlist NULL #define wasteObj_compare NULL *************** *** 2121,2126 **** (destructor) wasteObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc) wasteObj_getattr, /*tp_getattr*/ ! (setattrfunc) wasteObj_setattr, /*tp_setattr*/ (cmpfunc) wasteObj_compare, /*tp_compare*/ (reprfunc) wasteObj_repr, /*tp_repr*/ --- 2124,2129 ---- (destructor) wasteObj_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ ! (getattrfunc)0, /*tp_getattr*/ ! (setattrfunc)0, /*tp_setattr*/ (cmpfunc) wasteObj_compare, /*tp_compare*/ (reprfunc) wasteObj_repr, /*tp_repr*/ *************** *** 2129,2132 **** --- 2132,2152 ---- (PyMappingMethods *)0, /* tp_as_mapping */ (hashfunc) wasteObj_hash, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + PyObject_GenericGetAttr, /*tp_getattro*/ + PyObject_GenericSetAttr, /*tp_setattro */ + 0, /*outputHook_tp_as_buffer*/ + 0, /*outputHook_tp_flags*/ + 0, /*outputHook_tp_doc*/ + 0, /*outputHook_tp_traverse*/ + 0, /*outputHook_tp_clear*/ + 0, /*outputHook_tp_richcompare*/ + 0, /*outputHook_tp_weaklistoffset*/ + 0, /*outputHook_tp_iter*/ + 0, /*outputHook_tp_iternext*/ + wasteObj_methods, /* tp_methods */ + 0, /*outputHook_tp_members*/ + wasteObj_getsetlist, /*tp_getset*/ + 0, /*outputHook_tp_base*/ }; Index: wastesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/waste/wastesupport.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** wastesupport.py 18 Nov 2002 15:26:43 -0000 1.17 --- wastesupport.py 29 Nov 2002 23:40:47 -0000 1.18 *************** *** 278,282 **** ! class WEObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { --- 278,282 ---- ! class WEObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { *************** *** 290,294 **** Output("WEDispose(%s);", itselfname) ! class WEOObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { --- 290,294 ---- Output("WEDispose(%s);", itselfname) ! class WEOObjectDefinition(PEP252Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { From jackjansen@users.sourceforge.net Fri Nov 29 23:58:54 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 15:58:54 -0800 Subject: [Python-checkins] python/dist/src/Mac/OSX setup.jaguar.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv19620 Modified Files: setup.jaguar.py Log Message: Build _AE too. Index: setup.jaguar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/setup.jaguar.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** setup.jaguar.py 18 Nov 2002 13:48:18 -0000 1.2 --- setup.jaguar.py 29 Nov 2002 23:58:51 -0000 1.3 *************** *** 65,68 **** --- 65,72 ---- setup(name="MacPython for Jaguar extensions", version="2.2", ext_modules=[ + Extension("OverrideFrom23._AE", + [SRCDIR + "/Mac/Modules/ae/_AEmodule.c"], + include_dirs=[SRCDIR+"/Mac/Include"], + extra_link_args=['-framework', 'Carbon']), Extension("OverrideFrom23._Res", [SRCDIR + "/Mac/Modules/res/_Resmodule.c"], From jackjansen@users.sourceforge.net Sat Nov 30 00:01:34 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 16:01:34 -0800 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE MacPrefs.py,1.3,1.4 PyBrowser.py,1.16,1.17 PyConsole.py,1.11,1.12 Splash.py,1.15,1.16 Wbase.py,1.10,1.11 Wcontrols.py,1.13,1.14 Wlists.py,1.12,1.13 Wtext.py,1.17,1.18 Wwindows.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv20028/Tools/IDE Modified Files: MacPrefs.py PyBrowser.py PyConsole.py Splash.py Wbase.py Wcontrols.py Wlists.py Wtext.py Wwindows.py Log Message: Lots of minor tweaks for the pep252 checkins, mainly because Qd attributes are no longer supported. Index: MacPrefs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/MacPrefs.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MacPrefs.py 5 Jul 2001 07:03:16 -0000 1.3 --- MacPrefs.py 30 Nov 2002 00:01:24 -0000 1.4 *************** *** 71,75 **** prefdict[key] = value marshal.dump(prefdict, open(self.__path, 'wb')) ! fss = macfs.FSSpec(self.__path) fss.SetCreatorType(self.__creator, 'pref') --- 71,75 ---- prefdict[key] = value marshal.dump(prefdict, open(self.__path, 'wb')) ! fss = macfs.FSSpec(macfs.FSRef(self.__path)) fss.SetCreatorType(self.__creator, 'pref') *************** *** 98,102 **** vrefnum, dirid = macfs.FindFolder(kOnSystemDisk, 'pref', 0) prefsfolder_fss = macfs.FSSpec((vrefnum, dirid, '')) ! prefsfolder = prefsfolder_fss.as_pathname() path = os.path.join(prefsfolder, prefname) head, tail = os.path.split(path) --- 98,102 ---- vrefnum, dirid = macfs.FindFolder(kOnSystemDisk, 'pref', 0) prefsfolder_fss = macfs.FSSpec((vrefnum, dirid, '')) ! prefsfolder = macfs.FSRef(prefsfolder_fss).as_fsspec().as_pathname() path = os.path.join(prefsfolder, prefname) head, tail = os.path.split(path) Index: PyBrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyBrowser.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PyBrowser.py 16 Sep 2002 21:18:49 -0000 1.16 --- PyBrowser.py 30 Nov 2002 00:01:25 -0000 1.17 *************** *** 6,10 **** import re from Carbon import Qd, Icn, Fm, QuickDraw - from Carbon.List import GetListPort from Carbon.QuickDraw import hilitetransfermode --- 6,9 ---- *************** *** 212,216 **** lastpoint = (x, y) Qd.PaintRect(rect) ! Qd.PenPat(Qd.qd.black) Qd.PenNormal() if newcol > 0 and newcol <> abscol: --- 211,215 ---- lastpoint = (x, y) Qd.PaintRect(rect) ! Qd.PenPat(Qd.GetQDGlobalsBlack()) Qd.PenNormal() if newcol > 0 and newcol <> abscol: *************** *** 370,374 **** dataOffset, dataLen, theList): savedPort = Qd.GetPort() ! Qd.SetPort(GetListPort(theList)) savedClip = Qd.NewRgn() Qd.GetClip(savedClip) --- 369,373 ---- dataOffset, dataLen, theList): savedPort = Qd.GetPort() ! Qd.SetPort(theList.GetListPort()) savedClip = Qd.NewRgn() Qd.GetClip(savedClip) Index: PyConsole.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyConsole.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PyConsole.py 4 Feb 2002 11:53:53 -0000 1.11 --- PyConsole.py 30 Nov 2002 00:01:25 -0000 1.12 *************** *** 109,114 **** self.ted.WEClearUndo() self.updatescrollbars() ! if Qd.QDIsPortBuffered(self._parentwindow.wid): ! Qd.QDFlushPortBuffer(self._parentwindow.wid, None) def selection_ok(self): --- 109,114 ---- self.ted.WEClearUndo() self.updatescrollbars() ! if self._parentwindow.wid.GetWindowPort().QDIsPortBuffered(): ! self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None) def selection_ok(self): *************** *** 301,306 **** self.w.outputtext.updatescrollbars() self.w.outputtext.ted.WEFeatureFlag(WASTEconst.weFReadOnly, 1) ! if Qd.QDIsPortBuffered(self.w.wid): ! Qd.QDFlushPortBuffer(self.w.wid, None) def show(self): --- 301,306 ---- self.w.outputtext.updatescrollbars() self.w.outputtext.ted.WEFeatureFlag(WASTEconst.weFReadOnly, 1) ! if self.w.wid.GetWindowPort().QDIsPortBuffered(): ! self.w.wid.GetWindowPort().QDFlushPortBuffer(None) def show(self): Index: Splash.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Splash.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Splash.py 2 Nov 2001 19:30:21 -0000 1.15 --- Splash.py 30 Nov 2002 00:01:26 -0000 1.16 *************** *** 49,54 **** splash.DrawDialog() drawtext(what) ! splash.GetDialogWindow().ValidWindowRect(splash.GetDialogPort().portRect) ! Qd.QDFlushPortBuffer(splash.GetDialogWindow().GetWindowPort(), None) def drawtext(what = 0): --- 49,54 ---- splash.DrawDialog() drawtext(what) ! splash.GetDialogWindow().ValidWindowRect(splash.GetDialogPort().GetPortBounds()) ! splash.GetDialogWindow().GetWindowPort().QDFlushPortBuffer(None) def drawtext(what = 0): Index: Wbase.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wbase.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Wbase.py 24 Nov 2002 01:01:07 -0000 1.10 --- Wbase.py 30 Nov 2002 00:01:27 -0000 1.11 *************** *** 377,381 **** class Frame(Widget): ! def __init__(self, possize, pattern = Qd.qd.black, color = (0, 0, 0)): Widget.__init__(self, possize) self._framepattern = pattern --- 377,381 ---- class Frame(Widget): ! def __init__(self, possize, pattern = Qd.GetQDGlobalsBlack(), color = (0, 0, 0)): Widget.__init__(self, possize) self._framepattern = pattern *************** *** 571,575 **** # track mouse --- XXX move to separate method? Qd.PenMode(QuickDraw.srcXor) ! Qd.PenPat(Qd.qd.gray) Qd.PaintRect(rect) lastpos = None --- 571,575 ---- # track mouse --- XXX move to separate method? Qd.PenMode(QuickDraw.srcXor) ! Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) lastpos = None *************** *** 580,584 **** if pos == lastpos: continue ! Qd.PenPat(Qd.qd.gray) Qd.PaintRect(rect) if self._direction: --- 580,584 ---- if pos == lastpos: continue ! Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) if self._direction: *************** *** 586,593 **** else: rect = pos - 1, t, pos, b ! Qd.PenPat(Qd.qd.gray) Qd.PaintRect(rect) lastpos = pos ! Qd.QDFlushPortBuffer(self._parentwindow.wid, None) Evt.WaitNextEvent(0, 3) Qd.PaintRect(rect) --- 586,593 ---- else: rect = pos - 1, t, pos, b ! Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) lastpos = pos ! self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None) Evt.WaitNextEvent(0, 3) Qd.PaintRect(rect) *************** *** 644,648 **** if not visRgn: visRgn = self._parentwindow.wid.GetWindowPort().visRgn ! Qd.PenPat(Qd.qd.gray) rect = self._bounds Qd.FrameRect(rect) --- 644,648 ---- if not visRgn: visRgn = self._parentwindow.wid.GetWindowPort().visRgn ! Qd.PenPat(Qd.GetQDGlobalsGray()) rect = self._bounds Qd.FrameRect(rect) *************** *** 701,705 **** #_cursors = { # "watch" : Qd.GetCursor(QuickDraw.watchCursor).data, ! # "arrow" : Qd.qd.arrow, # "iBeam" : Qd.GetCursor(QuickDraw.iBeamCursor).data, # "cross" : Qd.GetCursor(QuickDraw.crossCursor).data, --- 701,705 ---- #_cursors = { # "watch" : Qd.GetCursor(QuickDraw.watchCursor).data, ! # "arrow" : Qd.GetQDGlobalsArrow(), # "iBeam" : Qd.GetCursor(QuickDraw.iBeamCursor).data, # "cross" : Qd.GetCursor(QuickDraw.crossCursor).data, Index: Wcontrols.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wcontrols.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Wcontrols.py 31 Dec 2001 08:56:52 -0000 1.13 --- Wcontrols.py 30 Nov 2002 00:01:27 -0000 1.14 *************** *** 171,175 **** import time self._control.HiliteControl(Controls.kControlButtonPart) ! Qd.QDFlushPortBuffer(self._parentwindow.wid, None) # needed under OSX time.sleep(0.1) self._control.HiliteControl(0) --- 171,175 ---- import time self._control.HiliteControl(Controls.kControlButtonPart) ! self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None) # needed under OSX time.sleep(0.1) self._control.HiliteControl(0) Index: Wlists.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wlists.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Wlists.py 26 Mar 2002 12:06:11 -0000 1.12 --- Wlists.py 30 Nov 2002 00:01:28 -0000 1.13 *************** *** 3,7 **** import string from Carbon import Evt, Events, Fm, Lists, Qd, Scrap, Win ! from Carbon.List import LNew, CreateCustomList, GetListPort from Carbon.Lists import kListDefUserProcType, lInitMsg, lDrawMsg, lHiliteMsg, lCloseMsg from Carbon.QuickDraw import hilitetransfermode --- 3,7 ---- import string from Carbon import Evt, Events, Fm, Lists, Qd, Scrap, Win ! from Carbon.List import LNew, CreateCustomList from Carbon.Lists import kListDefUserProcType, lInitMsg, lDrawMsg, lHiliteMsg, lCloseMsg from Carbon.QuickDraw import hilitetransfermode *************** *** 436,440 **** dataOffset, dataLen, theList): savedPort = Qd.GetPort() ! Qd.SetPort(GetListPort(theList)) savedClip = Qd.NewRgn() Qd.GetClip(savedClip) --- 436,440 ---- dataOffset, dataLen, theList): savedPort = Qd.GetPort() ! Qd.SetPort(theList.GetListPort()) savedClip = Qd.NewRgn() Qd.GetClip(savedClip) *************** *** 478,482 **** dataOffset, dataLen, theList): savedPort = Qd.GetPort() ! Qd.SetPort(GetListPort(theList)) savedClip = Qd.NewRgn() Qd.GetClip(savedClip) --- 478,482 ---- dataOffset, dataLen, theList): savedPort = Qd.GetPort() ! Qd.SetPort(theList.GetListPort()) savedClip = Qd.NewRgn() Qd.GetClip(savedClip) Index: Wtext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wtext.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Wtext.py 31 Dec 2001 14:52:52 -0000 1.17 --- Wtext.py 30 Nov 2002 00:01:28 -0000 1.18 *************** *** 966,970 **** self.ted.WEFeatureFlag(WASTEconst.weFAutoScroll, 0) self.ted.WESetSelection(count, count + 1) ! Qd.QDFlushPortBuffer(self._parentwindow.wid, None) # needed under OSX time.sleep(0.2) self.ted.WESetSelection(selstart, selend) --- 966,970 ---- self.ted.WEFeatureFlag(WASTEconst.weFAutoScroll, 0) self.ted.WESetSelection(count, count + 1) ! self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None) # needed under OSX time.sleep(0.2) self.ted.WESetSelection(selstart, selend) *************** *** 1043,1047 **** br = br - 1 self.SetPort() ! Qd.PenPat(Qd.qd.gray) Qd.PaintRect((br, bt, br + 1, bb)) Qd.PenNormal() --- 1043,1047 ---- br = br - 1 self.SetPort() ! Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect((br, bt, br + 1, bb)) Qd.PenNormal() *************** *** 1124,1128 **** def GetPortFontSettings(port): ! return Fm.GetFontName(port.txFont), port.txFace, port.txSize def SetPortFontSettings(port, (font, face, size)): --- 1124,1128 ---- def GetPortFontSettings(port): ! return Fm.GetFontName(port.GetPortTextFont()), port.GetPortTextFace(), port.GetPortTextSize() def SetPortFontSettings(port, (font, face, size)): Index: Wwindows.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wwindows.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Wwindows.py 21 Mar 2002 22:36:57 -0000 1.17 --- Wwindows.py 30 Nov 2002 00:01:29 -0000 1.18 *************** *** 271,275 **** def _calcbounds(self): ! self._possize = self.wid.GetWindowPort().portRect[2:] w, h = self._possize self._bounds = (0, 0, w, h) --- 271,275 ---- def _calcbounds(self): ! self._possize = self.wid.GetWindowPort().GetPortBounds()[2:] w, h = self._possize self._bounds = (0, 0, w, h) *************** *** 388,392 **** def getgrowrect(self): ! l, t, r, b = self.wid.GetWindowPort().portRect return (r - 15, b - 15, r, b) --- 388,392 ---- def getgrowrect(self): ! l, t, r, b = self.wid.GetWindowPort().GetPortBounds() return (r - 15, b - 15, r, b) *************** *** 424,428 **** def getwindowbounds(self, size, minsize = None): ! screenbounds = sl, st, sr, sb = Qd.qd.screenBits.bounds w, h = size l = sl + (sr - sl - w) / 2 --- 424,428 ---- def getwindowbounds(self, size, minsize = None): ! screenbounds = sl, st, sr, sb = Qd.GetQDGlobalsScreenBits().bounds w, h = size l = sl + (sr - sl - w) / 2 *************** *** 616,620 **** width, height = preferredsize ! sl, st, sr, sb = screenbounds = Qd.InsetRect(Qd.qd.screenBits.bounds, 4, 4) l, t = getnextwindowpos() if (l + width) > sr: --- 616,620 ---- width, height = preferredsize ! sl, st, sr, sb = screenbounds = Qd.InsetRect(Qd.GetQDGlobalsScreenBits().bounds, 4, 4) l, t = getnextwindowpos() if (l + width) > sr: From jackjansen@users.sourceforge.net Sat Nov 30 00:01:47 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 16:01:47 -0800 Subject: [Python-checkins] python/dist/src/Mac/Contrib/ImageHelpers MovieUtils.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Contrib/ImageHelpers In directory sc8-pr-cvs1:/tmp/cvs-serv20028/Contrib/ImageHelpers Modified Files: MovieUtils.py Log Message: Lots of minor tweaks for the pep252 checkins, mainly because Qd attributes are no longer supported. Index: MovieUtils.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Contrib/ImageHelpers/MovieUtils.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MovieUtils.py 25 Aug 2001 12:07:43 -0000 1.2 --- MovieUtils.py 30 Nov 2002 00:01:14 -0000 1.3 *************** *** 125,129 **** #Qd.MoveTo(10,10) #Qd.LineTo(200,150) ! Qd.CopyBits(self.gw.portBits,Qd.GetPort().portBits,self.myRect,destRect,srcCopy,None) class MovieWin(W.Window): --- 125,129 ---- #Qd.MoveTo(10,10) #Qd.LineTo(200,150) ! Qd.CopyBits(self.gw.GetPortBitMapForCopyBits(),Qd.GetPort().GetPortBitMapForCopyBits(),self.myRect,destRect,srcCopy,None) class MovieWin(W.Window): From jackjansen@users.sourceforge.net Sat Nov 30 00:01:49 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 16:01:49 -0800 Subject: [Python-checkins] python/dist/src/Mac/Demo/PICTbrowse ICONbrowse.py,1.8,1.9 PICTbrowse2.py,1.10,1.11 cicnbrowse.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Demo/PICTbrowse In directory sc8-pr-cvs1:/tmp/cvs-serv20028/Demo/PICTbrowse Modified Files: ICONbrowse.py PICTbrowse2.py cicnbrowse.py Log Message: Lots of minor tweaks for the pep252 checkins, mainly because Qd attributes are no longer supported. Index: ICONbrowse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/PICTbrowse/ICONbrowse.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ICONbrowse.py 27 Aug 2001 21:40:58 -0000 1.8 --- ICONbrowse.py 30 Nov 2002 00:01:15 -0000 1.9 *************** *** 94,98 **** """Return self.pictrect scaled to fit in window""" graf = self.wid.GetWindowPort() ! screenrect = graf.portRect picwidth = self.pictrect[2] - self.pictrect[0] picheight = self.pictrect[3] - self.pictrect[1] --- 94,98 ---- """Return self.pictrect scaled to fit in window""" graf = self.wid.GetWindowPort() ! screenrect = graf.GetPortBounds() picwidth = self.pictrect[2] - self.pictrect[0] picheight = self.pictrect[3] - self.pictrect[1] Index: PICTbrowse2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/PICTbrowse/PICTbrowse2.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PICTbrowse2.py 27 Aug 2001 21:40:34 -0000 1.10 --- PICTbrowse2.py 30 Nov 2002 00:01:16 -0000 1.11 *************** *** 94,98 **** """Return self.pictrect scaled to fit in window""" graf = self.dlg.GetWindowPort() ! screenrect = graf.portRect picwidth = self.pictrect[2] - self.pictrect[0] picheight = self.pictrect[3] - self.pictrect[1] --- 94,98 ---- """Return self.pictrect scaled to fit in window""" graf = self.dlg.GetWindowPort() ! screenrect = graf.GetPortBounds() picwidth = self.pictrect[2] - self.pictrect[0] picheight = self.pictrect[3] - self.pictrect[1] Index: cicnbrowse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/PICTbrowse/cicnbrowse.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** cicnbrowse.py 27 Aug 2001 21:41:03 -0000 1.7 --- cicnbrowse.py 30 Nov 2002 00:01:16 -0000 1.8 *************** *** 94,98 **** """Return self.pictrect scaled to fit in window""" graf = self.wid.GetWindowPort() ! screenrect = graf.portRect picwidth = self.pictrect[2] - self.pictrect[0] picheight = self.pictrect[3] - self.pictrect[1] --- 94,98 ---- """Return self.pictrect scaled to fit in window""" graf = self.wid.GetWindowPort() ! screenrect = graf.GetPortBounds() picwidth = self.pictrect[2] - self.pictrect[0] picheight = self.pictrect[3] - self.pictrect[1] From jackjansen@users.sourceforge.net Sat Nov 30 00:01:49 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 16:01:49 -0800 Subject: [Python-checkins] python/dist/src/Mac/Demo/imgbrowse imgbrowse.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Demo/imgbrowse In directory sc8-pr-cvs1:/tmp/cvs-serv20028/Demo/imgbrowse Modified Files: imgbrowse.py Log Message: Lots of minor tweaks for the pep252 checkins, mainly because Qd attributes are no longer supported. Index: imgbrowse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/imgbrowse/imgbrowse.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** imgbrowse.py 25 Aug 2001 12:05:40 -0000 1.5 --- imgbrowse.py 30 Nov 2002 00:01:17 -0000 1.6 *************** *** 1,3 **** ! """imgbrowse - Display pictures using img""" import FrameWork --- 1,3 ---- ! GetPortBounds()"""imgbrowse - Display pictures using img""" import FrameWork *************** *** 89,96 **** print 'PICT:', self.pictrect print 'WIND:', currect ! print 'ARGS:', (self.pixmap, self.wid.GetWindowPort().portBits, self.pictrect, currect, QuickDraw.srcCopy, None) self.info() ! Qd.CopyBits(self.pixmap, self.wid.GetWindowPort().portBits, self.pictrect, currect, QuickDraw.srcCopy, None) --- 89,96 ---- print 'PICT:', self.pictrect print 'WIND:', currect ! print 'ARGS:', (self.pixmap, self.wid.GetWindowPort().GetPortBitMapForCopyBits(), self.pictrect, currect, QuickDraw.srcCopy, None) self.info() ! Qd.CopyBits(self.pixmap, self.wid.GetWindowPort().GetPortBitMapForCopyBits(), self.pictrect, currect, QuickDraw.srcCopy, None) *************** *** 98,102 **** """Return self.pictrect scaled to fit in window""" graf = self.wid.GetWindowPort() ! screenrect = graf.portRect picwidth = self.pictrect[2] - self.pictrect[0] picheight = self.pictrect[3] - self.pictrect[1] --- 98,102 ---- """Return self.pictrect scaled to fit in window""" graf = self.wid.GetWindowPort() ! screenrect = graf.GetPortBounds() picwidth = self.pictrect[2] - self.pictrect[0] picheight = self.pictrect[3] - self.pictrect[1] *************** *** 114,118 **** def info(self): graf = self.wid.GetWindowPort() ! bits = graf.portBits mac_image.dumppixmap(bits.pixmap_data) --- 114,118 ---- def info(self): graf = self.wid.GetWindowPort() ! bits = graf.GetPortBitMapForCopyBits() mac_image.dumppixmap(bits.pixmap_data) From jackjansen@users.sourceforge.net Sat Nov 30 00:01:50 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 16:01:50 -0800 Subject: [Python-checkins] python/dist/src/Mac/Demo/mlte mlted.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Demo/mlte In directory sc8-pr-cvs1:/tmp/cvs-serv20028/Demo/mlte Modified Files: mlted.py Log Message: Lots of minor tweaks for the pep252 checkins, mainly because Qd attributes are no longer supported. Index: mlted.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/mlte/mlted.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mlted.py 25 Aug 2001 12:07:17 -0000 1.4 --- mlted.py 30 Nov 2002 00:01:17 -0000 1.5 *************** *** 363,367 **** self.active.do_idle(event) else: ! Qd.SetCursor(Qd.qd.arrow) def main(): --- 363,367 ---- self.active.do_idle(event) else: ! Qd.SetCursor(Qd.GetQDGlobalsArrow()) def main(): From jackjansen@users.sourceforge.net Sat Nov 30 00:01:53 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 16:01:53 -0800 Subject: [Python-checkins] python/dist/src/Mac/Demo/quicktime MovieInWindow.py,1.5,1.6 VerySimplePlayer.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Demo/quicktime In directory sc8-pr-cvs1:/tmp/cvs-serv20028/Demo/quicktime Modified Files: MovieInWindow.py VerySimplePlayer.py Log Message: Lots of minor tweaks for the pep252 checkins, mainly because Qd attributes are no longer supported. Index: MovieInWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/quicktime/MovieInWindow.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MovieInWindow.py 25 Aug 2001 12:07:36 -0000 1.5 --- MovieInWindow.py 30 Nov 2002 00:01:18 -0000 1.6 *************** *** 32,36 **** # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil) ! playMovieInWindow(theWindow, fss, theWindow.GetWindowPort().portRect) def playMovieInWindow(theWindow, theFile, movieBox): --- 32,36 ---- # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil) ! playMovieInWindow(theWindow, fss, theWindow.GetWindowPort().GetPortBounds()) def playMovieInWindow(theWindow, theFile, movieBox): Index: VerySimplePlayer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/quicktime/VerySimplePlayer.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** VerySimplePlayer.py 25 Aug 2001 12:13:33 -0000 1.5 --- VerySimplePlayer.py 30 Nov 2002 00:01:20 -0000 1.6 *************** *** 79,83 **** Qd.SetPort(whichWindow) whichWindow.BeginUpdate() ! Qd.EraseRect(whichWindow.GetWindowPort().portRect) whichWindow.EndUpdate() --- 79,83 ---- Qd.SetPort(whichWindow) whichWindow.BeginUpdate() ! Qd.EraseRect(whichWindow.GetWindowPort().GetPortBounds()) whichWindow.EndUpdate() From jackjansen@users.sourceforge.net Sat Nov 30 00:01:54 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 16:01:54 -0800 Subject: [Python-checkins] python/dist/src/Mac/Demo/textedit ped.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Demo/textedit In directory sc8-pr-cvs1:/tmp/cvs-serv20028/Demo/textedit Modified Files: ped.py Log Message: Lots of minor tweaks for the pep252 checkins, mainly because Qd attributes are no longer supported. Index: ped.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/textedit/ped.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ped.py 31 Dec 2001 15:02:56 -0000 1.9 --- ped.py 30 Nov 2002 00:01:21 -0000 1.10 *************** *** 22,26 **** w = Win.NewWindow(r, name, 1, 0, -1, 1, 0) self.wid = w ! x0, y0, x1, y1 = self.wid.GetWindowPort().portRect x0 = x0 + 4 y0 = y0 + 4 --- 22,26 ---- w = Win.NewWindow(r, name, 1, 0, -1, 1, 0) self.wid = w ! x0, y0, x1, y1 = self.wid.GetWindowPort().GetPortBounds() x0 = x0 + 4 y0 = y0 + 4 *************** *** 88,93 **** def do_update(self, wid, event): ! Qd.EraseRect(wid.GetWindowPort().portRect) ! self.ted.TEUpdate(wid.GetWindowPort().portRect) self.updatescrollbars() --- 88,93 ---- def do_update(self, wid, event): ! Qd.EraseRect(wid.GetWindowPort().GetPortBounds()) ! self.ted.TEUpdate(wid.GetWindowPort().GetPortBounds()) self.updatescrollbars() *************** *** 351,355 **** self.active.do_idle() else: ! Qd.SetCursor(Qd.qd.arrow) def main(): --- 351,355 ---- self.active.do_idle() else: ! Qd.SetCursor(Qd.GetQDGlobalsArrow()) def main(): From jackjansen@users.sourceforge.net Sat Nov 30 00:01:55 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 16:01:55 -0800 Subject: [Python-checkins] python/dist/src/Mac/Demo/waste htmled.py,1.11,1.12 swed.py,1.12,1.13 wed.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Demo/waste In directory sc8-pr-cvs1:/tmp/cvs-serv20028/Demo/waste Modified Files: htmled.py swed.py wed.py Log Message: Lots of minor tweaks for the pep252 checkins, mainly because Qd attributes are no longer supported. Index: htmled.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/waste/htmled.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** htmled.py 31 Dec 2001 15:02:48 -0000 1.11 --- htmled.py 30 Nov 2002 00:01:21 -0000 1.12 *************** *** 96,100 **** if self.ted.WEAdjustCursor(where, BIGREGION): return ! Qd.SetCursor(Qd.qd.arrow) def getscrollbarvalues(self): --- 96,100 ---- if self.ted.WEAdjustCursor(where, BIGREGION): return ! Qd.SetCursor(Qd.GetQDGlobalsArrow()) def getscrollbarvalues(self): *************** *** 781,785 **** self.active.do_idle(event) else: ! Qd.SetCursor(Qd.qd.arrow) def newRuler(self, obj): --- 781,785 ---- self.active.do_idle(event) else: ! Qd.SetCursor(Qd.GetQDGlobalsArrow()) def newRuler(self, obj): Index: swed.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/waste/swed.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** swed.py 31 Dec 2001 15:02:38 -0000 1.12 --- swed.py 30 Nov 2002 00:01:22 -0000 1.13 *************** *** 84,88 **** if self.ted.WEAdjustCursor(where, BIGREGION): return ! Qd.SetCursor(Qd.qd.arrow) def getscrollbarvalues(self): --- 84,88 ---- if self.ted.WEAdjustCursor(where, BIGREGION): return ! Qd.SetCursor(Qd.GetQDGlobalsArrow()) def getscrollbarvalues(self): *************** *** 610,614 **** self.active.do_idle(event) else: ! Qd.SetCursor(Qd.qd.arrow) def getfontnames(): --- 610,614 ---- self.active.do_idle(event) else: ! Qd.SetCursor(Qd.GetQDGlobalsArrow()) def getfontnames(): Index: wed.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/waste/wed.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** wed.py 31 Dec 2001 15:02:30 -0000 1.8 --- wed.py 30 Nov 2002 00:01:22 -0000 1.9 *************** *** 51,55 **** if self.ted.WEAdjustCursor(where, BIGREGION): return ! Qd.SetCursor(Qd.qd.arrow) def getscrollbarvalues(self): --- 51,55 ---- if self.ted.WEAdjustCursor(where, BIGREGION): return ! Qd.SetCursor(Qd.GetQDGlobalsArrow()) def getscrollbarvalues(self): *************** *** 418,422 **** self.active.do_idle(event) else: ! Qd.SetCursor(Qd.qd.arrow) def main(): --- 418,422 ---- self.active.do_idle(event) else: ! Qd.SetCursor(Qd.GetQDGlobalsArrow()) def main(): From jackjansen@users.sourceforge.net Sat Nov 30 00:01:56 2002 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 29 Nov 2002 16:01:56 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib EasyDialogs.py,1.39,1.40 FrameWork.py,1.53,1.54 PixMapWrapper.py,1.3,1.4 bgenlocations.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20028/Lib Modified Files: EasyDialogs.py FrameWork.py PixMapWrapper.py bgenlocations.py Log Message: Lots of minor tweaks for the pep252 checkins, mainly because Qd attributes are no longer supported. Index: EasyDialogs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/EasyDialogs.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** EasyDialogs.py 7 Nov 2002 23:07:04 -0000 1.39 --- EasyDialogs.py 30 Nov 2002 00:01:23 -0000 1.40 *************** *** 223,227 **** ! screenbounds = Qd.qd.screenBits.bounds screenbounds = screenbounds[0]+4, screenbounds[1]+4, \ screenbounds[2]-4, screenbounds[3]-4 --- 223,227 ---- ! screenbounds = Qd.GetQDGlobalsScreenBits().bounds screenbounds = screenbounds[0]+4, screenbounds[1]+4, \ screenbounds[2]-4, screenbounds[3]-4 Index: FrameWork.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/FrameWork.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** FrameWork.py 10 Sep 2002 12:22:32 -0000 1.53 --- FrameWork.py 30 Nov 2002 00:01:24 -0000 1.54 *************** *** 69,73 **** # The useable portion of the screen # ## but what happens with multiple screens? jvr ! screenbounds = qd.screenBits.bounds screenbounds = screenbounds[0]+4, screenbounds[1]+4, \ screenbounds[2]-4, screenbounds[3]-4 --- 69,73 ---- # The useable portion of the screen # ## but what happens with multiple screens? jvr ! screenbounds = GetQDGlobalsScreenBits().bounds screenbounds = screenbounds[0]+4, screenbounds[1]+4, \ screenbounds[2]-4, screenbounds[3]-4 *************** *** 98,102 **** def setarrowcursor(): ! SetCursor(qd.arrow) class Application: --- 98,102 ---- def setarrowcursor(): ! SetCursor(GetQDGlobalsArrow()) class Application: *************** *** 809,813 **** def do_resize(self, width, height, window): ! l, t, r, b = self.wid.GetWindowPort().portRect # jvr, forGrowIcon self.SetPort() # jvr self.wid.InvalWindowRect((r - SCROLLBARWIDTH + 1, b - SCROLLBARWIDTH + 1, r, b)) # jvr --- 809,813 ---- def do_resize(self, width, height, window): ! l, t, r, b = self.wid.GetWindowPort().GetPortBounds() # jvr, forGrowIcon self.SetPort() # jvr self.wid.InvalWindowRect((r - SCROLLBARWIDTH + 1, b - SCROLLBARWIDTH + 1, r, b)) # jvr *************** *** 817,821 **** def do_postresize(self, width, height, window): SetPort(window) ! self.wid.InvalWindowRect(window.GetWindowPort().portRect) def do_inContent(self, partcode, window, event): --- 817,821 ---- def do_postresize(self, width, height, window): SetPort(window) ! self.wid.InvalWindowRect(window.GetWindowPort().GetPortBounds()) def do_inContent(self, partcode, window, event): *************** *** 850,854 **** time.sleep(0.1) InvertRgn(window.GetWindowPort().visRgn) ! FillRgn(window.GetWindowPort().visRgn, qd.gray) else: EraseRgn(window.GetWindowPort().visRgn) --- 850,854 ---- time.sleep(0.1) InvertRgn(window.GetWindowPort().visRgn) ! FillRgn(window.GetWindowPort().visRgn, GetQDGlobalsGray()) else: EraseRgn(window.GetWindowPort().visRgn) *************** *** 903,907 **** self.barx = self.bary = None self.barx_enabled = self.bary_enabled = 1 ! x0, y0, x1, y1 = self.wid.GetWindowPort().portRect vx, vy = self.getscrollbarvalues() if vx == None: self.barx_enabled, vx = 0, 0 --- 903,907 ---- self.barx = self.bary = None self.barx_enabled = self.bary_enabled = 1 ! x0, y0, x1, y1 = self.wid.GetWindowPort().GetPortBounds() vx, vy = self.getscrollbarvalues() if vx == None: self.barx_enabled, vx = 0, 0 *************** *** 939,943 **** def do_postresize(self, width, height, window): ! l, t, r, b = self.wid.GetWindowPort().portRect self.SetPort() if self.barx: --- 939,943 ---- def do_postresize(self, width, height, window): ! l, t, r, b = self.wid.GetWindowPort().GetPortBounds() self.SetPort() if self.barx: Index: PixMapWrapper.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/PixMapWrapper.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PixMapWrapper.py 25 Aug 2001 12:08:49 -0000 1.3 --- PixMapWrapper.py 30 Nov 2002 00:01:24 -0000 1.4 *************** *** 152,156 **** dest[3] = y1 + src[3]-src[1] if not port: port = Qd.GetPort() ! Qd.CopyBits(self.PixMap(), port.portBits, src, tuple(dest), QuickDraw.srcCopy, None) --- 152,156 ---- dest[3] = y1 + src[3]-src[1] if not port: port = Qd.GetPort() ! Qd.CopyBits(self.PixMap(), port.GetPortBitMapForCopyBits(), src, tuple(dest), QuickDraw.srcCopy, None) Index: bgenlocations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/bgenlocations.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bgenlocations.py 5 Aug 2002 14:56:04 -0000 1.1 --- bgenlocations.py 30 Nov 2002 00:01:24 -0000 1.2 *************** *** 29,33 **** _MWERKSDIR="Macintosh HD:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior" else: ! _MWERKSDIR="/Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/" INCLUDEDIR=os.path.join(_MWERKSDIR, "MacOS Support", "Universal", "Interfaces", "CIncludes") --- 29,33 ---- _MWERKSDIR="Macintosh HD:Applications (Mac OS 9):Metrowerks CodeWarrior 7.0:Metrowerks CodeWarrior" else: ! _MWERKSDIR="/Volumes/Moes/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/" INCLUDEDIR=os.path.join(_MWERKSDIR, "MacOS Support", "Universal", "Interfaces", "CIncludes") From goodger@users.sourceforge.net Sat Nov 30 01:49:40 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 29 Nov 2002 17:49:40 -0800 Subject: [Python-checkins] python/nondist/peps pep-0257.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv17981/python/nondist/peps Modified Files: pep-0257.txt Log Message: Added "Handling Docstring Indentation" section. Index: pep-0257.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0257.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pep-0257.txt 28 Nov 2002 03:59:50 -0000 1.7 --- pep-0257.txt 30 Nov 2002 01:49:37 -0000 1.8 *************** *** 137,149 **** tools; it is important that it fits on one line and is separated from the rest of the docstring by a blank line. The summary line may be on ! the same line as the opening quotes or on the next line. ! ! The entire docstring is indented the same as the quotes at its first ! line (see example below). Docstring processing tools will strip a ! uniform amount of indentation from the second and further lines of the ! docstring, equal to the minimum indentation of all non-blank lines ! after the first line of the docstring. Relative indentation of later ! lines in the docstring is retained. Any indentation on the first line ! of the docstring (i.e., before the first newline) is removed. Insert a blank line before and after all docstrings (one-line or --- 137,143 ---- tools; it is important that it fits on one line and is separated from the rest of the docstring by a blank line. The summary line may be on ! the same line as the opening quotes or on the next line. The entire ! docstring is indented the same as the quotes at its first line (see ! example below). Insert a blank line before and after all docstrings (one-line or *************** *** 217,220 **** --- 211,284 ---- the closing quotes on a line by themselves. This way, Emacs' ``fill-paragraph`` command can be used on it. + + + Handling Docstring Indentation + ------------------------------ + + Docstring processing tools will strip a uniform amount of indentation + from the second and further lines of the docstring, equal to the + minimum indentation of all non-blank lines after the first line. Any + indentation in the first line of the docstring (i.e., up to the first + newline) is insignificant and removed. Relative indentation of later + lines in the docstring is retained. Blank lines should be removed + from the beginning and end of the docstring. + + Since code is much more precise than words, here is an implementation + of the algorithm:: + + def trim(docstring): + if not docstring: + return '' + # Convert tabs to spaces (following the normal Python rules) + # and split into a list of lines: + lines = docstring.expandtabs().splitlines() + # Determine minimum indentation (first line doesn't count): + indent = sys.maxint + for line in lines[1:]: + stripped = line.lstrip() + if stripped: + indent = min(indent, len(line) - len(stripped)) + # Remove indentation (first line is special): + trimmed = [lines[0].strip()] + if indent < sys.maxint: + for line in lines[1:]: + trimmed.append(line[indent:].rstrip()) + # Strip off trailing and leading blank lines: + while trimmed and not trimmed[-1]: + trimmed.pop() + while trimmed and not trimmed[0]: + trimmed.pop(0) + # Return a single string: + return '\n'.join(trimmed) + + The docstring in this example contains two newline characters and is + therefore 3 lines long. The first and last lines are blank:: + + def foo(): + """ + This is the second line of the docstring. + """ + + To illustrate:: + + >>> print repr(foo.__doc__) + '\n This is the second line of the docstring.\n ' + >>> foo.__doc__.splitlines() + ['', ' This is the second line of the docstring.', ' '] + >>> trim(foo.__doc__) + 'This is the second line of the docstring.' + + Once trimmed, these docstrings are equivalent:: + + def foo(): + """A multi-line + docstring. + """ + + def bar(): + """ + A multi-line + docstring. + """ From goodger@users.sourceforge.net Sat Nov 30 01:50:41 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 29 Nov 2002 17:50:41 -0800 Subject: [Python-checkins] python/nondist/peps pep-0291.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv18208/python/nondist/peps Modified Files: pep-0291.txt Log Message: Clarified the "Features to Avoid" table & text. Index: pep-0291.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0291.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0291.txt 15 Nov 2002 22:53:27 -0000 1.2 --- pep-0291.txt 30 Nov 2002 01:50:39 -0000 1.3 *************** *** 42,67 **** This list is not complete! It is only meant as a general guide. ! Note the features to avoid were implemented in the following ! version. For example, features listed next to 1.5.2 were ! implemented in 2.0. ! Version Features ! ------- -------- 1.5.2 string methods, Unicode, list comprehensions, augmented assignment (eg, +=), zip(), import x as y, dict.setdefault(), print >> f, calling f(*args, **kw), ! plus 2.0 features 2.0 nested scopes, rich comparisons, function attributes, ! plus 2.1 features 2.1 use of object or new-style classes, iterators, using generators, nested scopes, or // without from __future__ import ... statement, ! plus 2.2 features 2.2 bool, True, False, basestring, enumerate(), {}.pop(), ! PendingDeprecationWarning, Universal Newlines, ! plus 2.3 features --- 42,66 ---- This list is not complete! It is only meant as a general guide. ! Note that the features below were implemented in the version ! following the one listed. For example, features listed next to ! 1.5.2 were implemented in 2.0. ! Version Features to Avoid ! ------- ----------------- 1.5.2 string methods, Unicode, list comprehensions, augmented assignment (eg, +=), zip(), import x as y, dict.setdefault(), print >> f, calling f(*args, **kw), ! plus all features below 2.0 nested scopes, rich comparisons, function attributes, ! plus all features below 2.1 use of object or new-style classes, iterators, using generators, nested scopes, or // without from __future__ import ... statement, ! plus all features below 2.2 bool, True, False, basestring, enumerate(), {}.pop(), ! PendingDeprecationWarning, Universal Newlines From goodger@users.sourceforge.net Sat Nov 30 01:55:34 2002 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 29 Nov 2002 17:55:34 -0800 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.220,1.221 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv19234/python/nondist/peps Modified Files: pep-0000.txt Log Message: Moved informational PEPs 42 & 291; corrected title of 42. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.220 retrieving revision 1.221 diff -C2 -d -r1.220 -r1.221 *** pep-0000.txt 18 Nov 2002 10:40:44 -0000 1.220 --- pep-0000.txt 30 Nov 2002 01:55:29 -0000 1.221 *************** *** 46,49 **** --- 46,50 ---- Other Informational PEPs + I 42 Feature Requests Hylton I 101 Doing Python Releases 101 Warsaw, van Rossum I 102 Doing Python Micro Releases Baxter, Warsaw, van Rossum *************** *** 54,57 **** --- 55,59 ---- IF 272 API for Block Encryption Algorithms v1.0 Kuchling I 290 Code Migration and Modernization Hettinger + I 291 Backward Compatibility for Standard Library Norwitz Accepted PEPs (accepted; may not be implemented yet) *************** *** 62,66 **** Open PEPs (under consideration) - I 42 Small Feature Requests Hylton I 206 2.0 Batteries Included Zadka S 209 Adding Multidimensional Arrays Barrett, Oliphant --- 64,67 ---- *************** *** 96,100 **** I 287 reStructuredText Docstring Format Goodger S 288 Generators Attributes and Exceptions Hettinger - I 291 Backward Compatibility for Standard Library Norwitz S 292 Simpler String Substitutions Warsaw S 294 Type Names in the types Module Tirosh --- 97,100 ---- *************** *** 187,191 **** I 11 Removing support for little used platforms von Loewis I 12 Sample reStructuredText PEP Template Goodger, Warsaw ! I 42 Small Feature Requests Hylton SF 100 Python Unicode Integration Lemburg --- 187,191 ---- I 11 Removing support for little used platforms von Loewis I 12 Sample reStructuredText PEP Template Goodger, Warsaw ! I 42 Feature Requests Hylton SF 100 Python Unicode Integration Lemburg From ping@users.sourceforge.net Sat Nov 30 03:53:17 2002 From: ping@users.sourceforge.net (ping@users.sourceforge.net) Date: Fri, 29 Nov 2002 19:53:17 -0800 Subject: [Python-checkins] python/dist/src/Lib inspect.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv18609 Modified Files: inspect.py Log Message: getdoc(): Remove leading whitespace from first line; remove leading and trailing blank lines from docstrings. (Patch 645938 submitted by David Goodger.) Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** inspect.py 15 Aug 2002 14:59:00 -0000 1.38 --- inspect.py 30 Nov 2002 03:53:14 -0000 1.39 *************** *** 276,288 **** return None else: ! margin = None for line in lines[1:]: content = len(string.lstrip(line)) ! if not content: continue ! indent = len(line) - content ! if margin is None: margin = indent ! else: margin = min(margin, indent) ! if margin is not None: for i in range(1, len(lines)): lines[i] = lines[i][margin:] return string.join(lines, '\n') --- 276,296 ---- return None else: ! # Find minimum indentation of any non-blank lines after first line. ! margin = sys.maxint for line in lines[1:]: content = len(string.lstrip(line)) ! if content: ! indent = len(line) - content ! margin = min(margin, indent) ! # Remove indentation. ! if lines: ! lines[0] = lines[0].lstrip() ! if margin < sys.maxint: for i in range(1, len(lines)): lines[i] = lines[i][margin:] + # Remove any trailing or leading blank lines. + while lines and not lines[-1]: + lines.pop() + while lines and not lines[0]: + lines.pop(0) return string.join(lines, '\n') From ping@users.sourceforge.net Sat Nov 30 03:53:17 2002 From: ping@users.sourceforge.net (ping@users.sourceforge.net) Date: Fri, 29 Nov 2002 19:53:17 -0800 Subject: [Python-checkins] python/dist/src/Lib/test test_inspect.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv18609/test Modified Files: test_inspect.py Log Message: getdoc(): Remove leading whitespace from first line; remove leading and trailing blank lines from docstrings. (Patch 645938 submitted by David Goodger.) Index: test_inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_inspect.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_inspect.py 23 Jul 2002 19:03:55 -0000 1.8 --- test_inspect.py 30 Nov 2002 03:53:15 -0000 1.9 *************** *** 145,149 **** 'A longer,\n\nindented\n\ndocstring.', 'getdoc(mod.StupidGit)') test(inspect.getdoc(git.abuse) == ! 'Another\n\ndocstring\n\ncontaining\n\ntabs\n\n', 'getdoc(git.abuse)') test(inspect.getcomments(mod.StupidGit) == '# line 20\n', 'getcomments(mod.StupidGit)') --- 145,149 ---- 'A longer,\n\nindented\n\ndocstring.', 'getdoc(mod.StupidGit)') test(inspect.getdoc(git.abuse) == ! 'Another\n\ndocstring\n\ncontaining\n\ntabs', 'getdoc(git.abuse)') test(inspect.getcomments(mod.StupidGit) == '# line 20\n', 'getcomments(mod.StupidGit)') From jvr@users.sourceforge.net Sat Nov 30 19:56:16 2002 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sat, 30 Nov 2002 11:56:16 -0800 Subject: [Python-checkins] python/dist/src/Mac/Lib bundlebuilder.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv29612 Modified Files: bundlebuilder.py Log Message: - found a case where sys.path[0] isn't set to Contents/Resources, so search the entire path. - only add modules if we're building a standalone application. Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/bundlebuilder.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** bundlebuilder.py 29 Nov 2002 21:22:33 -0000 1.13 --- bundlebuilder.py 30 Nov 2002 19:56:14 -0000 1.14 *************** *** 231,235 **** EXT_LOADER = """\ import imp, sys, os ! path = os.path.join(sys.path[0], "%(filename)s") mod = imp.load_dynamic("%(name)s", path) sys.modules["%(name)s"] = mod --- 231,240 ---- EXT_LOADER = """\ import imp, sys, os ! for p in sys.path: ! path = os.path.join(p, "%(filename)s") ! if os.path.exists(path): ! break ! else: ! assert 0, "file not found: %(filename)s" mod = imp.load_dynamic("%(name)s", path) sys.modules["%(name)s"] = mod *************** *** 362,366 **** def postProcess(self): ! self.addPythonModules() if self.strip and not self.symlink: self.stripBinaries() --- 367,372 ---- def postProcess(self): ! if self.standalone: ! self.addPythonModules() if self.strip and not self.symlink: self.stripBinaries() From gward@users.sourceforge.net Sat Nov 30 22:47:47 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sat, 30 Nov 2002 14:47:47 -0800 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv4678 Added Files: ossaudiodev.c Log Message: ossaudiodev -- Python interface to the OSS (Open Sound System) API. This module is a replacement for linuxaudiodev, which will eventually be deprecated. Initial revision is rev 2.20 of linuxaudiodev.c, with a rewritten header comment. --- NEW FILE: ossaudiodev.c --- /* * ossaudiodev -- Python interface to the OSS (Open Sound System) API. * This is the standard audio API for Linux and some * flavours of BSD [XXX which ones?]; it is also available * for a wide range of commercial Unices. * * Originally written by Peter Bosch, March 2000, as linuxaudiodev. * * Renamed to ossaudiodev and rearranged/revised/hacked up * by Greg Ward , November 2002. * * (c) 2000 Peter Bosch. All Rights Reserved. * (c) 2002 Gregory P. Ward. All Rights Reserved. * (c) 2002 Python Software Foundation. All Rights Reserved. * * XXX need a license statement * * $Id: ossaudiodev.c,v 1.1 2002/11/30 22:47:45 gward Exp $ */ #include "Python.h" #include "structmember.h" #ifdef HAVE_FCNTL_H #include #else #define O_RDONLY 00 #define O_WRONLY 01 #endif #include #if defined(linux) #include typedef unsigned long uint32_t; #elif defined(__FreeBSD__) #include #ifndef SNDCTL_DSP_CHANNELS #define SNDCTL_DSP_CHANNELS SOUND_PCM_WRITE_CHANNELS #endif #endif typedef struct { PyObject_HEAD; int x_fd; /* The open file */ int x_mode; /* file mode */ int x_icount; /* Input count */ int x_ocount; /* Output count */ uint32_t x_afmts; /* Audio formats supported by hardware*/ } lad_t; /* XXX several format defined in soundcard.h are not supported, including _NE (native endian) options and S32 options */ static struct { int a_bps; uint32_t a_fmt; char *a_name; } audio_types[] = { { 8, AFMT_MU_LAW, "logarithmic mu-law 8-bit audio" }, { 8, AFMT_A_LAW, "logarithmic A-law 8-bit audio" }, { 8, AFMT_U8, "linear unsigned 8-bit audio" }, { 8, AFMT_S8, "linear signed 8-bit audio" }, { 16, AFMT_U16_BE, "linear unsigned 16-bit big-endian audio" }, { 16, AFMT_U16_LE, "linear unsigned 16-bit little-endian audio" }, { 16, AFMT_S16_BE, "linear signed 16-bit big-endian audio" }, { 16, AFMT_S16_LE, "linear signed 16-bit little-endian audio" }, { 16, AFMT_S16_NE, "linear signed 16-bit native-endian audio" }, }; static int n_audio_types = sizeof(audio_types) / sizeof(audio_types[0]); static PyTypeObject Ladtype; static PyObject *LinuxAudioError; static lad_t * newladobject(PyObject *arg) { lad_t *xp; int fd, afmts, imode; char *basedev = NULL; char *mode = NULL; /* Two ways to call linuxaudiodev.open(): open(device, mode) (for consistency with builtin open()) open(mode) (for backwards compatibility) because the *first* argument is optional, parsing args is a wee bit tricky. */ if (!PyArg_ParseTuple(arg, "s|s:open", &basedev, &mode)) return NULL; if (mode == NULL) { /* only one arg supplied */ mode = basedev; basedev = NULL; } if (strcmp(mode, "r") == 0) imode = O_RDONLY; else if (strcmp(mode, "w") == 0) imode = O_WRONLY; else { PyErr_SetString(LinuxAudioError, "mode should be 'r' or 'w'"); return NULL; } /* Open the correct device. The base device name comes from the * AUDIODEV environment variable first, then /dev/dsp. The * control device tacks "ctl" onto the base device name. * * Note that the only difference between /dev/audio and /dev/dsp * is that the former uses logarithmic mu-law encoding and the * latter uses 8-bit unsigned encoding. */ if (basedev == NULL) { /* called with one arg */ basedev = getenv("AUDIODEV"); if (basedev == NULL) /* $AUDIODEV not set */ basedev = "/dev/dsp"; } if ((fd = open(basedev, imode)) == -1) { PyErr_SetFromErrnoWithFilename(LinuxAudioError, basedev); return NULL; } if (imode == O_WRONLY && ioctl(fd, SNDCTL_DSP_NONBLOCK, NULL) == -1) { PyErr_SetFromErrnoWithFilename(LinuxAudioError, basedev); return NULL; } if (ioctl(fd, SNDCTL_DSP_GETFMTS, &afmts) == -1) { PyErr_SetFromErrnoWithFilename(LinuxAudioError, basedev); return NULL; } /* Create and initialize the object */ if ((xp = PyObject_New(lad_t, &Ladtype)) == NULL) { close(fd); return NULL; } xp->x_fd = fd; xp->x_mode = imode; xp->x_icount = xp->x_ocount = 0; xp->x_afmts = afmts; return xp; } static void lad_dealloc(lad_t *xp) { /* if already closed, don't reclose it */ if (xp->x_fd != -1) close(xp->x_fd); PyObject_Del(xp); } static PyObject * lad_read(lad_t *self, PyObject *args) { int size, count; char *cp; PyObject *rv; if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; rv = PyString_FromStringAndSize(NULL, size); if (rv == NULL) return NULL; cp = PyString_AS_STRING(rv); if ((count = read(self->x_fd, cp, size)) < 0) { PyErr_SetFromErrno(LinuxAudioError); Py_DECREF(rv); return NULL; } self->x_icount += count; _PyString_Resize(&rv, count); return rv; } static PyObject * lad_write(lad_t *self, PyObject *args) { char *cp; int rv, size; fd_set write_set_fds; struct timeval tv; int select_retval; if (!PyArg_ParseTuple(args, "s#:write", &cp, &size)) return NULL; /* use select to wait for audio device to be available */ FD_ZERO(&write_set_fds); FD_SET(self->x_fd, &write_set_fds); tv.tv_sec = 4; /* timeout values */ tv.tv_usec = 0; while (size > 0) { select_retval = select(self->x_fd+1, NULL, &write_set_fds, NULL, &tv); tv.tv_sec = 1; tv.tv_usec = 0; /* willing to wait this long next time*/ if (select_retval) { if ((rv = write(self->x_fd, cp, size)) == -1) { if (errno != EAGAIN) { PyErr_SetFromErrno(LinuxAudioError); return NULL; } else { errno = 0; /* EAGAIN: buffer is full, try again */ } } else { self->x_ocount += rv; size -= rv; cp += rv; } } else { /* printf("Not able to write to linux audio device within %ld seconds\n", tv.tv_sec); */ PyErr_SetFromErrno(LinuxAudioError); return NULL; } } Py_INCREF(Py_None); return Py_None; } static PyObject * lad_close(lad_t *self, PyObject *args) { if (!PyArg_ParseTuple(args, ":close")) return NULL; if (self->x_fd >= 0) { close(self->x_fd); self->x_fd = -1; } Py_INCREF(Py_None); return Py_None; } static PyObject * lad_fileno(lad_t *self, PyObject *args) { if (!PyArg_ParseTuple(args, ":fileno")) return NULL; return PyInt_FromLong(self->x_fd); } static PyObject * lad_setparameters(lad_t *self, PyObject *args) { int rate, ssize, nchannels, n, fmt, emulate=0; if (!PyArg_ParseTuple(args, "iiii|i:setparameters", &rate, &ssize, &nchannels, &fmt, &emulate)) return NULL; if (rate < 0) { PyErr_Format(PyExc_ValueError, "expected rate >= 0, not %d", rate); return NULL; } if (ssize < 0) { PyErr_Format(PyExc_ValueError, "expected sample size >= 0, not %d", ssize); return NULL; } if (nchannels != 1 && nchannels != 2) { PyErr_Format(PyExc_ValueError, "nchannels must be 1 or 2, not %d", nchannels); return NULL; } for (n = 0; n < n_audio_types; n++) if (fmt == audio_types[n].a_fmt) break; if (n == n_audio_types) { PyErr_Format(PyExc_ValueError, "unknown audio encoding: %d", fmt); return NULL; } if (audio_types[n].a_bps != ssize) { PyErr_Format(PyExc_ValueError, "for %s, expected sample size %d, not %d", audio_types[n].a_name, audio_types[n].a_bps, ssize); return NULL; } if (emulate == 0) { if ((self->x_afmts & audio_types[n].a_fmt) == 0) { PyErr_Format(PyExc_ValueError, "%s format not supported by device", audio_types[n].a_name); return NULL; } } if (ioctl(self->x_fd, SNDCTL_DSP_SETFMT, &audio_types[n].a_fmt) == -1) { PyErr_SetFromErrno(LinuxAudioError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_CHANNELS, &nchannels) == -1) { PyErr_SetFromErrno(LinuxAudioError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_SPEED, &rate) == -1) { PyErr_SetFromErrno(LinuxAudioError); return NULL; } Py_INCREF(Py_None); return Py_None; } static int _ssize(lad_t *self, int *nchannels, int *ssize) { int fmt; fmt = 0; if (ioctl(self->x_fd, SNDCTL_DSP_SETFMT, &fmt) < 0) return -errno; switch (fmt) { case AFMT_MU_LAW: case AFMT_A_LAW: case AFMT_U8: case AFMT_S8: *ssize = sizeof(char); break; case AFMT_S16_LE: case AFMT_S16_BE: case AFMT_U16_LE: case AFMT_U16_BE: *ssize = sizeof(short); break; case AFMT_MPEG: case AFMT_IMA_ADPCM: default: return -EOPNOTSUPP; } *nchannels = 0; if (ioctl(self->x_fd, SNDCTL_DSP_CHANNELS, nchannels) < 0) return -errno; return 0; } /* bufsize returns the size of the hardware audio buffer in number of samples */ static PyObject * lad_bufsize(lad_t *self, PyObject *args) { audio_buf_info ai; int nchannels, ssize; if (!PyArg_ParseTuple(args, ":bufsize")) return NULL; if (_ssize(self, &nchannels, &ssize) < 0) { PyErr_SetFromErrno(LinuxAudioError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_GETOSPACE, &ai) < 0) { PyErr_SetFromErrno(LinuxAudioError); return NULL; } return PyInt_FromLong((ai.fragstotal * ai.fragsize) / (nchannels * ssize)); } /* obufcount returns the number of samples that are available in the hardware for playing */ static PyObject * lad_obufcount(lad_t *self, PyObject *args) { audio_buf_info ai; int nchannels, ssize; if (!PyArg_ParseTuple(args, ":obufcount")) return NULL; if (_ssize(self, &nchannels, &ssize) < 0) { PyErr_SetFromErrno(LinuxAudioError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_GETOSPACE, &ai) < 0) { PyErr_SetFromErrno(LinuxAudioError); return NULL; } return PyInt_FromLong((ai.fragstotal * ai.fragsize - ai.bytes) / (ssize * nchannels)); } /* obufcount returns the number of samples that can be played without blocking */ static PyObject * lad_obuffree(lad_t *self, PyObject *args) { audio_buf_info ai; int nchannels, ssize; if (!PyArg_ParseTuple(args, ":obuffree")) return NULL; if (_ssize(self, &nchannels, &ssize) < 0) { PyErr_SetFromErrno(LinuxAudioError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_GETOSPACE, &ai) < 0) { PyErr_SetFromErrno(LinuxAudioError); return NULL; } return PyInt_FromLong(ai.bytes / (ssize * nchannels)); } /* Flush the device */ static PyObject * lad_flush(lad_t *self, PyObject *args) { if (!PyArg_ParseTuple(args, ":flush")) return NULL; if (ioctl(self->x_fd, SNDCTL_DSP_SYNC, NULL) == -1) { PyErr_SetFromErrno(LinuxAudioError); return NULL; } Py_INCREF(Py_None); return Py_None; } static PyObject * lad_getptr(lad_t *self, PyObject *args) { count_info info; int req; if (!PyArg_ParseTuple(args, ":getptr")) return NULL; if (self->x_mode == O_RDONLY) req = SNDCTL_DSP_GETIPTR; else req = SNDCTL_DSP_GETOPTR; if (ioctl(self->x_fd, req, &info) == -1) { PyErr_SetFromErrno(LinuxAudioError); return NULL; } return Py_BuildValue("iii", info.bytes, info.blocks, info.ptr); } static PyMethodDef lad_methods[] = { { "read", (PyCFunction)lad_read, METH_VARARGS }, { "write", (PyCFunction)lad_write, METH_VARARGS }, { "setparameters", (PyCFunction)lad_setparameters, METH_VARARGS }, { "bufsize", (PyCFunction)lad_bufsize, METH_VARARGS }, { "obufcount", (PyCFunction)lad_obufcount, METH_VARARGS }, { "obuffree", (PyCFunction)lad_obuffree, METH_VARARGS }, { "flush", (PyCFunction)lad_flush, METH_VARARGS }, { "close", (PyCFunction)lad_close, METH_VARARGS }, { "fileno", (PyCFunction)lad_fileno, METH_VARARGS }, { "getptr", (PyCFunction)lad_getptr, METH_VARARGS }, { NULL, NULL} /* sentinel */ }; static PyObject * lad_getattr(lad_t *xp, char *name) { return Py_FindMethod(lad_methods, (PyObject *)xp, name); } static PyTypeObject Ladtype = { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ "linuxaudiodev.linux_audio_device", /*tp_name*/ sizeof(lad_t), /*tp_size*/ 0, /*tp_itemsize*/ /* methods */ (destructor)lad_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc)lad_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ }; static PyObject * ladopen(PyObject *self, PyObject *args) { return (PyObject *)newladobject(args); } static PyMethodDef linuxaudiodev_methods[] = { { "open", ladopen, METH_VARARGS }, { 0, 0 }, }; void initlinuxaudiodev(void) { PyObject *m; m = Py_InitModule("linuxaudiodev", linuxaudiodev_methods); LinuxAudioError = PyErr_NewException("linuxaudiodev.error", NULL, NULL); if (LinuxAudioError) PyModule_AddObject(m, "error", LinuxAudioError); if (PyModule_AddIntConstant(m, "AFMT_MU_LAW", (long)AFMT_MU_LAW) == -1) return; if (PyModule_AddIntConstant(m, "AFMT_A_LAW", (long)AFMT_A_LAW) == -1) return; if (PyModule_AddIntConstant(m, "AFMT_U8", (long)AFMT_U8) == -1) return; if (PyModule_AddIntConstant(m, "AFMT_S8", (long)AFMT_S8) == -1) return; if (PyModule_AddIntConstant(m, "AFMT_U16_BE", (long)AFMT_U16_BE) == -1) return; if (PyModule_AddIntConstant(m, "AFMT_U16_LE", (long)AFMT_U16_LE) == -1) return; if (PyModule_AddIntConstant(m, "AFMT_S16_BE", (long)AFMT_S16_BE) == -1) return; if (PyModule_AddIntConstant(m, "AFMT_S16_LE", (long)AFMT_S16_LE) == -1) return; if (PyModule_AddIntConstant(m, "AFMT_S16_NE", (long)AFMT_S16_NE) == -1) return; return; } From gward@users.sourceforge.net Sat Nov 30 22:56:46 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sat, 30 Nov 2002 14:56:46 -0800 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv10973 Modified Files: ossaudiodev.c Log Message: * Don't put the device in non-blocking mode at open() time; this makes it impossible to access blocking mode! * Rename write() to writeall(), and add a write() method that just does one write(). * Rearrange/simplify writeall(): in particular, don't supply a timeout to select(). Let it block forever if it has to. * Add a bunch of simple ioctl() wrappers: nonblock(), setfmt(), getfmts(), channels(), speed(), sync(), reset(), post(). These wrap, respectively, SNDCTL_DSP_NONBLOCK, SNDCTL_DSP_SETFMT, SNDCTL_DSP_GETFMTS, etc. * Reduce flush() (which was a wrapper for the SNDCTL_DSP_SYNC ioctl) to an alias for sync(). * Rearrange the lad_methods list to reflect the order in which the methods are defined, and add some grouping comments. Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ossaudiodev.c 30 Nov 2002 22:47:45 -0000 1.1 --- ossaudiodev.c 30 Nov 2002 22:56:44 -0000 1.2 *************** *** 128,135 **** return NULL; } - if (imode == O_WRONLY && ioctl(fd, SNDCTL_DSP_NONBLOCK, NULL) == -1) { - PyErr_SetFromErrnoWithFilename(LinuxAudioError, basedev); - return NULL; - } if (ioctl(fd, SNDCTL_DSP_GETFMTS, &afmts) == -1) { PyErr_SetFromErrnoWithFilename(LinuxAudioError, basedev); --- 128,131 ---- *************** *** 157,160 **** --- 153,273 ---- } + + /* Methods to wrap the OSS ioctls. The calling convention is pretty + simple: + nonblock() -> ioctl(fd, SNDCTL_DSP_NONBLOCK) + fmt = setfmt(fmt) -> ioctl(fd, SNDCTL_DSP_SETFMT, &fmt) + etc. + */ + + + /* _do_ioctl_1() is a private helper function used for the OSS ioctls -- + SNDCTL_DSP_{SETFMT,CHANNELS,SPEED} -- that that are called from C + like this: + ioctl(fd, SNDCTL_DSP_cmd, &arg) + + where arg is the value to set, and on return the driver sets arg to + the value that was actually set. Mapping this to Python is obvious: + arg = dsp.xxx(arg) + */ + static PyObject * + _do_ioctl_1(lad_t *self, PyObject *args, char *fname, int cmd) + { + char argfmt[13] = "i:"; + int arg; + + assert(strlen(fname) <= 10); + strcat(argfmt, fname); + if (!PyArg_ParseTuple(args, argfmt, &arg)) + return NULL; + + if (ioctl(self->x_fd, cmd, &arg) == -1) + return PyErr_SetFromErrno(LinuxAudioError); + return PyInt_FromLong(arg); + } + + /* _do_ioctl_0() is a private helper for the no-argument ioctls: + SNDCTL_DSP_{SYNC,RESET,POST}. */ + static PyObject * + _do_ioctl_0(lad_t *self, PyObject *args, char *fname, int cmd) + { + char argfmt[12] = ":"; + + assert(strlen(fname) <= 10); + strcat(argfmt, fname); + if (!PyArg_ParseTuple(args, argfmt)) + return NULL; + + if (ioctl(self->x_fd, cmd, 0) == -1) + return PyErr_SetFromErrno(LinuxAudioError); + Py_INCREF(Py_None); + return Py_None; + } + + + static PyObject * + lad_nonblock(lad_t *self, PyObject *args) + { + /* Hmmm: it doesn't appear to be possible to return to blocking + mode once we're in non-blocking mode! */ + if (!PyArg_ParseTuple(args, ":nonblock")) + return NULL; + if (ioctl(self->x_fd, SNDCTL_DSP_NONBLOCK, NULL) == -1) + return PyErr_SetFromErrno(LinuxAudioError); + Py_INCREF(Py_None); + return Py_None; + } + + static PyObject * + lad_setfmt(lad_t *self, PyObject *args) + { + return _do_ioctl_1(self, args, "setfmt", SNDCTL_DSP_SETFMT); + } + + static PyObject * + lad_getfmts(lad_t *self, PyObject *args) + { + int mask; + if (!PyArg_ParseTuple(args, ":getfmts")) + return NULL; + if (ioctl(self->x_fd, SNDCTL_DSP_GETFMTS, &mask) == -1) + return PyErr_SetFromErrno(LinuxAudioError); + return PyInt_FromLong(mask); + } + + static PyObject * + lad_channels(lad_t *self, PyObject *args) + { + return _do_ioctl_1(self, args, "channels", SNDCTL_DSP_CHANNELS); + } + + static PyObject * + lad_speed(lad_t *self, PyObject *args) + { + return _do_ioctl_1(self, args, "speed", SNDCTL_DSP_SPEED); + } + + static PyObject * + lad_sync(lad_t *self, PyObject *args) + { + return _do_ioctl_0(self, args, "sync", SNDCTL_DSP_SYNC); + } + + static PyObject * + lad_reset(lad_t *self, PyObject *args) + { + return _do_ioctl_0(self, args, "reset", SNDCTL_DSP_RESET); + } + + static PyObject * + lad_post(lad_t *self, PyObject *args) + { + return _do_ioctl_0(self, args, "post", SNDCTL_DSP_POST); + } + + + /* Regular file methods: read(), write(), close(), etc. as well + as one convenience method, writeall(). */ + static PyObject * lad_read(lad_t *self, PyObject *args) *************** *** 185,222 **** char *cp; int rv, size; fd_set write_set_fds; ! struct timeval tv; ! int select_retval; if (!PyArg_ParseTuple(args, "s#:write", &cp, &size)) ! return NULL; /* use select to wait for audio device to be available */ FD_ZERO(&write_set_fds); FD_SET(self->x_fd, &write_set_fds); - tv.tv_sec = 4; /* timeout values */ - tv.tv_usec = 0; while (size > 0) { ! select_retval = select(self->x_fd+1, NULL, &write_set_fds, NULL, &tv); ! tv.tv_sec = 1; tv.tv_usec = 0; /* willing to wait this long next time*/ ! if (select_retval) { ! if ((rv = write(self->x_fd, cp, size)) == -1) { ! if (errno != EAGAIN) { ! PyErr_SetFromErrno(LinuxAudioError); ! return NULL; ! } else { ! errno = 0; /* EAGAIN: buffer is full, try again */ ! } ! } else { ! self->x_ocount += rv; ! size -= rv; ! cp += rv; ! } ! } else { ! /* printf("Not able to write to linux audio device within %ld seconds\n", tv.tv_sec); */ ! PyErr_SetFromErrno(LinuxAudioError); ! return NULL; ! } } Py_INCREF(Py_None); --- 298,353 ---- char *cp; int rv, size; + + if (!PyArg_ParseTuple(args, "s#:write", &cp, &size)) { + return NULL; + } + if ((rv = write(self->x_fd, cp, size)) == -1) { + return PyErr_SetFromErrno(LinuxAudioError); + } else { + self->x_ocount += rv; + } + return PyInt_FromLong(rv); + } + + static PyObject * + lad_writeall(lad_t *self, PyObject *args) + { + char *cp; + int rv, size; fd_set write_set_fds; ! int select_rv; + /* NB. writeall() is only useful in non-blocking mode: according to + Guenter Geiger on the linux-audio-dev list + (http://eca.cx/lad/2002/11/0380.html), OSS guarantees that + write() in blocking mode consumes the whole buffer. In blocking + mode, the behaviour of write() and writeall() from Python is + indistinguishable. */ + if (!PyArg_ParseTuple(args, "s#:write", &cp, &size)) ! return NULL; /* use select to wait for audio device to be available */ FD_ZERO(&write_set_fds); FD_SET(self->x_fd, &write_set_fds); while (size > 0) { ! select_rv = select(self->x_fd+1, NULL, &write_set_fds, NULL, NULL); ! assert(select_rv != 0); /* no timeout, can't expire */ ! if (select_rv == -1) ! return PyErr_SetFromErrno(LinuxAudioError); ! ! rv = write(self->x_fd, cp, size); ! if (rv == -1) { ! if (errno == EAGAIN) { /* buffer is full, try again */ ! errno = 0; ! continue; ! } else /* it's a real error */ ! return PyErr_SetFromErrno(LinuxAudioError); ! } else { /* wrote rv bytes */ ! self->x_ocount += rv; ! size -= rv; ! cp += rv; ! } } Py_INCREF(Py_None); *************** *** 246,249 **** --- 377,384 ---- } + + /* Convenience methods: these generally wrap a couple of ioctls into one + common task. */ + static PyObject * lad_setparameters(lad_t *self, PyObject *args) *************** *** 411,428 **** } - /* Flush the device */ - static PyObject * - lad_flush(lad_t *self, PyObject *args) - { - if (!PyArg_ParseTuple(args, ":flush")) return NULL; - - if (ioctl(self->x_fd, SNDCTL_DSP_SYNC, NULL) == -1) { - PyErr_SetFromErrno(LinuxAudioError); - return NULL; - } - Py_INCREF(Py_None); - return Py_None; - } - static PyObject * lad_getptr(lad_t *self, PyObject *args) --- 546,549 ---- *************** *** 446,459 **** static PyMethodDef lad_methods[] = { { "read", (PyCFunction)lad_read, METH_VARARGS }, { "write", (PyCFunction)lad_write, METH_VARARGS }, { "setparameters", (PyCFunction)lad_setparameters, METH_VARARGS }, { "bufsize", (PyCFunction)lad_bufsize, METH_VARARGS }, { "obufcount", (PyCFunction)lad_obufcount, METH_VARARGS }, { "obuffree", (PyCFunction)lad_obuffree, METH_VARARGS }, - { "flush", (PyCFunction)lad_flush, METH_VARARGS }, - { "close", (PyCFunction)lad_close, METH_VARARGS }, - { "fileno", (PyCFunction)lad_fileno, METH_VARARGS }, { "getptr", (PyCFunction)lad_getptr, METH_VARARGS }, { NULL, NULL} /* sentinel */ }; --- 567,597 ---- static PyMethodDef lad_methods[] = { + /* Regular file methods */ { "read", (PyCFunction)lad_read, METH_VARARGS }, { "write", (PyCFunction)lad_write, METH_VARARGS }, + { "writeall", (PyCFunction)lad_writeall, METH_VARARGS }, + { "close", (PyCFunction)lad_close, METH_VARARGS }, + { "fileno", (PyCFunction)lad_fileno, METH_VARARGS }, + + /* Simple ioctl wrappers */ + { "nonblock", (PyCFunction)lad_nonblock, METH_VARARGS }, + { "setfmt", (PyCFunction)lad_setfmt, METH_VARARGS }, + { "getfmts", (PyCFunction)lad_getfmts, METH_VARARGS }, + { "channels", (PyCFunction)lad_channels, METH_VARARGS }, + { "speed", (PyCFunction)lad_speed, METH_VARARGS }, + { "sync", (PyCFunction)lad_sync, METH_VARARGS }, + { "reset", (PyCFunction)lad_reset, METH_VARARGS }, + { "post", (PyCFunction)lad_post, METH_VARARGS }, + + /* Convenience methods -- wrap a couple of ioctls together */ { "setparameters", (PyCFunction)lad_setparameters, METH_VARARGS }, { "bufsize", (PyCFunction)lad_bufsize, METH_VARARGS }, { "obufcount", (PyCFunction)lad_obufcount, METH_VARARGS }, { "obuffree", (PyCFunction)lad_obuffree, METH_VARARGS }, { "getptr", (PyCFunction)lad_getptr, METH_VARARGS }, + + /* Aliases for backwards compatibility */ + { "flush", (PyCFunction)lad_sync, METH_VARARGS }, + { NULL, NULL} /* sentinel */ }; From gward@users.sourceforge.net Sat Nov 30 23:05:28 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sat, 30 Nov 2002 15:05:28 -0800 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv13592 Modified Files: ossaudiodev.c Log Message: Added mode 'rw' for full-duplex (play and record at the same time) mode. Added _EXPORT_INT macro to export an integer constant to Python-space. Use it for all the AFMT_* constants, and update the list of AFMT_* constants to match what's in Linux 2.4: add AFMT_{QUERY,IMA_ADPCM, MPEG,AC3}. This should probably be tested with older versions of OSS, eg. with Linux 2.2 and 2.0. Export all SNDCTL_* ioctl numbers (where "all" is the set found in /usr/include/linux/soundcard.h on my Debian 3.0 system -- again Linux 2.4). Again needs to be tested with older OSS versions. Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ossaudiodev.c 30 Nov 2002 22:56:44 -0000 1.2 --- ossaudiodev.c 30 Nov 2002 23:05:26 -0000 1.3 *************** *** 104,109 **** else if (strcmp(mode, "w") == 0) imode = O_WRONLY; else { ! PyErr_SetString(LinuxAudioError, "mode should be 'r' or 'w'"); return NULL; } --- 104,111 ---- else if (strcmp(mode, "w") == 0) imode = O_WRONLY; + else if (strcmp(mode, "rw") == 0) + imode = O_RDWR; else { ! PyErr_SetString(LinuxAudioError, "mode must be 'r', 'w', or 'rw'"); return NULL; } *************** *** 629,632 **** --- 631,638 ---- }; + + #define _EXPORT_INT(mod, name) \ + if (PyModule_AddIntConstant(mod, #name, (long) (name)) == -1) return; + void initlinuxaudiodev(void) *************** *** 640,662 **** PyModule_AddObject(m, "error", LinuxAudioError); ! if (PyModule_AddIntConstant(m, "AFMT_MU_LAW", (long)AFMT_MU_LAW) == -1) ! return; ! if (PyModule_AddIntConstant(m, "AFMT_A_LAW", (long)AFMT_A_LAW) == -1) ! return; ! if (PyModule_AddIntConstant(m, "AFMT_U8", (long)AFMT_U8) == -1) ! return; ! if (PyModule_AddIntConstant(m, "AFMT_S8", (long)AFMT_S8) == -1) ! return; ! if (PyModule_AddIntConstant(m, "AFMT_U16_BE", (long)AFMT_U16_BE) == -1) ! return; ! if (PyModule_AddIntConstant(m, "AFMT_U16_LE", (long)AFMT_U16_LE) == -1) ! return; ! if (PyModule_AddIntConstant(m, "AFMT_S16_BE", (long)AFMT_S16_BE) == -1) ! return; ! if (PyModule_AddIntConstant(m, "AFMT_S16_LE", (long)AFMT_S16_LE) == -1) ! return; ! if (PyModule_AddIntConstant(m, "AFMT_S16_NE", (long)AFMT_S16_NE) == -1) ! return; ! return; } --- 646,738 ---- PyModule_AddObject(m, "error", LinuxAudioError); ! /* Expose the audio format numbers -- essential! */ ! _EXPORT_INT(m, AFMT_QUERY); ! _EXPORT_INT(m, AFMT_MU_LAW); ! _EXPORT_INT(m, AFMT_A_LAW); ! _EXPORT_INT(m, AFMT_IMA_ADPCM); ! _EXPORT_INT(m, AFMT_U8); ! _EXPORT_INT(m, AFMT_S16_LE); ! _EXPORT_INT(m, AFMT_S16_BE); ! _EXPORT_INT(m, AFMT_S8); ! _EXPORT_INT(m, AFMT_U16_LE); ! _EXPORT_INT(m, AFMT_U16_BE); ! _EXPORT_INT(m, AFMT_MPEG); ! _EXPORT_INT(m, AFMT_AC3); ! _EXPORT_INT(m, AFMT_S16_NE); ! /* Expose all the ioctl numbers for masochists who like to do this ! stuff directly. */ ! _EXPORT_INT(m, SNDCTL_COPR_HALT); ! _EXPORT_INT(m, SNDCTL_COPR_LOAD); ! _EXPORT_INT(m, SNDCTL_COPR_RCODE); ! _EXPORT_INT(m, SNDCTL_COPR_RCVMSG); ! _EXPORT_INT(m, SNDCTL_COPR_RDATA); ! _EXPORT_INT(m, SNDCTL_COPR_RESET); ! _EXPORT_INT(m, SNDCTL_COPR_RUN); ! _EXPORT_INT(m, SNDCTL_COPR_SENDMSG); ! _EXPORT_INT(m, SNDCTL_COPR_WCODE); ! _EXPORT_INT(m, SNDCTL_COPR_WDATA); ! _EXPORT_INT(m, SNDCTL_DSP_BIND_CHANNEL); ! _EXPORT_INT(m, SNDCTL_DSP_CHANNELS); ! _EXPORT_INT(m, SNDCTL_DSP_GETBLKSIZE); ! _EXPORT_INT(m, SNDCTL_DSP_GETCAPS); ! _EXPORT_INT(m, SNDCTL_DSP_GETCHANNELMASK); ! _EXPORT_INT(m, SNDCTL_DSP_GETFMTS); ! _EXPORT_INT(m, SNDCTL_DSP_GETIPTR); ! _EXPORT_INT(m, SNDCTL_DSP_GETISPACE); ! _EXPORT_INT(m, SNDCTL_DSP_GETODELAY); ! _EXPORT_INT(m, SNDCTL_DSP_GETOPTR); ! _EXPORT_INT(m, SNDCTL_DSP_GETOSPACE); ! _EXPORT_INT(m, SNDCTL_DSP_GETSPDIF); ! _EXPORT_INT(m, SNDCTL_DSP_GETTRIGGER); ! _EXPORT_INT(m, SNDCTL_DSP_MAPINBUF); ! _EXPORT_INT(m, SNDCTL_DSP_MAPOUTBUF); ! _EXPORT_INT(m, SNDCTL_DSP_NONBLOCK); ! _EXPORT_INT(m, SNDCTL_DSP_POST); ! _EXPORT_INT(m, SNDCTL_DSP_PROFILE); ! _EXPORT_INT(m, SNDCTL_DSP_RESET); ! _EXPORT_INT(m, SNDCTL_DSP_SAMPLESIZE); ! _EXPORT_INT(m, SNDCTL_DSP_SETDUPLEX); ! _EXPORT_INT(m, SNDCTL_DSP_SETFMT); ! _EXPORT_INT(m, SNDCTL_DSP_SETFRAGMENT); ! _EXPORT_INT(m, SNDCTL_DSP_SETSPDIF); ! _EXPORT_INT(m, SNDCTL_DSP_SETSYNCRO); ! _EXPORT_INT(m, SNDCTL_DSP_SETTRIGGER); ! _EXPORT_INT(m, SNDCTL_DSP_SPEED); ! _EXPORT_INT(m, SNDCTL_DSP_STEREO); ! _EXPORT_INT(m, SNDCTL_DSP_SUBDIVIDE); ! _EXPORT_INT(m, SNDCTL_DSP_SYNC); ! _EXPORT_INT(m, SNDCTL_FM_4OP_ENABLE); ! _EXPORT_INT(m, SNDCTL_FM_LOAD_INSTR); ! _EXPORT_INT(m, SNDCTL_MIDI_INFO); ! _EXPORT_INT(m, SNDCTL_MIDI_MPUCMD); ! _EXPORT_INT(m, SNDCTL_MIDI_MPUMODE); ! _EXPORT_INT(m, SNDCTL_MIDI_PRETIME); ! _EXPORT_INT(m, SNDCTL_SEQ_CTRLRATE); ! _EXPORT_INT(m, SNDCTL_SEQ_GETINCOUNT); ! _EXPORT_INT(m, SNDCTL_SEQ_GETOUTCOUNT); ! _EXPORT_INT(m, SNDCTL_SEQ_GETTIME); ! _EXPORT_INT(m, SNDCTL_SEQ_NRMIDIS); ! _EXPORT_INT(m, SNDCTL_SEQ_NRSYNTHS); ! _EXPORT_INT(m, SNDCTL_SEQ_OUTOFBAND); ! _EXPORT_INT(m, SNDCTL_SEQ_PANIC); ! _EXPORT_INT(m, SNDCTL_SEQ_PERCMODE); ! _EXPORT_INT(m, SNDCTL_SEQ_RESET); ! _EXPORT_INT(m, SNDCTL_SEQ_RESETSAMPLES); ! _EXPORT_INT(m, SNDCTL_SEQ_SYNC); ! _EXPORT_INT(m, SNDCTL_SEQ_TESTMIDI); ! _EXPORT_INT(m, SNDCTL_SEQ_THRESHOLD); ! _EXPORT_INT(m, SNDCTL_SYNTH_CONTROL); ! _EXPORT_INT(m, SNDCTL_SYNTH_ID); ! _EXPORT_INT(m, SNDCTL_SYNTH_INFO); ! _EXPORT_INT(m, SNDCTL_SYNTH_MEMAVL); ! _EXPORT_INT(m, SNDCTL_SYNTH_REMOVESAMPLE); ! _EXPORT_INT(m, SNDCTL_TMR_CONTINUE); ! _EXPORT_INT(m, SNDCTL_TMR_METRONOME); ! _EXPORT_INT(m, SNDCTL_TMR_SELECT); ! _EXPORT_INT(m, SNDCTL_TMR_SOURCE); ! _EXPORT_INT(m, SNDCTL_TMR_START); ! _EXPORT_INT(m, SNDCTL_TMR_STOP); ! _EXPORT_INT(m, SNDCTL_TMR_TEMPO); ! _EXPORT_INT(m, SNDCTL_TMR_TIMEBASE); } From gward@users.sourceforge.net Sat Nov 30 23:17:13 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sat, 30 Nov 2002 15:17:13 -0800 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv21269 Modified Files: ossaudiodev.c Log Message: Rename LinuxAudioError to OSSAudioError ('ossaudiodev.error'). Use OSSAudioError much less frequently -- all real I/O errors (ie. any time open(), read(), write(), ioctl(), or select() return an error) become IOError. OSSAudioError is only used now for bad open() mode. Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ossaudiodev.c 30 Nov 2002 23:05:26 -0000 1.3 --- ossaudiodev.c 30 Nov 2002 23:17:10 -0000 1.4 *************** *** 78,82 **** static PyTypeObject Ladtype; ! static PyObject *LinuxAudioError; static lad_t * --- 78,82 ---- static PyTypeObject Ladtype; ! static PyObject *OSSAudioError; static lad_t * *************** *** 107,111 **** imode = O_RDWR; else { ! PyErr_SetString(LinuxAudioError, "mode must be 'r', 'w', or 'rw'"); return NULL; } --- 107,111 ---- imode = O_RDWR; else { ! PyErr_SetString(OSSAudioError, "mode must be 'r', 'w', or 'rw'"); return NULL; } *************** *** 127,135 **** if ((fd = open(basedev, imode)) == -1) { ! PyErr_SetFromErrnoWithFilename(LinuxAudioError, basedev); return NULL; } if (ioctl(fd, SNDCTL_DSP_GETFMTS, &afmts) == -1) { ! PyErr_SetFromErrnoWithFilename(LinuxAudioError, basedev); return NULL; } --- 127,135 ---- if ((fd = open(basedev, imode)) == -1) { ! PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); return NULL; } if (ioctl(fd, SNDCTL_DSP_GETFMTS, &afmts) == -1) { ! PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); return NULL; } *************** *** 185,189 **** if (ioctl(self->x_fd, cmd, &arg) == -1) ! return PyErr_SetFromErrno(LinuxAudioError); return PyInt_FromLong(arg); } --- 185,189 ---- if (ioctl(self->x_fd, cmd, &arg) == -1) ! return PyErr_SetFromErrno(PyExc_IOError); return PyInt_FromLong(arg); } *************** *** 202,206 **** if (ioctl(self->x_fd, cmd, 0) == -1) ! return PyErr_SetFromErrno(LinuxAudioError); Py_INCREF(Py_None); return Py_None; --- 202,206 ---- if (ioctl(self->x_fd, cmd, 0) == -1) ! return PyErr_SetFromErrno(PyExc_IOError); Py_INCREF(Py_None); return Py_None; *************** *** 216,220 **** return NULL; if (ioctl(self->x_fd, SNDCTL_DSP_NONBLOCK, NULL) == -1) ! return PyErr_SetFromErrno(LinuxAudioError); Py_INCREF(Py_None); return Py_None; --- 216,220 ---- return NULL; if (ioctl(self->x_fd, SNDCTL_DSP_NONBLOCK, NULL) == -1) ! return PyErr_SetFromErrno(PyExc_IOError); Py_INCREF(Py_None); return Py_None; *************** *** 234,238 **** return NULL; if (ioctl(self->x_fd, SNDCTL_DSP_GETFMTS, &mask) == -1) ! return PyErr_SetFromErrno(LinuxAudioError); return PyInt_FromLong(mask); } --- 234,238 ---- return NULL; if (ioctl(self->x_fd, SNDCTL_DSP_GETFMTS, &mask) == -1) ! return PyErr_SetFromErrno(PyExc_IOError); return PyInt_FromLong(mask); } *************** *** 286,290 **** cp = PyString_AS_STRING(rv); if ((count = read(self->x_fd, cp, size)) < 0) { ! PyErr_SetFromErrno(LinuxAudioError); Py_DECREF(rv); return NULL; --- 286,290 ---- cp = PyString_AS_STRING(rv); if ((count = read(self->x_fd, cp, size)) < 0) { ! PyErr_SetFromErrno(PyExc_IOError); Py_DECREF(rv); return NULL; *************** *** 305,309 **** } if ((rv = write(self->x_fd, cp, size)) == -1) { ! return PyErr_SetFromErrno(LinuxAudioError); } else { self->x_ocount += rv; --- 305,309 ---- } if ((rv = write(self->x_fd, cp, size)) == -1) { ! return PyErr_SetFromErrno(PyExc_IOError); } else { self->x_ocount += rv; *************** *** 338,342 **** assert(select_rv != 0); /* no timeout, can't expire */ if (select_rv == -1) ! return PyErr_SetFromErrno(LinuxAudioError); rv = write(self->x_fd, cp, size); --- 338,342 ---- assert(select_rv != 0); /* no timeout, can't expire */ if (select_rv == -1) ! return PyErr_SetFromErrno(PyExc_IOError); rv = write(self->x_fd, cp, size); *************** *** 346,350 **** continue; } else /* it's a real error */ ! return PyErr_SetFromErrno(LinuxAudioError); } else { /* wrote rv bytes */ self->x_ocount += rv; --- 346,350 ---- continue; } else /* it's a real error */ ! return PyErr_SetFromErrno(PyExc_IOError); } else { /* wrote rv bytes */ self->x_ocount += rv; *************** *** 432,444 **** if (ioctl(self->x_fd, SNDCTL_DSP_SETFMT, &audio_types[n].a_fmt) == -1) { ! PyErr_SetFromErrno(LinuxAudioError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_CHANNELS, &nchannels) == -1) { ! PyErr_SetFromErrno(LinuxAudioError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_SPEED, &rate) == -1) { ! PyErr_SetFromErrno(LinuxAudioError); return NULL; } --- 432,444 ---- if (ioctl(self->x_fd, SNDCTL_DSP_SETFMT, &audio_types[n].a_fmt) == -1) { ! PyErr_SetFromErrno(PyExc_IOError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_CHANNELS, &nchannels) == -1) { ! PyErr_SetFromErrno(PyExc_IOError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_SPEED, &rate) == -1) { ! PyErr_SetFromErrno(PyExc_IOError); return NULL; } *************** *** 493,501 **** if (_ssize(self, &nchannels, &ssize) < 0) { ! PyErr_SetFromErrno(LinuxAudioError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_GETOSPACE, &ai) < 0) { ! PyErr_SetFromErrno(LinuxAudioError); return NULL; } --- 493,501 ---- if (_ssize(self, &nchannels, &ssize) < 0) { ! PyErr_SetFromErrno(PyExc_IOError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_GETOSPACE, &ai) < 0) { ! PyErr_SetFromErrno(PyExc_IOError); return NULL; } *************** *** 515,523 **** if (_ssize(self, &nchannels, &ssize) < 0) { ! PyErr_SetFromErrno(LinuxAudioError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_GETOSPACE, &ai) < 0) { ! PyErr_SetFromErrno(LinuxAudioError); return NULL; } --- 515,523 ---- if (_ssize(self, &nchannels, &ssize) < 0) { ! PyErr_SetFromErrno(PyExc_IOError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_GETOSPACE, &ai) < 0) { ! PyErr_SetFromErrno(PyExc_IOError); return NULL; } *************** *** 538,546 **** if (_ssize(self, &nchannels, &ssize) < 0) { ! PyErr_SetFromErrno(LinuxAudioError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_GETOSPACE, &ai) < 0) { ! PyErr_SetFromErrno(LinuxAudioError); return NULL; } --- 538,546 ---- if (_ssize(self, &nchannels, &ssize) < 0) { ! PyErr_SetFromErrno(PyExc_IOError); return NULL; } if (ioctl(self->x_fd, SNDCTL_DSP_GETOSPACE, &ai) < 0) { ! PyErr_SetFromErrno(PyExc_IOError); return NULL; } *************** *** 562,566 **** req = SNDCTL_DSP_GETOPTR; if (ioctl(self->x_fd, req, &info) == -1) { ! PyErr_SetFromErrno(LinuxAudioError); return NULL; } --- 562,566 ---- req = SNDCTL_DSP_GETOPTR; if (ioctl(self->x_fd, req, &info) == -1) { ! PyErr_SetFromErrno(PyExc_IOError); return NULL; } *************** *** 642,648 **** m = Py_InitModule("linuxaudiodev", linuxaudiodev_methods); ! LinuxAudioError = PyErr_NewException("linuxaudiodev.error", NULL, NULL); ! if (LinuxAudioError) ! PyModule_AddObject(m, "error", LinuxAudioError); /* Expose the audio format numbers -- essential! */ --- 642,648 ---- m = Py_InitModule("linuxaudiodev", linuxaudiodev_methods); ! OSSAudioError = PyErr_NewException("ossaudiodev.error", NULL, NULL); ! if (OSSAudioError) ! PyModule_AddObject(m, "error", OSSAudioError); /* Expose the audio format numbers -- essential! */ From gward@users.sourceforge.net Sat Nov 30 23:20:11 2002 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sat, 30 Nov 2002 15:20:11 -0800 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv25987 Modified Files: ossaudiodev.c Log Message: Expunge any remaining mentions of linuxaudiodev -- it's ossaudiodev now! Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ossaudiodev.c 30 Nov 2002 23:17:10 -0000 1.4 --- ossaudiodev.c 30 Nov 2002 23:20:09 -0000 1.5 *************** *** 88,92 **** char *mode = NULL; ! /* Two ways to call linuxaudiodev.open(): open(device, mode) (for consistency with builtin open()) open(mode) (for backwards compatibility) --- 88,92 ---- char *mode = NULL; ! /* Two ways to call open(): open(device, mode) (for consistency with builtin open()) open(mode) (for backwards compatibility) *************** *** 608,612 **** PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ ! "linuxaudiodev.linux_audio_device", /*tp_name*/ sizeof(lad_t), /*tp_size*/ 0, /*tp_itemsize*/ --- 608,612 ---- PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ ! "ossaudiodev.oss_audio_device", /*tp_name*/ sizeof(lad_t), /*tp_size*/ 0, /*tp_itemsize*/ *************** *** 621,631 **** static PyObject * ! ladopen(PyObject *self, PyObject *args) { return (PyObject *)newladobject(args); } ! static PyMethodDef linuxaudiodev_methods[] = { ! { "open", ladopen, METH_VARARGS }, { 0, 0 }, }; --- 621,631 ---- static PyObject * ! ossopen(PyObject *self, PyObject *args) { return (PyObject *)newladobject(args); } ! static PyMethodDef ossaudiodev_methods[] = { ! { "open", ossopen, METH_VARARGS }, { 0, 0 }, }; *************** *** 636,644 **** void ! initlinuxaudiodev(void) { PyObject *m; ! m = Py_InitModule("linuxaudiodev", linuxaudiodev_methods); OSSAudioError = PyErr_NewException("ossaudiodev.error", NULL, NULL); --- 636,644 ---- void ! initossaudiodev(void) { PyObject *m; ! m = Py_InitModule("ossaudiodev", ossaudiodev_methods); OSSAudioError = PyErr_NewException("ossaudiodev.error", NULL, NULL);
$type\ $idx(