From 9c7cc87c5f7c7990085d73bfbd9318b89f003457 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 23 Oct 2019 16:05:27 +0300 Subject: [PATCH] Move command related modules to "commands" package --- platformio/builder/tools/piosize.py | 20 ++++++----- platformio/commands/__init__.py | 36 ++++++++----------- platformio/{ => commands}/check/__init__.py | 0 .../commands/{check.py => check/command.py} | 4 +-- platformio/{ => commands}/check/defect.py | 0 .../{ => commands}/check/tools/__init__.py | 4 +-- platformio/{ => commands}/check/tools/base.py | 2 +- .../{ => commands}/check/tools/clangtidy.py | 4 +-- .../{ => commands}/check/tools/cppcheck.py | 4 +-- platformio/commands/ci.py | 2 +- platformio/{ => commands}/debug/__init__.py | 0 platformio/{ => commands}/debug/client.py | 6 ++-- .../commands/{debug.py => debug/command.py} | 4 +-- platformio/{ => commands}/debug/helpers.py | 2 +- platformio/{ => commands}/debug/initcfgs.py | 0 platformio/{ => commands}/debug/process.py | 0 platformio/{ => commands}/debug/server.py | 2 +- platformio/{ => commands}/home/__init__.py | 0 .../commands/{home.py => home/command.py} | 16 ++++----- platformio/{ => commands}/home/helpers.py | 0 .../{ => commands}/home/rpc/__init__.py | 0 .../home/rpc/handlers/__init__.py | 0 .../{ => commands}/home/rpc/handlers/app.py | 0 .../{ => commands}/home/rpc/handlers/ide.py | 0 .../{ => commands}/home/rpc/handlers/misc.py | 2 +- .../{ => commands}/home/rpc/handlers/os.py | 2 +- .../home/rpc/handlers/piocore.py | 2 +- .../home/rpc/handlers/project.py | 4 +-- platformio/{ => commands}/home/rpc/server.py | 0 platformio/{ => commands}/home/web.py | 0 platformio/{ => commands}/run/__init__.py | 0 .../commands/{run.py => run/command.py} | 6 ++-- platformio/{ => commands}/run/helpers.py | 0 platformio/{ => commands}/run/processor.py | 2 +- platformio/{ => commands}/test/__init__.py | 0 .../commands/{test.py => test/command.py} | 4 +-- platformio/{ => commands}/test/embedded.py | 2 +- platformio/{ => commands}/test/native.py | 2 +- platformio/{ => commands}/test/processor.py | 2 +- platformio/project/helpers.py | 2 +- tests/commands/test_check.py | 2 +- tests/test_builder.py | 2 +- 42 files changed, 68 insertions(+), 72 deletions(-) rename platformio/{ => commands}/check/__init__.py (100%) rename platformio/commands/{check.py => check/command.py} (98%) rename platformio/{ => commands}/check/defect.py (100%) rename platformio/{ => commands}/check/tools/__init__.py (88%) rename platformio/{ => commands}/check/tools/base.py (98%) rename platformio/{ => commands}/check/tools/clangtidy.py (94%) rename platformio/{ => commands}/check/tools/cppcheck.py (97%) rename platformio/{ => commands}/debug/__init__.py (100%) rename platformio/{ => commands}/debug/client.py (98%) rename platformio/commands/{debug.py => debug/command.py} (97%) rename platformio/{ => commands}/debug/helpers.py (99%) rename platformio/{ => commands}/debug/initcfgs.py (100%) rename platformio/{ => commands}/debug/process.py (100%) rename platformio/{ => commands}/debug/server.py (98%) rename platformio/{ => commands}/home/__init__.py (100%) rename platformio/commands/{home.py => home/command.py} (86%) rename platformio/{ => commands}/home/helpers.py (100%) rename platformio/{ => commands}/home/rpc/__init__.py (100%) rename platformio/{ => commands}/home/rpc/handlers/__init__.py (100%) rename platformio/{ => commands}/home/rpc/handlers/app.py (100%) rename platformio/{ => commands}/home/rpc/handlers/ide.py (100%) rename platformio/{ => commands}/home/rpc/handlers/misc.py (97%) rename platformio/{ => commands}/home/rpc/handlers/os.py (99%) rename platformio/{ => commands}/home/rpc/handlers/piocore.py (99%) rename platformio/{ => commands}/home/rpc/handlers/project.py (98%) rename platformio/{ => commands}/home/rpc/server.py (100%) rename platformio/{ => commands}/home/web.py (100%) rename platformio/{ => commands}/run/__init__.py (100%) rename platformio/commands/{run.py => run/command.py} (97%) rename platformio/{ => commands}/run/helpers.py (100%) rename platformio/{ => commands}/run/processor.py (97%) rename platformio/{ => commands}/test/__init__.py (100%) rename platformio/commands/{test.py => test/command.py} (98%) rename platformio/{ => commands}/test/embedded.py (98%) rename platformio/{ => commands}/test/native.py (95%) rename platformio/{ => commands}/test/processor.py (98%) diff --git a/platformio/builder/tools/piosize.py b/platformio/builder/tools/piosize.py index 75fe944b..593375f1 100644 --- a/platformio/builder/tools/piosize.py +++ b/platformio/builder/tools/piosize.py @@ -18,7 +18,7 @@ from __future__ import absolute_import import sys from os import environ, makedirs, remove -from os.path import join, isdir +from os.path import isdir, join from elftools.elf.descriptions import describe_sh_flags from elftools.elf.elffile import ELFFile @@ -52,7 +52,7 @@ def _get_symbol_locations(env, elf_path, addrs): cmd = [env.subst("$CC").replace("-gcc", "-addr2line"), "-e", elf_path] result = _run_tool(cmd, env, addrs) locations = [line for line in result["out"].split("\n") if line] - assert(len(addrs) == len(locations)) + assert len(addrs) == len(locations) return dict(zip(addrs, [l.strip().replace("\\", "/") for l in locations])) @@ -61,12 +61,17 @@ def _get_demangled_names(env, mangled_names): if not mangled_names: return {} result = _run_tool( - [env.subst("$CC").replace("-gcc", "-c++filt")], env, mangled_names) + [env.subst("$CC").replace("-gcc", "-c++filt")], env, mangled_names + ) demangled_names = [line for line in result["out"].split("\n") if line] - assert(len(mangled_names) == len(demangled_names)) + assert len(mangled_names) == len(demangled_names) - return dict(zip(mangled_names, [dn.strip().replace( - "::__FUNCTION__", "") for dn in demangled_names])) + return dict( + zip( + mangled_names, + [dn.strip().replace("::__FUNCTION__", "") for dn in demangled_names], + ) + ) def _determine_section(sections, symbol_addr): @@ -150,8 +155,7 @@ def _collect_symbols_info(env, elffile, elf_path, sections): symbol_addrs.append(hex(symbol_addr)) symbols.append(symbol) - symbol_locations = _get_symbol_locations( - env, elf_path, symbol_addrs) + symbol_locations = _get_symbol_locations(env, elf_path, symbol_addrs) demangled_names = _get_demangled_names(env, mangled_names) for symbol in symbols: if symbol["name"].startswith("_Z"): diff --git a/platformio/commands/__init__.py b/platformio/commands/__init__.py index 961f4932..bc018f8c 100644 --- a/platformio/commands/__init__.py +++ b/platformio/commands/__init__.py @@ -13,7 +13,6 @@ # limitations under the License. import os -from os.path import dirname, isfile, join import click @@ -22,6 +21,10 @@ class PlatformioCLI(click.MultiCommand): leftover_args = [] + def __init__(self, *args, **kwargs): + super(PlatformioCLI, self).__init__(*args, **kwargs) + self._pio_cmds_dir = os.path.dirname(__file__) + @staticmethod def in_silence(): args = PlatformioCLI.leftover_args @@ -42,34 +45,23 @@ class PlatformioCLI(click.MultiCommand): def list_commands(self, ctx): cmds = [] - cmds_dir = dirname(__file__) - for name in os.listdir(cmds_dir): - if name.startswith("__init__"): + for cmd_name in os.listdir(self._pio_cmds_dir): + if cmd_name.startswith("__init__"): continue - if isfile(join(cmds_dir, name, "command.py")): - cmds.append(name) - elif name.endswith(".py"): - cmds.append(name[:-3]) + if os.path.isfile(os.path.join(self._pio_cmds_dir, cmd_name, "command.py")): + cmds.append(cmd_name) + elif cmd_name.endswith(".py"): + cmds.append(cmd_name[:-3]) cmds.sort() return cmds def get_command(self, ctx, cmd_name): mod = None try: - mod = __import__("platformio.commands." + cmd_name, None, None, ["cli"]) + mod_path = "platformio.commands." + cmd_name + if os.path.isfile(os.path.join(self._pio_cmds_dir, cmd_name, "command.py")): + mod_path = "platformio.commands.%s.command" % cmd_name + mod = __import__(mod_path, None, None, ["cli"]) except ImportError: raise click.UsageError('No such command "%s"' % cmd_name, ctx) return mod.cli - - @staticmethod - def _handle_obsolate_command(name): - # pylint: disable=import-outside-toplevel - if name == "platforms": - from platformio.commands import platform - - return platform.cli - if name == "serialports": - from platformio.commands import device - - return device.cli - raise AttributeError() diff --git a/platformio/check/__init__.py b/platformio/commands/check/__init__.py similarity index 100% rename from platformio/check/__init__.py rename to platformio/commands/check/__init__.py diff --git a/platformio/commands/check.py b/platformio/commands/check/command.py similarity index 98% rename from platformio/commands/check.py rename to platformio/commands/check/command.py index 614f60d1..d40058bc 100644 --- a/platformio/commands/check.py +++ b/platformio/commands/check/command.py @@ -24,8 +24,8 @@ import click from tabulate import tabulate from platformio import app, exception, fs, util -from platformio.check.defect import DefectItem -from platformio.check.tools import CheckToolFactory +from platformio.commands.check.defect import DefectItem +from platformio.commands.check.tools import CheckToolFactory from platformio.compat import dump_json_to_unicode from platformio.project.config import ProjectConfig from platformio.project.helpers import find_project_dir_above, get_project_dir diff --git a/platformio/check/defect.py b/platformio/commands/check/defect.py similarity index 100% rename from platformio/check/defect.py rename to platformio/commands/check/defect.py diff --git a/platformio/check/tools/__init__.py b/platformio/commands/check/tools/__init__.py similarity index 88% rename from platformio/check/tools/__init__.py rename to platformio/commands/check/tools/__init__.py index 0649e81d..4c8a5e72 100644 --- a/platformio/check/tools/__init__.py +++ b/platformio/commands/check/tools/__init__.py @@ -13,8 +13,8 @@ # limitations under the License. from platformio import exception -from platformio.check.tools.clangtidy import ClangtidyCheckTool -from platformio.check.tools.cppcheck import CppcheckCheckTool +from platformio.commands.check.tools.clangtidy import ClangtidyCheckTool +from platformio.commands.check.tools.cppcheck import CppcheckCheckTool class CheckToolFactory(object): diff --git a/platformio/check/tools/base.py b/platformio/commands/check/tools/base.py similarity index 98% rename from platformio/check/tools/base.py rename to platformio/commands/check/tools/base.py index 3306dd3c..78eac5dd 100644 --- a/platformio/check/tools/base.py +++ b/platformio/commands/check/tools/base.py @@ -15,7 +15,7 @@ import click from platformio import fs, proc -from platformio.check.defect import DefectItem +from platformio.commands.check.defect import DefectItem from platformio.project.helpers import get_project_dir, load_project_ide_data diff --git a/platformio/check/tools/clangtidy.py b/platformio/commands/check/tools/clangtidy.py similarity index 94% rename from platformio/check/tools/clangtidy.py rename to platformio/commands/check/tools/clangtidy.py index 36c00c26..20b4a5de 100644 --- a/platformio/check/tools/clangtidy.py +++ b/platformio/commands/check/tools/clangtidy.py @@ -15,8 +15,8 @@ import re from os.path import join -from platformio.check.defect import DefectItem -from platformio.check.tools.base import CheckToolBase +from platformio.commands.check.defect import DefectItem +from platformio.commands.check.tools.base import CheckToolBase from platformio.managers.core import get_core_package_dir diff --git a/platformio/check/tools/cppcheck.py b/platformio/commands/check/tools/cppcheck.py similarity index 97% rename from platformio/check/tools/cppcheck.py rename to platformio/commands/check/tools/cppcheck.py index aacb24f8..9eef560f 100644 --- a/platformio/check/tools/cppcheck.py +++ b/platformio/commands/check/tools/cppcheck.py @@ -16,8 +16,8 @@ from os import remove from os.path import isfile, join from tempfile import NamedTemporaryFile -from platformio.check.defect import DefectItem -from platformio.check.tools.base import CheckToolBase +from platformio.commands.check.defect import DefectItem +from platformio.commands.check.tools.base import CheckToolBase from platformio.managers.core import get_core_package_dir diff --git a/platformio/commands/ci.py b/platformio/commands/ci.py index 7228d001..4cdf227c 100644 --- a/platformio/commands/ci.py +++ b/platformio/commands/ci.py @@ -23,7 +23,7 @@ import click from platformio import app, fs from platformio.commands.init import cli as cmd_init from platformio.commands.init import validate_boards -from platformio.commands.run import cli as cmd_run +from platformio.commands.run.command import cli as cmd_run from platformio.compat import glob_escape from platformio.exception import CIBuildEnvsEmpty from platformio.project.config import ProjectConfig diff --git a/platformio/debug/__init__.py b/platformio/commands/debug/__init__.py similarity index 100% rename from platformio/debug/__init__.py rename to platformio/commands/debug/__init__.py diff --git a/platformio/debug/client.py b/platformio/commands/debug/client.py similarity index 98% rename from platformio/debug/client.py rename to platformio/commands/debug/client.py index eca409e5..990340e8 100644 --- a/platformio/debug/client.py +++ b/platformio/commands/debug/client.py @@ -27,10 +27,10 @@ from twisted.internet import stdio # pylint: disable=import-error from twisted.internet import task # pylint: disable=import-error from platformio import app, exception, fs, proc, util +from platformio.commands.debug import helpers, initcfgs +from platformio.commands.debug.process import BaseProcess +from platformio.commands.debug.server import DebugServer from platformio.compat import hashlib_encode_data -from platformio.debug import helpers, initcfgs -from platformio.debug.process import BaseProcess -from platformio.debug.server import DebugServer from platformio.project.helpers import get_project_cache_dir from platformio.telemetry import MeasurementProtocol diff --git a/platformio/commands/debug.py b/platformio/commands/debug/command.py similarity index 97% rename from platformio/commands/debug.py rename to platformio/commands/debug/command.py index 1fb1b8e7..c99cc548 100644 --- a/platformio/commands/debug.py +++ b/platformio/commands/debug/command.py @@ -22,7 +22,7 @@ from os.path import isfile import click from platformio import app, exception, fs, proc, util -from platformio.debug import helpers +from platformio.commands.debug import helpers from platformio.managers.core import inject_contrib_pysite from platformio.project.config import ProjectConfig from platformio.project.helpers import is_platformio_project, load_project_ide_data @@ -139,7 +139,7 @@ def cli(ctx, project_dir, project_conf, environment, verbose, interface, __unpro inject_contrib_pysite() # pylint: disable=import-outside-toplevel - from platformio.debug.client import GDBClient, reactor + from platformio.commands.debug.client import GDBClient, reactor client = GDBClient(project_dir, __unprocessed, debug_options, env_options) client.spawn(configuration["gdb_path"], configuration["prog_path"]) diff --git a/platformio/debug/helpers.py b/platformio/commands/debug/helpers.py similarity index 99% rename from platformio/debug/helpers.py rename to platformio/commands/debug/helpers.py index db396649..67255c46 100644 --- a/platformio/debug/helpers.py +++ b/platformio/commands/debug/helpers.py @@ -21,7 +21,7 @@ from os.path import isfile from platformio import exception, fs, util from platformio.commands.platform import platform_install as cmd_platform_install -from platformio.commands.run import cli as cmd_run +from platformio.commands.run.command import cli as cmd_run from platformio.managers.platform import PlatformFactory from platformio.project.config import ProjectConfig diff --git a/platformio/debug/initcfgs.py b/platformio/commands/debug/initcfgs.py similarity index 100% rename from platformio/debug/initcfgs.py rename to platformio/commands/debug/initcfgs.py diff --git a/platformio/debug/process.py b/platformio/commands/debug/process.py similarity index 100% rename from platformio/debug/process.py rename to platformio/commands/debug/process.py diff --git a/platformio/debug/server.py b/platformio/commands/debug/server.py similarity index 98% rename from platformio/debug/server.py rename to platformio/commands/debug/server.py index 49d730a0..18b39e41 100644 --- a/platformio/debug/server.py +++ b/platformio/commands/debug/server.py @@ -19,7 +19,7 @@ from twisted.internet import error # pylint: disable=import-error from twisted.internet import reactor # pylint: disable=import-error from platformio import exception, fs, util -from platformio.debug.process import BaseProcess +from platformio.commands.debug.process import BaseProcess from platformio.proc import where_is_program diff --git a/platformio/home/__init__.py b/platformio/commands/home/__init__.py similarity index 100% rename from platformio/home/__init__.py rename to platformio/commands/home/__init__.py diff --git a/platformio/commands/home.py b/platformio/commands/home/command.py similarity index 86% rename from platformio/commands/home.py rename to platformio/commands/home/command.py index 89bd9d01..a6340b5d 100644 --- a/platformio/commands/home.py +++ b/platformio/commands/home/command.py @@ -44,14 +44,14 @@ def cli(port, host, no_open): from twisted.internet import reactor from twisted.web import server - from platformio.home.rpc.handlers.app import AppRPC - from platformio.home.rpc.handlers.ide import IDERPC - from platformio.home.rpc.handlers.misc import MiscRPC - from platformio.home.rpc.handlers.os import OSRPC - from platformio.home.rpc.handlers.piocore import PIOCoreRPC - from platformio.home.rpc.handlers.project import ProjectRPC - from platformio.home.rpc.server import JSONRPCServerFactory - from platformio.home.web import WebRoot + from platformio.commands.home.rpc.handlers.app import AppRPC + from platformio.commands.home.rpc.handlers.ide import IDERPC + from platformio.commands.home.rpc.handlers.misc import MiscRPC + from platformio.commands.home.rpc.handlers.os import OSRPC + from platformio.commands.home.rpc.handlers.piocore import PIOCoreRPC + from platformio.commands.home.rpc.handlers.project import ProjectRPC + from platformio.commands.home.rpc.server import JSONRPCServerFactory + from platformio.commands.home.web import WebRoot factory = JSONRPCServerFactory() factory.addHandler(AppRPC(), namespace="app") diff --git a/platformio/home/helpers.py b/platformio/commands/home/helpers.py similarity index 100% rename from platformio/home/helpers.py rename to platformio/commands/home/helpers.py diff --git a/platformio/home/rpc/__init__.py b/platformio/commands/home/rpc/__init__.py similarity index 100% rename from platformio/home/rpc/__init__.py rename to platformio/commands/home/rpc/__init__.py diff --git a/platformio/home/rpc/handlers/__init__.py b/platformio/commands/home/rpc/handlers/__init__.py similarity index 100% rename from platformio/home/rpc/handlers/__init__.py rename to platformio/commands/home/rpc/handlers/__init__.py diff --git a/platformio/home/rpc/handlers/app.py b/platformio/commands/home/rpc/handlers/app.py similarity index 100% rename from platformio/home/rpc/handlers/app.py rename to platformio/commands/home/rpc/handlers/app.py diff --git a/platformio/home/rpc/handlers/ide.py b/platformio/commands/home/rpc/handlers/ide.py similarity index 100% rename from platformio/home/rpc/handlers/ide.py rename to platformio/commands/home/rpc/handlers/ide.py diff --git a/platformio/home/rpc/handlers/misc.py b/platformio/commands/home/rpc/handlers/misc.py similarity index 97% rename from platformio/home/rpc/handlers/misc.py rename to platformio/commands/home/rpc/handlers/misc.py index 5503cf8c..004c14a3 100644 --- a/platformio/home/rpc/handlers/misc.py +++ b/platformio/commands/home/rpc/handlers/misc.py @@ -18,7 +18,7 @@ import time from twisted.internet import defer, reactor # pylint: disable=import-error from platformio import app -from platformio.home.rpc.handlers.os import OSRPC +from platformio.commands.home.rpc.handlers.os import OSRPC class MiscRPC(object): diff --git a/platformio/home/rpc/handlers/os.py b/platformio/commands/home/rpc/handlers/os.py similarity index 99% rename from platformio/home/rpc/handlers/os.py rename to platformio/commands/home/rpc/handlers/os.py index 92f4a008..1be28fc8 100644 --- a/platformio/home/rpc/handlers/os.py +++ b/platformio/commands/home/rpc/handlers/os.py @@ -25,8 +25,8 @@ import click from twisted.internet import defer # pylint: disable=import-error from platformio import app, fs, util +from platformio.commands.home import helpers from platformio.compat import PY2, get_filesystem_encoding -from platformio.home import helpers class OSRPC(object): diff --git a/platformio/home/rpc/handlers/piocore.py b/platformio/commands/home/rpc/handlers/piocore.py similarity index 99% rename from platformio/home/rpc/handlers/piocore.py rename to platformio/commands/home/rpc/handlers/piocore.py index f2a692d0..9ef39a03 100644 --- a/platformio/home/rpc/handlers/piocore.py +++ b/platformio/commands/home/rpc/handlers/piocore.py @@ -26,8 +26,8 @@ from twisted.internet import threads # pylint: disable=import-error from twisted.internet import utils # pylint: disable=import-error from platformio import __main__, __version__, fs +from platformio.commands.home import helpers from platformio.compat import PY2, get_filesystem_encoding, is_bytes, string_types -from platformio.home import helpers try: from thread import get_ident as thread_get_ident diff --git a/platformio/home/rpc/handlers/project.py b/platformio/commands/home/rpc/handlers/project.py similarity index 98% rename from platformio/home/rpc/handlers/project.py rename to platformio/commands/home/rpc/handlers/project.py index 02c44e7e..b9e3948f 100644 --- a/platformio/home/rpc/handlers/project.py +++ b/platformio/commands/home/rpc/handlers/project.py @@ -22,9 +22,9 @@ from os.path import basename, getmtime, isdir, isfile, join, realpath, sep import jsonrpc # pylint: disable=import-error from platformio import exception, fs +from platformio.commands.home.rpc.handlers.app import AppRPC +from platformio.commands.home.rpc.handlers.piocore import PIOCoreRPC from platformio.compat import PY2, get_filesystem_encoding -from platformio.home.rpc.handlers.app import AppRPC -from platformio.home.rpc.handlers.piocore import PIOCoreRPC from platformio.ide.projectgenerator import ProjectGenerator from platformio.managers.platform import PlatformManager from platformio.project.config import ProjectConfig diff --git a/platformio/home/rpc/server.py b/platformio/commands/home/rpc/server.py similarity index 100% rename from platformio/home/rpc/server.py rename to platformio/commands/home/rpc/server.py diff --git a/platformio/home/web.py b/platformio/commands/home/web.py similarity index 100% rename from platformio/home/web.py rename to platformio/commands/home/web.py diff --git a/platformio/run/__init__.py b/platformio/commands/run/__init__.py similarity index 100% rename from platformio/run/__init__.py rename to platformio/commands/run/__init__.py diff --git a/platformio/commands/run.py b/platformio/commands/run/command.py similarity index 97% rename from platformio/commands/run.py rename to platformio/commands/run/command.py index e378c528..5058c159 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run/command.py @@ -22,11 +22,11 @@ from tabulate import tabulate from platformio import app, exception, fs, util from platformio.commands.device import device_monitor as cmd_device_monitor +from platformio.commands.run.helpers import clean_build_dir, handle_legacy_libdeps +from platformio.commands.run.processor import EnvironmentProcessor +from platformio.commands.test.processor import CTX_META_TEST_IS_RUNNING from platformio.project.config import ProjectConfig from platformio.project.helpers import find_project_dir_above -from platformio.run.helpers import clean_build_dir, handle_legacy_libdeps -from platformio.run.processor import EnvironmentProcessor -from platformio.test.processor import CTX_META_TEST_IS_RUNNING # pylint: disable=too-many-arguments,too-many-locals,too-many-branches diff --git a/platformio/run/helpers.py b/platformio/commands/run/helpers.py similarity index 100% rename from platformio/run/helpers.py rename to platformio/commands/run/helpers.py diff --git a/platformio/run/processor.py b/platformio/commands/run/processor.py similarity index 97% rename from platformio/run/processor.py rename to platformio/commands/run/processor.py index 6b7a9e20..3366c1e1 100644 --- a/platformio/run/processor.py +++ b/platformio/commands/run/processor.py @@ -14,8 +14,8 @@ from platformio import exception, telemetry from platformio.commands.platform import platform_install as cmd_platform_install +from platformio.commands.test.processor import CTX_META_TEST_RUNNING_NAME from platformio.managers.platform import PlatformFactory -from platformio.test.processor import CTX_META_TEST_RUNNING_NAME # pylint: disable=too-many-instance-attributes diff --git a/platformio/test/__init__.py b/platformio/commands/test/__init__.py similarity index 100% rename from platformio/test/__init__.py rename to platformio/commands/test/__init__.py diff --git a/platformio/commands/test.py b/platformio/commands/test/command.py similarity index 98% rename from platformio/commands/test.py rename to platformio/commands/test/command.py index 49b188df..cb1c8117 100644 --- a/platformio/commands/test.py +++ b/platformio/commands/test/command.py @@ -23,9 +23,9 @@ import click from tabulate import tabulate from platformio import app, exception, fs, util +from platformio.commands.test.embedded import EmbeddedTestProcessor +from platformio.commands.test.native import NativeTestProcessor from platformio.project.config import ProjectConfig -from platformio.test.embedded import EmbeddedTestProcessor -from platformio.test.native import NativeTestProcessor @click.command("test", short_help="Unit Testing") diff --git a/platformio/test/embedded.py b/platformio/commands/test/embedded.py similarity index 98% rename from platformio/test/embedded.py rename to platformio/commands/test/embedded.py index 6c6726e2..dc0d9ef0 100644 --- a/platformio/test/embedded.py +++ b/platformio/commands/test/embedded.py @@ -18,8 +18,8 @@ import click import serial from platformio import exception, util +from platformio.commands.test.processor import TestProcessorBase from platformio.managers.platform import PlatformFactory -from platformio.test.processor import TestProcessorBase class EmbeddedTestProcessor(TestProcessorBase): diff --git a/platformio/test/native.py b/platformio/commands/test/native.py similarity index 95% rename from platformio/test/native.py rename to platformio/commands/test/native.py index f028e4f3..a73c03fe 100644 --- a/platformio/test/native.py +++ b/platformio/commands/test/native.py @@ -15,8 +15,8 @@ from os.path import join from platformio import proc +from platformio.commands.test.processor import TestProcessorBase from platformio.proc import LineBufferedAsyncPipe -from platformio.test.processor import TestProcessorBase class NativeTestProcessor(TestProcessorBase): diff --git a/platformio/test/processor.py b/platformio/commands/test/processor.py similarity index 98% rename from platformio/test/processor.py rename to platformio/commands/test/processor.py index 6c900934..ed4f935c 100644 --- a/platformio/test/processor.py +++ b/platformio/commands/test/processor.py @@ -113,7 +113,7 @@ class TestProcessorBase(object): try: # pylint: disable=import-outside-toplevel - from platformio.commands.run import cli as cmd_run + from platformio.commands.run.command import cli as cmd_run return self.cmd_ctx.invoke( cmd_run, diff --git a/platformio/project/helpers.py b/platformio/project/helpers.py index deeeb6c2..642e1a7e 100644 --- a/platformio/project/helpers.py +++ b/platformio/project/helpers.py @@ -137,7 +137,7 @@ def compute_project_checksum(config): def load_project_ide_data(project_dir, env_or_envs): # pylint: disable=import-outside-toplevel - from platformio.commands.run import cli as cmd_run + from platformio.commands.run.command import cli as cmd_run assert env_or_envs envs = env_or_envs diff --git a/tests/commands/test_check.py b/tests/commands/test_check.py index e4bb6db9..fbb5b881 100644 --- a/tests/commands/test_check.py +++ b/tests/commands/test_check.py @@ -17,7 +17,7 @@ from os.path import isfile, join import pytest -from platformio.commands.check import cli as cmd_check +from platformio.commands.check.command import cli as cmd_check DEFAULT_CONFIG = """ [env:native] diff --git a/tests/test_builder.py b/tests/test_builder.py index d4f8012f..9dec2e0f 100644 --- a/tests/test_builder.py +++ b/tests/test_builder.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from platformio.commands.run import cli as cmd_run +from platformio.commands.run.command import cli as cmd_run def test_build_flags(clirunner, validate_cliresult, tmpdir):