[DEV] update function and class naming
This commit is contained in:
parent
118f1f5951
commit
5079829d04
111
lutin.py
111
lutin.py
@ -10,74 +10,75 @@ import lutinModule
|
||||
import lutinMultiprocess
|
||||
import lutinArg
|
||||
|
||||
mylutinArg = lutinArg.lutinArg()
|
||||
mylutinArg.Add(lutinArg.argDefine("h", "help", desc="display this help"))
|
||||
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.Add(lutinArg.argDefine("s", "force-strip", desc="Force the stripping of the compile elements"))
|
||||
myLutinArg = lutinArg.LutinArg()
|
||||
myLutinArg.add(lutinArg.ArgDefine("h", "help", desc="display this help"))
|
||||
myLutinArg.add_section("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.add(lutinArg.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements"))
|
||||
|
||||
mylutinArg.AddSection("properties", "keep in the sequency of the cible")
|
||||
mylutinArg.Add(lutinArg.argDefine("t", "target", list=[["Android",""],["Linux",""],["MacOs",""],["Windows",""]], desc="Select a target (by default the platform is the computer that compile this"))
|
||||
mylutinArg.Add(lutinArg.argDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
|
||||
mylutinArg.Add(lutinArg.argDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
|
||||
mylutinArg.Add(lutinArg.argDefine("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)"))
|
||||
myLutinArg.add_section("properties", "keep in the sequency of the cible")
|
||||
myLutinArg.add(lutinArg.ArgDefine("t", "target", list=[["Android",""],["Linux",""],["MacOs",""],["Windows",""]], desc="Select a target (by default the platform is the computer that compile this"))
|
||||
myLutinArg.add(lutinArg.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
|
||||
myLutinArg.add(lutinArg.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
|
||||
myLutinArg.add(lutinArg.ArgDefine("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)"))
|
||||
|
||||
mylutinArg.AddSection("cible", "generate in order set")
|
||||
localArgument = mylutinArg.Parse()
|
||||
myLutinArg.add_section("cible", "generate in order set")
|
||||
localArgument = myLutinArg.parse()
|
||||
|
||||
"""
|
||||
Display the help of this makefile
|
||||
display the help of this makefile
|
||||
"""
|
||||
def usage():
|
||||
# generic argument displayed :
|
||||
mylutinArg.Display()
|
||||
myLutinArg.display()
|
||||
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 all (same as previous)"
|
||||
print " clean all (same as previous)"
|
||||
print " dump"
|
||||
print " Dump all the module dependency and properties"
|
||||
listOfAllModule = lutinModule.ListAllModuleWithDesc()
|
||||
listOfAllModule = lutinModule.list_all_module_with_desc()
|
||||
for mod in listOfAllModule:
|
||||
print " " + mod[0] + " / " + mod[0] + "-clean / " + mod[0] + "-dump"
|
||||
print " " + mod[1]
|
||||
if mod[1] != "":
|
||||
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
|
||||
def parseGenericArg(argument,active):
|
||||
if argument.GetOptionName() == "help":
|
||||
if argument.get_option_nName() == "help":
|
||||
#display help
|
||||
if active==False:
|
||||
usage()
|
||||
return True
|
||||
elif argument.GetOptionName()=="jobs":
|
||||
elif argument.get_option_nName()=="jobs":
|
||||
if active==True:
|
||||
lutinMultiprocess.SetCoreNumber(int(argument.GetArg()))
|
||||
lutinMultiprocess.set_core_number(int(argument.get_arg()))
|
||||
return True
|
||||
elif argument.GetOptionName() == "verbose":
|
||||
elif argument.get_option_nName() == "verbose":
|
||||
if active==True:
|
||||
debug.SetLevel(int(argument.GetArg()))
|
||||
debug.set_level(int(argument.get_arg()))
|
||||
return True
|
||||
elif argument.GetOptionName() == "color":
|
||||
elif argument.get_option_nName() == "color":
|
||||
if active==True:
|
||||
debug.EnableColor()
|
||||
debug.enable_color()
|
||||
return True
|
||||
elif argument.GetOptionName() == "force":
|
||||
elif argument.get_option_nName() == "force":
|
||||
if active==True:
|
||||
lutinEnv.SetForceMode(True)
|
||||
lutinEnv.set_force_mode(True)
|
||||
return True
|
||||
elif argument.GetOptionName() == "pretty":
|
||||
elif argument.get_option_nName() == "pretty":
|
||||
if active==True:
|
||||
lutinEnv.SetPrintPrettyMode(True)
|
||||
lutinEnv.set_print_pretty_mode(True)
|
||||
return True
|
||||
elif argument.GetOptionName() == "force-strip":
|
||||
elif argument.get_option_nName() == "force-strip":
|
||||
if active==True:
|
||||
lutinEnv.SetForceStripMode(True)
|
||||
lutinEnv.set_force_strip_mode(True)
|
||||
return True
|
||||
return False
|
||||
|
||||
@ -110,18 +111,18 @@ def Start():
|
||||
for argument in localArgument:
|
||||
if True==parseGenericArg(argument, False):
|
||||
continue
|
||||
elif argument.GetOptionName() == "package":
|
||||
elif argument.get_option_nName() == "package":
|
||||
generatePackage=False
|
||||
elif argument.GetOptionName() == "compilator":
|
||||
if compilator!=argument.GetArg():
|
||||
debug.debug("change compilator ==> " + argument.GetArg())
|
||||
compilator=argument.GetArg()
|
||||
elif argument.get_option_nName() == "compilator":
|
||||
if compilator!=argument.get_arg():
|
||||
debug.debug("change compilator ==> " + argument.get_arg())
|
||||
compilator=argument.get_arg()
|
||||
#remove previous target
|
||||
target = None
|
||||
elif argument.GetOptionName() == "target":
|
||||
elif argument.get_option_nName() == "target":
|
||||
# No check input ==> this will be verify automaticly chen the target will be loaded
|
||||
if targetName!=argument.GetArg():
|
||||
targetName=argument.GetArg()
|
||||
if targetName!=argument.get_arg():
|
||||
targetName=argument.get_arg()
|
||||
debug.debug("change target ==> " + targetName + " & reset mode : gcc&release")
|
||||
#reset properties by defauult:
|
||||
compilator="gcc"
|
||||
@ -129,37 +130,37 @@ def Start():
|
||||
generatePackage=True
|
||||
#remove previous target
|
||||
target = None
|
||||
elif argument.GetOptionName() == "mode":
|
||||
if mode!=argument.GetArg():
|
||||
mode = argument.GetArg()
|
||||
elif argument.get_option_nName() == "mode":
|
||||
if mode!=argument.get_arg():
|
||||
mode = argument.get_arg()
|
||||
debug.debug("change mode ==> " + mode)
|
||||
#remove previous target
|
||||
target = None
|
||||
else:
|
||||
if argument.GetOptionName() != "":
|
||||
debug.warning("Can not understand argument : '" + argument.GetOptionName() + "'")
|
||||
if argument.get_option_nName() != "":
|
||||
debug.warning("Can not understand argument : '" + argument.get_option_nName() + "'")
|
||||
usage()
|
||||
else:
|
||||
#load the target if needed :
|
||||
if target == None:
|
||||
target = lutinTarget.TargetLoad(targetName, compilator, mode, generatePackage)
|
||||
target.Build(argument.GetArg())
|
||||
target = lutinTarget.target_load(targetName, compilator, mode, generatePackage)
|
||||
target.build(argument.get_arg())
|
||||
actionDone=True
|
||||
# if no action done : we do "all" ...
|
||||
if actionDone==False:
|
||||
#load the target if needed :
|
||||
if target == None:
|
||||
target = lutinTarget.TargetLoad(targetName, compilator, mode, generatePackage)
|
||||
target.Build("all")
|
||||
target = lutinTarget.target_load(targetName, compilator, mode, generatePackage)
|
||||
target.build("all")
|
||||
# stop all started threads
|
||||
lutinMultiprocess.UnInit()
|
||||
lutinMultiprocess.un_init()
|
||||
|
||||
"""
|
||||
When the user use with make.py we initialise ourself
|
||||
"""
|
||||
if __name__ == '__main__':
|
||||
debug.verbose("Use Make as a make stadard")
|
||||
sys.path.append(lutinTools.GetRunFolder())
|
||||
sys.path.append(lutinTools.get_run_folder())
|
||||
debug.verbose(" try to impoert module 'lutinBase.py'")
|
||||
if os.path.exists("lutinBase.py" )==True:
|
||||
__import__("lutinBase")
|
||||
@ -172,7 +173,7 @@ if __name__ == '__main__':
|
||||
and folder.lower()!="archive" \
|
||||
and folder.lower()!="out" :
|
||||
debug.debug("Automatic load path: '" + folder + "'")
|
||||
lutinModule.ImportPath(folder)
|
||||
lutinModule.import_path(folder)
|
||||
Start()
|
||||
|
||||
|
||||
|
130
lutinArg.py
130
lutinArg.py
@ -2,18 +2,18 @@
|
||||
import sys
|
||||
import lutinDebug as debug
|
||||
|
||||
class argElement:
|
||||
class ArgElement:
|
||||
def __init__(self, option, value=""):
|
||||
self.m_option = option;
|
||||
self.m_arg = value;
|
||||
|
||||
def GetOptionName(self):
|
||||
def get_option_nName(self):
|
||||
return self.m_option
|
||||
|
||||
def GetArg(self):
|
||||
def get_arg(self):
|
||||
return self.m_arg
|
||||
|
||||
def Display(self):
|
||||
def display(self):
|
||||
if len(self.m_arg)==0:
|
||||
debug.info("option : " + self.m_option)
|
||||
elif len(self.m_option)==0:
|
||||
@ -22,7 +22,7 @@ class argElement:
|
||||
debug.info("option : " + self.m_option + ":" + self.m_arg)
|
||||
|
||||
|
||||
class argDefine:
|
||||
class ArgDefine:
|
||||
def __init__(self,
|
||||
smallOption="", # like v for -v
|
||||
bigOption="", # like verbose for --verbose
|
||||
@ -41,19 +41,19 @@ class argDefine:
|
||||
self.m_haveParam = False
|
||||
self.m_description = desc;
|
||||
|
||||
def GetOptionSmall(self):
|
||||
def get_option_small(self):
|
||||
return self.m_optionSmall
|
||||
|
||||
def GetOptionBig(self):
|
||||
def get_option_big(self):
|
||||
return self.m_optionBig
|
||||
|
||||
def NeedParameters(self):
|
||||
def need_parameters(self):
|
||||
return self.m_haveParam
|
||||
|
||||
def GetPorperties(self):
|
||||
def get_porperties(self):
|
||||
return ""
|
||||
|
||||
def CheckAvaillable(self, argument):
|
||||
def check_availlable(self, argument):
|
||||
if len(self.m_list)==0:
|
||||
return True
|
||||
for element,desc in self.m_list:
|
||||
@ -61,7 +61,7 @@ class argDefine:
|
||||
return True
|
||||
return False
|
||||
|
||||
def Display(self):
|
||||
def display(self):
|
||||
if self.m_optionSmall != "" and self.m_optionBig != "":
|
||||
print(" -" + self.m_optionSmall + " / --" + self.m_optionBig)
|
||||
elif self.m_optionSmall != "":
|
||||
@ -89,50 +89,50 @@ class argDefine:
|
||||
tmpElementPrint += val
|
||||
print(" { " + tmpElementPrint + " }")
|
||||
|
||||
def Parse(self, argList, currentID):
|
||||
def parse(self, argList, currentID):
|
||||
return currentID;
|
||||
|
||||
|
||||
class argSection:
|
||||
class ArgSection:
|
||||
def __init__(self,
|
||||
sectionName="",
|
||||
desc=""):
|
||||
self.m_section = sectionName;
|
||||
self.m_description = desc;
|
||||
|
||||
def GetOptionSmall(self):
|
||||
def get_option_small(self):
|
||||
return ""
|
||||
|
||||
def GetOptionBig(self):
|
||||
def get_option_big(self):
|
||||
return ""
|
||||
|
||||
def GetPorperties(self):
|
||||
def get_porperties(self):
|
||||
return " [" + self.m_section + "]"
|
||||
|
||||
def Display(self):
|
||||
def display(self):
|
||||
print(" [" + self.m_section + "] : " + self.m_description)
|
||||
|
||||
def Parse(self, argList, currentID):
|
||||
def parse(self, argList, currentID):
|
||||
return currentID;
|
||||
|
||||
|
||||
class lutinArg:
|
||||
class LutinArg:
|
||||
def __init__(self):
|
||||
self.m_listProperties = []
|
||||
|
||||
def Add(self, argument):
|
||||
self.m_listProperties.append(argument) #argDefine(smallOption, bigOption, haveParameter, parameterList, description));
|
||||
def add(self, argument):
|
||||
self.m_listProperties.append(argument) #ArgDefine(smallOption, bigOption, haveParameter, parameterList, description));
|
||||
|
||||
def AddSection(self, sectionName, sectionDesc):
|
||||
self.m_listProperties.append(argSection(sectionName, sectionDesc))
|
||||
def add_section(self, sectionName, sectionDesc):
|
||||
self.m_listProperties.append(ArgSection(sectionName, sectionDesc))
|
||||
|
||||
def Parse(self):
|
||||
def parse(self):
|
||||
listArgument = [] # composed of list element
|
||||
NotParseNextElement=False
|
||||
NotparseNextElement=False
|
||||
for iii in range(1, len(sys.argv)):
|
||||
# special case of parameter in some elements
|
||||
if NotParseNextElement==True:
|
||||
NotParseNextElement = False
|
||||
if NotparseNextElement==True:
|
||||
NotparseNextElement = False
|
||||
continue
|
||||
debug.verbose("parse [" + str(iii) + "]=" + sys.argv[iii])
|
||||
argument = sys.argv[iii]
|
||||
@ -148,41 +148,41 @@ class lutinArg:
|
||||
if option[:2]=="--":
|
||||
# big argument
|
||||
for prop in self.m_listProperties:
|
||||
if prop.GetOptionBig()=="":
|
||||
if prop.get_option_big()=="":
|
||||
continue
|
||||
if prop.GetOptionBig() == option[2:]:
|
||||
if prop.get_option_big() == option[2:]:
|
||||
# find it
|
||||
debug.verbose("find argument 2 : " + option[2:])
|
||||
if prop.NeedParameters()==True:
|
||||
internalSub = option[2+len(prop.GetOptionBig()):]
|
||||
if prop.need_parameters()==True:
|
||||
internalSub = option[2+len(prop.get_option_big()):]
|
||||
if len(internalSub)!=0:
|
||||
if len(optionParam)!=0:
|
||||
# wrong argument ...
|
||||
debug.warning("maybe wrong argument for : '" + prop.GetOptionBig() + "' cmdLine='" + argument + "'")
|
||||
prop.Display()
|
||||
debug.warning("maybe wrong argument for : '" + prop.get_option_big() + "' cmdLine='" + argument + "'")
|
||||
prop.display()
|
||||
continue
|
||||
optionParam = internalSub
|
||||
if len(optionParam)==0:
|
||||
#Get the next parameters
|
||||
if len(sys.argv) > iii+1:
|
||||
optionParam = sys.argv[iii+1]
|
||||
NotParseNextElement=True
|
||||
NotparseNextElement=True
|
||||
else :
|
||||
# missing arguments
|
||||
debug.warning("parsing argument error : '" + prop.GetOptionBig() + "' Missing : subParameters ... cmdLine='" + argument + "'")
|
||||
prop.Display()
|
||||
debug.warning("parsing argument error : '" + prop.get_option_big() + "' Missing : subParameters ... cmdLine='" + argument + "'")
|
||||
prop.display()
|
||||
exit(-1)
|
||||
if prop.CheckAvaillable(optionParam)==False:
|
||||
debug.warning("argument error : '" + prop.GetOptionBig() + "' SubParameters not availlable ... cmdLine='" + argument + "' option='" + optionParam + "'")
|
||||
prop.Display()
|
||||
if prop.check_availlable(optionParam)==False:
|
||||
debug.warning("argument error : '" + prop.get_option_big() + "' SubParameters not availlable ... cmdLine='" + argument + "' option='" + optionParam + "'")
|
||||
prop.display()
|
||||
exit(-1)
|
||||
listArgument.append(argElement(prop.GetOptionBig(),optionParam))
|
||||
listArgument.append(ArgElement(prop.get_option_big(),optionParam))
|
||||
argumentFound = True
|
||||
else:
|
||||
if len(optionParam)!=0:
|
||||
debug.warning("parsing argument error : '" + prop.GetOptionBig() + "' need no subParameters : '" + optionParam + "' cmdLine='" + argument + "'")
|
||||
prop.Display()
|
||||
listArgument.append(argElement(prop.GetOptionBig()))
|
||||
debug.warning("parsing argument error : '" + prop.get_option_big() + "' need no subParameters : '" + optionParam + "' cmdLine='" + argument + "'")
|
||||
prop.display()
|
||||
listArgument.append(ArgElement(prop.get_option_big()))
|
||||
argumentFound = True
|
||||
break;
|
||||
if False==argumentFound:
|
||||
@ -190,61 +190,61 @@ class lutinArg:
|
||||
elif option[:1]=="-":
|
||||
# small argument
|
||||
for prop in self.m_listProperties:
|
||||
if prop.GetOptionSmall()=="":
|
||||
if prop.get_option_small()=="":
|
||||
continue
|
||||
if prop.GetOptionSmall() == option[1:1+len(prop.GetOptionSmall())]:
|
||||
if prop.get_option_small() == option[1:1+len(prop.get_option_small())]:
|
||||
# find it
|
||||
debug.verbose("find argument 1 : " + option[1:1+len(prop.GetOptionSmall())])
|
||||
if prop.NeedParameters()==True:
|
||||
internalSub = option[1+len(prop.GetOptionSmall()):]
|
||||
debug.verbose("find argument 1 : " + option[1:1+len(prop.get_option_small())])
|
||||
if prop.need_parameters()==True:
|
||||
internalSub = option[1+len(prop.get_option_small()):]
|
||||
if len(internalSub)!=0:
|
||||
if len(optionParam)!=0:
|
||||
# wrong argument ...
|
||||
debug.warning("maybe wrong argument for : '" + prop.GetOptionBig() + "' cmdLine='" + argument + "'")
|
||||
prop.Display()
|
||||
debug.warning("maybe wrong argument for : '" + prop.get_option_big() + "' cmdLine='" + argument + "'")
|
||||
prop.display()
|
||||
continue
|
||||
optionParam = internalSub
|
||||
if len(optionParam)==0:
|
||||
#Get the next parameters
|
||||
if len(sys.argv) > iii+1:
|
||||
optionParam = sys.argv[iii+1]
|
||||
NotParseNextElement=True
|
||||
NotparseNextElement=True
|
||||
else :
|
||||
# missing arguments
|
||||
debug.warning("parsing argument error : '" + prop.GetOptionBig() + "' Missing : subParameters cmdLine='" + argument + "'")
|
||||
prop.Display()
|
||||
debug.warning("parsing argument error : '" + prop.get_option_big() + "' Missing : subParameters cmdLine='" + argument + "'")
|
||||
prop.display()
|
||||
exit(-1)
|
||||
if prop.CheckAvaillable(optionParam)==False:
|
||||
debug.warning("argument error : '" + prop.GetOptionBig() + "' SubParameters not availlable ... cmdLine='" + argument + "' option='" + optionParam + "'")
|
||||
prop.Display()
|
||||
if prop.check_availlable(optionParam)==False:
|
||||
debug.warning("argument error : '" + prop.get_option_big() + "' SubParameters not availlable ... cmdLine='" + argument + "' option='" + optionParam + "'")
|
||||
prop.display()
|
||||
exit(-1)
|
||||
listArgument.append(argElement(prop.GetOptionBig(),optionParam))
|
||||
listArgument.append(ArgElement(prop.get_option_big(),optionParam))
|
||||
argumentFound = True
|
||||
else:
|
||||
if len(optionParam)!=0:
|
||||
debug.warning("parsing argument error : '" + prop.GetOptionBig() + "' need no subParameters : '" + optionParam + "' cmdLine='" + argument + "'")
|
||||
prop.Display()
|
||||
listArgument.append(argElement(prop.GetOptionBig()))
|
||||
debug.warning("parsing argument error : '" + prop.get_option_big() + "' need no subParameters : '" + optionParam + "' cmdLine='" + argument + "'")
|
||||
prop.display()
|
||||
listArgument.append(ArgElement(prop.get_option_big()))
|
||||
argumentFound = True
|
||||
break;
|
||||
|
||||
if argumentFound==False:
|
||||
#unknow element ... ==> just add in the list ...
|
||||
debug.verbose("unknow argument : " + argument)
|
||||
listArgument.append(argElement("", argument))
|
||||
listArgument.append(ArgElement("", argument))
|
||||
|
||||
#for argument in listArgument:
|
||||
# argument.Display()
|
||||
# argument.display()
|
||||
#exit(0)
|
||||
return listArgument;
|
||||
|
||||
|
||||
|
||||
def Display(self):
|
||||
def display(self):
|
||||
print "usage:"
|
||||
listOfPropertiesArg = "";
|
||||
for element in self.m_listProperties :
|
||||
listOfPropertiesArg += element.GetPorperties()
|
||||
listOfPropertiesArg += element.get_porperties()
|
||||
print " " + sys.argv[0] + listOfPropertiesArg + " ..."
|
||||
for element in self.m_listProperties :
|
||||
element.Display()
|
||||
element.display()
|
@ -18,12 +18,12 @@ color_cyan = ""
|
||||
|
||||
debugLock = threading.Lock()
|
||||
|
||||
def SetLevel(id):
|
||||
def set_level(id):
|
||||
global debugLevel
|
||||
debugLevel = id
|
||||
#print "SetDebug level at " + str(debugLevel)
|
||||
|
||||
def EnableColor():
|
||||
def enable_color():
|
||||
global debugColor
|
||||
debugColor = True
|
||||
global color_default
|
||||
@ -80,14 +80,14 @@ def error(input, threadID=-1):
|
||||
debugLock.acquire()
|
||||
print(color_red + "[ERROR] " + input + color_default)
|
||||
debugLock.release()
|
||||
lutinMultiprocess.ErrorOccured()
|
||||
lutinMultiprocess.error_occured()
|
||||
if threadID != -1:
|
||||
thread.interrupt_main()
|
||||
exit(-1)
|
||||
#os_exit(-1)
|
||||
#raise "error happend"
|
||||
|
||||
def printElement(type, lib, dir, name):
|
||||
def print_element(type, lib, dir, name):
|
||||
global debugLock
|
||||
global debugLevel
|
||||
if debugLevel >= 3:
|
||||
|
@ -4,14 +4,14 @@ import lutinDebug as debug
|
||||
import lutinEnv as environement
|
||||
|
||||
|
||||
def NeedReBuild(dst, src, dependFile, file_cmd="", cmdLine=""):
|
||||
def need_re_build(dst, src, dependFile, file_cmd="", cmdLine=""):
|
||||
debug.verbose("Resuest check of dependency of :")
|
||||
debug.verbose(" dst='" + dst + "'")
|
||||
debug.verbose(" str='" + src + "'")
|
||||
debug.verbose(" dept='" + dependFile + "'")
|
||||
debug.verbose(" cmd='" + file_cmd + "'")
|
||||
# if force mode selected ==> just force rebuild ...
|
||||
if environement.GetForceMode():
|
||||
if environement.get_force_mode():
|
||||
debug.verbose(" ==> must rebuild (force mode)")
|
||||
return True
|
||||
|
||||
@ -86,7 +86,7 @@ def NeedReBuild(dst, src, dependFile, file_cmd="", cmdLine=""):
|
||||
|
||||
|
||||
|
||||
def NeedRePackage(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
|
||||
def need_re_package(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
|
||||
debug.verbose("Resuest check of dependency of :")
|
||||
debug.verbose(" dst='" + dst + "'")
|
||||
debug.verbose(" src()=")
|
||||
@ -97,7 +97,7 @@ def NeedRePackage(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
|
||||
return False
|
||||
|
||||
# if force mode selected ==> just force rebuild ...
|
||||
if environement.GetForceMode():
|
||||
if environement.get_force_mode():
|
||||
debug.verbose(" ==> must re-package (force mode)")
|
||||
return True
|
||||
|
||||
|
14
lutinEnv.py
14
lutinEnv.py
@ -5,32 +5,32 @@ import lutinDebug as debug
|
||||
|
||||
forceMode=False
|
||||
|
||||
def SetForceMode(val):
|
||||
def set_force_mode(val):
|
||||
global forceMode
|
||||
if val==1:
|
||||
forceMode = 1
|
||||
else:
|
||||
forceMode = 0
|
||||
|
||||
def GetForceMode():
|
||||
def get_force_mode():
|
||||
global forceMode
|
||||
return forceMode
|
||||
|
||||
|
||||
printPrettyMode=False
|
||||
|
||||
def SetPrintPrettyMode(val):
|
||||
def set_print_pretty_mode(val):
|
||||
global printPrettyMode
|
||||
if val==True:
|
||||
printPrettyMode = True
|
||||
else:
|
||||
printPrettyMode = False
|
||||
|
||||
def GetPrintPrettyMode():
|
||||
def get_print_pretty_mode():
|
||||
global printPrettyMode
|
||||
return printPrettyMode
|
||||
|
||||
def PrintPretty(myString):
|
||||
def print_pretty(myString):
|
||||
global printPrettyMode
|
||||
if True==printPrettyMode:
|
||||
if myString[len(myString)-1]==' ' :
|
||||
@ -57,14 +57,14 @@ def PrintPretty(myString):
|
||||
|
||||
forceStripMode=False
|
||||
|
||||
def SetForceStripMode(val):
|
||||
def set_force_strip_mode(val):
|
||||
global forceStripMode
|
||||
if val==True:
|
||||
forceStripMode = True
|
||||
else:
|
||||
forceStripMode = False
|
||||
|
||||
def GetForceStripMode():
|
||||
def get_force_strip_mode():
|
||||
global forceStripMode
|
||||
return forceStripMode
|
||||
|
||||
|
@ -28,54 +28,54 @@ class heritage:
|
||||
self.flags_mm=module.export_flags_mm
|
||||
self.path=module.export_path
|
||||
|
||||
def AppendAndCheck(self, listout, newElement):
|
||||
def append_and_check(self, listout, newElement):
|
||||
for element in listout:
|
||||
if element==newElement:
|
||||
return
|
||||
listout.append(newElement)
|
||||
|
||||
def AppendToInternalList(self, listout, list):
|
||||
def append_to_internalList(self, listout, list):
|
||||
if type(list) == type(str()):
|
||||
self.AppendAndCheck(listout, list)
|
||||
self.append_and_check(listout, list)
|
||||
else:
|
||||
# mulyiple imput in the list ...
|
||||
for elem in list:
|
||||
self.AppendAndCheck(listout, elem)
|
||||
self.append_and_check(listout, elem)
|
||||
|
||||
def AddFlag_LD(self, list):
|
||||
self.AppendToInternalList(self.flags_ld, list)
|
||||
def add_flag_LD(self, list):
|
||||
self.append_to_internalList(self.flags_ld, list)
|
||||
|
||||
def AddFlag_CC(self, list):
|
||||
self.AppendToInternalList(self.flags_cc, list)
|
||||
def add_flag_CC(self, list):
|
||||
self.append_to_internalList(self.flags_cc, list)
|
||||
|
||||
def AddFlag_XX(self, list):
|
||||
self.AppendToInternalList(self.flags_xx, list)
|
||||
def add_flag_XX(self, list):
|
||||
self.append_to_internalList(self.flags_xx, list)
|
||||
|
||||
def AddFlag_M(self, list):
|
||||
self.AppendToInternalList(self.flags_m, list)
|
||||
def add_flag_M(self, list):
|
||||
self.append_to_internalList(self.flags_m, list)
|
||||
|
||||
def AddFlag_MM(self, list):
|
||||
self.AppendToInternalList(self.flags_mm, list)
|
||||
def add_flag_MM(self, list):
|
||||
self.append_to_internalList(self.flags_mm, list)
|
||||
|
||||
def AddImportPath(self, list):
|
||||
self.AppendToInternalList(self.path, list)
|
||||
def add_import_path(self, list):
|
||||
self.append_to_internalList(self.path, list)
|
||||
|
||||
def AddSources(self, list):
|
||||
self.AppendToInternalList(self.src, list)
|
||||
def add_sources(self, list):
|
||||
self.append_to_internalList(self.src, list)
|
||||
|
||||
def NeedUpdate(self, list):
|
||||
def need_update(self, list):
|
||||
self.hasBeenUpdated=True
|
||||
|
||||
def AddSub(self, other):
|
||||
def add_sub(self, other):
|
||||
if type(other) == type(None):
|
||||
debug.verbose("input of the heriatege class is None !!!")
|
||||
return
|
||||
if other.hasBeenUpdated==True:
|
||||
self.hasBeenUpdated = True
|
||||
self.AddFlag_LD(other.flags_ld)
|
||||
self.AddFlag_CC(other.flags_cc)
|
||||
self.AddFlag_XX(other.flags_xx)
|
||||
self.AddFlag_M(other.flags_m)
|
||||
self.AddFlag_MM(other.flags_mm)
|
||||
self.AddImportPath(other.path)
|
||||
self.AddSources(other.src)
|
||||
self.add_flag_LD(other.flags_ld)
|
||||
self.add_flag_CC(other.flags_cc)
|
||||
self.add_flag_XX(other.flags_xx)
|
||||
self.add_flag_M(other.flags_m)
|
||||
self.add_flag_MM(other.flags_mm)
|
||||
self.add_import_path(other.path)
|
||||
self.add_sources(other.src)
|
||||
|
384
lutinModule.py
384
lutinModule.py
@ -12,7 +12,7 @@ import lutinDepend as dependency
|
||||
import lutinMultiprocess
|
||||
import lutinEnv
|
||||
|
||||
class module:
|
||||
class Module:
|
||||
|
||||
##
|
||||
## @brief Module class represent all system needed for a specific
|
||||
@ -56,7 +56,7 @@ class module:
|
||||
# copy files and folders:
|
||||
self.files=[]
|
||||
self.folders=[]
|
||||
self.isBuild=False
|
||||
self.isbuild=False
|
||||
## end of basic INIT ...
|
||||
if moduleType == 'BINARY' \
|
||||
or moduleType == 'LIBRARY' \
|
||||
@ -68,7 +68,7 @@ class module:
|
||||
debug.error(' ==> error : "%s" ' %moduleType)
|
||||
raise 'Input value error'
|
||||
self.originFile = file;
|
||||
self.originFolder = lutinTools.GetCurrentPath(self.originFile)
|
||||
self.originFolder = lutinTools.get_current_path(self.originFile)
|
||||
self.localHeritage = heritage.heritage(self)
|
||||
|
||||
self.packageProp = { "COMPAGNY_TYPE" : set(""),
|
||||
@ -91,10 +91,10 @@ class module:
|
||||
|
||||
|
||||
##
|
||||
## @brief Add Some copilation flags for this module (and only this one)
|
||||
## @brief add Some copilation flags for this module (and only this one)
|
||||
##
|
||||
def add_extra_compile_flags(self):
|
||||
self.CompileFlags_CC([
|
||||
self.compile_flags_CC([
|
||||
"-Wall",
|
||||
"-Wsign-compare",
|
||||
"-Wreturn-type",
|
||||
@ -106,10 +106,10 @@ class module:
|
||||
## @brief remove all unneeded warning on compilation ==> for extern libs ...
|
||||
##
|
||||
def remove_compile_warning(self):
|
||||
self.CompileFlags_CC([
|
||||
self.compile_flags_CC([
|
||||
"-Wno-int-to-pointer-cast"
|
||||
]);
|
||||
self.CompileFlags_XX([
|
||||
self.compile_flags_XX([
|
||||
"-Wno-c++11-narrowing"
|
||||
])
|
||||
# only for gcc :"-Wno-unused-but-set-variable"
|
||||
@ -117,16 +117,16 @@ class module:
|
||||
##
|
||||
## @brief Commands for running gcc to compile a m++ file.
|
||||
##
|
||||
def Compile_mm_to_o(self, file, binary, target, depancy):
|
||||
file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file)
|
||||
def compile_mm_to_o(self, file, binary, target, depancy):
|
||||
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary,self.name,self.originFolder,file)
|
||||
# create the command line befor requesting start:
|
||||
cmdLine=lutinTools.ListToStr([
|
||||
cmdLine=lutinTools.list_to_str([
|
||||
target.xx,
|
||||
"-o", file_dst ,
|
||||
target.global_include_cc,
|
||||
lutinTools.AddPrefix("-I",self.export_path),
|
||||
lutinTools.AddPrefix("-I",self.local_path),
|
||||
lutinTools.AddPrefix("-I",depancy.path),
|
||||
lutinTools.add_prefix("-I",self.export_path),
|
||||
lutinTools.add_prefix("-I",self.local_path),
|
||||
lutinTools.add_prefix("-I",depancy.path),
|
||||
target.global_flags_cc,
|
||||
target.global_flags_mm,
|
||||
depancy.flags_cc,
|
||||
@ -139,27 +139,27 @@ class module:
|
||||
"-x objective-c++",
|
||||
file_src])
|
||||
# check the dependency for this file :
|
||||
if False==dependency.NeedReBuild(file_dst, file_src, file_depend, file_cmd, cmdLine):
|
||||
if False==dependency.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine):
|
||||
return file_dst
|
||||
lutinTools.CreateDirectoryOfFile(file_dst)
|
||||
lutinTools.create_directory_of_file(file_dst)
|
||||
comment = ["m++", self.name, "<==", file]
|
||||
#process element
|
||||
lutinMultiprocess.RunInPool(cmdLine, comment, file_cmd)
|
||||
lutinMultiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
||||
return file_dst
|
||||
|
||||
##
|
||||
## @brief Commands for running gcc to compile a m file.
|
||||
##
|
||||
def Compile_m_to_o(self, file, binary, target, depancy):
|
||||
file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file)
|
||||
def compile_m_to_o(self, file, binary, target, depancy):
|
||||
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary,self.name,self.originFolder,file)
|
||||
# create the command line befor requesting start:
|
||||
cmdLine=lutinTools.ListToStr([
|
||||
cmdLine=lutinTools.list_to_str([
|
||||
target.cc,
|
||||
"-o", file_dst ,
|
||||
target.global_include_cc,
|
||||
lutinTools.AddPrefix("-I",self.export_path),
|
||||
lutinTools.AddPrefix("-I",self.local_path),
|
||||
lutinTools.AddPrefix("-I",depancy.path),
|
||||
lutinTools.add_prefix("-I",self.export_path),
|
||||
lutinTools.add_prefix("-I",self.local_path),
|
||||
lutinTools.add_prefix("-I",depancy.path),
|
||||
target.global_flags_cc,
|
||||
target.global_flags_m,
|
||||
depancy.flags_cc,
|
||||
@ -172,27 +172,27 @@ class module:
|
||||
"-x objective-c",
|
||||
file_src])
|
||||
# check the dependency for this file :
|
||||
if False==dependency.NeedReBuild(file_dst, file_src, file_depend, file_cmd, cmdLine):
|
||||
if False==dependency.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine):
|
||||
return file_dst
|
||||
lutinTools.CreateDirectoryOfFile(file_dst)
|
||||
lutinTools.create_directory_of_file(file_dst)
|
||||
comment = ["m", self.name, "<==", file]
|
||||
#process element
|
||||
lutinMultiprocess.RunInPool(cmdLine, comment, file_cmd)
|
||||
lutinMultiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
||||
return file_dst
|
||||
|
||||
##
|
||||
## @brief Commands for running gcc to compile a C++ file.
|
||||
##
|
||||
def Compile_xx_to_o(self, file, binary, target, depancy):
|
||||
file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file)
|
||||
def compile_xx_to_o(self, file, binary, target, depancy):
|
||||
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary,self.name,self.originFolder,file)
|
||||
# create the command line befor requesting start:
|
||||
cmdLine=lutinTools.ListToStr([
|
||||
cmdLine=lutinTools.list_to_str([
|
||||
target.xx,
|
||||
"-o", file_dst ,
|
||||
target.global_include_cc,
|
||||
lutinTools.AddPrefix("-I",self.export_path),
|
||||
lutinTools.AddPrefix("-I",self.local_path),
|
||||
lutinTools.AddPrefix("-I",depancy.path),
|
||||
lutinTools.add_prefix("-I",self.export_path),
|
||||
lutinTools.add_prefix("-I",self.local_path),
|
||||
lutinTools.add_prefix("-I",depancy.path),
|
||||
target.global_flags_cc,
|
||||
target.global_flags_xx,
|
||||
depancy.flags_cc,
|
||||
@ -204,27 +204,27 @@ class module:
|
||||
" -c -MMD -MP -g ",
|
||||
file_src])
|
||||
# check the dependency for this file :
|
||||
if False==dependency.NeedReBuild(file_dst, file_src, file_depend, file_cmd, cmdLine):
|
||||
if False==dependency.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine):
|
||||
return file_dst
|
||||
lutinTools.CreateDirectoryOfFile(file_dst)
|
||||
lutinTools.create_directory_of_file(file_dst)
|
||||
comment = ["c++", self.name, "<==", file]
|
||||
#process element
|
||||
lutinMultiprocess.RunInPool(cmdLine, comment, file_cmd)
|
||||
lutinMultiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
||||
return file_dst
|
||||
|
||||
##
|
||||
## @brief Commands for running gcc to compile a C file.
|
||||
##
|
||||
def Compile_cc_to_o(self, file, binary, target, depancy):
|
||||
file_src, file_dst, file_depend, file_cmd = target.fileGenerateObject(binary,self.name,self.originFolder,file)
|
||||
def compile_cc_to_o(self, file, binary, target, depancy):
|
||||
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary,self.name,self.originFolder,file)
|
||||
# create the command line befor requesting start:
|
||||
cmdLine=lutinTools.ListToStr([
|
||||
cmdLine=lutinTools.list_to_str([
|
||||
target.cc,
|
||||
"-o", file_dst,
|
||||
target.global_include_cc,
|
||||
lutinTools.AddPrefix("-I",self.export_path),
|
||||
lutinTools.AddPrefix("-I",self.local_path),
|
||||
lutinTools.AddPrefix("-I",depancy.path),
|
||||
lutinTools.add_prefix("-I",self.export_path),
|
||||
lutinTools.add_prefix("-I",self.local_path),
|
||||
lutinTools.add_prefix("-I",depancy.path),
|
||||
target.global_flags_cc,
|
||||
depancy.flags_cc,
|
||||
self.flags_cc,
|
||||
@ -233,22 +233,22 @@ class module:
|
||||
file_src])
|
||||
|
||||
# check the dependency for this file :
|
||||
if False==dependency.NeedReBuild(file_dst, file_src, file_depend, file_cmd, cmdLine):
|
||||
if False==dependency.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine):
|
||||
return file_dst
|
||||
lutinTools.CreateDirectoryOfFile(file_dst)
|
||||
lutinTools.create_directory_of_file(file_dst)
|
||||
comment = ["c", self.name, "<==", file]
|
||||
# process element
|
||||
lutinMultiprocess.RunInPool(cmdLine, comment, file_cmd)
|
||||
lutinMultiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
||||
return file_dst
|
||||
|
||||
|
||||
##
|
||||
## @brief Commands for running ar.
|
||||
##
|
||||
def Link_to_a(self, file, binary, target, depancy):
|
||||
file_src, file_dst, file_depend, file_cmd = target.GenerateFile(binary, self.name,self.originFolder,file,"lib-static")
|
||||
def link_to_a(self, file, binary, target, depancy):
|
||||
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, self.name,self.originFolder,file,"lib-static")
|
||||
#$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS)
|
||||
cmdLine=lutinTools.ListToStr([
|
||||
cmdLine=lutinTools.list_to_str([
|
||||
target.ar,
|
||||
target.global_flags_ar,
|
||||
self.flags_ar,
|
||||
@ -257,34 +257,34 @@ class module:
|
||||
#depancy.src])
|
||||
|
||||
# check the dependency for this file :
|
||||
if False==dependency.NeedRePackage(file_dst, file_src, True, file_cmd, cmdLine) \
|
||||
and False==dependency.NeedRePackage(file_dst, depancy.src, False, file_cmd, cmdLine):
|
||||
if False==dependency.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) \
|
||||
and False==dependency.need_re_package(file_dst, depancy.src, False, file_cmd, cmdLine):
|
||||
return file_dst
|
||||
lutinTools.CreateDirectoryOfFile(file_dst)
|
||||
debug.printElement("StaticLib", self.name, "==>", file_dst)
|
||||
lutinTools.create_directory_of_file(file_dst)
|
||||
debug.print_element("StaticLib", self.name, "==>", file_dst)
|
||||
# explicitly remove the destination to prevent error ...
|
||||
if os.path.exists(file_dst) and os.path.isfile(file_dst):
|
||||
os.remove(file_dst)
|
||||
lutinMultiprocess.RunCommand(cmdLine)
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
#$(Q)$(TARGET_RANLIB) $@
|
||||
cmdLineRanLib=lutinTools.ListToStr([
|
||||
cmdLineRanLib=lutinTools.list_to_str([
|
||||
target.ranlib,
|
||||
file_dst ])
|
||||
lutinMultiprocess.RunCommand(cmdLineRanLib)
|
||||
lutinMultiprocess.run_command(cmdLineRanLib)
|
||||
# write cmd line only after to prevent errors ...
|
||||
lutinMultiprocess.StoreCommand(cmdLine, file_cmd)
|
||||
lutinMultiprocess.store_command(cmdLine, file_cmd)
|
||||
return file_dst
|
||||
|
||||
|
||||
##
|
||||
## @brief Commands for running gcc to link a shared library.
|
||||
##
|
||||
def Link_to_so(self, file, binary, target, depancy, libName=""):
|
||||
def link_to_so(self, file, binary, target, depancy, libName=""):
|
||||
if libName=="":
|
||||
libName = self.name
|
||||
file_src, file_dst, file_depend, file_cmd = target.GenerateFile(binary, libName,self.originFolder,file,"lib-shared")
|
||||
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, libName,self.originFolder,file,"lib-shared")
|
||||
#create command Line
|
||||
cmdLine=lutinTools.ListToStr([
|
||||
cmdLine=lutinTools.list_to_str([
|
||||
target.xx,
|
||||
"-o", file_dst,
|
||||
target.global_sysroot,
|
||||
@ -296,36 +296,36 @@ class module:
|
||||
target.global_flags_ld])
|
||||
|
||||
# check the dependency for this file :
|
||||
if dependency.NeedRePackage(file_dst, file_src, True, file_cmd, cmdLine) == False \
|
||||
and dependency.NeedRePackage(file_dst, depancy.src, False, file_cmd, cmdLine) == False:
|
||||
if dependency.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False \
|
||||
and dependency.need_re_package(file_dst, depancy.src, False, file_cmd, cmdLine) == False:
|
||||
return tmpList[1]
|
||||
lutinTools.CreateDirectoryOfFile(file_dst)
|
||||
debug.printElement("SharedLib", libName, "==>", file_dst)
|
||||
lutinMultiprocess.RunCommand(cmdLine)
|
||||
lutinTools.create_directory_of_file(file_dst)
|
||||
debug.print_element("SharedLib", libName, "==>", file_dst)
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
if "release"==target.buildMode \
|
||||
or lutinEnv.GetForceStripMode()==True:
|
||||
or lutinEnv.get_force_strip_mode()==True:
|
||||
# get the file size of the non strip file
|
||||
originSize = lutinTools.FileSize(file_dst);
|
||||
debug.printElement("SharedLib(strip)", libName, "", "")
|
||||
cmdLineStrip=lutinTools.ListToStr([
|
||||
originSize = lutinTools.file_size(file_dst);
|
||||
debug.print_element("SharedLib(strip)", libName, "", "")
|
||||
cmdLineStrip=lutinTools.list_to_str([
|
||||
target.strip,
|
||||
file_dst])
|
||||
lutinMultiprocess.RunCommand(cmdLineStrip)
|
||||
lutinMultiprocess.run_command(cmdLineStrip)
|
||||
# get the stip size of the binary
|
||||
stripSize = lutinTools.FileSize(file_dst)
|
||||
stripSize = lutinTools.file_size(file_dst)
|
||||
debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko")
|
||||
# write cmd line only after to prevent errors ...
|
||||
lutinMultiprocess.StoreCommand(cmdLine, file_cmd)
|
||||
#debug.printElement("SharedLib", self.name, "==>", tmpList[1])
|
||||
lutinMultiprocess.store_command(cmdLine, file_cmd)
|
||||
#debug.print_element("SharedLib", self.name, "==>", tmpList[1])
|
||||
|
||||
|
||||
##
|
||||
## @brief Commands for running gcc to link an executable.
|
||||
##
|
||||
def Link_to_bin(self, file, binary, target, depancy):
|
||||
file_src, file_dst, file_depend, file_cmd = target.GenerateFile(binary, self.name,self.originFolder,file,"bin")
|
||||
def link_to_bin(self, file, binary, target, depancy):
|
||||
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, self.name,self.originFolder,file,"bin")
|
||||
#create comdLine :
|
||||
cmdLine=lutinTools.ListToStr([
|
||||
cmdLine=lutinTools.list_to_str([
|
||||
target.xx,
|
||||
"-o", file_dst,
|
||||
target.global_sysroot,
|
||||
@ -335,27 +335,27 @@ class module:
|
||||
depancy.flags_ld,
|
||||
target.global_flags_ld])
|
||||
# check the dependency for this file :
|
||||
if False==dependency.NeedRePackage(file_dst, file_src, True, file_cmd, cmdLine) \
|
||||
and False==dependency.NeedRePackage(file_dst, depancy.src, False, file_cmd, cmdLine):
|
||||
if False==dependency.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) \
|
||||
and False==dependency.need_re_package(file_dst, depancy.src, False, file_cmd, cmdLine):
|
||||
return file_dst
|
||||
lutinTools.CreateDirectoryOfFile(file_dst)
|
||||
debug.printElement("Executable", self.name, "==>", file_dst)
|
||||
lutinTools.create_directory_of_file(file_dst)
|
||||
debug.print_element("Executable", self.name, "==>", file_dst)
|
||||
|
||||
lutinMultiprocess.RunCommand(cmdLine)
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
if "release"==target.buildMode \
|
||||
or lutinEnv.GetForceStripMode()==True:
|
||||
or lutinEnv.get_force_strip_mode()==True:
|
||||
# get the file size of the non strip file
|
||||
originSize = lutinTools.FileSize(file_dst);
|
||||
debug.printElement("Executable(strip)", self.name, "", "")
|
||||
cmdLineStrip=lutinTools.ListToStr([
|
||||
originSize = lutinTools.file_size(file_dst);
|
||||
debug.print_element("Executable(strip)", self.name, "", "")
|
||||
cmdLineStrip=lutinTools.list_to_str([
|
||||
target.strip,
|
||||
file_dst])
|
||||
lutinMultiprocess.RunCommand(cmdLineStrip)
|
||||
lutinMultiprocess.run_command(cmdLineStrip)
|
||||
# get the stip size of the binary
|
||||
stripSize = lutinTools.FileSize(file_dst)
|
||||
stripSize = lutinTools.file_size(file_dst)
|
||||
debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko")
|
||||
# write cmd line only after to prevent errors ...
|
||||
lutinMultiprocess.StoreCommand(cmdLine, file_cmd)
|
||||
lutinMultiprocess.store_command(cmdLine, file_cmd)
|
||||
|
||||
|
||||
##
|
||||
@ -364,7 +364,7 @@ class module:
|
||||
def files_to_staging(self, binaryName, target):
|
||||
for element in self.files:
|
||||
debug.verbose("Might copy file : " + element[0] + " ==> " + element[1])
|
||||
target.AddFileStaging(self.originFolder+"/"+element[0], element[1])
|
||||
target.add_file_staging(self.originFolder+"/"+element[0], element[1])
|
||||
|
||||
##
|
||||
## @brief Commands for copying files
|
||||
@ -372,12 +372,12 @@ class module:
|
||||
def folders_to_staging(self, binaryName, target):
|
||||
for element in self.folders:
|
||||
debug.verbose("Might copy folder : " + element[0] + "==>" + element[1])
|
||||
lutinTools.CopyAnythingTarget(target, self.originFolder+"/"+element[0],element[1])
|
||||
lutinTools.copy_anything_target(target, self.originFolder+"/"+element[0],element[1])
|
||||
|
||||
# call here to build the module
|
||||
def Build(self, target, packageName):
|
||||
def build(self, target, packageName):
|
||||
# ckeck if not previously build
|
||||
if target.IsModuleBuild(self.name)==True:
|
||||
if target.is_module_build(self.name)==True:
|
||||
return self.localHeritage
|
||||
|
||||
if packageName==None \
|
||||
@ -390,12 +390,12 @@ class module:
|
||||
None
|
||||
|
||||
# build dependency befor
|
||||
listSubFileNeededToBuild = []
|
||||
listSubFileNeededTobuild = []
|
||||
subHeritage = heritage.heritage(None)
|
||||
for dep in self.depends:
|
||||
inherit = target.Build(dep, packageName)
|
||||
inherit = target.build(dep, packageName)
|
||||
# add at the heritage list :
|
||||
subHeritage.AddSub(inherit)
|
||||
subHeritage.add_sub(inherit)
|
||||
|
||||
# build local sources
|
||||
for file in self.src:
|
||||
@ -403,62 +403,62 @@ class module:
|
||||
fileExt = file.split(".")[-1]
|
||||
if fileExt == "c" \
|
||||
or fileExt == "C":
|
||||
resFile = self.Compile_cc_to_o(file, packageName, target, subHeritage)
|
||||
listSubFileNeededToBuild.append(resFile)
|
||||
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":
|
||||
resFile = self.Compile_xx_to_o(file, packageName, target, subHeritage)
|
||||
listSubFileNeededToBuild.append(resFile)
|
||||
resFile = self.compile_xx_to_o(file, packageName, target, subHeritage)
|
||||
listSubFileNeededTobuild.append(resFile)
|
||||
elif fileExt == "mm" \
|
||||
or fileExt == "MM":
|
||||
resFile = self.Compile_mm_to_o(file, packageName, target, subHeritage)
|
||||
listSubFileNeededToBuild.append(resFile)
|
||||
resFile = self.compile_mm_to_o(file, packageName, target, subHeritage)
|
||||
listSubFileNeededTobuild.append(resFile)
|
||||
else:
|
||||
debug.verbose(" TODO : gcc " + self.originFolder + "/" + file)
|
||||
# when multiprocess availlable, we need to synchronize here ...
|
||||
lutinMultiprocess.PoolSynchrosize()
|
||||
lutinMultiprocess.pool_synchrosize()
|
||||
|
||||
# generate end point:
|
||||
if self.type=='PREBUILD':
|
||||
# nothing to add ==> just dependence
|
||||
None
|
||||
elif self.type=='LIBRARY':
|
||||
resFile = self.Link_to_a(listSubFileNeededToBuild, packageName, target, subHeritage)
|
||||
self.localHeritage.AddSources(resFile)
|
||||
resFile = self.link_to_a(listSubFileNeededTobuild, packageName, target, subHeritage)
|
||||
self.localHeritage.add_sources(resFile)
|
||||
elif self.type=='BINARY':
|
||||
resFile = self.Link_to_bin(listSubFileNeededToBuild, packageName, target, subHeritage)
|
||||
resFile = self.link_to_bin(listSubFileNeededTobuild, packageName, target, subHeritage)
|
||||
# generate tree for this special binary
|
||||
target.CleanModuleTree()
|
||||
self.BuildTree(target, self.name)
|
||||
target.copyToStaging(self.name)
|
||||
target.clean_module_tree()
|
||||
self.build_tree(target, self.name)
|
||||
target.copy_to_staging(self.name)
|
||||
elif self.type=="PACKAGE":
|
||||
if target.name=="Android":
|
||||
# special case for android wrapper :
|
||||
resFile = self.Link_to_so(listSubFileNeededToBuild, packageName, target, subHeritage, "libewol")
|
||||
resFile = self.link_to_so(listSubFileNeededTobuild, packageName, target, subHeritage, "libewol")
|
||||
else:
|
||||
resFile = self.Link_to_bin(listSubFileNeededToBuild, packageName, target, subHeritage)
|
||||
target.CleanModuleTree()
|
||||
resFile = self.link_to_bin(listSubFileNeededTobuild, packageName, target, subHeritage)
|
||||
target.clean_module_tree()
|
||||
# generate tree for this special binary
|
||||
self.BuildTree(target, self.name)
|
||||
target.copyToStaging(self.name)
|
||||
self.build_tree(target, self.name)
|
||||
target.copy_to_staging(self.name)
|
||||
if target.endGeneratePackage==True:
|
||||
# generate the package with his properties ...
|
||||
target.MakePackage(self.name, self.packageProp, self.originFolder + "/..")
|
||||
target.make_package(self.name, self.packageProp, self.originFolder + "/..")
|
||||
else:
|
||||
debug.error("Dit not know the element type ... (impossible case) type=" + self.type)
|
||||
|
||||
self.localHeritage.AddSub(subHeritage)
|
||||
self.localHeritage.add_sub(subHeritage)
|
||||
# return local dependency ...
|
||||
return self.localHeritage
|
||||
|
||||
# call here to build the module
|
||||
def BuildTree(self, target, packageName):
|
||||
def build_tree(self, target, packageName):
|
||||
# ckeck if not previously build
|
||||
if target.IsModuleBuildTree(self.name)==True:
|
||||
if target.is_module_buildTree(self.name)==True:
|
||||
return
|
||||
debug.verbose("build tree of " + self.name)
|
||||
# add all the elements (first added only one keep ==> permit to everload sublib element)
|
||||
@ -466,32 +466,32 @@ class module:
|
||||
self.folders_to_staging(packageName, target)
|
||||
#build tree of all submodules
|
||||
for dep in self.depends:
|
||||
inherit = target.BuildTree(dep, packageName)
|
||||
inherit = target.build_tree(dep, packageName)
|
||||
|
||||
|
||||
# call here to Clean the module
|
||||
def Clean(self, target):
|
||||
# call here to clean the module
|
||||
def clean(self, target):
|
||||
if self.type=='PREBUILD':
|
||||
# nothing to add ==> just dependence
|
||||
None
|
||||
elif self.type=='LIBRARY':
|
||||
# remove folder of the lib ... for this targer
|
||||
folderBuild = target.GetBuildFolder(self.name)
|
||||
debug.info("remove folder : '" + folderBuild + "'")
|
||||
lutinTools.RemoveFolderAndSubFolder(folderBuild)
|
||||
folderbuild = target.get_build_folder(self.name)
|
||||
debug.info("remove folder : '" + folderbuild + "'")
|
||||
lutinTools.remove_folder_and_sub_folder(folderbuild)
|
||||
elif self.type=='BINARY' \
|
||||
or self.type=='PACKAGE':
|
||||
# remove folder of the lib ... for this targer
|
||||
folderBuild = target.GetBuildFolder(self.name)
|
||||
debug.info("remove folder : '" + folderBuild + "'")
|
||||
lutinTools.RemoveFolderAndSubFolder(folderBuild)
|
||||
folderStaging = target.GetStagingFolder(self.name)
|
||||
folderbuild = target.get_build_folder(self.name)
|
||||
debug.info("remove folder : '" + folderbuild + "'")
|
||||
lutinTools.remove_folder_and_sub_folder(folderbuild)
|
||||
folderStaging = target.get_staging_folder(self.name)
|
||||
debug.info("remove folder : '" + folderStaging + "'")
|
||||
lutinTools.RemoveFolderAndSubFolder(folderStaging)
|
||||
lutinTools.remove_folder_and_sub_folder(folderStaging)
|
||||
else:
|
||||
debug.error("Dit not know the element type ... (impossible case) type=" + self.type)
|
||||
|
||||
def AppendAndCheck(self, listout, newElement, order):
|
||||
def append_and_check(self, listout, newElement, order):
|
||||
for element in listout:
|
||||
if element==newElement:
|
||||
return
|
||||
@ -499,98 +499,98 @@ class module:
|
||||
if True==order:
|
||||
listout.sort()
|
||||
|
||||
def AppendToInternalList(self, listout, list, order=False):
|
||||
def append_to_internalList(self, listout, list, order=False):
|
||||
if type(list) == type(str()):
|
||||
self.AppendAndCheck(listout, list, order)
|
||||
self.append_and_check(listout, list, order)
|
||||
else:
|
||||
# mulyiple imput in the list ...
|
||||
for elem in list:
|
||||
self.AppendAndCheck(listout, elem, order)
|
||||
self.append_and_check(listout, elem, order)
|
||||
|
||||
def AddModuleDepend(self, list):
|
||||
self.AppendToInternalList(self.depends, list, True)
|
||||
def add_module_depend(self, list):
|
||||
self.append_to_internalList(self.depends, list, True)
|
||||
|
||||
def AddExportPath(self, list):
|
||||
self.AppendToInternalList(self.export_path, list)
|
||||
def add_export_path(self, list):
|
||||
self.append_to_internalList(self.export_path, list)
|
||||
|
||||
def AddPath(self, list):
|
||||
self.AppendToInternalList(self.local_path, list)
|
||||
def add_path(self, list):
|
||||
self.append_to_internalList(self.local_path, list)
|
||||
|
||||
def AddExportflag_LD(self, list):
|
||||
self.AppendToInternalList(self.export_flags_ld, list)
|
||||
def add_export_flag_LD(self, list):
|
||||
self.append_to_internalList(self.export_flags_ld, list)
|
||||
|
||||
def AddExportFlag_CC(self, list):
|
||||
self.AppendToInternalList(self.export_flags_cc, list)
|
||||
def add_export_flag_CC(self, list):
|
||||
self.append_to_internalList(self.export_flags_cc, list)
|
||||
|
||||
def AddExportFlag_XX(self, list):
|
||||
self.AppendToInternalList(self.export_flags_xx, list)
|
||||
def add_export_flag_XX(self, list):
|
||||
self.append_to_internalList(self.export_flags_xx, list)
|
||||
|
||||
def AddExportFlag_M(self, list):
|
||||
self.AppendToInternalList(self.export_flags_m, list)
|
||||
def add_export_flag_M(self, list):
|
||||
self.append_to_internalList(self.export_flags_m, list)
|
||||
|
||||
def AddExportFlag_MM(self, list):
|
||||
self.AppendToInternalList(self.export_flags_mm, list)
|
||||
def add_export_flag_MM(self, list):
|
||||
self.append_to_internalList(self.export_flags_mm, list)
|
||||
|
||||
# add the link flag at the module
|
||||
def CompileFlags_LD(self, list):
|
||||
self.AppendToInternalList(self.flags_ld, list)
|
||||
def compile_flags_LD(self, list):
|
||||
self.append_to_internalList(self.flags_ld, list)
|
||||
|
||||
def CompileFlags_CC(self, list):
|
||||
self.AppendToInternalList(self.flags_cc, list)
|
||||
def compile_flags_CC(self, list):
|
||||
self.append_to_internalList(self.flags_cc, list)
|
||||
|
||||
def CompileFlags_XX(self, list):
|
||||
self.AppendToInternalList(self.flags_xx, list)
|
||||
def compile_flags_XX(self, list):
|
||||
self.append_to_internalList(self.flags_xx, list)
|
||||
|
||||
def CompileFlags_M(self, list):
|
||||
self.AppendToInternalList(self.flags_m, list)
|
||||
def compile_flags_M(self, list):
|
||||
self.append_to_internalList(self.flags_m, list)
|
||||
|
||||
def CompileFlags_MM(self, list):
|
||||
self.AppendToInternalList(self.flags_mm, list)
|
||||
def compile_flags_MM(self, list):
|
||||
self.append_to_internalList(self.flags_mm, list)
|
||||
|
||||
def CompileFlags_S(self, list):
|
||||
self.AppendToInternalList(self.flags_s, list)
|
||||
def compile_flags_S(self, list):
|
||||
self.append_to_internalList(self.flags_s, list)
|
||||
|
||||
def AddSrcFile(self, list):
|
||||
self.AppendToInternalList(self.src, list, True)
|
||||
def add_src_file(self, list):
|
||||
self.append_to_internalList(self.src, list, True)
|
||||
|
||||
def CopyFile(self, src, dst):
|
||||
def copy_file(self, src, dst):
|
||||
self.files.append([src,dst])
|
||||
|
||||
def CopyFolder(self, src, dst):
|
||||
def copy_folder(self, src, dst):
|
||||
self.folders.append([src,dst])
|
||||
|
||||
def PrintList(self, description, list):
|
||||
def print_list(self, description, list):
|
||||
if len(list) > 0:
|
||||
print ' %s' %description
|
||||
for elem in list:
|
||||
print ' %s' %elem
|
||||
|
||||
def Display(self, target):
|
||||
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
|
||||
self.PrintList('depends',self.depends)
|
||||
self.PrintList('flags_ld',self.flags_ld)
|
||||
self.PrintList('flags_cc',self.flags_cc)
|
||||
self.PrintList('flags_xx',self.flags_xx)
|
||||
self.PrintList('flags_m',self.flags_m)
|
||||
self.PrintList('flags_mm',self.flags_mm)
|
||||
self.PrintList('flags_s',self.flags_s)
|
||||
self.PrintList('src',self.src)
|
||||
self.PrintList('files',self.files)
|
||||
self.PrintList('folders',self.folders)
|
||||
self.PrintList('export_path',self.export_path)
|
||||
self.PrintList('export_flags_ld',self.export_flags_ld)
|
||||
self.PrintList('export_flags_cc',self.export_flags_cc)
|
||||
self.PrintList('export_flags_xx',self.export_flags_xx)
|
||||
self.PrintList('export_flags_m',self.export_flags_m)
|
||||
self.PrintList('export_flags_mm',self.export_flags_mm)
|
||||
self.PrintList('local_path',self.local_path)
|
||||
self.print_list('depends',self.depends)
|
||||
self.print_list('flags_ld',self.flags_ld)
|
||||
self.print_list('flags_cc',self.flags_cc)
|
||||
self.print_list('flags_xx',self.flags_xx)
|
||||
self.print_list('flags_m',self.flags_m)
|
||||
self.print_list('flags_mm',self.flags_mm)
|
||||
self.print_list('flags_s',self.flags_s)
|
||||
self.print_list('src',self.src)
|
||||
self.print_list('files',self.files)
|
||||
self.print_list('folders',self.folders)
|
||||
self.print_list('export_path',self.export_path)
|
||||
self.print_list('export_flags_ld',self.export_flags_ld)
|
||||
self.print_list('export_flags_cc',self.export_flags_cc)
|
||||
self.print_list('export_flags_xx',self.export_flags_xx)
|
||||
self.print_list('export_flags_m',self.export_flags_m)
|
||||
self.print_list('export_flags_mm',self.export_flags_mm)
|
||||
self.print_list('local_path',self.local_path)
|
||||
|
||||
def pkgSet(self, variable, value):
|
||||
def pkg_set(self, variable, value):
|
||||
if "COMPAGNY_TYPE" == variable:
|
||||
# com : Commercial
|
||||
# net : Network??
|
||||
@ -664,7 +664,7 @@ class module:
|
||||
else:
|
||||
debug.error("not know pak element : '" + variable + "'")
|
||||
|
||||
def pkgAdd(self, variable, value):
|
||||
def pkg_add(self, variable, value):
|
||||
# TODO : Check values...
|
||||
self.packageProp[variable].append(value)
|
||||
|
||||
@ -674,7 +674,7 @@ class module:
|
||||
moduleList=[]
|
||||
__startModuleName="lutin_"
|
||||
|
||||
def ImportPath(path):
|
||||
def import_path(path):
|
||||
global moduleList
|
||||
matches = []
|
||||
debug.debug('Start find sub File : "%s"' %path)
|
||||
@ -690,40 +690,40 @@ def ImportPath(path):
|
||||
debug.debug("integrate module: '" + moduleName + "' from '" + os.path.join(root, filename) + "'")
|
||||
moduleList.append([moduleName,os.path.join(root, filename)])
|
||||
|
||||
def LoadModule(target, name):
|
||||
def load_module(target, name):
|
||||
global moduleList
|
||||
for mod in moduleList:
|
||||
if mod[0]==name:
|
||||
if mod[0] == name:
|
||||
sys.path.append(os.path.dirname(mod[1]))
|
||||
theModule = __import__(__startModuleName + name)
|
||||
#try:
|
||||
tmpElement = theModule.Create(target)
|
||||
tmpElement = theModule.create(target)
|
||||
if (tmpElement == None) :
|
||||
debug.debug("Request load module '" + name + "' not define for this platform")
|
||||
else:
|
||||
target.AddModule(tmpElement)
|
||||
target.add_module(tmpElement)
|
||||
#except:
|
||||
# debug.error(" no function 'Create' in the module : " + mod[0] + " from:'" + mod[1] + "'")
|
||||
|
||||
def ListAllModule():
|
||||
def list_all_module():
|
||||
global moduleList
|
||||
tmpListName = []
|
||||
for mod in moduleList:
|
||||
tmpListName.append(mod[0])
|
||||
return tmpListName
|
||||
|
||||
def ListAllModuleWithDesc():
|
||||
def list_all_module_with_desc():
|
||||
global moduleList
|
||||
tmpList = []
|
||||
for mod in moduleList:
|
||||
sys.path.append(os.path.dirname(mod[1]))
|
||||
theModule = __import__("lutin_" + mod[0])
|
||||
try:
|
||||
tmpdesc = theModule.GetDesc()
|
||||
AddModule(tmpElement)
|
||||
tmpdesc = theModule.get_desc()
|
||||
tmpList.append([mod[0], tmpdesc])
|
||||
except:
|
||||
tmpList.append([mod[0], "no description"])
|
||||
debug.warning("has no naeme : " + mod[0])
|
||||
tmpList.append([mod[0], ""])
|
||||
return tmpList
|
||||
|
||||
|
||||
|
@ -15,15 +15,15 @@ currentThreadWorking = 0
|
||||
threads = []
|
||||
|
||||
exitFlag = False # resuest stop of the thread
|
||||
isInit = False # the thread are initialized
|
||||
isinit = False # the thread are initialized
|
||||
errorOccured = False # a thread have an error
|
||||
processorAvaillable = 1 # number of CPU core availlable
|
||||
|
||||
def StoreCommand(cmdLine, file):
|
||||
def store_command(cmdLine, file):
|
||||
# write cmd line only after to prevent errors ...
|
||||
if file!="":
|
||||
# Create directory:
|
||||
lutinTools.CreateDirectoryOfFile(file)
|
||||
lutinTools.create_directory_of_file(file)
|
||||
# Store the command Line:
|
||||
file2 = open(file, "w")
|
||||
file2.write(cmdLine)
|
||||
@ -31,8 +31,8 @@ def StoreCommand(cmdLine, file):
|
||||
file2.close()
|
||||
|
||||
|
||||
def RunCommand(cmdLine, storeCmdLine=""):
|
||||
debug.debug(lutinEnv.PrintPretty(cmdLine))
|
||||
def run_command(cmdLine, storeCmdLine=""):
|
||||
debug.debug(lutinEnv.print_pretty(cmdLine))
|
||||
try:
|
||||
retcode = subprocess.call(cmdLine, shell=True)
|
||||
except OSError as e:
|
||||
@ -50,7 +50,7 @@ def RunCommand(cmdLine, storeCmdLine=""):
|
||||
return
|
||||
|
||||
# write cmd line only after to prevent errors ...
|
||||
StoreCommand(cmdLine, storeCmdLine)
|
||||
store_command(cmdLine, storeCmdLine)
|
||||
|
||||
|
||||
|
||||
@ -80,8 +80,8 @@ class myThread(threading.Thread):
|
||||
comment = data[2]
|
||||
cmdLine = data[1]
|
||||
cmdStoreFile = data[3]
|
||||
debug.printElement( "[" + str(self.threadID) + "] " + comment[0], comment[1], comment[2], comment[3])
|
||||
RunCommand(cmdLine, cmdStoreFile)
|
||||
debug.print_element( "[" + str(self.threadID) + "] " + comment[0], comment[1], comment[2], comment[3])
|
||||
run_command(cmdLine, cmdStoreFile)
|
||||
else:
|
||||
debug.warning("unknow request command : " + data[0])
|
||||
else:
|
||||
@ -95,21 +95,21 @@ class myThread(threading.Thread):
|
||||
debug.verbose("Exiting " + self.name)
|
||||
|
||||
|
||||
def ErrorOccured():
|
||||
def error_occured():
|
||||
global exitFlag
|
||||
exitFlag = True
|
||||
|
||||
def SetCoreNumber(numberOfcore):
|
||||
def set_core_number(numberOfcore):
|
||||
global processorAvaillable
|
||||
processorAvaillable = numberOfcore
|
||||
debug.debug(" set number of core for multi process compilation : " + str(processorAvaillable))
|
||||
# nothing else to do
|
||||
|
||||
def Init():
|
||||
def init():
|
||||
global exitFlag
|
||||
global isInit
|
||||
if isInit==False:
|
||||
isInit=True
|
||||
global isinit
|
||||
if isinit==False:
|
||||
isinit=True
|
||||
global threads
|
||||
global queueLock
|
||||
global workQueue
|
||||
@ -123,7 +123,7 @@ def Init():
|
||||
|
||||
|
||||
|
||||
def UnInit():
|
||||
def un_init():
|
||||
global exitFlag
|
||||
# Notify threads it's time to exit
|
||||
exitFlag = True
|
||||
@ -136,13 +136,13 @@ def UnInit():
|
||||
|
||||
|
||||
|
||||
def RunInPool(cmdLine, comment, storeCmdLine=""):
|
||||
def run_in_pool(cmdLine, comment, storeCmdLine=""):
|
||||
if processorAvaillable <= 1:
|
||||
debug.printElement(comment[0], comment[1], comment[2], comment[3])
|
||||
RunCommand(cmdLine, storeCmdLine)
|
||||
debug.print_element(comment[0], comment[1], comment[2], comment[3])
|
||||
run_command(cmdLine, storeCmdLine)
|
||||
return
|
||||
# multithreaded mode
|
||||
Init()
|
||||
init()
|
||||
# Fill the queue
|
||||
queueLock.acquire()
|
||||
debug.verbose("add : in pool cmdLine")
|
||||
@ -150,7 +150,7 @@ def RunInPool(cmdLine, comment, storeCmdLine=""):
|
||||
queueLock.release()
|
||||
|
||||
|
||||
def PoolSynchrosize():
|
||||
def pool_synchrosize():
|
||||
global errorOccured
|
||||
if processorAvaillable <= 1:
|
||||
#in this case : nothing to synchronise
|
||||
@ -171,6 +171,6 @@ def PoolSynchrosize():
|
||||
debug.verbose("queue is empty")
|
||||
else:
|
||||
debug.debug("Thread return with error ... ==> stop all the pool")
|
||||
UnInit()
|
||||
un_init()
|
||||
debug.error("Pool error occured ...")
|
||||
|
||||
|
124
lutinTarget.py
124
lutinTarget.py
@ -81,7 +81,7 @@ class Target:
|
||||
def get_build_mode(self):
|
||||
return self.buildMode
|
||||
|
||||
def AddFileStaging(self, inputFile, outputFile):
|
||||
def add_file_staging(self, inputFile, outputFile):
|
||||
for source, dst in self.listFinalFile:
|
||||
if dst == outputFile :
|
||||
debug.verbose("already added : " + outputFile)
|
||||
@ -89,29 +89,29 @@ class Target:
|
||||
debug.verbose("add file : '" + inputFile + "' ==> '" + outputFile + "'");
|
||||
self.listFinalFile.append([inputFile,outputFile])
|
||||
|
||||
def copyToStaging(self, binaryName):
|
||||
baseFolder = self.GetStagingFolderData(binaryName)
|
||||
def copy_to_staging(self, binaryName):
|
||||
baseFolder = self.get_staging_folder_data(binaryName)
|
||||
for source, dst in self.listFinalFile:
|
||||
debug.verbose("must copy file : '" + source + "' ==> '" + dst + "'");
|
||||
lutinTools.CopyFile(source, baseFolder+"/"+dst)
|
||||
lutinTools.copy_file(source, baseFolder+"/"+dst)
|
||||
|
||||
|
||||
def CleanModuleTree(self):
|
||||
def clean_module_tree(self):
|
||||
self.buildTreeDone = []
|
||||
self.listFinalFile = []
|
||||
|
||||
|
||||
# TODO : Remove this hack ... ==> really bad ... but usefull
|
||||
def SetEwolFolder(self, folder):
|
||||
def set_ewol_folder(self, folder):
|
||||
self.folder_ewol = folder
|
||||
|
||||
|
||||
def fileGenerateObject(self,binaryName,moduleName,basePath,file):
|
||||
def file_generate_object(self,binaryName,moduleName,basePath,file):
|
||||
list=[]
|
||||
list.append(basePath + "/" + file)
|
||||
list.append(self.GetBuildFolder(moduleName) + "/" + file + self.suffix_obj)
|
||||
list.append(self.GetBuildFolder(moduleName) + "/" + file + self.suffix_dependence)
|
||||
list.append(self.GetBuildFolder(moduleName) + "/" + file + self.suffix_cmdLine)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + file + self.suffix_obj)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + file + self.suffix_dependence)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + file + self.suffix_cmdLine)
|
||||
return list
|
||||
"""
|
||||
return a list of 3 elements :
|
||||
@ -119,118 +119,118 @@ class Target:
|
||||
1 : destination file
|
||||
2 : dependence files module (*.d)
|
||||
"""
|
||||
def GenerateFile(self,binaryName,moduleName,basePath,file,type):
|
||||
def generate_file(self,binaryName,moduleName,basePath,file,type):
|
||||
list=[]
|
||||
if (type=="bin"):
|
||||
list.append(file)
|
||||
list.append(self.GetStagingFolder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary)
|
||||
list.append(self.GetBuildFolder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||
list.append(self.GetStagingFolder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_cmdLine)
|
||||
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_cmdLine)
|
||||
elif (type=="lib-shared"):
|
||||
list.append(file)
|
||||
list.append(self.GetStagingFolder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic)
|
||||
list.append(self.GetBuildFolder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||
list.append(self.GetStagingFolder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_cmdLine)
|
||||
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_cmdLine)
|
||||
elif (type=="lib-static"):
|
||||
list.append(file)
|
||||
list.append(self.GetBuildFolder(moduleName) + "/" + moduleName + self.suffix_lib_static)
|
||||
list.append(self.GetBuildFolder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||
list.append(self.GetBuildFolder(moduleName) + "/" + moduleName + self.suffix_cmdLine)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_cmdLine)
|
||||
else:
|
||||
debug.error("unknow type : " + type)
|
||||
return list
|
||||
|
||||
def GetFinalFolder(self):
|
||||
return lutinTools.GetRunFolder() + self.folder_out + self.folder_final
|
||||
def get_final_folder(self):
|
||||
return lutinTools.get_run_folder() + self.folder_out + self.folder_final
|
||||
|
||||
def GetStagingFolder(self, binaryName):
|
||||
return lutinTools.GetRunFolder() + self.folder_out + self.folder_staging + "/" + binaryName
|
||||
def get_staging_folder(self, binaryName):
|
||||
return lutinTools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName
|
||||
|
||||
def GetStagingFolderData(self, binaryName):
|
||||
return self.GetStagingFolder(binaryName) + self.folder_data + "/" + binaryName
|
||||
def get_staging_folder_data(self, binaryName):
|
||||
return self.get_staging_folder(binaryName) + self.folder_data + "/" + binaryName
|
||||
|
||||
def GetBuildFolder(self, moduleName):
|
||||
return lutinTools.GetRunFolder() + self.folder_out + self.folder_build + "/" + moduleName
|
||||
def get_build_folder(self, moduleName):
|
||||
return lutinTools.get_run_folder() + self.folder_out + self.folder_build + "/" + moduleName
|
||||
|
||||
def GetDocFolder(self, moduleName):
|
||||
return lutinTools.GetRunFolder() + self.folder_out + self.folder_doc + "/" + moduleName
|
||||
def get_doc_folder(self, moduleName):
|
||||
return lutinTools.get_run_folder() + self.folder_out + self.folder_doc + "/" + moduleName
|
||||
|
||||
def IsModuleBuild(self,module):
|
||||
def is_module_build(self,module):
|
||||
for mod in self.buildDone:
|
||||
if mod == module:
|
||||
return True
|
||||
self.buildDone.append(module)
|
||||
return False
|
||||
|
||||
def IsModuleBuildTree(self,module):
|
||||
def is_module_buildTree(self,module):
|
||||
for mod in self.buildTreeDone:
|
||||
if mod == module:
|
||||
return True
|
||||
self.buildTreeDone.append(module)
|
||||
return False
|
||||
|
||||
def AddModule(self, newModule):
|
||||
def add_module(self, newModule):
|
||||
debug.debug("Import nodule for Taget : " + newModule.name)
|
||||
self.moduleList.append(newModule)
|
||||
|
||||
|
||||
# return inherit packages ...
|
||||
"""
|
||||
def Build(self, name, packagesName):
|
||||
def build(self, name, packagesName):
|
||||
for module in self.moduleList:
|
||||
if module.name == name:
|
||||
return module.Build(self, packagesName)
|
||||
return module.build(self, packagesName)
|
||||
debug.error("request to build an un-existant module name : '" + name + "'")
|
||||
"""
|
||||
|
||||
def BuildTree(self, name, packagesName):
|
||||
def build_tree(self, name, packagesName):
|
||||
for module in self.moduleList:
|
||||
if module.name == name:
|
||||
module.BuildTree(self, packagesName)
|
||||
module.build_tree(self, packagesName)
|
||||
return
|
||||
debug.error("request to build tree on un-existant module name : '" + name + "'")
|
||||
|
||||
def Clean(self, name):
|
||||
def clean(self, name):
|
||||
for module in self.moduleList:
|
||||
if module.name == name:
|
||||
module.Clean(self)
|
||||
module.clean(self)
|
||||
return
|
||||
debug.error("request to clean an un-existant module name : '" + name + "'")
|
||||
|
||||
def LoadIfNeeded(self, name):
|
||||
def load_if_needed(self, name):
|
||||
for elem in self.moduleList:
|
||||
if elem.name == name:
|
||||
return
|
||||
lutinModule.LoadModule(self, name)
|
||||
lutinModule.load_module(self, name)
|
||||
|
||||
def LoadAll(self):
|
||||
listOfAllTheModule = lutinModule.ListAllModule()
|
||||
def load_all(self):
|
||||
listOfAllTheModule = lutinModule.list_all_module()
|
||||
for modName in listOfAllTheModule:
|
||||
self.LoadIfNeeded(modName)
|
||||
self.load_if_needed(modName)
|
||||
|
||||
def Build(self, name, packagesName=None):
|
||||
def build(self, name, packagesName=None):
|
||||
if name == "dump":
|
||||
debug.info("dump all")
|
||||
self.LoadAll()
|
||||
self.load_all()
|
||||
print 'Dump all modules properties'
|
||||
for mod in self.moduleList:
|
||||
mod.Display(self)
|
||||
mod.display(self)
|
||||
elif name == "all":
|
||||
debug.info("Build all")
|
||||
self.LoadAll()
|
||||
debug.info("build all")
|
||||
self.load_all()
|
||||
for mod in self.moduleList:
|
||||
if self.name=="Android":
|
||||
if mod.type == "PACKAGE":
|
||||
mod.Build(self, None)
|
||||
mod.build(self, None)
|
||||
else:
|
||||
if mod.type == "BINARY" \
|
||||
or mod.type == "PACKAGE":
|
||||
mod.Build(self, None)
|
||||
mod.build(self, None)
|
||||
elif name == "clean":
|
||||
debug.info("Clean all")
|
||||
self.LoadAll()
|
||||
debug.info("clean all")
|
||||
self.load_all()
|
||||
for mod in self.moduleList:
|
||||
mod.Clean(self)
|
||||
mod.clean(self)
|
||||
else:
|
||||
# get the action an the module ....
|
||||
gettedElement = name.split("-")
|
||||
@ -241,32 +241,32 @@ class Target:
|
||||
actionName = "build"
|
||||
debug.verbose("requested : " + moduleName + "-" + actionName)
|
||||
if actionName == "install":
|
||||
self.Build(moduleName + "-build")
|
||||
self.InstallPackage(moduleName)
|
||||
self.build(moduleName + "-build")
|
||||
self.install_package(moduleName)
|
||||
elif actionName == "uninstall":
|
||||
self.UnInstallPackage(moduleName)
|
||||
self.un_install_package(moduleName)
|
||||
elif actionName == "log":
|
||||
self.Log(moduleName)
|
||||
else:
|
||||
self.LoadIfNeeded(moduleName)
|
||||
self.load_if_needed(moduleName)
|
||||
# clean requested
|
||||
for mod in self.moduleList:
|
||||
if mod.name == moduleName:
|
||||
if actionName == "dump":
|
||||
debug.info("dump module '" + moduleName + "'")
|
||||
return mod.Display(self)
|
||||
return mod.display(self)
|
||||
elif actionName == "clean":
|
||||
debug.info("clean module '" + moduleName + "'")
|
||||
return mod.Clean(self)
|
||||
return mod.clean(self)
|
||||
elif actionName == "build":
|
||||
debug.debug("build module '" + moduleName + "'")
|
||||
return mod.Build(self, None)
|
||||
return mod.build(self, None)
|
||||
debug.error("not know module name : '" + moduleName + "' to '" + actionName + "' it")
|
||||
|
||||
|
||||
__startTargetName="lutinTarget"
|
||||
|
||||
def TargetLoad(targetName, compilator, mode, generatePackage):
|
||||
def target_load(targetName, compilator, mode, generatePackage):
|
||||
theTarget = __import__(__startTargetName + targetName)
|
||||
#try:
|
||||
tmpTarget = theTarget.Target(compilator, mode, generatePackage)
|
||||
|
@ -19,7 +19,7 @@ class Target(lutinTarget.Target):
|
||||
if folder=="android":
|
||||
self.folder_ndk = folder + "/ndk"
|
||||
if self.folder_ndk == "AUTO":
|
||||
self.folder_ndk = lutinTools.GetRunFolder() + "/../android/ndk"
|
||||
self.folder_ndk = lutinTools.get_run_folder() + "/../android/ndk"
|
||||
# auto search SDK
|
||||
if self.folder_sdk == "AUTO":
|
||||
for folder in os.listdir("."):
|
||||
@ -27,7 +27,7 @@ class Target(lutinTarget.Target):
|
||||
if folder=="android":
|
||||
self.folder_sdk = folder + "/sdk"
|
||||
if self.folder_sdk == "AUTO":
|
||||
self.folder_sdk = lutinTools.GetRunFolder() + "/../android/sdk"
|
||||
self.folder_sdk = lutinTools.get_run_folder() + "/../android/sdk"
|
||||
|
||||
|
||||
arch = "ARMv7"
|
||||
@ -161,22 +161,22 @@ class Target(lutinTarget.Target):
|
||||
|
||||
|
||||
|
||||
def CheckRightPackage(self, pkgProperties, value):
|
||||
def check_right_package(self, pkgProperties, value):
|
||||
for val in pkgProperties["RIGHT"]:
|
||||
if value == val:
|
||||
return True
|
||||
return False
|
||||
|
||||
def GetStagingFolderData(self, binaryName):
|
||||
return self.GetStagingFolder(binaryName) + self.folder_data
|
||||
def get_staging_folder_data(self, binaryName):
|
||||
return self.get_staging_folder(binaryName) + self.folder_data
|
||||
|
||||
def MakePackage(self, pkgName, pkgProperties, basePkgPath):
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
# FINAL_FOLDER_JAVA_PROJECT
|
||||
self.folder_javaProject= self.GetStagingFolder(pkgName) \
|
||||
self.folder_javaProject= self.get_staging_folder(pkgName) \
|
||||
+ "/src/" \
|
||||
+ pkgProperties["COMPAGNY_TYPE"] \
|
||||
+ "/" + pkgProperties["COMPAGNY_NAME2"] \
|
||||
@ -186,9 +186,9 @@ class Target(lutinTarget.Target):
|
||||
|
||||
compleatePackageName = pkgProperties["COMPAGNY_TYPE"]+"."+pkgProperties["COMPAGNY_NAME2"]+"." + pkgName
|
||||
|
||||
debug.printElement("pkg", "absractionFile", "<==", "dynamic file")
|
||||
debug.print_element("pkg", "absractionFile", "<==", "dynamic file")
|
||||
# Create folder :
|
||||
lutinTools.CreateDirectoryOfFile(self.file_finalAbstraction)
|
||||
lutinTools.create_directory_of_file(self.file_finalAbstraction)
|
||||
# Create file :
|
||||
tmpFile = open(self.file_finalAbstraction, 'w')
|
||||
if pkgProperties["ANDROID_APPL_TYPE"]=="APPL":
|
||||
@ -228,15 +228,15 @@ class Target(lutinTarget.Target):
|
||||
tmpFile.close()
|
||||
|
||||
|
||||
lutinTools.CopyFile(pkgProperties["ICON"], self.GetStagingFolder(pkgName) + "/res/drawable/icon.png", True)
|
||||
lutinTools.copy_file(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/res/drawable/icon.png", True)
|
||||
|
||||
|
||||
if pkgProperties["ANDROID_MANIFEST"]!="":
|
||||
debug.printElement("pkg", "AndroidManifest.xml", "<==", pkgProperties["ANDROID_MANIFEST"])
|
||||
lutinTools.CopyFile(pkgProperties["ANDROID_MANIFEST"], self.GetStagingFolder(pkgName) + "/AndroidManifest.xml", True)
|
||||
debug.print_element("pkg", "AndroidManifest.xml", "<==", pkgProperties["ANDROID_MANIFEST"])
|
||||
lutinTools.copy_file(pkgProperties["ANDROID_MANIFEST"], self.get_staging_folder(pkgName) + "/AndroidManifest.xml", True)
|
||||
else:
|
||||
debug.printElement("pkg", "AndroidManifest.xml", "<==", "package configurations")
|
||||
tmpFile = open(self.GetStagingFolder(pkgName) + "/AndroidManifest.xml", 'w')
|
||||
debug.print_element("pkg", "AndroidManifest.xml", "<==", "package configurations")
|
||||
tmpFile = open(self.get_staging_folder(pkgName) + "/AndroidManifest.xml", 'w')
|
||||
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||
tmpFile.write( "<!-- Manifest is autoGenerated with Ewol ... do not patch it-->\n")
|
||||
tmpFile.write( "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" \n")
|
||||
@ -287,31 +287,31 @@ class Target(lutinTarget.Target):
|
||||
tmpFile.write( " </activity>\n")
|
||||
tmpFile.write( " </application>\n")
|
||||
# write package autorisations :
|
||||
if True==self.CheckRightPackage(pkgProperties, "WRITE_EXTERNAL_STORAGE"):
|
||||
if True==self.check_right_package(pkgProperties, "WRITE_EXTERNAL_STORAGE"):
|
||||
tmpFile.write( " <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" /> \n")
|
||||
if True==self.CheckRightPackage(pkgProperties, "CAMERA"):
|
||||
if True==self.check_right_package(pkgProperties, "CAMERA"):
|
||||
tmpFile.write( " <uses-permission android:name=\"android.permission.CAMERA\" /> \n")
|
||||
if True==self.CheckRightPackage(pkgProperties, "INTERNET"):
|
||||
if True==self.check_right_package(pkgProperties, "INTERNET"):
|
||||
tmpFile.write( " <uses-permission android:name=\"android.permission.INTERNET\" /> \n")
|
||||
if True==self.CheckRightPackage(pkgProperties, "MODIFY_AUDIO_SETTINGS"):
|
||||
if True==self.check_right_package(pkgProperties, "MODIFY_AUDIO_SETTINGS"):
|
||||
tmpFile.write( " <uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\" /> \n")
|
||||
if True==self.CheckRightPackage(pkgProperties, "READ_CALENDAR"):
|
||||
if True==self.check_right_package(pkgProperties, "READ_CALENDAR"):
|
||||
tmpFile.write( " <uses-permission android:name=\"android.permission.READ_CALENDAR\" /> \n")
|
||||
if True==self.CheckRightPackage(pkgProperties, "READ_CONTACTS"):
|
||||
if True==self.check_right_package(pkgProperties, "READ_CONTACTS"):
|
||||
tmpFile.write( " <uses-permission android:name=\"android.permission.READ_CONTACTS\" /> \n")
|
||||
if True==self.CheckRightPackage(pkgProperties, "READ_FRAME_BUFFER"):
|
||||
if True==self.check_right_package(pkgProperties, "READ_FRAME_BUFFER"):
|
||||
tmpFile.write( " <uses-permission android:name=\"android.permission.READ_FRAME_BUFFER\" /> \n")
|
||||
if True==self.CheckRightPackage(pkgProperties, "READ_PROFILE"):
|
||||
if True==self.check_right_package(pkgProperties, "READ_PROFILE"):
|
||||
tmpFile.write( " <uses-permission android:name=\"android.permission.READ_PROFILE\" /> \n")
|
||||
if True==self.CheckRightPackage(pkgProperties, "RECORD_AUDIO"):
|
||||
if True==self.check_right_package(pkgProperties, "RECORD_AUDIO"):
|
||||
tmpFile.write( " <uses-permission android:name=\"android.permission.RECORD_AUDIO\" /> \n")
|
||||
if True==self.CheckRightPackage(pkgProperties, "SET_ORIENTATION"):
|
||||
if True==self.check_right_package(pkgProperties, "SET_ORIENTATION"):
|
||||
tmpFile.write( " <uses-permission android:name=\"android.permission.SET_ORIENTATION\" /> \n")
|
||||
if True==self.CheckRightPackage(pkgProperties, "VIBRATE"):
|
||||
if True==self.check_right_package(pkgProperties, "VIBRATE"):
|
||||
tmpFile.write( " <uses-permission android:name=\"android.permission.VIBRATE\" /> \n")
|
||||
if True==self.CheckRightPackage(pkgProperties, "ACCESS_COARSE_LOCATION"):
|
||||
if True==self.check_right_package(pkgProperties, "ACCESS_COARSE_LOCATION"):
|
||||
tmpFile.write( " <uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" /> \n")
|
||||
if True==self.CheckRightPackage(pkgProperties, "ACCESS_FINE_LOCATION"):
|
||||
if True==self.check_right_package(pkgProperties, "ACCESS_FINE_LOCATION"):
|
||||
tmpFile.write( " <uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" /> \n")
|
||||
tmpFile.write( "</manifest>\n\n")
|
||||
tmpFile.flush()
|
||||
@ -320,9 +320,9 @@ class Target(lutinTarget.Target):
|
||||
|
||||
if pkgProperties["ANDROID_APPL_TYPE"]!="APPL":
|
||||
#create the Wallpaper sub files : (main element for the application
|
||||
debug.printElement("pkg", pkgName + "_resource.xml", "<==", "package configurations")
|
||||
lutinTools.CreateDirectoryOfFile(self.GetStagingFolder(pkgName) + "/res/xml/" + pkgName + "_resource.xml")
|
||||
tmpFile = open(self.GetStagingFolder(pkgName) + "/res/xml/" + pkgName + "_resource.xml", 'w')
|
||||
debug.print_element("pkg", pkgName + "_resource.xml", "<==", "package configurations")
|
||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgName + "_resource.xml")
|
||||
tmpFile = open(self.get_staging_folder(pkgName) + "/res/xml/" + pkgName + "_resource.xml", 'w')
|
||||
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||
tmpFile.write( "<wallpaper xmlns:android=\"http://schemas.android.com/apk/res/android\"\n")
|
||||
if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
|
||||
@ -332,8 +332,8 @@ class Target(lutinTarget.Target):
|
||||
tmpFile.close()
|
||||
# create wallpaper setting if needed (class and config file)
|
||||
if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
|
||||
lutinTools.CreateDirectoryOfFile(self.folder_javaProject + pkgName + "Settings.java")
|
||||
debug.printElement("pkg", self.folder_javaProject + pkgName + "Settings.java", "<==", "package configurations")
|
||||
lutinTools.create_directory_of_file(self.folder_javaProject + pkgName + "Settings.java")
|
||||
debug.print_element("pkg", self.folder_javaProject + pkgName + "Settings.java", "<==", "package configurations")
|
||||
tmpFile = open(self.folder_javaProject + pkgName + "Settings.java", 'w');
|
||||
tmpFile.write( "package " + compleatePackageName + ";\n")
|
||||
tmpFile.write( "\n")
|
||||
@ -363,9 +363,9 @@ class Target(lutinTarget.Target):
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
debug.printElement("pkg", self.GetStagingFolder(pkgName) + "/res/xml/" + pkgName + "_settings.xml", "<==", "package configurations")
|
||||
lutinTools.CreateDirectoryOfFile(self.GetStagingFolder(pkgName) + "/res/xml/" + pkgName + "_settings.xml")
|
||||
tmpFile = open(self.GetStagingFolder(pkgName) + "/res/xml/" + pkgName + "_settings.xml", 'w');
|
||||
debug.print_element("pkg", self.get_staging_folder(pkgName) + "/res/xml/" + pkgName + "_settings.xml", "<==", "package configurations")
|
||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgName + "_settings.xml")
|
||||
tmpFile = open(self.get_staging_folder(pkgName) + "/res/xml/" + pkgName + "_settings.xml", 'w');
|
||||
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||
tmpFile.write( "<PreferenceScreen xmlns:android=\"http://schemas.android.com/apk/res/android\"\n")
|
||||
tmpFile.write( " android:title=\"Settings\"\n")
|
||||
@ -394,9 +394,9 @@ class Target(lutinTarget.Target):
|
||||
if WALL_haveArray==True:
|
||||
for WALL_type, WALL_key, WALL_title, WALL_summary, WALL_other in pkgProperties["ANDROID_WALLPAPER_PROPERTIES"]:
|
||||
if WALL_type == "list":
|
||||
debug.printElement("pkg", self.GetStagingFolder(pkgName) + "/res/values/" + WALL_key + ".xml", "<==", "package configurations")
|
||||
lutinTools.CreateDirectoryOfFile(self.GetStagingFolder(pkgName) + "/res/values/" + WALL_key + ".xml")
|
||||
tmpFile = open(self.GetStagingFolder(pkgName) + "/res/values/" + WALL_key + ".xml", 'w');
|
||||
debug.print_element("pkg", self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml", "<==", "package configurations")
|
||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml")
|
||||
tmpFile = open(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml", 'w');
|
||||
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||
tmpFile.write( "<resources xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\">\n")
|
||||
tmpFile.write( " <string-array name=\"" + pkgName + "_" + WALL_key + "_names\">\n")
|
||||
@ -413,34 +413,34 @@ class Target(lutinTarget.Target):
|
||||
|
||||
|
||||
#add properties on wallpaper :
|
||||
# myModule.pkgAdd("ANDROID_WALLPAPER_PROPERTIES", ["list", key, title, summary, [["key","value display"],["key2","value display 2"]])
|
||||
# myModule.pkgAdd("ANDROID_WALLPAPER_PROPERTIES", ["list", "testpattern", "Select test pattern", "Choose which test pattern to display", [["key","value display"],["key2","value display 2"]]])
|
||||
# myModule.pkgAdd("ANDROID_WALLPAPER_PROPERTIES", ["bool", key, title, summary, ["enable string", "disable String"])
|
||||
# myModule.pkgAdd("ANDROID_WALLPAPER_PROPERTIES", ["bool", "movement", "Motion", "Apply movement to test pattern", ["Moving test pattern", "Still test pattern"]
|
||||
# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["list", key, title, summary, [["key","value display"],["key2","value display 2"]])
|
||||
# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["list", "testpattern", "Select test pattern", "Choose which test pattern to display", [["key","value display"],["key2","value display 2"]]])
|
||||
# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["bool", key, title, summary, ["enable string", "disable String"])
|
||||
# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["bool", "movement", "Motion", "Apply movement to test pattern", ["Moving test pattern", "Still test pattern"]
|
||||
#copy needed resources :
|
||||
for res_source, res_dest in pkgProperties["ANDROID_RESOURCES"]:
|
||||
if res_source == "":
|
||||
continue
|
||||
lutinTools.CopyFile(res_source , self.GetStagingFolder(pkgName) + "/res/" + res_dest + "/" + os.path.basename(res_source), True)
|
||||
lutinTools.copy_file(res_source , self.get_staging_folder(pkgName) + "/res/" + res_dest + "/" + os.path.basename(res_source), True)
|
||||
|
||||
|
||||
# Doc :
|
||||
# http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/
|
||||
debug.printElement("pkg", "R.java", "<==", "Resources files")
|
||||
lutinTools.CreateDirectoryOfFile(self.GetStagingFolder(pkgName) + "/src/noFile")
|
||||
debug.print_element("pkg", "R.java", "<==", "Resources files")
|
||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/src/noFile")
|
||||
androidToolPath = self.folder_sdk + "/build-tools/19.0.0/"
|
||||
cmdLine = androidToolPath + "aapt p -f " \
|
||||
+ "-M " + self.GetStagingFolder(pkgName) + "/AndroidManifest.xml " \
|
||||
+ "-F " + self.GetStagingFolder(pkgName) + "/resources.res " \
|
||||
+ "-M " + self.get_staging_folder(pkgName) + "/AndroidManifest.xml " \
|
||||
+ "-F " + self.get_staging_folder(pkgName) + "/resources.res " \
|
||||
+ "-I " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\
|
||||
+ "-S " + self.GetStagingFolder(pkgName) + "/res/ " \
|
||||
+ "-J " + self.GetStagingFolder(pkgName) + "/src "
|
||||
lutinMultiprocess.RunCommand(cmdLine)
|
||||
+ "-S " + self.get_staging_folder(pkgName) + "/res/ " \
|
||||
+ "-J " + self.get_staging_folder(pkgName) + "/src "
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
#aapt package -f -M ${manifest.file} -F ${packaged.resource.file} -I ${path.to.android-jar.library}
|
||||
# -S ${android-resource-directory} [-m -J ${folder.to.output.the.R.java}]
|
||||
|
||||
lutinTools.CreateDirectoryOfFile(self.GetStagingFolder(pkgName) + "/build/classes/noFile")
|
||||
debug.printElement("pkg", "*.class", "<==", "*.java")
|
||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/build/classes/noFile")
|
||||
debug.print_element("pkg", "*.class", "<==", "*.java")
|
||||
# more information with : -Xlint
|
||||
# + self.file_finalAbstraction + " "\ # this generate ex: out/Android/debug/staging/tethys/src/com/edouarddupin/tethys/edn.java
|
||||
|
||||
@ -463,33 +463,33 @@ class Target(lutinTarget.Target):
|
||||
filesString += self.folder_javaProject + pkgName + "Settings.java "
|
||||
|
||||
cmdLine = "javac " \
|
||||
+ "-d " + self.GetStagingFolder(pkgName) + "/build/classes " \
|
||||
+ "-d " + self.get_staging_folder(pkgName) + "/build/classes " \
|
||||
+ "-classpath " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar " \
|
||||
+ filesString \
|
||||
+ self.file_finalAbstraction + " " \
|
||||
+ self.GetStagingFolder(pkgName) + "/src/R.java "
|
||||
lutinMultiprocess.RunCommand(cmdLine)
|
||||
+ self.get_staging_folder(pkgName) + "/src/R.java "
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
debug.printElement("pkg", ".dex", "<==", "*.class")
|
||||
debug.print_element("pkg", ".dex", "<==", "*.class")
|
||||
cmdLine = androidToolPath + "dx " \
|
||||
+ "--dex --no-strict " \
|
||||
+ "--output=" + self.GetStagingFolder(pkgName) + "/build/" + pkgName + ".dex " \
|
||||
+ self.GetStagingFolder(pkgName) + "/build/classes/ "
|
||||
lutinMultiprocess.RunCommand(cmdLine)
|
||||
+ "--output=" + self.get_staging_folder(pkgName) + "/build/" + pkgName + ".dex " \
|
||||
+ self.get_staging_folder(pkgName) + "/build/classes/ "
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
debug.printElement("pkg", ".apk", "<==", ".dex, assets, .so, res")
|
||||
debug.print_element("pkg", ".apk", "<==", ".dex, assets, .so, res")
|
||||
#builderDebug="-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y "
|
||||
builderDebug=""
|
||||
cmdLine = "java -Xmx128M " \
|
||||
+ "-classpath " + self.folder_sdk + "/tools/lib/sdklib.jar " \
|
||||
+ builderDebug \
|
||||
+ "com.android.sdklib.build.ApkBuilderMain " \
|
||||
+ self.GetStagingFolder(pkgName) + "/build/" + pkgName + "-unalligned.apk " \
|
||||
+ "com.android.sdklib.build.ApkbuilderMain " \
|
||||
+ self.get_staging_folder(pkgName) + "/build/" + pkgName + "-unalligned.apk " \
|
||||
+ "-u " \
|
||||
+ "-z " + self.GetStagingFolder(pkgName) + "/resources.res " \
|
||||
+ "-f " + self.GetStagingFolder(pkgName) + "/build/" + pkgName + ".dex " \
|
||||
+ "-rf " + self.GetStagingFolder(pkgName) + "/data "
|
||||
lutinMultiprocess.RunCommand(cmdLine)
|
||||
+ "-z " + self.get_staging_folder(pkgName) + "/resources.res " \
|
||||
+ "-f " + self.get_staging_folder(pkgName) + "/build/" + pkgName + ".dex " \
|
||||
+ "-rf " + self.get_staging_folder(pkgName) + "/data "
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
# doc :
|
||||
# http://developer.android.com/tools/publishing/app-signing.html
|
||||
@ -503,17 +503,17 @@ class Target(lutinTarget.Target):
|
||||
tmpFile.write("PassKey__AndroidDebugKey\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
debug.printElement("pkg", ".apk(signed debug)", "<==", ".apk (not signed)")
|
||||
debug.print_element("pkg", ".apk(signed debug)", "<==", ".apk (not signed)")
|
||||
# verbose mode :
|
||||
#debugOption = "-verbose -certs "
|
||||
debugOption = ""
|
||||
cmdLine = "jarsigner " \
|
||||
+ debugOption \
|
||||
+ "-keystore " + lutinTools.GetCurrentPath(__file__) + "/AndroidDebugKey.jks " \
|
||||
+ self.GetStagingFolder(pkgName) + "/build/" + pkgName + "-unalligned.apk " \
|
||||
+ "-keystore " + lutinTools.get_current_path(__file__) + "/AndroidDebugKey.jks " \
|
||||
+ self.get_staging_folder(pkgName) + "/build/" + pkgName + "-unalligned.apk " \
|
||||
+ " alias__AndroidDebugKey " \
|
||||
+ " < tmpPass.boo"
|
||||
lutinMultiprocess.RunCommand(cmdLine)
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
print("")
|
||||
else:
|
||||
# keytool is situated in $(JAVA_HOME)/bin ...
|
||||
@ -531,7 +531,7 @@ class Target(lutinTarget.Target):
|
||||
|
||||
# Question poser a ce moment, les automatiser ...
|
||||
# Quels sont vos prenom et nom ?
|
||||
# EdoGetRunFolderuard DUPIN
|
||||
# Edoget_run_folderuard DUPIN
|
||||
# [Unknown] : Quel est le nom de votre unite organisationnelle ?
|
||||
# org
|
||||
# [Unknown] : Quelle est le nom de votre organisation ?
|
||||
@ -557,28 +557,28 @@ class Target(lutinTarget.Target):
|
||||
# alias_$(PROJECT_NAME2)
|
||||
debug.warning("TODO ...")
|
||||
|
||||
debug.printElement("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
|
||||
lutinTools.RemoveFile(self.GetStagingFolder(pkgName) + "/" + pkgName + ".apk")
|
||||
debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
|
||||
lutinTools.remove_file(self.get_staging_folder(pkgName) + "/" + pkgName + ".apk")
|
||||
# verbose mode : -v
|
||||
cmdLine = self.folder_sdk + "/tools/zipalign 4 " \
|
||||
+ self.GetStagingFolder(pkgName) + "/build/" + pkgName + "-unalligned.apk " \
|
||||
+ self.GetStagingFolder(pkgName) + "/" + pkgName + ".apk "
|
||||
lutinMultiprocess.RunCommand(cmdLine)
|
||||
+ self.get_staging_folder(pkgName) + "/build/" + pkgName + "-unalligned.apk " \
|
||||
+ self.get_staging_folder(pkgName) + "/" + pkgName + ".apk "
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
# copy file in the final stage :
|
||||
lutinTools.CopyFile(self.GetStagingFolder(pkgName) + "/" + pkgName + ".apk",
|
||||
self.GetFinalFolder() + "/" + pkgName + ".apk",
|
||||
lutinTools.copy_file(self.get_staging_folder(pkgName) + "/" + pkgName + ".apk",
|
||||
self.get_final_folder() + "/" + pkgName + ".apk",
|
||||
True)
|
||||
|
||||
def InstallPackage(self, pkgName):
|
||||
def install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
cmdLine = self.folder_sdk + "/platform-tools/adb install -r " \
|
||||
+ self.GetStagingFolder(pkgName) + "/" + pkgName + ".apk "
|
||||
lutinMultiprocess.RunCommand(cmdLine)
|
||||
+ self.get_staging_folder(pkgName) + "/" + pkgName + ".apk "
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
def UnInstallPackage(self, pkgName):
|
||||
def un_install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Un-Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
@ -590,6 +590,6 @@ class Target(lutinTarget.Target):
|
||||
debug.info("logcat of android board")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
cmdLine = self.folder_sdk + "/platform-tools/adb shell logcat "
|
||||
lutinMultiprocess.RunCommand(cmdLine)
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ class Target(lutinTarget.Target):
|
||||
def __init__(self, typeCompilator, debugMode, generatePackage):
|
||||
lutinTarget.Target.__init__(self, "Linux", typeCompilator, debugMode, generatePackage, "", "")
|
||||
|
||||
def generateListSeparateComa(self, list):
|
||||
def generate_list_separate_coma(self, list):
|
||||
result = ""
|
||||
fistTime = True
|
||||
for elem in list:
|
||||
@ -21,27 +21,27 @@ class Target(lutinTarget.Target):
|
||||
result += elem
|
||||
return result
|
||||
|
||||
def MakePackage(self, pkgName, pkgProperties, basePkgPath):
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkgName + "' v"+pkgProperties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
self.GetStagingFolder(pkgName)
|
||||
targetOutFolderDebian=self.GetStagingFolder(pkgName) + "/DEBIAN/"
|
||||
self.get_staging_folder(pkgName)
|
||||
targetOutFolderDebian=self.get_staging_folder(pkgName) + "/DEBIAN/"
|
||||
finalFileControl = targetOutFolderDebian + "control"
|
||||
finalFilepostRm = targetOutFolderDebian + "postrm"
|
||||
# create the folders :
|
||||
lutinTools.CreateDirectoryOfFile(finalFileControl)
|
||||
lutinTools.CreateDirectoryOfFile(finalFilepostRm)
|
||||
lutinTools.create_directory_of_file(finalFileControl)
|
||||
lutinTools.create_directory_of_file(finalFilepostRm)
|
||||
## Create the control file
|
||||
tmpFile = open(finalFileControl, 'w')
|
||||
tmpFile.write("Package: " + pkgName + "\n")
|
||||
tmpFile.write("Version: " + pkgProperties["VERSION"] + "\n")
|
||||
tmpFile.write("Section: " + self.generateListSeparateComa(pkgProperties["SECTION"]) + "\n")
|
||||
tmpFile.write("Section: " + self.generate_list_separate_coma(pkgProperties["SECTION"]) + "\n")
|
||||
tmpFile.write("Priority: " + pkgProperties["PRIORITY"] + "\n")
|
||||
tmpFile.write("Architecture: all\n")
|
||||
tmpFile.write("Depends: bash\n")
|
||||
tmpFile.write("Maintainer: " + self.generateListSeparateComa(pkgProperties["MAINTAINER"]) + "\n")
|
||||
tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkgProperties["MAINTAINER"]) + "\n")
|
||||
tmpFile.write("Description: " + pkgProperties["DESCRIPTION"] + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
@ -59,13 +59,13 @@ class Target(lutinTarget.Target):
|
||||
## Enable Execution in script
|
||||
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
|
||||
## Readme donumentation
|
||||
readmeFileDest = self.GetStagingFolder(pkgName) + "/usr/share/doc/"+ pkgName + "/README"
|
||||
readmeFileDest = self.get_staging_folder(pkgName) + "/usr/share/doc/"+ pkgName + "/README"
|
||||
if os.path.exists(basePkgPath + "/os-Linux/README")==True:
|
||||
lutinTools.CopyFile(basePkgPath + "/os-Linux/README", readmeFileDest)
|
||||
lutinTools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest)
|
||||
elif os.path.exists(basePkgPath + "/README")==True:
|
||||
lutinTools.CopyFile(basePkgPath + "/README", readmeFileDest)
|
||||
lutinTools.copy_file(basePkgPath + "/README", readmeFileDest)
|
||||
elif os.path.exists(basePkgPath + "/README.md")==True:
|
||||
lutinTools.CopyFile(basePkgPath + "/README.md", readmeFileDest)
|
||||
lutinTools.copy_file(basePkgPath + "/README.md", readmeFileDest)
|
||||
else:
|
||||
debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
|
||||
tmpFile = open(readmeFileDest, 'w')
|
||||
@ -73,9 +73,9 @@ class Target(lutinTarget.Target):
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## licence file
|
||||
licenseFileDest = self.GetStagingFolder(pkgName) + "/usr/share/doc/"+ pkgName + "/copyright"
|
||||
licenseFileDest = self.get_staging_folder(pkgName) + "/usr/share/doc/"+ pkgName + "/copyright"
|
||||
if os.path.exists(basePkgPath + "/license.txt")==True:
|
||||
lutinTools.CopyFile(basePkgPath + "/license.txt", licenseFileDest)
|
||||
lutinTools.copy_file(basePkgPath + "/license.txt", licenseFileDest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(licenseFileDest, 'w')
|
||||
@ -83,26 +83,26 @@ class Target(lutinTarget.Target):
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
##changeLog file
|
||||
changeLogFileDest = self.GetStagingFolder(pkgName) + "/usr/share/doc/"+ pkgName + "/changelog"
|
||||
changeLogFileDest = self.get_staging_folder(pkgName) + "/usr/share/doc/"+ pkgName + "/changelog"
|
||||
if os.path.exists(basePkgPath + "/changelog")==True:
|
||||
lutinTools.CopyFile(basePkgPath + "/changelog", changeLogFileDest)
|
||||
lutinTools.copy_file(basePkgPath + "/changelog", changeLogFileDest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
lutinMultiprocess.RunCommand("git log > " + changeLogFileDest)
|
||||
lutinMultiprocess.run_command("git log > " + changeLogFileDest)
|
||||
## create the package :
|
||||
debug.debug("pachage : " + self.GetStagingFolder(pkgName) + "/" + pkgName + ".deb")
|
||||
os.system("cd " + self.GetStagingFolder("") + " ; dpkg-deb --build " + pkgName)
|
||||
lutinTools.CreateDirectoryOfFile(self.GetFinalFolder())
|
||||
lutinTools.CopyFile(self.GetStagingFolder("") + "/" + pkgName + self.suffix_package, self.GetFinalFolder() + "/" + pkgName + self.suffix_package)
|
||||
debug.debug("pachage : " + self.get_staging_folder(pkgName) + "/" + pkgName + ".deb")
|
||||
os.system("cd " + self.get_staging_folder("") + " ; dpkg-deb --build " + pkgName)
|
||||
lutinTools.create_directory_of_file(self.get_final_folder())
|
||||
lutinTools.copy_file(self.get_staging_folder("") + "/" + pkgName + self.suffix_package, self.get_final_folder() + "/" + pkgName + self.suffix_package)
|
||||
|
||||
def InstallPackage(self, pkgName):
|
||||
def install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
os.system("sudo dpkg -i " + self.GetFinalFolder() + "/" + pkgName + self.suffix_package)
|
||||
os.system("sudo dpkg -i " + self.get_final_folder() + "/" + pkgName + self.suffix_package)
|
||||
|
||||
def UnInstallPackage(self, pkgName):
|
||||
def un_install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Un-Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
os.system("sudo dpkg -r " + self.GetFinalFolder() + "/" + pkgName + self.suffix_package)
|
||||
os.system("sudo dpkg -r " + self.get_final_folder() + "/" + pkgName + self.suffix_package)
|
||||
|
@ -24,18 +24,18 @@ class Target(lutinTarget.Target):
|
||||
self.suffix_package=''
|
||||
|
||||
|
||||
def GetStagingFolder(self, binaryName):
|
||||
return lutinTools.GetRunFolder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/"
|
||||
def get_staging_folder(self, binaryName):
|
||||
return lutinTools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/"
|
||||
|
||||
def GetStagingFolderData(self, binaryName):
|
||||
return self.GetStagingFolder(binaryName) + self.folder_data + "/"
|
||||
def get_staging_folder_data(self, binaryName):
|
||||
return self.get_staging_folder(binaryName) + self.folder_data + "/"
|
||||
|
||||
def MakePackage(self, pkgName, pkgProperties, basePkgPath):
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
# http://www.sandroid.org/imcross/#Deployment
|
||||
infoFile=self.GetStagingFolder(pkgName) + "/Info.plist"
|
||||
infoFile=self.get_staging_folder(pkgName) + "/Info.plist"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
|
||||
@ -55,7 +55,7 @@ class Target(lutinTarget.Target):
|
||||
tmpFile.write("\n\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
infoFile=self.GetStagingFolder(pkgName) + "/PkgInfo"
|
||||
infoFile=self.get_staging_folder(pkgName) + "/PkgInfo"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write("APPL?????")
|
||||
@ -66,14 +66,14 @@ class Target(lutinTarget.Target):
|
||||
#cd $(TARGET_OUT_FINAL)/; tar -cf $(PROJECT_NAME).tar $(PROJECT_NAME).app
|
||||
#cd $(TARGET_OUT_FINAL)/; tar -czf $(PROJECT_NAME).tar.gz $(PROJECT_NAME).app
|
||||
|
||||
def InstallPackage(self, pkgName):
|
||||
def install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.warning(" ==> TODO")
|
||||
#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
|
||||
|
||||
def UnInstallPackage(self, pkgName):
|
||||
def un_install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Un-Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
@ -37,23 +37,23 @@ class Target(lutinTarget.Target):
|
||||
self.suffix_package=''
|
||||
|
||||
|
||||
def GetStagingFolderData(self, binaryName):
|
||||
return self.GetStagingFolder(binaryName) + self.folder_data
|
||||
def get_staging_folder_data(self, binaryName):
|
||||
return self.get_staging_folder(binaryName) + self.folder_data
|
||||
|
||||
def MakePackage(self, pkgName, pkgProperties, basePkgPath):
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.warning(" ==> TODO")
|
||||
|
||||
def InstallPackage(self, pkgName):
|
||||
def install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.warning(" ==> TODO")
|
||||
#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
|
||||
|
||||
def UnInstallPackage(self, pkgName):
|
||||
def un_install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Un-Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
@ -9,16 +9,16 @@ import fnmatch
|
||||
"""
|
||||
|
||||
"""
|
||||
def GetRunFolder():
|
||||
def get_run_folder():
|
||||
return os.getcwd()
|
||||
|
||||
"""
|
||||
|
||||
"""
|
||||
def GetCurrentPath(file):
|
||||
def get_current_path(file):
|
||||
return os.path.dirname(os.path.realpath(file))
|
||||
|
||||
def CreateDirectoryOfFile(file):
|
||||
def create_directory_of_file(file):
|
||||
folder = os.path.dirname(file)
|
||||
try:
|
||||
os.stat(folder)
|
||||
@ -26,22 +26,22 @@ def CreateDirectoryOfFile(file):
|
||||
os.makedirs(folder)
|
||||
|
||||
|
||||
def RemoveFolderAndSubFolder(path):
|
||||
def remove_folder_and_sub_folder(path):
|
||||
if os.path.isdir(path):
|
||||
debug.verbose("remove folder : '" + path + "'")
|
||||
shutil.rmtree(path)
|
||||
|
||||
def RemoveFile(path):
|
||||
def remove_file(path):
|
||||
if os.path.isfile(path):
|
||||
os.remove(path)
|
||||
|
||||
def FileSize(path):
|
||||
def file_size(path):
|
||||
if not os.path.isfile(path):
|
||||
return 0
|
||||
statinfo = os.stat(path)
|
||||
return statinfo.st_size
|
||||
|
||||
def FileReadData(path):
|
||||
def file_read_data(path):
|
||||
if not os.path.isfile(path):
|
||||
return ""
|
||||
file = open(path, "r")
|
||||
@ -49,22 +49,22 @@ def FileReadData(path):
|
||||
file.close()
|
||||
return data_file
|
||||
|
||||
def FileWriteData(path, data):
|
||||
def file_write_data(path, data):
|
||||
file = open(path, "w")
|
||||
file.write(data)
|
||||
file.close()
|
||||
|
||||
def ListToStr(list):
|
||||
def list_to_str(list):
|
||||
if type(list) == type(str()):
|
||||
return list + " "
|
||||
else:
|
||||
result = ""
|
||||
# mulyiple imput in the list ...
|
||||
for elem in list:
|
||||
result += ListToStr(elem)
|
||||
result += list_to_str(elem)
|
||||
return result
|
||||
|
||||
def AddPrefix(prefix,list):
|
||||
def add_prefix(prefix,list):
|
||||
if type(list) == type(None):
|
||||
return ""
|
||||
if type(list) == type(str()):
|
||||
@ -78,19 +78,19 @@ def AddPrefix(prefix,list):
|
||||
result.append(prefix+elem)
|
||||
return result
|
||||
|
||||
def CopyFile(src, dst, force=False):
|
||||
def copy_file(src, dst, force=False):
|
||||
if os.path.exists(src)==False:
|
||||
debug.error("Request a copy a file that does not existed : '" + src + "'")
|
||||
if os.path.exists(dst):
|
||||
if force==False \
|
||||
and os.path.getmtime(dst) > os.path.getmtime(src):
|
||||
return
|
||||
debug.printElement("copy file", src, "==>", dst)
|
||||
CreateDirectoryOfFile(dst)
|
||||
debug.print_element("copy file", src, "==>", dst)
|
||||
create_directory_of_file(dst)
|
||||
shutil.copyfile(src, dst)
|
||||
|
||||
|
||||
def CopyAnything(src, dst):
|
||||
def copy_anything(src, dst):
|
||||
tmpPath = os.path.dirname(os.path.realpath(src))
|
||||
tmpRule = os.path.basename(src)
|
||||
for root, dirnames, filenames in os.walk(tmpPath):
|
||||
@ -101,10 +101,10 @@ def CopyAnything(src, dst):
|
||||
for cycleFile in tmpList:
|
||||
#for cycleFile in filenames:
|
||||
#debug.info("Might copy : '" + tmpPath+cycleFile + "' ==> '" + dst + "'")
|
||||
CopyFile(tmpPath+"/"+cycleFile,dst+"/"+cycleFile)
|
||||
copy_file(tmpPath+"/"+cycleFile,dst+"/"+cycleFile)
|
||||
|
||||
|
||||
def CopyAnythingTarget(target, src, dst):
|
||||
def copy_anything_target(target, src, dst):
|
||||
tmpPath = os.path.dirname(os.path.realpath(src))
|
||||
tmpRule = os.path.basename(src)
|
||||
for root, dirnames, filenames in os.walk(tmpPath):
|
||||
@ -115,4 +115,4 @@ def CopyAnythingTarget(target, src, dst):
|
||||
for cycleFile in tmpList:
|
||||
#for cycleFile in filenames:
|
||||
#debug.info("Might copy : '" + tmpPath+cycleFile + "' ==> '" + dst + "'")
|
||||
target.AddFileStaging(tmpPath+"/"+cycleFile,dst+"/"+cycleFile)
|
||||
target.add_file_staging(tmpPath+"/"+cycleFile,dst+"/"+cycleFile)
|
||||
|
Loading…
x
Reference in New Issue
Block a user