comtypes 1.1.0__zip → 1.1.3__zip

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. comtypes-1.1.3/CHANGES.txt +1061 -0
  2. comtypes-1.1.3/LICENSE.txt +24 -0
  3. comtypes-1.1.3/MANIFEST.in +1 -0
  4. {comtypes-1.1.0 → comtypes-1.1.3}/PKG-INFO +1 -1
  5. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/__init__.py +7 -2
  6. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/_comobject.py +112 -74
  7. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/automation.py +5 -1
  8. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/client/_code_cache.py +1 -1
  9. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/npsupport.py +20 -15
  10. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/patcher.py +26 -2
  11. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/safearray.py +6 -10
  12. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/TestComServer.py +3 -4
  13. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_variant.py +5 -0
  14. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/tools/codegenerator.py +8 -0
  15. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/typeinfo.py +6 -1
  16. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes.egg-info/PKG-INFO +1 -1
  17. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes.egg-info/SOURCES.txt +3 -0
  18. {comtypes-1.1.0 → comtypes-1.1.3}/README +0 -0
  19. {comtypes-1.1.0 → comtypes-1.1.3}/clear_comtypes_cache.py +0 -0
  20. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/GUID.py +0 -0
  21. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/_meta.py +0 -0
  22. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/_safearray.py +0 -0
  23. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/client/__init__.py +0 -0
  24. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/client/_events.py +0 -0
  25. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/client/_generate.py +0 -0
  26. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/client/dynamic.py +0 -0
  27. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/client/lazybind.py +0 -0
  28. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/connectionpoints.py +0 -0
  29. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/errorinfo.py +0 -0
  30. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/git.py +0 -0
  31. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/hresult.py +0 -0
  32. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/logutil.py +0 -0
  33. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/messageloop.py +0 -0
  34. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/persist.py +0 -0
  35. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/server/__init__.py +0 -0
  36. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/server/automation.py +0 -0
  37. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/server/connectionpoints.py +0 -0
  38. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/server/inprocserver.py +0 -0
  39. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/server/localserver.py +0 -0
  40. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/server/register.py +0 -0
  41. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/server/w_getopt.py +0 -0
  42. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/shelllink.py +0 -0
  43. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/TestComServer.idl +0 -0
  44. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/TestComServer.tlb +0 -0
  45. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/TestDispServer.idl +0 -0
  46. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/TestDispServer.py +0 -0
  47. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/TestDispServer.tlb +0 -0
  48. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/__init__.py +0 -0
  49. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/find_memleak.py +0 -0
  50. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/mylib.idl +0 -0
  51. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/mytypelib.idl +0 -0
  52. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/runtests.py +0 -0
  53. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/setup.py +0 -0
  54. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_BSTR.py +0 -0
  55. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_DISPPARAMS.py +0 -0
  56. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_GUID.py +0 -0
  57. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_QueryService.py +0 -0
  58. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_agilent.py +0 -0
  59. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_avmc.py +0 -0
  60. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_basic.py +0 -0
  61. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_casesensitivity.py +0 -0
  62. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_client.py +0 -0
  63. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_collections.py +0 -0
  64. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_comserver.py +0 -0
  65. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_createwrappers.py +0 -0
  66. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_dict.py +0 -0
  67. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_dispinterface.py +0 -0
  68. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_dyndispatch.py +0 -0
  69. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_excel.py +0 -0
  70. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_findgendir.py +0 -0
  71. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_getactiveobj.py +0 -0
  72. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_ie.py +0 -0
  73. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_jscript.js +0 -0
  74. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_msscript.py +0 -0
  75. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_outparam.py +0 -0
  76. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_propputref.py +0 -0
  77. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_pump_events.py +0 -0
  78. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_safearray.py +0 -0
  79. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_sapi.py +0 -0
  80. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_server.py +0 -0
  81. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_showevents.py +0 -0
  82. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_subinterface.py +0 -0
  83. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_typeinfo.py +0 -0
  84. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_urlhistory.py +0 -0
  85. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_win32com_interop.py +0 -0
  86. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_wmi.py +0 -0
  87. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/test/test_word.py +0 -0
  88. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/tools/__init__.py +0 -0
  89. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/tools/tlbparser.py +0 -0
  90. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/tools/typedesc.py +0 -0
  91. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/tools/typedesc_base.py +0 -0
  92. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/util.py +0 -0
  93. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes/viewobject.py +0 -0
  94. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes.egg-info/dependency_links.txt +0 -0
  95. {comtypes-1.1.0 → comtypes-1.1.3}/comtypes.egg-info/top_level.txt +0 -0
  96. {comtypes-1.1.0 → comtypes-1.1.3}/setup.cfg +0 -0
  97. {comtypes-1.1.0 → comtypes-1.1.3}/setup.py +0 -0
