Skip to content

Commit

Permalink
Merge branch 'release/v6.1.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Jul 5, 2023
2 parents fc12dda + 3b3fbec commit bbcd92b
Show file tree
Hide file tree
Showing 103 changed files with 959 additions and 689 deletions.
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ What kind of issue is this?
use [Community Forums](https://community.platformio.org) or [Premium Support](https://platformio.org/support)

- [ ] **PlatformIO IDE**.
All issues related to PlatformIO IDE should be reported to appropriate repository:
[PlatformIO IDE for Atom](https://github.com/platformio/platformio-atom-ide/issues) or
[PlatformIO IDE for VSCode](https://github.com/platformio/platformio-vscode-ide/issues)
All issues related to PlatformIO IDE should be reported to the
[PlatformIO IDE for VSCode](https://github.com/platformio/platformio-vscode-ide/issues) repository

- [ ] **Development Platform or Board**.
All issues (building, uploading, adding new boards, etc.) related to PlatformIO development platforms
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
tox -e testcore
- name: Build Python source tarball
run: python setup.py sdist
run: python setup.py sdist bdist_wheel

- name: Publish package to PyPI
if: ${{ github.ref == 'refs/heads/master' }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/projects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
folder: "Marlin"
config_dir: "Marlin"
env_name: "mega2560"
# - esphome:
# repository: "esphome/esphome"
# folder: "esphome"
# config_dir: "esphome"
# env_name: "esp32-arduino"
- esphome:
repository: "esphome/esphome"
folder: "esphome"
config_dir: "esphome"
env_name: "esp32-arduino"
- smartknob:
repository: "scottbez1/smartknob"
folder: "smartknob"
Expand Down
9 changes: 5 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ To get started, <a href="https://cla-assistant.io/platformio/platformio-core">si
1. Fork the repository on GitHub
2. Clone repository `git clone --recursive https://github.com/YourGithubUsername/platformio-core.git`
3. Run `pip install tox`
4. Go to the root of project where is located `tox.ini` and run `tox -e py37`
4. Go to the root of the PlatformIO Core project where `tox.ini` is located (``cd platformio-core``) and run `tox -e py39`.
You can replace `py39` with your own Python version. For example, `py311` means Python 3.11.
5. Activate current development environment:

* Windows: `.tox\py37\Scripts\activate`
* Bash/ZSH: `source .tox/py37/bin/activate`
* Fish: `source .tox/py37/bin/activate.fish`
* Windows: `.tox\py39\Scripts\activate`
* Bash/ZSH: `source .tox/py39/bin/activate`
* Fish: `source .tox/py39/bin/activate.fish`

6. Make changes to code, documentation, etc.
7. Lint source code `make before-commit`
Expand Down
13 changes: 13 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ PlatformIO Core 6

**A professional collaborative platform for declarative, safety-critical, and test-driven embedded development.**

6.1.8 (2023-07-05)
~~~~~~~~~~~~~~~~~~

* Added a new ``--lint`` option to the `pio project config <https://docs.platformio.org/en/latest/core/userguide/project/cmd_config.html>`__ command, enabling users to efficiently perform linting on the |PIOCONF|
* Enhanced the parsing of the |PIOCONF| to provide comprehensive diagnostic information
* Expanded the functionality of the |LIBRARYJSON| manifest by allowing the use of the underscore symbol in the `keywords <https://docs.platformio.org/en/latest/manifests/library-json/fields/keywords.html>`__ field
* Optimized project integration templates to address the issue of long paths on Windows (`issue #4652 <https://github.com/platformio/platformio-core/issues/4652>`_)
* Refactored |UNITTESTING| engine to resolve compiler warnings with "-Wpedantic" option (`pull #4671 <https://github.com/platformio/platformio-core/pull/4671>`_)
* Eliminated erroneous warning regarding the use of obsolete PlatformIO Core when downgrading to the stable version (`issue #4664 <https://github.com/platformio/platformio-core/issues/4664>`_)
* Updated the `pio project metadata <https://docs.platformio.org/en/latest/core/userguide/project/cmd_metadata.html>`__ command to return C/C++ flags as parsed Unix shell arguments when dumping project build metadata
* Resolved a critical issue related to the usage of the ``-include`` flag within the `build_flags <https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_flags.html>`__ option, specifically when employing dynamic variables (`issue #4682 <https://github.com/platformio/platformio-core/issues/4682>`_)
* Removed PlatformIO IDE for Atom from the documentation as `Atom has been deprecated <https://github.blog/2022-06-08-sunsetting-atom/>`__

6.1.7 (2023-05-08)
~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion docs
Submodule docs updated 109 files
2 changes: 1 addition & 1 deletion platformio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

VERSION = (6, 1, 7)
VERSION = (6, 1, 8)
__version__ = ".".join([str(s) for s in VERSION])

__title__ = "platformio"
Expand Down
17 changes: 10 additions & 7 deletions platformio/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import os
import sys
from traceback import format_exc
import traceback

import click

Expand Down Expand Up @@ -53,13 +53,13 @@ def cli(ctx, force, caller, no_ansi): # pylint: disable=unused-argument
except: # pylint: disable=bare-except
pass

maintenance.on_platformio_start(ctx, caller)
maintenance.on_cmd_start(ctx, caller)


@cli.result_callback()
@click.pass_context
def process_result(ctx, result, *_, **__):
maintenance.on_platformio_end(ctx, result)
def process_result(*_, **__):
maintenance.on_cmd_end()


def configure():
Expand Down Expand Up @@ -96,6 +96,7 @@ def main(argv=None):
if argv:
assert isinstance(argv, list)
sys.argv = argv

try:
ensure_python3(raise_exception=True)
configure()
Expand All @@ -106,18 +107,18 @@ def main(argv=None):
except Exception as exc: # pylint: disable=broad-except
if not isinstance(exc, exception.ReturnErrorCode):
maintenance.on_platformio_exception(exc)
error_str = "Error: "
error_str = f"{exc.__class__.__name__}: "
if isinstance(exc, exception.PlatformioException):
error_str += str(exc)
else:
error_str += format_exc()
error_str += traceback.format_exc()
error_str += """
============================================================
An unexpected error occurred. Further steps:
* Verify that you have the latest version of PlatformIO using
`pip install -U platformio` command
`python -m pip install -U platformio` command
* Try to find answer in FAQ Troubleshooting section
https://docs.platformio.org/page/faq/index.html
Expand All @@ -129,6 +130,8 @@ def main(argv=None):
"""
click.secho(error_str, fg="red", err=True)
exit_code = int(str(exc)) if str(exc).isdigit() else 1

maintenance.on_platformio_exit()
sys.argv = prev_sys_argv
return exit_code

Expand Down
6 changes: 3 additions & 3 deletions platformio/account/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
import time

from platformio import __accounts_api__, app
from platformio.exception import PlatformioException
from platformio.exception import PlatformioException, UserSideException
from platformio.http import HTTPClient, HTTPClientError


class AccountError(PlatformioException):
MESSAGE = "{0}"


class AccountNotAuthorized(AccountError):
class AccountNotAuthorized(AccountError, UserSideException):
MESSAGE = "You are not authorized! Please log in to PlatformIO Account."


class AccountAlreadyAuthorized(AccountError):
class AccountAlreadyAuthorized(AccountError, UserSideException):
MESSAGE = "You are already authorized with {0} account."


Expand Down
15 changes: 11 additions & 4 deletions platformio/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import os
import platform
import socket
import time
import uuid

from platformio import __version__, exception, fs, proc
Expand Down Expand Up @@ -68,18 +69,23 @@ def projects_dir_validate(projects_dir):
"command_ctx": None,
"caller_id": None,
"custom_project_conf": None,
"pause_telemetry": False,
}


def resolve_state_path(conf_option_dir, file_name, ensure_dir_exists=True):
state_dir = ProjectConfig.get_instance().get("platformio", conf_option_dir)
if ensure_dir_exists and not os.path.isdir(state_dir):
os.makedirs(state_dir)
return os.path.join(state_dir, file_name)


class State:
def __init__(self, path=None, lock=False):
self.path = path
self.lock = lock
if not self.path:
core_dir = ProjectConfig.get_instance().get("platformio", "core_dir")
if not os.path.isdir(core_dir):
os.makedirs(core_dir)
self.path = os.path.join(core_dir, "appstate.json")
self.path = resolve_state_path("core_dir", "appstate.json")
self._storage = {}
self._lockfile = None
self.modified = False
Expand Down Expand Up @@ -248,6 +254,7 @@ def get_cid():
cid = str(cid)
if IS_WINDOWS or os.getuid() > 0: # pylint: disable=no-member
set_state_item("cid", cid)
set_state_item("created_at", int(time.time()))
return cid


Expand Down

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions platformio/assets/templates/ide-projects/atom/.gitignore.tpl

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 2 additions & 1 deletion platformio/builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
variables=clivars,
# Propagating External Environment
ENV=os.environ,
UNIX_TIME=int(time()),
TIMESTAMP=int(time()),
UNIX_TIME="$TIMESTAMP", # deprecated
BUILD_DIR=os.path.join("$PROJECT_BUILD_DIR", "$PIOENV"),
BUILD_SRC_DIR=os.path.join("$BUILD_DIR", "src"),
BUILD_TEST_DIR=os.path.join("$BUILD_DIR", "test"),
Expand Down
5 changes: 4 additions & 1 deletion platformio/builder/tools/piobuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,16 @@ def ParseFlagsExtended(env, flags): # pylint: disable=too-many-branches
# fix relative CPPPATH & LIBPATH
for k in ("CPPPATH", "LIBPATH"):
for i, p in enumerate(result.get(k, [])):
p = env.subst(p)
if os.path.isdir(p):
result[k][i] = os.path.abspath(p)

# fix relative path for "-include"
for i, f in enumerate(result.get("CCFLAGS", [])):
if isinstance(f, tuple) and f[0] == "-include":
result["CCFLAGS"][i] = (f[0], env.File(os.path.abspath(f[1].get_path())))
p = env.subst(f[1].get_path())
if os.path.exists(p):
result["CCFLAGS"][i] = (f[0], os.path.abspath(p))

return result

Expand Down
9 changes: 7 additions & 2 deletions platformio/builder/tools/piointegration.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import glob
import os

import click
import SCons.Defaults # pylint: disable=import-error
import SCons.Subst # pylint: disable=import-error
from SCons.Script import COMMAND_LINE_TARGETS # pylint: disable=import-error
Expand Down Expand Up @@ -154,8 +155,12 @@ def DumpIntegrationData(*args):
],
"defines": dump_defines(projenv),
"includes": projenv.DumpIntegrationIncludes(),
"cc_flags": _subst_cmd(projenv, "$CFLAGS $CCFLAGS $CPPFLAGS"),
"cxx_flags": _subst_cmd(projenv, "$CXXFLAGS $CCFLAGS $CPPFLAGS"),
"cc_flags": click.parser.split_arg_string(
_subst_cmd(projenv, "$CFLAGS $CCFLAGS $CPPFLAGS")
),
"cxx_flags": click.parser.split_arg_string(
_subst_cmd(projenv, "$CXXFLAGS $CCFLAGS $CPPFLAGS")
),
"cc_path": where_is_program(
globalenv.subst("$CC"), globalenv.subst("${ENV['PATH']}")
),
Expand Down
4 changes: 2 additions & 2 deletions platformio/check/tools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def _load_cpp_data(self):
data = load_build_metadata(self.project_dir, self.envname)
if not data:
return
self.cc_flags = click.parser.split_arg_string(data.get("cc_flags", ""))
self.cxx_flags = click.parser.split_arg_string(data.get("cxx_flags", ""))
self.cc_flags = data.get("cc_flags", [])
self.cxx_flags = data.get("cxx_flags", [])
self.cpp_includes = self._dump_includes(data.get("includes", {}))
self.cpp_defines = data.get("defines", [])
self.cc_path = data.get("cc_path")
Expand Down
15 changes: 15 additions & 0 deletions platformio/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ def in_silence():
]
)

@classmethod
def reveal_cmd_path_args(cls, ctx):
result = []
group = ctx.command
args = cls.leftover_args[::]
while args:
cmd_name = args.pop(0)
next_group = group.get_command(ctx, cmd_name)
if next_group:
group = next_group
result.append(cmd_name)
if not hasattr(group, "get_command"):
break
return result

def invoke(self, ctx):
PlatformioCLI.leftover_args = ctx.args
if hasattr(ctx, "protected_args"):
Expand Down
13 changes: 6 additions & 7 deletions platformio/commands/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,15 @@ def cli(dev, verbose):
subprocess.run(
[python_exe, "-m", "pip", "install", "--upgrade", pkg_spec],
check=True,
capture_output=not verbose,
stdout=subprocess.PIPE if not verbose else None,
)
r = subprocess.run(
output = subprocess.run(
[python_exe, "-m", "platformio", "--version"],
check=True,
capture_output=True,
text=True,
)
assert "version" in r.stdout
actual_version = r.stdout.split("version", 1)[1].strip()
stdout=subprocess.PIPE,
).stdout.decode()
assert "version" in output
actual_version = output.split("version", 1)[1].strip()
click.secho(
"PlatformIO has been successfully upgraded to %s" % actual_version,
fg="green",
Expand Down
15 changes: 15 additions & 0 deletions platformio/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import importlib.util
import inspect
import locale
import shlex
import sys

from platformio.exception import UserSideException
Expand All @@ -29,6 +30,20 @@
from asyncio import get_event_loop as aio_get_running_loop


if sys.version_info >= (3, 8):
from shlex import join as shlex_join
else:

def shlex_join(split_command):
return " ".join(shlex.quote(arg) for arg in split_command)


if sys.version_info >= (3, 9):
from asyncio import to_thread as aio_to_thread
else:
from starlette.concurrency import run_in_threadpool as aio_to_thread


PY2 = sys.version_info[0] == 2 # DO NOT REMOVE IT. ESP8266/ESP32 depend on it
IS_CYGWIN = sys.platform.startswith("cygwin")
IS_WINDOWS = WINDOWS = sys.platform.startswith("win")
Expand Down
4 changes: 4 additions & 0 deletions platformio/debug/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ class DebugSupportError(DebugError, UserSideException):

class DebugInvalidOptionsError(DebugError, UserSideException):
pass


class DebugInitError(DebugError, UserSideException):
pass

0 comments on commit bbcd92b

Please sign in to comment.