Changeset 3286 for lliurex-store/trunk
- Timestamp:
- Jan 12, 2017, 2:26:55 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/storeManager.py
r3283 r3286 4 4 import threading 5 5 import syslog 6 #Load the plugin dir 7 #pluginDir='/home/lliurex/lliurex-store/trunk/fuentes/lliurex-appstore.install/usr/share/lliurex-store/plugins' #Path to the dir that stores the plugins 8 #pluginDir='/usr/share/lliurex-store/plugins' #Path to the dir that stores the plugins 9 #oldpwd=os.getcwd() 10 #os.chdir(pluginDir) 11 #exec ('import ' + os.path.basename(pluginDir)) #DON'T CHANGE!!! 12 #os.chdir(oldpwd) 13 #del (oldpwd) 6 import pkgutil 14 7 import lliurexstore.plugins as plugins 15 from plugins import *16 8 ###### 17 9 #Ver. 1.0 of storeManager.py … … 34 26 'remove':['search','info','pkginfo','remove'] 35 27 } 36 self.dbg= 028 self.dbg=1 37 29 self.threads={} #Dict that stores the functions that must execute each action 38 30 self.threadsProgress={} #"" "" "" the progress for each launched thread 39 31 self.threadsRunning={} #"" "" "" the running threads 40 32 self._define_functions_for_threads() #Function that loads the dictionary self.threads 41 self.pluginDir='/usr/share/lliurex-store/plugins' #Path to the dir that stores the plugins42 #self.pluginDir='/home/lliurex/lliurex-store/trunk/fuentes/lliurex-appstore.install/usr/share/lliurex-store/plugins' #Path to the dir that stores the plugins43 self.pluginMod=os.path.basename(self.pluginDir) #DON'T CHANGE!!!44 33 self.registeredPlugins={} #Dict that have the relation between plugins and actions 45 34 self.registerProcessProgress={} #Dict that stores the progress for each function/parentAction pair … … 56 45 #### 57 46 def __init_plugins__(self): 58 # os.chdir(self.pluginDir) 59 # for mod in os.listdir(): 60 # if not mod.startswith('_'): 61 # modName=mod.split('.')[0] 62 # strImport='from plugins.'+modName+' import *' 63 # try: 64 # exec (strImport) 65 # except Exception as e: 66 # print(str(e)) 67 # from plugins import * 47 package=plugins 48 for importer, mod, ispkg in pkgutil.walk_packages(path=package.__path__, prefix=package.__name__+'.',onerror=lambda x: None): 49 strImport='from '+mod+' import *' 50 try: 51 self.debug("Importing "+str(mod)) 52 exec (strImport) 53 except Exception as e: 54 print(str(e)) 55 68 56 for mod in (sys.modules.keys()): 69 57 if 'plugins.' in mod: … … 71 59 pluginNameUp=mod.split('.')[-1] 72 60 pluginName=pluginNameUp.lower() 61 self._debug("Initializing "+str(pluginName)) 73 62 try: 74 loadedClass=eval( mod+'.'+pluginName)()63 loadedClass=eval(pluginName)() 75 64 definedActions=loadedClass.register() 76 65 except Exception as e:
Note: See TracChangeset
for help on using the changeset viewer.