mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-03 10:06:17 +01:00
_private: Avoid circular import of osc.core, osc.connection and osc.store
This commit is contained in:
parent
6e4ad5db1c
commit
c1aa427254
@ -4,10 +4,6 @@ and work with related XML data.
|
||||
"""
|
||||
|
||||
|
||||
from .. import connection as osc_connection
|
||||
from .. import core as osc_core
|
||||
|
||||
|
||||
def get(apiurl, path, query=None):
|
||||
"""
|
||||
Send a GET request to OBS.
|
||||
@ -21,6 +17,9 @@ def get(apiurl, path, query=None):
|
||||
:returns: Parsed XML root.
|
||||
:rtype: xml.etree.ElementTree.Element
|
||||
"""
|
||||
from .. import connection as osc_connection
|
||||
from .. import core as osc_core
|
||||
|
||||
assert apiurl
|
||||
assert path
|
||||
|
||||
@ -46,6 +45,9 @@ def post(apiurl, path, query=None):
|
||||
:returns: Parsed XML root.
|
||||
:rtype: xml.etree.ElementTree.Element
|
||||
"""
|
||||
from .. import connection as osc_connection
|
||||
from .. import core as osc_core
|
||||
|
||||
assert apiurl
|
||||
assert path
|
||||
|
||||
@ -110,6 +112,8 @@ def write_xml_node_to_file(node, path, indent=True):
|
||||
:param indent: Whether to indent (pretty-print) the written XML.
|
||||
:type indent: bool
|
||||
"""
|
||||
from .. import core as osc_core
|
||||
|
||||
if indent:
|
||||
osc_core.xmlindent(node)
|
||||
osc_core.ET.ElementTree(node).write(path)
|
||||
|
@ -1,7 +1,5 @@
|
||||
import functools
|
||||
|
||||
from .. import core as osc_core
|
||||
from .. import store as osc_store
|
||||
from . import api
|
||||
|
||||
|
||||
@ -40,6 +38,8 @@ class PackageBase:
|
||||
raise NotImplementedError
|
||||
|
||||
def _load_from_directory_node(self, directory_node):
|
||||
from .. import core as osc_core
|
||||
|
||||
# attributes
|
||||
self.rev = directory_node.get("rev")
|
||||
self.vrev = directory_node.get("vrev")
|
||||
@ -78,6 +78,8 @@ class ApiPackage(PackageBase):
|
||||
|
||||
class LocalPackage(PackageBase):
|
||||
def __init__(self, path):
|
||||
from .. import store as osc_store
|
||||
|
||||
self.dir = path
|
||||
self.store = osc_store.Store(self.dir)
|
||||
super().__init__(self.store.apiurl, self.store.project, self.store.package)
|
||||
|
@ -1,4 +1,3 @@
|
||||
from .. import core as osc_core
|
||||
from . import package as osc_package
|
||||
|
||||
|
||||
@ -6,6 +5,8 @@ def forward_request(apiurl, request, interactive=True):
|
||||
"""
|
||||
Forward the specified `request` to the projects the packages were branched from.
|
||||
"""
|
||||
from .. import core as osc_core
|
||||
|
||||
for action in request.get_actions("submit"):
|
||||
package = osc_package.ApiPackage(apiurl, action.tgt_project, action.tgt_package)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user