Skip to content

Commit 29b65a1

Browse files
committed
bugzilla: Break out __init__ bits to fix cyclic dependencies
1 parent 9237039 commit 29b65a1

7 files changed

Lines changed: 30 additions & 12 deletions

File tree

bugzilla/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,21 @@
99
# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
1010
# the full text of the license.
1111

12-
__version__ = "1.1.0"
13-
version = __version__
14-
1512
import sys
16-
from logging import getLogger
1713

1814
if hasattr(sys.version_info, "major") and sys.version_info.major >= 3:
1915
# pylint: disable=F0401
2016
from xmlrpc.client import Fault, ServerProxy
2117
else:
2218
from xmlrpclib import Fault, ServerProxy
2319

24-
log = getLogger("bugzilla")
25-
26-
20+
from .apiversion import version, __version__
2721
from .base import BugzillaBase as _BugzillaBase
2822
from .base import BugzillaError
2923
from .base import RequestsTransport as _RequestsTransport
3024
from .bugzilla3 import Bugzilla3, Bugzilla32, Bugzilla34, Bugzilla36
3125
from .bugzilla4 import Bugzilla4, Bugzilla42, Bugzilla44
26+
from .logsetup import log
3227
from .rhbugzilla import RHBugzilla, RHBugzilla3, RHBugzilla4
3328

3429

bugzilla/apiversion.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# Copyright (C) 2014 Red Hat Inc.
3+
#
4+
# This program is free software; you can redistribute it and/or modify it
5+
# under the terms of the GNU General Public License as published by the
6+
# Free Software Foundation; either version 2 of the License, or (at your
7+
# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
8+
# the full text of the license.
9+
10+
version = "1.1.0"
11+
__version__ = version

bugzilla/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131

3232
import requests
3333

34-
from . import __version__, log
34+
from .apiversion import __version__
3535
from .bug import _Bug, _User
36+
from .logsetup import log
3637

3738

3839
# Backwards compatibility

bugzilla/bug.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import locale
1313
import sys
1414

15-
from . import log
15+
from .logsetup import log
1616

1717

1818
class _Bug(object):

bugzilla/logsetup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# Copyright (C) 2014 Red Hat Inc.
3+
#
4+
# This program is free software; you can redistribute it and/or modify it
5+
# under the terms of the GNU General Public License as published by the
6+
# Free Software Foundation; either version 2 of the License, or (at your
7+
# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
8+
# the full text of the license.
9+
10+
from logging import getLogger
11+
log = getLogger("bugzilla")

bugzilla/rhbugzilla.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
# the full text of the license.
1111

1212

13-
from . import log
1413
from .bugzilla4 import Bugzilla44 as _parent
14+
from .logsetup import log
1515

1616

1717
class RHBugzilla(_parent):

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212

1313
def get_version():
14-
f = open("bugzilla/__init__.py")
14+
f = open("bugzilla/apiversion.py")
1515
for line in f:
16-
if line.startswith('__version__'):
16+
if line.startswith('version = '):
1717
return eval(line.split('=')[-1])
1818

1919

0 commit comments

Comments
 (0)