[DOC/DEV] continue documentation and update API ==> end of normalisation
This commit is contained in:
parent
dff87a00ee
commit
2ebe27a5a4
46
bin/lutin
46
bin/lutin
@ -25,32 +25,32 @@ import lutin.host as lutinHost
|
||||
import lutin.tools as lutinTools
|
||||
|
||||
myArgs = arguments.LutinArg()
|
||||
myArgs.add(arguments.ArgDefine("h", "help", desc="Display this help"))
|
||||
myArgs.add(arguments.ArgDefine("H", "HELP", desc="Display this help (with all compleate information)"))
|
||||
myArgs.add("h", "help", desc="Display this help")
|
||||
myArgs.add("H", "HELP", desc="Display this help (with all compleate information)")
|
||||
myArgs.add_section("option", "Can be set one time in all case")
|
||||
myArgs.add(arguments.ArgDefine("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"],["6","extreme_verbose"]], desc="display makefile debug level (verbose) default =2"))
|
||||
myArgs.add(arguments.ArgDefine("C", "color", desc="Display makefile output in color"))
|
||||
myArgs.add(arguments.ArgDefine("B", "force-build", desc="Force the rebuild without checking the dependency"))
|
||||
myArgs.add(arguments.ArgDefine("P", "pretty", desc="Print the debug has pretty display"))
|
||||
myArgs.add(arguments.ArgDefine("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously"))
|
||||
myArgs.add(arguments.ArgDefine("d", "depth", haveParam=True, desc="Depth of the search of sub element lutin_*.py (default=" + str(env.get_parse_depth()) + ")"))
|
||||
myArgs.add(arguments.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements"))
|
||||
myArgs.add(arguments.ArgDefine("o", "force-optimisation", desc="Force optimisation of the build"))
|
||||
myArgs.add(arguments.ArgDefine("w", "warning", desc="Store warning in a file build file"))
|
||||
myArgs.add(arguments.ArgDefine("i", "isolate-system", desc="Isolate system build (copy header of c and c++ system lib to not include unneeded external libs) EXPERIMENTAL (archlinux)"))
|
||||
myArgs.add("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"],["6","extreme_verbose"]], desc="display makefile debug level (verbose) default =2")
|
||||
myArgs.add("C", "color", desc="Display makefile output in color")
|
||||
myArgs.add("B", "force-build", desc="Force the rebuild without checking the dependency")
|
||||
myArgs.add("P", "pretty", desc="Print the debug has pretty display")
|
||||
myArgs.add("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously")
|
||||
myArgs.add("d", "depth", haveParam=True, desc="Depth of the search of sub element lutin_*.py (default=" + str(env.get_parse_depth()) + ")")
|
||||
myArgs.add("s", "force-strip", desc="Force the stripping of the compile elements")
|
||||
myArgs.add("o", "force-optimisation", desc="Force optimisation of the build")
|
||||
myArgs.add("w", "warning", desc="Store warning in a file build file")
|
||||
myArgs.add("i", "isolate-system", desc="Isolate system build (copy header of c and c++ system lib to not include unneeded external libs) EXPERIMENTAL (archlinux)")
|
||||
|
||||
myArgs.add_section("properties", "keep in the sequency of the cible")
|
||||
myArgs.add(arguments.ArgDefine("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'"))
|
||||
myArgs.add(arguments.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
|
||||
myArgs.add(arguments.ArgDefine("", "compilator-version", haveParam=True, desc="With travis we need to specify the name of the version if we want to compile with gcc 4.9 ==> --compilator-version=4.9"))
|
||||
myArgs.add(arguments.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
|
||||
myArgs.add(arguments.ArgDefine("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile"))
|
||||
myArgs.add(arguments.ArgDefine("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)"))
|
||||
myArgs.add(arguments.ArgDefine("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)"))
|
||||
myArgs.add(arguments.ArgDefine("g", "gcov", desc="Enable code coverage intrusion in code"))
|
||||
myArgs.add(arguments.ArgDefine("", "simulation", desc="Simulater mode (availlable only for IOS)"))
|
||||
myArgs.add(arguments.ArgDefine("", "list-target", desc="List all availlables targets ==> for auto completion"))
|
||||
myArgs.add(arguments.ArgDefine("", "list-module", desc="List all availlables module ==> for auto completion"))
|
||||
myArgs.add("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'")
|
||||
myArgs.add("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)")
|
||||
myArgs.add("", "compilator-version", haveParam=True, desc="With travis we need to specify the name of the version if we want to compile with gcc 4.9 ==> --compilator-version=4.9")
|
||||
myArgs.add("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)")
|
||||
myArgs.add("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile")
|
||||
myArgs.add("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)")
|
||||
myArgs.add("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)")
|
||||
myArgs.add("g", "gcov", desc="Enable code coverage intrusion in code")
|
||||
myArgs.add("", "simulation", desc="Simulater mode (availlable only for IOS)")
|
||||
myArgs.add("", "list-target", desc="List all availlables targets ==> for auto completion")
|
||||
myArgs.add("", "list-module", desc="List all availlables module ==> for auto completion")
|
||||
|
||||
myArgs.add_section("cible", "generate in order set")
|
||||
localArgument = myArgs.parse()
|
||||
|
35
doxy_lutin.py
Normal file
35
doxy_lutin.py
Normal file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/python
|
||||
import os
|
||||
import doxy.module as module
|
||||
import doxy.debug as debug
|
||||
import doxy.tools as tools
|
||||
|
||||
def create(target, module_name):
|
||||
my_module = module.Module(__file__, module_name)
|
||||
my_module.set_version([1,2,6])
|
||||
my_module.set_title("lutin: build system and packager")
|
||||
my_module.set_website("http://HeeroYui.github.io/" + module_name)
|
||||
my_module.set_website_sources("http://github.com/HeeroYui/" + module_name)
|
||||
my_module.add_path([
|
||||
module_name,
|
||||
"doc"
|
||||
])
|
||||
my_module.add_exclude_symbols([
|
||||
'_*',
|
||||
'lutinTarget_*',
|
||||
'lutinSystem_*',
|
||||
'lutinBuilder_*',
|
||||
])
|
||||
my_module.add_file_patterns([
|
||||
#'*.py',
|
||||
'builder.py',
|
||||
'debug.py',
|
||||
'env.py',
|
||||
'host.py',
|
||||
'module.py',
|
||||
'system.py',
|
||||
'target.py',
|
||||
'*.md',
|
||||
])
|
||||
|
||||
return my_module
|
164
lutin/arg.py
164
lutin/arg.py
@ -8,30 +8,63 @@
|
||||
## @license APACHE v2.0 (see license file)
|
||||
##
|
||||
import sys
|
||||
# Local import
|
||||
from . import debug
|
||||
|
||||
##
|
||||
## @brief Single argument class. It permit to define the getted argument.
|
||||
##
|
||||
class ArgElement:
|
||||
##
|
||||
## @brief Contructor.
|
||||
## @param[in] self Class handle
|
||||
## @param[in] option (string) Option name (write in fullmode ex: '--verbose' even if user write '-v')
|
||||
## @param[in] value (string) Writed value by the user (defult '')
|
||||
##
|
||||
def __init__(self, option, value=""):
|
||||
self.option = option;
|
||||
self.arg = value;
|
||||
|
||||
##
|
||||
## @brief Get the name of the argument: (write in fullmode ex: '--verbose' even if user write '-v')
|
||||
## @param[in] self Class handle
|
||||
## @return (string) The argument name
|
||||
##
|
||||
def get_option_name(self):
|
||||
return self.option
|
||||
|
||||
##
|
||||
## @brief Get argument data set by the user
|
||||
## @param[in] self Class handle
|
||||
## @return (string) The argument value
|
||||
##
|
||||
def get_arg(self):
|
||||
return self.arg
|
||||
|
||||
##
|
||||
## @brief Display the Argument property
|
||||
## @param[in] self Class handle
|
||||
##
|
||||
def display(self):
|
||||
if len(self.arg)==0:
|
||||
if len(self.arg) == 0:
|
||||
debug.info("option : " + self.option)
|
||||
elif len(self.option)==0:
|
||||
elif len(self.option) == 0:
|
||||
debug.info("element : " + self.arg)
|
||||
else:
|
||||
debug.info("option : " + self.option + ":" + self.arg)
|
||||
|
||||
|
||||
##
|
||||
## @brief Declare a possibility of an argument value
|
||||
##
|
||||
class ArgDefine:
|
||||
##
|
||||
## @brief Contructor.
|
||||
## @param[in] self Class handle
|
||||
## @param[in] smallOption (char) Value for the small option ex: '-v' '-k' ... 1 single char element (no need of '-')
|
||||
## @param[in] bigOption (string) Value of the big option name ex: '--verbose' '--kill' ... stated with -- and with the full name (no need of '--')
|
||||
## @param[in] list ([[string,string],...]) Optionnal list of availlable option: '--mode=debug' ==> [['debug', 'debug mode'],['release', 'release the software']]
|
||||
## @param[in] desc (string) user friendly description with this parameter (default "")
|
||||
## @param[in] haveParam (bool) The option must have a parameter (default False)
|
||||
##
|
||||
def __init__(self,
|
||||
smallOption="", # like v for -v
|
||||
bigOption="", # like verbose for --verbose
|
||||
@ -50,18 +83,46 @@ class ArgDefine:
|
||||
self.have_param = False
|
||||
self.description = desc;
|
||||
|
||||
##
|
||||
## @brief Get the small name of the option ex: '-v'
|
||||
## @param[in] self Class handle
|
||||
## @return (string) Small name value
|
||||
##
|
||||
def get_option_small(self):
|
||||
return self.option_small
|
||||
|
||||
|
||||
##
|
||||
## @brief Get the big name of the option ex: '--verbose'
|
||||
## @param[in] self Class handle
|
||||
## @return (string) Big name value
|
||||
##
|
||||
def get_option_big(self):
|
||||
return self.option_big
|
||||
|
||||
##
|
||||
## @brief Get the status of getting user parameter value
|
||||
## @param[in] self Class handle
|
||||
## @return True The user must write a value
|
||||
## @return False The user must NOT write a value
|
||||
##
|
||||
def need_parameters(self):
|
||||
return self.have_param
|
||||
|
||||
##
|
||||
## @brief Compatibility with @ref ArgSection class
|
||||
## @param[in] self Class handle
|
||||
## @return (string) empty string
|
||||
##
|
||||
def get_porperties(self):
|
||||
return ""
|
||||
|
||||
##
|
||||
## @brief Check if the user added value is correct or not with the list of availlable value
|
||||
## @param[in] self Class handle
|
||||
## @param[in] argument (string) User parameter value (string)
|
||||
## @return True The parameter is OK
|
||||
## @return False The parameter is NOT Availlable
|
||||
##
|
||||
def check_availlable(self, argument):
|
||||
if len(self.list)==0:
|
||||
return True
|
||||
@ -70,6 +131,10 @@ class ArgDefine:
|
||||
return True
|
||||
return False
|
||||
|
||||
##
|
||||
## @brief Display the argument property when user request help
|
||||
## @param[in] self Class handle
|
||||
##
|
||||
def display(self):
|
||||
color = debug.get_color_set()
|
||||
if self.option_small != "" and self.option_big != "":
|
||||
@ -98,46 +163,94 @@ class ArgDefine:
|
||||
tmpElementPrint += " / "
|
||||
tmpElementPrint += val
|
||||
print(" { " + tmpElementPrint + " }")
|
||||
|
||||
def parse(self, argList, currentID):
|
||||
return currentID;
|
||||
|
||||
|
||||
##
|
||||
## @brief Section Class definition (permit to add a comment when requesting help
|
||||
##
|
||||
class ArgSection:
|
||||
##
|
||||
## @brief Constructor
|
||||
## @param[in] self Class handle
|
||||
## @param[in] sectionName (string) Name of the cestion ex: "option" is displayed [option]
|
||||
## @param[in] desc (string) Comment assiciated with the group
|
||||
##
|
||||
def __init__(self,
|
||||
sectionName="",
|
||||
desc=""):
|
||||
self.section = sectionName;
|
||||
self.description = desc;
|
||||
|
||||
##
|
||||
## @brief Compatibility with @ref ArgDefine class
|
||||
## @param[in] self Class handle
|
||||
## @return empty string
|
||||
##
|
||||
def get_option_small(self):
|
||||
return ""
|
||||
|
||||
|
||||
##
|
||||
## @brief Compatibility with @ref ArgDefine class
|
||||
## @param[in] self Class handle
|
||||
## @return empty string
|
||||
##
|
||||
def get_option_big(self):
|
||||
return ""
|
||||
|
||||
|
||||
##
|
||||
## @brief get property print value with the correct writing mode
|
||||
## @param[in] self Class handle
|
||||
## @return String to display in the short line help
|
||||
##
|
||||
def get_porperties(self):
|
||||
color = debug.get_color_set()
|
||||
return " [" + color['blue'] + self.section + color['default'] + "]"
|
||||
|
||||
##
|
||||
## @brief Display the argument property when user request help
|
||||
## @param[in] self Class handle
|
||||
##
|
||||
def display(self):
|
||||
color = debug.get_color_set()
|
||||
print(" [" + color['blue'] + self.section + color['default'] + "] : " + self.description)
|
||||
|
||||
def parse(self, argList, currentID):
|
||||
return currentID;
|
||||
|
||||
|
||||
##
|
||||
## @brief Class to define the agmument list availlable for a program
|
||||
##
|
||||
class LutinArg:
|
||||
##
|
||||
## @brief Constructor.
|
||||
## @param[in] self Class handle
|
||||
##
|
||||
def __init__(self):
|
||||
self.listProperties = []
|
||||
self.list_properties = []
|
||||
|
||||
def add(self, argument):
|
||||
self.listProperties.append(argument) #ArgDefine(smallOption, bigOption, haveParameter, parameterList, description));
|
||||
##
|
||||
## @brief Add a new argument possibilities...
|
||||
## @param[in] self Class handle
|
||||
## @param[in] smallOption (char) Value for the small option ex: '-v' '-k' ... 1 single char element (no need of '-')
|
||||
## @param[in] bigOption (string) Value of the big option name ex: '--verbose' '--kill' ... stated with -- and with the full name (no need of '--')
|
||||
## @param[in] list ([[string,string],...]) Optionnal list of availlable option: '--mode=debug' ==> [['debug', 'debug mode'],['release', 'release the software']]
|
||||
## @param[in] desc (string) user friendly description with this parameter (default "")
|
||||
## @param[in] haveParam (bool) The option must have a parameter (default False)
|
||||
##
|
||||
def add(self, smallOption="", bigOption="", list=[], desc="", haveParam=False):
|
||||
self.list_properties.append(ArgDefine(smallOption, bigOption, list, desc, haveParam))
|
||||
|
||||
##
|
||||
## @brief Add section on argument list
|
||||
## @param[in] self Class handle
|
||||
## @param[in] sectionName (string) Name of the cestion ex: "option" is displayed [option]
|
||||
## @param[in] sectionDesc (string) Comment assiciated with the group
|
||||
##
|
||||
def add_section(self, sectionName, sectionDesc):
|
||||
self.listProperties.append(ArgSection(sectionName, sectionDesc))
|
||||
self.list_properties.append(ArgSection(sectionName, sectionDesc))
|
||||
|
||||
##
|
||||
## @brief Parse the argument set in the command line
|
||||
## @param[in] self Class handle
|
||||
##
|
||||
def parse(self):
|
||||
listArgument = [] # composed of list element
|
||||
NotparseNextElement=False
|
||||
@ -159,7 +272,7 @@ class LutinArg:
|
||||
argumentFound=False;
|
||||
if option[:2]=="--":
|
||||
# big argument
|
||||
for prop in self.listProperties:
|
||||
for prop in self.list_properties:
|
||||
if prop.get_option_big()=="":
|
||||
continue
|
||||
if prop.get_option_big() == option[2:]:
|
||||
@ -201,7 +314,7 @@ class LutinArg:
|
||||
debug.error("UNKNOW argument : '" + argument + "'")
|
||||
elif option[:1]=="-":
|
||||
# small argument
|
||||
for prop in self.listProperties:
|
||||
for prop in self.list_properties:
|
||||
if prop.get_option_small()=="":
|
||||
continue
|
||||
if prop.get_option_small() == option[1:1+len(prop.get_option_small())]:
|
||||
@ -250,13 +363,16 @@ class LutinArg:
|
||||
#exit(0)
|
||||
return listArgument;
|
||||
|
||||
|
||||
|
||||
##
|
||||
## @brief Display help on console output
|
||||
## @param[in] self Class handle
|
||||
##
|
||||
def display(self):
|
||||
print("usage:")
|
||||
listOfPropertiesArg = "";
|
||||
for element in self.listProperties :
|
||||
for element in self.list_properties :
|
||||
listOfPropertiesArg += element.get_porperties()
|
||||
print(" " + sys.argv[0] + listOfPropertiesArg + " ...")
|
||||
for element in self.listProperties :
|
||||
element.display()
|
||||
for element in self.list_properties :
|
||||
element.display()
|
||||
|
||||
|
@ -27,7 +27,10 @@ from . import env
|
||||
builder_list=[]
|
||||
__start_builder_name="Builder_"
|
||||
|
||||
|
||||
##
|
||||
## @brief Import all File that start with env.get_build_system_base_name() + __start_builder_name + XXX and register in the list of Builder
|
||||
## @param[in] path_list ([string,...]) List of file that start with env.get_build_system_base_name() in the running worktree (Parse one time ==> faster)
|
||||
##
|
||||
def import_path(path_list):
|
||||
global builder_list
|
||||
global_base = env.get_build_system_base_name()
|
||||
@ -57,7 +60,10 @@ def import_path(path_list):
|
||||
for elem in builder_list:
|
||||
debug.verbose(" " + str(elem["name"]))
|
||||
|
||||
# we must have call all import before ...
|
||||
|
||||
##
|
||||
## @brief All builder are common (no target or comilator dependency). We need to load all of them when start lutin
|
||||
##
|
||||
def init():
|
||||
global builder_list
|
||||
debug.debug('BUILDER: Initialize all ...')
|
||||
@ -65,6 +71,10 @@ def init():
|
||||
if element["element"] != None:
|
||||
element["element"].init()
|
||||
|
||||
##
|
||||
## @brief Get a builder tool with specifiying the input type (like cpp, S ...)
|
||||
## @param[in] input_type (string) extention file that can be compile
|
||||
##
|
||||
def get_builder(input_type):
|
||||
global builder_list
|
||||
for element in builder_list:
|
||||
@ -75,13 +85,16 @@ def get_builder(input_type):
|
||||
debug.error("Can not find builder for type : '" + str(input_type) + "'")
|
||||
raise ValueError('type error :' + str(input_type))
|
||||
|
||||
|
||||
def get_builder_with_output(input_type):
|
||||
##
|
||||
## @brief Get a builder tool with specifiying the output type (like .exe, .jar ...)
|
||||
## @param[in] input_type (string) extention file that can be generated
|
||||
##
|
||||
def get_builder_with_output(output_type):
|
||||
global builder_list
|
||||
for element in builder_list:
|
||||
if element["element"] != None:
|
||||
if input_type in element["element"].get_output_type():
|
||||
if output_type in element["element"].get_output_type():
|
||||
return element["element"]
|
||||
# we can not find the builder ...
|
||||
debug.error("Can not find builder for type : '" + str(input_type) + "'")
|
||||
raise ValueError('type error :' + str(input_type))
|
||||
debug.error("Can not find builder for type : '" + str(output_type) + "'")
|
||||
raise ValueError('type error :' + str(output_type))
|
||||
|
@ -26,15 +26,33 @@ color_cyan = ""
|
||||
|
||||
debug_lock = threading.Lock()
|
||||
|
||||
##
|
||||
## @brief Set log level of the console log system
|
||||
## @param[in] id (int) Value of the log level:
|
||||
## 0: None
|
||||
## 1: error
|
||||
## 2: warning
|
||||
## 3: info
|
||||
## 4: debug
|
||||
## 5: verbose
|
||||
## 6: extreme_verbose
|
||||
##
|
||||
def set_level(id):
|
||||
global debug_level
|
||||
debug_level = id
|
||||
#print "SetDebug level at " + str(debug_level)
|
||||
|
||||
##
|
||||
## @brief Get the current debug leval
|
||||
## @return The value of the log level. Show: @ref set_level
|
||||
##
|
||||
def get_level():
|
||||
global debug_level
|
||||
return debug_level
|
||||
|
||||
##
|
||||
## @brief Enable color of the console Log system
|
||||
##
|
||||
def enable_color():
|
||||
global debug_color
|
||||
debug_color = True
|
||||
@ -53,6 +71,9 @@ def enable_color():
|
||||
global color_cyan
|
||||
color_cyan = "\033[36m"
|
||||
|
||||
##
|
||||
## @brief Disable color of the console Log system
|
||||
##
|
||||
def disable_color():
|
||||
global debug_color
|
||||
debug_color = True
|
||||
@ -71,6 +92,11 @@ def disable_color():
|
||||
global color_cyan
|
||||
color_cyan = ""
|
||||
|
||||
##
|
||||
## @brief Print a extreme verbose log
|
||||
## @param[in] input (string) Value to print if level is enough
|
||||
## @param[in] force (bool) force display (no check of log level)
|
||||
##
|
||||
def extreme_verbose(input, force=False):
|
||||
global debug_lock
|
||||
global debug_level
|
||||
@ -80,6 +106,11 @@ def extreme_verbose(input, force=False):
|
||||
print(color_blue + input + color_default)
|
||||
debug_lock.release()
|
||||
|
||||
##
|
||||
## @brief Print a verbose log
|
||||
## @param[in] input (string) Value to print if level is enough
|
||||
## @param[in] force (bool) force display (no check of log level)
|
||||
##
|
||||
def verbose(input, force=False):
|
||||
global debug_lock
|
||||
global debug_level
|
||||
@ -89,6 +120,11 @@ def verbose(input, force=False):
|
||||
print(color_blue + input + color_default)
|
||||
debug_lock.release()
|
||||
|
||||
##
|
||||
## @brief Print a debug log
|
||||
## @param[in] input (string) Value to print if level is enough
|
||||
## @param[in] force (bool) force display (no check of log level)
|
||||
##
|
||||
def debug(input, force=False):
|
||||
global debug_lock
|
||||
global debug_level
|
||||
@ -98,6 +134,11 @@ def debug(input, force=False):
|
||||
print(color_green + input + color_default)
|
||||
debug_lock.release()
|
||||
|
||||
##
|
||||
## @brief Print an info log
|
||||
## @param[in] input (string) Value to print if level is enough
|
||||
## @param[in] force (bool) force display (no check of log level)
|
||||
##
|
||||
def info(input, force=False):
|
||||
global debug_lock
|
||||
global debug_level
|
||||
@ -107,6 +148,11 @@ def info(input, force=False):
|
||||
print(input + color_default)
|
||||
debug_lock.release()
|
||||
|
||||
##
|
||||
## @brief Print a warning log
|
||||
## @param[in] input (string) Value to print if level is enough
|
||||
## @param[in] force (bool) force display (no check of log level)
|
||||
##
|
||||
def warning(input, force=False):
|
||||
global debug_lock
|
||||
global debug_level
|
||||
@ -116,6 +162,11 @@ def warning(input, force=False):
|
||||
print(color_purple + "[WARNING] " + input + color_default)
|
||||
debug_lock.release()
|
||||
|
||||
##
|
||||
## @brief Print a todo log
|
||||
## @param[in] input (string) Value to print if level is enough
|
||||
## @param[in] force (bool) force display (no check of log level)
|
||||
##
|
||||
def todo(input, force=False):
|
||||
global debug_lock
|
||||
global debug_level
|
||||
@ -125,6 +176,13 @@ def todo(input, force=False):
|
||||
print(color_purple + "[TODO] " + input + color_default)
|
||||
debug_lock.release()
|
||||
|
||||
##
|
||||
## @brief Print an error log
|
||||
## @param[in] input (string) Value to print if level is enough
|
||||
## @param[in] thread_id (int) Current thead ID of the builder thread
|
||||
## @param[in] force (bool) force display (no check of log level)
|
||||
## @param[in] crash (bool) build error has appear ==> request stop of all builds
|
||||
##
|
||||
def error(input, thread_id=-1, force=False, crash=True):
|
||||
global debug_lock
|
||||
global debug_level
|
||||
@ -142,6 +200,15 @@ def error(input, thread_id=-1, force=False, crash=True):
|
||||
#os_exit(-1)
|
||||
#raise "error happend"
|
||||
|
||||
|
||||
##
|
||||
## @brief Print a log for a specific element action like generateing .so or binary ...
|
||||
## @param[in] type (string) type of action. Like: "copy file", "StaticLib", "Prebuild", "Library" ...
|
||||
## @param[in] lib (string) Name of the library/binary/package that action is done
|
||||
## @param[in] dir (string) build direction. ex: "<==", "==>" ...
|
||||
## @param[in] name (string) Destination of the data
|
||||
## @param[in] force (bool) force display (no check of log level)
|
||||
##
|
||||
def print_element(type, lib, dir, name, force=False):
|
||||
global debug_lock
|
||||
global debug_level
|
||||
@ -151,23 +218,31 @@ def print_element(type, lib, dir, name, force=False):
|
||||
print(color_cyan + type + color_default + " : " + color_yellow + lib + color_default + " " + dir + " " + color_blue + name + color_default)
|
||||
debug_lock.release()
|
||||
|
||||
def print_compilator(myString):
|
||||
##
|
||||
## @brief Print a compilation return (output)
|
||||
## @param[in] my_string (string) Std-error/std-info that is generate by the build system
|
||||
##
|
||||
def print_compilator(my_string):
|
||||
global debug_color
|
||||
global debug_lock
|
||||
if debug_color == True:
|
||||
myString = myString.replace('\\n', '\n')
|
||||
myString = myString.replace('\\t', '\t')
|
||||
myString = myString.replace('error:', color_red+'error:'+color_default)
|
||||
myString = myString.replace('warning:', color_purple+'warning:'+color_default)
|
||||
myString = myString.replace('note:', color_green+'note:'+color_default)
|
||||
myString = re.sub(r'([/\w_-]+\.\w+):', r'-COLORIN-\1-COLOROUT-:', myString)
|
||||
myString = myString.replace('-COLORIN-', color_yellow)
|
||||
myString = myString.replace('-COLOROUT-', color_default)
|
||||
my_string = my_string.replace('\\n', '\n')
|
||||
my_string = my_string.replace('\\t', '\t')
|
||||
my_string = my_string.replace('error:', color_red+'error:'+color_default)
|
||||
my_string = my_string.replace('warning:', color_purple+'warning:'+color_default)
|
||||
my_string = my_string.replace('note:', color_green+'note:'+color_default)
|
||||
my_string = re.sub(r'([/\w_-]+\.\w+):', r'-COLORIN-\1-COLOROUT-:', my_string)
|
||||
my_string = my_string.replace('-COLORIN-', color_yellow)
|
||||
my_string = my_string.replace('-COLOROUT-', color_default)
|
||||
|
||||
debug_lock.acquire()
|
||||
print(myString)
|
||||
print(my_string)
|
||||
debug_lock.release()
|
||||
|
||||
##
|
||||
## @brief Get the list of default color
|
||||
## @return A map with keys: "default","red","green","yellow","blue","purple","cyan"
|
||||
##
|
||||
def get_color_set() :
|
||||
global color_default
|
||||
global color_red
|
||||
|
@ -41,6 +41,11 @@ def _file_read_data(path, binary=False):
|
||||
file.close()
|
||||
return data_file
|
||||
|
||||
##
|
||||
## @brief Creata a dependency file with a list of files
|
||||
## @param[in] depend_file (string) filename to store a dependency data
|
||||
## @param[in] list_files ([string,...]) List of file that depend the current element
|
||||
##
|
||||
def create_dependency_file(depend_file, list_files):
|
||||
data = ""
|
||||
for elem in list_files:
|
||||
@ -48,6 +53,16 @@ def create_dependency_file(depend_file, list_files):
|
||||
_create_directory_of_file(depend_file)
|
||||
_file_write_data(depend_file, data)
|
||||
|
||||
##
|
||||
## @brief Check if all dependency of a file and dependency file is correct or not
|
||||
## @param[in] dst (string) File that will be generated
|
||||
## @param[in] src (string) Source File needed to generate the 'dst'
|
||||
## @param[in] depend_file (string) Dependency file that contain all file that the src depending
|
||||
## @param[in] file_cmd (string) Filename of where is store the cmdline to generate the 'dst'
|
||||
## @param[in] cmd_line (string) Command line that will be use to generate the 'dst'
|
||||
## @param[in] force_identical (string) for copy file this check if the src and dst are identical
|
||||
## @return (bool) True: something change ==> need to rebuild, False otherwise
|
||||
##
|
||||
def need_re_build(dst, src, depend_file=None, file_cmd="", cmd_line="", force_identical=False):
|
||||
debug.extreme_verbose("Request check of dependency of :")
|
||||
debug.extreme_verbose(" dst='" + str(dst) + "'")
|
||||
@ -142,7 +157,7 @@ def need_re_build(dst, src, depend_file=None, file_cmd="", cmd_line="", force_id
|
||||
file.close()
|
||||
# check the 2 files are identical:
|
||||
if force_identical == True:
|
||||
# check if the 2 cmd_line are similar :
|
||||
# check if the 2 cmd_line are similar:
|
||||
size_src = _file_size(src)
|
||||
size_dst = _file_size(dst)
|
||||
if size_src != size_dst:
|
||||
@ -157,8 +172,15 @@ def need_re_build(dst, src, depend_file=None, file_cmd="", cmd_line="", force_id
|
||||
debug.extreme_verbose(" ==> Not rebuild (all dependency is OK)")
|
||||
return False
|
||||
|
||||
|
||||
|
||||
##
|
||||
## @brief
|
||||
## @param[in] dst (string) File that will be generated
|
||||
## @param[in] src_list ([string,...]) Source file list needed to generate the 'dst'
|
||||
## @param[in] must_have_src (bool) All sources must be present
|
||||
## @param[in] file_cmd (string) Filename of where is store the cmdline to generate the 'dst'
|
||||
## @param[in] cmd_line (string) Command line that will be use to generate the 'dst'
|
||||
## @return (bool) True: Need to regenerate the package, False otherwise
|
||||
##
|
||||
def need_re_package(dst, src_list, must_have_src, file_cmd="", cmd_line=""):
|
||||
debug.extreme_verbose("Request check of dependency of :")
|
||||
debug.extreme_verbose(" dst='" + str(dst) + "'")
|
||||
|
@ -151,6 +151,11 @@ class HeritageList:
|
||||
self.path[ppp].append(iii)
|
||||
debug.extreme_verbose("Path : " + str(self.path))
|
||||
|
||||
##
|
||||
## @brief Generate a string representing the class (for str(xxx))
|
||||
## @param[in] self (handle) Class handle
|
||||
## @return (string) string of str() convertion
|
||||
##
|
||||
def __repr__(self):
|
||||
return "{HeritageList:" + str(self.list_heritage) + "}"
|
||||
|
||||
@ -169,19 +174,19 @@ class heritage:
|
||||
self.path = {}
|
||||
self.include = ""
|
||||
# update is set at true when data are newly created ==> force upper element to update
|
||||
self.hasBeenUpdated=False
|
||||
self.has_been_updated=False
|
||||
|
||||
if type(module) != type(None):
|
||||
# all the parameter that the upper classe need when build
|
||||
self.name = module.name
|
||||
self.depends = copy.deepcopy(module.depends)
|
||||
self.name = module.get_name()
|
||||
self.depends = copy.deepcopy(module.get_depends())
|
||||
# keep reference because the flags can change in time
|
||||
self.flags = module.flags["export"] # have no deep copy here is a feature ...
|
||||
self.path = copy.deepcopy(module.path["export"])
|
||||
self.flags = module._flags["export"] # have no deep copy here is a feature ...
|
||||
self.path = copy.deepcopy(module._path["export"])
|
||||
# if the user install some header ==> they will ba autoamaticaly exported ...
|
||||
if target != None:
|
||||
if len(module.header) > 0:
|
||||
self.include = target.get_build_path_include(module.name)
|
||||
if len(module._header) > 0:
|
||||
self.include = target.get_build_path_include(module.get_name())
|
||||
|
||||
def add_depends(self, elements):
|
||||
self.depends.append(elements)
|
||||
@ -218,14 +223,14 @@ class heritage:
|
||||
self.path['c'].append(self.include)
|
||||
|
||||
def need_update(self, list):
|
||||
self.hasBeenUpdated=True
|
||||
self.has_been_updated=True
|
||||
|
||||
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
|
||||
if other.has_been_updated == True:
|
||||
self.has_been_updated = True
|
||||
for flags in other.flags:
|
||||
value = other.flags[flags]
|
||||
if flags not in self.flags:
|
||||
@ -247,6 +252,11 @@ class heritage:
|
||||
ver = self.flags["c++-version"]
|
||||
self.flags["c++-version"] = ver
|
||||
|
||||
##
|
||||
## @brief Generate a string representing the class (for str(xxx))
|
||||
## @param[in] self (handle) Class handle
|
||||
## @return (string) string of str() convertion
|
||||
##
|
||||
def __repr__(self):
|
||||
return "{Heritage:" + str(self.name) + " ... }"
|
||||
|
||||
|
@ -25,12 +25,25 @@ except:
|
||||
enable_resize_image = False
|
||||
debug.warning("Missing python tools : CoreGraphics (MacOs) or PIL")
|
||||
|
||||
##
|
||||
## @brief Generate the upper pow 2 of the size in parameter
|
||||
## @param[in] size (int) Size that might heve the upper pow(2)
|
||||
## @return the new size in pow(2)
|
||||
##
|
||||
def get_pow_2_multiple(size):
|
||||
base = 2
|
||||
while size>base:
|
||||
base = base * 2
|
||||
return base
|
||||
|
||||
##
|
||||
## @brief Resize an image
|
||||
## @param[in] src_file (string) Path of the source image file
|
||||
## @param[in] dest_file (string) Path out the destination image file
|
||||
## @param[in] x (int) Width of the image
|
||||
## @param[in] y (int) Height of the image
|
||||
## @param[in] cmd_file (string) Filename of where is store the cmdline to generate the 'dst'
|
||||
##
|
||||
# TODO : 3 things to do :
|
||||
# check if force requested
|
||||
# check if time change
|
||||
|
982
lutin/module.py
982
lutin/module.py
File diff suppressed because it is too large
Load Diff
@ -18,7 +18,9 @@ from . import debug
|
||||
from . import module
|
||||
from . import tools
|
||||
from . import env
|
||||
|
||||
##
|
||||
## @brief System class represent the pre-build Module that are already install and accessible in the system environment
|
||||
##
|
||||
class System:
|
||||
def __init__(self):
|
||||
self.valid=False;
|
||||
@ -59,6 +61,11 @@ class System:
|
||||
"clip":clip_path,
|
||||
"recursive":recursive
|
||||
})
|
||||
##
|
||||
## @brief Generate a string representing the class (for str(xxx))
|
||||
## @param[in] self (handle) Class handle
|
||||
## @return (string) string of str() convertion
|
||||
##
|
||||
def __repr__(self):
|
||||
return "{lutin.System}"
|
||||
|
||||
@ -75,7 +82,7 @@ def create_module_from_system(target, dict):
|
||||
# add exporting sources
|
||||
myModule.add_src_file(dict["system"].export_src)
|
||||
# add export path
|
||||
myModule.add_export_path(dict["system"].export_path)
|
||||
myModule.add_path(dict["system"].export_path, export=True)
|
||||
# Export all actions ...
|
||||
for elem in dict["system"].action_on_state:
|
||||
level, name, action = dict["system"].action_on_state[elem]
|
||||
@ -98,6 +105,10 @@ def create_module_from_system(target, dict):
|
||||
system_list={}
|
||||
__start_system_name="System_"
|
||||
|
||||
##
|
||||
## @brief Import all File that start with env.get_build_system_base_name() + __start_system_name + XXX and register in the list of System
|
||||
## @param[in] path_list ([string,...]) List of file that start with env.get_build_system_base_name() in the running worktree (Parse one time ==> faster)
|
||||
##
|
||||
def import_path(path_list):
|
||||
global system_list
|
||||
global_base = env.get_build_system_base_name()
|
||||
@ -138,7 +149,9 @@ def import_path(path_list):
|
||||
for val in system_list[elem]:
|
||||
debug.verbose(" " + str(val["name"]))
|
||||
|
||||
|
||||
##
|
||||
## @brief Display all the system binary that can be used
|
||||
##
|
||||
def display():
|
||||
global system_list
|
||||
for elementName in system_list:
|
||||
@ -146,6 +159,13 @@ def display():
|
||||
for data in system_list[elementName]:
|
||||
debug.info("SYSTEM: '" + data["name"] +"' in " + data["path"])
|
||||
|
||||
##
|
||||
## @brief Check if a library is availlable for a specific target
|
||||
## @param[in] lib_name (string) Name of the Library
|
||||
## @param[in] target_name (string) Name of the target
|
||||
## @param[in] target (handle) Handle on the @ref Target build engine
|
||||
## @return
|
||||
##
|
||||
def exist(lib_name, target_name, target) :
|
||||
global system_list
|
||||
debug.verbose("exist= " + lib_name + " in " + target_name)
|
||||
|
@ -21,7 +21,9 @@ from . import module
|
||||
from . import system
|
||||
from . import multiprocess
|
||||
from . import env
|
||||
|
||||
##
|
||||
## @brief Target class represent the buyild environement for a specific platform like Linux, or Android ....
|
||||
##
|
||||
class Target:
|
||||
def __init__(self, name, config, arch):
|
||||
self.config = config
|
||||
@ -170,6 +172,11 @@ class Target:
|
||||
# special case for IOS (example) no build dynamicly ...
|
||||
self.support_dynamic_link = True
|
||||
|
||||
##
|
||||
## @brief Generate a string representing the class (for str(xxx))
|
||||
## @param[in] self (handle) Class handle
|
||||
## @return (string) string of str() convertion
|
||||
##
|
||||
def __repr__(self):
|
||||
return "{lutin.Target}"
|
||||
|
||||
@ -434,12 +441,12 @@ class Target:
|
||||
return False
|
||||
|
||||
def add_module(self, newModule):
|
||||
debug.debug("Add nodule for Taget : " + newModule.name)
|
||||
debug.debug("Add nodule for Taget : " + newModule.get_name())
|
||||
self.module_list.append(newModule)
|
||||
|
||||
def get_module(self, name):
|
||||
for mod in self.module_list:
|
||||
if mod.name == name:
|
||||
if mod.get_name() == name:
|
||||
return mod
|
||||
debug.error("the module '" + str(name) + "'does not exist/already build")
|
||||
return None
|
||||
@ -455,21 +462,21 @@ class Target:
|
||||
|
||||
def build_tree(self, name, packagesName):
|
||||
for mod in self.module_list:
|
||||
if mod.name == name:
|
||||
if mod.get_name() == name:
|
||||
mod.build_tree(self, packagesName)
|
||||
return
|
||||
debug.error("request to build tree on un-existant module name : '" + name + "'")
|
||||
|
||||
def clean(self, name):
|
||||
for mod in self.module_list:
|
||||
if mod.name == name:
|
||||
if mod.get_name() == name:
|
||||
mod.clean(self)
|
||||
return
|
||||
debug.error("request to clean an un-existant module name : '" + name + "'")
|
||||
|
||||
def load_if_needed(self, name, optionnal=False):
|
||||
for elem in self.module_list:
|
||||
if elem.name == name:
|
||||
if elem.get_name() == name:
|
||||
return True
|
||||
# try to find in the local Modules:
|
||||
exist = module.exist(self, name)
|
||||
@ -491,7 +498,7 @@ class Target:
|
||||
|
||||
def project_add_module(self, name, projectMng, addedModule):
|
||||
for mod in self.module_list:
|
||||
if mod.name == name:
|
||||
if mod.get_name() == name:
|
||||
mod.ext_project_add_module(self, projectMng, addedModule)
|
||||
return
|
||||
|
||||
@ -578,7 +585,8 @@ class Target:
|
||||
ret = [heritage.HeritageList(), False]
|
||||
else:
|
||||
for mod in self.module_list:
|
||||
if mod.name == module_name:
|
||||
debug.verbose("compare " + mod.get_name() + " == " + module_name)
|
||||
if mod.get_name() == module_name:
|
||||
if action_name[:4] == "dump":
|
||||
debug.info("dump module '" + module_name + "'")
|
||||
if len(action_name) > 4:
|
||||
@ -863,7 +871,10 @@ class Target:
|
||||
target_list=[]
|
||||
__start_target_name="Target_"
|
||||
|
||||
|
||||
##
|
||||
## @brief Import all File that start with env.get_build_system_base_name() + __start_target_name + XXX and register in the list of Target
|
||||
## @param[in] path_list ([string,...]) List of file that start with env.get_build_system_base_name() in the running worktree (Parse one time ==> faster)
|
||||
##
|
||||
def import_path(path_list):
|
||||
global target_list
|
||||
global_base = env.get_build_system_base_name()
|
||||
@ -888,6 +899,9 @@ def import_path(path_list):
|
||||
for elem in target_list:
|
||||
debug.verbose(" " + str(elem[0]))
|
||||
|
||||
##
|
||||
## @brief
|
||||
##
|
||||
def load_target(name, config):
|
||||
global target_list
|
||||
debug.debug("load target: " + name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user