[DEV] set the pretty print availlable ==> easy debug
This commit is contained in:
parent
419f0ee229
commit
7870b05284
7
lutin.py
7
lutin.py
@ -16,6 +16,7 @@ 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("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"))
|
||||
|
||||
mylutinArg.AddSection("properties", "keep in the sequency of the cible")
|
||||
@ -46,7 +47,7 @@ def usage():
|
||||
print " ex: " + sys.argv[0] + " all board=Android all board=Windows all help"
|
||||
exit(0)
|
||||
|
||||
# preparse the argument to get the erbose element for debug mode
|
||||
# preparse the argument to get the verbose element for debug mode
|
||||
def parseGenericArg(argument,active):
|
||||
if argument.GetOptionName() == "help":
|
||||
#display help
|
||||
@ -69,6 +70,10 @@ def parseGenericArg(argument,active):
|
||||
if active==True:
|
||||
lutinEnv.SetForceMode(True)
|
||||
return True
|
||||
elif argument.GetOptionName() == "pretty":
|
||||
if active==True:
|
||||
lutinEnv.SetPrintPrettyMode(True)
|
||||
return True
|
||||
return False
|
||||
|
||||
# parse default unique argument:
|
||||
|
37
lutinEnv.py
37
lutinEnv.py
@ -17,3 +17,40 @@ def GetForceMode():
|
||||
return forceMode
|
||||
|
||||
|
||||
printPrettyMode=False
|
||||
|
||||
def SetPrintPrettyMode(val):
|
||||
global printPrettyMode
|
||||
if val==True:
|
||||
printPrettyMode = True
|
||||
else:
|
||||
printPrettyMode = False
|
||||
|
||||
def GetPrintPrettyMode():
|
||||
global printPrettyMode
|
||||
return printPrettyMode
|
||||
|
||||
def PrintPretty(myString):
|
||||
global printPrettyMode
|
||||
if True==printPrettyMode:
|
||||
if myString[len(myString)-1]==' ' :
|
||||
tmpcmdLine = myString[:len(myString)-1]
|
||||
else :
|
||||
tmpcmdLine = myString
|
||||
tmpcmdLine = tmpcmdLine.replace(' ', '\n\t')
|
||||
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
||||
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
||||
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
||||
tmpcmdLine = tmpcmdLine.replace('-o\n\t', '-o ')
|
||||
tmpcmdLine = tmpcmdLine.replace('-D\n\t', '-D ')
|
||||
tmpcmdLine = tmpcmdLine.replace('-I\n\t', '-I ')
|
||||
tmpcmdLine = tmpcmdLine.replace('-L\n\t', '-L ')
|
||||
tmpcmdLine = tmpcmdLine.replace('g++\n\t', 'g++\t')
|
||||
tmpcmdLine = tmpcmdLine.replace('gcc\n\t', 'gcc\t')
|
||||
tmpcmdLine = tmpcmdLine.replace('ar\n\t', 'ar\t')
|
||||
tmpcmdLine = tmpcmdLine.replace('ranlib\n\t', 'ranlib\t')
|
||||
tmpcmdLine = tmpcmdLine.replace('\n\t', ' \\\n\t')
|
||||
|
||||
return tmpcmdLine
|
||||
else:
|
||||
return myString
|
||||
|
@ -11,15 +11,6 @@ import lutinHeritage as heritage
|
||||
import lutinDepend as dependency
|
||||
import lutinMultiprocess
|
||||
|
||||
def RunCommand(cmdLine):
|
||||
debug.debug(cmdLine)
|
||||
ret = os.system(cmdLine)
|
||||
# TODO : Use "subprocess" instead ==> permit to pipline the renderings ...
|
||||
if ret != 0:
|
||||
if ret == 2:
|
||||
debug.error("can not compile file ... [keyboard interrrupt]")
|
||||
else:
|
||||
debug.error("can not compile file ... ret : " + str(ret))
|
||||
"""
|
||||
|
||||
"""
|
||||
@ -246,12 +237,12 @@ class module:
|
||||
# explicitly remove the destination to prevent error ...
|
||||
if os.path.exists(file_dst) and os.path.isfile(file_dst):
|
||||
os.remove(file_dst)
|
||||
RunCommand(cmdLine)
|
||||
lutinMultiprocess.RunCommand(cmdLine)
|
||||
#$(Q)$(TARGET_RANLIB) $@
|
||||
cmdLineRanLib=lutinTools.ListToStr([
|
||||
target.ranlib,
|
||||
file_dst ])
|
||||
RunCommand(cmdLineRanLib)
|
||||
lutinMultiprocess.RunCommand(cmdLineRanLib)
|
||||
# write cmd line only after to prevent errors ...
|
||||
lutinMultiprocess.StoreCommand(cmdLine, file_cmd)
|
||||
return file_dst
|
||||
@ -282,7 +273,7 @@ class module:
|
||||
return tmpList[1]
|
||||
lutinTools.CreateDirectoryOfFile(file_dst)
|
||||
debug.printElement("SharedLib", libName, "==>", file_dst)
|
||||
RunCommand(cmdLine)
|
||||
lutinMultiprocess.RunCommand(cmdLine)
|
||||
if "release"==target.buildMode:
|
||||
debug.printElement("SharedLib(strip)", libName, "", "")
|
||||
cmdLineStrip=lutinTools.ListToStr([
|
||||
@ -316,13 +307,13 @@ class module:
|
||||
lutinTools.CreateDirectoryOfFile(file_dst)
|
||||
debug.printElement("Executable", self.name, "==>", file_dst)
|
||||
|
||||
RunCommand(cmdLine)
|
||||
lutinMultiprocess.RunCommand(cmdLine)
|
||||
if "release"==target.buildMode:
|
||||
debug.printElement("Executable(strip)", self.name, "", "")
|
||||
cmdLineStrip=lutinTools.ListToStr([
|
||||
target.strip,
|
||||
file_dst])
|
||||
RunCommand(cmdLineStrip)
|
||||
lutinMultiprocess.RunCommand(cmdLineStrip)
|
||||
# write cmd line only after to prevent errors ...
|
||||
lutinMultiprocess.StoreCommand(cmdLine, file_cmd)
|
||||
|
||||
@ -370,13 +361,20 @@ class module:
|
||||
for file in self.src:
|
||||
#debug.info(" " + self.name + " <== " + file);
|
||||
fileExt = file.split(".")[-1]
|
||||
if fileExt == "c" or fileExt == "C":
|
||||
if fileExt == "c" \
|
||||
or fileExt == "C":
|
||||
resFile = self.Compile_cc_to_o(file, packageName, target, subHeritage)
|
||||
listSubFileNeededToBuild.append(resFile)
|
||||
elif fileExt == "cpp" or fileExt == "CPP" or fileExt == "cxx" or fileExt == "CXX" or fileExt == "xx" or fileExt == "XX":
|
||||
elif fileExt == "cpp" \
|
||||
or fileExt == "CPP" \
|
||||
or fileExt == "cxx" \
|
||||
or fileExt == "CXX" \
|
||||
or fileExt == "xx" \
|
||||
or fileExt == "XX":
|
||||
resFile = self.Compile_xx_to_o(file, packageName, target, subHeritage)
|
||||
listSubFileNeededToBuild.append(resFile)
|
||||
elif fileExt == "mm" or fileExt == "MM":
|
||||
elif fileExt == "mm"
|
||||
or fileExt == "MM":
|
||||
resFile = self.Compile_mm_to_o(file, packageName, target, subHeritage)
|
||||
listSubFileNeededToBuild.append(resFile)
|
||||
else:
|
||||
|
@ -7,6 +7,7 @@ import Queue
|
||||
import os
|
||||
import subprocess
|
||||
import lutinTools
|
||||
import lutinEnv
|
||||
|
||||
queueLock = threading.Lock()
|
||||
workQueue = Queue.Queue()
|
||||
@ -31,8 +32,7 @@ def StoreCommand(cmdLine, file):
|
||||
|
||||
|
||||
def RunCommand(cmdLine, storeCmdLine=""):
|
||||
debug.debug(cmdLine)
|
||||
retcode = -1
|
||||
debug.debug(lutinEnv.PrintPretty(cmdLine))
|
||||
try:
|
||||
retcode = subprocess.call(cmdLine, shell=True)
|
||||
except OSError as e:
|
||||
|
Loading…
x
Reference in New Issue
Block a user