Changeset 4417
- Timestamp:
- Apr 25, 2017, 2:46:39 PM (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/files/error.json
r4370 r4417 12 12 "9":"plugin disabled", 13 13 "10":"unable to initialize n4d client", 14 "11":"no space left on device", 15 "12":"url not found", 14 16 "262":"version mismatch", 15 17 "264":"already installed", -
lliurex-store/trunk/fuentes/lliurex-store-cli/usr/share/lliurex-store/lliurex-store-cli.py
r4394 r4417 35 35 print (_(u"Results for ")+_(action)) 36 36 for data in results[action]: 37 print (data)38 37 if action=='info': 39 38 try: … … 159 158 for progress in progressDic: 160 159 if progress!='load': 161 progressArray.append( progress+': '+str(int(progressDic[progress]))+'%')160 progressArray.append(_(progress)+': '+str(int(progressDic[progress]))+'%') 162 161 print(','.join(progressArray),end="\r") 163 162 time.sleep(0.1) -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/loadStore.py
r4394 r4417 77 77 applist=store.get_apps() 78 78 uniqDict={} 79 lliurexApps={} 79 80 for app in applist: 80 81 #Prioritize Lliurex apps … … 82 83 self._debug("Prioritize app "+str(app.get_id())) 83 84 app.set_priority(100) 85 lliurexApps.update({app.get_id_filename():app}) 84 86 elif app.has_category('Lliurex'): 85 87 self._debug("Prioritize app "+app.get_id()) 86 88 app.set_priority(100) 89 lliurexApps.update({app.get_id_filename():app}) 87 90 else: 88 91 app.set_priority(0) 92 if app.get_id_filename() in lliurexApps.keys(): 93 # app.set_merge_kind(appstream.AppMergeKind.APPEND) 94 self._debug("Mergin app "+str(app.get_id())+" as is in Lliurex") 95 # app.set_id(lliurexApps[app.get_id_filename()]) 96 lliurexApps[app.get_id_filename()].subsume_full(app,appstream.AppSubsumeFlags.BOTH_WAYS) 97 store.remove_app(app) 98 # store.remove_app(app) 89 99 #Remove apps whitout pkgname 90 100 if not app.get_pkgnames(): … … 98 108 pkg=app.get_pkgname_default() 99 109 if pkg in uniqDict.keys(): 100 fn=app.get_id_ filename()110 fn=app.get_id_no_prefix() 101 111 self._debug("Comparing "+fn+" with "+uniqDict[pkg]['fn']) 102 112 if fn != uniqDict[pkg]['fn']: … … 106 116 else: 107 117 self._debug("Removed duplicated "+uniqDict[pkg]['app'].get_id()) 118 uniqDict.update({pkg:{'fn':app.get_id_no_prefix(),'app':app}}) 108 119 store.remove_app(uniqDict[pkg]['app']) 109 uniqDict.update({pkg:{'fn':app.get_id_filename(),'app':app}})110 120 elif pkg: 111 121 uniqDict.update({pkg:{'fn':app.get_id_filename(),'app':app}}) -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/shManager.py
r4394 r4417 13 13 self.locale=locale.getlocale()[0] 14 14 self.dbg=0 15 self.pluginInfo={'install':'sh' }15 self.pluginInfo={'install':'sh','pkginfo':'sh'} 16 16 self.progress=0 17 17 self.result={} … … 37 37 def execute_action(self,action,applist): 38 38 self.result['status']={'status':-1,'msg':''} 39 self.result['data'].append(applist)39 # self.result['data'].append(applist) 40 40 count=len(applist) 41 41 if (action): … … 44 44 if action=='install': 45 45 self.result['data'].append(self._install_App(appInfo)) 46 if action=='pkginfo': 47 self.result['data'].append(self._get_Sh_Info(appInfo)) 46 48 self.progress=100 47 49 return(self.result) … … 51 53 self.result['status']={'status':status,'msg':msg} 52 54 53 def _callback(self,cmdLauncher): 54 inc=1 55 def _callback(self,partialSize=0,totalSize=0): 55 56 limit=99 56 margin=limit-self.progress 57 inc=round(margin/limit,3) 58 self.progress=self.progress+inc 57 if partialSize!=0 and totalSize!=0: 58 inc=round(partialSize/totalSize,2)*100 59 self.progress=inc 60 else: 61 inc=1 62 margin=limit-self.progress 63 inc=round(margin/limit,3) 64 self.progress=(self.progress+inc) 65 if (self.progress>limit): 66 self.progress=limit 59 67 #def _callback 60 68 … … 74 82 self._debug("executing "+str(cmdsudo)) 75 83 cmdCmd=subprocess.Popen(cmdsudo,stdout=subprocess.PIPE,stdin=subprocess.PIPE,stderr=subprocess.PIPE) 84 # cmdCmd=subprocess.check_output(cmdsudo) 76 85 cmdLauncher=os.path.basename(dest_path) 77 86 cmdLauncher=os.path.splitext(cmdLauncher)[0] 78 87 while cmdCmd.poll() is None: 79 self._callback( cmdLauncher)88 self._callback() 80 89 time.sleep(0.4) 90 if cmdCmd.poll(): 91 if cmdCmd.poll()==255: 92 err=303 93 else: 94 err=cmdCmd.poll() 81 95 cmdResult=cmdCmd.stdout.read() 82 96 cmdError=cmdCmd.stderr.read() 83 97 self._debug("Error: "+str(cmdError)) 84 98 self._debug("Result: "+str(cmdResult)) 99 except subprocess.CalledProcessError as callError: 100 # err=callError.returncode 101 #if gksudo fails set "permission denied" error 102 err=303 85 103 except Exception as e: 86 104 self._debug(str(e)) … … 99 117 self._debug("Downloading "+appUrl+" to "+dest_path) 100 118 try: 101 119 # urllib.request.urlretrieve(appUrl,dest_path) 102 120 with urllib.request.urlopen(appUrl) as response, open(dest_path, 'wb') as out_file: 103 shutil.copyfileobj(response, out_file) 104 121 bf=16*1024 122 acumbf=0 123 shSize=int(response.info()['Content-Length']) 124 while True: 125 if acumbf>=shSize: 126 break 127 shutil.copyfileobj(response, out_file,bf) 128 acumbf=acumbf+bf 129 self._callback(acumbf,shSize) 105 130 return_msg=True 106 131 except Exception as e: … … 109 134 return return_msg 110 135 #def _download_App 136 137 def _get_Sh_Info(self,appInfo): 138 appUrl=appInfo['installerUrl'] 139 self._debug("Connecting to "+appUrl) 140 appUrl.strip() 141 try: 142 info=urllib.request.urlopen(appUrl) 143 appInfo['size']=info.info()['Content-Length'] 144 err=0 145 except: 146 err=11 147 self._set_status(err) 148 return(appInfo) 149 150 #def _get_info 151 -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/storeManager.py
r4394 r4417 384 384 self._debug("Checking plugin for "+action+ " "+package_type) 385 385 if package_type in self.registeredPlugins[action]: 386 # result['data']=[] 386 387 #Only search full info if it's required 387 388 if (fullsearch==False): 388 result['data'].extend(typeDict[package_type])389 # result['data'].extend(typeDict[package_type]) 389 390 continue 390 391 self._debug("Retrieving info for "+str(typeDict[package_type])) … … 513 514 return_msg=True 514 515 self._debug("Regenerating the cache...") 515 self._load_Store()516 # self._load_Store() 516 517 self._log("Result "+action +": "+str(self.result[action])) 517 518 return(return_msg)
Note: See TracChangeset
for help on using the changeset viewer.