mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 18:17:13 +02:00
Merge branch 'develop' into feature/v7
This commit is contained in:
@ -22,6 +22,7 @@ PlatformIO Core 6
|
||||
* Resolved an issue encountered while utilizing the `pio pkg exec <https://docs.platformio.org/en/latest/core/userguide/pkg/cmd_exec.html>`__ command on the Windows platform to execute Python scripts from a package
|
||||
* Implemented a crucial improvement to the `pio run <https://docs.platformio.org/en/latest/core/userguide/cmd_run.html>`__ command, guaranteeing that the ``monitor`` target is not executed if any of the preceding targets, such as ``upload``, encounter failures
|
||||
* `Cppcheck <https://docs.platformio.org/en/latest/plus/check-tools/cppcheck.html>`__ v2.11 with new checks, CLI commands and various analysis improvements
|
||||
* Resolved a critical issue that arose on macOS ARM platforms due to the Python "requests" module, leading to a "ModuleNotFoundError: No module named 'chardet'" (`issue #4702 <https://github.com/platformio/platformio-core/issues/4702>`_)
|
||||
|
||||
6.1.9 (2023-07-06)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
VERSION = (6, 1, "10a3")
|
||||
VERSION = (6, 1, "10a4")
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
@ -56,3 +56,22 @@ __check_internet_hosts__ = [
|
||||
"88.198.170.159", # platformio.org
|
||||
"github.com",
|
||||
] + __registry_mirror_hosts__
|
||||
|
||||
__install_requires__ = [
|
||||
# Core requirements
|
||||
"bottle == 0.12.*",
|
||||
"click >=8.0.4, <=8.2",
|
||||
"colorama",
|
||||
"marshmallow == 3.*",
|
||||
"pyelftools == 0.29",
|
||||
"pyserial == 3.5.*", # keep in sync "device/monitor/terminal.py"
|
||||
"requests == 2.*",
|
||||
"semantic_version == 2.10.*",
|
||||
"tabulate == 0.*",
|
||||
] + [
|
||||
# PIO Home requirements
|
||||
"ajsonrpc == 1.2.*",
|
||||
"starlette >=0.19, <0.32",
|
||||
"uvicorn >=0.16, <0.24",
|
||||
"wsproto == 1.*",
|
||||
]
|
||||
|
@ -18,7 +18,7 @@ import subprocess
|
||||
|
||||
import click
|
||||
|
||||
from platformio import VERSION, __version__, app, exception
|
||||
from platformio import VERSION, __install_requires__, __version__, app, exception
|
||||
from platformio.http import fetch_remote_content
|
||||
from platformio.package.manager.core import update_core_packages
|
||||
from platformio.proc import get_pythonexe_path
|
||||
@ -33,9 +33,14 @@ DEVELOP_INIT_SCRIPT_URL = (
|
||||
|
||||
@click.command("upgrade", short_help="Upgrade PlatformIO Core to the latest version")
|
||||
@click.option("--dev", is_flag=True, help="Use development branch")
|
||||
@click.option("--only-dependencies", is_flag=True)
|
||||
@click.option("--verbose", "-v", is_flag=True)
|
||||
def cli(dev, verbose):
|
||||
def cli(dev, only_dependencies, verbose):
|
||||
if only_dependencies:
|
||||
return upgrade_pypi_dependencies(verbose)
|
||||
|
||||
update_core_packages()
|
||||
|
||||
if not dev and __version__ == get_latest_version():
|
||||
return click.secho(
|
||||
"You're up-to-date!\nPlatformIO %s is currently the "
|
||||
@ -50,11 +55,21 @@ def cli(dev, verbose):
|
||||
pkg_spec = DEVELOP_ZIP_URL if to_develop else "platformio"
|
||||
|
||||
try:
|
||||
# PIO Core
|
||||
subprocess.run(
|
||||
[python_exe, "-m", "pip", "install", "--upgrade", pkg_spec],
|
||||
check=True,
|
||||
stdout=subprocess.PIPE if not verbose else None,
|
||||
)
|
||||
|
||||
# PyPI dependencies
|
||||
subprocess.run(
|
||||
[python_exe, "-m", "platformio", "upgrade", "--only-dependencies"],
|
||||
check=False,
|
||||
stdout=subprocess.PIPE,
|
||||
)
|
||||
|
||||
# Check version
|
||||
output = subprocess.run(
|
||||
[python_exe, "-m", "platformio", "--version"],
|
||||
check=True,
|
||||
@ -87,9 +102,20 @@ def cli(dev, verbose):
|
||||
return True
|
||||
|
||||
|
||||
def get_pkg_spec(to_develop):
|
||||
if to_develop:
|
||||
return
|
||||
def upgrade_pypi_dependencies(verbose):
|
||||
subprocess.run(
|
||||
[
|
||||
get_pythonexe_path(),
|
||||
"-m",
|
||||
"pip",
|
||||
"install",
|
||||
"--upgrade",
|
||||
"pip",
|
||||
*__install_requires__,
|
||||
],
|
||||
check=True,
|
||||
stdout=subprocess.PIPE if not verbose else None,
|
||||
)
|
||||
|
||||
|
||||
def get_latest_version():
|
||||
|
@ -1,105 +0,0 @@
|
||||
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
|
||||
#
|
||||
# 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.
|
||||
|
||||
import tempfile
|
||||
import io
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
MAIN_SCRIPT_URL = "https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py"
|
||||
|
||||
|
||||
def download_with_requests(url, dst):
|
||||
import requests
|
||||
|
||||
resp = requests.get(url, stream=True)
|
||||
itercontent = resp.iter_content(chunk_size=io.DEFAULT_BUFFER_SIZE)
|
||||
with open(dst, "wb") as fp:
|
||||
for chunk in itercontent:
|
||||
fp.write(chunk)
|
||||
return dst
|
||||
|
||||
|
||||
def download_with_urllib3(url, dst):
|
||||
import urllib3
|
||||
|
||||
http = urllib3.PoolManager()
|
||||
r = http.request("GET", url, preload_content=False)
|
||||
|
||||
with open(dst, "wb") as out:
|
||||
while True:
|
||||
data = r.read(io.DEFAULT_BUFFER_SIZE)
|
||||
if not data:
|
||||
break
|
||||
out.write(data)
|
||||
|
||||
r.release_conn()
|
||||
return dst
|
||||
|
||||
|
||||
def download_with_urllib(url, dst):
|
||||
if sys.version_info[0] == 3:
|
||||
from urllib.request import urlopen
|
||||
else:
|
||||
from urllib import urlopen
|
||||
|
||||
response = urlopen(url)
|
||||
CHUNK = 16 * 1024
|
||||
with open(dst, "wb") as f:
|
||||
while True:
|
||||
chunk = response.read(CHUNK)
|
||||
if not chunk:
|
||||
break
|
||||
f.write(chunk)
|
||||
|
||||
return dst
|
||||
|
||||
|
||||
def download_with_curl(url, dst):
|
||||
subprocess.check_output(["curl", "-o", dst, url])
|
||||
return dst
|
||||
|
||||
|
||||
def download_with_wget(url, dst):
|
||||
subprocess.check_output(["wget", "-O", dst, url])
|
||||
return dst
|
||||
|
||||
|
||||
def download_file(url, dst):
|
||||
methods = [
|
||||
download_with_requests,
|
||||
download_with_urllib3,
|
||||
download_with_urllib,
|
||||
download_with_curl,
|
||||
download_with_wget,
|
||||
]
|
||||
for method in methods:
|
||||
try:
|
||||
method(url, dst)
|
||||
return dst
|
||||
except:
|
||||
pass
|
||||
raise Exception("Could not download file '%s' to '%s' " % (url, dst))
|
||||
|
||||
|
||||
def main():
|
||||
with tempfile.NamedTemporaryFile() as tmp_file:
|
||||
dst = download_file(MAIN_SCRIPT_URL, str(tmp_file.name))
|
||||
command = [sys.executable, dst]
|
||||
command.extend(sys.argv[1:])
|
||||
subprocess.check_call(command)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
51
setup.py
51
setup.py
@ -12,6 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import platform
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
from platformio import (
|
||||
@ -22,52 +23,12 @@ from platformio import (
|
||||
__title__,
|
||||
__url__,
|
||||
__version__,
|
||||
__install_requires__,
|
||||
)
|
||||
|
||||
py_37 = "python_version == '3.7'"
|
||||
py_below_37 = "python_version < '3.7'"
|
||||
py_gte_37 = "python_version >= '3.7'"
|
||||
py_gte_38 = "python_version >= '3.8'"
|
||||
|
||||
minimal_requirements = [
|
||||
"bottle==0.12.*",
|
||||
"click==8.0.4; " + py_below_37,
|
||||
"click==8.1.*; " + py_gte_37,
|
||||
"colorama",
|
||||
"marshmallow==3.14.1; " + py_below_37,
|
||||
"marshmallow==3.19.0; " + py_37,
|
||||
"marshmallow==3.20.*; " + py_gte_38,
|
||||
"pyelftools==0.29",
|
||||
"pyserial==3.5.*", # keep in sync "device/monitor/terminal.py"
|
||||
"requests==2.*",
|
||||
"semantic_version==2.10.*",
|
||||
"tabulate==0.*",
|
||||
]
|
||||
|
||||
home_requirements = [
|
||||
"ajsonrpc==1.2.*",
|
||||
"starlette==0.19.1; " + py_below_37,
|
||||
"starlette==0.29.0; " + py_37,
|
||||
"starlette==0.31.*; " + py_gte_38,
|
||||
"uvicorn==0.16.0; " + py_below_37,
|
||||
"uvicorn==0.22.0; " + py_37,
|
||||
"uvicorn==0.23.*; " + py_gte_38,
|
||||
"wsproto==1.0.0; " + py_below_37,
|
||||
"wsproto==1.2.*; " + py_gte_37,
|
||||
]
|
||||
|
||||
# issue 4614: urllib3 v2.0 only supports OpenSSL 1.1.1+
|
||||
try:
|
||||
import ssl
|
||||
|
||||
if ssl.OPENSSL_VERSION.startswith("OpenSSL ") and ssl.OPENSSL_VERSION_INFO < (
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
):
|
||||
minimal_requirements.append("urllib3<2")
|
||||
except ImportError:
|
||||
pass
|
||||
# issue #4702; Broken "requests/charset_normalizer" on macOS ARM
|
||||
if platform.system() == "Darwin" and "arm" in platform.machine().lower():
|
||||
__install_requires__.append("chardet>=3.0.2,<4")
|
||||
|
||||
|
||||
setup(
|
||||
@ -79,7 +40,7 @@ setup(
|
||||
author_email=__email__,
|
||||
url=__url__,
|
||||
license=__license__,
|
||||
install_requires=minimal_requirements + home_requirements,
|
||||
install_requires=__install_requires__,
|
||||
python_requires=">=3.6",
|
||||
packages=find_packages(include=["platformio", "platformio.*"]),
|
||||
package_data={
|
||||
|
Reference in New Issue
Block a user