From 717010d9b41f7b827ad463f6f593937064cc24c3 Mon Sep 17 00:00:00 2001 From: ldericher Date: Wed, 19 Aug 2020 17:15:00 +0200 Subject: [PATCH] move utils package into top level --- src/kiwi/{subcommands/utils => }/executable.py | 2 +- src/kiwi/{subcommands/utils => }/misc.py | 0 src/kiwi/{subcommands/utils => }/project.py | 4 ++-- src/kiwi/{subcommands/utils => }/rootkit.py | 4 +--- src/kiwi/runner.py | 2 +- src/kiwi/subcommands/_subcommand.py | 4 +--- src/kiwi/subcommands/conf.py | 5 ++--- src/kiwi/subcommands/disable.py | 1 - src/kiwi/subcommands/down.py | 2 +- src/kiwi/subcommands/enable.py | 1 - src/kiwi/subcommands/list.py | 4 +++- src/kiwi/subcommands/net.py | 4 ++-- src/kiwi/subcommands/new.py | 1 - src/kiwi/subcommands/update.py | 4 +++- src/kiwi/subcommands/utils/__init__.py | 1 - 15 files changed, 17 insertions(+), 22 deletions(-) rename src/kiwi/{subcommands/utils => }/executable.py (98%) rename src/kiwi/{subcommands/utils => }/misc.py (100%) rename src/kiwi/{subcommands/utils => }/project.py (98%) rename src/kiwi/{subcommands/utils => }/rootkit.py (96%) delete mode 100644 src/kiwi/subcommands/utils/__init__.py diff --git a/src/kiwi/subcommands/utils/executable.py b/src/kiwi/executable.py similarity index 98% rename from src/kiwi/subcommands/utils/executable.py rename to src/kiwi/executable.py index 7f2a537..4681f92 100644 --- a/src/kiwi/subcommands/utils/executable.py +++ b/src/kiwi/executable.py @@ -4,7 +4,7 @@ import os import subprocess # parent -from ...config import LoadedConfig +from .config import LoadedConfig def _update_kwargs(**kwargs): diff --git a/src/kiwi/subcommands/utils/misc.py b/src/kiwi/misc.py similarity index 100% rename from src/kiwi/subcommands/utils/misc.py rename to src/kiwi/misc.py diff --git a/src/kiwi/subcommands/utils/project.py b/src/kiwi/project.py similarity index 98% rename from src/kiwi/subcommands/utils/project.py rename to src/kiwi/project.py index 1037770..60e1beb 100644 --- a/src/kiwi/subcommands/utils/project.py +++ b/src/kiwi/project.py @@ -3,8 +3,8 @@ import os from .executable import Executable -from ..._constants import CONF_DIRECTORY_NAME -from ...config import LoadedConfig +from ._constants import CONF_DIRECTORY_NAME +from .config import LoadedConfig class Project: diff --git a/src/kiwi/subcommands/utils/rootkit.py b/src/kiwi/rootkit.py similarity index 96% rename from src/kiwi/subcommands/utils/rootkit.py rename to src/kiwi/rootkit.py index c286030..a3c7937 100644 --- a/src/kiwi/subcommands/utils/rootkit.py +++ b/src/kiwi/rootkit.py @@ -4,11 +4,9 @@ import os import subprocess # local +from ._constants import IMAGES_DIRECTORY_NAME, LOCAL_IMAGES_NAME, DEFAULT_IMAGE_NAME from .executable import Executable -# parent -from ..._constants import IMAGES_DIRECTORY_NAME, LOCAL_IMAGES_NAME, DEFAULT_IMAGE_NAME - def _prefix_path(prefix, path): if isinstance(path, str): diff --git a/src/kiwi/runner.py b/src/kiwi/runner.py index 3fba2c9..9f4058d 100644 --- a/src/kiwi/runner.py +++ b/src/kiwi/runner.py @@ -4,7 +4,7 @@ import subprocess # local from . import subcommands -from .subcommands.utils.executable import Executable +from .executable import Executable from .parser import Parser diff --git a/src/kiwi/subcommands/_subcommand.py b/src/kiwi/subcommands/_subcommand.py index dccb00d..1925bc7 100644 --- a/src/kiwi/subcommands/_subcommand.py +++ b/src/kiwi/subcommands/_subcommand.py @@ -2,11 +2,9 @@ import logging import os -# local -from .utils.project import Projects - # parent from ..parser import Parser +from ..project import Projects class SubCommand: diff --git a/src/kiwi/subcommands/conf.py b/src/kiwi/subcommands/conf.py index 3030b98..0d590d1 100644 --- a/src/kiwi/subcommands/conf.py +++ b/src/kiwi/subcommands/conf.py @@ -1,16 +1,15 @@ # system import logging -import os import subprocess # local from ._subcommand import SubCommand -from .utils.project import Projects -from .utils.rootkit import Rootkit, prefix_path_mnt # parent from .._constants import CONF_DIRECTORY_NAME from ..config import LoadedConfig +from ..project import Projects +from ..rootkit import Rootkit, prefix_path_mnt class ConfCopyCommand(SubCommand): diff --git a/src/kiwi/subcommands/disable.py b/src/kiwi/subcommands/disable.py index f2e9362..82f8e5c 100644 --- a/src/kiwi/subcommands/disable.py +++ b/src/kiwi/subcommands/disable.py @@ -1,5 +1,4 @@ # local -from .utils.project import Projects from ._subcommand import ProjectCommand diff --git a/src/kiwi/subcommands/down.py b/src/kiwi/subcommands/down.py index 6023919..cd838fb 100644 --- a/src/kiwi/subcommands/down.py +++ b/src/kiwi/subcommands/down.py @@ -1,6 +1,6 @@ # local from ._subcommand import ServiceCommand -from .utils.misc import are_you_sure +from ..misc import are_you_sure class DownCommand(ServiceCommand): diff --git a/src/kiwi/subcommands/enable.py b/src/kiwi/subcommands/enable.py index 9432bdf..d0ea8a0 100644 --- a/src/kiwi/subcommands/enable.py +++ b/src/kiwi/subcommands/enable.py @@ -1,5 +1,4 @@ # local -from .utils.project import Projects from ._subcommand import ProjectCommand diff --git a/src/kiwi/subcommands/list.py b/src/kiwi/subcommands/list.py index df8068c..406ecb9 100644 --- a/src/kiwi/subcommands/list.py +++ b/src/kiwi/subcommands/list.py @@ -5,7 +5,9 @@ import yaml # local from ._subcommand import ServiceCommand -from .utils.project import Project, Projects + +# parent +from ..project import Project, Projects def _print_list(strings): diff --git a/src/kiwi/subcommands/net.py b/src/kiwi/subcommands/net.py index 8a630b1..30a25ad 100644 --- a/src/kiwi/subcommands/net.py +++ b/src/kiwi/subcommands/net.py @@ -4,11 +4,11 @@ import subprocess # local from ._subcommand import SubCommand -from .utils.executable import Executable -from .utils.misc import are_you_sure # parent from ..config import LoadedConfig +from ..executable import Executable +from ..misc import are_you_sure def _find_net(net_name): diff --git a/src/kiwi/subcommands/new.py b/src/kiwi/subcommands/new.py index e92142c..9571ebe 100644 --- a/src/kiwi/subcommands/new.py +++ b/src/kiwi/subcommands/new.py @@ -4,7 +4,6 @@ import os import shutil # local -from .utils.project import Projects from ._subcommand import ProjectCommand # parent diff --git a/src/kiwi/subcommands/update.py b/src/kiwi/subcommands/update.py index ccb58a3..5335e37 100644 --- a/src/kiwi/subcommands/update.py +++ b/src/kiwi/subcommands/update.py @@ -1,6 +1,8 @@ # local from ._subcommand import ServiceCommand -from .utils.misc import are_you_sure + +# parent +from ..misc import are_you_sure class UpdateCommand(ServiceCommand): diff --git a/src/kiwi/subcommands/utils/__init__.py b/src/kiwi/subcommands/utils/__init__.py deleted file mode 100644 index 5a65bd6..0000000 --- a/src/kiwi/subcommands/utils/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# git keep