mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -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
|
import sys,os,time,stat,string,re,getopt,cPickle
|
||||||
|
from glob import glob
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
##
|
##
|
||||||
@ -30,7 +31,7 @@ FileDateCache = {}
|
|||||||
|
|
||||||
def filedate(path):
|
def filedate(path):
|
||||||
global FileDateCache
|
global FileDateCache
|
||||||
if (FileDateCache.has_key(path)):
|
if FileDateCache.has_key(path):
|
||||||
return FileDateCache[path]
|
return FileDateCache[path]
|
||||||
try: date = os.path.getmtime(path)
|
try: date = os.path.getmtime(path)
|
||||||
except: date = 0
|
except: date = 0
|
||||||
@ -44,7 +45,7 @@ def updatefiledate(path):
|
|||||||
FileDateCache[path] = date
|
FileDateCache[path] = date
|
||||||
|
|
||||||
def youngest(files):
|
def youngest(files):
|
||||||
if (type(files) == str):
|
if type(files) == str:
|
||||||
source = filedate(files)
|
source = filedate(files)
|
||||||
if (source==0):
|
if (source==0):
|
||||||
sys.exit("Error: source file not readable: "+files)
|
sys.exit("Error: source file not readable: "+files)
|
||||||
@ -56,17 +57,17 @@ def youngest(files):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def older(file,others):
|
def older(file,others):
|
||||||
return (filedate(file)<youngest(others))
|
return filedate(file)<youngest(others)
|
||||||
|
|
||||||
def xpaths(prefix,base,suffix):
|
def xpaths(prefix,base,suffix):
|
||||||
if (type(base) == str):
|
if type(base) == str:
|
||||||
return prefix + base + suffix
|
return prefix + base + suffix
|
||||||
result = []
|
result = []
|
||||||
for x in base:
|
for x in base:
|
||||||
result.append(xpaths(prefix,x,suffix))
|
result.append(xpaths(prefix,x,suffix))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
if (sys.platform == "win32"):
|
if sys.platform == "win32":
|
||||||
import _winreg
|
import _winreg
|
||||||
def GetRegistryKey(path, subkey):
|
def GetRegistryKey(path, subkey):
|
||||||
k1=0
|
k1=0
|
||||||
@ -79,27 +80,37 @@ if (sys.platform == "win32"):
|
|||||||
return k1
|
return k1
|
||||||
|
|
||||||
def oslocalcmd(cd, cmd):
|
def oslocalcmd(cd, cmd):
|
||||||
if (cd != "."):
|
if VERBOSE:
|
||||||
print "cd "+cd+" ; "+cmd
|
if cd != ".":
|
||||||
|
print "( cd "+cd+"; "+cmd+" )"
|
||||||
|
else:
|
||||||
|
print cmd
|
||||||
|
if cd != ".":
|
||||||
base=os.getcwd()
|
base=os.getcwd()
|
||||||
os.chdir(cd)
|
os.chdir(cd)
|
||||||
else:
|
|
||||||
print cmd
|
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
if (sys.platform == "win32"):
|
if sys.platform == "win32":
|
||||||
exe = cmd.split()[0]
|
exe = cmd.split()[0]
|
||||||
if (os.path.isfile(exe)==0):
|
if os.path.isfile(exe)==0:
|
||||||
for i in os.environ["PATH"].split(";"):
|
for i in os.environ["PATH"].split(";"):
|
||||||
if os.path.isfile(os.path.join(i, exe)):
|
if os.path.isfile(os.path.join(i, exe)):
|
||||||
exe = os.path.join(i, exe)
|
exe = os.path.join(i, exe)
|
||||||
break
|
break
|
||||||
if (os.path.isfile(exe)==0):
|
if os.path.isfile(exe)==0:
|
||||||
sys.exit("Cannot find "+exe+" on search path")
|
sys.exit("Cannot find "+exe+" on search path")
|
||||||
res = os.spawnl(os.P_WAIT, exe, cmd)
|
res = os.spawnl(os.P_WAIT, exe, cmd)
|
||||||
else: res = os.system(cmd)
|
else:
|
||||||
if (res != 0):
|
res = os.system(cmd)
|
||||||
sys.exit(1)
|
if res != 0:
|
||||||
if (cd != "."):
|
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)
|
os.chdir(base)
|
||||||
|
|
||||||
def oscmd(cmd):
|
def oscmd(cmd):
|
||||||
@ -196,6 +207,14 @@ DIRECTXSDK = None
|
|||||||
MAYASDK = {}
|
MAYASDK = {}
|
||||||
MAXSDK = {}
|
MAXSDK = {}
|
||||||
MAXSDKCS = {}
|
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()
|
STARTTIME=time.time()
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
@ -1045,9 +1064,11 @@ def ConditionalWriteFile(dest,desiredcontents):
|
|||||||
rfile = open(dest, 'rb')
|
rfile = open(dest, 'rb')
|
||||||
contents = rfile.read(-1)
|
contents = rfile.read(-1)
|
||||||
rfile.close()
|
rfile.close()
|
||||||
except: contents=0
|
except:
|
||||||
if (contents != desiredcontents):
|
contents=0
|
||||||
print "Regenerating file: "+dest
|
if contents != desiredcontents:
|
||||||
|
if VERBOSE:
|
||||||
|
print "Regenerating file: "+dest
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
WriteFile(dest,desiredcontents)
|
WriteFile(dest,desiredcontents)
|
||||||
|
|
||||||
@ -1069,7 +1090,7 @@ def CopyFile(dstfile,srcfile):
|
|||||||
if (older(dstfile,srcfile)):
|
if (older(dstfile,srcfile)):
|
||||||
global VERBOSE
|
global VERBOSE
|
||||||
if VERBOSE >= 1:
|
if VERBOSE >= 1:
|
||||||
print "Copying "+srcfile+" -> "+dstfile+"..."
|
print "Copying \"%s\" --> \"%s\""%(srcfile, dstfile)
|
||||||
WriteFile(dstfile,ReadFile(srcfile))
|
WriteFile(dstfile,ReadFile(srcfile))
|
||||||
updatefiledate(dstfile)
|
updatefiledate(dstfile)
|
||||||
ALLTARGETS.append(dstfile)
|
ALLTARGETS.append(dstfile)
|
||||||
@ -1082,7 +1103,7 @@ def CopyFile(dstfile,srcfile):
|
|||||||
##
|
##
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
def CopyAllFiles(dstdir,srcdir,suffix=""):
|
def CopyAllFiles(dstdir, srcdir, suffix=""):
|
||||||
suflen = len(suffix)
|
suflen = len(suffix)
|
||||||
files = os.listdir(srcdir)
|
files = os.listdir(srcdir)
|
||||||
for x in files:
|
for x in files:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user