--- a/plugin_pack.py Tue Apr 01 04:25:07 2008 -0400
+++ b/plugin_pack.py Thu Apr 03 02:19:13 2008 -0400
@@ -17,19 +17,19 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
-"""Usage: plugin_pack.py [options]
+"""Usage: plugin_pack.py [OPTION...] command - -a, --abusive-plugins Outputs a comma-separated list of the abusive
- -D, --dist-dirs Outputs the list of all directories that have
- plugins and should be included in the distribution
- -d, --default-plugins Outputs a comma-separated list of the default
- --dependency-graph Outputs a graphviz diagram showing dependencies
- -h, --help Shows usage information
- -i, --incomplete-plugins Outputs a comma-separated list of the incomplete
- -p, --plugin=<name> Outputs all info about <name>
+ -a Load abusive plugins + -d Load default plugins + -i Load incomplate plugins + dependency-graph Outputs a graphviz script of the plugin's dependencies + info <plugin> Display information about plugin. @@ -75,7 +75,7 @@
output = 'name: %s\n' % self.name
- output += 'authors: %s\n' % string.join(self.authors, ',')
+ output += 'authors: %s\n' % string.join(self.authors, ', ') output += 'type: %s\n' % self.type
output += 'depends: %s\n' % string.join(self.depends, ' ')
output += 'provides: %s\n' % self.provides
@@ -89,6 +89,7 @@
def load_plugins(self, types, depends):
@@ -124,7 +125,7 @@
if len(set(depends).intersection(set(p.depends))) == 0:
- self.plugins[p.name] = p
+ self.plugins[p.provides] = p def list_type(self, type):
@@ -145,15 +146,6 @@
print string.join(names, ',')
- for name in self.plugins.keys():
- dirs[self.plugins[name].directory] = 1
- print string.join(dirs, ' ')
def default_plugins(self):
return self.list_type('default')
@@ -163,7 +155,29 @@
def incomplete_plugins(self):
return self.list_type('incomplete')
- def dependency_graph(self):
+ cmd = self.commands[args[0]] + print 'command \'%s\' was not found' % args[0] + commands['help'] = help + def dist_dirs(self, args): + """Outputs a list of all plugin directories to included in the distribution""" + for name in self.plugins.keys(): + dirs[self.plugins[name].directory] = 1 + print string.join(dirs, ' ') + commands['dist_dirs'] = dist_dirs + def dependency_graph(self, args): + """Outputs a graphviz script of dependencies""" node = plugin.provides.replace('-', '_')
@@ -219,6 +233,18 @@
print '\t%s -> %s;' % (node, dep)
+ commands['dependency_graph'] = dependency_graph + """Outputs all information about the given plugins""" + print self.plugins[p].__str__().strip() + print 'Failed to find a plugin that provides \'%s\'' % (p) + commands['info'] = info # create our main instance
@@ -250,10 +276,22 @@
- print "args: %s" % (string.join(args, ' '))
+ # load the plugins that have been requested, if both lists are empty, all pp.load_plugins(types, depends)
- pp.print_names(pp.plugins.values())
-if __name__ == "__main__":
+ pp.commands[cmd](pp, args) + printerr('\'%s\' command not found' % (cmd)) +if __name__ == '__main__':