Update of /cvsroot/pywin32/pywin32/com/win32com/client
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10628
Modified Files:
Tag: py3k
makepy.py
Log Message:
Use isinstance to determine type of typelibInfo
Index: makepy.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/makepy.py,v
retrieving revision 1.25.2.2
retrieving revision 1.25.2.3
diff -C2 -d -r1.25.2.2 -r1.25.2.3
*** makepy.py 31 Aug 2008 17:22:20 -0000 1.25.2.2
--- makepy.py 31 Aug 2008 18:46:46 -0000 1.25.2.3
***************
*** 67,71 ****
"""
! import sys, os, types, pythoncom
from win32com.client import genpy
--- 67,71 ----
"""
! import sys, os, pythoncom
from win32com.client import genpy
***************
*** 220,224 ****
if bForDemand and file is not None:
raise RuntimeError("You can only perform a demand-build when the output goes to the gen_py directory")
! if type(typelibInfo)==type(()):
# Tuple
typelibCLSID, lcid, major, minor = typelibInfo
--- 220,224 ----
if bForDemand and file is not None:
raise RuntimeError("You can only perform a demand-build when the output goes to the gen_py directory")
! if isinstance(typelibInfo, tuple):
# Tuple
typelibCLSID, lcid, major, minor = typelibInfo
***************
*** 227,231 ****
spec.FromTypelib(tlb, str(typelibCLSID))
typelibs = [(tlb, spec)]
! elif type(typelibInfo)==types.InstanceType:
if typelibInfo.dll is None:
# Version numbers not always reliable if enumerated from registry.
--- 227,231 ----
spec.FromTypelib(tlb, str(typelibCLSID))
typelibs = [(tlb, spec)]
! elif isinstance(typelibInfo, selecttlb.TypelibSpec):
if typelibInfo.dll is None:
# Version numbers not always reliable if enumerated from registry.
***************
*** 236,239 ****
--- 236,241 ----
elif hasattr(typelibInfo, "GetLibAttr"):
# A real typelib object!
+ # Could also use isinstance(typelibInfo, PyITypeLib) instead, but PyITypeLib is not directly exposed by pythoncom.
+ # pythoncom.TypeIIDs[pythoncom.IID_ITypeLib] seems to work
tla = typelibInfo.GetLibAttr()
guid = tla[0]
|