org.guifications.plugins: e90fb63d6f841c45cff22dc8f7baf5bfe3d0b23f

grim at guifications.org grim at guifications.org
Sat May 10 18:10:10 CDT 2008


-----------------------------------------------------------------
Revision: e90fb63d6f841c45cff22dc8f7baf5bfe3d0b23f
Ancestor: 71ef6f75954eb7d907471a2c37d6e75203e699af
Author: grim at guifications.org
Date: 2008-05-10T20:39:17
Branch: org.guifications.plugins

Modified files:
        plugin_pack.py

ChangeLog: 

added a 'list' command to output information about all plugins.  It's been modelled after dpkg -l and will be used to help find out the 'provides' name of a plugin for use in other commands to plugin_pack.py


-----------------------------------------------------------------
This revision's diffstat output:
 plugin_pack.py |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
-------------- next part --------------
============================================================
--- plugin_pack.py	12596cabd2ea891351ccc08a8b9ac7986aa6ca90
+++ plugin_pack.py	e0ca9c27c277c6c68c9559b9fb2c3ef604a02236
@@ -287,7 +287,57 @@ class PluginPack:
 
 		print "%s" % (string.join(output, ','))
 	commands['build_dirs'] = build_dirs
+	
+	def list_plugins(self, args):
+		data = {}
 
+		# create an array for the widths, we initialize it to the lengths of
+		# the title strings.  We ignore summary, since that one shouldn't
+		# matter.
+		widths = [4, 8, 0]
+
+		for p in self.plugins.keys():
+			plugin = self.plugins[p]
+
+			if plugin.type == 'abusive':
+				type = 'a'
+			elif plugin.type == 'incomplete':
+				type = 'i'
+			else:
+				type = 'd'
+
+			if 'finch' in plugin.depends:
+				ui = 'f'
+			elif 'pidgin' in plugin.depends:
+				ui = 'p'
+			elif 'purple' in plugin.depends:
+				ui = 'r'
+			else:
+				ui = 'u'
+
+			widths[0] = max(widths[0], len(plugin.name))
+			widths[1] = max(widths[1], len(plugin.provides))
+			widths[2] = max(widths[2], len(plugin.summary))
+
+			data[plugin.provides] = [type, ui, plugin.name, plugin.provides, plugin.summary]
+
+		print 'Type=Default/Incomplete/Abusive'
+		print '| UI=Finch/Pidgin/puRple/Unknown'
+		print '|/ Name%s Provides%s Summary' % (' ' * (widths[0] - 4), ' ' * (widths[1] - 8))
+		print '++-%s-%s-%s' % ('=' * (widths[0]), '=' * (widths[1]), '=' * (widths[2]))
+
+		# create the format var
+		fmt = '%%s%%s %%-%ds %%-%ds %%s' % (widths[0], widths[1]) #, widths[2])
+
+		# now loop through the list again, with everything formatted
+		list = data.keys()
+		list.sort()
+
+		for p in list:
+			d = data[p]
+			print fmt % (d[0], d[1], d[2], d[3], d[4])
+	commands['list'] = list_plugins
+
 	def config_file(self, args):
 		"""Outputs the contents for the file to be m4_include()'d from configure"""
 		uniqdirs = self.unique_dirs()


More information about the Plugins-commits mailing list