pidgin/purple-plugin-pack

48eac6f1a547
Parents 1b0ffb46592a
Children 1a752dbdf56c
plugin_pack.py: python3 compat fixes
  • +14 -12
    plugin_pack.py
  • --- a/plugin_pack.py Thu Apr 06 01:07:57 2017 -0300
    +++ b/plugin_pack.py Thu Apr 06 01:11:32 2017 -0300
    @@ -37,7 +37,6 @@
    import getopt
    import glob
    import os.path
    -import string
    import sys
    try:
    @@ -84,9 +83,9 @@
    def __str__(self):
    output = 'name: {}\n'.format(self.name)
    - output += 'authors: {}\n'.format(string.join(self.authors, ', '))
    + output += 'authors: {}\n'.format(', '.join(self.authors))
    output += 'type: {}\n'.format(self.type)
    - output += 'depends: {}\n'.format(string.join(self.depends, ' '))
    + output += 'depends: {}\n'.format(' '.join(self.depends))
    output += 'provides: {}\n'.format(self.provides)
    output += 'directory: {}\n'.format(self.directory)
    output += 'summary: {}\n'.format(self.summary)
    @@ -97,6 +96,10 @@
    return output
    + def __lt__(self, other):
    + return self.name < other.name
    +
    +
    class PluginPack:
    commands = {}
    plugins = {}
    @@ -164,7 +167,7 @@
    for plugin in list:
    names.append(plugin.name)
    - print(string.join(names, ','))
    + print(','.join(names))
    def default_plugins(self):
    return self.list_type('default')
    @@ -207,12 +210,12 @@
    cmds = self.commands.keys()
    cmds.remove('help')
    cmds.sort()
    - print(' {}'.format(string.join(cmds, ' ')))
    + print(' {}'.format(' '.join(cmds)))
    commands['help'] = help
    def dist_dirs(self, args):
    """Displays a list of all plugin directories to included in the distribution"""
    - print(string.join(self.unique_dirs(), ' '))
    + print(' '.join(self.unique_dirs()))
    commands['dist_dirs'] = dist_dirs
    def build_dirs(self, args):
    @@ -309,7 +312,7 @@
    output.sort()
    - print("{}".format(string.join(output, ',')))
    + print("{}".format(','.join(output)))
    commands['build_dirs'] = build_dirs
    def list_plugins(self, args):
    @@ -353,13 +356,12 @@
    print('++-{}-{}-{}'.format('=' * (widths[0]), '=' * (widths[1]), '=' * (widths[2])))
    # create the format var
    - fmt = '{}{} {:<' + widths[0] + '} {:<' + widths[1] + '} {}'
    + fmt = '{}{} {:<' + str(widths[0]) + '} {:<' + str(widths[1]) + '} {}'
    # now loop through the list again, with everything formatted
    - list = data.keys()
    - list.sort()
    + keys = sorted(list(data.keys()))
    - for p in list:
    + for p in keys:
    d = data[p]
    print(fmt.format(d[0], d[1], d[2], d[3], d[4]))
    commands['list'] = list_plugins
    @@ -519,7 +521,7 @@
    counts['pidgin'] = len(self.pidgin_plugins())
    def value(val):
    - return "%3d ({:6.2}%)".format(val, (float(val) / float(counts['total'])) * 100.0)
    + return "%3d ({:6.2f}%)".format(val, (float(val) / float(counts['total'])) * 100.0)
    print('{}\n\n{}\n\n{}\n{}\n{}\n{}\n\n{}\n{}\n{}\n{}'.format(
    "Purple Plugin Pack Stats", "{} plugins in total".format(counts['total']),