Changeset 512
- Timestamp:
- 03/19/06 14:24:27 (3 years ago)
- Files:
-
- hackinstallplugin/0.9/hackinstall/core.py (modified) (1 diff)
- hackinstallplugin/0.9/hackinstall/templates/hackinstall_admin_plugin.cs (modified) (1 diff)
- hackinstallplugin/0.9/hackinstall/web_ui.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
hackinstallplugin/0.9/hackinstall/core.py
r508 r512 78 78 newname = '%s%s_r%s%s' % (md.group(1),md.group(2),rev,md.group(3)) 79 79 self.env.log.debug('Renaming %s to %s' % (f, newname)) 80 os.rename(self.env.path+'/plugins/'+f,self.env.path+'/plugins/'+newname) 81 82 # Remove all old versions 83 md = re.match('([^-]+)-',f) 84 if md: 85 for f2 in os.listdir(self.env.path+'/plugins'): 86 md2 = re.match('([^-]+)-',f2) 87 if md2 and md.group(1) == md2.group(1): 88 os.remove(self.env.path+'/plugins/'+f2) 80 89 81 90 def download_hack(self, name, rev): hackinstallplugin/0.9/hackinstall/templates/hackinstall_admin_plugin.cs
r484 r512 7 7 <form method="post"> 8 8 <table> 9 <tr><td>Name</td><td>Current</td>< /tr>9 <tr><td>Name</td><td>Current</td><td>Installed</td></tr> 10 10 <?cs each:plugin = hackinstall.plugins ?> 11 11 <tr> 12 12 <td><?cs name:plugin ?></td> 13 13 <td><?cs var:plugin.current ?></td> 14 <td>< input type="submit" name="download_<?cs name:plugin ?>" value="Download" /></td>14 <td><?cs var:plugin.installed ?></td> 15 15 <td><input type="submit" name="install_<?cs name:plugin ?>" value="Install" /></td> 16 16 </tr> hackinstallplugin/0.9/hackinstall/web_ui.py
r508 r512 10 10 from db_default import default_table 11 11 from core import * 12 import urlparse, xmlrpclib 12 import urlparse, xmlrpclib, re, os 13 13 14 14 __all__ = ['HackInstallPlugin'] … … 115 115 # Internal methods 116 116 def _get_hacks(self, type): 117 # Build hash of name -> installed-rev 118 installed = {} 119 if type == 'plugin': 120 for f in os.listdir(self.env.path+'/plugins'): 121 self.log.debug("Found egg '%s'"%f) 122 md = re.match('([^-]+)-([^-]+)-',f) 123 if md: 124 plugin = md.group(1).lower()+'plugin' 125 md2 = re.search('r(\d+)',md.group(2)) 126 if md2: 127 installed[plugin] = int(md2.group(1)) 128 else: 129 installed[plugin] = 0 130 self.log.debug('Extracted version = %s'%installed[plugin]) 131 elif type == 'macro': 132 pass # Haven't gotten here yet 133 134 # Build the rest of the data structure from the DB 117 135 db = self.env.get_db_cnx() 118 136 cursor = db.cursor() … … 120 138 cursor.execute('SELECT id, name, current FROM hacks WHERE type = %s', (type,)) 121 139 for row in cursor: 122 hacks[row[1]] = {'id': row[0], 'current': row[2] }140 hacks[row[1]] = {'id': row[0], 'current': row[2], 'installed': installed.get(row[1].lower(), -1)} 123 141 return hacks 124 142
