2017-06-05 16:02:39 +03:00
|
|
|
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
|
2015-11-18 17:16:17 +02:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2014-06-07 13:34:31 +03:00
|
|
|
|
|
|
|
|
|
|
|
class PlatformioException(Exception):
|
|
|
|
|
|
|
|
MESSAGE = None
|
|
|
|
|
|
|
|
def __str__(self): # pragma: no cover
|
|
|
|
if self.MESSAGE:
|
2019-05-08 12:41:11 +03:00
|
|
|
return self.MESSAGE.format(
|
|
|
|
*self.args # pylint: disable=not-an-iterable
|
|
|
|
)
|
2018-12-26 20:54:29 +02:00
|
|
|
return super(PlatformioException, self).__str__()
|
2014-06-07 13:34:31 +03:00
|
|
|
|
|
|
|
|
2015-02-19 22:02:50 +02:00
|
|
|
class ReturnErrorCode(PlatformioException):
|
2016-11-12 00:28:49 +02:00
|
|
|
|
|
|
|
MESSAGE = "{0}"
|
2015-02-19 22:02:50 +02:00
|
|
|
|
|
|
|
|
2018-07-14 22:10:56 +03:00
|
|
|
class LockFileTimeoutError(PlatformioException):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2015-09-05 22:58:42 +03:00
|
|
|
class MinitermException(PlatformioException):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2017-07-03 13:35:39 +03:00
|
|
|
class UserSideException(PlatformioException):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class AbortedByUser(UserSideException):
|
2015-02-15 23:39:02 +02:00
|
|
|
|
|
|
|
MESSAGE = "Aborted by user"
|
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
#
|
|
|
|
# Development Platform
|
|
|
|
#
|
|
|
|
|
|
|
|
|
2014-06-07 13:34:31 +03:00
|
|
|
class UnknownPlatform(PlatformioException):
|
|
|
|
|
2017-01-25 15:33:40 +02:00
|
|
|
MESSAGE = "Unknown development platform '{0}'"
|
|
|
|
|
|
|
|
|
|
|
|
class IncompatiblePlatform(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Development platform '{0}' is not compatible with PIO Core v{1}"
|
2014-06-07 13:34:31 +03:00
|
|
|
|
|
|
|
|
2014-06-13 20:47:02 +03:00
|
|
|
class PlatformNotInstalledYet(PlatformioException):
|
|
|
|
|
2017-12-23 19:48:16 +02:00
|
|
|
MESSAGE = ("The platform '{0}' has not been installed yet. "
|
|
|
|
"Use `platformio platform install {0}` command")
|
2014-06-13 20:47:02 +03:00
|
|
|
|
|
|
|
|
2014-12-29 20:22:01 +02:00
|
|
|
class UnknownBoard(PlatformioException):
|
|
|
|
|
2016-05-26 19:43:36 +03:00
|
|
|
MESSAGE = "Unknown board ID '{0}'"
|
2014-12-29 20:22:01 +02:00
|
|
|
|
|
|
|
|
2016-08-24 23:03:41 +03:00
|
|
|
class InvalidBoardManifest(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Invalid board JSON manifest '{0}'"
|
|
|
|
|
|
|
|
|
2015-03-11 18:12:58 +02:00
|
|
|
class UnknownFramework(PlatformioException):
|
|
|
|
|
2015-12-14 22:44:16 +02:00
|
|
|
MESSAGE = "Unknown framework '{0}'"
|
2015-03-11 18:12:58 +02:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
# Package Manager
|
|
|
|
|
|
|
|
|
|
|
|
class PlatformIOPackageException(PlatformioException):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class UnknownPackage(PlatformIOPackageException):
|
2014-06-07 13:34:31 +03:00
|
|
|
|
2015-12-14 22:44:16 +02:00
|
|
|
MESSAGE = "Detected unknown package '{0}'"
|
2014-06-07 13:34:31 +03:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class MissingPackageManifest(PlatformIOPackageException):
|
2016-09-04 00:35:47 +03:00
|
|
|
|
2017-01-15 00:12:41 +02:00
|
|
|
MESSAGE = "Could not find one of '{0}' manifest files in the package"
|
2016-09-04 00:35:47 +03:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class UndefinedPackageVersion(PlatformIOPackageException):
|
2014-06-07 13:34:31 +03:00
|
|
|
|
2017-12-23 19:48:16 +02:00
|
|
|
MESSAGE = ("Could not find a version that satisfies the requirement '{0}'"
|
|
|
|
" for your system '{1}'")
|
2016-05-29 23:28:50 +03:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class PackageInstallError(PlatformIOPackageException):
|
2016-05-26 19:43:36 +03:00
|
|
|
|
2018-01-13 01:19:41 +02:00
|
|
|
MESSAGE = ("Could not install '{0}' with version requirements '{1}' "
|
2018-02-03 01:34:01 +02:00
|
|
|
"for your system '{2}'.\n\n"
|
|
|
|
"Please try this solution -> http://bit.ly/faq-package-manager")
|
2014-06-07 13:34:31 +03:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class ExtractArchiveItemError(PlatformIOPackageException):
|
2018-07-13 01:54:37 +03:00
|
|
|
|
|
|
|
MESSAGE = (
|
|
|
|
"Could not extract `{0}` to `{1}`. Try to disable antivirus "
|
|
|
|
"tool or check this solution -> http://bit.ly/faq-package-manager")
|
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class UnsupportedArchiveType(PlatformIOPackageException):
|
|
|
|
|
|
|
|
MESSAGE = "Can not unpack file '{0}'"
|
|
|
|
|
|
|
|
|
|
|
|
class FDUnrecognizedStatusCode(PlatformIOPackageException):
|
2014-06-07 13:34:31 +03:00
|
|
|
|
2015-12-14 22:44:16 +02:00
|
|
|
MESSAGE = "Got an unrecognized status code '{0}' when downloaded {1}"
|
2014-06-07 13:34:31 +03:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class FDSizeMismatch(PlatformIOPackageException):
|
2014-06-07 13:34:31 +03:00
|
|
|
|
2017-12-23 19:48:16 +02:00
|
|
|
MESSAGE = ("The size ({0:d} bytes) of downloaded file '{1}' "
|
|
|
|
"is not equal to remote size ({2:d} bytes)")
|
2014-06-07 13:34:31 +03:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class FDSHASumMismatch(PlatformIOPackageException):
|
2014-06-07 13:34:31 +03:00
|
|
|
|
2017-12-23 19:48:16 +02:00
|
|
|
MESSAGE = ("The 'sha1' sum '{0}' of downloaded file '{1}' "
|
|
|
|
"is not equal to remote '{2}'")
|
2014-06-07 13:34:31 +03:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
#
|
|
|
|
# Project
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
class PlatformIOProjectException(PlatformioException):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class NotPlatformIOProject(PlatformIOProjectException):
|
2014-06-07 13:34:31 +03:00
|
|
|
|
2017-12-23 19:48:16 +02:00
|
|
|
MESSAGE = (
|
|
|
|
"Not a PlatformIO project. `platformio.ini` file has not been "
|
|
|
|
"found in current working directory ({0}). To initialize new project "
|
|
|
|
"please use `platformio init` command")
|
2014-06-07 13:34:31 +03:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class InvalidProjectConf(PlatformIOProjectException):
|
2014-06-07 13:34:31 +03:00
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
MESSAGE = ("Invalid '{0}' (project configuration file): '{1}'")
|
2014-06-07 13:34:31 +03:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class UndefinedEnvPlatform(PlatformIOProjectException):
|
2014-06-07 13:34:31 +03:00
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
MESSAGE = "Please specify platform for '{0}' environment"
|
2014-06-12 21:17:45 +03:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class ProjectEnvsNotAvailable(PlatformIOProjectException):
|
2014-06-12 21:17:45 +03:00
|
|
|
|
2015-10-03 15:38:33 +01:00
|
|
|
MESSAGE = "Please setup environments in `platformio.ini` file"
|
2014-07-27 22:29:32 +03:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class UnknownEnvNames(PlatformIOProjectException): # FIXME: UnknownProjectEnvs
|
2014-07-27 22:39:41 +03:00
|
|
|
|
2015-12-14 22:44:16 +02:00
|
|
|
MESSAGE = "Unknown environment names '{0}'. Valid names are '{1}'"
|
2014-07-27 22:39:41 +03:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
#
|
|
|
|
# Library
|
|
|
|
#
|
2016-09-19 15:10:28 +03:00
|
|
|
|
|
|
|
|
2016-08-02 19:10:29 +03:00
|
|
|
class LibNotFound(PlatformioException):
|
2014-10-19 00:14:11 +03:00
|
|
|
|
2017-12-23 19:48:16 +02:00
|
|
|
MESSAGE = ("Library `{0}` has not been found in PlatformIO Registry.\n"
|
|
|
|
"You can ignore this message, if `{0}` is a built-in library "
|
|
|
|
"(included in framework, SDK). E.g., SPI, Wire, etc.")
|
2014-11-22 23:55:17 +02:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
class NotGlobalLibDir(UserSideException):
|
2016-08-26 12:30:37 +03:00
|
|
|
|
2017-12-23 19:48:16 +02:00
|
|
|
MESSAGE = (
|
|
|
|
"The `{0}` is not a PlatformIO project.\n\n"
|
|
|
|
"To manage libraries in global storage `{1}`,\n"
|
|
|
|
"please use `platformio lib --global {2}` or specify custom storage "
|
|
|
|
"`platformio lib --storage-dir /path/to/storage/ {2}`.\n"
|
|
|
|
"Check `platformio lib --help` for details.")
|
2016-08-26 12:30:37 +03:00
|
|
|
|
|
|
|
|
2014-12-16 23:45:00 +02:00
|
|
|
class InvalidLibConfURL(PlatformioException):
|
|
|
|
|
2015-12-14 22:44:16 +02:00
|
|
|
MESSAGE = "Invalid library config URL '{0}'"
|
2014-12-16 23:45:00 +02:00
|
|
|
|
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
#
|
|
|
|
# UDEV Rules
|
|
|
|
#
|
2018-06-20 16:32:38 +03:00
|
|
|
|
2019-05-07 17:51:50 +03:00
|
|
|
|
|
|
|
class InvalidUdevRules(PlatformioException):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class MissedUdevRules(InvalidUdevRules):
|
|
|
|
|
|
|
|
MESSAGE = (
|
|
|
|
"Warning! Please install `99-platformio-udev.rules`. \nMode details: "
|
|
|
|
"https://docs.platformio.org/en/latest/faq.html#platformio-udev-rules")
|
|
|
|
|
|
|
|
|
|
|
|
class OutdatedUdevRules(InvalidUdevRules):
|
|
|
|
|
|
|
|
MESSAGE = (
|
|
|
|
"Warning! Your `{0}` are outdated. Please update or reinstall them."
|
|
|
|
"\n Mode details: https://docs.platformio.org"
|
|
|
|
"/en/latest/faq.html#platformio-udev-rules")
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Misc
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
class GetSerialPortsError(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "No implementation for your platform ('{0}') available"
|
|
|
|
|
|
|
|
|
|
|
|
class GetLatestVersionError(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Can not retrieve the latest PlatformIO version"
|
|
|
|
|
|
|
|
|
|
|
|
class APIRequestError(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "[API] {0}"
|
|
|
|
|
|
|
|
|
|
|
|
class InternetIsOffline(UserSideException):
|
|
|
|
|
|
|
|
MESSAGE = (
|
|
|
|
"You are not connected to the Internet.\n"
|
|
|
|
"If you build a project first time, we need Internet connection "
|
|
|
|
"to install all dependencies and toolchains.")
|
2018-06-20 16:32:38 +03:00
|
|
|
|
|
|
|
|
2014-11-22 23:55:17 +02:00
|
|
|
class BuildScriptNotFound(PlatformioException):
|
|
|
|
|
2015-12-14 22:44:16 +02:00
|
|
|
MESSAGE = "Invalid path '{0}' to build script"
|
2014-11-29 22:39:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
class InvalidSettingName(PlatformioException):
|
|
|
|
|
2015-12-14 22:44:16 +02:00
|
|
|
MESSAGE = "Invalid setting with the name '{0}'"
|
2014-11-29 22:39:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
class InvalidSettingValue(PlatformioException):
|
|
|
|
|
2015-12-14 22:44:16 +02:00
|
|
|
MESSAGE = "Invalid value '{0}' for the setting '{1}'"
|
2014-11-29 22:55:32 +02:00
|
|
|
|
|
|
|
|
2018-04-15 06:08:29 +03:00
|
|
|
class InvalidJSONFile(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = "Could not load broken JSON: {0}"
|
|
|
|
|
|
|
|
|
2015-05-07 16:20:53 +01:00
|
|
|
class CIBuildEnvsEmpty(PlatformioException):
|
|
|
|
|
2017-12-23 19:48:16 +02:00
|
|
|
MESSAGE = ("Can't find PlatformIO build environments.\n"
|
|
|
|
"Please specify `--board` or path to `platformio.ini` with "
|
|
|
|
"predefined environments using `--project-conf` option")
|
2015-05-07 16:20:53 +01:00
|
|
|
|
|
|
|
|
2015-11-26 22:02:59 +02:00
|
|
|
class UpgradeError(PlatformioException):
|
|
|
|
|
2015-12-14 22:44:16 +02:00
|
|
|
MESSAGE = """{0}
|
2015-09-10 17:47:19 +03:00
|
|
|
|
2015-12-07 22:44:31 +02:00
|
|
|
* Upgrade using `pip install -U platformio`
|
2015-11-26 22:02:59 +02:00
|
|
|
* Try different installation/upgrading steps:
|
2018-08-15 19:44:02 +03:00
|
|
|
https://docs.platformio.org/page/installation.html
|
2015-11-26 22:02:59 +02:00
|
|
|
"""
|
2015-09-10 20:23:37 +03:00
|
|
|
|
|
|
|
|
2017-12-19 15:05:41 +02:00
|
|
|
class HomeDirPermissionsError(PlatformioException):
|
|
|
|
|
2017-12-23 19:48:16 +02:00
|
|
|
MESSAGE = (
|
|
|
|
"The directory `{0}` or its parent directory is not owned by the "
|
|
|
|
"current user and PlatformIO can not store configuration data.\n"
|
|
|
|
"Please check the permissions and owner of that directory.\n"
|
|
|
|
"Otherwise, please remove manually `{0}` directory and PlatformIO "
|
|
|
|
"will create new from the current user.")
|
2017-12-19 15:05:41 +02:00
|
|
|
|
|
|
|
|
2015-09-10 20:23:37 +03:00
|
|
|
class CygwinEnvDetected(PlatformioException):
|
|
|
|
|
2017-12-23 19:48:16 +02:00
|
|
|
MESSAGE = ("PlatformIO does not work within Cygwin environment. "
|
|
|
|
"Use native Terminal instead.")
|
2018-02-09 21:47:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
class DebugSupportError(PlatformioException):
|
|
|
|
|
|
|
|
MESSAGE = ("Currently, PlatformIO does not support debugging for `{0}`.\n"
|
2018-06-28 23:57:16 +03:00
|
|
|
"Please contact support@pioplus.com or visit "
|
2018-08-15 19:44:02 +03:00
|
|
|
"< https://docs.platformio.org/page/plus/debugging.html >")
|
2018-02-09 21:47:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
class DebugInvalidOptions(PlatformioException):
|
|
|
|
pass
|