[DEV] update to python 3.0 && compatible with python 2.7
This commit is contained in:
parent
e531092bea
commit
50103d4c74
24
lutin.py
24
lutin.py
@ -49,19 +49,19 @@ localArgument = myLutinArg.parse()
|
||||
def usage():
|
||||
# generic argument displayed :
|
||||
myLutinArg.display()
|
||||
print " All target can finish with '-clean' '-dump' ..."
|
||||
print " all"
|
||||
print " build all (only for the current selected board) (bynary and packages)"
|
||||
print " clean"
|
||||
print " clean all (same as previous)"
|
||||
print " dump"
|
||||
print " Dump all the module dependency and properties"
|
||||
print(" All target can finish with '-clean' '-dump' ...")
|
||||
print(" all")
|
||||
print(" build all (only for the current selected board) (bynary and packages)")
|
||||
print(" clean")
|
||||
print(" clean all (same as previous)")
|
||||
print(" dump")
|
||||
print(" Dump all the module dependency and properties")
|
||||
listOfAllModule = lutinModule.list_all_module_with_desc()
|
||||
for mod in listOfAllModule:
|
||||
print " " + mod[0]
|
||||
print(" " + mod[0])
|
||||
if mod[1] != "":
|
||||
print " " + mod[1]
|
||||
print " ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all"
|
||||
print(" " + mod[1])
|
||||
print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")
|
||||
exit(0)
|
||||
|
||||
# preparse the argument to get the verbose element for debug mode
|
||||
@ -79,7 +79,7 @@ def parseGenericArg(argument,active):
|
||||
if retValue != "":
|
||||
retValue += " "
|
||||
retValue += moduleName
|
||||
print retValue
|
||||
print(retValue)
|
||||
exit(0)
|
||||
return True
|
||||
if argument.get_option_nName() == "list-target":
|
||||
@ -90,7 +90,7 @@ def parseGenericArg(argument,active):
|
||||
if retValue != "":
|
||||
retValue += " "
|
||||
retValue += targetName
|
||||
print retValue
|
||||
print(retValue)
|
||||
exit(0)
|
||||
return True
|
||||
elif argument.get_option_nName()=="jobs":
|
||||
|
@ -249,10 +249,10 @@ class LutinArg:
|
||||
|
||||
|
||||
def display(self):
|
||||
print "usage:"
|
||||
print("usage:")
|
||||
listOfPropertiesArg = "";
|
||||
for element in self.m_listProperties :
|
||||
listOfPropertiesArg += element.get_porperties()
|
||||
print " " + sys.argv[0] + listOfPropertiesArg + " ..."
|
||||
print(" " + sys.argv[0] + listOfPropertiesArg + " ...")
|
||||
for element in self.m_listProperties :
|
||||
element.display()
|
@ -8,7 +8,6 @@
|
||||
##
|
||||
|
||||
import os
|
||||
import thread
|
||||
import lutinMultiprocess
|
||||
import threading
|
||||
import re
|
||||
@ -110,7 +109,7 @@ def error(input, threadID=-1, force=False, crash=True):
|
||||
if crash==True:
|
||||
lutinMultiprocess.error_occured()
|
||||
if threadID != -1:
|
||||
thread.interrupt_main()
|
||||
threading.interrupt_main()
|
||||
exit(-1)
|
||||
#os_exit(-1)
|
||||
#raise "error happend"
|
||||
|
@ -725,17 +725,17 @@ class Module:
|
||||
|
||||
def print_list(self, description, list):
|
||||
if len(list) > 0:
|
||||
print ' %s' %description
|
||||
print(' ' + str(description))
|
||||
for elem in list:
|
||||
print ' %s' %elem
|
||||
print(' ' + str(elem))
|
||||
|
||||
def display(self, target):
|
||||
print '-----------------------------------------------'
|
||||
print ' package : "%s"' %self.name
|
||||
print '-----------------------------------------------'
|
||||
print ' type:"%s"' %self.type
|
||||
print ' file:"%s"' %self.originFile
|
||||
print ' folder:"%s"' %self.originFolder
|
||||
print('-----------------------------------------------')
|
||||
print(' package : "' + self.name + "'")
|
||||
print('-----------------------------------------------')
|
||||
print(' type:"' + str(self.type) + "'")
|
||||
print(' file:"' + str(self.originFile) + "'")
|
||||
print(' folder:"' + str(self.originFolder) + "'")
|
||||
self.print_list('depends',self.depends)
|
||||
self.print_list('depends_optionnal', self.depends_optionnal)
|
||||
self.print_list('flags_ld',self.flags_ld)
|
||||
|
@ -11,7 +11,11 @@ import sys
|
||||
import lutinDebug as debug
|
||||
import threading
|
||||
import time
|
||||
import Queue
|
||||
import sys
|
||||
if sys.version_info >= (3, 0):
|
||||
import queue
|
||||
else:
|
||||
import Queue as queue
|
||||
import os
|
||||
import subprocess
|
||||
import lutinTools
|
||||
@ -19,7 +23,7 @@ import lutinEnv
|
||||
import shlex
|
||||
|
||||
queueLock = threading.Lock()
|
||||
workQueue = Queue.Queue()
|
||||
workQueue = queue.Queue()
|
||||
currentThreadWorking = 0
|
||||
threads = []
|
||||
# To know the first error arrive in the pool ==> to display all the time the same error file when multiple compilation
|
||||
@ -63,6 +67,9 @@ def run_command_direct(cmdLine):
|
||||
debug.error("subprocess.CalledProcessError : " + str(args))
|
||||
# launch the subprocess:
|
||||
output, err = p.communicate()
|
||||
if sys.version_info >= (3, 0):
|
||||
output = output.decode("utf-8")
|
||||
err = err.decode("utf-8")
|
||||
# Check error :
|
||||
if p.returncode == 0:
|
||||
if output == None:
|
||||
@ -86,6 +93,9 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
||||
debug.error("subprocess.CalledProcessError : TODO ...")
|
||||
# launch the subprocess:
|
||||
output, err = p.communicate()
|
||||
if sys.version_info >= (3, 0):
|
||||
output = output.decode("utf-8")
|
||||
err = err.decode("utf-8")
|
||||
# Check error :
|
||||
if p.returncode == 0:
|
||||
debug.debug(lutinEnv.print_pretty(cmdLine))
|
||||
|
Loading…
x
Reference in New Issue
Block a user