Changeset 3646 for lliurex-store/trunk/fuentes/lliurex-appstore.install/usr
- Timestamp:
- Feb 15, 2017, 6:27:03 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-store/trunk/fuentes/lliurex-appstore.install/usr/share/lliurex-store/lliurex-store-cli.py
r3277 r3646 11 11 printed=False 12 12 results=store.get_result(action) 13 print (store.get_progress())13 print ("") 14 14 for action in results: 15 15 if action in actions and not actionList[action]: 16 print("") 17 print ("#####################") 18 print ("RESULT FOR "+action+ " executed in " + str((time.time() - start_time))) 19 print(store.get_progress()) 16 print (u"Results for "+action) 20 17 for result in results[action]: 21 print(result) 22 print ("---------------") 18 if action=='search': 19 if args.info: 20 try: 21 print(u'Package: '+result['package']) 22 print(u'Version: '+result['version']) 23 print(u'Categories: '+','.join(result['categories'])) 24 print(u'Status: '+result['status']) 25 print(u'Summary: '+result['summary']) 26 print(u'Description: '+result['description']) 27 pkgString=[] 28 for dependency in result['depends']: 29 pkgName=dependency.split(';')[0] 30 pkgString.append(pkgName) 31 print(u'Depends: '+' '+','.join(pkgString)) 32 print("") 33 except: 34 pass 35 else: 36 #Only print name and summary 37 print(result['package']+": "+result['summary']) 38 elif action=='list': 39 #Print package, summary and status 40 try: 41 if result['package']: 42 package=result['package'] 43 else: 44 package=result['name'] 45 print(package+": "+result['summary']+' ('+','.join(result['categories'])+')'+' ('+result['status']+')') 46 except: 47 pass 48 elif action=='install': 49 for app in result: 50 print(app+' '+result[app]) 51 else: 52 print(result) 23 53 printed=True 24 if printed: 25 print ("####################") 54 # print ("---------------") 55 # if printed: 56 # print ("####################") 26 57 return(printed) 58 #def print_results 27 59 28 60 CURSOR_UP='\033[F' … … 30 62 actions=[] 31 63 parms={} 32 store=storeManager.StoreManager()33 64 args=process_Args(sys.argv) 65 store=storeManager.StoreManager(args.debug) 34 66 35 if args.debug:36 actions.append('debug')37 store.set_debug(args.debug)38 parms['debug']=args.debug39 if args.search:67 ''' if args.debug: 68 actions.append('debug') 69 store.set_debug(args.debug) 70 parms['debug']=args.debug''' 71 if (args.search or args.info): 40 72 actions.append('search') 73 if args.info: 74 args.search=args.info 41 75 parms['search']=args.search 42 76 if args.install: … … 56 90 start_time=time.time() 57 91 for action in actions: 58 print("Launching: "+action)92 # print(u"Launching: "+action) 59 93 store.execute_action(action,parms[action]) 60 94 actionList[action]=False 61 95 62 print ("All actions launched: " +str(actions))96 # print ("All actions launched: " +str(actions)) 63 97 while store.is_action_running(): 64 # print(" ",end="\r") 65 print (CURSOR_UP + ERASE_LINE) 66 print(store.get_progress(),end="\r") 98 progressDic=store.get_progress() 99 progressArray=[] 100 for progress in progressDic: 101 if progress!='load': 102 progressArray.append(progress+': '+str(int(progressDic[progress]))+'%') 103 print(','.join(progressArray),end="\r") 67 104 time.sleep(0.1) 68 105 for key in actionList: … … 70 107 if key in progressDic: 71 108 if progressDic[key]==100 and not actionList[key]: 109 progressDic=store.get_progress(key) 110 progressArray=[] 111 for progress in progressDic: 112 if progress!='load': 113 progressArray.append(progress+': '+str(progressDic[progress])+'%') 114 print(','.join(progressArray)) 115 print (CURSOR_UP + ERASE_LINE) 72 116 actionList[key]=print_results(key) 73 117 print_results() 74 75 118 76 119 def process_Args(args): … … 79 122 parser.add_argument('--list-sections',action='store_true',help=(u"List all sections from the store")) 80 123 parser.add_argument('--search',metavar='Name',nargs='?',help=(u"Search a package")) 124 parser.add_argument('--info',metavar='Name',nargs='?',help=(u"Show all info from a package")) 81 125 parser.add_argument('--install',metavar='Package',help=(u"Install a package")) 82 126 parser.add_argument('--remove',metavar='Package',help=(u"Remove a package"))
Note: See TracChangeset
for help on using the changeset viewer.