def open(self):
self.__inPos = 0
self.__inPosOld = 0
self.__outFile = None
self.__current = DirHasher.FileIndex.Stat()
try:
if os.path.exists(self.__cachePath):
self.__inFile = open(self.__cachePath, "rb")
sig = self.__inFile.read(4)
if sig == DirHasher.FileIndex.SIGNATURE:
self.__mismatch = False
self.__inPos = self.__inPosOld = 4
self.__readEntry() # prefetch first entry
else:
logging.getLogger(__name__).info(
"Wrong signature at '%s': %s", self.__cachePath, sig)
self.__inFile.close()
self.__inFile = None
self.__mismatch = True
else:
self.__inFile = None
self.__mismatch = True
except OSError as e:
raise BuildError("Error opening hash cache: " + str(e))
评论列表
文章目录