/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugin.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-22 00:56:52 UTC
  • mfrom: (6621.2.26 py3_pokes)
  • Revision ID: jelmer@jelmer.uk-20170522005652-yjahcr9hwmjkno7n
Merge Python3 porting work ('py3 pokes')

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
import os
35
35
import sys
36
36
 
37
 
from breezy import osutils
 
37
from . import osutils
38
38
 
39
 
from breezy.lazy_import import lazy_import
 
39
from .lazy_import import lazy_import
40
40
lazy_import(globals(), """
41
41
import imp
42
42
import re
243
243
                user=get_user_plugin_path())
244
244
 
245
245
    # Unset paths that should be removed
246
 
    for k,v in refs.iteritems():
 
246
    for k,v in refs.items():
247
247
        removed = '-%s' % k
248
248
        # defaults can never mention removing paths as that will make it
249
249
        # impossible for the user to revoke these removals.
308
308
    The python module path for breezy.plugins will be modified to be 'dirs'.
309
309
    """
310
310
    # Explicitly load the plugins with a specific path
311
 
    for fullname, path in PluginImporter.specific_paths.iteritems():
 
311
    for fullname, path in PluginImporter.specific_paths.items():
312
312
        name = fullname[len('breezy.plugins.'):]
313
313
        _load_plugin_module(name, path)
314
314
 
379
379
    if ('breezy.plugins.%s' % name) in PluginImporter.blacklist:
380
380
        return
381
381
    try:
382
 
        exec "import breezy.plugins.%s" % name in {}
 
382
        exec("import breezy.plugins.%s" % name, {})
383
383
    except KeyboardInterrupt:
384
384
        raise
385
 
    except errors.IncompatibleAPI, e:
 
385
    except errors.IncompatibleAPI as e:
386
386
        warning_message = (
387
387
            "Unable to load plugin %r. It requested API version "
388
388
            "%s of module %s but the minimum exported version is %s, and "
389
389
            "the maximum is %s" %
390
390
            (name, e.wanted, e.api, e.minimum, e.current))
391
391
        record_plugin_warning(name, warning_message)
392
 
    except Exception, e:
 
392
    except Exception as e:
393
393
        trace.warning("%s" % e)
394
394
        if re.search('\.|-| ', name):
395
395
            sanitised_name = re.sub('[-. ]', '_', name)
508
508
            result = self.module.__doc__
509
509
        if result[-1] != '\n':
510
510
            result += '\n'
511
 
        from breezy import help_topics
 
511
        from . import help_topics
512
512
        result += help_topics._format_see_also(additional_see_also)
513
513
        return result
514
514
 
577
577
                    version_info = version_info.split('.')
578
578
                elif len(version_info) == 3:
579
579
                    version_info = tuple(version_info) + ('final', 0)
580
 
            except TypeError, e:
 
580
            except TypeError as e:
581
581
                # The given version_info isn't even iteratible
582
582
                trace.log_exception_quietly()
583
583
                version_info = (version_info,)
589
589
            return "unknown"
590
590
        try:
591
591
            version_string = _format_version_tuple(version_info)
592
 
        except (ValueError, TypeError, IndexError), e:
 
592
        except (ValueError, TypeError, IndexError) as e:
593
593
            trace.log_exception_quietly()
594
594
            # try to return something usefull for bad plugins, in stead of
595
595
            # stack tracing.