forked from platformio/platformio-core
Finally removed all tracks to the Python 2.7
This commit is contained in:
@ -51,12 +51,13 @@ PlatformIO Core 5
|
||||
* **Integration**
|
||||
|
||||
- Added a new build variable (``COMPILATIONDB_INCLUDE_TOOLCHAIN``) to include toolchain paths in the compilation database (`issue #3735 <https://github.com/platformio/platformio-core/issues/3735>`_)
|
||||
- Changed default path for compilation database `compile_commands.json <https://docs.platformio.org/en/latest/integration/compile_commands.html>`__ to the root of the project
|
||||
- Changed default path for compilation database `compile_commands.json <https://docs.platformio.org/en/latest/integration/compile_commands.html>`__ to the project root
|
||||
|
||||
* **Miscellaneous**
|
||||
|
||||
- Improved PIO Remote setup on credit-card sized computers (Raspberry Pi, BeagleBon, etc) (`issue #3865 <https://github.com/platformio/platformio-core/issues/3865>`_)
|
||||
- Better handling of the failed tests using the `Unit Testing <https://docs.platformio.org/en/latest/plus/unit-testing.html>`__ solution.
|
||||
- Better handling of the failed tests using the `Unit Testing <https://docs.platformio.org/en/latest/plus/unit-testing.html>`__ solution
|
||||
- Finally removed all tracks to the Python 2.7, the Python 3.6 is the minimum supported version.
|
||||
|
||||
5.2.5 (2022-02-10)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
2
docs
2
docs
Submodule docs updated: 7c02d91f4e...bde1247be3
@ -12,15 +12,13 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# pylint: disable=import-outside-toplevel
|
||||
|
||||
import os
|
||||
import sys
|
||||
from traceback import format_exc
|
||||
|
||||
import click
|
||||
|
||||
from platformio import __version__, exception
|
||||
from platformio import __version__, exception, maintenance
|
||||
from platformio.commands import PlatformioCLI
|
||||
from platformio.compat import IS_CYGWIN, ensure_python3
|
||||
|
||||
@ -55,16 +53,12 @@ def cli(ctx, force, caller, no_ansi):
|
||||
except: # pylint: disable=bare-except
|
||||
pass
|
||||
|
||||
from platformio import maintenance
|
||||
|
||||
maintenance.on_platformio_start(ctx, force, caller)
|
||||
|
||||
|
||||
@cli.result_callback()
|
||||
@click.pass_context
|
||||
def process_result(ctx, result, *_, **__):
|
||||
from platformio import maintenance
|
||||
|
||||
maintenance.on_platformio_end(ctx, result)
|
||||
|
||||
|
||||
@ -111,10 +105,7 @@ def main(argv=None):
|
||||
exit_code = int(e.code)
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
if not isinstance(e, exception.ReturnErrorCode):
|
||||
if sys.version_info.major != 2:
|
||||
from platformio import maintenance
|
||||
|
||||
maintenance.on_platformio_exception(e)
|
||||
maintenance.on_platformio_exception(e)
|
||||
error_str = "Error: "
|
||||
if isinstance(e, exception.PlatformioException):
|
||||
error_str += str(e)
|
||||
|
@ -16,6 +16,7 @@ import json
|
||||
import math
|
||||
import os
|
||||
import socket
|
||||
from urllib.parse import urljoin
|
||||
|
||||
import requests.adapters
|
||||
from requests.packages.urllib3.util.retry import Retry # pylint:disable=import-error
|
||||
@ -24,11 +25,6 @@ from platformio import __check_internet_hosts__, __default_requests_timeout__, a
|
||||
from platformio.cache import ContentCache, cleanup_content_cache
|
||||
from platformio.exception import PlatformioException, UserSideException
|
||||
|
||||
try:
|
||||
from urllib.parse import urljoin
|
||||
except ImportError:
|
||||
from urlparse import urljoin
|
||||
|
||||
|
||||
class HTTPClientError(PlatformioException):
|
||||
def __init__(self, message, response=None):
|
||||
|
@ -14,10 +14,11 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from io import StringIO
|
||||
import threading
|
||||
|
||||
import click
|
||||
from ajsonrpc.core import JSONRPC20DispatchException
|
||||
@ -27,27 +28,22 @@ from platformio import __main__, __version__, fs, proc
|
||||
from platformio.commands.home import helpers
|
||||
from platformio.compat import get_locale_encoding, is_bytes
|
||||
|
||||
try:
|
||||
from thread import get_ident as thread_get_ident
|
||||
except ImportError:
|
||||
from threading import get_ident as thread_get_ident
|
||||
|
||||
|
||||
class MultiThreadingStdStream(object):
|
||||
def __init__(self, parent_stream):
|
||||
self._buffers = {thread_get_ident(): parent_stream}
|
||||
self._buffers = {threading.get_ident(): parent_stream}
|
||||
|
||||
def __getattr__(self, name):
|
||||
thread_id = thread_get_ident()
|
||||
thread_id = threading.get_ident()
|
||||
self._ensure_thread_buffer(thread_id)
|
||||
return getattr(self._buffers[thread_id], name)
|
||||
|
||||
def _ensure_thread_buffer(self, thread_id):
|
||||
if thread_id not in self._buffers:
|
||||
self._buffers[thread_id] = StringIO()
|
||||
self._buffers[thread_id] = io.StringIO()
|
||||
|
||||
def write(self, value):
|
||||
thread_id = thread_get_ident()
|
||||
thread_id = threading.get_ident()
|
||||
self._ensure_thread_buffer(thread_id)
|
||||
return self._buffers[thread_id].write(
|
||||
value.decode() if is_bytes(value) else value
|
||||
|
@ -18,6 +18,7 @@ import json
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
from urllib.parse import quote
|
||||
|
||||
import click
|
||||
from tabulate import tabulate
|
||||
@ -32,11 +33,6 @@ from platformio.proc import is_ci
|
||||
from platformio.project.config import ProjectConfig
|
||||
from platformio.project.helpers import get_project_dir, is_platformio_project
|
||||
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib import quote
|
||||
|
||||
CTX_META_INPUT_DIRS_KEY = __name__ + ".input_dirs"
|
||||
CTX_META_PROJECT_ENVIRONMENTS_KEY = __name__ + ".project_environments"
|
||||
CTX_META_STORAGE_DIRS_KEY = __name__ + ".storage_dirs"
|
||||
|
@ -20,16 +20,14 @@ import sys
|
||||
|
||||
from platformio.exception import UserSideException
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
if sys.version_info >= (3, 7):
|
||||
from asyncio import create_task as aio_create_task
|
||||
from asyncio import get_running_loop as aio_get_running_loop
|
||||
else:
|
||||
from asyncio import ensure_future as aio_create_task
|
||||
from asyncio import get_event_loop as aio_get_running_loop
|
||||
if sys.version_info >= (3, 7):
|
||||
from asyncio import create_task as aio_create_task
|
||||
from asyncio import get_running_loop as aio_get_running_loop
|
||||
else:
|
||||
from asyncio import ensure_future as aio_create_task
|
||||
from asyncio import get_event_loop as aio_get_running_loop
|
||||
|
||||
|
||||
PY2 = sys.version_info[0] == 2
|
||||
IS_CYGWIN = sys.platform.startswith("cygwin")
|
||||
IS_WINDOWS = WINDOWS = sys.platform.startswith("win")
|
||||
IS_MACOS = sys.platform.startswith("darwin")
|
||||
|
@ -13,6 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
import time
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import click
|
||||
|
||||
@ -22,11 +23,6 @@ from platformio.package.exception import UnknownPackageError
|
||||
from platformio.package.meta import PackageSpec
|
||||
from platformio.package.version import cast_version_to_semver
|
||||
|
||||
try:
|
||||
from urllib.parse import urlparse
|
||||
except ImportError:
|
||||
from urlparse import urlparse
|
||||
|
||||
|
||||
class RegistryFileMirrorIterator(object):
|
||||
|
||||
|
@ -18,6 +18,7 @@ import json
|
||||
import os
|
||||
import re
|
||||
import tarfile
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from platformio import util
|
||||
from platformio.clients.http import fetch_remote_content
|
||||
@ -25,11 +26,6 @@ from platformio.compat import get_object_members, string_types
|
||||
from platformio.package.exception import ManifestParserError, UnknownManifestError
|
||||
from platformio.project.helpers import is_platformio_project
|
||||
|
||||
try:
|
||||
from urllib.parse import urlparse
|
||||
except ImportError:
|
||||
from urlparse import urlparse
|
||||
|
||||
|
||||
class ManifestFileType(object):
|
||||
PLATFORM_JSON = "platform.json"
|
||||
|
@ -26,37 +26,21 @@ from platformio.clients.http import fetch_remote_content
|
||||
from platformio.package.exception import ManifestValidationError
|
||||
from platformio.util import memoized
|
||||
|
||||
MARSHMALLOW_2 = marshmallow.__version_info__ < (3,)
|
||||
|
||||
class BaseSchema(Schema):
|
||||
class Meta(object): # pylint: disable=no-init
|
||||
unknown = marshmallow.EXCLUDE # pylint: disable=no-member
|
||||
|
||||
if MARSHMALLOW_2:
|
||||
|
||||
class CompatSchema(Schema):
|
||||
pass
|
||||
|
||||
else:
|
||||
|
||||
class CompatSchema(Schema):
|
||||
class Meta(object): # pylint: disable=no-init
|
||||
unknown = marshmallow.EXCLUDE # pylint: disable=no-member
|
||||
|
||||
def handle_error(self, error, data, **_): # pylint: disable=arguments-differ
|
||||
raise ManifestValidationError(
|
||||
error.messages,
|
||||
data,
|
||||
error.valid_data if hasattr(error, "valid_data") else error.data,
|
||||
)
|
||||
|
||||
|
||||
class BaseSchema(CompatSchema):
|
||||
def load_manifest(self, data):
|
||||
if MARSHMALLOW_2:
|
||||
data, errors = self.load(data)
|
||||
if errors:
|
||||
raise ManifestValidationError(errors, data, data)
|
||||
return data
|
||||
return self.load(data)
|
||||
|
||||
def handle_error(self, error, data, **_): # pylint: disable=arguments-differ
|
||||
raise ManifestValidationError(
|
||||
error.messages,
|
||||
data,
|
||||
error.valid_data if hasattr(error, "valid_data") else error.data,
|
||||
)
|
||||
|
||||
|
||||
class StrictSchema(BaseSchema):
|
||||
def handle_error(self, error, data, **_): # pylint: disable=arguments-differ
|
||||
@ -67,8 +51,6 @@ class StrictSchema(BaseSchema):
|
||||
]
|
||||
else:
|
||||
error.valid_data = None
|
||||
if MARSHMALLOW_2:
|
||||
error.data = error.valid_data
|
||||
raise error
|
||||
|
||||
|
||||
|
@ -16,6 +16,7 @@ import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from platformio import proc
|
||||
from platformio.package.exception import (
|
||||
@ -24,11 +25,6 @@ from platformio.package.exception import (
|
||||
UserSideException,
|
||||
)
|
||||
|
||||
try:
|
||||
from urllib.parse import urlparse
|
||||
except ImportError:
|
||||
from urlparse import urlparse
|
||||
|
||||
|
||||
class VCSBaseException(PackageException):
|
||||
pass
|
||||
|
@ -16,6 +16,7 @@ import base64
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from urllib.parse import quote
|
||||
|
||||
import click
|
||||
|
||||
@ -24,11 +25,6 @@ from platformio.compat import hashlib_encode_data, is_bytes
|
||||
from platformio.package.manager.core import get_core_package_dir
|
||||
from platformio.platform.exception import BuildScriptNotFound
|
||||
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib import quote
|
||||
|
||||
|
||||
class PlatformRunMixin(object):
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import configparser
|
||||
import glob
|
||||
import json
|
||||
import os
|
||||
@ -24,11 +25,6 @@ from platformio.compat import string_types
|
||||
from platformio.project import exception
|
||||
from platformio.project.options import ProjectOptions
|
||||
|
||||
try:
|
||||
import ConfigParser as ConfigParser
|
||||
except ImportError:
|
||||
import configparser as ConfigParser
|
||||
|
||||
CONFIG_HEADER = """
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
@ -87,7 +83,7 @@ class ProjectConfigBase(object):
|
||||
self.expand_interpolations = expand_interpolations
|
||||
self.warnings = []
|
||||
self._parsed = []
|
||||
self._parser = ConfigParser.ConfigParser(inline_comment_prefixes=("#", ";"))
|
||||
self._parser = configparser.ConfigParser(inline_comment_prefixes=("#", ";"))
|
||||
if path and os.path.isfile(path):
|
||||
self.read(path, parse_extra)
|
||||
|
||||
@ -102,7 +98,7 @@ class ProjectConfigBase(object):
|
||||
self._parsed.append(path)
|
||||
try:
|
||||
self._parser.read(path, "utf-8")
|
||||
except ConfigParser.Error as e:
|
||||
except configparser.Error as e:
|
||||
raise exception.InvalidProjectConfError(path, str(e))
|
||||
|
||||
if not parse_extra:
|
||||
@ -310,7 +306,7 @@ class ProjectConfigBase(object):
|
||||
value = None
|
||||
try:
|
||||
value = self.getraw(section, option, default)
|
||||
except ConfigParser.Error as e:
|
||||
except configparser.Error as e:
|
||||
raise exception.InvalidProjectConfError(self.path, str(e))
|
||||
|
||||
option_meta = ProjectOptions.get("%s.%s" % (section.split(":", 1)[0], option))
|
||||
@ -398,7 +394,7 @@ class ProjectConfig(ProjectConfigBase, ProjectConfigDirsMixin):
|
||||
def update(self, data, clear=False):
|
||||
assert isinstance(data, list)
|
||||
if clear:
|
||||
self._parser = ConfigParser.ConfigParser()
|
||||
self._parser = configparser.ConfigParser()
|
||||
for section, options in data:
|
||||
if not self._parser.has_section(section):
|
||||
self._parser.add_section(section)
|
||||
|
@ -16,6 +16,7 @@ import atexit
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import queue
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
@ -32,11 +33,6 @@ from platformio.compat import hashlib_encode_data, string_types
|
||||
from platformio.proc import is_ci, is_container
|
||||
from platformio.project.helpers import is_platformio_project
|
||||
|
||||
try:
|
||||
import queue
|
||||
except ImportError:
|
||||
import Queue as queue
|
||||
|
||||
|
||||
class TelemetryBase(object):
|
||||
def __init__(self):
|
||||
|
10
setup.py
10
setup.py
@ -24,24 +24,21 @@ from platformio import (
|
||||
__url__,
|
||||
__version__,
|
||||
)
|
||||
from platformio.compat import PY2
|
||||
|
||||
|
||||
minimal_requirements = [
|
||||
"bottle==0.12.*",
|
||||
"click%s" % (">=8.0.3,<9" if sys.version_info >= (3, 7) else "==8.0.4"),
|
||||
"colorama",
|
||||
"marshmallow%s" % (">=2,<3" if PY2 else ">=2,<4"),
|
||||
"marshmallow==3.*",
|
||||
"pyelftools>=0.27,<1",
|
||||
"pyserial==3.*",
|
||||
"requests==2.*",
|
||||
"semantic_version==2.9.*",
|
||||
"tabulate==0.8.*",
|
||||
"zeroconf<1",
|
||||
]
|
||||
|
||||
if not PY2:
|
||||
minimal_requirements.append("zeroconf<1")
|
||||
|
||||
home_requirements = [
|
||||
"aiofiles==0.8.*",
|
||||
"ajsonrpc==1.*",
|
||||
@ -59,7 +56,8 @@ setup(
|
||||
author_email=__email__,
|
||||
url=__url__,
|
||||
license=__license__,
|
||||
install_requires=minimal_requirements + ([] if PY2 else home_requirements),
|
||||
install_requires=minimal_requirements + home_requirements,
|
||||
python_requires=">=3.6",
|
||||
packages=find_packages(exclude=["tests.*", "tests"]) + ["scripts"],
|
||||
package_data={
|
||||
"platformio": [
|
||||
|
@ -14,13 +14,14 @@
|
||||
|
||||
# pylint: disable=redefined-outer-name
|
||||
|
||||
import configparser
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from platformio import fs
|
||||
from platformio.project.config import ConfigParser, ProjectConfig
|
||||
from platformio.project.config import ProjectConfig
|
||||
from platformio.project.exception import InvalidProjectConfError, UnknownEnvNamesError
|
||||
|
||||
BASE_CONFIG = """
|
||||
@ -154,7 +155,7 @@ def test_defaults(config):
|
||||
|
||||
|
||||
def test_sections(config):
|
||||
with pytest.raises(ConfigParser.NoSectionError):
|
||||
with pytest.raises(configparser.NoSectionError):
|
||||
config.getraw("unknown_section", "unknown_option")
|
||||
|
||||
assert config.sections() == [
|
||||
@ -276,10 +277,10 @@ def test_sysenv_options(config):
|
||||
|
||||
def test_getraw_value(config):
|
||||
# unknown option
|
||||
with pytest.raises(ConfigParser.NoOptionError):
|
||||
with pytest.raises(configparser.NoOptionError):
|
||||
config.getraw("custom", "unknown_option")
|
||||
# unknown option even if exists in [env]
|
||||
with pytest.raises(ConfigParser.NoOptionError):
|
||||
with pytest.raises(configparser.NoOptionError):
|
||||
config.getraw("platformio", "monitor_speed")
|
||||
|
||||
# default
|
||||
|
@ -19,7 +19,6 @@ from glob import glob
|
||||
import pytest
|
||||
|
||||
from platformio import fs, proc
|
||||
from platformio.compat import PY2
|
||||
from platformio.package.manager.platform import PlatformPackageManager
|
||||
from platformio.platform.factory import PlatformFactory
|
||||
from platformio.project.config import ProjectConfig
|
||||
@ -48,8 +47,6 @@ def pytest_generate_tests(metafunc):
|
||||
for root, _, files in os.walk(examples_dir):
|
||||
if "platformio.ini" not in files or ".skiptest" in files:
|
||||
continue
|
||||
if "zephyr-" in root and PY2:
|
||||
continue
|
||||
group = os.path.basename(root)
|
||||
if "-" in group:
|
||||
group = group.split("-", 1)[0]
|
||||
|
Reference in New Issue
Block a user