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