Changeset 4346
- Timestamp:
- Apr 20, 2017, 8:31:59 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/zmdManager.py
r3848 r4346 39 39 count=len(applist) 40 40 self.n4dclient=self._n4d_connect() 41 self.result['status']={'status':-1,'msg':''} 42 self.result['data']=[] 41 43 for appInfo in applist: 42 44 if not (os.path.exists(self.zmdPath)): 43 45 return applist; 44 46 if (action): 45 47 if action=='install': 46 self. _install_Zmd(appInfo)48 self.result['data'].append(self._install_Zmd(appInfo)) 47 49 if action=='remove': 48 self. _remove_Zmd(appInfo)50 self.result['data'].append(self._remove_Zmd(appInfo)) 49 51 if action=='pkginfo': 50 self. _get_Zmd_Info(appInfo)52 self.result['data'].append(self._get_Zmd_Info(appInfo)) 51 53 self.progress=100 52 54 return(self.result) … … 70 72 zmd=self.zmdPath+'/'+appInfo['package']+'.zmd' 71 73 self._debug("Installing "+str(zmd)) 74 err=0 72 75 try: 73 76 zmdsudo=['gksudo',zmd] 74 print("executing "+str(zmdsudo))77 self._debug("executing "+str(zmdsudo)) 75 78 zmdCmd=subprocess.Popen(zmdsudo,stdout=subprocess.PIPE,stdin=subprocess.PIPE,stderr=subprocess.PIPE) 76 79 zmdLauncher=os.path.basename(zmd) … … 78 81 while zmdCmd.poll() is None: 79 82 self._callback(zmdLauncher) 80 time.sleep( 0.4)81 zmdResult=zmdCmd .stdout.read()83 time.sleep(.4 84 zmdResult=zmdCmdtdout.read() 82 85 zmdError=zmdCmd.stderr.read() 83 self._debug(" Result: "+str(zmdError))86 self._debug("Error: "+str(zmdError)) 84 87 self._debug("Result: "+str(zmdResult)) 85 88 appInfo=self._get_Zmd_Info(appInfo) 86 if appInfo['status']=='Installed': 87 self._set_status(0) 88 else: 89 self._set_status(5) 89 if appInfo['status']!='Installed': 90 err=5 90 91 except Exception as e: 91 92 appInfo=self._get_Zmd_Info(appInfo) 92 93 self._debug(str(e)) 93 if appInfo['status']=='Installed': 94 self._set_status(0) 95 self.result['data'].update({appInfo['name']:u'installed'}) 96 else: 97 self.result['data'].update({appInfo['name']:u'not installed'}) 98 self._set_status(5) 94 if appInfo['status']!='Installed': 95 err=5 96 self._set_status(err) 97 return err 99 98 #def _install_Zmd 100 99 … … 104 103 os.chdir(self.zmdPath) 105 104 sw_continue=False 105 err=0 106 106 try: 107 107 removePackages=[] … … 114 114 packagelist=packagelist[:-1] 115 115 #We've the file with the packagelist, now it's time to read the list 116 print("Obtaining packages in : "+packagelist)116 self._debug("Obtaining packages in : "+packagelist) 117 117 f2=open (packagelist,'r') 118 118 for line2 in f2: … … 125 125 f.close() 126 126 except Exception as e: 127 err=7 127 128 print(str(e)) 128 129 if sw_continue: … … 148 149 zmdError=zmdCmd.stderr.read() 149 150 except Exception as e: 150 print(str(e)) 151 err=6 152 self._debug((str(e)) 153 self._debug("Error: "+str(zmdError)) 151 154 self._debug("Result: "+str(zmdResult)) 152 self._debug("Error: "+str(zmdError))153 155 appInfo=self._get_Zmd_Info(appInfo) 154 156 if appInfo['status']=='Installed': 155 self._set_status(6) 156 else: 157 self._set_status(0) 158 self.result['data'].update({appInfo['name']:u'removed'}) 157 err=6 158 self._set_status(err) 159 159 os.remove(zeroScript) 160 return err 160 161 #def _remove_Zmd 161 162 … … 170 171 171 172 self._set_status(6) 172 self.result['data'].append(appInfo) 173 # self.result['data'].append(appInfo) 174 # self.result.append(appInfo) 173 175 return(appInfo) 174 176 #def _get_Zmd_Info
Note: See TracChangeset
for help on using the changeset viewer.