Skip to content

Commit

Permalink
refactor: move messages and bridge modules
Browse files Browse the repository at this point in the history
  • Loading branch information
seppzer0 committed Mar 5, 2024
1 parent 4fa05af commit 52ec353
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RUN python3 -m pip install pip --upgrade && \
# This significantly reduces the total build time, as each time we make a build call for a device,
# only device-specific kernel source is being downloaded into the container.
#
RUN python3 ${WDIR}/wrapper/bridge.py --shared
RUN python3 ${WDIR}/wrapper/utils/bridge.py --shared

# launch app
CMD [ "/bin/bash" ]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from wrapper.utils import messages as msg
from wrapper.tools import messages as msg


def test__message_note__validate(capfd):
Expand Down
3 changes: 1 addition & 2 deletions wrapper/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import json
import argparse

from wrapper.tools import cleaning as cm
from wrapper.utils import messages as msg
from wrapper.tools import cleaning as cm, messages as msg
from wrapper.configs import ArgumentConfig, DirectoryConfig as dcfg
from wrapper.engines import DockerEngine, PodmanEngine
from wrapper.commands import KernelCommand, AssetsCommand, BundleCommand
Expand Down
3 changes: 1 addition & 2 deletions wrapper/clients/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from typing import Optional
from pydantic import BaseModel

from wrapper.tools import cleaning as cm, commands as ccmd
from wrapper.utils import messages as msg
from wrapper.tools import cleaning as cm, commands as ccmd, messages as msg
from wrapper.configs import DirectoryConfig as dcfg


Expand Down
2 changes: 1 addition & 1 deletion wrapper/clients/rom_api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import requests
from pydantic import BaseModel

from wrapper.utils import messages as msg
from wrapper.tools import messages as msg
from wrapper.interfaces import IRomApi


Expand Down
3 changes: 1 addition & 2 deletions wrapper/commands/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from pydantic import BaseModel

from wrapper.core import KernelBuilder, AssetsCollector
from wrapper.tools import cleaning as cm, commands as ccmd, fileoperations as fo
from wrapper.utils import messages as msg
from wrapper.tools import cleaning as cm, commands as ccmd, fileoperations as fo, messages as msg
from wrapper.configs import DirectoryConfig as dcfg
from wrapper.interfaces import IBundleCommand

Expand Down
3 changes: 1 addition & 2 deletions wrapper/configs/argument_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from typing import Optional
from pydantic import BaseModel

from wrapper.tools import commands as ccmd
from wrapper.utils import messages as msg
from wrapper.tools import commands as ccmd, messages as msg


class ArgumentConfig(BaseModel):
Expand Down
3 changes: 1 addition & 2 deletions wrapper/core/assets_collector.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os
from pydantic import BaseModel

from wrapper.tools import cleaning as cm, fileoperations as fo
from wrapper.utils import messages as msg
from wrapper.tools import cleaning as cm, fileoperations as fo, messages as msg
from wrapper.clients import GitHubApi, LineageOsApi, ParanoidAndroidApi
from wrapper.configs import DirectoryConfig as dcfg
from wrapper.interfaces import IAssetsCollector
Expand Down
4 changes: 2 additions & 2 deletions wrapper/core/kernel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from pathlib import Path
from pydantic import BaseModel

from wrapper.tools import cleaning as cm, commands as ccmd, fileoperations as fo
from wrapper.utils import ResourceManager, messages as msg
from wrapper.tools import cleaning as cm, commands as ccmd, fileoperations as fo, messages as msg
from wrapper.utils import ResourceManager
from wrapper.configs import DirectoryConfig as dcfg
from wrapper.interfaces import IKernelBuilder

Expand Down
5 changes: 2 additions & 3 deletions wrapper/engines/container_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from pydantic import BaseModel
from subprocess import CompletedProcess

from wrapper.tools import commands as ccmd
from wrapper.utils import messages as msg
from wrapper.tools import commands as ccmd, messages as msg
from wrapper.configs import DirectoryConfig as dcfg
from wrapper.interfaces import IContainerEngine

Expand Down Expand Up @@ -70,7 +69,7 @@ def dir_bundle_conan(self) -> Path:
@property
def wrapper_cmd(self) -> str:
# prepare launch command
cmd = f"python3 {Path('wrapper', 'bridge.py')}"
cmd = f"python3 {Path('wrapper', 'utils', 'bridge.py')}"
arguments = {
"--command": self.command,
"--codename": self.codename,
Expand Down
3 changes: 1 addition & 2 deletions wrapper/engines/docker_engine.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os
from typing import override

from wrapper.tools import commands as ccmd
from wrapper.utils import messages as msg
from wrapper.tools import commands as ccmd, messages as msg
from wrapper.interfaces import IDockerEngine

from wrapper.engines.container_engine import ContainerEngine
Expand Down
1 change: 1 addition & 0 deletions wrapper/tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .cleaning import remove, git, root
from .commands import launch
from .fileoperations import ucopy, download
from .messages import banner, note, error, cancel, done, outputstream
2 changes: 1 addition & 1 deletion wrapper/tools/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import subprocess
from subprocess import CompletedProcess

from wrapper.utils import messages as msg
from wrapper.tools import messages as msg


def launch(
Expand Down
3 changes: 1 addition & 2 deletions wrapper/tools/fileoperations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from typing import Tuple
from pathlib import Path

from wrapper.tools import commands as ccmd
from wrapper.utils import messages as msg
from wrapper.tools import commands as ccmd, messages as msg


def ucopy(src: Path, dst: Path, exceptions: Tuple[str] = ()) -> None:
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion wrapper/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from .resource_manager import ResourceManager
from .messages import banner, note, error, cancel, done, outputstream
3 changes: 2 additions & 1 deletion wrapper/bridge.py → wrapper/utils/bridge.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import sys
import argparse

from wrapper.utils import messages as msg, ResourceManager
from wrapper.tools import messages as msg
from wrapper.utils import ResourceManager
from wrapper.commands import KernelCommand, AssetsCommand, BundleCommand


Expand Down
3 changes: 1 addition & 2 deletions wrapper/utils/resource_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import tarfile
from typing import Optional

from wrapper.tools import cleaning as cm, commands as ccmd, fileoperations as fo
from wrapper.utils import messages as msg
from wrapper.tools import cleaning as cm, commands as ccmd, fileoperations as fo, messages as msg
from wrapper.configs import DirectoryConfig as dcfg


Expand Down

0 comments on commit 52ec353

Please sign in to comment.