Ignore:
Timestamp:
Jun 9, 2017, 2:57:36 PM (2 years ago)
Author:
Juanma
Message:

added appImage plugin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/example.py

    r3275 r5133  
    11#The name of the main class must match the file name in lowercase
    22
    3 
     3#<---- Main scheme for a store plugin
     4#Init: Could accept parameters if we declare them in storeManager's threads dict
    45class example:
    56        def __init__(self):
    6                 self.example='This is an example plugin'
    77                self.dbg=0
    88                self.progress=0
    99                #This dict defines wich package_type relies on what action
     10                #actions are defined in storeManager.
     11                #Non contempled actions must declare its related functions on storeManager (threads dict) and define relationships with other actions in relatedActions.
     12                #action=example
     13                #package='*' (in this case all package_types. It could be "deb", "zmd" or whatever package type)
    1014                self.pluginInfo={'example':'*'}
    1115        #def __init__
    12 
     16       
     17        #public function that sets the debug mode. If we execute storeManager in debug mode all plugins will be launched in this mode.
    1318        def set_debug(self,dbg='1'):
    1419                self.dbg=int(dbg)
     
    2126        #def debug
    2227
     28        #public function accessed by sotremanager in order to register the plugin and its actions
    2329        def register(self):
    2430                #This function MUST return the dict with the action:package_type pair
    25                 #In this example it return nothing
    26                 #return(self.pluginInfo)
    27                 return({})
     31                #In this example it returns nothing
     32                self.pluginInfo={}
     33                return(self.pluginInfo)
    2834
    29         def execute_action(self,action):
    30                 if action=='example':
    31                         self._exec_example()
    32                 self.progress=100
    33                 return self.example
     35        #storeManager calls this method when launchs an action.
     36        def execute_action(self,action,applist):
     37                #applist is a list of appinfo elements
     38                #This function must return a dict with the dicts 'status' and 'data'
     39                #Status stores the returning status, 0=succesful, !0=error
     40                #Data stores the resulting data of the operation
     41                self.progress=0
     42                self.result['status']={'status':-1,'msg':''}
     43                self.result['data']=''
     44                for app in applist:
     45                        if action=='example':
     46                                datalist.append(self._exec_example(app))
     47                self.result['data']=list(dataList)
     48                self.progress=100 #When all actions are launched we must assure that progress=100.
     49                return(self.result)
    3450
    3551        def _callback(self):
    3652                self.progress=self.progress+1
    3753
    38 # <---- Put your code ----> #
     54#End of needed functions-------->
    3955
    40         def _exec_example(self):
    41                 self.example="Example executed"
     56# Put your code ----> #
     57
     58        def _exec_example(self,app):
    4259                while (self.progress<100):
    4360                        self._callback()
     61                return(app)
     62
     63# <---- #
Note: See TracChangeset for help on using the changeset viewer.