Dropped support for "pythonPackages" field in "platform.json" manifest in favor of "Extra Python Dependencies"

This commit is contained in:
Ivan Kravets
2022-02-17 17:25:21 +02:00
parent f1f5497d8d
commit e8051838a3
4 changed files with 12 additions and 46 deletions

View File

@ -18,8 +18,10 @@ PlatformIO Core 5
* `pio pkg outdated <https://docs.platformio.org/en/latest/core/userguide/pkg/cmd_pack.html>`__ - check for project outdated packages
* `pio pkg exec <https://docs.platformio.org/en/latest/core/userguide/pkg/cmd_exec.html>`_ - run command from package tool (`issue #4163 <https://github.com/platformio/platformio-core/issues/4163>`_)
- Dropped automatic updates of global libraries and development platforms (`issue #4179 <https://github.com/platformio/platformio-core/issues/4179>`_)
- Dropped support for "pythonPackages" field in "platform.json" manifest in favor of `Extra Python Dependencies <https://docs.platformio.org/en/latest/scripting/examples/extra_python_packages.html>`__
* Improved PIO Remote setup on credit-card sized computers (Raspberry Pi, BeagleBon, etc) (`issue #3865 <https://github.com/platformio/platformio-core/issues/3865>`_)
* Dropped automatic updates of global libraries and development platforms (`issue #4179 <https://github.com/platformio/platformio-core/issues/4179>`_)
5.2.5 (2022-02-10)
~~~~~~~~~~~~~~~~~~

2
docs

Submodule docs updated: 5a4ab6acb4...87396f762b

View File

@ -47,7 +47,9 @@ class PlatformPackageManager(BasePackageManager): # pylint: disable=too-many-an
with_all_packages=False,
silent=False,
force=False,
project_env=None,
):
already_installed = self.get_package(spec)
pkg = super(PlatformPackageManager, self).install(
spec, silent=silent, force=force, skip_dependencies=True
)
@ -60,6 +62,9 @@ class PlatformPackageManager(BasePackageManager): # pylint: disable=too-many-an
)
raise e
if project_env:
p.configure_project_packages(project_env)
if with_all_packages:
with_packages = list(p.packages)
@ -70,8 +75,8 @@ class PlatformPackageManager(BasePackageManager): # pylint: disable=too-many-an
silent=silent,
force=force,
)
p.install_python_packages()
p.on_installed()
if not already_installed:
p.on_installed()
return pkg
def uninstall(self, spec, silent=False, skip_dependencies=False):
@ -83,7 +88,6 @@ class PlatformPackageManager(BasePackageManager): # pylint: disable=too-many-an
pkg, silent=silent, skip_dependencies=True
)
if not skip_dependencies:
p.uninstall_python_packages()
p.on_uninstalled()
return pkg

View File

@ -13,12 +13,10 @@
# limitations under the License.
import os
import subprocess
import click
import semantic_version
from platformio import __version__, fs, proc
from platformio import __version__, fs
from platformio.package.manager.tool import ToolPackageManager
from platformio.package.version import pepver_to_semver
from platformio.platform._packages import PlatformPackagesMixin
@ -104,10 +102,6 @@ class PlatformBase( # pylint: disable=too-many-instance-attributes,too-many-pub
packages[spec.name].update(**options)
return packages
@property
def python_packages(self):
return self._manifest.get("pythonPackages")
def ensure_engine_compatible(self):
if not self.engines or "platformio" not in self.engines:
return True
@ -238,37 +232,3 @@ class PlatformBase( # pylint: disable=too-many-instance-attributes,too-many-pub
def on_uninstalled(self):
pass
def install_python_packages(self):
if not self.python_packages:
return None
click.echo(
"Installing Python packages: %s"
% ", ".join(list(self.python_packages.keys())),
)
args = [proc.get_pythonexe_path(), "-m", "pip", "install", "--upgrade"]
for name, requirements in self.python_packages.items():
if any(c in requirements for c in ("<", ">", "=")):
args.append("%s%s" % (name, requirements))
else:
args.append("%s==%s" % (name, requirements))
try:
return subprocess.call(args) == 0
except Exception as e: # pylint: disable=broad-except
click.secho(
"Could not install Python packages -> %s" % e, fg="red", err=True
)
return None
def uninstall_python_packages(self):
if not self.python_packages:
return
click.echo("Uninstalling Python packages")
args = [proc.get_pythonexe_path(), "-m", "pip", "uninstall", "--yes"]
args.extend(list(self.python_packages.keys()))
try:
subprocess.call(args) == 0
except Exception as e: # pylint: disable=broad-except
click.secho(
"Could not install Python packages -> %s" % e, fg="red", err=True
)