[pywin32-checkins] pywin32/com/win32com/client gencache.py,1.18,1.19
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-07-26 01:40:01
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1:/tmp/cvs-serv29808 Modified Files: gencache.py Log Message: Only attempt to validate the tlb file if it can be loaded - ie, if we have a generated module but no type library, we don't complain. Index: gencache.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/gencache.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** gencache.py 27 Oct 2002 10:15:08 -0000 1.18 --- gencache.py 26 Jul 2003 00:53:02 -0000 1.19 *************** *** 354,358 **** module = None minor = tlbAttr[4] ! if bValidateFile: filePathPrefix = "%s\\%s" % (GetGeneratePath(), GetGeneratedFileName(typelibCLSID, lcid, major, minor)) filePath = filePathPrefix + ".py" --- 354,367 ---- module = None minor = tlbAttr[4] ! if module is not None and bValidateFile: ! try: ! typLibPath = pythoncom.QueryPathOfRegTypeLib(typelibCLSID, major, minor, lcid) ! tlbAttributes = pythoncom.LoadRegTypeLib(typelibCLSID, major, minor, lcid).GetLibAttr() ! except pythoncom.com_error: ! # We have a module, but no type lib - we should still ! # run with what we have though - the typelib may not be ! # deployed here. ! bValidateFile = 0 ! if module is not None and bValidateFile: filePathPrefix = "%s\\%s" % (GetGeneratePath(), GetGeneratedFileName(typelibCLSID, lcid, major, minor)) filePath = filePathPrefix + ".py" *************** *** 371,375 **** # If we have a differing MinorVersion or genpy has bumped versions, update the file import genpy ! if module is not None and (module.MinorVersion != tlbAttributes[4] or genpy.makepy_version != module.makepy_version): #print "Version skew: %d, %d" % (module.MinorVersion, tlbAttributes[4]) # try to erase the bad file from the cache --- 380,384 ---- # If we have a differing MinorVersion or genpy has bumped versions, update the file import genpy ! if module.MinorVersion != tlbAttributes[4] or genpy.makepy_version != module.makepy_version: #print "Version skew: %d, %d" % (module.MinorVersion, tlbAttributes[4]) # try to erase the bad file from the cache *************** *** 389,416 **** bReloadNeeded = 1 else: ! if module is not None: ! minor = module.MinorVersion ! filePathPrefix = "%s\\%s" % (GetGeneratePath(), GetGeneratedFileName(typelibCLSID, lcid, major, minor)) ! filePath = filePathPrefix + ".py" ! filePathPyc = filePathPrefix + ".pyc" ! #print "Trying py stat: ", filePath ! fModTimeSet = 0 try: ! pyModTime = os.stat(filePath)[8] fModTimeSet = 1 except os.error, e: ! # If .py file fails, try .pyc file ! #print "Trying pyc stat", filePathPyc ! try: ! pyModTime = os.stat(filePathPyc)[8] ! fModTimeSet = 1 ! except os.error, e: ! pass ! #print "Trying stat typelib", pyModTime ! #print str(typLibPath) ! typLibModTime = os.stat(str(typLibPath[:-1]))[8] ! if fModTimeSet and (typLibModTime > pyModTime): ! bReloadNeeded = 1 ! module = None except (ImportError, os.error): module = None --- 398,424 ---- bReloadNeeded = 1 else: ! minor = module.MinorVersion ! filePathPrefix = "%s\\%s" % (GetGeneratePath(), GetGeneratedFileName(typelibCLSID, lcid, major, minor)) ! filePath = filePathPrefix + ".py" ! filePathPyc = filePathPrefix + ".pyc" ! #print "Trying py stat: ", filePath ! fModTimeSet = 0 ! try: ! pyModTime = os.stat(filePath)[8] ! fModTimeSet = 1 ! except os.error, e: ! # If .py file fails, try .pyc file ! #print "Trying pyc stat", filePathPyc try: ! pyModTime = os.stat(filePathPyc)[8] fModTimeSet = 1 except os.error, e: ! pass ! #print "Trying stat typelib", pyModTime ! #print str(typLibPath) ! typLibModTime = os.stat(str(typLibPath[:-1]))[8] ! if fModTimeSet and (typLibModTime > pyModTime): ! bReloadNeeded = 1 ! module = None except (ImportError, os.error): module = None |