How to use the platformio.exception.PlatformioException function in platformio

To help you get started, we’ve selected a few platformio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github platformio / platformio-core / platformio / managers / core.py View on Github external
def pioplus_call(args, **kwargs):
    if WINDOWS and sys.version_info < (2, 7, 6):
        raise exception.PlatformioException(
            "PlatformIO Core Plus v%s does not run under Python version %s.\n"
            "Minimum supported version is 2.7.6, please upgrade Python.\n"
            "Python 3 is not yet supported.\n" % (__version__, sys.version)
        )

    pioplus_path = join(get_core_package_dir("tool-pioplus"), "pioplus")
    pythonexe_path = get_pythonexe_path()
    os.environ["PYTHONEXEPATH"] = pythonexe_path
    os.environ["PYTHONPYSITEDIR"] = get_core_package_dir("contrib-pysite")
    os.environ["PIOCOREPYSITEDIR"] = dirname(fs.get_source_dir() or "")
    if dirname(pythonexe_path) not in os.environ["PATH"].split(os.pathsep):
        os.environ["PATH"] = (os.pathsep).join(
            [dirname(pythonexe_path), os.environ["PATH"]]
        )
    copy_pythonpath_to_osenv()
    code = subprocess.call([pioplus_path] + args, **kwargs)
github platformio / platformio-core / platformio / commands / check / tools / __init__.py View on Github external
def new(tool, project_dir, config, envname, options):
        cls = None
        if tool == "cppcheck":
            cls = CppcheckCheckTool
        elif tool == "clangtidy":
            cls = ClangtidyCheckTool
        else:
            raise exception.PlatformioException("Unknown check tool `%s`" % tool)
        return cls(project_dir, config, envname, options)
github platformio / platformio-core / platformio / platforms / linux_arm.py View on Github external
def configure_default_packages(self, envoptions, targets):
        if (envoptions.get("framework") == "wiringpi" and
                "linux_arm" not in util.get_systype()):
            raise exception.PlatformioException(
                "PlatformIO does not support temporary cross-compilation "
                "for WiringPi framework. Please run PlatformIO directly on "
                "Raspberry Pi"
            )

        return BasePlatform.configure_default_packages(
            self, envoptions, targets)
github platformio / platformio-core / platformio / exception.py View on Github external
https://docs.platformio.org/page/installation.html
"""


class HomeDirPermissionsError(UserSideException):

    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."
    )


class CygwinEnvDetected(PlatformioException):

    MESSAGE = (
        "PlatformIO does not work within Cygwin environment. "
        "Use native Terminal instead."
    )


class TestDirNotExists(PlatformioException):

    MESSAGE = (
        "A test folder '{0}' does not exist.\nPlease create 'test' "
        "directory in project's root and put a test set.\n"
github platformio / platformio-core / platformio / exception.py View on Github external
#
# Development Platform
#


class UnknownPlatform(PlatformioException):

    MESSAGE = "Unknown development platform '{0}'"


class IncompatiblePlatform(PlatformioException):

    MESSAGE = "Development platform '{0}' is not compatible with PIO Core v{1}"


class PlatformNotInstalledYet(PlatformioException):

    MESSAGE = (
        "The platform '{0}' has not been installed yet. "
        "Use `platformio platform install {0}` command"
    )


class UnknownBoard(PlatformioException):

    MESSAGE = "Unknown board ID '{0}'"


class InvalidBoardManifest(PlatformioException):

    MESSAGE = "Invalid board JSON manifest '{0}'"
github platformio / platformio-core / platformio / exception.py View on Github external
# pylint: disable=not-an-iterable
            return self.MESSAGE.format(*self.args)

        return super(PlatformioException, self).__str__()


class ReturnErrorCode(PlatformioException):

    MESSAGE = "{0}"


class LockFileTimeoutError(PlatformioException):
    pass


class MinitermException(PlatformioException):
    pass


class UserSideException(PlatformioException):
    pass


class AbortedByUser(UserSideException):

    MESSAGE = "Aborted by user"


#
# Development Platform
#
github platformio / platformio-core / platformio / exception.py View on Github external
MESSAGE = None

    def __str__(self):  # pragma: no cover
        if self.MESSAGE:
            # pylint: disable=not-an-iterable
            return self.MESSAGE.format(*self.args)

        return super(PlatformioException, self).__str__()


class ReturnErrorCode(PlatformioException):

    MESSAGE = "{0}"


class LockFileTimeoutError(PlatformioException):
    pass


class MinitermException(PlatformioException):
    pass


class UserSideException(PlatformioException):
    pass


class AbortedByUser(UserSideException):

    MESSAGE = "Aborted by user"
github platformio / platformio-core / platformio / managers / platform.py View on Github external
def __init__(self, manifest_path):
        self._id = basename(manifest_path)[:-5]
        assert isfile(manifest_path)
        self.manifest_path = manifest_path
        try:
            self._manifest = util.load_json(manifest_path)
        except ValueError:
            raise exception.InvalidBoardManifest(manifest_path)
        if not set(["name", "url", "vendor"]) <= set(self._manifest):
            raise exception.PlatformioException(
                "Please specify name, url and vendor fields for " +
                manifest_path)
github platformio / platformio-core / platformio / exception.py View on Github external
"If you build a project first time, we need Internet connection "
        "to install all dependencies and toolchains."
    )


class BuildScriptNotFound(PlatformioException):

    MESSAGE = "Invalid path '{0}' to build script"


class InvalidSettingName(PlatformioException):

    MESSAGE = "Invalid setting with the name '{0}'"


class InvalidSettingValue(PlatformioException):

    MESSAGE = "Invalid value '{0}' for the setting '{1}'"


class InvalidJSONFile(PlatformioException):

    MESSAGE = "Could not load broken JSON: {0}"


class CIBuildEnvsEmpty(PlatformioException):

    MESSAGE = (
        "Can't find PlatformIO build environments.\n"
        "Please specify `--board` or path to `platformio.ini` with "
        "predefined environments using `--project-conf` option"
    )
github bq / bitbloq-offline / app / res / web2board / darwin / Web2Board.app / Contents / Resources / platformio / ide / projectgenerator.py View on Github external
def get_project_build_data(self):
        data = {
            "defines": [],
            "includes": [],
            "cxx_path": None
        }
        envdata = self.get_project_env()
        if "env_name" not in envdata:
            return data
        result = util.exec_command(
            ["platformio", "-f", "run", "-t", "idedata",
             "-e", envdata['env_name'], "-d", self.project_dir]
        )

        if result['returncode'] != 0 or '"includes":' not in result['out']:
            raise exception.PlatformioException(
                "\n".join([result['out'], result['err']]))

        output = result['out']
        start_index = output.index('\n{"')
        stop_index = output.rindex('}')
        data = json.loads(output[start_index + 1:stop_index + 1])

        return data