@@ -9,8 +9,10 @@ class Patch(object):
9
9
  >>> class MyClass:
10
10
  ... def __init__(self, param):
11
11
  ... self.param = param
12
+ ... def bar(self):
13
+ ... print("orig bar")
12
14
 
13
- To add attributes to MyClass, you can use MonkeyPatch:
15
+ To add attributes to MyClass, you can use Patch:
14
16
 
15
17
  >>> @Patch(MyClass)
16
18
  ... class JustANamespace:
@@ -22,6 +24,28 @@ class Patch(object):
22
24
 
23
25
  The namespace is assigned None, so there's no mistaking the purpose
24
26
  >>> JustANamespace
27
+
28
+ The patcher will replace the existing methods:
29
+
30
+ >>> @Patch(MyClass)
31
+ ... class SomeNamespace:
32
+ ... def bar(self):
33
+ ... print("replaced bar")
34
+ >>> ob = MyClass('foo')
35
+ >>> ob.bar()
36
+ replaced bar
37
+
38
+ But it will not replace methods if no_replace is indicated.
39
+
40
+ >>> @Patch(MyClass)
41
+ ... class AnotherNamespace:
42
+ ... @no_replace
43
+ ... def bar(self):
44
+ ... print("candy bar")
45
+ >>> ob = MyClass('foo')
46
+ >>> ob.bar()
47
+ replaced bar
48
+
25
49
  """
26
50
 
27
51
  def __init__(self, target):
@@ -32,7 +56,7 @@ class Patch(object):
32
56
  if name in vars(ReferenceEmptyClass):
33
57
  continue
34
58
  no_replace = getattr(value, '__no_replace', False)
35
- if no_replace and hasattr(value, name):
59
+ if no_replace and hasattr(self.target, name):
36
60
  continue
37
61
  setattr(self.target, name, value)
38
62
 
@@ -4,6 +4,8 @@ from ctypes import (POINTER, Structure, byref, cast, c_long, memmove, pointer,
4
4
  sizeof)
5
5
  from comtypes import _safearray, IUnknown, com_interface_registry, npsupport
6
6
  from comtypes.patcher import Patch
7
+
8
+ numpy = npsupport.numpy
7
9
  _safearray_type_cache = {}
8
10
 
9
11
 
@@ -150,9 +152,6 @@ def _make_safearray_type(itemtype):
150
152
  @classmethod
151
153
  def create_from_ndarray(cls, value, extra, lBound=0):
152
154
  from comtypes.automation import VARIANT
153
- #c:/python25/lib/site-packages/numpy/ctypeslib.py
154
- numpy = __import__("numpy.ctypeslib")
155
-
156
155
  # If processing VARIANT, makes sure the array type is correct.
157
156
  if cls._itemtype_ is VARIANT:
158
157
  if value.dtype != npsupport.VARIANT_dtype:
@@ -223,9 +222,9 @@ def _make_safearray_type(itemtype):
223
222
  self._needsfree = True
224
223
  return self[0]
225
224
 
226
- def __del__(self):
225
+ def __del__(self, _SafeArrayDestroy=_safearray.SafeArrayDestroy):
227
226
  if self._needsfree:
228
- _safearray.SafeArrayDestroy(self)
227
+ _SafeArrayDestroy(self)
229
228
 
230
229
  def _get_size(self, dim):
231
230
  "Return the number of elements for dimension 'dim'"
@@ -308,10 +307,10 @@ def _make_safearray_type(itemtype):
308
307
  # we can get the most speed-up.
309
308
  # XXX Only try to convert types known to
310
309
  # numpy.ctypeslib.
311
- import numpy.ctypeslib
312
310
  if (safearray_as_ndarray and self._itemtype_ in
313
311
  numpy.ctypeslib._typecodes.values()):
314
- arr = numpy.ctypeslib.as_array(ptr, (num_elements,))
312
+ arr = numpy.ctypeslib.as_array(ptr,
313
+ (num_elements,))
315
314
  return arr.copy()
316
315
  return ptr[:num_elements]
317
316
 
@@ -365,8 +364,6 @@ def _make_safearray_type(itemtype):
365
364
 
366
365
  def _ndarray_to_variant_array(value):
367
366
  """ Convert an ndarray to VARIANT_dtype array """
368
- numpy = npsupport.numpy
369
-
370
367
  # Check that variant arrays are supported
371
368
  if npsupport.VARIANT_dtype is None:
372
369
  msg = "VARIANT ndarrays require NumPy 1.7 or newer."
@@ -390,7 +387,6 @@ def _datetime64_ndarray_to_variant_array(value):
390
387
  # since midnight 30 December 1899. Hours and minutes are represented as
391
388
  # fractional days.
392
389
  from comtypes.automation import VT_DATE
393
- numpy = npsupport.numpy
394
390
  value = numpy.array(value, "datetime64[ns]")
395
391
  value = value - npsupport.com_null_date64
396
392
  # Convert to days
@@ -117,9 +117,8 @@ class TestComServer(
117
117
 
118
118
  _name = u"spam, spam, spam"
119
119
 
120
- def ITestComServer__get_name(self, this, pname):
121
- pname[0] = self._name
122
- return S_OK
120
+ def _get_name(self):
121
+ return self._name
123
122
 
124
123
  def ITestComServer__set_name(self, this, name):
125
124
  self._name = name
@@ -139,7 +138,7 @@ class TestComServer(
139
138
  ## HRESULT MixedInOut([in] int a, [out] int *b, [in] int c, [out] int *d);
140
139
  def MixedInOut(self, a, c):
141
140
  return a+1, c+1
142
-
141
+
143
142
  if __name__ == "__main__":
144
143
  try:
145
144
  from comtypes.server.register import UseCommandLine
@@ -176,6 +176,11 @@ class VariantTestCase(unittest.TestCase):
176
176
  v.vt = VT_BSTR
177
177
  self.failUnless(v.value in ("", None))
178
178
 
179
+ def test_empty_BSTR(self):
180
+ v = VARIANT()
181
+ v.value = ""
182
+ self.assertEqual(v.vt, VT_BSTR)
183
+
179
184
  def test_UDT(self):
180
185
  from comtypes.gen.TestComServerLib import MYCOLOR
181
186
  v = VARIANT(MYCOLOR(red=1.0, green=2.0, blue=3.0))
@@ -2,12 +2,15 @@
2
2
  # libraries.
3
3
  import os
4
4
  import cStringIO
5
+ import keyword
5
6
  from comtypes.tools import typedesc
6
7
  import comtypes.client
7
8
  import comtypes.client._generate
8
9
 
9
10
  version = "$Rev$"[6:-2]
10
11
 
12
+ __warn_on_munge__ = __debug__
13
+
11
14
 
12
15
  class lcid(object):
13
16
  def __repr__(self):
@@ -345,6 +348,11 @@ class Generator(object):
345
348
  _enumvalues = 0
346
349
  def EnumValue(self, tp):
347
350
  value = int(tp.value)
351
+ if keyword.iskeyword(tp.name):
352
+ # XXX use logging!
353
+ if __warn_on_munge__:
354
+ print "# Fixing keyword as EnumValue for %s" % tp.name
355
+ tp.name += "_"
348
356
  print >> self.stream, \
349
357
  "%s = %d" % (tp.name, value)
350
358
  self.names.add(tp.name)
@@ -4,6 +4,7 @@
4
4
  # flags '..\tools\windows.xml -m comtypes -m comtypes.automation -w -r .*TypeLibEx -r .*TypeLib -o typeinfo.py'
5
5
  # then hacked manually
6
6
  import os
7
+ import sys
7
8
  import weakref
8
9
 
9
10
  from ctypes import *
@@ -31,6 +32,8 @@ from comtypes.automation import WCHAR
31
32
  from comtypes.automation import WORD
32
33
  from comtypes.automation import tagVARIANT
33
34
 
35
+ is_64_bit = sys.maxsize > 2**32
36
+
34
37
  BOOL = c_int
35
38
  HREFTYPE = DWORD
36
39
  INT = c_int
@@ -38,7 +41,9 @@ MEMBERID = DISPID
38
41
  OLECHAR = WCHAR
39
42
  PVOID = c_void_p
40
43
  SHORT = c_short
41
- ULONG_PTR = c_ulong
44
+ # See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx#ULONG_PTR # noqa
45
+ ULONG_PTR = c_uint64 if is_64_bit else c_ulong
46
+
42
47
  USHORT = c_ushort
43
48
  LPOLESTR = POINTER(OLECHAR)
44
49
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: comtypes
3
- Version: 1.1.0
3
+ Version: 1.1.3
4
4
  Summary: Pure Python COM package
5
5
  Home-page: http://starship.python.net/crew/theller/comtypes
6
6
  Author: Thomas Heller
@@ -1,3 +1,6 @@
1
+ CHANGES.txt
2
+ LICENSE.txt
3
+ MANIFEST.in
1
4
  README
2
5
  clear_comtypes_cache.py
3
6
  setup.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes