Skip to content

Commit bbcd92b

Browse files
committed
Merge branch 'release/v6.1.8'
2 parents fc12dda + 3b3fbec commit bbcd92b

File tree

103 files changed

+959
-689
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+959
-689
lines changed

.github/ISSUE_TEMPLATE.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ What kind of issue is this?
66
use [Community Forums](https://community.platformio.org) or [Premium Support](https://platformio.org/support)
77

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

1312
- [ ] **Development Platform or Board**.
1413
All issues (building, uploading, adding new boards, etc.) related to PlatformIO development platforms

.github/workflows/deployment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
tox -e testcore
3636
3737
- name: Build Python source tarball
38-
run: python setup.py sdist
38+
run: python setup.py sdist bdist_wheel
3939

4040
- name: Publish package to PyPI
4141
if: ${{ github.ref == 'refs/heads/master' }}

.github/workflows/projects.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
folder: "Marlin"
1414
config_dir: "Marlin"
1515
env_name: "mega2560"
16-
# - esphome:
17-
# repository: "esphome/esphome"
18-
# folder: "esphome"
19-
# config_dir: "esphome"
20-
# env_name: "esp32-arduino"
16+
- esphome:
17+
repository: "esphome/esphome"
18+
folder: "esphome"
19+
config_dir: "esphome"
20+
env_name: "esp32-arduino"
2121
- smartknob:
2222
repository: "scottbez1/smartknob"
2323
folder: "smartknob"

CONTRIBUTING.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ To get started, <a href="https://cla-assistant.io/platformio/platformio-core">si
66
1. Fork the repository on GitHub
77
2. Clone repository `git clone --recursive https://github.com/YourGithubUsername/platformio-core.git`
88
3. Run `pip install tox`
9-
4. Go to the root of project where is located `tox.ini` and run `tox -e py37`
9+
4. Go to the root of the PlatformIO Core project where `tox.ini` is located (``cd platformio-core``) and run `tox -e py39`.
10+
You can replace `py39` with your own Python version. For example, `py311` means Python 3.11.
1011
5. Activate current development environment:
1112

12-
* Windows: `.tox\py37\Scripts\activate`
13-
* Bash/ZSH: `source .tox/py37/bin/activate`
14-
* Fish: `source .tox/py37/bin/activate.fish`
13+
* Windows: `.tox\py39\Scripts\activate`
14+
* Bash/ZSH: `source .tox/py39/bin/activate`
15+
* Fish: `source .tox/py39/bin/activate.fish`
1516

1617
6. Make changes to code, documentation, etc.
1718
7. Lint source code `make before-commit`

HISTORY.rst

+13
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ PlatformIO Core 6
1515

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

18+
6.1.8 (2023-07-05)
19+
~~~~~~~~~~~~~~~~~~
20+
21+
* 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|
22+
* Enhanced the parsing of the |PIOCONF| to provide comprehensive diagnostic information
23+
* 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
24+
* Optimized project integration templates to address the issue of long paths on Windows (`issue #4652 <https://github.com/platformio/platformio-core/issues/4652>`_)
25+
* Refactored |UNITTESTING| engine to resolve compiler warnings with "-Wpedantic" option (`pull #4671 <https://github.com/platformio/platformio-core/pull/4671>`_)
26+
* 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>`_)
27+
* 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
28+
* 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>`_)
29+
* Removed PlatformIO IDE for Atom from the documentation as `Atom has been deprecated <https://github.blog/2022-06-08-sunsetting-atom/>`__
30+
1831
6.1.7 (2023-05-08)
1932
~~~~~~~~~~~~~~~~~~
2033

docs

Submodule docs updated 109 files

platformio/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
VERSION = (6, 1, 7)
15+
VERSION = (6, 1, 8)
1616
__version__ = ".".join([str(s) for s in VERSION])
1717

1818
__title__ = "platformio"

platformio/__main__.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import os
1616
import sys
17-
from traceback import format_exc
17+
import traceback
1818

1919
import click
2020

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

56-
maintenance.on_platformio_start(ctx, caller)
56+
maintenance.on_cmd_start(ctx, caller)
5757

5858

5959
@cli.result_callback()
6060
@click.pass_context
61-
def process_result(ctx, result, *_, **__):
62-
maintenance.on_platformio_end(ctx, result)
61+
def process_result(*_, **__):
62+
maintenance.on_cmd_end()
6363

6464

