fix maya location on linux, fix dependency cache problems with Python 3 that forced a full rebuild every time

This commit is contained in:
rdb 2013-12-17 13:33:39 +00:00
parent 0046d259dc
commit b686d371ca
2 changed files with 42 additions and 37 deletions

View File

@ -2149,7 +2149,7 @@ def WriteConfigSettings():
speedtree_parameters["SPEEDTREE_BIN_DIR"] = (SDK["SPEEDTREE"] + "/Bin")
conf = "/* prc_parameters.h. Generated automatically by makepanda.py */\n"
for key in prc_parameters.keys():
for key in sorted(prc_parameters.keys()):
if ((key == "DEFAULT_PRC_DIR") or (key[:4]=="PRC_")):
val = OverrideValue(key, prc_parameters[key])
if (val == 'UNDEF'): conf = conf + "#undef " + key + "\n"
@ -2157,7 +2157,7 @@ def WriteConfigSettings():
ConditionalWriteFile(GetOutputDir() + '/include/prc_parameters.h', conf)
conf = "/* dtool_config.h. Generated automatically by makepanda.py */\n"
for key in dtool_config.keys():
for key in sorted(dtool_config.keys()):
val = OverrideValue(key, dtool_config[key])
if (val == 'UNDEF'): conf = conf + "#undef " + key + "\n"
else: conf = conf + "#define " + key + " " + val + "\n"
@ -2165,7 +2165,7 @@ def WriteConfigSettings():
if (RTDIST or RUNTIME):
conf = "/* p3d_plugin_config.h. Generated automatically by makepanda.py */\n"
for key in plugin_config.keys():
for key in sorted(plugin_config.keys()):
val = plugin_config[key]
if (val == 'UNDEF'): conf = conf + "#undef " + key + "\n"
else: conf = conf + "#define " + key + " \"" + val.replace("\\", "\\\\") + "\"\n"
@ -2173,7 +2173,7 @@ def WriteConfigSettings():
if (PkgSkip("SPEEDTREE")==0):
conf = "/* speedtree_parameters.h. Generated automatically by makepanda.py */\n"
for key in speedtree_parameters.keys():
for key in sorted(speedtree_parameters.keys()):
val = OverrideValue(key, speedtree_parameters[key])
if (val == 'UNDEF'): conf = conf + "#undef " + key + "\n"
else: conf = conf + "#define " + key + " \"" + val.replace("\\", "\\\\") + "\"\n"

View File

@ -628,31 +628,33 @@ def ClearTimestamp(path):
BUILTFROMCACHE = {}
def JustBuilt(files, others):
dates = []
dates = {}
for file in files:
del TIMESTAMPCACHE[file]
dates.append(GetTimestamp(file))
dates[file] = GetTimestamp(file)
for file in others:
dates.append(GetTimestamp(file))
dates[file] = GetTimestamp(file)
key = tuple(files)
BUILTFROMCACHE[key] = [others,dates]
BUILTFROMCACHE[key] = dates
def NeedsBuild(files, others):
dates = []
dates = {}
for file in files:
dates.append(GetTimestamp(file))
if (not os.path.exists(file)): return 1
dates[file] = GetTimestamp(file)
if not os.path.exists(file):
return True
for file in others:
dates.append(GetTimestamp(file))
dates[file] = GetTimestamp(file)
key = tuple(files)
if (key in BUILTFROMCACHE):
if (BUILTFROMCACHE[key] == [others,dates]):
return 0
else:
oldothers = BUILTFROMCACHE[key][0]
if (oldothers != others and VERBOSE):
if key in BUILTFROMCACHE:
if BUILTFROMCACHE[key] == dates:
return False
if VERBOSE and frozenset(oldothers) != frozenset(others):
print("%sWARNING:%s file dependencies changed: %s%s%s" % (GetColor("red"), GetColor(), GetColor("green"), files, GetColor()))
return 1
return True
########################################################################
##
@ -721,8 +723,8 @@ def SaveDependencyCache():
except: icache = 0
if (icache!=0):
print("Storing dependency cache.")
pickle.dump(CXXINCLUDECACHE, icache, 1)
pickle.dump(BUILTFROMCACHE, icache, 1)
pickle.dump(CXXINCLUDECACHE, icache, 2)
pickle.dump(BUILTFROMCACHE, icache, 2)
icache.close()
def LoadDependencyCache():
@ -973,6 +975,8 @@ def ConditionalWriteFile(dest, desiredcontents):
except:
contents = 0
if contents != desiredcontents:
if VERBOSE:
print("Writing %s" % (dest))
sys.stdout.flush()
WriteFile(dest, desiredcontents)
@ -1759,7 +1763,7 @@ def SdkLocateMaya():
ddir = "/Applications/Autodesk/maya"+key
if (os.path.isdir(ddir)): SDK[ver] = ddir
else:
if (GetTargetArch() == 'x64'):
if (GetTargetArch() in ("x86_64", "amd64")):
ddir1 = "/usr/autodesk/maya"+key+"-x64"
ddir2 = "/usr/aw/maya"+key+"-x64"
else:
@ -2546,7 +2550,7 @@ def FindLocation(fn, ipath):
if (GetLinkAllStatic() and fn.endswith(".dll")):
fn = fn[:-4] + ".lib"
loc = CalcLocation(fn, ipath)
(base,ext) = os.path.splitext(fn)
base, ext = os.path.splitext(fn)
ORIG_EXT[loc] = ext
return loc
@ -2642,6 +2646,7 @@ def TargetAdd(target, dummy=0, opts=0, input=0, dep=0, ipath=0, winrc=0):
for x in dep:
fulldep = FindLocation(x, ipath)
t.deps[fulldep] = 1
if winrc != 0 and GetTarget() == 'windows':
TargetAdd(target, input=WriteResourceFile(target.split("/")[-1].split(".")[0], **winrc))