mirror of
https://github.com/elua/elua.git
synced 2025-01-08 20:56:17 +08:00
mostly cosmetic changes for the new romfs compress/compile feature
This commit is contained in:
parent
d215353e2f
commit
e935ae52e7
@ -234,6 +234,11 @@ if romfsmode not in ['verbatim', 'compile', 'compress']:
|
||||
# Build the compilation command now
|
||||
compcmd = ''
|
||||
if romfsmode == 'compile':
|
||||
# First check for luac.cross in the current directory
|
||||
if not os.path.isfile( "luac.cross" ):
|
||||
print "The eLua cross compiler was not found."
|
||||
print "Build it by running 'scons -f cross-lua.py'"
|
||||
sys.exit( -1 )
|
||||
compcmd = './luac.cross -ccn %s -cce %s -o %%s -s %%s' % ( toolset[ 'cross_%s' % target ], toolset[ 'cross_cpumode' ] )
|
||||
elif romfsmode == 'compress':
|
||||
compcmd = 'lua luasrcdiet.lua --quiet --maximum --opt-comments --opt-whitespace --opt-emptylines --opt-eols --opt-strings --opt-numbers --opt-locals -o %s %s'
|
||||
|
8
mkfs.py
8
mkfs.py
@ -75,12 +75,13 @@ def mkfs( dirname, outname, flist, mode, compcmd ):
|
||||
return False
|
||||
|
||||
# Do we need to process the file?
|
||||
fextpart = ''
|
||||
if mode == "compile" or mode == "compress":
|
||||
fnamepart, fextpart = os.path.splitext( realname )
|
||||
if mode == "compress":
|
||||
newext = ".lua.tmp"
|
||||
else:
|
||||
newext = ".luac"
|
||||
newext = ".lc"
|
||||
if fextpart == ".lua":
|
||||
newname = fnamepart + newext
|
||||
if mode == "compress":
|
||||
@ -102,9 +103,8 @@ def mkfs( dirname, outname, flist, mode, compcmd ):
|
||||
fname = fnamepart + ".lc"
|
||||
filedata = crtfile.read()
|
||||
crtfile.close()
|
||||
if mode == 'compile' or mode == "compress":
|
||||
if fextpart == ".lua":
|
||||
os.remove( newname )
|
||||
if fextpart == ".lua" and mode != "verbatim":
|
||||
os.remove( newname )
|
||||
|
||||
# Write name, size, id, numpars
|
||||
for c in fname:
|
||||
|
Loading…
x
Reference in New Issue
Block a user