|
@@ -373,6 +373,11 @@ name differ from the one found in plugin's init file"
|
373
|
373
|
#@throw AttributeError if varname not found
|
374
|
374
|
#@throw ImportError if the file fails to be imported
|
375
|
375
|
#@throw PluginError if the filename was not valid
|
|
376
|
+ #@todo Some strange things append :
|
|
377
|
+ #when loading modules in test self.module.__name__ does not contains
|
|
378
|
+ #the package... but in prod cases the self.module.__name__ is
|
|
379
|
+ #the module fullname... Just a reminder note to explain the dirty
|
|
380
|
+ #if on self_modname
|
376
|
381
|
def _import_from_init_var(self, varname):
|
377
|
382
|
# Read varname
|
378
|
383
|
try:
|
|
@@ -391,9 +396,14 @@ name differ from the one found in plugin's init file"
|
391
|
396
|
fname = filename,
|
392
|
397
|
name = self.name)
|
393
|
398
|
raise PluginError(msg)
|
|
399
|
+ #See the todo
|
|
400
|
+ if len(self.module.__name__.split('.')) == 1:
|
|
401
|
+ self_modname = self.module.__package__
|
|
402
|
+ else:
|
|
403
|
+ self_modname = self.module.__name__
|
394
|
404
|
#extract module name from filename
|
395
|
405
|
base_mod = '.'.join(filename.split('.')[:-1])
|
396
|
|
- module_name = self.module.__name__+"."+base_mod
|
|
406
|
+ module_name = self_modname+"."+base_mod
|
397
|
407
|
return importlib.import_module(module_name)
|
398
|
408
|
|
399
|
409
|
##@brief Check dependencies of plugin
|
|
@@ -701,7 +711,6 @@ file : '%s'. Running discover again..." % DISCOVER_CACHE_FILENAME)
|
701
|
711
|
#dropped
|
702
|
712
|
pass
|
703
|
713
|
result = {'path_list': paths, 'plugins': result}
|
704
|
|
- print("DEUG ",result['plugins'])
|
705
|
714
|
#Writing to cache
|
706
|
715
|
if not no_cache:
|
707
|
716
|
with open(DISCOVER_CACHE_FILENAME, 'w+') as pdcache:
|
|
@@ -806,7 +815,8 @@ file : '%s'. Running discover again..." % DISCOVER_CACHE_FILENAME)
|
806
|
815
|
##@brief Import init file from a plugin path
|
807
|
816
|
#@param path str : Directory path
|
808
|
817
|
#@return a tuple (init_module, module_name)
|
809
|
|
- #@todo very dirty, clean it
|
|
818
|
+ #@todo replace by LodelContext usage !!! (not mandatory, this fun
|
|
819
|
+ #is only used in plugin discover method)
|
810
|
820
|
@classmethod
|
811
|
821
|
def import_init(cls, path):
|
812
|
822
|
cls._mod_cnt += 1 # in order to ensure module name unicity
|