Changeset 3656 for lliurex-store
- Timestamp:
- Feb 17, 2017, 11:51:55 AM (4 years ago)
- Location:
- lliurex-store/trunk/fuentes
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-store/trunk/fuentes/lliurex-store-cli/usr/share/lliurex-store/lliurex-store-cli.py
r3653 r3656 6 6 import lliurexstore.storeManager as storeManager 7 7 import time 8 from bs4 import BeautifulSoup 8 9 9 10 class color: … … 30 31 if status['status']==0: 31 32 for data in results[action]: 32 if action=='search': 33 if args.info: 34 try: 35 print(color.BOLD+u'Package: '+color.END + data['package']) 36 print(u'Version: '+data['version']) 37 print(u'Categories: '+','.join(data['categories'])) 38 print(u'Status: '+data['state']) 39 print(u'Summary: '+data['summary']) 40 print(u'Description: '+data['description']) 41 pkgString=[] 42 for dependency in data['depends']: 43 pkgName=dependency.split(';')[0] 44 pkgString.append(pkgName) 45 print(u'Depends: '+' '+','.join(pkgString)) 46 print("") 47 except: 48 pass 49 else: 50 #Only print name and summary 51 print(color.BOLD+data['package']+color.END+": "+data['summary']) 33 if action=='info': 34 try: 35 print(color.BOLD+u'Package'+': '+color.END + data['package']) 36 print(u'Version'+': '+data['version']) 37 print(u'License'+': '+data['license']) 38 print(u'Categories'+': '+','.join(data['categories'])) 39 print(u'Status'+': '+data['state']) 40 print(u'Summary'+': '+data['summary']) 41 desc=(BeautifulSoup(data['description'],"lxml")).get_text() 42 # print(u'Description'+': '+data['description']) 43 print(u'Description'+': '+desc) 44 pkgString=[] 45 for dependency in data['depends']: 46 pkgName=dependency.split(';')[0] 47 pkgString.append(pkgName) 48 print(u'Depends: '+' '+','.join(pkgString)) 49 print("") 50 except Exception as e: 51 print(e) 52 pass 53 elif action=='search': 54 #Only print name and summary 55 print(color.BOLD+data['package']+color.END+": "+data['summary']) 52 56 elif action=='list': 53 57 #Print package, summary and status … … 62 66 pass 63 67 elif action=='install': 64 for app in data: 65 print(app+' '+data[app]) 68 listData=data.split(';') 69 print(listData[0]+" "+ u"installed"+" "+color.BOLD+ u"succesfully"+color.END) 70 elif action=='remove': 71 listData=data.split(';') 72 print(listData[0]+" "+ u"removed"+" "+color.BOLD+ u"succesfully"+color.END) 66 73 else: 67 74 print(data) 68 75 else: 69 76 print (u"Error: "+str(status['status'])) … … 83 90 store.set_debug(args.debug) 84 91 parms['debug']=args.debug''' 85 if (args.search or args.info): 92 if args.info: 93 actions.append('info') 94 parms['info']=args.info 95 if args.search: 86 96 actions.append('search') 87 if args.info:88 args.search=args.info89 97 parms['search']=args.search 90 98 if args.install: … … 101 109 parms['list_sections']=args.list_sections 102 110 103 actionList={'search':False,'info':False,'pkgInfo':False,'install':False,'remove':False }111 actionList={'search':False,'info':False,'pkgInfo':False,'install':False,'remove':False,'list':False,'list-sections':False} 104 112 start_time=time.time() 105 113 for action in actions: -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/debManager.py
r3653 r3656 55 55 if action=='pkginfo': 56 56 self._get_App_Dependencies(appInfo,app) 57 # self.progress=self.progress+(self.partialProgress/self.count) 58 self._debug("Final Progress: "+str(self.progress)) 57 self.progress=self.progress+(self.partialProgress/self.count) 59 58 self.progress=100 60 59 return(self.result) … … 64 63 self.result['status']={'status':status,'msg':msg} 65 64 65 def _fake_callback(self,status,typ,data=None): 66 pass 67 #def _fake_callback 68 66 69 def _callback(self,status,typ,data=None): 67 print("PRO "+str(self.progress)) 68 self.partialProgress=status.get_property('percentage') 69 self.partialProgress=self.partialProgress/self.count 70 self.progress=(self.progress+self.partialProgress)/self.count 71 self._debug("Partial Progress"+str(self.partialProgress)) 72 self._debug("Total Progress"+str(self.progress)) 73 self._debug("Total apps"+str(self.count)) 70 self.partialProgress=status.props.percentage 71 self.progress=self.partialProgress/self.count 74 72 #def _callback 75 73 … … 80 78 self.installer.install_packages(True,[app.get_id(),],None,self._callback,None) 81 79 self.result['data'].update({app.get_id():u'installed'}) 80 self._set_status(0) 82 81 except Exception as e: 83 82 self._debug("Install error: "+str(e.code)) … … 91 90 self.installer.remove_packages(True,[app.get_id(),],True,False,None,self._callback,None) 92 91 self.result['data'].update({app.get_id():0}) 92 self._set_status(0) 93 93 except Exception as e: 94 94 self._debug("Remove error: " +str(e.code)) … … 104 104 dependsList=[] 105 105 try: 106 results=pkTask.get_depends(1,[app.get_id(),],True,None,self._ callback,None)106 results=pkTask.get_depends(1,[app.get_id(),],True,None,self._fake_callback,None) 107 107 except: 108 108 pass … … 134 134 self.return_msg=False 135 135 try: 136 result=self.installer.resolve(1,[appName,],None,self._ callback, None)136 result=self.installer.resolve(1,[appName,],None,self._fake_callback, None) 137 137 applist=result.get_package_array() 138 138 if applist: … … 142 142 self._debug("Couldn't resolve "+appName) 143 143 self._debug("Reason: "+str(e)) 144 self.partialProgress=100 144 finally: 145 self.partialProgress=100 145 146 return(app) 146 147 #def _resolve_App -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/infoManager.py
r3653 r3656 4 4 def __init__(self): 5 5 self.dbg=0 6 self.pluginInfo={' info':'*'}6 self.pluginInfo={'get_info':'*'} 7 7 self.applistInfo=[] 8 8 self.progress=0 … … 28 28 self.appstream=appstream 29 29 count=len(applist) 30 if action==' info' and count>0:30 if action=='get_info' and count>0: 31 31 inc=100.0/count 32 32 self._get_info(applist) -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/searchManager.py
r3653 r3656 9 9 self.dbg=0 10 10 self.store='' 11 self.pluginInfo={'search':'*','list':'*','list_sections':'*' }11 self.pluginInfo={'search':'*','list':'*','list_sections':'*','info':'*'} 12 12 self.precision=10 13 13 self.applist=[] … … 49 49 if action=='list_sections': 50 50 self._list_sections() 51 if action=='search':51 if (action=='search' or action=='info'): 52 52 self._search_app(tokens) 53 53 self.progress=100 -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/storeManager.py
r3653 r3656 20 20 self.relatedActions={ 21 21 'load':['load'], 22 'search':['search','info','pkginfo'], 23 'list':['list','info','pkginfo'], 22 'search':['search','get_info','pkginfo'], 23 'list':['list','get_info','pkginfo'], 24 'info':['list','get_info','pkginfo'], 24 25 'list_sections':['list_sections'], 25 'install':['search',' info','pkginfo','install'],26 'remove':['search',' info','pkginfo','remove']26 'install':['search','get_info','pkginfo','install'], 27 'remove':['search','get_info','pkginfo','remove'] 27 28 } 28 29 self.dbg=0 … … 99 100 def _define_functions_for_threads(self): 100 101 self.threads['load']="threading.Thread(target=self._load_Store)" 101 self.threads[' info']="threading.Thread(target=self._get_App_Info,args=[args])"102 self.threads['get_info']="threading.Thread(target=self._get_App_Info,args=[args])" 102 103 self.threads['pkginfo']="threading.Thread(target=self._get_Extended_App_Info,args=[args])" 103 104 self.threads['search']='threading.Thread(target=self._search_Store,args=[args,action])' 104 105 self.threads['list']='threading.Thread(target=self._search_Store,args=[args,action])' 106 self.threads['info']='threading.Thread(target=self._search_Store,args=[args,action])' 105 107 self.threads['install']='threading.Thread(target=self._install_remove_App,args=[args,action])' 106 108 self.threads['remove']='threading.Thread(target=self._install_remove_App,args=[args,action])' … … 332 334 #### 333 335 def _get_App_Info(self,applist,launchedby=None): 334 action=' info'336 action='get_info' 335 337 infoFunction=self._execute_class_method(action,None,launchedby) 336 338 applistInfo=infoFunction.execute_action(self.store,action,applist) … … 392 394 # - List of dicts with all the info 393 395 #### 394 def _search_Store(self,searchItem='',action='search',fullsearch= True,launchedby=None):396 def _search_Store(self,searchItem='',action='search',fullsearch=False,launchedby=None): 395 397 applist={} 396 398 aux_applist=[] … … 400 402 except: 401 403 searchItem='' 402 if action=='list_sections':404 elif action=='list_sections': 403 405 searchItem='' 406 elif action=='info': 407 fullsearch=True 404 408 if not launchedby: 405 409 launchedby=action … … 412 416 if status['status']==0: 413 417 #1.- Get appstream metadata (faster) 414 partialAction=' info'418 partialAction='get_info' 415 419 self.result[partialAction]={} 416 420 applist=self._get_App_Info(aux_applist,launchedby)
Note: See TracChangeset
for help on using the changeset viewer.