mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 01:57:13 +02:00
Format code with Black 23.1.0
This commit is contained in:
@ -21,22 +21,18 @@ from platformio.http import HTTPClient, HTTPClientError
|
|||||||
|
|
||||||
|
|
||||||
class AccountError(PlatformioException):
|
class AccountError(PlatformioException):
|
||||||
|
|
||||||
MESSAGE = "{0}"
|
MESSAGE = "{0}"
|
||||||
|
|
||||||
|
|
||||||
class AccountNotAuthorized(AccountError):
|
class AccountNotAuthorized(AccountError):
|
||||||
|
|
||||||
MESSAGE = "You are not authorized! Please log in to PlatformIO Account."
|
MESSAGE = "You are not authorized! Please log in to PlatformIO Account."
|
||||||
|
|
||||||
|
|
||||||
class AccountAlreadyAuthorized(AccountError):
|
class AccountAlreadyAuthorized(AccountError):
|
||||||
|
|
||||||
MESSAGE = "You are already authorized with {0} account."
|
MESSAGE = "You are already authorized with {0} account."
|
||||||
|
|
||||||
|
|
||||||
class AccountClient(HTTPClient): # pylint:disable=too-many-public-methods
|
class AccountClient(HTTPClient): # pylint:disable=too-many-public-methods
|
||||||
|
|
||||||
SUMMARY_CACHE_TTL = 60 * 60 * 24 * 7
|
SUMMARY_CACHE_TTL = 60 * 60 * 24 * 7
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -25,7 +25,6 @@ from platformio.compat import get_filesystem_encoding, get_locale_encoding
|
|||||||
|
|
||||||
|
|
||||||
class InoToCPPConverter:
|
class InoToCPPConverter:
|
||||||
|
|
||||||
PROTOTYPE_RE = re.compile(
|
PROTOTYPE_RE = re.compile(
|
||||||
r"""^(
|
r"""^(
|
||||||
(?:template\<.*\>\s*)? # template
|
(?:template\<.*\>\s*)? # template
|
||||||
|
@ -109,7 +109,6 @@ class LibBuilderFactory:
|
|||||||
|
|
||||||
|
|
||||||
class LibBuilderBase:
|
class LibBuilderBase:
|
||||||
|
|
||||||
CLASSIC_SCANNER = SCons.Scanner.C.CScanner()
|
CLASSIC_SCANNER = SCons.Scanner.C.CScanner()
|
||||||
CCONDITIONAL_SCANNER = SCons.Scanner.C.CConditionalScanner()
|
CCONDITIONAL_SCANNER = SCons.Scanner.C.CConditionalScanner()
|
||||||
# Max depth of nested includes:
|
# Max depth of nested includes:
|
||||||
|
@ -24,7 +24,6 @@ from platformio.project.helpers import get_project_dir
|
|||||||
|
|
||||||
|
|
||||||
class DefectItem:
|
class DefectItem:
|
||||||
|
|
||||||
SEVERITY_HIGH = 1
|
SEVERITY_HIGH = 1
|
||||||
SEVERITY_MEDIUM = 2
|
SEVERITY_MEDIUM = 2
|
||||||
SEVERITY_LOW = 4
|
SEVERITY_LOW = 4
|
||||||
|
@ -19,7 +19,6 @@ import click
|
|||||||
|
|
||||||
|
|
||||||
class PlatformioCLI(click.MultiCommand):
|
class PlatformioCLI(click.MultiCommand):
|
||||||
|
|
||||||
leftover_args = []
|
leftover_args = []
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
@ -42,7 +42,7 @@ def cli(query, installed, json_output): # pylint: disable=R0912
|
|||||||
grpboards[board["platform"]].append(board)
|
grpboards[board["platform"]].append(board)
|
||||||
|
|
||||||
terminal_width = shutil.get_terminal_size().columns
|
terminal_width = shutil.get_terminal_size().columns
|
||||||
for (platform, boards) in sorted(grpboards.items()):
|
for platform, boards in sorted(grpboards.items()):
|
||||||
click.echo("")
|
click.echo("")
|
||||||
click.echo("Platform: ", nl=False)
|
click.echo("Platform: ", nl=False)
|
||||||
click.secho(platform, bold=True)
|
click.secho(platform, bold=True)
|
||||||
|
@ -18,7 +18,6 @@ from platformio.device.finder import SerialPortFinder, is_pattern_port
|
|||||||
|
|
||||||
|
|
||||||
class BlackmagicDebugConfig(DebugConfigBase):
|
class BlackmagicDebugConfig(DebugConfigBase):
|
||||||
|
|
||||||
GDB_INIT_SCRIPT = """
|
GDB_INIT_SCRIPT = """
|
||||||
define pio_reset_halt_target
|
define pio_reset_halt_target
|
||||||
set language c
|
set language c
|
||||||
|
@ -16,7 +16,6 @@ from platformio.debug.config.base import DebugConfigBase
|
|||||||
|
|
||||||
|
|
||||||
class GenericDebugConfig(DebugConfigBase):
|
class GenericDebugConfig(DebugConfigBase):
|
||||||
|
|
||||||
GDB_INIT_SCRIPT = """
|
GDB_INIT_SCRIPT = """
|
||||||
define pio_reset_halt_target
|
define pio_reset_halt_target
|
||||||
monitor reset halt
|
monitor reset halt
|
||||||
|
@ -16,7 +16,6 @@ from platformio.debug.config.base import DebugConfigBase
|
|||||||
|
|
||||||
|
|
||||||
class JlinkDebugConfig(DebugConfigBase):
|
class JlinkDebugConfig(DebugConfigBase):
|
||||||
|
|
||||||
GDB_INIT_SCRIPT = """
|
GDB_INIT_SCRIPT = """
|
||||||
define pio_reset_halt_target
|
define pio_reset_halt_target
|
||||||
monitor reset
|
monitor reset
|
||||||
|
@ -16,7 +16,6 @@ from platformio.debug.config.base import DebugConfigBase
|
|||||||
|
|
||||||
|
|
||||||
class MspdebugDebugConfig(DebugConfigBase):
|
class MspdebugDebugConfig(DebugConfigBase):
|
||||||
|
|
||||||
GDB_INIT_SCRIPT = """
|
GDB_INIT_SCRIPT = """
|
||||||
define pio_reset_halt_target
|
define pio_reset_halt_target
|
||||||
end
|
end
|
||||||
|
@ -17,7 +17,6 @@ from platformio.debug.config.base import DebugConfigBase
|
|||||||
|
|
||||||
|
|
||||||
class NativeDebugConfig(DebugConfigBase):
|
class NativeDebugConfig(DebugConfigBase):
|
||||||
|
|
||||||
GDB_INIT_SCRIPT = """
|
GDB_INIT_SCRIPT = """
|
||||||
define pio_reset_halt_target
|
define pio_reset_halt_target
|
||||||
end
|
end
|
||||||
|
@ -16,7 +16,6 @@ from platformio.debug.config.base import DebugConfigBase
|
|||||||
|
|
||||||
|
|
||||||
class QemuDebugConfig(DebugConfigBase):
|
class QemuDebugConfig(DebugConfigBase):
|
||||||
|
|
||||||
GDB_INIT_SCRIPT = """
|
GDB_INIT_SCRIPT = """
|
||||||
define pio_reset_halt_target
|
define pio_reset_halt_target
|
||||||
monitor system_reset
|
monitor system_reset
|
||||||
|
@ -16,7 +16,6 @@ from platformio.debug.config.base import DebugConfigBase
|
|||||||
|
|
||||||
|
|
||||||
class RenodeDebugConfig(DebugConfigBase):
|
class RenodeDebugConfig(DebugConfigBase):
|
||||||
|
|
||||||
GDB_INIT_SCRIPT = """
|
GDB_INIT_SCRIPT = """
|
||||||
define pio_reset_halt_target
|
define pio_reset_halt_target
|
||||||
monitor machine Reset
|
monitor machine Reset
|
||||||
|
@ -20,7 +20,6 @@ class DebugError(PlatformioException):
|
|||||||
|
|
||||||
|
|
||||||
class DebugSupportError(DebugError, UserSideException):
|
class DebugSupportError(DebugError, UserSideException):
|
||||||
|
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"Currently, PlatformIO does not support debugging for `{0}`.\n"
|
"Currently, PlatformIO does not support debugging for `{0}`.\n"
|
||||||
"Please request support at https://github.com/platformio/"
|
"Please request support at https://github.com/platformio/"
|
||||||
|
@ -31,7 +31,6 @@ from platformio.test.runners.factory import TestRunnerFactory
|
|||||||
|
|
||||||
|
|
||||||
class GDBMIConsoleStream(BytesIO): # pylint: disable=too-few-public-methods
|
class GDBMIConsoleStream(BytesIO): # pylint: disable=too-few-public-methods
|
||||||
|
|
||||||
STDOUT = sys.stdout
|
STDOUT = sys.stdout
|
||||||
|
|
||||||
def write(self, text):
|
def write(self, text):
|
||||||
|
@ -53,7 +53,6 @@ class DebugSubprocessProtocol(asyncio.SubprocessProtocol):
|
|||||||
|
|
||||||
|
|
||||||
class DebugBaseProcess:
|
class DebugBaseProcess:
|
||||||
|
|
||||||
STDOUT_CHUNK_SIZE = 2048
|
STDOUT_CHUNK_SIZE = 2048
|
||||||
LOG_FILE = None
|
LOG_FILE = None
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ from platformio.debug.process.client import DebugClientProcess
|
|||||||
|
|
||||||
|
|
||||||
class GDBClientProcess(DebugClientProcess):
|
class GDBClientProcess(DebugClientProcess):
|
||||||
|
|
||||||
PIO_SRC_NAME = ".pioinit"
|
PIO_SRC_NAME = ".pioinit"
|
||||||
INIT_COMPLETED_BANNER = "PlatformIO: Initialization completed"
|
INIT_COMPLETED_BANNER = "PlatformIO: Initialization completed"
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ from platformio.proc import where_is_program
|
|||||||
|
|
||||||
|
|
||||||
class DebugServerProcess(DebugBaseProcess):
|
class DebugServerProcess(DebugBaseProcess):
|
||||||
|
|
||||||
STD_BUFFER_SIZE = 1024
|
STD_BUFFER_SIZE = 1024
|
||||||
|
|
||||||
def __init__(self, debug_config):
|
def __init__(self, debug_config):
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
|
|
||||||
class PlatformioException(Exception):
|
class PlatformioException(Exception):
|
||||||
|
|
||||||
MESSAGE = None
|
MESSAGE = None
|
||||||
|
|
||||||
def __str__(self): # pragma: no cover
|
def __str__(self): # pragma: no cover
|
||||||
@ -26,7 +25,6 @@ class PlatformioException(Exception):
|
|||||||
|
|
||||||
|
|
||||||
class ReturnErrorCode(PlatformioException):
|
class ReturnErrorCode(PlatformioException):
|
||||||
|
|
||||||
MESSAGE = "{0}"
|
MESSAGE = "{0}"
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +33,6 @@ class UserSideException(PlatformioException):
|
|||||||
|
|
||||||
|
|
||||||
class AbortedByUser(UserSideException):
|
class AbortedByUser(UserSideException):
|
||||||
|
|
||||||
MESSAGE = "Aborted by user"
|
MESSAGE = "Aborted by user"
|
||||||
|
|
||||||
|
|
||||||
@ -49,7 +46,6 @@ class InvalidUdevRules(UserSideException):
|
|||||||
|
|
||||||
|
|
||||||
class MissedUdevRules(InvalidUdevRules):
|
class MissedUdevRules(InvalidUdevRules):
|
||||||
|
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"Warning! Please install `99-platformio-udev.rules`. \nMore details: "
|
"Warning! Please install `99-platformio-udev.rules`. \nMore details: "
|
||||||
"https://docs.platformio.org/en/latest/core/installation/udev-rules.html"
|
"https://docs.platformio.org/en/latest/core/installation/udev-rules.html"
|
||||||
@ -57,7 +53,6 @@ class MissedUdevRules(InvalidUdevRules):
|
|||||||
|
|
||||||
|
|
||||||
class OutdatedUdevRules(InvalidUdevRules):
|
class OutdatedUdevRules(InvalidUdevRules):
|
||||||
|
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"Warning! Your `{0}` are outdated. Please update or reinstall them."
|
"Warning! Your `{0}` are outdated. Please update or reinstall them."
|
||||||
"\nMore details: "
|
"\nMore details: "
|
||||||
@ -71,32 +66,26 @@ class OutdatedUdevRules(InvalidUdevRules):
|
|||||||
|
|
||||||
|
|
||||||
class GetSerialPortsError(PlatformioException):
|
class GetSerialPortsError(PlatformioException):
|
||||||
|
|
||||||
MESSAGE = "No implementation for your platform ('{0}') available"
|
MESSAGE = "No implementation for your platform ('{0}') available"
|
||||||
|
|
||||||
|
|
||||||
class GetLatestVersionError(PlatformioException):
|
class GetLatestVersionError(PlatformioException):
|
||||||
|
|
||||||
MESSAGE = "Can not retrieve the latest PlatformIO version"
|
MESSAGE = "Can not retrieve the latest PlatformIO version"
|
||||||
|
|
||||||
|
|
||||||
class InvalidSettingName(UserSideException):
|
class InvalidSettingName(UserSideException):
|
||||||
|
|
||||||
MESSAGE = "Invalid setting with the name '{0}'"
|
MESSAGE = "Invalid setting with the name '{0}'"
|
||||||
|
|
||||||
|
|
||||||
class InvalidSettingValue(UserSideException):
|
class InvalidSettingValue(UserSideException):
|
||||||
|
|
||||||
MESSAGE = "Invalid value '{0}' for the setting '{1}'"
|
MESSAGE = "Invalid value '{0}' for the setting '{1}'"
|
||||||
|
|
||||||
|
|
||||||
class InvalidJSONFile(PlatformioException):
|
class InvalidJSONFile(PlatformioException):
|
||||||
|
|
||||||
MESSAGE = "Could not load broken JSON: {0}"
|
MESSAGE = "Could not load broken JSON: {0}"
|
||||||
|
|
||||||
|
|
||||||
class CIBuildEnvsEmpty(UserSideException):
|
class CIBuildEnvsEmpty(UserSideException):
|
||||||
|
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"Can't find PlatformIO build environments.\n"
|
"Can't find PlatformIO build environments.\n"
|
||||||
"Please specify `--board` or path to `platformio.ini` with "
|
"Please specify `--board` or path to `platformio.ini` with "
|
||||||
@ -105,7 +94,6 @@ class CIBuildEnvsEmpty(UserSideException):
|
|||||||
|
|
||||||
|
|
||||||
class UpgradeError(PlatformioException):
|
class UpgradeError(PlatformioException):
|
||||||
|
|
||||||
MESSAGE = """{0}
|
MESSAGE = """{0}
|
||||||
|
|
||||||
* Upgrade using `pip install -U platformio`
|
* Upgrade using `pip install -U platformio`
|
||||||
@ -115,7 +103,6 @@ class UpgradeError(PlatformioException):
|
|||||||
|
|
||||||
|
|
||||||
class HomeDirPermissionsError(UserSideException):
|
class HomeDirPermissionsError(UserSideException):
|
||||||
|
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"The directory `{0}` or its parent directory is not owned by the "
|
"The directory `{0}` or its parent directory is not owned by the "
|
||||||
"current user and PlatformIO can not store configuration data.\n"
|
"current user and PlatformIO can not store configuration data.\n"
|
||||||
@ -126,7 +113,6 @@ class HomeDirPermissionsError(UserSideException):
|
|||||||
|
|
||||||
|
|
||||||
class CygwinEnvDetected(PlatformioException):
|
class CygwinEnvDetected(PlatformioException):
|
||||||
|
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"PlatformIO does not work within Cygwin environment. "
|
"PlatformIO does not work within Cygwin environment. "
|
||||||
"Use native Terminal instead."
|
"Use native Terminal instead."
|
||||||
|
@ -181,7 +181,7 @@ def match_src_files(src_dir, src_filter=None, src_exts=None, followlinks=True):
|
|||||||
result = set()
|
result = set()
|
||||||
# correct fs directory separator
|
# correct fs directory separator
|
||||||
src_filter = src_filter.replace("/", os.sep).replace("\\", os.sep)
|
src_filter = src_filter.replace("/", os.sep).replace("\\", os.sep)
|
||||||
for (action, pattern) in re.findall(r"(\+|\-)<([^>]+)>", src_filter):
|
for action, pattern in re.findall(r"(\+|\-)<([^>]+)>", src_filter):
|
||||||
candidates = _find_candidates(pattern)
|
candidates = _find_candidates(pattern)
|
||||||
if action == "+":
|
if action == "+":
|
||||||
result |= candidates
|
result |= candidates
|
||||||
|
@ -21,7 +21,6 @@ from platformio.project.helpers import is_platformio_project
|
|||||||
|
|
||||||
|
|
||||||
class AppRPC:
|
class AppRPC:
|
||||||
|
|
||||||
IGNORE_STORAGE_KEYS = [
|
IGNORE_STORAGE_KEYS = [
|
||||||
"cid",
|
"cid",
|
||||||
"coreVersion",
|
"coreVersion",
|
||||||
|
@ -21,7 +21,6 @@ from platformio.compat import aio_get_running_loop
|
|||||||
|
|
||||||
|
|
||||||
class IDERPC:
|
class IDERPC:
|
||||||
|
|
||||||
COMMAND_TIMEOUT = 1.5 # in seconds
|
COMMAND_TIMEOUT = 1.5 # in seconds
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -24,8 +24,8 @@ from starlette.concurrency import run_in_threadpool
|
|||||||
|
|
||||||
from platformio import __main__, __version__, fs, proc
|
from platformio import __main__, __version__, fs, proc
|
||||||
from platformio.compat import get_locale_encoding, is_bytes
|
from platformio.compat import get_locale_encoding, is_bytes
|
||||||
from platformio.home import helpers
|
|
||||||
from platformio.exception import PlatformioException
|
from platformio.exception import PlatformioException
|
||||||
|
from platformio.home import helpers
|
||||||
|
|
||||||
|
|
||||||
class MultiThreadingStdStream:
|
class MultiThreadingStdStream:
|
||||||
|
@ -24,7 +24,6 @@ from platformio.proc import force_exit
|
|||||||
|
|
||||||
|
|
||||||
class JSONRPCServerFactoryBase:
|
class JSONRPCServerFactoryBase:
|
||||||
|
|
||||||
connection_nums = 0
|
connection_nums = 0
|
||||||
shutdown_timer = None
|
shutdown_timer = None
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ class HTTPClientError(PlatformioException):
|
|||||||
|
|
||||||
|
|
||||||
class InternetConnectionError(UserSideException):
|
class InternetConnectionError(UserSideException):
|
||||||
|
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"You are not connected to the Internet.\n"
|
"You are not connected to the Internet.\n"
|
||||||
"PlatformIO needs the Internet connection to"
|
"PlatformIO needs the Internet connection to"
|
||||||
|
@ -137,7 +137,7 @@ def list_global_packages(options):
|
|||||||
only_packages = any(
|
only_packages = any(
|
||||||
options.get(type_) or options.get(f"only_{type_}") for (type_, _) in data
|
options.get(type_) or options.get(f"only_{type_}") for (type_, _) in data
|
||||||
)
|
)
|
||||||
for (type_, pm) in data:
|
for type_, pm in data:
|
||||||
skip_conds = [
|
skip_conds = [
|
||||||
only_packages
|
only_packages
|
||||||
and not options.get(type_)
|
and not options.get(type_)
|
||||||
|
@ -48,12 +48,10 @@ class ManifestValidationError(ManifestException):
|
|||||||
|
|
||||||
|
|
||||||
class MissingPackageManifestError(ManifestException):
|
class MissingPackageManifestError(ManifestException):
|
||||||
|
|
||||||
MESSAGE = "Could not find one of '{0}' manifest files in the package"
|
MESSAGE = "Could not find one of '{0}' manifest files in the package"
|
||||||
|
|
||||||
|
|
||||||
class UnknownPackageError(UserSideException):
|
class UnknownPackageError(UserSideException):
|
||||||
|
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"Could not find the package with '{0}' requirements for your system '%s'"
|
"Could not find the package with '{0}' requirements for your system '%s'"
|
||||||
% util.get_systype()
|
% util.get_systype()
|
||||||
@ -61,7 +59,6 @@ class UnknownPackageError(UserSideException):
|
|||||||
|
|
||||||
|
|
||||||
class NotGlobalLibDir(UserSideException):
|
class NotGlobalLibDir(UserSideException):
|
||||||
|
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"The `{0}` is not a PlatformIO project.\n\n"
|
"The `{0}` is not a PlatformIO project.\n\n"
|
||||||
"To manage libraries in global storage `{1}`,\n"
|
"To manage libraries in global storage `{1}`,\n"
|
||||||
|
@ -26,7 +26,6 @@ from platformio.package.lockfile import LockFile
|
|||||||
|
|
||||||
|
|
||||||
class PackageManagerDownloadMixin:
|
class PackageManagerDownloadMixin:
|
||||||
|
|
||||||
DOWNLOAD_CACHE_EXPIRE = 86400 * 30 # keep package in a local cache for 1 month
|
DOWNLOAD_CACHE_EXPIRE = 86400 * 30 # keep package in a local cache for 1 month
|
||||||
|
|
||||||
def compute_download_path(self, *args):
|
def compute_download_path(self, *args):
|
||||||
|
@ -27,7 +27,6 @@ from platformio.package.vcsclient import VCSClientFactory
|
|||||||
|
|
||||||
|
|
||||||
class PackageManagerInstallMixin:
|
class PackageManagerInstallMixin:
|
||||||
|
|
||||||
_INSTALL_HISTORY = None # avoid circle dependencies
|
_INSTALL_HISTORY = None # avoid circle dependencies
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -65,7 +65,6 @@ class PackageType:
|
|||||||
|
|
||||||
|
|
||||||
class PackageCompatibility:
|
class PackageCompatibility:
|
||||||
|
|
||||||
KNOWN_QUALIFIERS = ("platforms", "frameworks", "authors")
|
KNOWN_QUALIFIERS = ("platforms", "frameworks", "authors")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -468,7 +467,6 @@ class PackageMetaData:
|
|||||||
|
|
||||||
|
|
||||||
class PackageItem:
|
class PackageItem:
|
||||||
|
|
||||||
METAFILE_NAME = ".piopm"
|
METAFILE_NAME = ".piopm"
|
||||||
|
|
||||||
def __init__(self, path, metadata=None):
|
def __init__(self, path, metadata=None):
|
||||||
|
@ -24,7 +24,6 @@ from platformio.package.exception import PackageException
|
|||||||
|
|
||||||
|
|
||||||
class ExtractArchiveItemError(PackageException):
|
class ExtractArchiveItemError(PackageException):
|
||||||
|
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"Could not extract `{0}` to `{1}`. Try to disable antivirus "
|
"Could not extract `{0}` to `{1}`. Try to disable antivirus "
|
||||||
"tool or check this solution -> https://bit.ly/faq-package-manager"
|
"tool or check this solution -> https://bit.ly/faq-package-manager"
|
||||||
|
@ -58,7 +58,6 @@ class VCSClientFactory:
|
|||||||
|
|
||||||
|
|
||||||
class VCSClientBase:
|
class VCSClientBase:
|
||||||
|
|
||||||
command = None
|
command = None
|
||||||
|
|
||||||
def __init__(self, src_dir, remote_url=None, tag=None, silent=False):
|
def __init__(self, src_dir, remote_url=None, tag=None, silent=False):
|
||||||
@ -128,7 +127,6 @@ class VCSClientBase:
|
|||||||
|
|
||||||
|
|
||||||
class GitClient(VCSClientBase):
|
class GitClient(VCSClientBase):
|
||||||
|
|
||||||
command = "git"
|
command = "git"
|
||||||
_configured = False
|
_configured = False
|
||||||
|
|
||||||
@ -232,7 +230,6 @@ class GitClient(VCSClientBase):
|
|||||||
|
|
||||||
|
|
||||||
class HgClient(VCSClientBase):
|
class HgClient(VCSClientBase):
|
||||||
|
|
||||||
command = "hg"
|
command = "hg"
|
||||||
|
|
||||||
def export(self):
|
def export(self):
|
||||||
@ -256,7 +253,6 @@ class HgClient(VCSClientBase):
|
|||||||
|
|
||||||
|
|
||||||
class SvnClient(VCSClientBase):
|
class SvnClient(VCSClientBase):
|
||||||
|
|
||||||
command = "svn"
|
command = "svn"
|
||||||
|
|
||||||
def export(self):
|
def export(self):
|
||||||
|
@ -28,7 +28,6 @@ from platformio.platform.exception import BuildScriptNotFound
|
|||||||
|
|
||||||
|
|
||||||
class PlatformRunMixin:
|
class PlatformRunMixin:
|
||||||
|
|
||||||
LINE_ERROR_RE = re.compile(r"(^|\s+)error:?\s+", re.I)
|
LINE_ERROR_RE = re.compile(r"(^|\s+)error:?\s+", re.I)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -29,7 +29,6 @@ from platformio.project.config import ProjectConfig
|
|||||||
class PlatformBase( # pylint: disable=too-many-instance-attributes,too-many-public-methods
|
class PlatformBase( # pylint: disable=too-many-instance-attributes,too-many-public-methods
|
||||||
PlatformPackagesMixin, PlatformRunMixin
|
PlatformPackagesMixin, PlatformRunMixin
|
||||||
):
|
):
|
||||||
|
|
||||||
CORE_SEMVER = pepver_to_semver(__version__)
|
CORE_SEMVER = pepver_to_semver(__version__)
|
||||||
_BOARDS_CACHE = {}
|
_BOARDS_CACHE = {}
|
||||||
|
|
||||||
|
@ -20,12 +20,10 @@ class PlatformException(PlatformioException):
|
|||||||
|
|
||||||
|
|
||||||
class UnknownPlatform(PlatformException):
|
class UnknownPlatform(PlatformException):
|
||||||
|
|
||||||
MESSAGE = "Unknown development platform '{0}'"
|
MESSAGE = "Unknown development platform '{0}'"
|
||||||
|
|
||||||
|
|
||||||
class IncompatiblePlatform(PlatformException):
|
class IncompatiblePlatform(PlatformException):
|
||||||
|
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"Development platform '{0}' is not compatible with PlatformIO Core v{1} and "
|
"Development platform '{0}' is not compatible with PlatformIO Core v{1} and "
|
||||||
"depends on PlatformIO Core {2}.\n"
|
"depends on PlatformIO Core {2}.\n"
|
||||||
@ -33,20 +31,16 @@ class IncompatiblePlatform(PlatformException):
|
|||||||
|
|
||||||
|
|
||||||
class UnknownBoard(PlatformException):
|
class UnknownBoard(PlatformException):
|
||||||
|
|
||||||
MESSAGE = "Unknown board ID '{0}'"
|
MESSAGE = "Unknown board ID '{0}'"
|
||||||
|
|
||||||
|
|
||||||
class InvalidBoardManifest(PlatformException):
|
class InvalidBoardManifest(PlatformException):
|
||||||
|
|
||||||
MESSAGE = "Invalid board JSON manifest '{0}'"
|
MESSAGE = "Invalid board JSON manifest '{0}'"
|
||||||
|
|
||||||
|
|
||||||
class UnknownFramework(PlatformException):
|
class UnknownFramework(PlatformException):
|
||||||
|
|
||||||
MESSAGE = "Unknown framework '{0}'"
|
MESSAGE = "Unknown framework '{0}'"
|
||||||
|
|
||||||
|
|
||||||
class BuildScriptNotFound(PlatformException):
|
class BuildScriptNotFound(PlatformException):
|
||||||
|
|
||||||
MESSAGE = "Invalid path '{0}' to build script"
|
MESSAGE = "Invalid path '{0}' to build script"
|
||||||
|
@ -166,7 +166,7 @@ def init_base_project(project_dir):
|
|||||||
(config.get("platformio", "lib_dir"), init_lib_readme),
|
(config.get("platformio", "lib_dir"), init_lib_readme),
|
||||||
(config.get("platformio", "test_dir"), init_test_readme),
|
(config.get("platformio", "test_dir"), init_test_readme),
|
||||||
]
|
]
|
||||||
for (path, cb) in dir_to_readme:
|
for path, cb in dir_to_readme:
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
continue
|
continue
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
|
@ -39,7 +39,6 @@ CONFIG_HEADER = """
|
|||||||
|
|
||||||
|
|
||||||
class ProjectConfigBase:
|
class ProjectConfigBase:
|
||||||
|
|
||||||
INLINE_COMMENT_RE = re.compile(r"\s+;.*$")
|
INLINE_COMMENT_RE = re.compile(r"\s+;.*$")
|
||||||
VARTPL_RE = re.compile(r"\$\{([^\.\}\()]+)\.([^\}]+)\}")
|
VARTPL_RE = re.compile(r"\$\{([^\.\}\()]+)\.([^\}]+)\}")
|
||||||
|
|
||||||
@ -412,7 +411,6 @@ class ProjectConfigDirsMixin:
|
|||||||
|
|
||||||
|
|
||||||
class ProjectConfig(ProjectConfigBase, ProjectConfigDirsMixin):
|
class ProjectConfig(ProjectConfigBase, ProjectConfigDirsMixin):
|
||||||
|
|
||||||
_instances = {}
|
_instances = {}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -20,7 +20,6 @@ class ProjectError(PlatformioException):
|
|||||||
|
|
||||||
|
|
||||||
class NotPlatformIOProjectError(ProjectError, UserSideException):
|
class NotPlatformIOProjectError(ProjectError, UserSideException):
|
||||||
|
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"Not a PlatformIO project. `platformio.ini` file has not been "
|
"Not a PlatformIO project. `platformio.ini` file has not been "
|
||||||
"found in current working directory ({0}). To initialize new project "
|
"found in current working directory ({0}). To initialize new project "
|
||||||
@ -29,25 +28,20 @@ class NotPlatformIOProjectError(ProjectError, UserSideException):
|
|||||||
|
|
||||||
|
|
||||||
class InvalidProjectConfError(ProjectError, UserSideException):
|
class InvalidProjectConfError(ProjectError, UserSideException):
|
||||||
|
|
||||||
MESSAGE = "Invalid '{0}' (project configuration file): '{1}'"
|
MESSAGE = "Invalid '{0}' (project configuration file): '{1}'"
|
||||||
|
|
||||||
|
|
||||||
class UndefinedEnvPlatformError(ProjectError, UserSideException):
|
class UndefinedEnvPlatformError(ProjectError, UserSideException):
|
||||||
|
|
||||||
MESSAGE = "Please specify platform for '{0}' environment"
|
MESSAGE = "Please specify platform for '{0}' environment"
|
||||||
|
|
||||||
|
|
||||||
class ProjectEnvsNotAvailableError(ProjectError, UserSideException):
|
class ProjectEnvsNotAvailableError(ProjectError, UserSideException):
|
||||||
|
|
||||||
MESSAGE = "Please setup environments in `platformio.ini` file"
|
MESSAGE = "Please setup environments in `platformio.ini` file"
|
||||||
|
|
||||||
|
|
||||||
class UnknownEnvNamesError(ProjectError, UserSideException):
|
class UnknownEnvNamesError(ProjectError, UserSideException):
|
||||||
|
|
||||||
MESSAGE = "Unknown environment names '{0}'. Valid names are '{1}'"
|
MESSAGE = "Unknown environment names '{0}'. Valid names are '{1}'"
|
||||||
|
|
||||||
|
|
||||||
class ProjectOptionValueError(ProjectError, UserSideException):
|
class ProjectOptionValueError(ProjectError, UserSideException):
|
||||||
|
|
||||||
MESSAGE = "{0} for option `{1}` in section [{2}]"
|
MESSAGE = "{0} for option `{1}` in section [{2}]"
|
||||||
|
@ -22,7 +22,6 @@ from platformio.registry.client import RegistryClient
|
|||||||
|
|
||||||
|
|
||||||
class RegistryFileMirrorIterator:
|
class RegistryFileMirrorIterator:
|
||||||
|
|
||||||
HTTP_CLIENT_INSTANCES = {}
|
HTTP_CLIENT_INSTANCES = {}
|
||||||
|
|
||||||
def __init__(self, download_url):
|
def __init__(self, download_url):
|
||||||
|
@ -17,7 +17,6 @@ from twisted.spread import pb # pylint: disable=import-error
|
|||||||
|
|
||||||
|
|
||||||
class AsyncCommandBase:
|
class AsyncCommandBase:
|
||||||
|
|
||||||
MAX_BUFFER_SIZE = 1024 * 1024 # 1Mb
|
MAX_BUFFER_SIZE = 1024 * 1024 # 1Mb
|
||||||
|
|
||||||
def __init__(self, options=None, on_end_callback=None):
|
def __init__(self, options=None, on_end_callback=None):
|
||||||
|
@ -118,7 +118,6 @@ def remote_run(
|
|||||||
silent,
|
silent,
|
||||||
verbose,
|
verbose,
|
||||||
):
|
):
|
||||||
|
|
||||||
from platformio.remote.client.run_or_test import RunOrTestClient
|
from platformio.remote.client.run_or_test import RunOrTestClient
|
||||||
|
|
||||||
cr = RunOrTestClient(
|
cr = RunOrTestClient(
|
||||||
@ -211,7 +210,6 @@ def remote_test( # pylint: disable=redefined-builtin
|
|||||||
without_uploading,
|
without_uploading,
|
||||||
verbose,
|
verbose,
|
||||||
):
|
):
|
||||||
|
|
||||||
from platformio.remote.client.run_or_test import RunOrTestClient
|
from platformio.remote.client.run_or_test import RunOrTestClient
|
||||||
|
|
||||||
cr = RunOrTestClient(
|
cr = RunOrTestClient(
|
||||||
|
@ -34,7 +34,7 @@ class AsyncClientBase(RemoteClientBase):
|
|||||||
def cb_async_result(self, result):
|
def cb_async_result(self, result):
|
||||||
if self._acs_total == 0:
|
if self._acs_total == 0:
|
||||||
self._acs_total = len(result)
|
self._acs_total = len(result)
|
||||||
for (success, value) in result:
|
for success, value in result:
|
||||||
if not success:
|
if not success:
|
||||||
raise pb.Error(value)
|
raise pb.Error(value)
|
||||||
self.acread_data(*value)
|
self.acread_data(*value)
|
||||||
|
@ -33,7 +33,6 @@ from platformio.remote.factory.ssl import SSLContextFactory
|
|||||||
class RemoteClientBase( # pylint: disable=too-many-instance-attributes
|
class RemoteClientBase( # pylint: disable=too-many-instance-attributes
|
||||||
pb.Referenceable
|
pb.Referenceable
|
||||||
):
|
):
|
||||||
|
|
||||||
PING_DELAY = 60
|
PING_DELAY = 60
|
||||||
PING_MAX_FAILURES = 3
|
PING_MAX_FAILURES = 3
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
@ -32,7 +32,7 @@ class DeviceListClient(RemoteClientBase):
|
|||||||
|
|
||||||
def _cbResult(self, result):
|
def _cbResult(self, result):
|
||||||
data = {}
|
data = {}
|
||||||
for (success, value) in result:
|
for success, value in result:
|
||||||
if not success:
|
if not success:
|
||||||
click.secho(value, fg="red", err=True)
|
click.secho(value, fg="red", err=True)
|
||||||
continue
|
continue
|
||||||
|
@ -71,7 +71,6 @@ class SMBridgeFactory(protocol.ServerFactory):
|
|||||||
class DeviceMonitorClient( # pylint: disable=too-many-instance-attributes
|
class DeviceMonitorClient( # pylint: disable=too-many-instance-attributes
|
||||||
RemoteClientBase
|
RemoteClientBase
|
||||||
):
|
):
|
||||||
|
|
||||||
MAX_BUFFER_SIZE = 1024 * 1024
|
MAX_BUFFER_SIZE = 1024 * 1024
|
||||||
|
|
||||||
def __init__(self, agents, **kwargs):
|
def __init__(self, agents, **kwargs):
|
||||||
@ -96,7 +95,7 @@ class DeviceMonitorClient( # pylint: disable=too-many-instance-attributes
|
|||||||
def _cb_device_list(self, result):
|
def _cb_device_list(self, result):
|
||||||
devices = []
|
devices = []
|
||||||
hwid_devindexes = []
|
hwid_devindexes = []
|
||||||
for (success, value) in result:
|
for success, value in result:
|
||||||
if not success:
|
if not success:
|
||||||
click.secho(value, fg="red", err=True)
|
click.secho(value, fg="red", err=True)
|
||||||
continue
|
continue
|
||||||
|
@ -28,7 +28,6 @@ from platformio.remote.projectsync import PROJECT_SYNC_STAGE, ProjectSync
|
|||||||
|
|
||||||
|
|
||||||
class RunOrTestClient(AsyncClientBase):
|
class RunOrTestClient(AsyncClientBase):
|
||||||
|
|
||||||
MAX_ARCHIVE_SIZE = 50 * 1024 * 1024 # 50Mb
|
MAX_ARCHIVE_SIZE = 50 * 1024 * 1024 # 50Mb
|
||||||
UPLOAD_CHUNK_SIZE = 256 * 1024 # 256Kb
|
UPLOAD_CHUNK_SIZE = 256 * 1024 # 256Kb
|
||||||
|
|
||||||
@ -147,7 +146,7 @@ class RunOrTestClient(AsyncClientBase):
|
|||||||
|
|
||||||
def cb_psync_init_result(self, result):
|
def cb_psync_init_result(self, result):
|
||||||
self._acs_total = len(result)
|
self._acs_total = len(result)
|
||||||
for (success, value) in result:
|
for success, value in result:
|
||||||
if not success:
|
if not success:
|
||||||
raise pb.Error(value)
|
raise pb.Error(value)
|
||||||
agent_id, ac_id = value
|
agent_id, ac_id = value
|
||||||
|
@ -47,13 +47,13 @@ class ProjectSync:
|
|||||||
|
|
||||||
def rebuild_dbindex(self):
|
def rebuild_dbindex(self):
|
||||||
self._db = {}
|
self._db = {}
|
||||||
for (path, relpath, cb_filter) in self.items:
|
for path, relpath, cb_filter in self.items:
|
||||||
if cb_filter and not cb_filter(path):
|
if cb_filter and not cb_filter(path):
|
||||||
continue
|
continue
|
||||||
self._insert_to_db(path, relpath)
|
self._insert_to_db(path, relpath)
|
||||||
if not isdir(path):
|
if not isdir(path):
|
||||||
continue
|
continue
|
||||||
for (root, _, files) in os.walk(path, followlinks=True):
|
for root, _, files in os.walk(path, followlinks=True):
|
||||||
for name in files:
|
for name in files:
|
||||||
self._insert_to_db(
|
self._insert_to_db(
|
||||||
join(root, name), join(relpath, root[len(path) + 1 :], name)
|
join(root, name), join(relpath, root[len(path) + 1 :], name)
|
||||||
|
@ -54,7 +54,6 @@ class TelemetryBase:
|
|||||||
|
|
||||||
|
|
||||||
class MeasurementProtocol(TelemetryBase):
|
class MeasurementProtocol(TelemetryBase):
|
||||||
|
|
||||||
TID = "UA-1768265-9"
|
TID = "UA-1768265-9"
|
||||||
PARAMS_MAP = {
|
PARAMS_MAP = {
|
||||||
"screen_name": "cd",
|
"screen_name": "cd",
|
||||||
@ -201,7 +200,6 @@ class MeasurementProtocol(TelemetryBase):
|
|||||||
|
|
||||||
@util.singleton
|
@util.singleton
|
||||||
class MPDataPusher:
|
class MPDataPusher:
|
||||||
|
|
||||||
MAX_WORKERS = 5
|
MAX_WORKERS = 5
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -20,7 +20,6 @@ class UnitTestError(PlatformioException):
|
|||||||
|
|
||||||
|
|
||||||
class TestDirNotExistsError(UnitTestError, UserSideException):
|
class TestDirNotExistsError(UnitTestError, UserSideException):
|
||||||
|
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"A test folder '{0}' does not exist.\nPlease create 'test' "
|
"A test folder '{0}' does not exist.\nPlease create 'test' "
|
||||||
"directory in the project root and put a test suite.\n"
|
"directory in the project root and put a test suite.\n"
|
||||||
|
@ -40,7 +40,6 @@ def list_test_suites(project_config, environments, filters, ignores):
|
|||||||
test_names = list_test_names(project_config)
|
test_names = list_test_names(project_config)
|
||||||
for env_name in project_config.envs():
|
for env_name in project_config.envs():
|
||||||
for test_name in test_names:
|
for test_name in test_names:
|
||||||
|
|
||||||
# filter and ignore patterns
|
# filter and ignore patterns
|
||||||
patterns = dict(filter=list(filters), ignore=list(ignores))
|
patterns = dict(filter=list(filters), ignore=list(ignores))
|
||||||
for key, value in patterns.items():
|
for key, value in patterns.items():
|
||||||
|
@ -54,7 +54,6 @@ class TestRunnerOptions: # pylint: disable=too-many-instance-attributes
|
|||||||
|
|
||||||
|
|
||||||
class TestRunnerBase:
|
class TestRunnerBase:
|
||||||
|
|
||||||
NAME = None
|
NAME = None
|
||||||
EXTRA_LIB_DEPS = None
|
EXTRA_LIB_DEPS = None
|
||||||
TESTCASE_PARSE_RE = None
|
TESTCASE_PARSE_RE = None
|
||||||
|
@ -101,7 +101,6 @@ class DoctestTestCaseParser:
|
|||||||
|
|
||||||
|
|
||||||
class DoctestTestRunner(TestRunnerBase):
|
class DoctestTestRunner(TestRunnerBase):
|
||||||
|
|
||||||
EXTRA_LIB_DEPS = ["doctest/doctest@^2.4.9"]
|
EXTRA_LIB_DEPS = ["doctest/doctest@^2.4.9"]
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
@ -22,7 +22,6 @@ from platformio.test.runners.base import TestRunnerBase
|
|||||||
|
|
||||||
|
|
||||||
class GoogletestTestCaseParser:
|
class GoogletestTestCaseParser:
|
||||||
|
|
||||||
# Examples:
|
# Examples:
|
||||||
# [ RUN ] FooTest.Bar
|
# [ RUN ] FooTest.Bar
|
||||||
# ...
|
# ...
|
||||||
@ -89,7 +88,6 @@ class GoogletestTestCaseParser:
|
|||||||
|
|
||||||
|
|
||||||
class GoogletestTestRunner(TestRunnerBase):
|
class GoogletestTestRunner(TestRunnerBase):
|
||||||
|
|
||||||
EXTRA_LIB_DEPS = ["google/googletest@^1.12.1"]
|
EXTRA_LIB_DEPS = ["google/googletest@^1.12.1"]
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
@ -22,7 +22,6 @@ from platformio.exception import UserSideException
|
|||||||
|
|
||||||
|
|
||||||
class SerialTestOutputReader:
|
class SerialTestOutputReader:
|
||||||
|
|
||||||
SERIAL_TIMEOUT = 600
|
SERIAL_TIMEOUT = 600
|
||||||
|
|
||||||
def __init__(self, test_runner):
|
def __init__(self, test_runner):
|
||||||
|
@ -26,7 +26,6 @@ from platformio.util import strip_ansi_codes
|
|||||||
|
|
||||||
|
|
||||||
class UnityTestRunner(TestRunnerBase):
|
class UnityTestRunner(TestRunnerBase):
|
||||||
|
|
||||||
EXTRA_LIB_DEPS = ["throwtheswitch/Unity@^2.5.2"]
|
EXTRA_LIB_DEPS = ["throwtheswitch/Unity@^2.5.2"]
|
||||||
|
|
||||||
# Examples:
|
# Examples:
|
||||||
|
@ -96,7 +96,6 @@ class RetryStopException(RetryException):
|
|||||||
|
|
||||||
|
|
||||||
class retry:
|
class retry:
|
||||||
|
|
||||||
RetryNextException = RetryNextException
|
RetryNextException = RetryNextException
|
||||||
RetryStopException = RetryStopException
|
RetryStopException = RetryStopException
|
||||||
|
|
||||||
|
@ -112,7 +112,6 @@ def test_ci_keep_build_dir_single_src_dir(
|
|||||||
def test_ci_keep_build_dir_nested_src_dirs(
|
def test_ci_keep_build_dir_nested_src_dirs(
|
||||||
clirunner, tmpdir_factory, validate_cliresult
|
clirunner, tmpdir_factory, validate_cliresult
|
||||||
):
|
):
|
||||||
|
|
||||||
build_dir = str(tmpdir_factory.mktemp("ci_build_dir"))
|
build_dir = str(tmpdir_factory.mktemp("ci_build_dir"))
|
||||||
|
|
||||||
# Split default Arduino project in two parts
|
# Split default Arduino project in two parts
|
||||||
|
Reference in New Issue
Block a user