6565
def configure():
@@ -96,6 +96,7 @@ def main(argv=None):
9696
if argv:
9797
assert isinstance(argv, list)
9898
sys.argv = argv
99+
99100
try:
100101
ensure_python3(raise_exception=True)
101102
configure()
@@ -106,18 +107,18 @@ def main(argv=None):
106107
except Exception as exc: # pylint: disable=broad-except
107108
if not isinstance(exc, exception.ReturnErrorCode):
108109
maintenance.on_platformio_exception(exc)
109-
error_str = "Error: "
110+
error_str = f"{exc.__class__.__name__}: "
110111
if isinstance(exc, exception.PlatformioException):
111112
error_str += str(exc)
112113
else:
113-
error_str += format_exc()
114+
error_str += traceback.format_exc()
114115
error_str += """
115116
============================================================
116117
117118
An unexpected error occurred. Further steps:
118119
119120
* Verify that you have the latest version of PlatformIO using
120-
`pip install -U platformio` command
121+
`python -m pip install -U platformio` command
121122
122123
* Try to find answer in FAQ Troubleshooting section
123124
https://docs.platformio.org/page/faq/index.html
@@ -129,6 +130,8 @@ def main(argv=None):
129130
"""
130131
click.secho(error_str, fg="red", err=True)
131132
exit_code = int(str(exc)) if str(exc).isdigit() else 1
133+
134+
maintenance.on_platformio_exit()
132135
sys.argv = prev_sys_argv
133136
return exit_code
134137

platformio/account/client.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
import time
1717

1818
from platformio import __accounts_api__, app
19-
from platformio.exception import PlatformioException
19+
from platformio.exception import PlatformioException, UserSideException
2020
from platformio.http import HTTPClient, HTTPClientError
2121

2222

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

2626

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

3030

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

3434

platformio/app.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import os
1919
import platform
2020
import socket
21+
import time
2122
import uuid
2223

2324
from platformio import __version__, exception, fs, proc
@@ -68,18 +69,23 @@ def projects_dir_validate(projects_dir):
6869
"command_ctx": None,
6970
"caller_id": None,
7071
"custom_project_conf": None,
72+
"pause_telemetry": False,
7173
}
7274

7375

76+
def resolve_state_path(conf_option_dir, file_name, ensure_dir_exists=True):
77+
state_dir = ProjectConfig.get_instance().get("platformio", conf_option_dir)
78+
if ensure_dir_exists and not os.path.isdir(state_dir):
79+
os.makedirs(state_dir)
80+
return os.path.join(state_dir, file_name)
81+
82+
7483
class State:
7584
def __init__(self, path=None, lock=False):
7685
self.path = path
7786
self.lock = lock
7887
if not self.path:
79-
core_dir = ProjectConfig.get_instance().get("platformio", "core_dir")
80-
if not os.path.isdir(core_dir):
81-
os.makedirs(core_dir)
82-
self.path = os.path.join(core_dir, "appstate.json")
88+
self.path = resolve_state_path("core_dir", "appstate.json")
8389
self._storage = {}
8490
self._lockfile = None
8591
self.modified = False
@@ -248,6 +254,7 @@ def get_cid():
248254
cid = str(cid)
249255
if IS_WINDOWS or os.getuid() > 0: # pylint: disable=no-member
250256
set_state_item("cid", cid)
257+
set_state_item("created_at", int(time.time()))
251258
return cid
252259

253260

platformio/assets/templates/ide-projects/atom/.clang_complete.tpl

-6
This file was deleted.

platformio/assets/templates/ide-projects/atom/.gcc-flags.json.tpl

-9
This file was deleted.

platformio/assets/templates/ide-projects/atom/.gitignore.tpl

-3
This file was deleted.

platformio/assets/templates/ide-projects/qtcreator/platformio.cflags.tpl

-1
This file was deleted.

platformio/assets/templates/ide-projects/qtcreator/platformio.cxxflags.tpl

-1
This file was deleted.

platformio/builder/main.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
variables=clivars,
7373
# Propagating External Environment
7474
ENV=os.environ,
75-
UNIX_TIME=int(time()),
75+
TIMESTAMP=int(time()),
76+
UNIX_TIME="$TIMESTAMP", # deprecated
7677
BUILD_DIR=os.path.join("$PROJECT_BUILD_DIR", "$PIOENV"),
7778
BUILD_SRC_DIR=os.path.join("$BUILD_DIR", "src"),
7879
BUILD_TEST_DIR=os.path.join("$BUILD_DIR", "test"),

platformio/builder/tools/piobuild.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,16 @@ def ParseFlagsExtended(env, flags): # pylint: disable=too-many-branches
200200
# fix relative CPPPATH & LIBPATH
201201
for k in ("CPPPATH", "LIBPATH"):
202202
for i, p in enumerate(result.get(k, [])):
203+
p = env.subst(p)
203204
if os.path.isdir(p):
204205
result[k][i] = os.path.abspath(p)
205206

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

211214
return result
212215

platformio/builder/tools/piointegration.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import glob
1717
import os
1818

