[DEV] change color option and add size display of stipping

This commit is contained in:
Edouard DUPIN 2013-10-15 21:31:41 +02:00
parent f67512f49d
commit 2a0f8bdb02
4 changed files with 21 additions and 5 deletions

View File

@ -14,7 +14,7 @@ mylutinArg = lutinArg.lutinArg()
mylutinArg.Add(lutinArg.argDefine("h", "help", desc="display this help"))
mylutinArg.AddSection("option", "Can be set one time in all case")
mylutinArg.Add(lutinArg.argDefine("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"]], desc="Display makefile debug level (verbose) default =2"))
mylutinArg.Add(lutinArg.argDefine("c", "color", desc="Display makefile output in color"))
mylutinArg.Add(lutinArg.argDefine("C", "color", desc="Display makefile output in color"))
mylutinArg.Add(lutinArg.argDefine("f", "force", desc="Force the rebuild without checking the dependency"))
mylutinArg.Add(lutinArg.argDefine("P", "pretty", desc="print the debug has pretty display"))
mylutinArg.Add(lutinArg.argDefine("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously"))
@ -22,7 +22,7 @@ mylutinArg.Add(lutinArg.argDefine("s", "force-strip", desc="Force the stripping
mylutinArg.AddSection("properties", "keep in the sequency of the cible")
mylutinArg.Add(lutinArg.argDefine("t", "target", list=[["Android",""],["Linux",""],["MacOs",""],["Windows",""]], desc="Select a target (by default the platform is the computer that compile this"))
mylutinArg.Add(lutinArg.argDefine("C", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
mylutinArg.Add(lutinArg.argDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
mylutinArg.Add(lutinArg.argDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
mylutinArg.Add(lutinArg.argDefine("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)"))
@ -109,7 +109,7 @@ def Start():
# parse all argument
for argument in localArgument:
if True==parseGenericArg(argument, False):
None # nothing to do ...
continue
elif argument.GetOptionName() == "package":
generatePackage=False
elif argument.GetOptionName() == "compilator":

View File

@ -150,9 +150,9 @@ class lutinArg:
for prop in self.m_listProperties:
if prop.GetOptionBig()=="":
continue
if prop.GetOptionBig() == option[2:2+len(prop.GetOptionBig())]:
if prop.GetOptionBig() == option[2:]:
# find it
debug.verbose("find argument 2 : " + option[2:2+len(prop.GetOptionBig())])
debug.verbose("find argument 2 : " + option[2:])
if prop.NeedParameters()==True:
internalSub = option[2+len(prop.GetOptionBig()):]
if len(internalSub)!=0:

View File

@ -282,11 +282,16 @@ class module:
lutinMultiprocess.RunCommand(cmdLine)
if "release"==target.buildMode \
or lutinEnv.GetForceStripMode()==True:
# get the file size of the non strip file
originSize = lutinTools.FileSize(file_dst);
debug.printElement("SharedLib(strip)", libName, "", "")
cmdLineStrip=lutinTools.ListToStr([
target.strip,
file_dst])
lutinMultiprocess.RunCommand(cmdLineStrip)
# get the stip size of the binary
stripSize = lutinTools.FileSize(file_dst)
debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko")
# write cmd line only after to prevent errors ...
lutinMultiprocess.StoreCommand(cmdLine, file_cmd)
#debug.printElement("SharedLib", self.name, "==>", tmpList[1])
@ -317,11 +322,16 @@ class module:
lutinMultiprocess.RunCommand(cmdLine)
if "release"==target.buildMode \
or lutinEnv.GetForceStripMode()==True:
# get the file size of the non strip file
originSize = lutinTools.FileSize(file_dst);
debug.printElement("Executable(strip)", self.name, "", "")
cmdLineStrip=lutinTools.ListToStr([
target.strip,
file_dst])
lutinMultiprocess.RunCommand(cmdLineStrip)
# get the stip size of the binary
stripSize = lutinTools.FileSize(file_dst)
debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko")
# write cmd line only after to prevent errors ...
lutinMultiprocess.StoreCommand(cmdLine, file_cmd)

View File

@ -35,6 +35,12 @@ def RemoveFile(path):
if os.path.isfile(path):
os.remove(path)
def FileSize(path):
if not os.path.isfile(path):
return 0
statinfo = os.stat(path)
return statinfo.st_size
def ListToStr(list):
if type(list) == type(str()):