Enhance PIP dependency declarations // Resolve #4819

This commit is contained in:
Ivan Kravets
2024-01-06 16:24:01 +02:00
parent f2d16e7631
commit c74c9778a1
6 changed files with 71 additions and 45 deletions

View File

@ -35,7 +35,8 @@ jobs:
tox -e testcore
- name: Build Python source tarball
run: python setup.py sdist bdist_wheel
# run: python setup.py sdist bdist_wheel
run: python setup.py sdist
- name: Publish package to PyPI
if: ${{ github.ref == 'refs/heads/master' }}

View File

@ -25,6 +25,7 @@ test-driven methodologies, and modern toolchains for unrivaled success.
* Drastically enhanced the speed of project building when operating in verbose mode (`issue #4783 <https://github.com/platformio/platformio-core/issues/4783>`_)
* Upgraded the build engine to the latest version of SCons (4.6.0) to improve build performance, reliability, and compatibility with other tools and systems (`release notes <https://github.com/SCons/scons/releases/tag/4.6.0>`__)
* Enhanced the handling of built-in variables in |PIOCONF| during |INTERPOLATION| (`issue #4695 <https://github.com/platformio/platformio-core/issues/4695>`_)
* Enhanced PIP dependency declarations for improved reliability and extended support to include Python 3.6 (`issue #4819 <https://github.com/platformio/platformio-core/issues/4819>`_)
* Implemented a fail-safe mechanism to terminate a debugging session if an unknown CLI option is passed (`issue #4699 <https://github.com/platformio/platformio-core/issues/4699>`_)
* Rectified an issue where ``${platformio.name}`` erroneously represented ``None`` as the default `project name <https://docs.platformio.org/en/latest/projectconf/sections/platformio/options/generic/name.html>`__ (`issue #4717 <https://github.com/platformio/platformio-core/issues/4717>`_)
* Resolved an issue where the ``COMPILATIONDB_INCLUDE_TOOLCHAIN`` setting was not correctly applying to private libraries (`issue #4762 <https://github.com/platformio/platformio-core/issues/4762>`_)

View File

@ -52,22 +52,3 @@ __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.30",
"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.34",
"uvicorn >=0.16, <=0.25",
"wsproto == 1.*",
]

View File

@ -18,9 +18,10 @@ import subprocess
import click
from platformio import VERSION, __install_requires__, __version__, app, exception
from platformio import VERSION, __version__, app, exception
from platformio.http import fetch_remote_content
from platformio.package.manager.core import update_core_packages
from platformio.pipdeps import get_pip_dependencies
from platformio.proc import get_pythonexe_path
PYPI_JSON_URL = "https://pypi.org/pypi/platformio/json"
@ -37,7 +38,7 @@ DEVELOP_INIT_SCRIPT_URL = (
@click.option("--verbose", "-v", is_flag=True)
def cli(dev, only_dependencies, verbose):
if only_dependencies:
return upgrade_pypi_dependencies(verbose)
return upgrade_pip_dependencies(verbose)
update_core_packages()
@ -102,7 +103,7 @@ def cli(dev, only_dependencies, verbose):
return True
def upgrade_pypi_dependencies(verbose):
def upgrade_pip_dependencies(verbose):
subprocess.run(
[
get_pythonexe_path(),
@ -111,7 +112,7 @@ def upgrade_pypi_dependencies(verbose):
"install",
"--upgrade",
"pip",
*__install_requires__,
*get_pip_dependencies(),
],
check=True,
stdout=subprocess.PIPE if not verbose else None,

61
platformio/pipdeps.py Normal file
View File

@ -0,0 +1,61 @@
# 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 platform
import sys
PY36 = sys.version_info[0:2] == (3, 6)
def get_pip_dependencies():
core = [
"bottle == 0.12.*",
"click >=8.0.4, <9",
"colorama",
"marshmallow == 3.*",
"pyelftools == 0.30",
"pyserial == 3.5.*", # keep in sync "device/monitor/terminal.py"
"requests == 2.*",
"semantic_version == 2.10.*",
"tabulate == 0.*",
]
home = [
# PIO Home requirements
"ajsonrpc == 1.2.*",
"starlette >=0.19, <0.35",
"uvicorn %s" % ("== 0.16.0" if PY36 else ">=0.16, <0.26"),
"wsproto == 1.*",
]
extra = []
# issue #4702; Broken "requests/charset_normalizer" on macOS ARM
if platform.system() == "Darwin" and "arm" in platform.machine().lower():
extra.append("chardet>=3.0.2,<6")
# issue 4614: urllib3 v2.0 only supports OpenSSL 1.1.1+
try:
import ssl # pylint: disable=import-outside-toplevel
if ssl.OPENSSL_VERSION.startswith("OpenSSL ") and ssl.OPENSSL_VERSION_INFO < (
1,
1,
1,
):
extra.append("urllib3<2")
except ImportError:
pass
return core + home + extra

View File

@ -12,7 +12,6 @@
# 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 (
@ -23,26 +22,8 @@ from platformio import (
__title__,
__url__,
__version__,
__install_requires__,
)
# 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")
# 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,
):
__install_requires__.append("urllib3<2")
except ImportError:
pass
from platformio.pipdeps import get_pip_dependencies
setup(
name=__title__,
@ -53,7 +34,7 @@ setup(
author_email=__email__,
url=__url__,
license=__license__,
install_requires=__install_requires__,
install_requires=get_pip_dependencies(),
python_requires=">=3.6",
packages=find_packages(include=["platformio", "platformio.*"]),
package_data={