include version number in dependency cache (sorry for forcing a full rebuild onto y'all)

This commit is contained in:
rdb 2013-12-22 10:12:19 +00:00
parent 5bd9eaf7fc
commit adf9b05381

View File

@ -709,6 +709,7 @@ def CxxGetIncludes(path):
## ##
######################################################################## ########################################################################
DCACHE_VERSION = 2
DCACHE_BACKED_UP = False DCACHE_BACKED_UP = False
def SaveDependencyCache(): def SaveDependencyCache():
@ -720,10 +721,15 @@ def SaveDependencyCache():
os.path.join(OUTPUTDIR, "tmp", "makepanda-dcache-backup")) os.path.join(OUTPUTDIR, "tmp", "makepanda-dcache-backup"))
except: pass except: pass
DCACHE_BACKED_UP = True DCACHE_BACKED_UP = True
try: icache = open(os.path.join(OUTPUTDIR, "tmp", "makepanda-dcache"),'wb')
except: icache = 0 try:
if (icache!=0): icache = open(os.path.join(OUTPUTDIR, "tmp", "makepanda-dcache"),'wb')
except:
icache = None
if icache is not None:
print("Storing dependency cache.") print("Storing dependency cache.")
pickle.dump(DCACHE_VERSION, icache, 0)
pickle.dump(CXXINCLUDECACHE, icache, 2) pickle.dump(CXXINCLUDECACHE, icache, 2)
pickle.dump(BUILTFROMCACHE, icache, 2) pickle.dump(BUILTFROMCACHE, icache, 2)
icache.close() icache.close()
@ -731,12 +737,20 @@ def SaveDependencyCache():
def LoadDependencyCache(): def LoadDependencyCache():
global CXXINCLUDECACHE global CXXINCLUDECACHE
global BUILTFROMCACHE global BUILTFROMCACHE
try: icache = open(os.path.join(OUTPUTDIR, "tmp", "makepanda-dcache"),'rb')
except: icache = 0 try:
if (icache!=0): icache = open(os.path.join(OUTPUTDIR, "tmp", "makepanda-dcache"), 'rb')
CXXINCLUDECACHE = pickle.load(icache) except:
BUILTFROMCACHE = pickle.load(icache) icache = None
icache.close()
if icache is not None:
ver = pickle.load(icache)
if ver == DCACHE_VERSION:
CXXINCLUDECACHE = pickle.load(icache)
BUILTFROMCACHE = pickle.load(icache)
icache.close()
else:
print("Cannot load dependency cache, version is too old!")
######################################################################## ########################################################################
## ##