[DEV] update build to support configure instead of create in module ==> permit to get back the version ... order issue
This commit is contained in:
parent
fb4b03a441
commit
b6a5f7e539
@ -82,11 +82,12 @@ def get_version():
|
|||||||
|
|
||||||
# create the module
|
# create the module
|
||||||
# @param[in] target reference on the Target that is currently build
|
# @param[in] target reference on the Target that is currently build
|
||||||
# @param[in] module_name Name of the module that is extract from the file name (to be generic)
|
# @param[in] my_module Module handle that migh be configured
|
||||||
def create(target, module_name):
|
# @return True The module is welled configure
|
||||||
my_module = module.Module(__file__, module_name, get_type())
|
# @return False The module is Not availlable (for this target or ...)
|
||||||
|
def configure(target, my_module):
|
||||||
...
|
...
|
||||||
return my_module
|
return True
|
||||||
```
|
```
|
||||||
|
|
||||||
Thes it is simple to specify build for:
|
Thes it is simple to specify build for:
|
||||||
@ -164,7 +165,7 @@ Add file to compile: {#lutin_module_int
|
|||||||
This is simple: (you just need to specify all the file to compile)
|
This is simple: (you just need to specify all the file to compile)
|
||||||
|
|
||||||
```{.py}
|
```{.py}
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
...
|
...
|
||||||
|
|
||||||
# add the file to compile:
|
# add the file to compile:
|
||||||
@ -187,7 +188,7 @@ This permit to check error inclusion directly in developpement and separate the
|
|||||||
|
|
||||||
Add file to external include:
|
Add file to external include:
|
||||||
```{.py}
|
```{.py}
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
...
|
...
|
||||||
|
|
||||||
my_module.add_header_file([
|
my_module.add_header_file([
|
||||||
@ -200,7 +201,7 @@ def create(target, module_name):
|
|||||||
|
|
||||||
You can add a path to your local include:
|
You can add a path to your local include:
|
||||||
```{.py}
|
```{.py}
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
...
|
...
|
||||||
|
|
||||||
my_module.add_path(os.path.join(tools.get_current_path(__file__), "lib-name"))
|
my_module.add_path(os.path.join(tools.get_current_path(__file__), "lib-name"))
|
||||||
@ -214,7 +215,7 @@ Add Sub-dependency: {#lutin_module_int
|
|||||||
|
|
||||||
All library need to add at minimum of a simple library (C lib) and other if needed. To do it jus call:
|
All library need to add at minimum of a simple library (C lib) and other if needed. To do it jus call:
|
||||||
```{.py}
|
```{.py}
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
...
|
...
|
||||||
|
|
||||||
# add dependency of the generic C library:
|
# add dependency of the generic C library:
|
||||||
@ -231,7 +232,7 @@ def create(target, module_name):
|
|||||||
|
|
||||||
The system can have optinnal sub-library, then if you just want to add an optionnal dependency:
|
The system can have optinnal sub-library, then if you just want to add an optionnal dependency:
|
||||||
```{.py}
|
```{.py}
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
...
|
...
|
||||||
|
|
||||||
# Add an optionnal dependency (set flag in CPP build if the subLib exist) ==> flag is locally set
|
# Add an optionnal dependency (set flag in CPP build if the subLib exist) ==> flag is locally set
|
||||||
@ -248,7 +249,7 @@ Compilation adn link flags/libs: {#lutin_module_int
|
|||||||
|
|
||||||
It is possible to define local and external flags (external are set internal too):
|
It is possible to define local and external flags (external are set internal too):
|
||||||
```{.py}
|
```{.py}
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
...
|
...
|
||||||
# external flags:
|
# external flags:
|
||||||
my_module.add_flag('link-lib', "pthread", export=True)
|
my_module.add_flag('link-lib', "pthread", export=True)
|
||||||
@ -264,7 +265,7 @@ build mode (release/debug): {#lutin_module_int
|
|||||||
|
|
||||||
To add somes element dependent of the build mode:
|
To add somes element dependent of the build mode:
|
||||||
```{.py}
|
```{.py}
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
...
|
...
|
||||||
|
|
||||||
if target.get_mode() == "release":
|
if target.get_mode() == "release":
|
||||||
@ -281,7 +282,7 @@ build type target: {#lutin_module_int
|
|||||||
To add somes element dependent of the target type:
|
To add somes element dependent of the target type:
|
||||||
|
|
||||||
```{.py}
|
```{.py}
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
...
|
...
|
||||||
|
|
||||||
if "Windows" in target.get_type():
|
if "Windows" in target.get_type():
|
||||||
@ -309,7 +310,7 @@ Add some data in the install path (share path): {#lutin_module_in
|
|||||||
You can install a simple file:
|
You can install a simple file:
|
||||||
|
|
||||||
```{.py}
|
```{.py}
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
...
|
...
|
||||||
|
|
||||||
# copy file in the share/binanyName/ path (no sub path)
|
# copy file in the share/binanyName/ path (no sub path)
|
||||||
@ -321,7 +322,7 @@ def create(target, module_name):
|
|||||||
Copy multiple files (change path)
|
Copy multiple files (change path)
|
||||||
|
|
||||||
```{.py}
|
```{.py}
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
...
|
...
|
||||||
|
|
||||||
my_module.copy_path('data/*', 'destinationPath')
|
my_module.copy_path('data/*', 'destinationPath')
|
||||||
@ -414,17 +415,20 @@ def get_compagny_name():
|
|||||||
# Note: this fucntion is optionnal.
|
# Note: this fucntion is optionnal.
|
||||||
def get_maintainer():
|
def get_maintainer():
|
||||||
return ["Mr NAME SurName <my-email@group.com>"]
|
return ["Mr NAME SurName <my-email@group.com>"]
|
||||||
|
# return "authors.txt"
|
||||||
|
|
||||||
# Version of the library
|
# Version of the library
|
||||||
# Note: this fucntion is optionnal.
|
# Note: this fucntion is optionnal.
|
||||||
def get_version():
|
def get_version():
|
||||||
return [0,1,"dev"]
|
return [0,1,"dev"]
|
||||||
|
# return "version.txt"
|
||||||
|
|
||||||
# create the module
|
# create the module
|
||||||
# @param[in] target reference on the Target that is currently build
|
# @param[in] target reference on the Target that is currently build
|
||||||
# @param[in] module_name Name of the module that is extract from the file name (to be generic)
|
# @param[in] my_module Module handle that migh be configured
|
||||||
def create(target, module_name):
|
# @return True The module is welled configure
|
||||||
my_module = module.Module(__file__, module_name, get_type())
|
# @return False The module is Not availlable (for this target or ...)
|
||||||
|
def configure(target, my_module):
|
||||||
|
|
||||||
# add the file to compile:
|
# add the file to compile:
|
||||||
my_module.add_src_file([
|
my_module.add_src_file([
|
||||||
@ -485,7 +489,8 @@ def create(target, module_name):
|
|||||||
|
|
||||||
my_module.copy_path('data/*', 'destinationPath')
|
my_module.copy_path('data/*', 'destinationPath')
|
||||||
|
|
||||||
return my_module
|
# Return True if the module is compatible with the target or ...
|
||||||
|
return True
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -1451,7 +1451,32 @@ def load_module(target, name):
|
|||||||
# get basic module properties:
|
# get basic module properties:
|
||||||
property = get_module_option(os.path.dirname(mod[1]), 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 "configure" in dir(the_module):
|
||||||
|
# create the module:
|
||||||
|
tmp_element = Module(the_module_file, name, property["type"])
|
||||||
|
# overwrite some package default property (if not set by user)
|
||||||
|
if property["compagny-type"] != None:
|
||||||
|
tmp_element._pkg_set_if_default("COMPAGNY_TYPE", property["compagny-type"])
|
||||||
|
if property["compagny-name"] != None:
|
||||||
|
tmp_element._pkg_set_if_default("COMPAGNY_NAME", property["compagny-name"])
|
||||||
|
if property["maintainer"] != None:
|
||||||
|
tmp_element._pkg_set_if_default("MAINTAINER", property["maintainer"])
|
||||||
|
if property["name"] != None:
|
||||||
|
tmp_element._pkg_set_if_default("NAME", property["name"])
|
||||||
|
if property["description"] != None:
|
||||||
|
tmp_element._pkg_set_if_default("DESCRIPTION", property["description"])
|
||||||
|
if property["license"] != None:
|
||||||
|
tmp_element._pkg_set_if_default("LICENSE", property["license"])
|
||||||
|
if property["version"] != None:
|
||||||
|
tmp_element._pkg_set_if_default("VERSION", property["version"])
|
||||||
|
# call user to configure it:
|
||||||
|
ret = the_module.configure(target, tmp_element)
|
||||||
|
if ret == False:
|
||||||
|
# the user request remove the capabilities of this module for this platform
|
||||||
|
tmp_element = None
|
||||||
|
elif "create" in dir(the_module):
|
||||||
|
# parse in a second time to permit to implement retro-compat build
|
||||||
|
debug.warning("[DEPRECATED] (" + name + ") module creation: function 'create', use 'configure' ... (remove compatibility in next major version (2.x)")
|
||||||
tmp_element = the_module.create(target, name)
|
tmp_element = the_module.create(target, name)
|
||||||
if tmp_element != None:
|
if tmp_element != None:
|
||||||
# overwrite some package default property (if not set by user)
|
# overwrite some package default property (if not set by user)
|
||||||
@ -1542,7 +1567,7 @@ def get_module_option(path, the_module, name):
|
|||||||
if "get_type" in list_of_function_in_factory:
|
if "get_type" in list_of_function_in_factory:
|
||||||
type = the_module.get_type()
|
type = the_module.get_type()
|
||||||
else:
|
else:
|
||||||
debug.debug(" function get_type() must be provided in the module: " + name)
|
debug.error(" function get_type() must be provided in the module: " + name)
|
||||||
|
|
||||||
if "get_sub_type" in list_of_function_in_factory:
|
if "get_sub_type" in list_of_function_in_factory:
|
||||||
sub_type = the_module.get_sub_type()
|
sub_type = the_module.get_sub_type()
|
||||||
|
@ -175,6 +175,7 @@ class Target(target.Target):
|
|||||||
if host.OS == "Windows":
|
if host.OS == "Windows":
|
||||||
debug.error("action not implemented ...")
|
debug.error("action not implemented ...")
|
||||||
return
|
return
|
||||||
|
debug.debug(" think to configure your wine : 'winecfg' : https://www.winehq.org/docs/wineusr-guide/config-wine-main")
|
||||||
appl_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", pkg_name + self.suffix_binary)
|
appl_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", pkg_name + self.suffix_binary)
|
||||||
cmd = "wine " + appl_path + " "
|
cmd = "wine " + appl_path + " "
|
||||||
for elem in option_list:
|
for elem in option_list:
|
||||||
@ -183,3 +184,4 @@ class Target(target.Target):
|
|||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("-- Run package '" + pkg_name + "' Finished")
|
debug.info("-- Run package '" + pkg_name + "' Finished")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import lutin.module as module
|
|
||||||
import lutin.tools as tools
|
import lutin.tools as tools
|
||||||
import lutin.debug as debug
|
import lutin.debug as debug
|
||||||
import os
|
import os
|
||||||
@ -8,10 +7,9 @@ def get_type():
|
|||||||
return "BINARY"
|
return "BINARY"
|
||||||
|
|
||||||
def get_desc():
|
def get_desc():
|
||||||
return "Text C compilation"
|
return "Test C compilation"
|
||||||
|
|
||||||
def create(target, module_name):
|
def configure(target, my_module):
|
||||||
my_module = module.Module(__file__, module_name, get_type())
|
|
||||||
my_module.add_extra_compile_flags()
|
my_module.add_extra_compile_flags()
|
||||||
my_module.add_src_file([
|
my_module.add_src_file([
|
||||||
'test.c'
|
'test.c'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user