mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-09 12:35:48 +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):
|
def get(apiurl, path, query=None):
|
||||||
"""
|
"""
|
||||||
Send a GET request to OBS.
|
Send a GET request to OBS.
|
||||||
@ -21,6 +17,9 @@ def get(apiurl, path, query=None):
|
|||||||
:returns: Parsed XML root.
|
:returns: Parsed XML root.
|
||||||
:rtype: xml.etree.ElementTree.Element
|
:rtype: xml.etree.ElementTree.Element
|
||||||
"""
|
"""
|
||||||
|
from .. import connection as osc_connection
|
||||||
|
from .. import core as osc_core
|
||||||
|
|
||||||
assert apiurl
|
assert apiurl
|
||||||
assert path
|
assert path
|
||||||
|
|
||||||
@ -46,6 +45,9 @@ def post(apiurl, path, query=None):
|
|||||||
:returns: Parsed XML root.
|
:returns: Parsed XML root.
|
||||||
:rtype: xml.etree.ElementTree.Element
|
:rtype: xml.etree.ElementTree.Element
|
||||||
"""
|
"""
|
||||||
|
from .. import connection as osc_connection
|
||||||
|
from .. import core as osc_core
|
||||||
|
|
||||||
assert apiurl
|
assert apiurl
|
||||||
assert path
|
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.
|
:param indent: Whether to indent (pretty-print) the written XML.
|
||||||
:type indent: bool
|
:type indent: bool
|
||||||
"""
|
"""
|
||||||
|
from .. import core as osc_core
|
||||||
|
|
||||||
if indent:
|
if indent:
|
||||||
osc_core.xmlindent(node)
|
osc_core.xmlindent(node)
|
||||||
osc_core.ET.ElementTree(node).write(path)
|
osc_core.ET.ElementTree(node).write(path)
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import functools
|
import functools
|
||||||
|
|
||||||
from .. import core as osc_core
|
|
||||||
from .. import store as osc_store
|
|
||||||
from . import api
|
from . import api
|
||||||
|
|
||||||
|
|
||||||
@ -40,6 +38,8 @@ class PackageBase:
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def _load_from_directory_node(self, directory_node):
|
def _load_from_directory_node(self, directory_node):
|
||||||
|
from .. import core as osc_core
|
||||||
|
|
||||||
# attributes
|
# attributes
|
||||||
self.rev = directory_node.get("rev")
|
self.rev = directory_node.get("rev")
|
||||||
self.vrev = directory_node.get("vrev")
|
self.vrev = directory_node.get("vrev")
|
||||||
@ -78,6 +78,8 @@ class ApiPackage(PackageBase):
|
|||||||
|
|
||||||
class LocalPackage(PackageBase):
|
class LocalPackage(PackageBase):
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
|
from .. import store as osc_store
|
||||||
|
|
||||||
self.dir = path
|
self.dir = path
|
||||||
self.store = osc_store.Store(self.dir)
|
self.store = osc_store.Store(self.dir)
|
||||||
super().__init__(self.store.apiurl, self.store.project, self.store.package)
|
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
|
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.
|
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"):
|
for action in request.get_actions("submit"):
|
||||||
package = osc_package.ApiPackage(apiurl, action.tgt_project, action.tgt_package)
|
package = osc_package.ApiPackage(apiurl, action.tgt_project, action.tgt_package)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user