mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virtinst: Switch to relative imports, fix cyclic import warnings
This commit is contained in:
@@ -53,14 +53,10 @@ class parser_class(object):
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
from virtconv.vmx import vmx_parser as _vmx_parser
|
||||
from virtconv.ovf import ovf_parser as _ovf_parser
|
||||
|
||||
|
||||
_parsers = [
|
||||
_vmx_parser,
|
||||
_ovf_parser,
|
||||
]
|
||||
def _get_parsers():
|
||||
from .vmx import vmx_parser
|
||||
from .ovf import ovf_parser
|
||||
return [vmx_parser, ovf_parser]
|
||||
|
||||
|
||||
def _is_test():
|
||||
@@ -71,7 +67,7 @@ def _find_parser_by_name(input_name):
|
||||
"""
|
||||
Return the parser of the given name.
|
||||
"""
|
||||
parsers = [p for p in _parsers if p.name == input_name]
|
||||
parsers = [p for p in _get_parsers() if p.name == input_name]
|
||||
if len(parsers):
|
||||
return parsers[0]
|
||||
raise RuntimeError(_("No parser found for type '%s'") % input_name)
|
||||
@@ -81,7 +77,7 @@ def _find_parser_by_file(input_file):
|
||||
"""
|
||||
Return the parser that is capable of comprehending the given file.
|
||||
"""
|
||||
for p in _parsers:
|
||||
for p in _get_parsers():
|
||||
if p.identify_file(input_file):
|
||||
return p
|
||||
raise RuntimeError(_("Don't know how to parse file %s") % input_file)
|
||||
@@ -155,7 +151,7 @@ def _find_input(input_file, parser, print_cb):
|
||||
parser = _find_parser_by_file(input_file)
|
||||
return input_file, parser, force_clean
|
||||
|
||||
parsers = parser and [parser] or _parsers
|
||||
parsers = parser and [parser] or _get_parsers()
|
||||
for root, ignore, files in os.walk(input_file):
|
||||
for p in parsers:
|
||||
for f in [f for f in files if f.endswith(p.suffix)]:
|
||||
|
||||
@@ -25,7 +25,7 @@ import libxml2
|
||||
|
||||
import virtinst
|
||||
|
||||
from virtconv.formats import parser_class
|
||||
from .formats import parser_class
|
||||
|
||||
|
||||
# Mapping of ResourceType value to device type
|
||||
|
||||
@@ -27,7 +27,7 @@ import shlex
|
||||
import virtinst
|
||||
from virtinst import util
|
||||
|
||||
from virtconv.formats import parser_class
|
||||
from .formats import parser_class
|
||||
|
||||
|
||||
class _VMXLine(object):
|
||||
|
||||
Reference in New Issue
Block a user