forked from platformio/platformio-core
Rename "espressif" platform to "espressif8266"
This commit is contained in:
1 parent
6036c54b05
commit
fda7392b84
20 files changed
+84
-46
No files matched your search
@@ -14,7 +14,7 @@
|
||||
|
||||
import sys
|
||||
|
||||
VERSION = (3, 0, "0b10")
|
||||
VERSION = (3, 0, "0b11")
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
|
||||
@@ -130,6 +130,8 @@ class EnvironmentProcessor(object):
|
||||
|
||||
RENAMED_OPTIONS = {"lib_use": "lib_force"}
|
||||
|
||||
RENAMED_PLATFORMS = {"espressif": "espressif8266"}
|
||||
|
||||
def __init__(self, # pylint: disable=R0913
|
||||
cmd_ctx,
|
||||
name,
|
||||
@@ -191,6 +193,15 @@ class EnvironmentProcessor(object):
|
||||
"`%s` instead." % (k, self.RENAMED_OPTIONS[k]),
|
||||
fg="yellow")
|
||||
k = self.RENAMED_OPTIONS[k]
|
||||
# process renamed platforms
|
||||
if k == "platform" and v in self.RENAMED_PLATFORMS:
|
||||
click.secho(
|
||||
"Warning! Platform `%s` is deprecated and will be "
|
||||
"removed in the next release! Please use "
|
||||
"`%s` instead." % (v, self.RENAMED_PLATFORMS[v]),
|
||||
fg="yellow")
|
||||
v = self.RENAMED_PLATFORMS[v]
|
||||
|
||||
# warn about unknown options
|
||||
if k not in self.KNOWN_OPTIONS:
|
||||
click.secho(
|
||||
|
||||
@@ -25,6 +25,8 @@ from platformio import __version__, app, exception, telemetry, util
|
||||
from platformio.commands.lib import lib_update as cmd_lib_update
|
||||
from platformio.commands.platform import \
|
||||
platform_install as cmd_platform_install
|
||||
from platformio.commands.platform import \
|
||||
platform_uninstall as cmd_platform_uninstall
|
||||
from platformio.commands.platform import platform_update as cmd_platform_update
|
||||
from platformio.commands.upgrade import get_latest_version
|
||||
from platformio.managers.lib import LibraryManager
|
||||
@@ -82,7 +84,8 @@ class Upgrader(object):
|
||||
util.pepver_to_semver(to_version))
|
||||
|
||||
self._upgraders = [
|
||||
(semantic_version.Version("3.0.0-a1"), self._upgrade_to_3_0_0)
|
||||
(semantic_version.Version("3.0.0-a1"), self._upgrade_to_3_0_0),
|
||||
(semantic_version.Version("3.0.0-b11"), self._upgrade_to_3_0_0)
|
||||
]
|
||||
|
||||
def run(self, ctx):
|
||||
@@ -97,7 +100,8 @@ class Upgrader(object):
|
||||
|
||||
return all(result)
|
||||
|
||||
def _upgrade_to_3_0_0(self, ctx): # pylint: disable=R0201
|
||||
@staticmethod
|
||||
def _upgrade_to_3_0_0(ctx):
|
||||
# convert custom board configuration
|
||||
boards_dir = join(util.get_home_dir(), "boards")
|
||||
if isdir(boards_dir):
|
||||
@@ -115,10 +119,22 @@ class Upgrader(object):
|
||||
# re-install PlatformIO 2.0 development platforms
|
||||
installed_platforms = app.get_state_item("installed_platforms", [])
|
||||
if installed_platforms:
|
||||
if "espressif" in installed_platforms:
|
||||
installed_platforms[installed_platforms.index(
|
||||
"espressif")] = "espressif8266"
|
||||
ctx.invoke(cmd_platform_install, platforms=installed_platforms)
|
||||
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def _upgrade_to_3_0_0b11(ctx):
|
||||
current_platforms = [m['name']
|
||||
for m in PlatformManager().get_installed()]
|
||||
if "espressif" not in current_platforms:
|
||||
return
|
||||
ctx.invoke(cmd_platform_install, platforms=["espressif8266"])
|
||||
ctx.invoke(cmd_platform_uninstall, platforms=["espressif"])
|
||||
|
||||
|
||||
def after_upgrade(ctx):
|
||||
last_version = app.get_state_item("last_version", "0.0.0")
|
||||
|
||||
Reference in new issue
Block a user