19+
import click
1920
import SCons.Defaults # pylint: disable=import-error
2021
import SCons.Subst # pylint: disable=import-error
2122
from SCons.Script import COMMAND_LINE_TARGETS # pylint: disable=import-error
@@ -154,8 +155,12 @@ def DumpIntegrationData(*args):
154155
],
155156
"defines": dump_defines(projenv),
156157
"includes": projenv.DumpIntegrationIncludes(),
157-
"cc_flags": _subst_cmd(projenv, "$CFLAGS $CCFLAGS $CPPFLAGS"),
158-
"cxx_flags": _subst_cmd(projenv, "$CXXFLAGS $CCFLAGS $CPPFLAGS"),
158+
"cc_flags": click.parser.split_arg_string(
159+
_subst_cmd(projenv, "$CFLAGS $CCFLAGS $CPPFLAGS")
160+
),
161+
"cxx_flags": click.parser.split_arg_string(
162+
_subst_cmd(projenv, "$CXXFLAGS $CCFLAGS $CPPFLAGS")
163+
),
159164
"cc_path": where_is_program(
160165
globalenv.subst("$CC"), globalenv.subst("${ENV['PATH']}")
161166
),

platformio/check/tools/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def _load_cpp_data(self):
6060
data = load_build_metadata(self.project_dir, self.envname)
6161
if not data:
6262
return
63-
self.cc_flags = click.parser.split_arg_string(data.get("cc_flags", ""))
64-
self.cxx_flags = click.parser.split_arg_string(data.get("cxx_flags", ""))
63+
self.cc_flags = data.get("cc_flags", [])
64+
self.cxx_flags = data.get("cxx_flags", [])
6565
self.cpp_includes = self._dump_includes(data.get("includes", {}))
6666
self.cpp_defines = data.get("defines", [])
6767
self.cc_path = data.get("cc_path")

platformio/cli.py

+15
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ def in_silence():
6363
]
6464
)
6565

66+
@classmethod
67+
def reveal_cmd_path_args(cls, ctx):
68+
result = []
69+
group = ctx.command
70+
args = cls.leftover_args[::]
71+
while args:
72+
cmd_name = args.pop(0)
73+
next_group = group.get_command(ctx, cmd_name)
74+
if next_group:
75+
group = next_group
76+
result.append(cmd_name)
77+
if not hasattr(group, "get_command"):
78+
break
79+
return result
80+
6681
def invoke(self, ctx):
6782
PlatformioCLI.leftover_args = ctx.args
6883
if hasattr(ctx, "protected_args"):

platformio/commands/upgrade.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,15 @@ def cli(dev, verbose):
5353
subprocess.run(
5454
[python_exe, "-m", "pip", "install", "--upgrade", pkg_spec],
5555
check=True,
56-
capture_output=not verbose,
56+
stdout=subprocess.PIPE if not verbose else None,
5757
)
58-
r = subprocess.run(
58+
output = subprocess.run(
5959
[python_exe, "-m", "platformio", "--version"],
6060
check=True,
61-
capture_output=True,
62-
text=True,
63-
)
64-
assert "version" in r.stdout
65-
actual_version = r.stdout.split("version", 1)[1].strip()
61+
stdout=subprocess.PIPE,
62+
).stdout.decode()
63+
assert "version" in output
64+
actual_version = output.split("version", 1)[1].strip()
6665
click.secho(
6766
"PlatformIO has been successfully upgraded to %s" % actual_version,
6867
fg="green",

platformio/compat.py

+15
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import importlib.util
1818
import inspect
1919
import locale
20+
import shlex
2021
import sys
2122

2223
from platformio.exception import UserSideException
@@ -29,6 +30,20 @@
2930
from asyncio import get_event_loop as aio_get_running_loop
3031

3132

33+
if sys.version_info >= (3, 8):
34+
from shlex import join as shlex_join
35+
else:
36+
37+
def shlex_join(split_command):
38+
return " ".join(shlex.quote(arg) for arg in split_command)
39+
40+
41+
if sys.version_info >= (3, 9):
42+
from asyncio import to_thread as aio_to_thread
43+
else:
44+
from starlette.concurrency import run_in_threadpool as aio_to_thread
45+
46+
3247
PY2 = sys.version_info[0] == 2 # DO NOT REMOVE IT. ESP8266/ESP32 depend on it
3348
IS_CYGWIN = sys.platform.startswith("cygwin")
3449
IS_WINDOWS = WINDOWS = sys.platform.startswith("win")

platformio/debug/exception.py

+4
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ class DebugSupportError(DebugError, UserSideException):
3030

3131
class DebugInvalidOptionsError(DebugError, UserSideException):
3232
pass
33+
34+
35+
class DebugInitError(DebugError, UserSideException):
36+
pass

0 commit comments

Comments
 (0)