- Timestamp:
- Apr 21, 2017, 2:59:21 PM (4 years ago)
- Location:
- lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/infoManager.py
r4363 r4394 124 124 if app.get_url_item(1): 125 125 appInfo['homepage']=app.get_url_item(1).strip() 126 if app.get_url_item(0): 127 appInfo['installerUrl']=app.get_url_item(0).strip() 126 128 if app.get_state()==1: #1=Installed 127 129 appInfo['state']='installed' -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/loadStore.py
r3884 r4394 78 78 uniqDict={} 79 79 for app in applist: 80 #Prioritize Lliurex apps 81 if str(app.get_origin()).find('lliurex')>=0: 82 self._debug("Prioritize app "+str(app.get_id())) 83 app.set_priority(100) 84 elif app.has_category('Lliurex'): 85 self._debug("Prioritize app "+app.get_id()) 86 app.set_priority(100) 87 else: 88 app.set_priority(0) 80 89 #Remove apps whitout pkgname 81 90 if not app.get_pkgnames(): … … 101 110 elif pkg: 102 111 uniqDict.update({pkg:{'fn':app.get_id_filename(),'app':app}}) 112 103 113 #Check the blacklist 114 store=self._apply_blacklist(store) 115 return (store) 116 #def _sanitize_store 117 118 def _apply_blacklist(self,store): 104 119 try: 105 120 flavour=subprocess.check_output(["lliurex-version","-f"]).rstrip() … … 132 147 self._debug('No blacklist to check') 133 148 except subprocess.CalledProcessError as e: 134 print(u"Running on a non Lliurex host")149 self_debug("Running on a non Lliurex host") 135 150 except Exception as e: 136 151 self._debug("Error processing blacklist: "+str(e)) 137 return (store) 138 #def _sanitize_store 152 finally: 153 return(store) 154 #def _apply_blacklist 139 155 -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/shManager.py
r3275 r4394 4 4 import locale 5 5 import tempfile 6 import subprocess 7 import urllib.request 8 import shutil 9 import time 6 10 7 11 class shmanager: 8 def __init__(self ,packagekit=None,action=None,app={}):12 def __init__(self): 9 13 self.locale=locale.getlocale()[0] 10 14 self.dbg=0 11 15 self.pluginInfo={'install':'sh'} 12 if action=='install': 13 self.install_App(app) 16 self.progress=0 17 self.result={} 18 self.result['data']=[] 19 self.result['status']={} 20 self.result['status']={'status':-1,'msg':''} 14 21 #def __init__ 15 22 16 23 def set_debug(self,dbg='1'): 17 24 self.dbg=int(dbg) 18 self. debug ("Debug enabled")25 self._debug ("Debug enabled") 19 26 #def set_debug 20 27 21 def debug(self,msg=''):28 def _debug(self,msg=''): 22 29 if self.dbg==1: 23 print ('DEBUG Zmd: '+msg)30 print ('DEBUG Sh: '+msg) 24 31 #def debug 25 32 … … 29 36 30 37 def execute_action(self,action,applist): 38 self.result['status']={'status':-1,'msg':''} 39 self.result['data'].append(applist) 31 40 count=len(applist) 32 41 if (action): 33 if action=='install': 34 self._install_App(appInfo) 42 for appInfo in applist: 43 self._debug("Executing action "+action+" for "+str(appInfo)) 44 if action=='install': 45 self.result['data'].append(self._install_App(appInfo)) 35 46 self.progress=100 36 47 return(self.result) 37 48 #def execute_action 38 49 50 def _set_status(self,status,msg=''): 51 self.result['status']={'status':status,'msg':msg} 52 53 def _callback(self,cmdLauncher): 54 inc=1 55 limit=99 56 margin=limit-self.progress 57 inc=round(margin/limit,3) 58 self.progress=self.progress+inc 59 #def _callback 60 39 61 def _install_App(self,appInfo): 40 62 return_msg=False 41 appUrl=app info['installerUrl']42 self. debug("Checking availabilty for "+appUrl)63 appUrl=appInfo['installerUrl'] 64 self._debug("Checking availabilty for "+appUrl) 43 65 tmpDir=tempfile.mkdtemp(None,None,'/tmp') 44 66 fileName=appUrl.split('/')[-1] … … 47 69 os.chdir(tmpDir) 48 70 os.chmod(dest_path, stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR) 71 err=0 72 try: 73 cmdsudo=['gksudo',dest_path] 74 self._debug("executing "+str(cmdsudo)) 75 cmdCmd=subprocess.Popen(cmdsudo,stdout=subprocess.PIPE,stdin=subprocess.PIPE,stderr=subprocess.PIPE) 76 cmdLauncher=os.path.basename(dest_path) 77 cmdLauncher=os.path.splitext(cmdLauncher)[0] 78 while cmdCmd.poll() is None: 79 self._callback(cmdLauncher) 80 time.sleep(0.4) 81 cmdResult=cmdCmd.stdout.read() 82 cmdError=cmdCmd.stderr.read() 83 self._debug("Error: "+str(cmdError)) 84 self._debug("Result: "+str(cmdResult)) 85 except Exception as e: 86 self._debug(str(e)) 87 err=12 88 else: 89 err=11 90 self._set_status(err) 91 return err 49 92 #def install_App 50 93 … … 54 97 tmpDir=tempfile.mkdtemp(None,None,'/tmp') 55 98 dest_path=tmpDir+'/'+appUrl.split('/')[-1] 56 self. debug("Downloading "+appUrl+" to "+dest_path)99 self._debug("Downloading "+appUrl+" to "+dest_path) 57 100 try: 58 urllib.request.urlretrieve(appUrl,dest_path) 101 # urllib.request.urlretrieve(appUrl,dest_path) 102 with urllib.request.urlopen(appUrl) as response, open(dest_path, 'wb') as out_file: 103 shutil.copyfileobj(response, out_file) 104 59 105 return_msg=True 60 106 except Exception as e: 61 self. debug(str(e))107 self._debug(str(e)) 62 108 return_msg=False 63 109 return return_msg -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/storeManager.py
r4370 r4394 375 375 result['status']={'status':0,'msg':''} 376 376 for appInfo in applistInfo: 377 result['data'].append(appInfo) 377 378 package_type=self._check_package_type(appInfo) 378 379 if package_type in typeDict: … … 531 532 return_msg="zmd" 532 533 else: 533 if "Installer" in appInfo['categories']: 534 #Standalone installers must have an installerUrl field loaded from a bundle type=script description 535 if appInfo['installerUrl']!='': 534 536 return_msg="sh" 535 537 else:
Note: See TracChangeset
for help on using the changeset viewer.