[DEV] correction of the dependence check (basic error)
This commit is contained in:
parent
d0356e2fd0
commit
810f699b6c
@ -31,10 +31,6 @@ def NeedReBuild(dst, src, dependFile, file_cmd="", cmdLine=""):
|
|||||||
if ""!=file_cmd:
|
if ""!=file_cmd:
|
||||||
if False==os.path.exists(file_cmd):
|
if False==os.path.exists(file_cmd):
|
||||||
debug.verbose(" ==> must rebuild (no commandLine file)")
|
debug.verbose(" ==> must rebuild (no commandLine file)")
|
||||||
file2 = open(file_cmd, "w")
|
|
||||||
file2.write(cmdLine)
|
|
||||||
file2.flush()
|
|
||||||
file2.close()
|
|
||||||
return True
|
return True
|
||||||
# check if the 2 cmdline are similar :
|
# check if the 2 cmdline are similar :
|
||||||
file2 = open(file_cmd, "r")
|
file2 = open(file_cmd, "r")
|
||||||
@ -44,10 +40,6 @@ def NeedReBuild(dst, src, dependFile, file_cmd="", cmdLine=""):
|
|||||||
debug.verbose(" ==> '" + cmdLine + "'")
|
debug.verbose(" ==> '" + cmdLine + "'")
|
||||||
debug.verbose(" ==> '" + firstAndUniqueLine + "'")
|
debug.verbose(" ==> '" + firstAndUniqueLine + "'")
|
||||||
file2.close()
|
file2.close()
|
||||||
file2 = open(file_cmd, "w")
|
|
||||||
file2.write(cmdLine)
|
|
||||||
file2.flush()
|
|
||||||
file2.close()
|
|
||||||
return True
|
return True
|
||||||
# the cmdfile is correct ...
|
# the cmdfile is correct ...
|
||||||
file2.close()
|
file2.close()
|
||||||
@ -60,9 +52,11 @@ def NeedReBuild(dst, src, dependFile, file_cmd="", cmdLine=""):
|
|||||||
curLine = curLine[:len(curLine)-1]
|
curLine = curLine[:len(curLine)-1]
|
||||||
# removing last \ ...
|
# removing last \ ...
|
||||||
if curLine[len(curLine)-1:] == '\\' :
|
if curLine[len(curLine)-1:] == '\\' :
|
||||||
curLine = curLine[len(curLine)-1:]
|
curLine = curLine[:len(curLine)-1]
|
||||||
# remove white space :
|
# remove white space :
|
||||||
|
#debug.verbose(" Line (read) : '" + curLine + "'");
|
||||||
curLine = curLine.strip()
|
curLine = curLine.strip()
|
||||||
|
#debug.verbose(" Line (strip) : '" + curLine + "'");
|
||||||
|
|
||||||
testFile=""
|
testFile=""
|
||||||
if curLine[len(curLine)-1:] == ':':
|
if curLine[len(curLine)-1:] == ':':
|
||||||
@ -77,11 +71,11 @@ def NeedReBuild(dst, src, dependFile, file_cmd="", cmdLine=""):
|
|||||||
if testFile!="":
|
if testFile!="":
|
||||||
debug.verbose(" ==> test");
|
debug.verbose(" ==> test");
|
||||||
if False==os.path.exists(testFile):
|
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()
|
file.close()
|
||||||
return True
|
return True
|
||||||
if os.path.getmtime(testFile) > os.path.getmtime(dst):
|
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()
|
file.close()
|
||||||
return True
|
return True
|
||||||
# close the current file :
|
# close the current file :
|
||||||
|
@ -277,6 +277,12 @@ class module:
|
|||||||
depancy.flags_ld,
|
depancy.flags_ld,
|
||||||
target.global_flags_ld])
|
target.global_flags_ld])
|
||||||
RunCommand(cmdLine)
|
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])
|
#debug.printElement("SharedLib", self.name, "==>", tmpList[1])
|
||||||
"""$(Q)$(TARGET_CXX) \
|
"""$(Q)$(TARGET_CXX) \
|
||||||
-o $@ \
|
-o $@ \
|
||||||
@ -321,6 +327,13 @@ class module:
|
|||||||
depancy.flags_ld,
|
depancy.flags_ld,
|
||||||
target.global_flags_ld])
|
target.global_flags_ld])
|
||||||
RunCommand(cmdLine)
|
RunCommand(cmdLine)
|
||||||
|
if "release"==target.buildMode:
|
||||||
|
debug.printElement("Executable(strip)", self.name, "", "")
|
||||||
|
cmdLine=lutinTools.ListToStr([
|
||||||
|
target.strip,
|
||||||
|
tmpList[1]])
|
||||||
|
RunCommand(cmdLine)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
$(TARGET_CXX) \
|
$(TARGET_CXX) \
|
||||||
-o $@ \
|
-o $@ \
|
||||||
@ -339,7 +352,7 @@ class module:
|
|||||||
$(PRIVATE_LDLIBS) \
|
$(PRIVATE_LDLIBS) \
|
||||||
$(TARGET_GLOBAL_LDLIBS)
|
$(TARGET_GLOBAL_LDLIBS)
|
||||||
"""
|
"""
|
||||||
#$(call strip-executable)
|
#$(call strip- )
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
## Commands for copying files
|
## Commands for copying files
|
||||||
|
@ -7,6 +7,17 @@ import Queue
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
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=""):
|
def RunCommand(cmdLine, storeCmdLine=""):
|
||||||
debug.debug(cmdLine)
|
debug.debug(cmdLine)
|
||||||
retcode = -1
|
retcode = -1
|
||||||
@ -15,22 +26,26 @@ def RunCommand(cmdLine, storeCmdLine=""):
|
|||||||
except OSError as e:
|
except OSError as e:
|
||||||
print >>sys.stderr, "Execution failed:", 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!="":
|
if storeCmdLine!="":
|
||||||
file2 = open(storeCmdLine, "w")
|
file2 = open(storeCmdLine, "w")
|
||||||
file2.write(cmdLine)
|
file2.write(cmdLine)
|
||||||
file2.flush()
|
file2.flush()
|
||||||
file2.close()
|
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):
|
class myThread(threading.Thread):
|
||||||
def __init__(self, threadID, lock, queue):
|
def __init__(self, threadID, lock, queue):
|
||||||
@ -71,13 +86,6 @@ class myThread(threading.Thread):
|
|||||||
# kill requested ...
|
# kill requested ...
|
||||||
debug.verbose("Exiting " + self.name)
|
debug.verbose("Exiting " + self.name)
|
||||||
|
|
||||||
queueLock = threading.Lock()
|
|
||||||
workQueue = Queue.Queue()
|
|
||||||
currentThreadWorking = 0
|
|
||||||
threads = []
|
|
||||||
|
|
||||||
isInit = False
|
|
||||||
processorAvaillable = 1
|
|
||||||
|
|
||||||
def ErrorOccured():
|
def ErrorOccured():
|
||||||
global exitFlag
|
global exitFlag
|
||||||
@ -135,18 +143,26 @@ def RunInPool(cmdLine, comment, storeCmdLine=""):
|
|||||||
|
|
||||||
|
|
||||||
def PoolSynchrosize():
|
def PoolSynchrosize():
|
||||||
|
global errorOccured
|
||||||
if processorAvaillable <= 1:
|
if processorAvaillable <= 1:
|
||||||
#in this case : nothing to synchronise
|
#in this case : nothing to synchronise
|
||||||
return
|
return
|
||||||
|
|
||||||
debug.verbose("wait queue process ended\n")
|
debug.verbose("wait queue process ended\n")
|
||||||
# Wait for queue to empty
|
# Wait for queue to empty
|
||||||
while not workQueue.empty():
|
while not workQueue.empty() \
|
||||||
|
and False==errorOccured:
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
pass
|
pass
|
||||||
# Wait all thread have ended their current process
|
# Wait all thread have ended their current process
|
||||||
while currentThreadWorking != 0:
|
while currentThreadWorking != 0 \
|
||||||
|
and False==errorOccured:
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
pass
|
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 ...")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user