[DEV] integrate the version in the get version in file
This commit is contained in:
parent
e1e896fcc1
commit
6440dc6309
@ -1443,7 +1443,7 @@ def load_module(target, name):
|
|||||||
the_module_file = mod[1]
|
the_module_file = mod[1]
|
||||||
the_module = __import__(env.get_build_system_base_name() + __start_module_name + name)
|
the_module = __import__(env.get_build_system_base_name() + __start_module_name + name)
|
||||||
# get basic module properties:
|
# get basic module properties:
|
||||||
property = get_module_option(the_module, name)
|
property = get_module_option(os.path.dirname(mod[1]), the_module, name)
|
||||||
# configure the module:
|
# configure the module:
|
||||||
if "create" in dir(the_module):
|
if "create" in dir(the_module):
|
||||||
tmp_element = the_module.create(target, name)
|
tmp_element = the_module.create(target, name)
|
||||||
@ -1509,17 +1509,18 @@ def list_all_module_with_desc():
|
|||||||
for mod in __module_list:
|
for mod in __module_list:
|
||||||
sys.path.append(os.path.dirname(mod[1]))
|
sys.path.append(os.path.dirname(mod[1]))
|
||||||
the_module = __import__(env.get_build_system_base_name() + __start_module_name + mod[0])
|
the_module = __import__(env.get_build_system_base_name() + __start_module_name + mod[0])
|
||||||
tmpList.append(get_module_option(the_module, mod[0]))
|
tmpList.append(get_module_option(os.path.dirname(mod[1]), the_module, mod[0]))
|
||||||
return tmpList
|
return tmpList
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Get a specific module options
|
## @brief Get a specific module options
|
||||||
|
## @param[in] path (string) Pathof the module
|
||||||
## @param[in] the_module (handle) @ref Module handle
|
## @param[in] the_module (handle) @ref Module handle
|
||||||
## @param[in] name (string) Name of the module
|
## @param[in] name (string) Name of the module
|
||||||
## @return a Map with the keys: "name", "description", "type", "sub-type", "license", "compagny-type", "compagny-name", "maintainer", "version", "version-id"
|
## @return a Map with the keys: "name", "description", "type", "sub-type", "license", "compagny-type", "compagny-name", "maintainer", "version", "version-id"
|
||||||
##
|
##
|
||||||
def get_module_option(the_module, name):
|
def get_module_option(path, the_module, name):
|
||||||
type = None
|
type = None
|
||||||
sub_type = None
|
sub_type = None
|
||||||
description = None
|
description = None
|
||||||
@ -1564,10 +1565,10 @@ def get_module_option(the_module, name):
|
|||||||
compagny_name = the_module.get_compagny_name()
|
compagny_name = the_module.get_compagny_name()
|
||||||
|
|
||||||
if "get_maintainer" in list_of_function_in_factory:
|
if "get_maintainer" in list_of_function_in_factory:
|
||||||
maintainer = the_module.get_maintainer()
|
maintainer = tools.get_maintainer_from_file_or_direct(path, the_module.get_maintainer())
|
||||||
|
|
||||||
if "get_version" in list_of_function_in_factory:
|
if "get_version" in list_of_function_in_factory:
|
||||||
version = the_module.get_version()
|
version = tools.get_version_from_file_or_direct(path, the_module.get_version())
|
||||||
|
|
||||||
if "get_version_id" in list_of_function_in_factory:
|
if "get_version_id" in list_of_function_in_factory:
|
||||||
version_id = the_module.get_version_id()
|
version_id = the_module.get_version_id()
|
||||||
|
@ -349,3 +349,65 @@ def list_append_to_2(listout, module, list, order=False):
|
|||||||
listout[module] = []
|
listout[module] = []
|
||||||
# add elements...
|
# add elements...
|
||||||
list_append_to(listout[module], list, order)
|
list_append_to(listout[module], list, order)
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief The vertion number can be set in an external file to permit to have a singe position to change when create a vew version
|
||||||
|
## @param[in] path_module (string) Path of the module position
|
||||||
|
## @param[in] filename_or_version (string or list) Path of the version or the real version lint parameter
|
||||||
|
## @return (list) List of version number
|
||||||
|
##
|
||||||
|
def get_version_from_file_or_direct(path_module, filename_or_version):
|
||||||
|
# check case of iser set the version directly
|
||||||
|
if type(filename_or_version) == list:
|
||||||
|
return filename_or_version
|
||||||
|
# this use a version file
|
||||||
|
file_data = file_read_data(os.path.join(path_module, filename_or_version))
|
||||||
|
if len(file_data) == 0:
|
||||||
|
debug.warning("not enought data in the file version size=0 " + path_module + " / " + filename_or_version)
|
||||||
|
return [0,0,0]
|
||||||
|
lines = file_data.split("\n")
|
||||||
|
if len(lines) != 1:
|
||||||
|
debug.warning("More thatn one line in the file version ==> bas case use mode: 'XX', XX.YYY', 'XX.Y.ZZZ' or 'XX.Y-dev' : " + path_module + " / " + filename_or_version)
|
||||||
|
return [0,0,0]
|
||||||
|
line = lines[0]
|
||||||
|
debug.debug("Parse line: '" + line + "'")
|
||||||
|
#check if we have "-dev"
|
||||||
|
dev_mode = False
|
||||||
|
if line[-4:] == "-dev":
|
||||||
|
dev_mode = True
|
||||||
|
line = line[:-4]
|
||||||
|
out = []
|
||||||
|
list_elem = line.split('.')
|
||||||
|
for elem in list_elem:
|
||||||
|
out.append(int(elem))
|
||||||
|
if dev_mode == True:
|
||||||
|
out.append("dev")
|
||||||
|
debug.debug(" ==> " + str(out))
|
||||||
|
return out
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get the list of the authors frim an input list or a file
|
||||||
|
## @param[in] path_module (string) Path of the module position
|
||||||
|
## @param[in] filename_or_version (string or list) Path of the author file or the real list of authors
|
||||||
|
## @return (list) List of authors
|
||||||
|
##
|
||||||
|
def get_maintainer_from_file_or_direct(path_module, filename_or_author):
|
||||||
|
# check case of iser set the version directly
|
||||||
|
if type(filename_or_author) == list:
|
||||||
|
return filename_or_author
|
||||||
|
# this use a version file
|
||||||
|
file_data = file_read_data(os.path.join(path_module, filename_or_author))
|
||||||
|
if len(file_data) == 0:
|
||||||
|
debug.warning("not enought data in the file author size=0 " + path_module + " / " + filename_or_author)
|
||||||
|
return []
|
||||||
|
# One user by line and # for comment line
|
||||||
|
out = []
|
||||||
|
for elem in file_data.split('\n'):
|
||||||
|
if len(elem) == 0:
|
||||||
|
continue
|
||||||
|
if elem[0] == "#":
|
||||||
|
# comment ...
|
||||||
|
continue
|
||||||
|
out.append(elem)
|
||||||
|
return out
|
Loading…
x
Reference in New Issue
Block a user