mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
Added support for altering Config.prc in packpanda
This commit is contained in:
parent
fc43808355
commit
78a819cd69
@ -18,6 +18,7 @@
|
|||||||
; UBITMAP - name of uninstaller bitmap (ie, "C:\Airblade\Airblade.bmp")
|
; UBITMAP - name of uninstaller bitmap (ie, "C:\Airblade\Airblade.bmp")
|
||||||
;
|
;
|
||||||
; PANDA - location of panda install tree.
|
; PANDA - location of panda install tree.
|
||||||
|
; PANDACONF - name of panda config directory - usually $PANDA\etc
|
||||||
; PSOURCE - location of the panda source-tree if available, OR location of panda install tree.
|
; PSOURCE - location of the panda source-tree if available, OR location of panda install tree.
|
||||||
; PYEXTRAS - directory containing python extras, if any.
|
; PYEXTRAS - directory containing python extras, if any.
|
||||||
;
|
;
|
||||||
@ -90,7 +91,7 @@ Section "${SMDIRECTORY}" SecCore
|
|||||||
File /r "${PANDA}\bin\*.dll"
|
File /r "${PANDA}\bin\*.dll"
|
||||||
File /r "${PANDA}\bin\Microsoft.VC80.CRT.manifest"
|
File /r "${PANDA}\bin\Microsoft.VC80.CRT.manifest"
|
||||||
SetOutPath $INSTDIR\etc
|
SetOutPath $INSTDIR\etc
|
||||||
File /r "${PANDA}\etc\*"
|
File /r "${PANDACONF}\*"
|
||||||
SetOutPath $INSTDIR\direct\src\directscripts
|
SetOutPath $INSTDIR\direct\src\directscripts
|
||||||
File /r /x CVS /x Opt?-Win32 "${PSOURCE}\direct\src\directscripts\*"
|
File /r /x CVS /x Opt?-Win32 "${PSOURCE}\direct\src\directscripts\*"
|
||||||
SetOutPath $INSTDIR\direct
|
SetOutPath $INSTDIR\direct
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
##############################################################################
|
#############################################################################
|
||||||
#
|
#
|
||||||
# packpanda - this is a tool that packages up a panda game into a
|
# packpanda - this is a tool that packages up a panda game into a
|
||||||
# convenient, easily-downloaded windows executable. Packpanda relies on
|
# convenient, easily-downloaded windows executable. Packpanda relies on
|
||||||
@ -21,7 +21,7 @@ OPTIONLIST = [
|
|||||||
("rmdir", 2, "Delete all directories with given name"),
|
("rmdir", 2, "Delete all directories with given name"),
|
||||||
("rmext", 2, "Delete all files with given extension"),
|
("rmext", 2, "Delete all files with given extension"),
|
||||||
("fast", 0, "Use fast compression instead of good compression"),
|
("fast", 0, "Use fast compression instead of good compression"),
|
||||||
("bam", 0, "Generate BAM files"),
|
("bam", 0, "Generate BAM files, change default-model-extension to BAM"),
|
||||||
("pyc", 0, "Generate PYC files"),
|
("pyc", 0, "Generate PYC files"),
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -164,20 +164,52 @@ def limitedCopyTree(src, dst, rmdir):
|
|||||||
|
|
||||||
|
|
||||||
TMPDIR=os.path.abspath("packpanda-TMP")
|
TMPDIR=os.path.abspath("packpanda-TMP")
|
||||||
|
TMPGAME=os.path.join(TMPDIR,"game")
|
||||||
|
TMPETC=os.path.join(TMPDIR,"etc")
|
||||||
print ""
|
print ""
|
||||||
print "Copying the game to "+TMPDIR+"..."
|
print "Copying the game to "+TMPDIR+"..."
|
||||||
if (os.path.exists(TMPDIR)):
|
if (os.path.exists(TMPDIR)):
|
||||||
try: shutil.rmtree(TMPDIR)
|
try: shutil.rmtree(TMPDIR)
|
||||||
except: sys.exit("Cannot delete "+TMPDIR)
|
except: sys.exit("Cannot delete "+TMPDIR)
|
||||||
try:
|
try:
|
||||||
|
os.mkdir(TMPDIR)
|
||||||
rmdir = {}
|
rmdir = {}
|
||||||
for x in OPTIONS["rmdir"]:
|
for x in OPTIONS["rmdir"]:
|
||||||
rmdir[x] = 1
|
rmdir[x] = 1
|
||||||
limitedCopyTree(DIR, TMPDIR, rmdir)
|
limitedCopyTree(DIR, TMPGAME, rmdir)
|
||||||
if not os.path.isdir( TMPDIR ):
|
if not os.path.isdir( TMPGAME ):
|
||||||
os.mkdir(TMPDIR)
|
os.mkdir(TMPGAME)
|
||||||
|
limitedCopyTree(os.path.join(PANDA, "etc"), TMPETC, {})
|
||||||
|
if not os.path.isdir( TMPETC ):
|
||||||
|
os.mkdir(TMPETC)
|
||||||
except: sys.exit("Cannot copy game to "+TMPDIR)
|
except: sys.exit("Cannot copy game to "+TMPDIR)
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# If --bam requested, change default-model-extension .egg to bam.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
def ReadFile(wfile):
|
||||||
|
try:
|
||||||
|
srchandle = open(wfile, "rb")
|
||||||
|
data = srchandle.read()
|
||||||
|
srchandle.close()
|
||||||
|
return data
|
||||||
|
except: exit("Cannot read "+wfile)
|
||||||
|
|
||||||
|
def WriteFile(wfile,data):
|
||||||
|
try:
|
||||||
|
dsthandle = open(wfile, "wb")
|
||||||
|
dsthandle.write(data)
|
||||||
|
dsthandle.close()
|
||||||
|
except: exit("Cannot write "+wfile)
|
||||||
|
|
||||||
|
if OPTIONS["bam"]:
|
||||||
|
CONF=ReadFile(os.path.join(TMPETC,"Confauto.prc"))
|
||||||
|
CONF=CONF.replace("default-model-extension .egg","default-model-extension .bam")
|
||||||
|
WriteFile(os.path.join(TMPETC,"Confauto.prc"), CONF)
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# Compile all py files, convert all egg files.
|
# Compile all py files, convert all egg files.
|
||||||
@ -244,7 +276,7 @@ def DeleteFiles(file):
|
|||||||
|
|
||||||
print ""
|
print ""
|
||||||
print "Compiling BAM and PYC files..."
|
print "Compiling BAM and PYC files..."
|
||||||
os.chdir(TMPDIR)
|
os.chdir(TMPGAME)
|
||||||
CompileFiles(".")
|
CompileFiles(".")
|
||||||
DeleteFiles(".")
|
DeleteFiles(".")
|
||||||
|
|
||||||
@ -266,8 +298,9 @@ CMD=CMD+'/DRUNTEXT="Play '+NAME+'" '
|
|||||||
CMD=CMD+'/DIBITMAP="'+BITMAP+'" '
|
CMD=CMD+'/DIBITMAP="'+BITMAP+'" '
|
||||||
CMD=CMD+'/DUBITMAP="'+BITMAP+'" '
|
CMD=CMD+'/DUBITMAP="'+BITMAP+'" '
|
||||||
CMD=CMD+'/DPANDA="'+PANDA+'" '
|
CMD=CMD+'/DPANDA="'+PANDA+'" '
|
||||||
|
CMD=CMD+'/DPANDACONF="'+TMPETC+'" '
|
||||||
CMD=CMD+'/DPSOURCE="'+PSOURCE+'" '
|
CMD=CMD+'/DPSOURCE="'+PSOURCE+'" '
|
||||||
CMD=CMD+'/DPPGAME="'+TMPDIR+'" '
|
CMD=CMD+'/DPPGAME="'+TMPGAME+'" '
|
||||||
CMD=CMD+'/DPPMAIN="'+MAIN+'" '
|
CMD=CMD+'/DPPMAIN="'+MAIN+'" '
|
||||||
CMD=CMD+'/DPPICON="'+PPICON+'" '
|
CMD=CMD+'/DPPICON="'+PPICON+'" '
|
||||||
CMD=CMD+'"'+PSOURCE+'\\direct\\src\\directscripts\\packpanda.nsi"'
|
CMD=CMD+'"'+PSOURCE+'\\direct\\src\\directscripts\\packpanda.nsi"'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user