[DEV] correction of the dependence check (basic error)

This commit is contained in:
Edouard DUPIN 2013-04-25 22:11:05 +02:00
parent d0356e2fd0
commit 810f699b6c
3 changed files with 53 additions and 30 deletions

View File

@ -31,10 +31,6 @@ def NeedReBuild(dst, src, dependFile, file_cmd="", cmdLine=""):
if ""!=file_cmd:
if False==os.path.exists(file_cmd):
debug.verbose(" ==> must rebuild (no commandLine file)")
file2 = open(file_cmd, "w")
file2.write(cmdLine)
file2.flush()
file2.close()
return True
# check if the 2 cmdline are similar :
file2 = open(file_cmd, "r")
@ -44,10 +40,6 @@ def NeedReBuild(dst, src, dependFile, file_cmd="", cmdLine=""):
debug.verbose(" ==> '" + cmdLine + "'")
debug.verbose(" ==> '" + firstAndUniqueLine + "'")
file2.close()
file2 = open(file_cmd, "w")
file2.write(cmdLine)
file2.flush()
file2.close()
return True
# the cmdfile is correct ...
file2.close()
@ -60,9 +52,11 @@ def NeedReBuild(dst, src, dependFile, file_cmd="", cmdLine=""):
curLine = curLine[:len(curLine)-1]
# removing last \ ...
if curLine[len(curLine)-1:] == '\\' :
curLine = curLine[len(curLine)-1:]
curLine = curLine[:len(curLine)-1]
# remove white space :
#debug.verbose(" Line (read) : '" + curLine + "'");
curLine = curLine.strip()
#debug.verbose(" Line (strip) : '" + curLine + "'");
testFile=""
if curLine[len(curLine)-1:] == ':':
@ -77,11 +71,11 @@ def NeedReBuild(dst, src, dependFile, file_cmd="", cmdLine=""):
if testFile!="":
debug.verbose(" ==> test");
if False==os.path.exists(testFile):
debug.warning(" ==> must rebuild (a dependency file does not exist)")
debug.verbose(" ==> must rebuild (a dependency file does not exist)")
file.close()
return True
if os.path.getmtime(testFile) > os.path.getmtime(dst):
debug.warning(" ==> must rebuild (a dependency file time is newer)")
debug.verbose(" ==> must rebuild (a dependency file time is newer)")
file.close()
return True
# close the current file :

View File

@ -277,6 +277,12 @@ class module:
depancy.flags_ld,
target.global_flags_ld])
RunCommand(cmdLine)
if "release"==target.buildMode:
debug.printElement("SharedLib(strip)", self.name, "", "")
cmdLine=lutinTools.ListToStr([
target.strip,
tmpList[1]])
RunCommand(cmdLine)
#debug.printElement("SharedLib", self.name, "==>", tmpList[1])
"""$(Q)$(TARGET_CXX) \
-o $@ \
@ -321,6 +327,13 @@ class module:
depancy.flags_ld,
target.global_flags_ld])
RunCommand(cmdLine)
if "release"==target.buildMode:
debug.printElement("Executable(strip)", self.name, "", "")
cmdLine=lutinTools.ListToStr([
target.strip,
tmpList[1]])
RunCommand(cmdLine)
"""
$(TARGET_CXX) \
-o $@ \
@ -339,7 +352,7 @@ class module:
$(PRIVATE_LDLIBS) \
$(TARGET_GLOBAL_LDLIBS)
"""
#$(call strip-executable)
#$(call strip- )
###############################################################################
## Commands for copying files

View File

@ -7,6 +7,17 @@ import Queue
import os
import subprocess
queueLock = threading.Lock()
workQueue = Queue.Queue()
currentThreadWorking = 0
threads = []
exitFlag = False # resuest stop of the thread
isInit = False # the thread are initialized
errorOccured = False # a thread have an error
processorAvaillable = 1 # number of CPU core availlable
def RunCommand(cmdLine, storeCmdLine=""):
debug.debug(cmdLine)
retcode = -1
@ -15,22 +26,26 @@ def RunCommand(cmdLine, storeCmdLine=""):
except OSError as e:
print >>sys.stderr, "Execution failed:", e
if retcode != 0:
global errorOccured
errorOccured = True
global exitFlag
exitFlag = True
if retcode == 2:
debug.error("can not compile file ... [keyboard interrrupt]")
else:
debug.error("can not compile file ... ret : " + str(retcode))
return
# write cmd line only after to prvent errors ...
# write cmd line only after to prevent errors ...
if storeCmdLine!="":
file2 = open(storeCmdLine, "w")
file2.write(cmdLine)
file2.flush()
file2.close()
# TODO : Use "subprocess" instead ==> permit to pipline the renderings ...
if retcode != 0:
if retcode == 2:
debug.error("can not compile file ... [keyboard interrrupt]")
else:
debug.error("can not compile file ... ret : " + str(retcode))
exitFlag = False
class myThread(threading.Thread):
def __init__(self, threadID, lock, queue):
@ -71,13 +86,6 @@ class myThread(threading.Thread):
# kill requested ...
debug.verbose("Exiting " + self.name)
queueLock = threading.Lock()
workQueue = Queue.Queue()
currentThreadWorking = 0
threads = []
isInit = False
processorAvaillable = 1
def ErrorOccured():
global exitFlag
@ -135,18 +143,26 @@ def RunInPool(cmdLine, comment, storeCmdLine=""):
def PoolSynchrosize():
global errorOccured
if processorAvaillable <= 1:
#in this case : nothing to synchronise
return
debug.verbose("wait queue process ended\n")
# Wait for queue to empty
while not workQueue.empty():
while not workQueue.empty() \
and False==errorOccured:
time.sleep(0.2)
pass
# Wait all thread have ended their current process
while currentThreadWorking != 0:
while currentThreadWorking != 0 \
and False==errorOccured:
time.sleep(0.2)
pass
debug.verbose("queue is empty")
if False==errorOccured:
debug.verbose("queue is empty")
else:
debug.debug("Thread return with error ... ==> stop all the pool")
UnInit()
debug.error("Pool error occured ...")