forked from pool/python-bugzillatools
Add upstream patch for porting to Python 3 (and fix some remaining bugs) Adjust SPEC file for adding testing OBS-URL: https://build.opensuse.org/request/show/612263 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-bugzillatools?expand=0&rev=7
101 lines
2.6 KiB
Diff
101 lines
2.6 KiB
Diff
--- a/plugin-bzr/__init__.py
|
|
+++ b/plugin-bzr/__init__.py
|
|
@@ -91,34 +91,36 @@ a bug URL and status in the revision met
|
|
|
|
bzr commit -m 'fix bug 123' --fixes example:123
|
|
"""
|
|
+import sys
|
|
|
|
-import bzrlib.api
|
|
-import bzrlib.commands
|
|
-import bzrlib.trace
|
|
-
|
|
-import bzlib
|
|
-
|
|
-from . import hooks
|
|
-
|
|
-# plugin setup
|
|
-version_info = bzlib.version_info
|
|
-
|
|
-COMPATIBLE_BZR_VERSIONS = [
|
|
- (2, 0, 0),
|
|
- (2, 1, 0),
|
|
- (2, 2, 0),
|
|
- (2, 3, 0),
|
|
-]
|
|
-
|
|
-bzrlib.api.require_any_api(bzrlib, COMPATIBLE_BZR_VERSIONS)
|
|
-
|
|
-if __name__ != 'bzrlib.plugins.bugzillatools':
|
|
- bzrlib.trace.warning(
|
|
- 'Not running as bzrlib.plugins.bugzillatools; things may break.')
|
|
-
|
|
-# install the get_command hook
|
|
-bzrlib.commands.Command.hooks.install_named_hook(
|
|
- 'get_command',
|
|
- hooks.get_command_hook,
|
|
- 'bugzilla plugin - extend cmd_commit'
|
|
-)
|
|
+if sys.version_info[0] == 2:
|
|
+ import bzrlib.api
|
|
+ import bzrlib.commands
|
|
+ import bzrlib.trace
|
|
+
|
|
+ import bzlib
|
|
+
|
|
+ from . import hooks
|
|
+
|
|
+ # plugin setup
|
|
+ version_info = bzlib.version_info
|
|
+
|
|
+ COMPATIBLE_BZR_VERSIONS = [
|
|
+ (2, 0, 0),
|
|
+ (2, 1, 0),
|
|
+ (2, 2, 0),
|
|
+ (2, 3, 0),
|
|
+ ]
|
|
+
|
|
+ bzrlib.api.require_any_api(bzrlib, COMPATIBLE_BZR_VERSIONS)
|
|
+
|
|
+ if __name__ != 'bzrlib.plugins.bugzillatools':
|
|
+ bzrlib.trace.warning(
|
|
+ 'Not running as bzrlib.plugins.bugzillatools; things may break.')
|
|
+
|
|
+ # install the get_command hook
|
|
+ bzrlib.commands.Command.hooks.install_named_hook(
|
|
+ 'get_command',
|
|
+ hooks.get_command_hook,
|
|
+ 'bugzilla plugin - extend cmd_commit'
|
|
+ )
|
|
--- a/bzlib/config.py
|
|
+++ b/bzlib/config.py
|
|
@@ -40,7 +40,7 @@ def check_section(section):
|
|
raise ConfigError('invalid section: {}'.format(section))
|
|
|
|
|
|
-class Config(ConfigParser.SafeConfigParser):
|
|
+class Config(ConfigParser.ConfigParser):
|
|
_instances = {}
|
|
|
|
@classmethod
|
|
@@ -52,16 +52,16 @@ class Config(ConfigParser.SafeConfigPars
|
|
|
|
def __init__(self, path):
|
|
path = os.path.expanduser(path)
|
|
- ConfigParser.SafeConfigParser.__init__(self)
|
|
+ ConfigParser.ConfigParser.__init__(self)
|
|
self._path = path
|
|
self.read(self._path)
|
|
|
|
def write(self):
|
|
with open(self._path, 'w') as fp:
|
|
- ConfigParser.SafeConfigParser.write(self, fp)
|
|
+ ConfigParser.ConfigParser.write(self, fp)
|
|
|
|
def add_section(self, section):
|
|
- ConfigParser.SafeConfigParser.add_section(self, check_section(section))
|
|
+ ConfigParser.ConfigParser.add_section(self, check_section(section))
|
|
|
|
|
|
NoSectionError = ConfigParser.NoSectionError
|