prefix = '/var/www/update/' pattern = compile('^(.*)-([0-9]{14})$') def addPreviousVersions(path): write('Adding ' + path + '...\r') if isdir(prefix + path): names = listdir(prefix + path) names.sort() for name in names: if path != '': name = path + '/' + name addPreviousVersions(name) else: match = pattern.match(path) if match == None: return plugin = plugins.getPlugin(match.group(1)) if plugin == None: print 'Ignoring', match.group(1) return checksum = Util.getDigest(match.group(1), prefix + path) timestamp = long(match.group(2)) if not plugin.hasPreviousVersion(checksum): plugin.addPreviousVersion(checksum, timestamp) addPreviousVersions('') writer = XMLFileWriter(plugins) writer.validate() writer.write(GZIPOutputStream(FileOutputStream(dbPath)))
if not plugin.filename in argv[1:]: continue from ij import IJ IJ.debugMode = True print 'Handling', plugin dependencies = [dep.filename for dep in plugin.getDependencies()] seen = set() # dependencies have timestamps, so let's keep them intact when possible result = plugins.analyzeDependencies(plugin) for dependency in result: if dependency in dependencies: seen.add(dependency) else: plugin.addDependency(dependency) # special case: imglib dependency of Script Editor if plugin.filename == 'plugins/Script_Editor.jar': for dependency in ['jars/imglib.jar']: if not dependency in dependencies: plugin.addDependency(dependency) seen.add(dependency) for dependency in dependencies: if not dependency in seen: plugin.removeDependency(dependency) writer = XMLFileWriter(plugins) writer.validate() writer.write(GZIPOutputStream(FileOutputStream(dbPath)))
if len(argv) > 1: if not plugin.filename in argv[1:]: continue from ij import IJ IJ.debugMode = True print 'Handling', plugin dependencies = [dep.filename for dep in plugin.getDependencies()] seen = set() # dependencies have timestamps, so let's keep them intact when possible result = plugins.analyzeDependencies(plugin) for dependency in result: if dependency in dependencies: seen.add(dependency) else: plugin.addDependency(dependency) # special case: imglib dependency of Script Editor if plugin.filename == 'plugins/Script_Editor.jar': for dependency in ['jars/imglib.jar']: if not dependency in dependencies: plugin.addDependency(dependency) seen.add(dependency) for dependency in dependencies: if not dependency in seen: plugin.removeDependency(dependency) XMLFileWriter.writeAndValidate(dbPath[:-3]) system('gzip -9f ' + dbPath[:-3])