From e3a2e19fe62e5c7cb6eb45c9f90102bd0826fad5 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 23 Feb 2015 22:14:48 +0100 Subject: [PATCH] [DEV] add dependency of generic module --- lutinHeritage.py | 6 +++++- lutinModule.py | 20 ++++++++++++++++---- lutinTarget.py | 5 +++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/lutinHeritage.py b/lutinHeritage.py index 2888d4f..fc4a746 100644 --- a/lutinHeritage.py +++ b/lutinHeritage.py @@ -8,6 +8,7 @@ ## import sys +import copy import lutinDebug as debug @@ -127,7 +128,7 @@ class heritage: if type(module) != type(None): # all the parameter that the upper classe need when build self.name = module.name - self.depends = module.depends + self.depends = copy.deepcopy(module.depends) self.flags_ld = module.export_flags_ld self.flags_cc = module.export_flags_cc self.flags_xx = module.export_flags_xx @@ -135,6 +136,9 @@ class heritage: self.flags_mm = module.export_flags_mm self.path = module.export_path + def add_depends(self, depend): + self.depends.append(depend) + def add_flag_LD(self, list): append_to_list(self.flags_ld, list) diff --git a/lutinModule.py b/lutinModule.py index 57915e6..8e08bbd 100644 --- a/lutinModule.py +++ b/lutinModule.py @@ -44,6 +44,7 @@ class Module: self.depends = [] # Dependency list (optionnal module): self.depends_optionnal = [] + self.depends_find = [] # Documentation list: self.documentation = None # export PATH @@ -457,12 +458,16 @@ class Module: listSubFileNeededTobuild = [] self.subHeritageList = heritage.HeritageList() # optionnal dependency : - for dep, option in self.depends_optionnal: + for dep, option, export in self.depends_optionnal: inheritList, isBuilt = target.build_optionnal(dep, packageName) if isBuilt == True: + self.localHeritage.add_depends(dep); # TODO : Add optionnal Flags ... # ==> do it really better ... - self.add_export_flag_CC("-D"+option); + if export == False: + self.compile_flags_CC("-D"+option); + else: + self.add_export_flag_CC("-D"+option); # add at the heritage list : self.subHeritageList.add_heritage_list(inheritList) for dep in self.depends: @@ -579,8 +584,8 @@ class Module: def add_module_depend(self, list): self.append_to_internalList(self.depends, list, True) - def add_optionnal_module_depend(self, module_name, compilation_flags=""): - self.append_and_check(self.depends_optionnal, [module_name, compilation_flags], True) + def add_optionnal_module_depend(self, module_name, compilation_flags="", export=False): + self.append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True) def add_export_path(self, list): self.append_to_internalList(self.export_path, list) @@ -784,6 +789,13 @@ def import_path(path): debug.debug("integrate module: '" + moduleName + "' from '" + os.path.join(root, filename) + "'") moduleList.append([moduleName,os.path.join(root, filename)]) +def exist(target, name): + global moduleList + for mod in moduleList: + if mod[0] == name: + return True + return False + def load_module(target, name): global moduleList for mod in moduleList: diff --git a/lutinTarget.py b/lutinTarget.py index 074c19d..2d9974e 100644 --- a/lutinTarget.py +++ b/lutinTarget.py @@ -313,6 +313,11 @@ class Target: if exist == True: lutinSystem.load(self, name, self.name) return True; + # try to find in the local Modules: + exist = lutinModule.exist(self, name) + if exist == True: + lutinModule.load_module(self, name) + return True; else: return False;