Updated to squeeze pandamodules not showbaseglobal

This commit is contained in:
Mark Mine 2003-06-20 01:30:25 +00:00
parent 899781208a
commit 5c6aa9b77c

View File

@ -1,20 +1,43 @@
import os import os
import sys
import getopt
import pandaSqueezeTool import pandaSqueezeTool
# Assumption: We will be squeezing the files from C:\Panda\lib\py # Assumption: We will be squeezing the files from C:\Panda\lib\py
try:
opts, pargs = getopt.getopt(sys.argv[1:], 'O')
except Exception, e:
# User passed in a bad option, print the error and the help, then exit
print e
print 'Usage: pass in -O for optimized'
sys.exit()
fOptimized = 0
# Store the option values into our variables
for opt in opts:
flag, value = opt
if (flag == '-O'):
fOptimized = 1
print 'Squeezing pyo files'
def getSqueezeableFiles(): def getSqueezeableFiles():
directDir = os.getenv('DIRECT') directDir = os.getenv('DIRECT')
fileList = os.listdir(directDir + "\lib\py") fileList = os.listdir(directDir + "\lib\py")
newFileList = [] newFileList = []
for i in fileList: if fOptimized:
if i[-4:] == ".pyc": targetFileExtension = ".pyo"
j = directDir + "/lib/py/" + i else:
newFileList.append(j) targetFileExtension = ".pyc"
return newFileList for i in fileList:
base,ext = os.path.splitext(i)
if (ext == ".py"):
j = directDir + "/lib/py/" + i
newFileList.append(j)
return newFileList
def squeezePandaFiles(): def squeezePandaFiles():
l = getSqueezeableFiles() l = getSqueezeableFiles()
pandaSqueezeTool.squeeze("panda", "ShowBaseGlobal", l) pandaSqueezeTool.squeeze("PandaModules", "PandaModulesUnsqueezed", l)
squeezePandaFiles() squeezePandaFiles()