home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import win32com
- import win32com.client.makepy as win32com
- import win32com.test as win32com
- import pythoncom
- import sys
- import os
- genList = [
- ('msword8', '{00020905-0000-0000-C000-000000000046}', 1033, 8, 0)]
- genDir = 'Generated4Test'
-
- def GetGenPath():
- import win32api
- return os.path.join(win32api.GetFullPathName(win32com.test.__path__[0]), genDir)
-
-
- def GenerateFromRegistered(fname, *loadArgs):
- genPath = GetGenPath()
-
- try:
- os.stat(genPath)
- except os.error:
- os.mkdir(genPath)
-
- open(os.path.join(genPath, '__init__.py'), 'w').close()
- print fname, ': generating -',
- f = open(os.path.join(genPath, fname + '.py'), 'w')
- win32com.client.makepy.GenerateFromTypeLibSpec(loadArgs, f, bQuiet = 1, bGUIProgress = 1, bUnicodeToString = NeedUnicodeConversions)
- f.close()
- print 'compiling -',
- fullModName = 'win32com.test.%s.%s' % (genDir, fname)
- exec 'import ' + fullModName
- sys.modules[fname] = sys.modules[fullModName]
- print 'done'
-
-
- def GenerateAll():
- for args in genList:
-
- try:
- apply(GenerateFromRegistered, args)
- continue
- except KeyboardInterrupt:
- print '** Interrupted ***'
- break
- continue
- except pythoncom.com_error:
- print '** Could not generate test code for ', args[0]
- continue
-
- return None
-
-
-
- def CleanAll():
- print 'Cleaning generated test scripts...'
-
- try:
- 1 / 0
- except:
- pass
-
- genPath = GetGenPath()
- for args in genList:
-
- try:
- name = args[0] + '.py'
- os.unlink(os.path.join(genPath, name))
- except os.error:
- details = None
- if type(details) == type(()) and details[0] != 2:
- print 'Could not deleted generated', name, details
-
- except:
- details[0] != 2
-
-
- try:
- name = args[0] + '.pyc'
- os.unlink(os.path.join(genPath, name))
- except os.error:
- details = None
- if type(details) == type(()) and details[0] != 2:
- print 'Could not deleted generated', name, details
-
- except:
- details[0] != 2
-
-
- try:
- os.unlink(os.path.join(genPath, '__init__.py'))
- except:
- pass
-
-
- try:
- os.unlink(os.path.join(genPath, '__init__.pyc'))
- continue
- continue
-
-
-
- try:
- os.rmdir(genPath)
- except os.error:
- details = None
- print 'Could not delete test directory -', details
-
-
- if __name__ == '__main__':
- GenerateAll()
- CleanAll()
-
-