Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

testmakepy.py 1.9KB

1 year ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Test makepy - try and run it over every OCX in the windows system directory.
  2. import sys
  3. import traceback
  4. import pythoncom
  5. import win32api
  6. import win32com.test.util
  7. import winerror
  8. from win32com.client import gencache, makepy, selecttlb
  9. def TestBuildAll(verbose=1):
  10. num = 0
  11. tlbInfos = selecttlb.EnumTlbs()
  12. for info in tlbInfos:
  13. if verbose:
  14. print("%s (%s)" % (info.desc, info.dll))
  15. try:
  16. makepy.GenerateFromTypeLibSpec(info)
  17. # sys.stderr.write("Attr typeflags for coclass referenced object %s=%d (%d), typekind=%d\n" % (name, refAttr.wTypeFlags, refAttr.wTypeFlags & pythoncom.TYPEFLAG_FDUAL,refAttr.typekind))
  18. num += 1
  19. except pythoncom.com_error as details:
  20. # Ignore these 2 errors, as the are very common and can obscure
  21. # useful warnings.
  22. if details.hresult not in [
  23. winerror.TYPE_E_CANTLOADLIBRARY,
  24. winerror.TYPE_E_LIBNOTREGISTERED,
  25. ]:
  26. print("** COM error on", info.desc)
  27. print(details)
  28. except KeyboardInterrupt:
  29. print("Interrupted!")
  30. raise KeyboardInterrupt
  31. except:
  32. print("Failed:", info.desc)
  33. traceback.print_exc()
  34. if makepy.bForDemandDefault:
  35. # This only builds enums etc by default - build each
  36. # interface manually
  37. tinfo = (info.clsid, info.lcid, info.major, info.minor)
  38. mod = gencache.EnsureModule(info.clsid, info.lcid, info.major, info.minor)
  39. for name in mod.NamesToIIDMap.keys():
  40. makepy.GenerateChildFromTypeLibSpec(name, tinfo)
  41. return num
  42. def TestAll(verbose=0):
  43. num = TestBuildAll(verbose)
  44. print("Generated and imported", num, "modules")
  45. win32com.test.util.CheckClean()
  46. if __name__ == "__main__":
  47. TestAll("-q" not in sys.argv)