mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
small changes that make otherMakePanda and makepanda more similar
This commit is contained in:
parent
64180d739c
commit
be3e668f6b
@ -13,6 +13,7 @@
|
||||
########################################################################
|
||||
|
||||
import sys,os,time,stat,string,re,getopt,cPickle
|
||||
from glob import glob
|
||||
|
||||
########################################################################
|
||||
##
|
||||
@ -30,7 +31,7 @@ FileDateCache = {}
|
||||
|
||||
def filedate(path):
|
||||
global FileDateCache
|
||||
if (FileDateCache.has_key(path)):
|
||||
if FileDateCache.has_key(path):
|
||||
return FileDateCache[path]
|
||||
try: date = os.path.getmtime(path)
|
||||
except: date = 0
|
||||
@ -44,7 +45,7 @@ def updatefiledate(path):
|
||||
FileDateCache[path] = date
|
||||
|
||||
def youngest(files):
|
||||
if (type(files) == str):
|
||||
if type(files) == str:
|
||||
source = filedate(files)
|
||||
if (source==0):
|
||||
sys.exit("Error: source file not readable: "+files)
|
||||
@ -56,17 +57,17 @@ def youngest(files):
|
||||
return result
|
||||
|
||||
def older(file,others):
|
||||
return (filedate(file)<youngest(others))
|
||||
return filedate(file)<youngest(others)
|
||||
|
||||
def xpaths(prefix,base,suffix):
|
||||
if (type(base) == str):
|
||||
if type(base) == str:
|
||||
return prefix + base + suffix
|
||||
result = []
|
||||
for x in base:
|
||||
result.append(xpaths(prefix,x,suffix))
|
||||
return result
|
||||
|
||||
if (sys.platform == "win32"):
|
||||
if sys.platform == "win32":
|
||||
import _winreg
|
||||
def GetRegistryKey(path, subkey):
|
||||
k1=0
|
||||
@ -79,27 +80,37 @@ if (sys.platform == "win32"):
|
||||
return k1
|
||||
|
||||
def oslocalcmd(cd, cmd):
|
||||
if (cd != "."):
|
||||
print "cd "+cd+" ; "+cmd
|
||||
base=os.getcwd()
|
||||
os.chdir(cd)
|
||||
if VERBOSE:
|
||||
if cd != ".":
|
||||
print "( cd "+cd+"; "+cmd+" )"
|
||||
else:
|
||||
print cmd
|
||||
if cd != ".":
|
||||
base=os.getcwd()
|
||||
os.chdir(cd)
|
||||
sys.stdout.flush()
|
||||
if (sys.platform == "win32"):
|
||||
if sys.platform == "win32":
|
||||
exe = cmd.split()[0]
|
||||
if (os.path.isfile(exe)==0):
|
||||
if os.path.isfile(exe)==0:
|
||||
for i in os.environ["PATH"].split(";"):
|
||||
if os.path.isfile(os.path.join(i, exe)):
|
||||
exe = os.path.join(i, exe)
|
||||
break
|
||||
if (os.path.isfile(exe)==0):
|
||||
if os.path.isfile(exe)==0:
|
||||
sys.exit("Cannot find "+exe+" on search path")
|
||||
res = os.spawnl(os.P_WAIT, exe, cmd)
|
||||
else: res = os.system(cmd)
|
||||
if (res != 0):
|
||||
sys.exit(1)
|
||||
if (cd != "."):
|
||||
else:
|
||||
res = os.system(cmd)
|
||||
if res != 0:
|
||||
if not VERBOSE:
|
||||
print "\n------------- Command Failed ---------------"
|
||||
if cd != ".":
|
||||
print "( cd "+cd+"; "+cmd+" )"
|
||||
else:
|
||||
print cmd
|
||||
print "--------------------------------------------"
|
||||
sys.exit(res)
|
||||
if cd != ".":
|
||||
os.chdir(base)
|
||||
|
||||
def oscmd(cmd):
|
||||
@ -196,6 +207,14 @@ DIRECTXSDK = None
|
||||
MAYASDK = {}
|
||||
MAXSDK = {}
|
||||
MAXSDKCS = {}
|
||||
|
||||
try:
|
||||
# If there is a makepandaPreferences.py, import it:
|
||||
from makepandaPreferences import *
|
||||
except ImportError:
|
||||
# If it's not there, no problem:
|
||||
pass
|
||||
|
||||
STARTTIME=time.time()
|
||||
|
||||
##########################################################################################
|
||||
@ -1045,8 +1064,10 @@ def ConditionalWriteFile(dest,desiredcontents):
|
||||
rfile = open(dest, 'rb')
|
||||
contents = rfile.read(-1)
|
||||
rfile.close()
|
||||
except: contents=0
|
||||
if (contents != desiredcontents):
|
||||
except:
|
||||
contents=0
|
||||
if contents != desiredcontents:
|
||||
if VERBOSE:
|
||||
print "Regenerating file: "+dest
|
||||
sys.stdout.flush()
|
||||
WriteFile(dest,desiredcontents)
|
||||
@ -1069,7 +1090,7 @@ def CopyFile(dstfile,srcfile):
|
||||
if (older(dstfile,srcfile)):
|
||||
global VERBOSE
|
||||
if VERBOSE >= 1:
|
||||
print "Copying "+srcfile+" -> "+dstfile+"..."
|
||||
print "Copying \"%s\" --> \"%s\""%(srcfile, dstfile)
|
||||
WriteFile(dstfile,ReadFile(srcfile))
|
||||
updatefiledate(dstfile)
|
||||
ALLTARGETS.append(dstfile)
|
||||
|
Loading…
x
Reference in New Issue
Block a user