pywin32-checkins Mailing List for Python for Windows Extensions (Page 54)
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(6) |
Jul
(50) |
Aug
(11) |
Sep
(24) |
Oct
(184) |
Nov
(118) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(31) |
Feb
(25) |
Mar
(34) |
Apr
(105) |
May
(49) |
Jun
(38) |
Jul
(39) |
Aug
(7) |
Sep
(98) |
Oct
(79) |
Nov
(20) |
Dec
(17) |
2005 |
Jan
(66) |
Feb
(32) |
Mar
(43) |
Apr
(30) |
May
(58) |
Jun
(30) |
Jul
(16) |
Aug
(4) |
Sep
(21) |
Oct
(42) |
Nov
(11) |
Dec
(14) |
2006 |
Jan
(42) |
Feb
(30) |
Mar
(22) |
Apr
(1) |
May
(9) |
Jun
(15) |
Jul
(20) |
Aug
(9) |
Sep
(8) |
Oct
(1) |
Nov
(9) |
Dec
(43) |
2007 |
Jan
(52) |
Feb
(45) |
Mar
(20) |
Apr
(12) |
May
(59) |
Jun
(39) |
Jul
(35) |
Aug
(31) |
Sep
(17) |
Oct
(20) |
Nov
(4) |
Dec
(4) |
2008 |
Jan
(28) |
Feb
(111) |
Mar
(4) |
Apr
(27) |
May
(40) |
Jun
(27) |
Jul
(32) |
Aug
(94) |
Sep
(87) |
Oct
(153) |
Nov
(336) |
Dec
(331) |
2009 |
Jan
(298) |
Feb
(127) |
Mar
(20) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(1) |
2010 |
Jan
(7) |
Feb
(1) |
Mar
|
Apr
|
May
(15) |
Jun
(4) |
Jul
(3) |
Aug
(28) |
Sep
(1) |
Oct
(19) |
Nov
(16) |
Dec
(6) |
2011 |
Jan
(2) |
Feb
(18) |
Mar
(17) |
Apr
(12) |
May
(5) |
Jun
(11) |
Jul
(7) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(4) |
Dec
|
2012 |
Jan
(6) |
Feb
(2) |
Mar
|
Apr
(8) |
May
(4) |
Jun
(3) |
Jul
(13) |
Aug
(27) |
Sep
(8) |
Oct
(9) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
|
Feb
(1) |
Mar
(5) |
Apr
(10) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(9) |
2014 |
Jan
(2) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
(6) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(3) |
Feb
(2) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: Mark H. <mha...@us...> - 2008-11-26 08:39:37
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18639/Pythonwin/pywin/framework/editor Modified Files: vss.py Log Message: various syntax modernizations Index: vss.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor/vss.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** vss.py 2 Oct 2008 13:03:55 -0000 1.5 --- vss.py 26 Nov 2008 08:39:33 -0000 1.6 *************** *** 83,90 **** ok = 1 except pythoncom.com_error, exc: ! msg = exc.strerror ! if exc: ! msg = exc[2] ! win32ui.MessageBox(msg, "Error checking out file") except: typ, val, tb = sys.exc_info() --- 83,87 ---- ok = 1 except pythoncom.com_error, exc: ! win32ui.MessageBox(exc.strerror, "Error checking out file") except: typ, val, tb = sys.exc_info() |
From: Mark H. <mha...@us...> - 2008-11-26 08:39:36
|
Update of /cvsroot/pywin32/pywin32/AutoDuck In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18639/AutoDuck Modified Files: document_object.py Log Message: various syntax modernizations Index: document_object.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/AutoDuck/document_object.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** document_object.py 31 May 2005 12:40:05 -0000 1.2 --- document_object.py 26 Nov 2008 08:39:32 -0000 1.3 *************** *** 78,80 **** print "Doc categories" for c in doc: ! print " ", c.id, c.label \ No newline at end of file --- 78,80 ---- print "Doc categories" for c in doc: ! print " ", c.id, c.label |
From: Mark H. <mha...@us...> - 2008-11-26 08:39:36
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18639/Pythonwin/pywin/framework Modified Files: interact.py intpyapp.py sgrepmdi.py stdin.py Log Message: various syntax modernizations Index: intpyapp.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/intpyapp.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** intpyapp.py 9 Aug 2008 16:47:07 -0000 1.11 --- intpyapp.py 26 Nov 2008 08:39:32 -0000 1.12 *************** *** 238,247 **** argType = args[0] if argStart >= len(args): ! raise TypeError, "The command line requires an additional arg." if argType=="/edit": # Load up the default application. if dde: fname = win32api.GetFullPathName(args[argStart]) ! dde.Exec("win32ui.GetApp().OpenDocumentFile(%s)" % (`fname`)) else: win32ui.GetApp().OpenDocumentFile(args[argStart]) --- 238,247 ---- argType = args[0] if argStart >= len(args): ! raise TypeError("The command line requires an additional arg.") if argType=="/edit": # Load up the default application. if dde: fname = win32api.GetFullPathName(args[argStart]) ! dde.Exec("win32ui.GetApp().OpenDocumentFile(%s)" % (repr(fname))) else: win32ui.GetApp().OpenDocumentFile(args[argStart]) *************** *** 259,263 **** scriptutils.RunScript(args[argStart], ' '.join(args[argStart+1:]), 0) elif argType=="/app": ! raise RuntimeError, "/app only supported for new instances of Pythonwin.exe" elif argType=='/new': # Allow a new instance of Pythonwin return 1 --- 259,263 ---- scriptutils.RunScript(args[argStart], ' '.join(args[argStart+1:]), 0) elif argType=="/app": ! raise RuntimeError("/app only supported for new instances of Pythonwin.exe") elif argType=='/new': # Allow a new instance of Pythonwin return 1 *************** *** 268,277 **** win32ui.MessageBox("The /dde command can only be used\r\nwhen Pythonwin is already running") else: ! raise TypeError, "Command line arguments not recognised" except: typ, val, tb = sys.exc_info() print "There was an error processing the command line args" traceback.print_exception(typ, val, tb, None, sys.stdout) ! win32ui.OutputDebug("There was a problem with the command line args - %s: %s" % (`typ`,`val`)) tb = None # Prevent a cycle --- 268,277 ---- win32ui.MessageBox("The /dde command can only be used\r\nwhen Pythonwin is already running") else: ! raise TypeError("Command line arguments not recognised") except: typ, val, tb = sys.exc_info() print "There was an error processing the command line args" traceback.print_exception(typ, val, tb, None, sys.stdout) ! win32ui.OutputDebug("There was a problem with the command line args - %s: %s" % (repr(typ),repr(val))) tb = None # Prevent a cycle *************** *** 303,307 **** # def OnDDECommand(self, command): - # print "DDE Executing", `command` try: exec command + "\n" --- 303,306 ---- *************** *** 431,437 **** # Only attempt to save editor documents. from pywin.framework.editor import editorTemplate ! docs = filter(lambda doc: doc.IsModified() and doc.GetPathName(), editorTemplate.GetDocumentList()) ! map(lambda doc: doc.OnSaveDocument(doc.GetPathName()), docs) ! win32ui.SetStatusText("%d documents saved" % len(docs), 1) def OnViewToolbarDbg(self, id, code): --- 430,439 ---- # Only attempt to save editor documents. from pywin.framework.editor import editorTemplate ! num = 0 ! for doc in editorTemplate.GetDocumentList(): ! if doc.IsModified() and doc.GetPathName(): ! num = num = 1 ! doc.OnSaveDocument(doc.GetPathName()) ! win32ui.SetStatusText("%d documents saved" % num, 1) def OnViewToolbarDbg(self, id, code): Index: interact.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/interact.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** interact.py 9 Aug 2008 16:47:07 -0000 1.17 --- interact.py 26 Nov 2008 08:39:32 -0000 1.18 *************** *** 331,335 **** return terms = (["\n" + sys.ps2] * (len(bufLines)-1)) + [''] ! for bufLine, term in map(None, bufLines, terms): if bufLine.strip(): self.write( bufLine + term ) --- 331,335 ---- return terms = (["\n" + sys.ps2] * (len(bufLines)-1)) + [''] ! for bufLine, term in zip(bufLines, terms): if bufLine.strip(): self.write( bufLine + term ) Index: sgrepmdi.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/sgrepmdi.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sgrepmdi.py 9 Aug 2008 16:47:07 -0000 1.7 --- sgrepmdi.py 26 Nov 2008 08:39:32 -0000 1.8 *************** *** 47,51 **** if os.path.isdir(d): d = d.lower() ! if not dirs.has_key(d): dirs[d] = None if recurse: --- 47,51 ---- if os.path.isdir(d): d = d.lower() ! if d not in dirs: dirs[d] = None if recurse: *************** *** 53,57 **** for sd in subdirs: sd = sd.lower() ! if not dirs.has_key(sd): dirs[sd] = None elif os.path.isfile(d): --- 53,57 ---- for sd in subdirs: sd = sd.lower() ! if d not in dirs: dirs[sd] = None elif os.path.isfile(d): *************** *** 59,63 **** else: x = None ! if os.environ.has_key(d): x = dirpath(os.environ[d]) elif d[:5] == 'HKEY_': --- 59,63 ---- else: x = None ! if d in os.environ: x = dirpath(os.environ[d]) elif d[:5] == 'HKEY_': *************** *** 80,84 **** if x: for xd in x: ! if not dirs.has_key(xd): dirs[xd] = None if recurse: --- 80,84 ---- if x: for xd in x: ! if xd not in dirs: dirs[xd] = None if recurse: *************** *** 86,90 **** for sd in subdirs: sd = sd.lower() ! if not dirs.has_key(sd): dirs[sd] = None self.dirs = [] --- 86,90 ---- for sd in subdirs: sd = sd.lower() ! if sd not in dirs: dirs[sd] = None self.dirs = [] Index: stdin.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/stdin.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** stdin.py 26 Nov 2008 01:32:08 -0000 1.6 --- stdin.py 26 Nov 2008 08:39:33 -0000 1.7 *************** *** 34,38 **** """ if self.real_file is None: ! raise AttributeError, name return getattr(self.real_file, name) --- 34,38 ---- """ if self.real_file is None: ! raise AttributeError(name) return getattr(self.real_file, name) |
From: Mark H. <mha...@us...> - 2008-11-26 08:39:36
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/ifilter/demo In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18639/com/win32comext/ifilter/demo Modified Files: filterDemo.py Log Message: various syntax modernizations Index: filterDemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/ifilter/demo/filterDemo.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** filterDemo.py 22 Jun 2004 00:53:54 -0000 1.1 --- filterDemo.py 26 Nov 2008 08:39:33 -0000 1.2 *************** *** 250,253 **** else: print propValue ! print ! \ No newline at end of file --- 250,252 ---- else: print propValue ! print |
From: Mark H. <mha...@us...> - 2008-11-26 08:39:36
|
Update of /cvsroot/pywin32/pywin32/win32/scripts In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18639/win32/scripts Modified Files: ControlService.py setup_d.py Log Message: various syntax modernizations Index: ControlService.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/scripts/ControlService.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ControlService.py 2 Sep 1999 00:19:32 -0000 1.1 --- ControlService.py 26 Nov 2008 08:39:33 -0000 1.2 *************** *** 163,167 **** self.listCtrl.SetRedraw(1) ! def OnListEvent(self, id, code): if code == win32con.LBN_SELCHANGE or code == win32con.LBN_SELCANCEL: pos = self.listCtrl.GetCurSel() --- 163,167 ---- self.listCtrl.SetRedraw(1) ! def OnListEvent(self, id, code): if code == win32con.LBN_SELCHANGE or code == win32con.LBN_SELCANCEL: pos = self.listCtrl.GetCurSel() *************** *** 184,188 **** return self.data[pos][-2:] ! def OnStartCmd(self, id, code): service = self.GetSelService() if not service: --- 184,188 ---- return self.data[pos][-2:] ! def OnStartCmd(self, id, code): service = self.GetSelService() if not service: *************** *** 193,197 **** self.ReloadData() ! def OnStopCmd(self, id, code): service = self.GetSelService() if not service: --- 193,197 ---- self.ReloadData() ! def OnStopCmd(self, id, code): service = self.GetSelService() if not service: *************** *** 202,206 **** self.ReloadData() ! def OnPauseCmd(self, id, code): service = self.GetSelService() if not service: --- 202,206 ---- self.ReloadData() ! def OnPauseCmd(self, id, code): service = self.GetSelService() if not service: *************** *** 211,215 **** self.ReloadData() ! def OnContinueCmd(self, id, code): service = self.GetSelService() if not service: --- 211,215 ---- self.ReloadData() ! def OnContinueCmd(self, id, code): service = self.GetSelService() if not service: *************** *** 220,224 **** self.ReloadData() ! def OnStartupCmd(self, id, code): service = self.GetSelService() if not service: --- 220,224 ---- self.ReloadData() ! def OnStartupCmd(self, id, code): service = self.GetSelService() if not service: Index: setup_d.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/scripts/setup_d.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** setup_d.py 4 Jun 2001 05:58:38 -0000 1.1 --- setup_d.py 26 Nov 2008 08:39:33 -0000 1.2 *************** *** 89,91 **** _domodule("pywintypes", pywintypes.__file__) ! print "System _d files were setup." \ No newline at end of file --- 89,91 ---- _domodule("pywintypes", pywintypes.__file__) ! print "System _d files were setup." |
From: Mark H. <mha...@us...> - 2008-11-26 08:39:36
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/axscript/client In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18639/com/win32comext/axscript/client Modified Files: pyscript.py scriptdispatch.py Log Message: various syntax modernizations Index: pyscript.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/client/pyscript.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pyscript.py 26 Nov 2008 01:50:18 -0000 1.12 --- pyscript.py 26 Nov 2008 08:39:33 -0000 1.13 *************** *** 54,61 **** def __getattr__(self, attr): if attr[1]=="_" and attr[:-1]=="_": ! raise AttributeError, attr rc = self._FindAttribute_(attr) if rc is None: ! raise AttributeError, attr return rc def _Close_(self): --- 54,61 ---- def __getattr__(self, attr): if attr[1]=="_" and attr[:-1]=="_": ! raise AttributeError(attr) rc = self._FindAttribute_(attr) if rc is None: ! raise AttributeError(attr) return rc def _Close_(self): *************** *** 73,77 **** except AttributeError: pass ! raise AttributeError, attr def _FindAttribute_(self, attr): --- 73,77 ---- except AttributeError: pass ! raise AttributeError(attr) def _FindAttribute_(self, attr): *************** *** 84,88 **** # (mainly b/w compat) return getattr(self._scriptEngine_.globalNameSpaceModule, attr) ! # raise AttributeError, attr class NamedScriptAttribute: --- 84,88 ---- # (mainly b/w compat) return getattr(self._scriptEngine_.globalNameSpaceModule, attr) ! # raise AttributeError(attr) class NamedScriptAttribute: *************** *** 104,108 **** if self._scriptItem_.dispatchContainer: return getattr(self._scriptItem_.dispatchContainer,attr) ! raise AttributeError, attr def __setattr__(self, attr, value): # XXX - todo - if a known item, then should call its default --- 104,108 ---- if self._scriptItem_.dispatchContainer: return getattr(self._scriptItem_.dispatchContainer,attr) ! raise AttributeError(attr) def __setattr__(self, attr, value): # XXX - todo - if a known item, then should call its default *************** *** 114,118 **** except AttributeError: pass ! raise AttributeError, attr def _Close_(self): self.__dict__['_scriptItem_'] = None --- 114,118 ---- except AttributeError: pass ! raise AttributeError(attr) def _Close_(self): self.__dict__['_scriptItem_'] = None Index: scriptdispatch.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/client/scriptdispatch.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** scriptdispatch.py 20 May 2005 23:27:54 -0000 1.4 --- scriptdispatch.py 26 Nov 2008 08:39:33 -0000 1.5 *************** *** 38,42 **** func = getattr(self.scriptNamespace, name) if not _is_callable(func): ! raise AttributeError, name # Not a function. realArgs = [] for arg in args: --- 38,42 ---- func = getattr(self.scriptNamespace, name) if not _is_callable(func): ! raise AttributeError(name) # Not a function. realArgs = [] for arg in args: *************** *** 59,63 **** ret = getattr(self.scriptNamespace, name) if _is_callable(ret): ! raise AttributeError, name # Not a property. except AttributeError: raise COMException(scode=winerror.DISP_E_MEMBERNOTFOUND) --- 59,63 ---- ret = getattr(self.scriptNamespace, name) if _is_callable(ret): ! raise AttributeError(name) # Not a property. except AttributeError: raise COMException(scode=winerror.DISP_E_MEMBERNOTFOUND) |
From: Mark H. <mha...@us...> - 2008-11-26 08:39:35
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18639 Modified Files: pywin32_postinstall.py Log Message: various syntax modernizations Index: pywin32_postinstall.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/pywin32_postinstall.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** pywin32_postinstall.py 13 Nov 2008 03:57:19 -0000 1.27 --- pywin32_postinstall.py 26 Nov 2008 08:39:32 -0000 1.28 *************** *** 317,321 **** files = glob.glob(os.path.join(lib_dir, "pywin32_system32\\*.*")) if not files: ! raise RuntimeError, "No system files to copy!!" # Try the system32 directory first - if that fails due to "access denied", # it implies a non-admin user, and we use sys.prefix --- 317,321 ---- files = glob.glob(os.path.join(lib_dir, "pywin32_system32\\*.*")) if not files: ! raise RuntimeError("No system files to copy!!") # Try the system32 directory first - if that fails due to "access denied", # it implies a non-admin user, and we use sys.prefix *************** *** 354,363 **** % dst print msg ! raise RuntimeError, msg continue raise else: ! raise RuntimeError, \ ! "You don't have enough permissions to install the system files" # Pythonwin 'compiles' config files - record them for uninstall. --- 354,363 ---- % dst print msg ! raise RuntimeError(msg) continue raise else: ! raise RuntimeError( ! "You don't have enough permissions to install the system files") # Pythonwin 'compiles' config files - record them for uninstall. |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:52
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/com/win32comext/shell/src Modified Files: Tag: py3k PyIExtractIcon.cpp PyIExtractIcon.h Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: PyIExtractIcon.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIExtractIcon.h,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** PyIExtractIcon.h 7 Oct 2003 02:32:11 -0000 1.2 --- PyIExtractIcon.h 26 Nov 2008 07:17:39 -0000 1.2.4.1 *************** *** 9,13 **** public: MAKE_PYCOM_CTOR(PyIExtractIcon); ! static IExtractIcon *GetI(PyObject *self); static PyComTypeObject type; --- 9,13 ---- public: MAKE_PYCOM_CTOR(PyIExtractIcon); ! static IExtractIconA *GetI(PyObject *self); static PyComTypeObject type; *************** *** 24,28 **** // Gateway Declaration ! class PyGExtractIcon : public PyGatewayBase, public IExtractIcon { protected: --- 24,28 ---- // Gateway Declaration ! class PyGExtractIcon : public PyGatewayBase, public IExtractIconA { protected: *************** *** 32,38 **** ! // IExtractIcon STDMETHOD(Extract)( ! LPCTSTR pszFile, UINT nIconIndex, HICON * phiconLarge, --- 32,38 ---- ! // IExtractIconA STDMETHOD(Extract)( ! LPCSTR pszFile, UINT nIconIndex, HICON * phiconLarge, *************** *** 42,46 **** STDMETHOD(GetIconLocation)( UINT uFlags, ! LPTSTR szIconFile, UINT cchMax, LPINT piIndex, --- 42,46 ---- STDMETHOD(GetIconLocation)( UINT uFlags, ! LPSTR szIconFile, UINT cchMax, LPINT piIndex, Index: PyIExtractIcon.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIExtractIcon.cpp,v retrieving revision 1.5.2.1 retrieving revision 1.5.2.2 diff -C2 -d -r1.5.2.1 -r1.5.2.2 *** PyIExtractIcon.cpp 13 Sep 2008 15:48:31 -0000 1.5.2.1 --- PyIExtractIcon.cpp 26 Nov 2008 07:17:39 -0000 1.5.2.2 *************** *** 18,24 **** } ! /* static */ IExtractIcon *PyIExtractIcon::GetI(PyObject *self) { ! return (IExtractIcon *)PyIUnknown::GetI(self); } --- 18,24 ---- } ! /* static */ IExtractIconA *PyIExtractIcon::GetI(PyObject *self) { ! return (IExtractIconA *)PyIUnknown::GetI(self); } *************** *** 26,30 **** PyObject *PyIExtractIcon::Extract(PyObject *self, PyObject *args) { ! IExtractIcon *pIEI = GetI(self); if ( pIEI == NULL ) return NULL; --- 26,30 ---- PyObject *PyIExtractIcon::Extract(PyObject *self, PyObject *args) { ! IExtractIconA *pIEI = GetI(self); if ( pIEI == NULL ) return NULL; *************** *** 35,39 **** HICON hiconSmall; PyObject *obpszFile; ! TCHAR *pszFile; UINT nIconIndex; UINT nIconSize; --- 35,39 ---- HICON hiconSmall; PyObject *obpszFile; ! char *pszFile; UINT nIconIndex; UINT nIconSize; *************** *** 41,50 **** return NULL; BOOL bPythonIsHappy = TRUE; ! if (!PyWinObject_AsTCHAR(obpszFile, &pszFile)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIEI->Extract( pszFile, nIconIndex, &hiconLarge, &hiconSmall, nIconSize ); ! PyWinObject_FreeTCHAR(pszFile); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) --- 41,50 ---- return NULL; BOOL bPythonIsHappy = TRUE; ! if (!PyWinObject_AsString(obpszFile, &pszFile)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIEI->Extract( pszFile, nIconIndex, &hiconLarge, &hiconSmall, nIconSize ); ! PyWinObject_FreeString(pszFile); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) *************** *** 62,66 **** PyObject *PyIExtractIcon::GetIconLocation(PyObject *self, PyObject *args) { ! IExtractIcon *pIEI = GetI(self); if ( pIEI == NULL ) return NULL; --- 62,66 ---- PyObject *PyIExtractIcon::GetIconLocation(PyObject *self, PyObject *args) { ! IExtractIconA *pIEI = GetI(self); if ( pIEI == NULL ) return NULL; *************** *** 71,75 **** if ( !PyArg_ParseTuple(args, "i|i:GetIconLocation", &uFlags, &cchMax)) return NULL; ! TCHAR *buf = (TCHAR *)malloc(cchMax * sizeof(TCHAR)); if (!buf) return PyErr_NoMemory(); --- 71,75 ---- if ( !PyArg_ParseTuple(args, "i|i:GetIconLocation", &uFlags, &cchMax)) return NULL; ! char *buf = (char *)malloc(cchMax * sizeof(char)); if (!buf) return PyErr_NoMemory(); *************** *** 84,88 **** return PyCom_BuildPyException(hr, pIEI, IID_IExtractIcon ); } ! PyObject *retStr = PyWinObject_FromTCHAR(buf); free(buf); return Py_BuildValue("iNii", hr, retStr, iIndex, flags); --- 84,88 ---- return PyCom_BuildPyException(hr, pIEI, IID_IExtractIcon ); } ! PyObject *retStr = PyString_FromString(buf); free(buf); return Py_BuildValue("iNii", hr, retStr, iIndex, flags); *************** *** 106,110 **** // Gateway Implementation STDMETHODIMP PyGExtractIcon::Extract( ! /* [unique][in] */ LPCTSTR pszFile, /* [unique][in] */ UINT nIconIndex, /* [out] */ HICON * phiconLarge, --- 106,110 ---- // Gateway Implementation STDMETHODIMP PyGExtractIcon::Extract( ! /* [unique][in] */ LPCSTR pszFile, /* [unique][in] */ UINT nIconIndex, /* [out] */ HICON * phiconLarge, *************** *** 114,118 **** PY_GATEWAY_METHOD; PyObject *obpszFile; ! obpszFile = PyWinObject_FromTCHAR(pszFile); PyObject *result; HRESULT hr=InvokeViaPolicy("Extract", &result, "Oii", obpszFile, nIconIndex, nIconSize); --- 114,118 ---- PY_GATEWAY_METHOD; PyObject *obpszFile; ! obpszFile = PyString_FromString(pszFile); PyObject *result; HRESULT hr=InvokeViaPolicy("Extract", &result, "Oii", obpszFile, nIconIndex, nIconSize); *************** *** 137,141 **** STDMETHODIMP PyGExtractIcon::GetIconLocation( /* [unique][in] */ UINT uFlags, ! /* [unique][out] */ LPTSTR szIconFile, /* [unique][in] */ UINT cchMax, /* [unique][out] */ LPINT piIndex, --- 137,141 ---- STDMETHODIMP PyGExtractIcon::GetIconLocation( /* [unique][in] */ UINT uFlags, ! /* [unique][out] */ LPSTR szIconFile, /* [unique][in] */ UINT cchMax, /* [unique][out] */ LPINT piIndex, *************** *** 156,163 **** else { if (PyArg_ParseTuple(result, "Oii", &obFileName, piIndex, pflags)) { ! TCHAR *filename; ! if (PyWinObject_AsTCHAR(obFileName, &filename)) { ! _tcsncpy(szIconFile, filename, cchMax); ! PyWinObject_FreeTCHAR(filename); } } --- 156,163 ---- else { if (PyArg_ParseTuple(result, "Oii", &obFileName, piIndex, pflags)) { ! char *filename; ! if (PyWinObject_AsString(obFileName, &filename)) { ! strncpy(szIconFile, filename, cchMax); ! PyWinObject_FreeString(filename); } } |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:52
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/axscript/client In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/com/win32comext/axscript/client Modified Files: Tag: py3k error.py pyscript.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: pyscript.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/client/pyscript.py,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** pyscript.py 6 May 2007 12:03:51 -0000 1.11 --- pyscript.py 26 Nov 2008 07:17:39 -0000 1.11.2.1 *************** *** 8,25 **** """ - import framework import winerror import win32com import win32api import pythoncom - from win32com.axscript import axscript - import win32com.server.register import sys import traceback - import scriptdispatch import re import win32com.client.dynamic ! from framework import RaiseAssert, trace, Exception, SCRIPTTEXT_FORCEEXECUTION, SCRIPTTEXT_ISEXPRESSION, SCRIPTTEXT_ISPERSISTENT PyScript_CLSID = "{DF630910-1C1D-11d0-AE36-8C0F5E000000}" --- 8,26 ---- """ import winerror import win32com import win32api import pythoncom import sys import traceback import re import win32com.client.dynamic + from win32com.axscript.client import framework, scriptdispatch + from win32com.axscript import axscript + import win32com.server.register ! from win32com.axscript.client.framework import \ ! RaiseAssert, trace, Exception, SCRIPTTEXT_FORCEEXECUTION, \ ! SCRIPTTEXT_ISEXPRESSION, SCRIPTTEXT_ISPERSISTENT PyScript_CLSID = "{DF630910-1C1D-11d0-AE36-8C0F5E000000}" *************** *** 41,82 **** return "PyScript - " + framework.AXScriptCodeBlock.GetDisplayName(self) - # - # Restricted execution model. - # - import rexec - class AXRExec(rexec.RExec): - ok_builtin_modules = rexec.RExec.ok_builtin_modules + ('win32trace',) - - def __init__(self, pretendMain, hooks = None, verbose = 0): - self.pretendMain = pretendMain - rexec.RExec.__init__(self, hooks, verbose) - # mods = list(self.ok_dynamic_modules) - # mods.append("win32trace") - # mods = tuple(mods) - # self.ok_dynamic_modules = mods - def make_main(self): - if not self.modules.has_key('__main__'): - self.modules['__main__'] = self.pretendMain - self.pretendMain.__builtins__ = self.modules['__builtin__'] - m = self.add_module('__main__') - - # Classes that looks and behaves like RExec, but isnt really! - import ihooks - class AXNotRHooks(ihooks.Hooks): - pass - - class AXNotRExec: - def __init__(self, pretendMain, hooks = None, verbose = 0): - self.pretendMain = pretendMain - self.hooks = hooks or AXNotRHooks(verbose) - self.modules = {'__main__': self.pretendMain} - - def add_module(self, mname): - if self.modules.has_key(mname): - return self.modules[mname] - self.modules[mname] = m = self.hooks.new_module(mname) - # m.__builtins__ = self.modules['__builtin__'] - return m - # There is only ever _one_ ax object - it exists in the global namespace # for all script items. --- 42,45 ---- *************** *** 224,228 **** self.globalNameSpaceModule = imp.new_module("__ax_main__") self.globalNameSpaceModule.__dict__['ax'] = AXScriptAttribute(self) - self.rexec_env = None # will be created first time around. self.codeBlocks = [] --- 187,190 ---- *************** *** 252,266 **** def RegisterNamedItem(self, item): - if self.rexec_env is None: - # RExec is not available in 2.2+. If we get here for IE, the - # user has explicitly run axscript_rexec, so is choosing to - # take this risk. - # if self.safetyOptions & (axscript.INTERFACESAFE_FOR_UNTRUSTED_DATA | axscript.INTERFACESAFE_FOR_UNTRUSTED_CALLER): - # # Use RExec. - # self.rexec_env = AXRExec(self.globalNameSpaceModule) - # else: - # DONT use RExec. - self.rexec_env = AXNotRExec(self.globalNameSpaceModule) - wasReg = item.isRegistered framework.COMScript.RegisterNamedItem(self, item) --- 214,217 ---- *************** *** 401,406 **** pass # ??? globalNameSpaceModule = None - - self.rexec_env = None def DllRegisterServer(): --- 352,355 ---- Index: error.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/client/error.py,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** error.py 7 May 2007 02:27:44 -0000 1.9 --- error.py 26 Nov 2008 07:17:39 -0000 1.9.2.1 *************** *** 154,173 **** tb_top = tb ! list = ['Traceback (most recent call last):\n'] ! list = list + traceback.format_list(format_items) if exc_type==pythoncom.com_error: desc = "%s (0x%x)" % (value[1], value[0]) if value[0]==winerror.DISP_E_EXCEPTION and value[2] and value[2][2]: desc = value[2][2] ! list.append("COM Error: "+desc) else: ! list = list + traceback.format_exception_only(exc_type, value) # all items in the list are utf8 courtesy of Python magically # converting unicode to utf8 before compilation. ! for i in range(len(list)): ! if type(list[i]) is str: ! #assert type(list[i]) is str, type(list[i]) ! list[i] = list[i].decode('utf8') ! self.description = ExpandTabs(u''.join(list)) # Clear tracebacks etc. tb = tb_top = tb_look = None --- 154,186 ---- tb_top = tb ! bits = ['Traceback (most recent call last):\n'] ! bits.extend(traceback.format_list(format_items)) if exc_type==pythoncom.com_error: desc = "%s (0x%x)" % (value[1], value[0]) if value[0]==winerror.DISP_E_EXCEPTION and value[2] and value[2][2]: desc = value[2][2] ! bits.append("COM Error: "+desc) else: ! bits.extend(traceback.format_exception_only(exc_type, value)) ! ! # XXX - this block appears completely bogus??? The UTF8 ! # comment below is from well before py3k, so utf8 doesn't have ! # any special status in py2k. Most likely is that this was ! # simply an artifact of an invalid test (which remains - it ! # raises a RuntimeError with a *string* with extended ! # characters.) ! # Sadly, the test still fails in the same way if you raise a ! # Unicode string with an extended char. This block keeps the ! # tests passing, so it remains. ! # XXX - todo - read the above, and fix below! ! # all items in the list are utf8 courtesy of Python magically # converting unicode to utf8 before compilation. ! for i in xrange(len(bits)): ! if type(bits[i]) is str: ! #assert type(bits[i]) is str, type(bits[i]) ! bits[i] = bits[i].decode('utf8') ! ! self.description = ExpandTabs(u''.join(bits)) # Clear tracebacks etc. tb = tb_top = tb_look = None |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:52
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/win32/src Modified Files: Tag: py3k win32clipboardmodule.cpp Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: win32clipboardmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32clipboardmodule.cpp,v retrieving revision 1.23.2.1 retrieving revision 1.23.2.2 diff -C2 -d -r1.23.2.1 -r1.23.2.2 *** win32clipboardmodule.cpp 29 Aug 2008 04:59:26 -0000 1.23.2.1 --- win32clipboardmodule.cpp 26 Nov 2008 07:17:39 -0000 1.23.2.2 *************** *** 313,316 **** --- 313,317 ---- // @pyparm int|format|CF_TEXT|Specifies a clipboard format. For a description of // the standard clipboard formats, see Standard Clipboard Formats. + // In Unicode builds (ie, python 3k), the default is CF_UNICODETEXT. #ifdef UNICODE int format = CF_UNICODETEXT; *************** *** 894,903 **** // In py3k, unicode no longer supports buffer interface if (PyUnicode_Check(obhandle)){ ! wchar_t *wchar_buf=PyUnicode_AS_UNICODE(obhandle); ! // ??? WTF None of the of Python Api functions return the correct size ??? ! bufSize = (wcslen(wchar_buf)+1) * sizeof(wchar_buf[0]); ! buf=(void *)wchar_buf; ! } ! else{ if (PyObject_AsReadBuffer(obhandle,&buf,&bufSize)==-1) return NULL; --- 895,901 ---- // In py3k, unicode no longer supports buffer interface if (PyUnicode_Check(obhandle)){ ! bufSize = PyUnicode_GET_DATA_SIZE(obhandle) + sizeof(Py_UNICODE); ! buf=(void *)PyUnicode_AS_UNICODE(obhandle); ! } else { if (PyObject_AsReadBuffer(obhandle,&buf,&bufSize)==-1) return NULL; *************** *** 946,977 **** // @pymethod int|win32clipboard|SetClipboardText|Convienience function to // call SetClipboardData with text. ! static PyObject * py_set_clipboard_text(PyObject* self, PyObject* args) { - #ifdef UNICODE - int format = CF_UNICODETEXT; - #else int format = CF_TEXT; - #endif - TCHAR *text; PyObject *obtext, *ret=NULL; ! DWORD size; ! if (!PyArg_ParseTuple(args, "O:SetClipboardText", ! &obtext)) // @pyparm str/unicode|text||The text to place on the clipboard. return NULL; ! if (!PyWinObject_AsTCHAR(obtext, &text, FALSE, &size)) ! return NULL; HGLOBAL hMem; ! LPTSTR pszDst=NULL; ! hMem = GlobalAlloc(GHND, (size+1) * sizeof(TCHAR)); if (hMem == NULL) PyWin_SetAPIError("GlobalAlloc"); else{ ! pszDst = (TCHAR *)GlobalLock(hMem); ! _tcscpy(pszDst, text); ! pszDst[size] = 0; GlobalUnlock(hMem); HANDLE data; --- 944,991 ---- // @pymethod int|win32clipboard|SetClipboardText|Convienience function to // call SetClipboardData with text. ! // @comm You may pass a Unicode or string/bytes object to this function, ! // but depending on the value of the 'format' param, it may be converted ! // to the appropriate type for that param. ! // @comm Many applications will want to call this function twice, with the ! // same string specified but CF_UNICODETEXT specified the second. static PyObject * py_set_clipboard_text(PyObject* self, PyObject* args) { int format = CF_TEXT; PyObject *obtext, *ret=NULL; ! if (!PyArg_ParseTuple(args, "O|i:SetClipboardText", ! &obtext, // @pyparm str/unicode|text||The text to place on the clipboard. ! &format)) // @pyparm int|format|CF_TEXT|The clipboard format to use - must be CF_TEXT or CF_UNICODETEXT return NULL; ! const void *src = 0; ! DWORD cb = 0; // number of bytes *excluding* NULL ! size_t size_null = 0; ! if (format == CF_TEXT) { ! if (!PyWinObject_AsString(obtext, (char **)&src, FALSE, &cb)) ! return NULL; ! size_null = sizeof(char); ! } else if (format == CF_UNICODETEXT) { ! DWORD cchars; ! if (!PyWinObject_AsWCHAR(obtext, (WCHAR **)&src, FALSE, &cchars)) ! return NULL; ! cb = cchars * sizeof(WCHAR); ! size_null = sizeof(WCHAR); ! } else { ! return PyErr_Format(PyExc_ValueError, "Format arg must be one of CF_TEXT (%d) or CF_UNICODETEXT (%d) - got %d", ! CF_TEXT, CF_UNICODETEXT, format); ! } ! HGLOBAL hMem; ! BYTE *dest=NULL; ! hMem = GlobalAlloc(GHND, cb + size_null); if (hMem == NULL) PyWin_SetAPIError("GlobalAlloc"); else{ ! dest = (BYTE *)GlobalLock(hMem); ! memcpy(dest, src, cb); ! // whack the terminator on. ! memset(dest+cb, 0, size_null); GlobalUnlock(hMem); HANDLE data; *************** *** 984,988 **** ret = PyWinLong_FromHANDLE(data); } ! PyWinObject_FreeTCHAR(text); return ret; // @pyseeapi SetClipboardData --- 998,1005 ---- ret = PyWinLong_FromHANDLE(data); } ! if (format == CF_TEXT) ! PyWinObject_FreeString((char *)src); ! else ! PyWinObject_FreeWCHAR((WCHAR *)src); return ret; // @pyseeapi SetClipboardData *************** *** 1179,1182 **** --- 1196,1206 ---- AddConstants(module); PyDict_SetItemString(dict, "error", PyWinExc_ApiError); + PyDict_SetItemString(dict,"UNICODE", + #ifdef UNICODE + Py_True + #else + Py_False + #endif + ); } *************** *** 1203,1206 **** --- 1227,1237 ---- if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError)==-1) return NULL; + PyDict_SetItemString(dict,"UNICODE", + #ifdef UNICODE + Py_True + #else + Py_False + #endif + ); return module; } |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:52
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/win32/test Modified Files: Tag: py3k test_clipboard.py test_win32event.py testall.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: testall.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/testall.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** testall.py 29 May 2007 12:22:28 -0000 1.6 --- testall.py 26 Nov 2008 07:17:39 -0000 1.6.2.1 *************** *** 6,10 **** ui_demos = """GetSaveFileName print_desktop win32cred_demo win32gui_demo win32gui_dialog win32gui_menu win32gui_taskbar ! win32rcparser_demo winprocess win32console_demo""".split() # Other demos known as 'bad' (or at least highly unlikely to work) # cerapi: no CE module is built (CE via pywin32 appears dead) --- 6,12 ---- ui_demos = """GetSaveFileName print_desktop win32cred_demo win32gui_demo win32gui_dialog win32gui_menu win32gui_taskbar ! win32rcparser_demo winprocess win32console_demo ! win32gui_devicenotify ! NetValidatePasswordPolicy""".split() # Other demos known as 'bad' (or at least highly unlikely to work) # cerapi: no CE module is built (CE via pywin32 appears dead) Index: test_clipboard.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_clipboard.py,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -C2 -d -r1.6.2.1 -r1.6.2.2 *** test_clipboard.py 29 Aug 2008 04:59:28 -0000 1.6.2.1 --- test_clipboard.py 26 Nov 2008 07:17:39 -0000 1.6.2.2 *************** *** 34,38 **** self.bmp_name = os.path.join(os.path.abspath(this_dir), "..", "Demos", "images", "smiley.bmp") ! self.failUnless(os.path.isfile(self.bmp_name)) flags = win32con.LR_DEFAULTSIZE | win32con.LR_LOADFROMFILE self.bmp_handle = win32gui.LoadImage(0, self.bmp_name, --- 34,38 ---- self.bmp_name = os.path.join(os.path.abspath(this_dir), "..", "Demos", "images", "smiley.bmp") ! self.failUnless(os.path.isfile(self.bmp_name), self.bmp_name) flags = win32con.LR_DEFAULTSIZE | win32con.LR_LOADFROMFILE self.bmp_handle = win32gui.LoadImage(0, self.bmp_name, *************** *** 60,64 **** CloseClipboard() def test_unicode(self): ! val = unicode("test-\xe0\xf2", "mbcs") SetClipboardData(win32con.CF_UNICODETEXT, val) self.failUnlessEqual(GetClipboardData(win32con.CF_UNICODETEXT), val) --- 60,64 ---- CloseClipboard() def test_unicode(self): ! val = u"test-\a9har" SetClipboardData(win32con.CF_UNICODETEXT, val) self.failUnlessEqual(GetClipboardData(win32con.CF_UNICODETEXT), val) *************** *** 66,72 **** val = "test-val" SetClipboardText(val) ! self.failUnlessEqual(GetClipboardData(win32con.CF_TEXT), val) def test_string(self): ! val = "test" SetClipboardData(win32con.CF_TEXT, val) self.failUnlessEqual(GetClipboardData(win32con.CF_TEXT), val) --- 66,77 ---- val = "test-val" SetClipboardText(val) ! # GetClipboardData doesn't to auto string conversions - so on py3k, ! # CF_TEXT returns bytes. ! expected = val.encode("ascii") ! self.failUnlessEqual(GetClipboardData(win32con.CF_TEXT), expected) ! SetClipboardText(val, win32con.CF_UNICODETEXT) ! self.failUnlessEqual(GetClipboardData(win32con.CF_UNICODETEXT), val) def test_string(self): ! val = "test".encode("ascii") SetClipboardData(win32con.CF_TEXT, val) self.failUnlessEqual(GetClipboardData(win32con.CF_TEXT), val) *************** *** 78,93 **** CloseClipboard() def test_mem(self): ! val = b"test" SetClipboardData(win32con.CF_TEXT, val) # Get the raw data - this will include the '\0' raw_data = GetGlobalMemory(GetClipboardDataHandle(win32con.CF_TEXT)) ! self.failUnlessEqual(val + '\0', raw_data) def test_bad_mem(self): - if sys.getwindowsversion()[0] > 5: - print ("skipping test_bad_mem - fails on Vista (x64 at least - not sure about x32...)") - return self.failUnlessRaises(pywintypes.error, GetGlobalMemory, 0) - self.failUnlessRaises(pywintypes.error, GetGlobalMemory, 1) self.failUnlessRaises(pywintypes.error, GetGlobalMemory, -1) def test_custom_mem(self): test_data = b"hello\x00\xff" --- 83,100 ---- CloseClipboard() def test_mem(self): ! val = "test".encode("ascii") ! expected = "test\0".encode("ascii") SetClipboardData(win32con.CF_TEXT, val) # Get the raw data - this will include the '\0' raw_data = GetGlobalMemory(GetClipboardDataHandle(win32con.CF_TEXT)) ! self.failUnlessEqual(expected, raw_data) def test_bad_mem(self): self.failUnlessRaises(pywintypes.error, GetGlobalMemory, 0) self.failUnlessRaises(pywintypes.error, GetGlobalMemory, -1) + if sys.getwindowsversion()[0] <= 5: + # For some reason, the value '1' dies from a 64bit process, but + # "works" (ie, gives the correct exception) from a 32bit process. + # just silently skip this value on Vista. + self.failUnlessRaises(pywintypes.error, GetGlobalMemory, 1) def test_custom_mem(self): test_data = b"hello\x00\xff" Index: test_win32event.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_win32event.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** test_win32event.py 25 Jan 2005 07:53:35 -0000 1.1 --- test_win32event.py 26 Nov 2008 07:17:39 -0000 1.1.4.1 *************** *** 21,24 **** --- 21,47 ---- self.failUnlessEqual(rc, win32event.WAIT_TIMEOUT) + class TestWaitFunctions(unittest.TestCase): + def testMsgWaitForMultipleObjects(self): + # this function used to segfault when called with an empty list + res = win32event.MsgWaitForMultipleObjects([], 0, 0, 0) + self.assertEquals(res, win32event.WAIT_TIMEOUT) + + def testMsgWaitForMultipleObjects2(self): + # test with non-empty list + event = win32event.CreateEvent(None, 0, 0, None) + res = win32event.MsgWaitForMultipleObjects([event], 0, 0, 0) + self.assertEquals(res, win32event.WAIT_TIMEOUT) + + def testMsgWaitForMultipleObjectsEx(self): + # this function used to segfault when called with an empty list + res = win32event.MsgWaitForMultipleObjectsEx([], 0, 0, 0) + self.assertEquals(res, win32event.WAIT_TIMEOUT) + + def testMsgWaitForMultipleObjectsEx2(self): + # test with non-empty list + event = win32event.CreateEvent(None, 0, 0, None) + res = win32event.MsgWaitForMultipleObjectsEx([event], 0, 0, 0) + self.assertEquals(res, win32event.WAIT_TIMEOUT) + if __name__=='__main__': unittest.main() |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:52
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/Pythonwin/pywin/debugger Modified Files: Tag: py3k debugger.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: debugger.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/debugger.py,v retrieving revision 1.17.2.3 retrieving revision 1.17.2.4 diff -C2 -d -r1.17.2.3 -r1.17.2.4 *** debugger.py 4 Sep 2008 20:53:56 -0000 1.17.2.3 --- debugger.py 26 Nov 2008 07:17:38 -0000 1.17.2.4 *************** *** 312,316 **** from bdb import Breakpoint ! for bplist in list(Breakpoint.bplist.values()): for bp in bplist: if id(bp)==item_id: --- 312,316 ---- from bdb import Breakpoint ! for bplist in Breakpoint.bplist.itervalues(): for bp in bplist: if id(bp)==item_id: *************** *** 326,330 **** item_id = self.GetItem(num)[6] from bdb import Breakpoint ! for bplist in list(Breakpoint.bplist.values()): for bp in bplist: if id(bp)==item_id: --- 326,330 ---- item_id = self.GetItem(num)[6] from bdb import Breakpoint ! for bplist in Breakpoint.bplist.itervalues(): for bp in bplist: if id(bp)==item_id: *************** *** 340,344 **** index = -1 from bdb import Breakpoint ! for bplist in list(Breakpoint.bplist.values()): for bp in bplist: baseName = os.path.split(bp.file)[1] --- 340,344 ---- index = -1 from bdb import Breakpoint ! for bplist in Breakpoint.bplist.itervalues(): for bp in bplist: baseName = os.path.split(bp.file)[1] *************** *** 600,608 **** return 0 if frame is self.botframe and self.skipBotFrame == SKIP_RUN: - print ('skip SKIP_RUN') self.set_continue() return 0 if frame is self.botframe and self.skipBotFrame == SKIP_STEP: - print ('skip SKIP_STEP') self.set_step() return 0 --- 600,606 ---- |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:52
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/axscript/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/com/win32comext/axscript/test Modified Files: Tag: py3k testHost.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: testHost.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/test/testHost.py,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** testHost.py 7 May 2007 02:27:44 -0000 1.5 --- testHost.py 26 Nov 2008 07:17:39 -0000 1.5.2.1 *************** *** 1,7 **** ! import string, sys from win32com.axscript.server.error import Exception from win32com.axscript import axscript from win32com.axscript.server import axsite - import pythoncom from win32com.server import util, connect import win32com.server.policy --- 1,7 ---- ! import sys ! import pythoncom from win32com.axscript.server.error import Exception from win32com.axscript import axscript from win32com.axscript.server import axsite from win32com.server import util, connect import win32com.server.policy *************** *** 31,35 **** if st is None: st = "" text = st + "\n" + (" " * (char-1)) + "^" + "\n" + exc[2] ! for line in string.split(text,"\n"): print " >" + line --- 31,35 ---- if st is None: st = "" text = st + "\n" + (" " * (char-1)) + "^" + "\n" + exc[2] ! for line in text.splitlines(): print " >" + line *************** *** 49,53 **** def echo(self, *args): ! self.last = string.join(map(str, args)) if self.verbose: for arg in args: --- 49,53 ---- def echo(self, *args): ! self.last = "".join([str(s) for s in args]) if self.verbose: for arg in args: *************** *** 127,131 **** PyScript_Exc = u"""\ def hello(arg1): ! raise RuntimeError, "exc with extended \xa9har" """ --- 127,131 ---- PyScript_Exc = u"""\ def hello(arg1): ! raise RuntimeError(u"exc with extended \xa9har") """ |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:52
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/Pythonwin/pywin Modified Files: Tag: py3k __init__.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/__init__.py,v retrieving revision 1.4.4.1 retrieving revision 1.4.4.2 diff -C2 -d -r1.4.4.1 -r1.4.4.2 *** __init__.py 29 Aug 2008 06:16:06 -0000 1.4.4.1 --- __init__.py 26 Nov 2008 07:17:38 -0000 1.4.4.2 *************** *** 1,5 **** # See if we run in Unicode mode. # This may be referenced all over the place, so we save it globally. ! import win32api, win32con, builtins # This doesn't seem to work correctly on NT - see bug 716708 --- 1,5 ---- # See if we run in Unicode mode. # This may be referenced all over the place, so we save it globally. ! import win32api, win32con # This doesn't seem to work correctly on NT - see bug 716708 *************** *** 9,11 **** default_scintilla_encoding = "utf-8" # Scintilla _only_ supports this ATM ! del win32api, win32con, builtins --- 9,11 ---- default_scintilla_encoding = "utf-8" # Scintilla _only_ supports this ATM ! del win32api, win32con |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:52
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/app In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/Pythonwin/pywin/Demos/app Modified Files: Tag: py3k customprint.py dlgappdemo.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: dlgappdemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/app/dlgappdemo.py,v retrieving revision 1.2.4.1 retrieving revision 1.2.4.2 diff -C2 -d -r1.2.4.1 -r1.2.4.2 *** dlgappdemo.py 29 Aug 2008 06:16:05 -0000 1.2.4.1 --- dlgappdemo.py 26 Nov 2008 07:17:38 -0000 1.2.4.2 *************** *** 45,47 **** from . import demoutils demoutils.NeedApp() - \ No newline at end of file --- 45,46 ---- Index: customprint.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/app/customprint.py,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** customprint.py 29 Aug 2008 06:16:05 -0000 1.3.2.1 --- customprint.py 26 Nov 2008 07:17:38 -0000 1.3.2.2 *************** *** 34,38 **** } self.pens = {} ! for name, color in list(self.colors.items()): self.pens[name] = win32ui.CreatePen(win32con.PS_SOLID, 5, color) --- 34,38 ---- } self.pens = {} ! for name, color in self.colors.iteritems(): self.pens[name] = win32ui.CreatePen(win32con.PS_SOLID, 5, color) |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:52
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/Pythonwin/pywin/framework Modified Files: Tag: py3k dlgappcore.py help.py intpyapp.py scriptutils.py startup.py stdin.py winout.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: intpyapp.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/intpyapp.py,v retrieving revision 1.11.2.2 retrieving revision 1.11.2.3 diff -C2 -d -r1.11.2.2 -r1.11.2.3 *** intpyapp.py 31 Aug 2008 08:31:27 -0000 1.11.2.2 --- intpyapp.py 26 Nov 2008 07:17:38 -0000 1.11.2.3 *************** *** 130,134 **** from . import intpydde except ImportError: - traceback.print_exc() # No dde support! return None --- 130,133 ---- *************** *** 178,181 **** --- 177,182 ---- # Allow Pythonwin to host OCX controls. win32ui.EnableControlContainer() + + # Display the interactive window if the user wants it. from . import interact interact.CreateInteractiveWindowUserPreference() *************** *** 277,286 **** def LoadSystemModules(self): ! self.DoLoadModules("editor,stdin") def LoadUserModules(self, moduleNames = None): # Load the users modules. if moduleNames is None: ! default = "sgrepmdi,mdi_pychecker" moduleNames=win32ui.GetProfileVal('Python','Startup Modules',default) self.DoLoadModules(moduleNames) --- 278,287 ---- def LoadSystemModules(self): ! self.DoLoadModules("pywin.framework.editor,pywin.framework.stdin") def LoadUserModules(self, moduleNames = None): # Load the users modules. if moduleNames is None: ! default = "pywin.framework.sgrepmdi,pywin.framework.mdi_pychecker" moduleNames=win32ui.GetProfileVal('Python','Startup Modules',default) self.DoLoadModules(moduleNames) *************** *** 291,295 **** for module in modules: try: ! exec("from . import "+module) except: # Catch em all, else the app itself dies! 'ImportError: traceback.print_exc() --- 292,296 ---- for module in modules: try: ! exec("import "+module) except: # Catch em all, else the app itself dies! 'ImportError: traceback.print_exc() Index: startup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/startup.py,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** startup.py 29 Aug 2008 06:16:42 -0000 1.4.2.1 --- startup.py 26 Nov 2008 07:17:38 -0000 1.4.2.2 *************** *** 38,42 **** sys.appargv = sys.argv[:] # Must check for /app param here. ! if len(sys.argv)>=2 and sys.argv[0].lower()=='/app': from . import cmdline moduleName = cmdline.FixArgFileName(sys.argv[1]) --- 38,42 ---- sys.appargv = sys.argv[:] # Must check for /app param here. ! if len(sys.argv)>=2 and sys.argv[0].lower()=='/app': from . import cmdline moduleName = cmdline.FixArgFileName(sys.argv[1]) *************** *** 45,49 **** # newargv.insert(0, sys.argv[0]) sys.argv = newargv ! from . import intpyapp --- 45,50 ---- # newargv.insert(0, sys.argv[0]) sys.argv = newargv ! ! # Import the module that runs our interactive app. from . import intpyapp Index: stdin.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/stdin.py,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** stdin.py 29 Aug 2008 06:16:42 -0000 1.3.2.1 --- stdin.py 26 Nov 2008 07:17:38 -0000 1.3.2.2 *************** *** 18,37 **** """ import sys - import string ! true = 1 ! false = 0 ! ! import code ! get_input_line = code.InteractiveConsole.raw_input class Stdin: def __init__(self): ! self.real_file = sys.stdin self.buffer = "" def __getattr__(self, name): """Forward most functions to the real sys.stdin for absolute realism. """ return getattr(self.real_file, name) --- 18,39 ---- """ import sys ! try: ! get_input_line = raw_input # py2x ! except NameError: ! import code ! get_input_line = code.InteractiveConsole.raw_input class Stdin: def __init__(self): ! self.real_file = sys.stdin # NOTE: Likely to be None in py3k self.buffer = "" + self.closed = False def __getattr__(self, name): """Forward most functions to the real sys.stdin for absolute realism. """ + if self.real_file is None: + raise AttributeError, name return getattr(self.real_file, name) *************** *** 49,58 **** EOF is encountered immediately. (For certain files, like ttys, it makes sense to continue reading after an EOF is hit.)""" - if self.closed: - return self.real_file.read(size) - result_size = self.__get_lines(size) return self.__extract_from_buffer(result_size) - def readline(self, size = -1): --- 51,56 ---- *************** *** 66,72 **** in the input. """ - if self.closed: - return self.real_file.readline(size) - maximum_result_size = self.__get_lines(size, lambda buffer: '\n' in buffer) --- 64,67 ---- *************** *** 87,91 **** return result ! def __get_lines(self, desired_size, done_reading = lambda buffer: false): """Keep adding lines to our internal buffer until done_reading(self.buffer) is true or EOF has been reached or we have desired_size bytes in the buffer. --- 82,86 ---- return result ! def __get_lines(self, desired_size, done_reading = lambda buffer: False): """Keep adding lines to our internal buffer until done_reading(self.buffer) is true or EOF has been reached or we have desired_size bytes in the buffer. *************** *** 100,106 **** try: self.__get_line() ! except: # deal with cancellation of get_input_line dialog desired_size = len(self.buffer) # Be satisfied! ! pass if desired_size < 0: return len(self.buffer) --- 95,101 ---- try: self.__get_line() ! except EOFError: # deal with cancellation of get_input_line dialog desired_size = len(self.buffer) # Be satisfied! ! if desired_size < 0: return len(self.buffer) *************** *** 121,127 **** (possibly after rounding up to an internal buffer size) are read. """ - if self.closed: - return self.real_file.readlines(*sizehint) - result = [] total_read = 0 --- 116,119 ---- *************** *** 161,165 **** test_input = test_input[end_of_line_pos + 1:] if len(result) == 0 or result[0] == '~': ! raise EOFError return result --- 153,157 ---- test_input = test_input[end_of_line_pos + 1:] if len(result) == 0 or result[0] == '~': ! raise EOFError() return result Index: dlgappcore.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/dlgappcore.py,v retrieving revision 1.3.4.1 retrieving revision 1.3.4.2 diff -C2 -d -r1.3.4.1 -r1.3.4.2 *** dlgappcore.py 29 Aug 2008 06:16:41 -0000 1.3.4.1 --- dlgappcore.py 26 Nov 2008 07:17:38 -0000 1.3.4.2 *************** *** 1,2 **** --- 1,6 ---- + # dlgappcore. + # + # base classes for dialog based apps. + from . import app import win32ui Index: help.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/help.py,v retrieving revision 1.12.2.2 retrieving revision 1.12.2.3 diff -C2 -d -r1.12.2.2 -r1.12.2.3 *** help.py 2 Oct 2008 13:06:36 -0000 1.12.2.2 --- help.py 26 Nov 2008 07:17:38 -0000 1.12.2.3 *************** *** 143,147 **** if helpIDMap: ! for id, (desc, fname) in list(helpIDMap.items()): otherMenu.AppendMenu(win32con.MF_ENABLED|win32con.MF_STRING,id, desc) else: --- 143,147 ---- if helpIDMap: ! for id, (desc, fname) in helpIDMap.iteritems(): otherMenu.AppendMenu(win32con.MF_ENABLED|win32con.MF_STRING,id, desc) else: Index: winout.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/winout.py,v retrieving revision 1.14.2.1 retrieving revision 1.14.2.2 diff -C2 -d -r1.14.2.1 -r1.14.2.2 *** winout.py 29 Aug 2008 06:16:42 -0000 1.14.2.1 --- winout.py 26 Nov 2008 07:17:38 -0000 1.14.2.2 *************** *** 24,28 **** from pywin.mfc import docview from pywin.framework import app, window - ## from pywintypes import UnicodeType import win32ui, win32api, win32con import queue --- 24,27 ---- *************** *** 131,139 **** return 1 except win32api.error as details: ! try: ! msg = details[2] ! except: ! msg = str(details) ! win32ui.SetStatusText("The help file could not be opened - %s" % msg) return 1 except: --- 130,134 ---- return 1 except win32api.error as details: ! win32ui.SetStatusText("The help file could not be opened - %s" % details.strerror) return 1 except: *************** *** 428,432 **** return 0 ! def QueueFlush(self, max = sys.maxsize): # Returns true if the queue is empty after the flush # debug("Queueflush - %d, %d\n" % (max, self.outputQueue.qsize())) --- 423,427 ---- return 0 ! def QueueFlush(self, max = None): # Returns true if the queue is empty after the flush # debug("Queueflush - %d, %d\n" % (max, self.outputQueue.qsize())) *************** *** 434,454 **** items = [] rc = 0 ! while max > 0: try: item = self.outputQueue.get_nowait() - ## if is_platform_unicode: - ## # Note is_platform_unicode is never true any more! - ## if not isinstance(item, UnicodeType): - ## item = str(item, default_platform_encoding) - ## item = item.encode(default_scintilla_encoding) # What scintilla uses. - ## else: - ## # try and display using mbcs encoding - ## if isinstance(item, UnicodeType): - ## item = item.encode("mbcs") items.append(item) except queue.Empty: rc = 1 break ! max = max - 1 if len(items) != 0: if not self.CheckRecreateWindow(): --- 429,441 ---- items = [] rc = 0 ! while max is None or max > 0: try: item = self.outputQueue.get_nowait() items.append(item) except queue.Empty: rc = 1 break ! if max is not None: ! max = max - 1 if len(items) != 0: if not self.CheckRecreateWindow(): Index: scriptutils.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/scriptutils.py,v retrieving revision 1.18.2.1 retrieving revision 1.18.2.2 diff -C2 -d -r1.18.2.1 -r1.18.2.2 *** scriptutils.py 29 Aug 2008 06:16:42 -0000 1.18.2.1 --- scriptutils.py 26 Nov 2008 07:17:38 -0000 1.18.2.2 *************** *** 263,269 **** try: f = open(script) ! except IOError as xxx_todo_changeme: ! (code, msg) = xxx_todo_changeme.args ! win32ui.MessageBox("The file could not be opened - %s (%d)" % (msg, code)) return --- 263,268 ---- try: f = open(script) ! except IOError as exc: ! win32ui.MessageBox("The file could not be opened - %s (%d)" % (exc.strerror, exc.errno)) return *************** *** 382,386 **** modName, modExt = os.path.splitext(modName) newPath = None ! for key, mod in list(sys.modules.items()): if hasattr(mod, '__file__'): fname = mod.__file__ --- 381,385 ---- modName, modExt = os.path.splitext(modName) newPath = None ! for key, mod in sys.modules.iteritems(): if hasattr(mod, '__file__'): fname = mod.__file__ *************** *** 460,464 **** def RunTabNanny(filename): ! import io tabnanny = FindTabNanny() if tabnanny is None: --- 459,466 ---- def RunTabNanny(filename): ! try: ! import cStringIO as io ! except ImportError: ! import io tabnanny = FindTabNanny() if tabnanny is None: |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:52
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/docking In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/Pythonwin/pywin/docking Modified Files: Tag: py3k DockingBar.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: DockingBar.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/docking/DockingBar.py,v retrieving revision 1.6.2.2 retrieving revision 1.6.2.3 diff -C2 -d -r1.6.2.2 -r1.6.2.3 *** DockingBar.py 2 Oct 2008 13:06:36 -0000 1.6.2.2 --- DockingBar.py 26 Nov 2008 07:17:38 -0000 1.6.2.3 *************** *** 24,28 **** def DeflateRect(rect, point): ! (x,y) = point return rect[0]+x, rect[1]+y, rect[2]-x, rect[3]-y --- 24,28 ---- def DeflateRect(rect, point): ! (x, y) = point return rect[0]+x, rect[1]+y, rect[2]-x, rect[3]-y |
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/com/win32com/test Modified Files: Tag: py3k errorSemantics.py policySemantics.py testAXScript.py testArrays.py testClipboard.py testDictionary.py testExplorer.py testMSOffice.py testPersist.py testPippo.py testPyComTest.py testServers.py testShell.py testall.py testvb.py util.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: testPippo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPippo.py,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** testPippo.py 3 Jun 2007 13:27:02 -0000 1.4 --- testPippo.py 26 Nov 2008 07:17:39 -0000 1.4.2.1 *************** *** 7,13 **** class PippoTester(unittest.TestCase): def setUp(self): ! # register the server ! import pippo_server ! pippo_server.main([pippo_server.__file__]) # create it. self.object = Dispatch("Python.Test.Pippo") --- 7,13 ---- class PippoTester(unittest.TestCase): def setUp(self): ! from win32com.test.util import RegisterPythonServer ! from win32com.test import pippo_server ! RegisterPythonServer(pippo_server.__file__, "Python.Test.Pippo") # create it. self.object = Dispatch("Python.Test.Pippo") Index: testArrays.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testArrays.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** testArrays.py 4 May 2004 07:03:04 -0000 1.2 --- testArrays.py 26 Nov 2008 07:17:39 -0000 1.2.4.1 *************** *** 2,6 **** # arrays patch. from win32com.client import gencache ! import util import unittest --- 2,6 ---- # arrays patch. from win32com.client import gencache ! from win32com.test import util import unittest Index: testServers.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testServers.py,v retrieving revision 1.5 retrieving revision 1.5.4.1 diff -C2 -d -r1.5 -r1.5.4.1 *** testServers.py 4 May 2004 07:01:44 -0000 1.5 --- testServers.py 26 Nov 2008 07:17:39 -0000 1.5.4.1 *************** *** 11,17 **** def setUp(self): # Ensure the correct version registered. ! from win32com.servers.interp import Interpreter ! import win32com.server.register ! win32com.server.register.RegisterClasses(Interpreter, quiet=1) def _testInterp(self, interp): --- 11,17 ---- def setUp(self): # Ensure the correct version registered. ! from win32com.test.util import RegisterPythonServer ! from win32com.servers import interp ! RegisterPythonServer(interp.__file__, "Python.Interpreter") def _testInterp(self, interp): Index: policySemantics.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/policySemantics.py,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -C2 -d -r1.4 -r1.4.4.1 *** policySemantics.py 10 Nov 2003 00:49:29 -0000 1.4 --- policySemantics.py 26 Nov 2008 07:17:39 -0000 1.4.4.1 *************** *** 23,27 **** def _Evaluate(self): # return the sum ! return reduce(lambda a,b: a+b, self.list, 0) def In(self, value): return value in self.list --- 23,27 ---- def _Evaluate(self): # return the sum ! return sum(self.list) def In(self, value): return value in self.list Index: testPyComTest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPyComTest.py,v retrieving revision 1.32 retrieving revision 1.32.2.1 diff -C2 -d -r1.32 -r1.32.2.1 *** testPyComTest.py 1 Jul 2008 00:11:57 -0000 1.32 --- testPyComTest.py 26 Nov 2008 07:17:39 -0000 1.32.2.1 *************** *** 15,19 **** # This test uses a Python implemented COM server - ensure correctly registered. ! RegisterPythonServer(os.path.join(os.path.dirname(__file__), '..', "servers", "test_pycomtest.py")) from win32com.client import gencache --- 15,20 ---- # This test uses a Python implemented COM server - ensure correctly registered. ! RegisterPythonServer(os.path.join(os.path.dirname(__file__), '..', "servers", "test_pycomtest.py"), ! "Python.Test.PyCOMTest") from win32com.client import gencache Index: util.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/util.py,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 *** util.py 11 Nov 2008 01:04:19 -0000 1.9.2.1 --- util.py 26 Nov 2008 07:17:39 -0000 1.9.2.2 *************** *** 1,3 **** --- 1,4 ---- import sys, os + import winreg as _winreg import win32api import tempfile *************** *** 14,18 **** # Ensure no lingering exceptions - Python should have zero outstanding # COM objects ! sys.exc_clear() c = _GetInterfaceCount() if c: --- 15,22 ---- # Ensure no lingering exceptions - Python should have zero outstanding # COM objects ! try: ! sys.exc_clear() ! except AttributeError: ! pass # py3k c = _GetInterfaceCount() if c: *************** *** 22,26 **** print "Warning - %d com gateway objects still alive" % c ! def RegisterPythonServer(filename, verbose=0): cmd = '%s "%s" --unattended > nul 2>&1' % (win32api.GetModuleFileName(0), filename) if verbose: --- 26,77 ---- print "Warning - %d com gateway objects still alive" % c ! def RegisterPythonServer(filename, progids=None, verbose=0): ! if progids: ! if isinstance(progids, basestring): ! progids = [progids] ! # we know the CLSIDs we need, but we might not be an admin user ! # and otherwise unable to register them. So as long as the progids ! # exist and the DLL points at our version, assume it already is. ! why_not = None ! for progid in progids: ! try: ! clsid = pythoncom.MakeIID(progid) ! except pythoncom.com_error: ! # no progid - not registered. ! break ! # have a CLSID - open it. ! try: ! HKCR = _winreg.HKEY_CLASSES_ROOT ! hk = _winreg.OpenKey(HKCR, "CLSID\\%s" % clsid) ! dll = _winreg.QueryValue(hk, "InprocServer32") ! except WindowsError: ! # no CLSID or InProcServer32 - not good! ! break ! if os.path.basename(dll) != os.path.basename(pythoncom.__file__): ! why_not = "%r is registered against a different Python version (%s)" % (progid, dll) ! break ! else: ! #print "Skipping registration of '%s' - already registered" % filename ! return ! # needs registration - see if its likely! ! try: ! from win32com.shell.shell import IsUserAnAdmin ! except ImportError: ! print "Can't import win32com.shell - no idea if you are an admin or not?" ! is_admin = False ! else: ! try: ! is_admin = IsUserAnAdmin() ! except pythoncom.com_error: ! # old, less-secure OS - assume *is* admin. ! is_admin = True ! if not is_admin: ! msg = "%r isn't registered, but I'm not an administrator who can register it." % progids[0] ! if why_not: ! msg += "\n(registration check failed as %s)" % why_not ! # throw a normal "class not registered" exception - we don't report ! # them the same way as "real" errors. ! raise pythoncom.com_error(winerror.CO_E_CLASSSTRING, msg, None, -1) ! # so theoretically we are able to register it. cmd = '%s "%s" --unattended > nul 2>&1' % (win32api.GetModuleFileName(0), filename) if verbose: *************** *** 64,68 **** func(*args, **kw) except pythoncom.com_error, details: ! if details[0]==hresult: return testcase.fail("Excepected COM exception with HRESULT 0x%x" % hresult) --- 115,119 ---- func(*args, **kw) except pythoncom.com_error, details: ! if details.hresult==hresult: return testcase.fail("Excepected COM exception with HRESULT 0x%x" % hresult) *************** *** 176,179 **** --- 227,260 ---- return test + class TestResult(unittest._TextTestResult): + def __init__(self, *args, **kw): + super(TestResult, self).__init__(*args, **kw) + self.num_invalid_clsid = 0 + + def addError(self, test, err): + """Called when an error has occurred. 'err' is a tuple of values as + returned by sys.exc_info(). + """ + if isinstance(err[1], pythoncom.com_error) and \ + err[1].hresult==winerror.CO_E_CLASSSTRING: + self.num_invalid_clsid += 1 + if self.showAll: + self.stream.writeln("SKIP") + elif self.dots: + self.stream.write('S') + self.stream.flush() + return + super(TestResult, self).addError(test, err) + + def printErrors(self): + super(TestResult, self).printErrors() + if self.num_invalid_clsid: + self.stream.writeln("SKIPPED: %d tests due to missing COM objects used for testing" % + self.num_invalid_clsid) + + class TestRunner(unittest.TextTestRunner): + def _makeResult(self): + return TestResult(self.stream, self.descriptions, self.verbosity) + # Utilities to set the win32com logger to something what just captures # records written and doesn't print them. *************** *** 244,249 **** def testmain(*args, **kw): new_kw = kw.copy() ! if not new_kw.has_key('testLoader'): new_kw['testLoader'] = TestLoader() unittest.main(*args, **new_kw) CheckClean() --- 325,332 ---- def testmain(*args, **kw): new_kw = kw.copy() ! if 'testLoader' not in new_kw: new_kw['testLoader'] = TestLoader() + if 'testRunner' not in new_kw: + new_kw['testRunner'] = TestRunner() unittest.main(*args, **new_kw) CheckClean() Index: testShell.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testShell.py,v retrieving revision 1.10.4.1 retrieving revision 1.10.4.2 diff -C2 -d -r1.10.4.1 -r1.10.4.2 *** testShell.py 13 Sep 2008 14:40:54 -0000 1.10.4.1 --- testShell.py 26 Nov 2008 07:17:39 -0000 1.10.4.2 *************** *** 4,7 **** --- 4,12 ---- import copy + try: + sys_maxsize = sys.maxsize # 2.6 and later - maxsize != maxint on 64bits + except AttributeError: + sys_maxsize = sys.maxint + import win32con import pythoncom *************** *** 18,23 **** shellLink = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink) persistFile = shellLink.QueryInterface(pythoncom.IID_IPersistFile) ! for base_name in os.listdir(desktop): ! name = os.path.join(desktop, base_name) try: persistFile.Load(name,STGM_READ) --- 23,30 ---- shellLink = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink) persistFile = shellLink.QueryInterface(pythoncom.IID_IPersistFile) ! names = [os.path.join(desktop, n) for n in os.listdir(desktop)] ! programs = str(shell.SHGetSpecialFolderPath(0, CSIDL_PROGRAMS)) ! names.extend([os.path.join(programs, n) for n in os.listdir(programs)]) ! for name in names: try: persistFile.Load(name,STGM_READ) *************** *** 31,35 **** if num == 0: # This isn't a fatal error, but is unlikely. ! print ("Could not find any links on your desktop, which is unusual") def testShellFolder(self): --- 38,42 ---- if num == 0: # This isn't a fatal error, but is unlikely. ! print ("Could not find any links on your desktop or programs dir, which is unusual") def testShellFolder(self): *************** *** 130,134 **** ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys.maxsize + 1) self._testRT(d) --- 137,141 ---- ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys_maxsize + 1) self._testRT(d) *************** *** 145,149 **** ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys.maxsize + 1), dict(cFileName="foo2.txt", sizel=(1,2), --- 152,156 ---- ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys_maxsize + 1), dict(cFileName="foo2.txt", sizel=(1,2), *************** *** 153,158 **** ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys.maxsize + 1), ! dict(cFileName="foo\xa9.txt", sizel=(1,2), pointl=(3,4), --- 160,165 ---- ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys_maxsize + 1), ! dict(cFileName=u"foo\xa9.txt", sizel=(1,2), pointl=(3,4), *************** *** 161,165 **** ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys.maxsize + 1), ] s = shell.FILEGROUPDESCRIPTORAsString(d, 1) --- 168,172 ---- ftLastAccessTime=pythoncom.MakeTime(11), ftLastWriteTime=pythoncom.MakeTime(12), ! nFileSize=sys_maxsize + 1), ] s = shell.FILEGROUPDESCRIPTORAsString(d, 1) Index: testMSOffice.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testMSOffice.py,v retrieving revision 1.7 retrieving revision 1.7.4.1 diff -C2 -d -r1.7 -r1.7.4.1 *** testMSOffice.py 18 Nov 2002 11:20:06 -0000 1.7 --- testMSOffice.py 26 Nov 2008 07:17:39 -0000 1.7.4.1 *************** *** 21,25 **** try: # NOTE - using "client.Dispatch" would return an msword8.py instance! ! print "Starting Word 8 for dynamic test" word = win32com.client.dynamic.Dispatch("Word.Application") TestWord8(word) --- 21,25 ---- try: # NOTE - using "client.Dispatch" would return an msword8.py instance! ! print ("Starting Word 8 for dynamic test") word = win32com.client.dynamic.Dispatch("Word.Application") TestWord8(word) *************** *** 27,31 **** word = None # Now we will test Dispatch without the new "lazy" capabilities ! print "Starting Word 8 for non-lazy dynamic test" dispatch = win32com.client.dynamic._GetGoodDispatch("Word.Application") typeinfo = dispatch.GetTypeInfo() --- 27,31 ---- word = None # Now we will test Dispatch without the new "lazy" capabilities ! print ("Starting Word 8 for non-lazy dynamic test") dispatch = win32com.client.dynamic._GetGoodDispatch("Word.Application") typeinfo = dispatch.GetTypeInfo() *************** *** 37,45 **** except pythoncom.com_error: ! print "Starting Word 7 for dynamic test" word = win32com.client.Dispatch("Word.Basic") TestWord7(word) ! print "Starting MSWord for generated test" from win32com.client import gencache word = gencache.EnsureDispatch("Word.Application.8") --- 37,45 ---- except pythoncom.com_error: ! print ("Starting Word 7 for dynamic test") word = win32com.client.Dispatch("Word.Basic") TestWord7(word) ! print ("Starting MSWord for generated test") from win32com.client import gencache word = gencache.EnsureDispatch("Word.Application.8") *************** *** 82,86 **** import win32com.test.Generated4Test.msword8 except ImportError: ! print "Can not do old style test" --- 82,86 ---- import win32com.test.Generated4Test.msword8 except ImportError: ! print ("Can not do old style test") *************** *** 135,166 **** def TestAll(): ! try: ! TestWord() ! ! print "Starting Excel for Dynamic test..." ! xl = win32com.client.dynamic.Dispatch("Excel.Application") ! TextExcel(xl) ! try: ! print "Starting Excel 8 for generated excel8.py test..." ! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 0, 1, 2, bForDemand=1) ! xl = win32com.client.Dispatch("Excel.Application") ! TextExcel(xl) ! except ImportError: ! print "Could not import the generated Excel 97 wrapper" ! try: ! import xl5en32 ! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 9, 1, 0) ! xl = win32com.client.Dispatch("Excel.Application.5") ! print "Starting Excel 95 for makepy test..." ! TextExcel(xl) ! except ImportError: ! print "Could not import the generated Excel 95 wrapper" ! except KeyboardInterrupt: ! print "*** Interrupted MSOffice test ***" ! except: ! traceback.print_exc() if __name__=='__main__': --- 135,160 ---- def TestAll(): ! TestWord() ! print ("Starting Excel for Dynamic test...") ! xl = win32com.client.dynamic.Dispatch("Excel.Application") ! TextExcel(xl) ! try: ! print ("Starting Excel 8 for generated excel8.py test...") ! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 0, 1, 2, bForDemand=1) ! xl = win32com.client.Dispatch("Excel.Application") ! TextExcel(xl) ! except ImportError: ! print ("Could not import the generated Excel 97 wrapper") ! try: ! import xl5en32 ! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 9, 1, 0) ! xl = win32com.client.Dispatch("Excel.Application.5") ! print ("Starting Excel 95 for makepy test...") ! TextExcel(xl) ! except ImportError: ! print ("Could not import the generated Excel 95 wrapper") if __name__=='__main__': Index: errorSemantics.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/errorSemantics.py,v retrieving revision 1.6 retrieving revision 1.6.4.1 diff -C2 -d -r1.6 -r1.6.4.1 *** errorSemantics.py 7 Sep 2004 02:10:49 -0000 1.6 --- errorSemantics.py 26 Nov 2008 07:17:39 -0000 1.6.4.1 *************** *** 32,36 **** def Commit(self, flags): ! raise "foo" def test(): --- 32,36 ---- def Commit(self, flags): ! raise Exception("foo") def test(): *************** *** 39,46 **** try: com_server.Clone() ! except pythoncom.com_error, com_exc: ! hr, desc, exc, argErr = com_exc ! if hr != winerror.E_UNEXPECTED: raise error("Calling the object natively did not yield the correct scode", com_exc) if not exc or exc[-1] != winerror.E_UNEXPECTED: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) --- 39,47 ---- try: com_server.Clone() ! raise error("Expecting this call to fail!") ! except pythoncom.com_error as com_exc: ! if com_exc.hresult != winerror.E_UNEXPECTED: raise error("Calling the object natively did not yield the correct scode", com_exc) + exc = com_exc.excepinfo if not exc or exc[-1] != winerror.E_UNEXPECTED: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) *************** *** 54,62 **** finally: cap.release() ! except pythoncom.com_error, com_exc: ! hr, desc, exc, argErr = com_exc ! if hr != winerror.E_FAIL: raise error("The hresult was not E_FAIL for an internal error", com_exc) ! if exc[1] != "Python COM Server Internal Error": raise error("The description in the exception tuple did not yield the correct string", com_exc) # Check we saw a traceback in stderr --- 55,63 ---- finally: cap.release() ! raise error("Expecting this call to fail!") ! except pythoncom.com_error as com_exc: ! if com_exc.hresult != winerror.E_FAIL: raise error("The hresult was not E_FAIL for an internal error", com_exc) ! if com_exc.excepinfo[1] != "Python COM Server Internal Error": raise error("The description in the exception tuple did not yield the correct string", com_exc) # Check we saw a traceback in stderr *************** *** 68,75 **** try: com_server.Clone() ! except pythoncom.com_error, com_exc: ! hr, desc, exc, argErr = com_exc ! if hr != winerror.DISP_E_EXCEPTION: raise error("Calling the object via IDispatch did not yield the correct scode", com_exc) if not exc or exc[-1] != winerror.E_UNEXPECTED: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) --- 69,77 ---- try: com_server.Clone() ! raise error("Expecting this call to fail!") ! except pythoncom.com_error as com_exc: ! if com_exc.hresult != winerror.DISP_E_EXCEPTION: raise error("Calling the object via IDispatch did not yield the correct scode", com_exc) + exc = com_exc.excepinfo if not exc or exc[-1] != winerror.E_UNEXPECTED: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) *************** *** 84,91 **** finally: cap.release() ! except pythoncom.com_error, com_exc: ! hr, desc, exc, argErr = com_exc ! if hr != winerror.DISP_E_EXCEPTION: raise error("Calling the object via IDispatch did not yield the correct scode", com_exc) if not exc or exc[-1] != winerror.E_FAIL: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) --- 86,94 ---- finally: cap.release() ! raise error("Expecting this call to fail!") ! except pythoncom.com_error as com_exc: ! if com_exc.hresult != winerror.DISP_E_EXCEPTION: raise error("Calling the object via IDispatch did not yield the correct scode", com_exc) + exc = com_exc.excepinfo if not exc or exc[-1] != winerror.E_FAIL: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) Index: testvb.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testvb.py,v retrieving revision 1.20 retrieving revision 1.20.4.1 diff -C2 -d -r1.20 -r1.20.4.1 *** testvb.py 21 Nov 2006 06:56:04 -0000 1.20 --- testvb.py 26 Nov 2008 07:17:39 -0000 1.20.4.1 *************** *** 8,29 **** from win32com.server.util import NewCollection, wrap import string ! import util ! ! importMsg = """\ ! **** VB Test harness is not installed *** ! This test requires a VB test program to be built and installed ! on this PC. ! """ ! ! ### NOTE: VB SUCKS! ! ### If you delete the DLL built by VB, then reopen VB ! ### to rebuild the DLL, it loses the IID of the object!!! ! ### So I will try to avoid this in the future :-) ! ! # Import the type library for the test module. ! try: ! win32com.client.gencache.EnsureDispatch("PyCOMVBTest.Tester") ! except pythoncom.com_error: ! raise RuntimeError, importMsg import traceback --- 8,12 ---- from win32com.server.util import NewCollection, wrap import string ! from win32com.test import util import traceback *************** *** 34,38 **** ## useDispatcher = win32com.server.dispatcher.DefaultDebugDispatcher ! error = "VB Test Error" # Set up a COM object that VB will do some callbacks on. This is used --- 17,21 ---- ## useDispatcher = win32com.server.dispatcher.DefaultDebugDispatcher ! error = RuntimeError # Set up a COM object that VB will do some callbacks on. This is used *************** *** 78,100 **** vbtest.LongProperty = -1 if vbtest.LongProperty != -1: ! raise error, "Could not set the long property correctly." vbtest.IntProperty = 10 if vbtest.IntProperty != 10: ! raise error, "Could not set the integer property correctly." vbtest.VariantProperty = 10 if vbtest.VariantProperty != 10: ! raise error, "Could not set the variant integer property correctly." vbtest.VariantProperty = buffer('raw\0data') if vbtest.VariantProperty != buffer('raw\0data'): ! raise error, "Could not set the variant buffer property correctly." vbtest.StringProperty = "Hello from Python" if vbtest.StringProperty != "Hello from Python": ! raise error, "Could not set the string property correctly." vbtest.VariantProperty = "Hello from Python" if vbtest.VariantProperty != "Hello from Python": ! raise error, "Could not set the variant string property correctly." vbtest.VariantProperty = (1.0, 2.0, 3.0) if vbtest.VariantProperty != (1.0, 2.0, 3.0): ! raise error, "Could not set the variant property to an array of floats correctly - '%s'." % (vbtest.VariantProperty,) TestArrays(vbtest, bUseGenerated) --- 61,83 ---- vbtest.LongProperty = -1 if vbtest.LongProperty != -1: ! raise error("Could not set the long property correctly.") vbtest.IntProperty = 10 if vbtest.IntProperty != 10: ! raise error("Could not set the integer property correctly.") vbtest.VariantProperty = 10 if vbtest.VariantProperty != 10: ! raise error("Could not set the variant integer property correctly.") vbtest.VariantProperty = buffer('raw\0data') if vbtest.VariantProperty != buffer('raw\0data'): ! raise error("Could not set the variant buffer property correctly.") vbtest.StringProperty = "Hello from Python" if vbtest.StringProperty != "Hello from Python": ! raise error("Could not set the string property correctly.") vbtest.VariantProperty = "Hello from Python" if vbtest.VariantProperty != "Hello from Python": ! raise error("Could not set the variant string property correctly.") vbtest.VariantProperty = (1.0, 2.0, 3.0) if vbtest.VariantProperty != (1.0, 2.0, 3.0): ! raise error("Could not set the variant property to an array of floats correctly - '%s'." % (vbtest.VariantProperty,)) TestArrays(vbtest, bUseGenerated) *************** *** 113,117 **** vbtest.VariantPutref = vbtest if vbtest.VariantPutref._oleobj_!= vbtest._oleobj_: ! raise error, "Could not set the VariantPutref property correctly." # Cant test further types for this VariantPutref, as only # COM objects can be stored ByRef. --- 96,100 ---- vbtest.VariantPutref = vbtest if vbtest.VariantPutref._oleobj_!= vbtest._oleobj_: ! raise error("Could not set the VariantPutref property correctly.") # Cant test further types for this VariantPutref, as only # COM objects can be stored ByRef. *************** *** 122,131 **** # vbtest.CollectionProperty = NewCollection((1,2,"3", "Four")) # if vbtest.CollectionProperty != (1,2,"3", "Four"): ! # raise error, "Could not set the Collection property correctly - got back " + str(vbtest.CollectionProperty) # These are sub's that have a single byref param # Result should be just the byref. if vbtest.IncrementIntegerParam(1) != 2: ! raise error, "Could not pass an integer byref" # Sigh - we cant have *both* "ommited byref" and optional args --- 105,114 ---- # vbtest.CollectionProperty = NewCollection((1,2,"3", "Four")) # if vbtest.CollectionProperty != (1,2,"3", "Four"): ! # raise error("Could not set the Collection property correctly - got back " + str(vbtest.CollectionProperty)) # These are sub's that have a single byref param # Result should be just the byref. if vbtest.IncrementIntegerParam(1) != 2: ! raise error("Could not pass an integer byref") # Sigh - we cant have *both* "ommited byref" and optional args *************** *** 133,143 **** # rather than simply all byrefs working as optional. # if vbtest.IncrementIntegerParam() != 1: ! # raise error, "Could not pass an omitted integer byref" if vbtest.IncrementVariantParam(1) != 2: ! raise error, "Could not pass an int VARIANT byref:"+str(vbtest.IncrementVariantParam(1)) if vbtest.IncrementVariantParam(1.5) != 2.5: ! raise error, "Could not pass a float VARIANT byref" # Can't test IncrementVariantParam with the param omitted as it --- 116,126 ---- # rather than simply all byrefs working as optional. # if vbtest.IncrementIntegerParam() != 1: ! # raise error("Could not pass an omitted integer byref") if vbtest.IncrementVariantParam(1) != 2: ! raise error("Could not pass an int VARIANT byref:"+str(vbtest.IncrementVariantParam(1))) if vbtest.IncrementVariantParam(1.5) != 2.5: ! raise error("Could not pass a float VARIANT byref") # Can't test IncrementVariantParam with the param omitted as it *************** *** 148,152 **** ret = vbtest.PassIntByVal(1) if ret != 2: ! raise error, "Could not increment the integer - "+str(ret) TestVBInterface(vbtest) --- 131,135 ---- ret = vbtest.PassIntByVal(1) if ret != 2: ! raise error("Could not increment the integer - "+str(ret)) TestVBInterface(vbtest) *************** *** 157,166 **** ret = vbtest.PassIntByRef(1) if ret != (1,2): ! raise error, "Could not increment the integer - "+str(ret) # Check you can leave a byref arg blank. # see above # ret = vbtest.PassIntByRef() # if ret != (0,1): ! # raise error, "Could not increment the integer with default arg- "+str(ret) def _DoTestCollection(vbtest, col_name, expected): --- 140,149 ---- ret = vbtest.PassIntByRef(1) if ret != (1,2): ! raise error("Could not increment the integer - "+str(ret)) # Check you can leave a byref arg blank. # see above # ret = vbtest.PassIntByRef() # if ret != (0,1): ! # raise error("Could not increment the integer with default arg- "+str(ret)) def _DoTestCollection(vbtest, col_name, expected): *************** *** 176,180 **** check.append(item) if check != list(expected): ! raise error, "Collection %s didn't have %r (had %r)" % (col_name, expected, check) # Just looping over the collection again works (ie, is restartable) check = [] --- 159,163 ---- check.append(item) if check != list(expected): ! raise error("Collection %s didn't have %r (had %r)" % (col_name, expected, check)) # Just looping over the collection again works (ie, is restartable) check = [] *************** *** 182,186 **** check.append(item) if check != list(expected): ! raise error, "Collection 2nd time around %s didn't have %r (had %r)" % (col_name, expected, check) # Check we can get it via iter() i = iter(getattr(vbtest, col_name)) --- 165,169 ---- check.append(item) if check != list(expected): ! raise error("Collection 2nd time around %s didn't have %r (had %r)" % (col_name, expected, check)) # Check we can get it via iter() i = iter(getattr(vbtest, col_name)) *************** *** 189,193 **** check.append(item) if check != list(expected): ! raise error, "Collection iterator %s didn't have %r 2nd time around (had %r)" % (col_name, expected, check) # but an iterator is not restartable check = [] --- 172,176 ---- check.append(item) if check != list(expected): ! raise error("Collection iterator %s didn't have %r 2nd time around (had %r)" % (col_name, expected, check)) # but an iterator is not restartable check = [] *************** *** 195,204 **** check.append(item) if check != []: ! raise error, "2nd time around Collection iterator %s wasn't empty (had %r)" % (col_name, check) # Check len()==Count() c = getattr(vbtest, col_name) if len(c) != _getcount(c): ! raise error, "Collection %s __len__(%r) wasn't==Count(%r)" % (col_name, len(c), _getcount(c)) # Check we can do it with zero based indexing. c = getattr(vbtest, col_name) --- 178,187 ---- check.append(item) if check != []: ! raise error("2nd time around Collection iterator %s wasn't empty (had %r)" % (col_name, check)) # Check len()==Count() c = getattr(vbtest, col_name) if len(c) != _getcount(c): ! raise error("Collection %s __len__(%r) wasn't==Count(%r)" % (col_name, len(c), _getcount(c))) # Check we can do it with zero based indexing. c = getattr(vbtest, col_name) *************** *** 207,211 **** check.append(c[i]) if check != list(expected): ! raise error, "Collection %s didn't have %r (had %r)" % (col_name, expected, check) # Check we can do it with our old "Skip/Next" methods. --- 190,194 ---- check.append(c[i]) if check != list(expected): ! raise error("Collection %s didn't have %r (had %r)" % (col_name, expected, check)) # Check we can do it with our old "Skip/Next" methods. *************** *** 218,222 **** check.append(n[0]) if check != list(expected): ! raise error, "Collection %s didn't have %r (had %r)" % (col_name, expected, check) def TestCollections(vbtest): --- 201,205 ---- check.append(n[0]) if check != list(expected): ! raise error("Collection %s didn't have %r (had %r)" % (col_name, expected, check)) def TestCollections(vbtest): *************** *** 224,228 **** # zero based indexing works for simple VB collections. if vbtest.CollectionProperty[0] != 1: ! raise error, "The CollectionProperty[0] element was not the default value" _DoTestCollection(vbtest, "EnumerableCollectionProperty", []) --- 207,211 ---- # zero based indexing works for simple VB collections. if vbtest.CollectionProperty[0] != 1: ! raise error("The CollectionProperty[0] element was not the default value") _DoTestCollection(vbtest, "EnumerableCollectionProperty", []) *************** *** 236,247 **** vbtest.ArrayProperty = data if expected_exception is not None: ! raise error, "Expected '%s'" % expected_exception except expected_exception: return got = vbtest.ArrayProperty if got != data: ! raise error, \ ! "Could not set the array data correctly - got %r, expected %r" \ ! % (got, data) def TestArrays(vbtest, bUseGenerated): --- 219,230 ---- vbtest.ArrayProperty = data if expected_exception is not None: ! raise error("Expected '%s'" % expected_exception) except expected_exception: return got = vbtest.ArrayProperty if got != data: ! raise error( ! "Could not set the array data correctly - got %r, expected %r" ! % (got, data)) def TestArrays(vbtest, bUseGenerated): *************** *** 314,320 **** byRefParam = map(str, byRefParam) if testData != list(resultData): ! raise error, "The safe array data was not what we expected - got " + str(resultData) if testData != list(byRefParam): ! raise error, "The safe array data was not what we expected - got " + str(byRefParam) testData = [1.0, 2.0, 3.0] resultData, byRefParam = vbtest.PassSAFEARRAYVariant(testData) --- 297,303 ---- byRefParam = map(str, byRefParam) if testData != list(resultData): ! raise error("The safe array data was not what we expected - got " + str(resultData)) if testData != list(byRefParam): ! raise error("The safe array data was not what we expected - got " + str(byRefParam)) testData = [1.0, 2.0, 3.0] resultData, byRefParam = vbtest.PassSAFEARRAYVariant(testData) *************** *** 336,367 **** try: vbtest.IntProperty = "One" ! raise error, "Should have failed by now" except pythoncom.com_error, (hr, desc, exc, argErr): if hr != winerror.DISP_E_TYPEMISMATCH: ! raise error, "Expected DISP_E_TYPEMISMATCH" s = vbtest.StructProperty if s.int_val != 99 or str(s.str_val) != "hello": ! raise error, "The struct value was not correct" s.str_val = "Hi from Python" s.int_val = 11 if s.int_val != 11 or str(s.str_val) != "Hi from Python": ! raise error, "The struct value didnt persist!" if s.sub_val.int_val != 66 or str(s.sub_val.str_val) != "sub hello": ! raise error, "The sub-struct value was not correct" sub = s.sub_val sub.int_val = 22 if sub.int_val != 22: print sub.int_val ! raise error, "The sub-struct value didnt persist!" if s.sub_val.int_val != 22: print s.sub_val.int_val ! raise error, "The sub-struct value (re-fetched) didnt persist!" if s.sub_val.array_val[0].int_val != 0 or str(s.sub_val.array_val[0].str_val) != "zero": print s.sub_val.array_val[0].int_val ! raise error, "The array element wasnt correct" s.sub_val.array_val[0].int_val = 99 s.sub_val.array_val[1].int_val = 66 --- 319,350 ---- try: vbtest.IntProperty = "One" ! raise error("Should have failed by now") except pythoncom.com_error, (hr, desc, exc, argErr): if hr != winerror.DISP_E_TYPEMISMATCH: ! raise error("Expected DISP_E_TYPEMISMATCH") s = vbtest.StructProperty if s.int_val != 99 or str(s.str_val) != "hello": ! raise error("The struct value was not correct") s.str_val = "Hi from Python" s.int_val = 11 if s.int_val != 11 or str(s.str_val) != "Hi from Python": ! raise error("The struct value didnt persist!") if s.sub_val.int_val != 66 or str(s.sub_val.str_val) != "sub hello": ! raise error("The sub-struct value was not correct") sub = s.sub_val sub.int_val = 22 if sub.int_val != 22: print sub.int_val ! raise error("The sub-struct value didnt persist!") if s.sub_val.int_val != 22: print s.sub_val.int_val ! raise error("The sub-struct value (re-fetched) didnt persist!") if s.sub_val.array_val[0].int_val != 0 or str(s.sub_val.array_val[0].str_val) != "zero": print s.sub_val.array_val[0].int_val ! raise error("The array element wasnt correct") s.sub_val.array_val[0].int_val = 99 s.sub_val.array_val[1].int_val = 66 *************** *** 369,373 **** s.sub_val.array_val[1].int_val != 66: print s.sub_val.array_val[0].int_val ! raise error, "The array element didnt persist." # Now pass the struct back to VB vbtest.StructProperty = s --- 352,356 ---- s.sub_val.array_val[1].int_val != 66: print s.sub_val.array_val[0].int_val ! raise error("The array element didnt persist.") # Now pass the struct back to VB vbtest.StructProperty = s *************** *** 375,381 **** s = vbtest.StructProperty if s.int_val != 11 or str(s.str_val) != "Hi from Python": ! raise error, "After sending to VB, the struct value didnt persist!" if s.sub_val.array_val[0].int_val != 99: ! raise error, "After sending to VB, the struct array value didnt persist!" # Now do some object equality tests. --- 358,364 ---- s = vbtest.StructProperty if s.int_val != 11 or str(s.str_val) != "Hi from Python": ! raise error("After sending to VB, the struct value didnt persist!") if s.sub_val.array_val[0].int_val != 99: ! raise error("After sending to VB, the struct array value didnt persist!") # Now do some object equality tests. *************** *** 415,419 **** try: s.bad_attribute ! raise RuntimeError, "Could get a bad attribute" except AttributeError: pass --- 398,402 ---- try: s.bad_attribute ! raise RuntimeError("Could get a bad attribute") except AttributeError: pass *************** *** 427,434 **** t = ob.GetInterfaceTester(2) if t.getn() != 2: ! raise error, "Initial value wrong" t.setn(3) if t.getn() != 3: ! raise error, "New value wrong" def DoTestAll(): --- 410,417 ---- t = ob.GetInterfaceTester(2) if t.getn() != 2: ! raise error("Initial value wrong") t.setn(3) if t.getn() != 3: ! raise error("New value wrong") def DoTestAll(): *************** *** 440,451 **** def TestAll(): if not __debug__: ! raise RuntimeError, "This must be run in debug mode - we use assert!" try: DoTestAll() print "All tests appear to have worked!" except: print "TestAll() failed!!" traceback.print_exc() # Make this test run under our test suite to leak tests etc work --- 423,440 ---- def TestAll(): + # Import the type library for the test module. Let the 'invalid clsid' + # exception filter up, where the test runner will treat it as 'skipped' + win32com.client.gencache.EnsureDispatch("PyCOMVBTest.Tester") + if not __debug__: ! raise RuntimeError("This must be run in debug mode - we use assert!") try: DoTestAll() print "All tests appear to have worked!" except: + # ????? print "TestAll() failed!!" traceback.print_exc() + raise # Make this test run under our test suite to leak tests etc work Index: testClipboard.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testClipboard.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** testClipboard.py 4 May 2004 07:02:30 -0000 1.2 --- testClipboard.py 26 Nov 2008 07:17:39 -0000 1.2.4.1 *************** *** 46,50 **** if cf == win32con.CF_TEXT: ret_stg = pythoncom.STGMEDIUM() ! ret_stg.set(pythoncom.TYMED_HGLOBAL, self.strval) elif cf == win32con.CF_UNICODETEXT: ret_stg = pythoncom.STGMEDIUM() --- 46,51 ---- if cf == win32con.CF_TEXT: ret_stg = pythoncom.STGMEDIUM() ! # ensure always 'bytes' by encoding string. ! ret_stg.set(pythoncom.TYMED_HGLOBAL, self.strval.encode("ascii")) elif cf == win32con.CF_UNICODETEXT: ret_stg = pythoncom.STGMEDIUM() *************** *** 110,114 **** win32clipboard.OpenClipboard() got = win32clipboard.GetClipboardData(win32con.CF_TEXT) ! self.assertEqual(got, "Hello from Python") # Now check unicode got = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT) --- 111,117 ---- win32clipboard.OpenClipboard() got = win32clipboard.GetClipboardData(win32con.CF_TEXT) ! # CF_TEXT gives bytes on py3k - use encode() to ensure that's true. ! expected = "Hello from Python".encode("ascii") ! self.assertEqual(got, expected) # Now check unicode got = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT) *************** *** 118,122 **** def testWin32ToCom(self): # Set the data via the std win32 clipboard functions. ! val = "Hello again!" win32clipboard.OpenClipboard() win32clipboard.SetClipboardData(win32con.CF_TEXT, val) --- 121,125 ---- def testWin32ToCom(self): # Set the data via the std win32 clipboard functions. ! val = "Hello again!".encode("ascii") # ensure always bytes, even in py3k win32clipboard.OpenClipboard() win32clipboard.SetClipboardData(win32con.CF_TEXT, val) *************** *** 130,134 **** # knowing if it meant to be a string, or a binary buffer, so # it must return it too. ! self.failUnlessEqual(got, val+"\0") def testDataObjectFlush(self): --- 133,137 ---- # knowing if it meant to be a string, or a binary buffer, so # it must return it too. ! self.failUnlessEqual(got, "Hello again!\0".encode("ascii")) def testDataObjectFlush(self): *************** *** 152,155 **** if __name__=='__main__': ! import util util.testmain() --- 155,158 ---- if __name__=='__main__': ! from win32com.test import util util.testmain() Index: testall.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testall.py,v retrieving revision 1.27.2.1 retrieving revision 1.27.2.2 diff -C2 -d -r1.27.2.1 -r1.27.2.2 *** testall.py 11 Nov 2008 01:04:19 -0000 1.27.2.1 --- testall.py 26 Nov 2008 07:17:39 -0000 1.27.2.2 *************** *** 2,7 **** import pythoncom import win32com.client ! from util import CheckClean, TestCase, CapturingFunctionTestCase, TestLoader ! import win32com.test.util import traceback import getopt --- 2,8 ---- import pythoncom import win32com.client ! from win32com.test.util import CheckClean, TestCase, \ ! CapturingFunctionTestCase, ShellTestCase, \ ! TestLoader, TestRunner, RegisterPythonServer import traceback import getopt *************** *** 58,61 **** --- 59,68 ---- no_leak_tests = True # done by the test itself def testit(self): + # Check that the item is registered, so we get the correct + # 'skipped' behaviour (and recorded as such) rather than either + # error or silence due to non-registration. + RegisterPythonServer(os.path.join(os.path.dirname(__file__), '..', "servers", "test_pycomtest.py"), + "Python.Test.PyCOMTest") + # Execute testPyComTest in its own process so it can play # with the Python thread state *************** *** 66,69 **** --- 73,80 ---- class PippoTest(TestCase): def testit(self): + # Check we are registered before spawning the process. + from win32com.test import pippo_server + RegisterPythonServer(pippo_server.__file__, "Python.Test.Pippo") + python = sys.executable fname = os.path.join(os.path.dirname(this_file), "testPippo.py") *************** *** 123,128 **** mod_name = test_name func_name = None try: ! mod = __import__(mod_name) except: import_failures.append((mod_name, sys.exc_info()[:2])) --- 134,141 ---- mod_name = test_name func_name = None + fq_mod_name = "win32com.test." + mod_name try: ! __import__(fq_mod_name) ! mod = sys.modules[fq_mod_name] except: import_failures.append((mod_name, sys.exc_info()[:2])) *************** *** 145,150 **** continue if func is not None: ! test = win32com.test.util.CapturingFunctionTestCase(func, ! description=mod_name) else: if hasattr(mod, "suite"): --- 158,162 ---- continue if func is not None: ! test = CapturingFunctionTestCase(func, description=mod_name) else: if hasattr(mod, "suite"): *************** *** 155,159 **** suite.addTest(test) for cmd, output in output_checked_programs[i]: ! suite.addTest(win32com.test.util.ShellTestCase(cmd, output)) for test_class in custom_test_cases[i]: --- 167,171 ---- suite.addTest(test) for cmd, output in output_checked_programs[i]: ! suite.addTest(ShellTestCase(cmd, output)) for test_class in custom_test_cases[i]: *************** *** 202,206 **** # A little row of markers so the dots show how close to finished print '|' * suite.countTestCases() ! testRunner = unittest.TextTestRunner(verbosity=verbosity) testResult = testRunner.run(suite) if import_failures: --- 214,218 ---- # A little row of markers so the dots show how close to finished print '|' * suite.countTestCases() ! testRunner = TestRunner(verbosity=verbosity) testResult = testRunner.run(suite) if import_failures: Index: testExplorer.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testExplorer.py,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** testExplorer.py 19 Jul 2008 06:23:40 -0000 1.7 --- testExplorer.py 26 Nov 2008 07:17:39 -0000 1.7.2.1 *************** *** 9,16 **** import win32gui import win32con import glob import pythoncom import time ! from util import CheckClean bVisibleEventFired = 0 --- 9,17 ---- import win32gui import win32con + import winerror import glob import pythoncom import time ! from win32com.test.util import CheckClean bVisibleEventFired = 0 *************** *** 48,52 **** 'Internet Explorer_Server']: hwnd = win32gui.FindWindowEx(hwnd, 0, child_class, None) ! assert hwnd, "Couldn't find '%s" % (child_class,) # But here is the point - once you have an 'Internet Explorer_Server', # you can send a message and use ObjectFromLresult to get it back. --- 49,53 ---- 'Internet Explorer_Server']: hwnd = win32gui.FindWindowEx(hwnd, 0, child_class, None) ! assert hwnd, "Couldn't find '%s'" % (child_class,) # But here is the point - once you have an 'Internet Explorer_Server', # you can send a message and use ObjectFromLresult to get it back. *************** *** 74,96 **** def TestAll(): try: ! iexplore = win32com.client.dynamic.Dispatch("InternetExplorer.Application") ! TestExplorer(iexplore) ! ! win32api.Sleep(1000) ! iexplore = None ! # Test IE events. ! TestExplorerEvents() ! # Give IE a chance to shutdown, else it can get upset on fast machines. ! time.sleep(2) ! # Note that the TextExplorerEvents will force makepy - hence ! # this gencache is really no longer needed. ! from win32com.client import gencache ! gencache.EnsureModule("{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 0, 1, 1) ! iexplore = win32com.client.Dispatch("InternetExplorer.Application") ! TestExplorer(iexplore) finally: iexplore = None --- 75,100 ---- def TestAll(): try: ! try: ! iexplore = win32com.client.dynamic.Dispatch("InternetExplorer.Application") ! TestExplorer(iexplore) ! win32api.Sleep(1000) ! iexplore = None ! # Test IE events. ! TestExplorerEvents() ! # Give IE a chance to shutdown, else it can get upset on fast machines. ! time.sleep(2) ! # Note that the TextExplorerEvents will force makepy - hence ! # this gencache is really no longer needed. + from win32com.client import gencache + gencache.EnsureModule("{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 0, 1, 1) + iexplore = win32com.client.Dispatch("InternetExplorer.Application") + TestExplorer(iexplore) + except pythoncom.com_error as exc: + if exc.hresult!=winerror.RPC_E_DISCONNECTED: # user closed the app! + raise finally: iexplore = None Index: testAXScript.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testAXScript.py,v retrieving revision 1.7 retrieving revision 1.7.4.1 diff -C2 -d -r1.7 -r1.7.4.1 *** testAXScript.py 10 Nov 2003 00:49:29 -0000 1.7 --- testAXScript.py 26 Nov 2008 07:17:39 -0000 1.7.4.1 *************** *** 15,19 **** from util import RegisterPythonServer self.verbose = verbose ! RegisterPythonServer(file, self.verbose) def testHost(self): --- 15,19 ---- from util import RegisterPythonServer self.verbose = verbose ! RegisterPythonServer(file, 'python', verbose=self.verbose) def testHost(self): *************** *** 32,34 **** if __name__=='__main__': ! unittest.main() --- 32,34 ---- if __name__=='__main__': ! win32com.test.util.testmain() Index: testDictionary.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testDictionary.py,v retrieving revision 1.6 retrieving revision 1.6.4.1 diff -C2 -d -r1.6 -r1.6.4.1 *** testDictionary.py 10 Nov 2003 00:49:29 -0000 1.6 --- testDictionary.py 26 Nov 2008 07:17:39 -0000 1.6.4.1 *************** *** 9,13 **** import pywintypes import winerror - L=pywintypes.Unicode import unittest --- 9,12 ---- *************** *** 25,31 **** # Ensure we have the correct version registered. def Register(quiet): ! import win32com.server.register ! from win32com.servers.dictionary import DictionaryPolicy ! win32com.server.register.RegisterClasses(DictionaryPolicy, quiet=quiet) def TestDict(quiet=None): --- 24,30 ---- # Ensure we have the correct version registered. def Register(quiet): ! import win32com.servers.dictionary ! from win32com.test.util import RegisterPythonServer ! RegisterPythonServer(win32com.servers.dictionary.__file__, 'Python.Dictionary') def TestDict(quiet=None): Index: testPersist.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPersist.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** testPersist.py 18 Nov 2002 11:20:07 -0000 1.2 --- testPersist.py 26 Nov 2008 07:17:39 -0000 1.2.4.1 *************** *** 1,5 **** import pythoncom import win32com.server.util - import util import time --- 1,4 ---- |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:52
|
Update of /cvsroot/pywin32/pywin32/com/win32com/server In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/com/win32com/server Modified Files: Tag: py3k policy.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: policy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/server/policy.py,v retrieving revision 1.23 retrieving revision 1.23.2.1 diff -C2 -d -r1.23 -r1.23.2.1 *** policy.py 13 Feb 2008 22:18:08 -0000 1.23 --- policy.py 26 Nov 2008 07:17:39 -0000 1.23.2.1 *************** *** 71,77 **** import win32api import winerror - import string import sys import types import win32con, pythoncom --- 71,77 ---- import win32api import winerror import sys import types + import pywintypes import win32con, pythoncom *************** *** 85,92 **** # Few more globals to speed things. - from pywintypes import UnicodeType IDispatchType = pythoncom.TypeIIDs[pythoncom.IID_IDispatch] IUnknownType = pythoncom.TypeIIDs[pythoncom.IID_IUnknown] - core_has_unicode = hasattr(__builtins__, "unicode") from exception import COMException --- 85,90 ---- *************** *** 98,104 **** regAddnPath = 'CLSID\\%s\\PythonCOMPath' - # exc_info doesnt appear 'till Python 1.5, but we now have other 1.5 deps! - from sys import exc_info - def CreateInstance(clsid, reqIID): """Create a new instance of the specified IID --- 96,99 ---- *************** *** 114,119 **** # First see is sys.path should have something on it. try: ! addnPaths = string.split(win32api.RegQueryValue(win32con.HKEY_CLASSES_ROOT, ! regAddnPath % clsid),';') for newPath in addnPaths: if newPath not in sys.path: --- 109,114 ---- # First see is sys.path should have something on it. try: ! addnPaths = win32api.RegQueryValue(win32con.HKEY_CLASSES_ROOT, ! regAddnPath % clsid).split(';') for newPath in addnPaths: if newPath not in sys.path: *************** *** 134,140 **** except win32api.error: dispatcher = None - - # clear exception information - sys.exc_type = sys.exc_value = sys.exc_traceback = None # sys.clearexc() appears in 1.5? if dispatcher: --- 129,132 ---- *************** *** 242,246 **** # Allow interfaces to be specified by name. for i in ob._com_interfaces_: ! if type(i) != pythoncom.PyIIDType: # Prolly a string! if i[0] != "{": --- 234,238 ---- # Allow interfaces to be specified by name. for i in ob._com_interfaces_: ! if type(i) != pywintypes.IIDType: # Prolly a string! if i[0] != "{": *************** *** 280,284 **** if type(dispid) == type(""): try: ! dispid = self._name_to_dispid_[string.lower(dispid)] except KeyError: raise COMException(scode = winerror.DISP_E_MEMBERNOTFOUND, desc="Member not found") --- 272,276 ---- if type(dispid) == type(""): try: ! dispid = self._name_to_dispid_[dispid.lower()] except KeyError: raise COMException(scode = winerror.DISP_E_MEMBERNOTFOUND, desc="Member not found") *************** *** 314,318 **** try: ### TODO - look at the fdex flags!!! ! return self._name_to_dispid_[string.lower(str(name))] except KeyError: raise COMException(scode = winerror.DISP_E_UNKNOWNNAME) --- 306,310 ---- try: ### TODO - look at the fdex flags!!! ! return self._name_to_dispid_[name.lower()] except KeyError: raise COMException(scode = winerror.DISP_E_UNKNOWNNAME) *************** *** 327,331 **** if type(dispid) == type(""): try: ! dispid = self._name_to_dispid_[string.lower(dispid)] except KeyError: raise COMException(scode = winerror.DISP_E_MEMBERNOTFOUND, desc="Member not found") --- 319,323 ---- if type(dispid) == type(""): try: ! dispid = self._name_to_dispid_[dispid.lower()] except KeyError: raise COMException(scode = winerror.DISP_E_MEMBERNOTFOUND, desc="Member not found") *************** *** 470,474 **** # Filter out all 'normal' IIDs (ie, IID objects and strings starting with { interfaces = [i for i in getattr(ob, '_com_interfaces_', []) ! if type(i) != pythoncom.PyIIDType and not i.startswith("{")] universal_data = universal.RegisterInterfaces(tlb_guid, tlb_lcid, tlb_major, tlb_minor, interfaces) --- 462,466 ---- # Filter out all 'normal' IIDs (ie, IID objects and strings starting with { interfaces = [i for i in getattr(ob, '_com_interfaces_', []) ! if type(i) != pywintypes.IIDType and not i.startswith("{")] universal_data = universal.RegisterInterfaces(tlb_guid, tlb_lcid, tlb_major, tlb_minor, interfaces) *************** *** 481,493 **** # Copy existing _dispid_to_func_ entries to _name_to_dispid_ for dispid, name in self._dispid_to_func_.items(): ! self._name_to_dispid_[string.lower(name)]=dispid for dispid, name in self._dispid_to_get_.items(): ! self._name_to_dispid_[string.lower(name)]=dispid for dispid, name in self._dispid_to_put_.items(): ! self._name_to_dispid_[string.lower(name)]=dispid # Patch up the universal stuff. for dispid, invkind, name in universal_data: ! self._name_to_dispid_[string.lower(name)]=dispid if invkind == DISPATCH_METHOD: self._dispid_to_func_[dispid] = name --- 473,485 ---- # Copy existing _dispid_to_func_ entries to _name_to_dispid_ for dispid, name in self._dispid_to_func_.items(): ! self._name_to_dispid_[name.lower()]=dispid for dispid, name in self._dispid_to_get_.items(): ! self._name_to_dispid_[name.lower()]=dispid for dispid, name in self._dispid_to_put_.items(): ! self._name_to_dispid_[name.lower()]=dispid # Patch up the universal stuff. for dispid, invkind, name in universal_data: ! self._name_to_dispid_[name.lower()]=dispid if invkind == DISPATCH_METHOD: self._dispid_to_func_[dispid] = name *************** *** 650,655 **** except pythoncom.error: pass # Keep it as IUnknown - elif not core_has_unicode and arg_type==UnicodeType: - arg = str(arg) ret.append(arg) return tuple(ret), kwArgs --- 642,645 ---- *************** *** 685,690 **** def _getdispid_(self, name, fdex): # TODO - Look at fdex flags. ! # TODO - Remove str() of Unicode name param. ! lname = string.lower(str(name)) try: return self._name_to_dispid_[lname] --- 675,679 ---- def _getdispid_(self, name, fdex): # TODO - Look at fdex flags. ! lname = name.lower() try: return self._name_to_dispid_[lname] *************** *** 703,709 **** ### note: serviceProvider is being ignored... ### there might be assigned DISPID values to properties, too... - ### TODO - Remove the str() of the Unicode argument try: ! name = str(self._dyn_dispid_to_name_[dispid]) except KeyError: raise COMException(scode = winerror.DISP_E_MEMBERNOTFOUND, desc="Member not found") --- 692,697 ---- ### note: serviceProvider is being ignored... ### there might be assigned DISPID values to properties, too... try: ! name = self._dyn_dispid_to_name_[dispid] except KeyError: raise COMException(scode = winerror.DISP_E_MEMBERNOTFOUND, desc="Member not found") *************** *** 720,724 **** """ try: ! idx = string.rindex(spec, ".") mname = spec[:idx] fname = spec[idx+1:] --- 708,712 ---- """ try: ! idx = spec.rindex(".") mname = spec[:idx] fname = spec[idx+1:] |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:49
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888 Modified Files: Tag: py3k setup.py setup3.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.81.2.5 retrieving revision 1.81.2.6 diff -C2 -d -r1.81.2.5 -r1.81.2.6 *** setup.py 24 Nov 2008 06:14:33 -0000 1.81.2.5 --- setup.py 26 Nov 2008 07:17:38 -0000 1.81.2.6 *************** *** 1,3 **** ! build_id="212.1" # may optionally include a ".{patchno}" suffix. # Putting buildno at the top prevents automatic __doc__ assignment, and # I *want* the build number at the top :) --- 1,3 ---- ! build_id="212.5" # may optionally include a ".{patchno}" suffix. # Putting buildno at the top prevents automatic __doc__ assignment, and # I *want* the build number at the top :) *************** *** 73,76 **** --- 73,77 ---- import _winreg + is_py3k = sys.version_info > (3,) # get this out of the way early on... # The rest of our imports. *************** *** 268,271 **** --- 269,273 ---- define_macros = define_macros or [] define_macros.append(("DISTUTILS_BUILD", None)) + define_macros.append(("_CRT_SECURE_NO_WARNINGS", None)) self.pch_header = pch_header self.extra_swig_commands = extra_swig_commands or [] *************** *** 306,320 **** return result dsp_path = os.path.dirname(dsp) for line in open(dsp, "r"): fields = line.strip().split("=", 2) if fields[0]=="SOURCE": ! if os.path.splitext(fields[1])[1].lower() in ['.cpp', '.c', '.i', '.rc', '.mc']: pathname = os.path.normpath(os.path.join(dsp_path, fields[1])) result.append(pathname) # Sort the sources so that (for example) the .mc file is processed first, # building this may create files included by other source files. - # Note that this requires a patch to distutils' ccompiler classes so that - # they build the sources in the order given. build_order = ".i .mc .rc .cpp".split() decorated = [(build_order.index(os.path.splitext(fname)[-1].lower()), fname) --- 308,333 ---- return result dsp_path = os.path.dirname(dsp) + seen_swigs = [] for line in open(dsp, "r"): fields = line.strip().split("=", 2) if fields[0]=="SOURCE": ! ext = os.path.splitext(fields[1])[1].lower() ! if ext in ['.cpp', '.c', '.i', '.rc', '.mc']: pathname = os.path.normpath(os.path.join(dsp_path, fields[1])) result.append(pathname) + if ext == '.i': + seen_swigs.append(pathname) + # ack - .dsp files may have references to the generated 'foomodule.cpp' + # from 'foo.i' - but we now do things differently... + for ss in seen_swigs: + base, ext = os.path.splitext(ss) + nuke = base + "module.cpp" + try: + result.remove(nuke) + except ValueError: + pass # Sort the sources so that (for example) the .mc file is processed first, # building this may create files included by other source files. build_order = ".i .mc .rc .cpp".split() decorated = [(build_order.index(os.path.splitext(fname)[-1].lower()), fname) *************** *** 391,395 **** unicode_mode = self.unicode_mode if unicode_mode is None: ! unicode_mode = sys.version_info > (3,) if unicode_mode: self.extra_compile_args.append("/DUNICODE") --- 404,408 ---- unicode_mode = self.unicode_mode if unicode_mode is None: ! unicode_mode = is_py3k if unicode_mode: self.extra_compile_args.append("/DUNICODE") *************** *** 484,492 **** # Start with 2to3 related stuff for py3k. ! is_py3k = sys.version_info > (3,) ! if is_py3k: def refactor_filenames(filenames): from lib2to3.refactor import RefactoringTool, get_fixers_from_package fixers = get_fixers_from_package('lib2to3.fixes') options = dict(doctests_only=False, fix=[], list_fixes=[], print_function=False, verbose=False, --- 497,512 ---- # Start with 2to3 related stuff for py3k. ! do_2to3 = False and is_py3k # XXX - py3k branch - syntax is already py3k! ! if do_2to3: ! # hack into the import fixer to remove the Tk fixers - they cause trouble ! # for some of our things with the same name. ! from lib2to3.fixes import fix_imports ! # 'Dialog' fixer causes pywin/mfc/dialog.py's DlgSimpleImport to subclass ! # a Tk dialog instead of a pywin one! ! del fix_imports.MAPPING["Dialog"] def refactor_filenames(filenames): from lib2to3.refactor import RefactoringTool, get_fixers_from_package fixers = get_fixers_from_package('lib2to3.fixes') + options = dict(doctests_only=False, fix=[], list_fixes=[], print_function=False, verbose=False, *************** *** 509,513 **** # 'build_py' command ! if is_py3k: # Force 2to3 to be run for py3k versions. class my_build_py(build_py): --- 529,533 ---- # 'build_py' command ! if do_2to3: # Force 2to3 to be run for py3k versions. class my_build_py(build_py): *************** *** 538,542 **** # 'build_scripts' command ! if is_py3k: class my_build_scripts(build_scripts): def copy_file(self, src, dest): --- 558,562 ---- # 'build_scripts' command ! if do_2to3: class my_build_scripts(build_scripts): def copy_file(self, src, dest): *************** *** 1090,1095 **** return build_ext.get_export_symbols(self, ext) ! def find_swig (self): ! if "SWIG" in os.environ: swig = os.environ["SWIG"] else: --- 1110,1119 ---- return build_ext.get_export_symbols(self, ext) ! def find_swig(self): ! if is_py3k and "SWIG_PY3" in os.environ: ! swig = os.environ["SWIG_PY3"] ! elif not is_py3k and "SWIG_PY2" in os.environ: ! swig = os.environ["SWIG_PY2"] ! elif "SWIG" in os.environ: swig = os.environ["SWIG"] else: *************** *** 1100,1104 **** return swig ! def swig_sources (self, sources, ext=None): new_sources = [] swig_sources = [] --- 1124,1128 ---- return swig ! def swig_sources(self, sources, ext=None): new_sources = [] swig_sources = [] *************** *** 1108,1115 **** # source -- but there should be an option to put SWIG output in # the temp dir. ! # XXX - Note that swig_wince_modules no longer #include the real ! # generated .cpp file (well, they do, but are avoided via the ! # pre-processor.) So this is no longer a reason we can't generate ! # directly to the temp directory. target_ext = '.cpp' for source in sources: --- 1132,1137 ---- # source -- but there should be an option to put SWIG output in # the temp dir. ! # Adding py3k to the mix means we *really* need to move to generating ! # to the temp dir... target_ext = '.cpp' for source in sources: *************** *** 1119,1124 **** continue swig_sources.append(source) ! # Patch up the filenames for SWIG modules that also build ! # under WinCE - see defn of swig_wince_modules for details if os.path.basename(base) in swig_interface_parents: swig_targets[source] = base + target_ext --- 1141,1145 ---- continue swig_sources.append(source) ! # Patch up the filenames for various special cases... if os.path.basename(base) in swig_interface_parents: swig_targets[source] = base + target_ext *************** *** 1127,1142 **** # More vile hacks. winxpmodule is built from win32gui.i - # just different #defines are setup for windows.h. new_target = os.path.join(os.path.dirname(base), ! "winxpguimodule") + target_ext ! swig_targets[source] = new_target ! new_sources.append(new_target) ! elif os.path.basename(base) in swig_wince_modules: ! # We need to add this .cpp to the sources, so it ! # will be built. ! new_target = base + 'module_win32' + target_ext swig_targets[source] = new_target new_sources.append(new_target) else: ! swig_targets[source] = base + 'module' + target_ext else: new_sources.append(source) --- 1148,1161 ---- # More vile hacks. winxpmodule is built from win32gui.i - # just different #defines are setup for windows.h. + pyver = sys.version_info[0] # 2 or 3! new_target = os.path.join(os.path.dirname(base), ! "winxpgui_py%d_swig%s" % (pyver, target_ext)) swig_targets[source] = new_target new_sources.append(new_target) else: ! pyver = sys.version_info[0] # 2 or 3! ! new_target = '%s_py%d_swig%s' % (base, pyver, target_ext) ! new_sources.append(new_target) ! swig_targets[source] = new_target else: new_sources.append(source) *************** *** 1172,1179 **** # build for any platform sees these as dirty. # This could probably go once we generate .cpp into the temp dir. ! if self.force or newer(os.path.abspath(source), os.path.abspath(target)): ! swig_cmd.extend(["-o", ! os.path.abspath(target), ! os.path.abspath(source)]) log.info("swigging %s to %s", source, target) out_dir = os.path.dirname(source) --- 1191,1200 ---- # build for any platform sees these as dirty. # This could probably go once we generate .cpp into the temp dir. ! fqsource = os.path.abspath(source) ! fqtarget = os.path.abspath(target) ! rebuild = self.force or newer(fqsource, fqtarget) ! log.debug("should swig %s->%s=%s", source, target, rebuild) ! if rebuild: ! swig_cmd.extend(["-o", fqtarget, fqsource]) log.info("swigging %s to %s", source, target) out_dir = os.path.dirname(source) *************** *** 1292,1295 **** --- 1313,1318 ---- except ImportError: ok = False + # XXX - verstamp still broken on py3k + ok = False if ok: stamp_script = os.path.join(sys.prefix, "Lib", "site-packages", *************** *** 1352,1356 **** def copy_file(self, src, dest): ! dest, copied = build_scripts.copy_file(self, src, dest) # 2to3 if not self.dry_run and copied: --- 1375,1379 ---- def copy_file(self, src, dest): ! dest, copied = install_data.copy_file(self, src, dest) # 2to3 if not self.dry_run and copied: *************** *** 1386,1390 **** ("win32api", "user32 advapi32 shell32 version", None, 0x0500, 'win32/src/win32apimodule.cpp win32/src/win32api_display.cpp'), ("win32cred", "AdvAPI32 credui", True, 0x0501, 'win32/src/win32credmodule.cpp'), ! ("win32crypt", "Crypt32", None, 0x0500, 'win32/src/win32crypt.i win32/src/win32cryptmodule.cpp'), ("win32file", "oleaut32", None, 0x0500), ("win32event", "user32", None), --- 1409,1413 ---- ("win32api", "user32 advapi32 shell32 version", None, 0x0500, 'win32/src/win32apimodule.cpp win32/src/win32api_display.cpp'), ("win32cred", "AdvAPI32 credui", True, 0x0501, 'win32/src/win32credmodule.cpp'), ! ("win32crypt", "Crypt32", None, 0x0500, 'win32/src/win32crypt.i'), ("win32file", "oleaut32", None, 0x0500), ("win32event", "user32", None), *************** *** 1392,1396 **** ("win32evtlog", "advapi32 oleaut32", None), # win32gui handled below ! ("win32job", "user32", None, 0x0500, 'win32/src/win32job.i win32/src/win32jobmodule.cpp'), ("win32lz", "lz32", None), ("win32net", "netapi32 advapi32", True, None, """ --- 1415,1419 ---- ("win32evtlog", "advapi32 oleaut32", None), # win32gui handled below ! ("win32job", "user32", True, 0x0500, 'win32/src/win32job.i'), ("win32lz", "lz32", None), ("win32net", "netapi32 advapi32", True, None, """ *************** *** 1407,1411 **** ("win32ras", "rasapi32 user32", None), ("win32security", "advapi32 user32 netapi32", True, 0x0500, """ ! win32/src/win32security.i win32/src/win32securitymodule.cpp win32/src/win32security_sspi.cpp win32/src/win32security_ds.cpp """), --- 1430,1434 ---- ("win32ras", "rasapi32 user32", None), ("win32security", "advapi32 user32 netapi32", True, 0x0500, """ ! win32/src/win32security.i win32/src/win32security_sspi.cpp win32/src/win32security_ds.cpp """), *************** *** 1414,1418 **** ("win32wnet", "netapi32 mpr", None), ("win32inet", "wininet", None, 0x500, """ ! win32/src/win32inet.i win32/src/win32inetmodule.cpp win32/src/win32inet_winhttp.cpp""" ), --- 1437,1441 ---- ("win32wnet", "netapi32 mpr", None), ("win32inet", "wininet", None, 0x500, """ ! win32/src/win32inet.i win32/src/win32inet_winhttp.cpp""" ), *************** *** 1466,1470 **** # winxptheme WinExt_win32("_winxptheme", ! sources = ["win32/src/_winxptheme.i", "win32/src/_winxpthememodule.cpp"], libraries="gdi32 user32 comdlg32 comctl32 shell32 Uxtheme", windows_h_version=0x0500, --- 1489,1493 ---- # winxptheme WinExt_win32("_winxptheme", ! sources = ["win32/src/_winxptheme.i"], libraries="gdi32 user32 comdlg32 comctl32 shell32 Uxtheme", windows_h_version=0x0500, *************** *** 1771,1778 **** } - # A list of modules that can also be built for Windows CE. These generate - # their .i to _win32.cpp or _wince.cpp. - swig_wince_modules = "win32event win32file win32gui win32process".split() - # .i files that are #included, and hence are not part of the build. Our .dsp # parser isn't smart enough to differentiate these. --- 1794,1797 ---- *************** *** 1893,1900 **** other_extensions ! if sys.version_info > (3,): py3k_skip_modules = \ """odbc win32evtlog win32print win32security win32inet adsi internet ! mapi shell bits ifilter isapi PyISAPI_loader """.split() ext_modules = [e for e in ext_modules if e.name not in py3k_skip_modules] --- 1912,1919 ---- other_extensions ! if is_py3k: py3k_skip_modules = \ """odbc win32evtlog win32print win32security win32inet adsi internet ! mapi bits ifilter isapi PyISAPI_loader """.split() ext_modules = [e for e in ext_modules if e.name not in py3k_skip_modules] Index: setup3.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Attic/setup3.py,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** setup3.py 1 Oct 2008 13:08:17 -0000 1.1.2.1 --- setup3.py 26 Nov 2008 07:17:38 -0000 1.1.2.2 *************** *** 4,8 **** from lib2to3.refactor import RefactoringTool, get_fixers_from_package ! fixers = get_fixers_from_package('lib2to3.fixes') options = dict(doctests_only=False, fix=[], list_fixes=[], print_function=False, verbose=False, --- 4,8 ---- from lib2to3.refactor import RefactoringTool, get_fixers_from_package ! fixers = ['lib2to3.fixes.fix_print', 'lib2to3.fixes.fix_except', 'lib2to3.fixes.fix_imports'] #get_fixers_from_package('lib2to3.fixes') options = dict(doctests_only=False, fix=[], list_fixes=[], print_function=False, verbose=False, |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:49
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/Pythonwin/pywin/idle Modified Files: Tag: py3k AutoIndent.py PyParse.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: PyParse.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle/PyParse.py,v retrieving revision 1.5.2.1 retrieving revision 1.5.2.2 diff -C2 -d -r1.5.2.1 -r1.5.2.2 *** PyParse.py 29 Aug 2008 06:16:42 -0000 1.5.2.1 --- PyParse.py 26 Nov 2008 07:17:38 -0000 1.5.2.2 *************** *** 114,130 **** def set_str(self, str): assert len(str) == 0 or str[-1] == '\n', "Oops - have str %r" % (str,) - ## if type(str) == UnicodeType: - ## # The parse functions have no idea what to do with Unicode, so - ## # replace all Unicode characters with "x". This is "safe" - ## # so long as the only characters germane to parsing the structure - ## # of Python are 7-bit ASCII. It's *necessary* because Unicode - ## # strings don't have a .translate() method that supports - ## # deletechars. - ## uniphooey = str - ## str = [] - ## push = str.append - ## for raw in map(ord, uniphooey): - ## push(raw < 127 and chr(raw) or "x") - ## str = "".join(str) self.str = str self.study_level = 0 --- 114,117 ---- Index: AutoIndent.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle/AutoIndent.py,v retrieving revision 1.3.2.5 retrieving revision 1.3.2.6 diff -C2 -d -r1.3.2.5 -r1.3.2.6 *** AutoIndent.py 24 Sep 2008 21:04:39 -0000 1.3.2.5 --- AutoIndent.py 26 Nov 2008 07:17:38 -0000 1.3.2.6 *************** *** 480,489 **** def readline(self): if self.finished: ! return "" ! i = self.i = self.i + 1 ! mark = repr(i) + ".0" ! if self.text.compare(mark, ">=", "end"): ! return b"" ! return self.text.get(mark, mark + " lineend+1c").encode(default_scintilla_encoding) def run(self): --- 480,492 ---- def readline(self): if self.finished: ! val = "" ! else: ! i = self.i = self.i + 1 ! mark = repr(i) + ".0" ! if self.text.compare(mark, ">=", "end"): ! val = "" ! else: ! val = self.text.get(mark, mark + " lineend+1c") ! return val.encode(default_scintilla_encoding) def run(self): |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:49
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/Pythonwin/pywin/framework/editor Modified Files: Tag: py3k vss.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: vss.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor/vss.py,v retrieving revision 1.4.2.2 retrieving revision 1.4.2.3 diff -C2 -d -r1.4.2.2 -r1.4.2.3 *** vss.py 2 Oct 2008 13:06:36 -0000 1.4.2.2 --- vss.py 26 Nov 2008 07:17:38 -0000 1.4.2.3 *************** *** 83,90 **** ok = 1 except pythoncom.com_error as exc: ! msg = exc.strerror ! if exc: ! msg = exc[2] ! win32ui.MessageBox(msg, "Error checking out file") except: typ, val, tb = sys.exc_info() --- 83,87 ---- ok = 1 except pythoncom.com_error as exc: ! win32ui.MessageBox(exc.strerror, "Error checking out file") except: typ, val, tb = sys.exc_info() |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:49
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/Pythonwin Modified Files: Tag: py3k win32uimodule.cpp Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: win32uimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uimodule.cpp,v retrieving revision 1.39.2.6 retrieving revision 1.39.2.7 diff -C2 -d -r1.39.2.6 -r1.39.2.7 *** win32uimodule.cpp 4 Oct 2008 18:40:01 -0000 1.39.2.6 --- win32uimodule.cpp 26 Nov 2008 07:17:38 -0000 1.39.2.7 *************** *** 337,341 **** #if (PY_VERSION_HEX < 0x03000000) USES_CONVERSION; ! csRet.Format(_T("object '%s'"), A2T(ob_type->tp_name)); #else csRet.Format(_T("object '%S'"), ob_type->tp_name); --- 337,341 ---- #if (PY_VERSION_HEX < 0x03000000) USES_CONVERSION; ! csRet.Format(_T("object '%s'"), A2T((LPSTR)ob_type->tp_name)); #else csRet.Format(_T("object '%S'"), ob_type->tp_name); |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:43
|
Update of /cvsroot/pywin32/pywin32/com/win32com In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/com/win32com Modified Files: Tag: py3k readme.htm Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: readme.htm =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/readme.htm,v retrieving revision 1.15 retrieving revision 1.15.4.1 diff -C2 -d -r1.15 -r1.15.4.1 *** readme.htm 31 May 2005 12:36:02 -0000 1.15 --- readme.htm 26 Nov 2008 07:17:39 -0000 1.15.4.1 *************** *** 28,41 **** </p> <p> ! To ease the transition, from pywin32 build 205 a FutureWarning will be issued ! when your code fetches a COM currency object - but a tuple will still be ! returned. However, if your code sets <code>pythoncom.__future_currency__ = True</code>, ! a warning will not be issued, and a decimal module object will be returned. ! At some undetermined point in the future (but not before build 208) the ! new behaviour will be the default. ! </p> ! <p> ! When supplying a COM currency object, you can supply either a decimal object ! or a tuple. This issue only applies when pythoncom passes you a currency value </p> <p> --- 28,35 ---- </p> <p> ! Up until build 212, code could set <code>pythoncom.__future_currency__ = True</code> ! to force use of the decimal module, with a warning issued otherwise. In ! builds 213 and later, the decimal module is unconditionally used when ! pythoncon returns you a currency value. </p> <p> *************** *** 55,58 **** --- 49,59 ---- <h3>Recent Changes</h3> + + <h4>Lost of internal changes on the road to py3k</h4> + + <h4>win32com.axcontrol and win2con.internet</h4> + Many more interfaces for hosting AX controls and the interfaces + used by Internet Explorer. + <h4>win32com.shell</h4> The shell interfaces have undergone a number of enhancements and changes. |
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/com/win32com/client Modified Files: Tag: py3k __init__.py build.py dynamic.py gencache.py genpy.py makepy.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: makepy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/makepy.py,v retrieving revision 1.25.2.3 retrieving revision 1.25.2.4 diff -C2 -d -r1.25.2.3 -r1.25.2.4 *** makepy.py 31 Aug 2008 18:46:46 -0000 1.25.2.3 --- makepy.py 26 Nov 2008 07:17:39 -0000 1.25.2.4 *************** *** 255,258 **** --- 255,260 ---- for typelib, info in typelibs: + gen = genpy.Generator(typelib, info.dll, progress, bUnicodeToString=bUnicodeToString, bBuildHidden=bBuildHidden) + if file is None: this_name = gencache.GetGeneratedFileName(info.clsid, info.lcid, info.major, info.minor) *************** *** 270,292 **** else: outputName = full_name + ".py" ! # generate to a temp file (so errors don't leave a 1/2 ! # generated file) and one which can handle unicode! ! try: ! os.unlink(outputName) ! except os.error: ! pass ! encoding = 'mbcs' # could make this a param. ! fileUse = open(outputName + ".temp", "wt", encoding=encoding) progress.LogBeginGenerate(outputName) else: fileUse = file ! gen = genpy.Generator(typelib, info.dll, progress, bUnicodeToString=bUnicodeToString, bBuildHidden=bBuildHidden) ! ! gen.generate(fileUse, bForDemand) ! ! if file is None: ! fileUse.close() ! os.rename(outputName + ".temp", outputName) if bToGenDir: progress.SetDescription("Importing module") --- 272,287 ---- else: outputName = full_name + ".py" ! fileUse = gen.open_writer(outputName) progress.LogBeginGenerate(outputName) else: fileUse = file ! worked = False ! try: ! gen.generate(fileUse, bForDemand) ! worked = True ! finally: ! if file is None: ! gen.finish_writer(outputName, fileUse, worked) if bToGenDir: progress.SetDescription("Importing module") Index: dynamic.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/dynamic.py,v retrieving revision 1.22.2.3 retrieving revision 1.22.2.4 diff -C2 -d -r1.22.2.3 -r1.22.2.4 *** dynamic.py 3 Oct 2008 01:09:55 -0000 1.22.2.3 --- dynamic.py 26 Nov 2008 07:17:39 -0000 1.22.2.4 *************** *** 16,20 **** --- 16,23 ---- """ + import sys import traceback + import types + import pythoncom import winerror *************** *** 22,26 **** - import types from pywintypes import IIDType --- 25,28 ---- *************** *** 63,73 **** print() # get the type objects for IDispatch and IUnknown dispatchType = pythoncom.TypeIIDs[pythoncom.IID_IDispatch] iunkType = pythoncom.TypeIIDs[pythoncom.IID_IUnknown] _defaultDispatchItem=build.DispatchItem def _GetGoodDispatch(IDispatch, clsctx = pythoncom.CLSCTX_SERVER): ! if isinstance(IDispatch, (str, IIDType)): try: IDispatch = pythoncom.connect(IDispatch) --- 65,83 ---- print() + # A helper to create method objects on the fly + if sys.version_info > (3,0): + def MakeMethod(func, inst, cls): + return types.MethodType(func, inst) # class not needed in py3k + else: + MakeMethod = types.MethodType # all args used in py2k. + # get the type objects for IDispatch and IUnknown dispatchType = pythoncom.TypeIIDs[pythoncom.IID_IDispatch] iunkType = pythoncom.TypeIIDs[pythoncom.IID_IUnknown] + _GoodDispatchTypes=(str, IIDType, unicode) _defaultDispatchItem=build.DispatchItem def _GetGoodDispatch(IDispatch, clsctx = pythoncom.CLSCTX_SERVER): ! if isinstance(IDispatch, _GoodDispatchTypes): try: IDispatch = pythoncom.connect(IDispatch) *************** *** 169,173 **** def __bool__(self): ! return 1 # ie "if object:" should always be "true" - without this, __len__ is tried. # _Possibly_ want to defer to __len__ if available, but Im not sure this is # desirable??? --- 179,183 ---- def __bool__(self): ! return True # ie "if object:" should always be "true" - without this, __len__ is tried. # _Possibly_ want to defer to __len__ if available, but Im not sure this is # desirable??? *************** *** 300,304 **** # Save the function in map. fn = self._builtMethods_[name] = tempNameSpace[name] ! newMeth = types.MethodType(fn, self) return newMeth except: --- 310,314 ---- # Save the function in map. fn = self._builtMethods_[name] = tempNameSpace[name] ! newMeth = MakeMethod(fn, self, self.__class__) return newMeth except: *************** *** 310,314 **** """Cleanup object - like a close - to force cleanup when you dont want to rely on Python's reference counting.""" ! for childCont in list(self._mapCachedItems_.values()): childCont._Release_() self._mapCachedItems_ = {} --- 320,324 ---- """Cleanup object - like a close - to force cleanup when you dont want to rely on Python's reference counting.""" ! for childCont in self._mapCachedItems_.itervalues(): childCont._Release_() self._mapCachedItems_ = {} *************** *** 434,438 **** # If a known method, create new instance and return. try: ! return types.MethodType(self._builtMethods_[attr], self) except KeyError: pass --- 444,448 ---- # If a known method, create new instance and return. try: ! return MakeMethod(self._builtMethods_[attr], self, self.__class__) except KeyError: pass *************** *** 485,489 **** self._olerepr_.mapFuncs[attr] = retEntry return self._make_method_(attr) ! raise pythoncom.com_error(details) debug_attr_print("OLE returned ", ret) return self._get_good_object_(ret) --- 495,499 ---- self._olerepr_.mapFuncs[attr] = retEntry return self._make_method_(attr) ! raise debug_attr_print("OLE returned ", ret) return self._get_good_object_(ret) Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/__init__.py,v retrieving revision 1.34.4.3 retrieving revision 1.34.4.4 diff -C2 -d -r1.34.4.3 -r1.34.4.4 *** __init__.py 3 Oct 2008 01:09:55 -0000 1.34.4.3 --- __init__.py 26 Nov 2008 07:17:39 -0000 1.34.4.4 *************** *** 6,13 **** # dispatch object, the known class will be used. This contrasts # with dynamic.Dispatch behaviour, where dynamic objects are always used. ! import builtins ! # For some bizarre reason, __builtins__ fails with attribute error on __dict__ here? # This can go away ! NeedUnicodeConversions = not hasattr(builtins, "unicode") import pythoncom --- 6,12 ---- # dispatch object, the known class will be used. This contrasts # with dynamic.Dispatch behaviour, where dynamic objects are always used. ! # This can go away ! NeedUnicodeConversions = False import pythoncom *************** *** 259,267 **** clsid = disp_class.CLSID # Create a new class that derives from 3 classes - the dispatch class, the event sink class and the user class. ! import new events_class = getevents(clsid) if events_class is None: raise ValueError("This COM object does not support events.") ! result_class = new.classobj("COMEventClass", (disp_class, events_class, user_event_class), {"__setattr__" : _event_setattr_}) instance = result_class(disp._oleobj_) # This only calls the first base class __init__. events_class.__init__(instance, instance) --- 258,271 ---- clsid = disp_class.CLSID # Create a new class that derives from 3 classes - the dispatch class, the event sink class and the user class. ! # XXX - we are still "classic style" classes in py2x, so we need can't yet ! # use 'type()' everywhere - revisit soon, as py2x will move to new-style too... ! try: ! from types import ClassType as new_type ! except ImportError: ! new_type = type # py3k events_class = getevents(clsid) if events_class is None: raise ValueError("This COM object does not support events.") ! result_class = new_type("COMEventClass", (disp_class, events_class, user_event_class), {"__setattr__" : _event_setattr_}) instance = result_class(disp._oleobj_) # This only calls the first base class __init__. events_class.__init__(instance, instance) *************** *** 469,474 **** if _PyIDispatchType==type(obj): return Dispatch(obj, obUserName, resultCLSID, UnicodeToString=NeedUnicodeConversions) - ## elif NeedUnicodeConversions and UnicodeType==type(obj): - ## return str(obj) return obj --- 473,476 ---- Index: build.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/build.py,v retrieving revision 1.31.2.3 retrieving revision 1.31.2.4 diff -C2 -d -r1.31.2.3 -r1.31.2.4 *** build.py 3 Oct 2008 01:09:55 -0000 1.31.2.3 --- build.py 26 Nov 2008 07:17:39 -0000 1.31.2.4 *************** *** 578,582 **** else: firstOptArg = numArgs - numOptArgs ! for arg in range(numArgs): try: argName = names[arg+1] --- 578,582 ---- else: firstOptArg = numArgs - numOptArgs ! for arg in xrange(numArgs): try: argName = names[arg+1] *************** *** 604,608 **** argName = MakePublicAttributeName(argName) - # insanely long lines with an 'encoding' flag crashes python 2.4.0 # keep 5 args per line --- 604,607 ---- Index: genpy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/genpy.py,v retrieving revision 1.55.2.2 retrieving revision 1.55.2.3 diff -C2 -d -r1.55.2.2 -r1.55.2.3 *** genpy.py 31 Aug 2008 09:33:17 -0000 1.55.2.2 --- genpy.py 26 Nov 2008 07:17:39 -0000 1.55.2.3 *************** *** 23,27 **** error = "makepy.error" ! makepy_version = "0.4.97" # Written to generated file. GEN_FULL="full" --- 23,27 ---- error = "makepy.error" ! makepy_version = "0.4.98" # Written to generated file. GEN_FULL="full" *************** *** 98,101 **** --- 98,102 ---- # classes. class WritableItem: + # __cmp__ used for sorting in py2x... def __cmp__(self, other): "Compare for sorting" *************** *** 103,106 **** --- 104,112 ---- if ret==0 and self.doc: ret = cmp(self.doc[0], other.doc[0]) return ret + # ... but not used in py3k - __lt__ minimum needed there + def __lt__(self, other): # py3k variant + if self.order == other.order: + return self.doc < other.doc + return self.order < other.order def __repr__(self): return "OleItem: doc=%s, order=%d" % (repr(self.doc), self.order) *************** *** 128,132 **** # (no longer necessary for new style code, but still used for old code. def WriteAliasesForItem(item, aliasItems, stream): ! for alias in list(aliasItems.values()): if item.doc and alias.aliasDoc and (alias.aliasDoc[0]==item.doc[0]): alias.WriteAliasItem(aliasItems, stream) --- 134,138 ---- # (no longer necessary for new style code, but still used for old code. def WriteAliasesForItem(item, aliasItems, stream): ! for alias in aliasItems.itervalues(): if item.doc and alias.aliasDoc and (alias.aliasDoc[0]==item.doc[0]): alias.WriteAliasItem(aliasItems, stream) *************** *** 205,210 **** if vdesc[4] == pythoncom.VAR_CONST: val = vdesc[1] ! if isinstance(val, int): ! use=val else: use = repr(str(val)) --- 211,221 ---- if vdesc[4] == pythoncom.VAR_CONST: val = vdesc[1] ! if sys.version_info <= (2,4) and (isinstance(val, int) or isinstance(val, long)): ! if val==0x80000000L: # special case ! use = "0x80000000L" # 'L' for future warning ! elif val > 0x80000000L or val < 0: # avoid a FutureWarning ! use = long(val) ! else: ! use = hex(val) else: use = repr(str(val)) *************** *** 645,649 **** def CollectOleItemInfosFromType(self): ret = [] ! for i in range(self.typelib.GetTypeInfoCount()): info = self.typelib.GetTypeInfo(i) infotype = self.typelib.GetTypeInfoType(i) --- 656,660 ---- def CollectOleItemInfosFromType(self): ret = [] ! for i in xrange(self.typelib.GetTypeInfoCount()): info = self.typelib.GetTypeInfo(i) infotype = self.typelib.GetTypeInfoType(i) *************** *** 756,759 **** --- 767,797 ---- return oleItems, enumItems, recordItems, vtableItems + def open_writer(self, filename, encoding="mbcs"): + # A place to put code to open a file with the appropriate encoding. + # Does *not* set self.file - just opens and returns a file. + # Actually *deletes* the filename asked for and returns a handle to a + # temp file - finish_writer then puts everything back in place. This + # is so errors don't leave a 1/2 generated file around causing bizarre + # errors later. + # Could be a classmethod one day... + try: + os.unlink(filename) + except os.error: + pass + filename = filename + ".temp" + if sys.version_info > (3,0): + ret = open(filename, "wt", encoding=encoding) + else: + import codecs # not available in py3k. + ret = codecs.open(filename, "wt", encoding) + return ret + + def finish_writer(self, filename, f, worked): + f.close() + if worked: + os.rename(filename + ".temp", filename) + else: + os.unlink(filename + ".temp") + def generate(self, file, is_for_demand = 0): if is_for_demand: *************** *** 777,780 **** --- 815,823 ---- self.bHaveWrittenCoClassBaseClass = 0 self.bHaveWrittenEventBaseClass = 0 + # You must provide a file correctly configured for writing unicode. + # We assert this is it may indicate somewhere in pywin32 that needs + # upgrading. + assert self.file.encoding, self.file + encoding = self.file.encoding # or "mbcs" print('# -*- coding: mbcs -*-', file=self.file) # Is this always correct? *************** *** 831,835 **** print("class constants:", file=stream) values = list(enumItems.values()) ! ## values.sort() for oleitem in values: oleitem.WriteEnumerationItems(stream) --- 874,878 ---- print("class constants:", file=stream) values = list(enumItems.values()) ! values.sort() for oleitem in values: oleitem.WriteEnumerationItems(stream) *************** *** 838,843 **** if self.generate_type == GEN_FULL: ! values = [v for v in oleItems.values() if v is not None] ! ## values.sort() for oleitem in values: self.progress.Tick() --- 881,886 ---- if self.generate_type == GEN_FULL: ! values = [v for v in oleItems.itervalues() if v is not None] ! values.sort() for oleitem in values: self.progress.Tick() *************** *** 845,849 **** values = list(vtableItems.values()) ! ## values.sort() for oleitem in values: self.progress.Tick() --- 888,892 ---- values = list(vtableItems.values()) ! values.sort() for oleitem in values: self.progress.Tick() *************** *** 853,858 **** print('RecordMap = {', file=stream) ! values = list(recordItems.values()) ! for record in values: if str(record.clsid) == pythoncom.IID_NULL: print("\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (repr(record.doc[0]), repr(str(record.clsid))), file=stream) --- 896,900 ---- print('RecordMap = {', file=stream) ! for record in recordItems.itervalues(): if str(record.clsid) == pythoncom.IID_NULL: print("\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (repr(record.doc[0]), repr(str(record.clsid))), file=stream) *************** *** 865,869 **** if self.generate_type == GEN_FULL: print('CLSIDToClassMap = {', file=stream) ! for item in list(oleItems.values()): if item is not None and item.bWritten: print("\t'%s' : %s," % (str(item.clsid), item.python_name), file=stream) --- 907,911 ---- if self.generate_type == GEN_FULL: print('CLSIDToClassMap = {', file=stream) ! for item in oleItems.itervalues(): if item is not None and item.bWritten: print("\t'%s' : %s," % (str(item.clsid), item.python_name), file=stream) *************** *** 873,877 **** print("VTablesToPackageMap = {}", file=stream) print("VTablesToClassMap = {", file=stream) ! for item in list(vtableItems.values()): print("\t'%s' : '%s'," % (item.clsid,item.python_name), file=stream) print('}', file=stream) --- 915,919 ---- print("VTablesToPackageMap = {}", file=stream) print("VTablesToClassMap = {", file=stream) ! for item in vtableItems.itervalues(): print("\t'%s' : '%s'," % (item.clsid,item.python_name), file=stream) print('}', file=stream) *************** *** 881,885 **** print('CLSIDToClassMap = {}', file=stream) print('CLSIDToPackageMap = {', file=stream) ! for item in list(oleItems.values()): if item is not None: print("\t'%s' : %s," % (str(item.clsid), repr(item.python_name)), file=stream) --- 923,927 ---- print('CLSIDToClassMap = {}', file=stream) print('CLSIDToPackageMap = {', file=stream) ! for item in oleItems.itervalues(): if item is not None: print("\t'%s' : %s," % (str(item.clsid), repr(item.python_name)), file=stream) *************** *** 887,891 **** print("VTablesToClassMap = {}", file=stream) print("VTablesToPackageMap = {", file=stream) ! for item in list(vtableItems.values()): print("\t'%s' : '%s'," % (item.clsid,item.python_name), file=stream) print('}', file=stream) --- 929,933 ---- print("VTablesToClassMap = {}", file=stream) print("VTablesToPackageMap = {", file=stream) ! for item in vtableItems.itervalues(): print("\t'%s' : '%s'," % (item.clsid,item.python_name), file=stream) print('}', file=stream) *************** *** 895,906 **** # Bit of a hack - build a temp map of iteItems + vtableItems - coClasses map = {} ! for item in list(oleItems.values()): if item is not None and not isinstance(item, CoClassItem): map[item.python_name] = item.clsid ! for item in list(vtableItems.values()): # No nones or CoClasses in this map map[item.python_name] = item.clsid print("NamesToIIDMap = {", file=stream) ! for name, iid in list(map.items()): print("\t'%s' : '%s'," % (name, iid), file=stream) print('}', file=stream) --- 937,948 ---- # Bit of a hack - build a temp map of iteItems + vtableItems - coClasses map = {} ! for item in oleItems.itervalues(): if item is not None and not isinstance(item, CoClassItem): map[item.python_name] = item.clsid ! for item in vtableItems.itervalues(): # No nones or CoClasses in this map map[item.python_name] = item.clsid print("NamesToIIDMap = {", file=stream) ! for name, iid in map.iteritems(): print("\t'%s' : '%s'," % (name, iid), file=stream) print('}', file=stream) *************** *** 960,966 **** # Make a map of iid: dispitem, vtableitem) items = {} ! for key, value in list(oleItems.items()): items[key] = (value,None) ! for key, value in list(vtableItems.items()): existing = items.get(key, None) if existing is not None: --- 1002,1008 ---- # Make a map of iid: dispitem, vtableitem) items = {} ! for key, value in oleItems.iteritems(): items[key] = (value,None) ! for key, value in vtableItems.iteritems(): existing = items.get(key, None) if existing is not None: *************** *** 971,978 **** self.progress.SetDescription("Generating...", len(items)) ! for oleitem, vtableitem in list(items.values()): an_item = oleitem or vtableitem assert not self.file, "already have a file?" ! self.file = open(os.path.join(dir, an_item.python_name) + ".py", "w") try: if oleitem is not None: --- 1013,1024 ---- self.progress.SetDescription("Generating...", len(items)) ! for oleitem, vtableitem in items.itervalues(): an_item = oleitem or vtableitem assert not self.file, "already have a file?" ! # like makepy.py, we gen to a .temp file so failure doesn't ! # leave a 1/2 generated mess. ! out_name = os.path.join(dir, an_item.python_name) + ".py" ! worked = False ! self.file = self.open_writer(out_name) try: if oleitem is not None: *************** *** 981,986 **** self.do_gen_child_item(vtableitem) self.progress.Tick() finally: ! self.file.close() self.file = None finally: --- 1027,1033 ---- self.do_gen_child_item(vtableitem) self.progress.Tick() + worked = True finally: ! self.finish_writer(out_name, self.file, worked) self.file = None finally: Index: gencache.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/gencache.py,v retrieving revision 1.32.2.1 retrieving revision 1.32.2.2 diff -C2 -d -r1.32.2.1 -r1.32.2.2 *** gencache.py 29 Aug 2008 08:58:53 -0000 1.32.2.1 --- gencache.py 26 Nov 2008 07:17:39 -0000 1.32.2.2 *************** *** 49,52 **** --- 49,57 ---- demandGeneratedTypeLibraries = {} + try: + import cPickle as pickle + except ImportError: + import pickle + def __init__(): # Initialize the module. Called once explicitly at module import below. *************** *** 61,65 **** raise RuntimeError("Trying to write to a readonly gencache ('%s')!" \ % win32com.__gen_path__) - import pickle f = open(os.path.join(GetGeneratePath(), "dicts.dat"), "wb") try: --- 66,69 ---- *************** *** 71,78 **** def _LoadDicts(): - import pickle # Load the dictionary from a .zip file if that is where we live. if hasattr(win32com, "__loader__"): ! import io loader = win32com.__loader__ arc_path = loader.archive --- 75,84 ---- def _LoadDicts(): # Load the dictionary from a .zip file if that is where we live. if hasattr(win32com, "__loader__"): ! try: ! import cStringIO as io ! except ImportError: ! import io loader = win32com.__loader__ arc_path = loader.archive *************** *** 536,539 **** --- 542,546 ---- mod = EnsureModule(tla[0], tla[1], tla[3], tla[4], bForDemand=bForDemand) GetModuleForCLSID(disp_clsid) + # Get the class from the module. from . import CLSIDToClass disp_class = CLSIDToClass.GetClass(str(disp_clsid)) *************** *** 553,569 **** dict = mod.CLSIDToClassMap info = str(typelibclsid), lcid, major, minor ! for clsid, cls in list(dict.items()): clsidToTypelib[clsid] = info dict = mod.CLSIDToPackageMap ! for clsid, name in list(dict.items()): clsidToTypelib[clsid] = info dict = mod.VTablesToClassMap ! for clsid, cls in list(dict.items()): clsidToTypelib[clsid] = info dict = mod.VTablesToPackageMap ! for clsid, cls in list(dict.items()): clsidToTypelib[clsid] = info --- 560,576 ---- dict = mod.CLSIDToClassMap info = str(typelibclsid), lcid, major, minor ! for clsid, cls in dict.iteritems(): clsidToTypelib[clsid] = info dict = mod.CLSIDToPackageMap ! for clsid, name in dict.iteritems(): clsidToTypelib[clsid] = info dict = mod.VTablesToClassMap ! for clsid, cls in dict.iteritems(): clsidToTypelib[clsid] = info dict = mod.VTablesToPackageMap ! for clsid, cls in dict.iteritems(): clsidToTypelib[clsid] = info *************** *** 652,658 **** # Build a unique dir d = {} ! for clsid, (typelibCLSID, lcid, major, minor) in list(clsidToTypelib.items()): d[typelibCLSID, lcid, major, minor] = None ! for typelibCLSID, lcid, major, minor in list(d.keys()): mod = GetModuleForTypelib(typelibCLSID, lcid, major, minor) print("%s - %s" % (mod.__doc__, typelibCLSID)) --- 659,665 ---- # Build a unique dir d = {} ! for clsid, (typelibCLSID, lcid, major, minor) in clsidToTypelib.iteritems(): d[typelibCLSID, lcid, major, minor] = None ! for typelibCLSID, lcid, major, minor in d.iterkeys(): mod = GetModuleForTypelib(typelibCLSID, lcid, major, minor) print("%s - %s" % (mod.__doc__, typelibCLSID)) |