mirror of
https://github.com/platformio/platformio-core.git
synced 2025-08-01 10:54:27 +02:00
Improve upgrading command
This commit is contained in:
@@ -32,7 +32,6 @@ def cli():
|
|||||||
fg="yellow")
|
fg="yellow")
|
||||||
|
|
||||||
cmds = (
|
cmds = (
|
||||||
["pip", "install", "--upgrade", "pip", "setuptools"],
|
|
||||||
["pip", "install", "--upgrade", "platformio"],
|
["pip", "install", "--upgrade", "platformio"],
|
||||||
["platformio", "--version"]
|
["platformio", "--version"]
|
||||||
)
|
)
|
||||||
@@ -60,7 +59,11 @@ def cli():
|
|||||||
if not r:
|
if not r:
|
||||||
raise exception.UpgradeError(
|
raise exception.UpgradeError(
|
||||||
"\n".join([str(cmd), str(e)]))
|
"\n".join([str(cmd), str(e)]))
|
||||||
if ("Permission denied" in r['err'] and
|
permission_errors = (
|
||||||
|
"permission denied",
|
||||||
|
"not permitted"
|
||||||
|
)
|
||||||
|
if (any([m in r['err'].lower() for m in permission_errors]) and
|
||||||
"windows" not in util.get_systype()):
|
"windows" not in util.get_systype()):
|
||||||
click.secho("""
|
click.secho("""
|
||||||
-----------------
|
-----------------
|
||||||
@@ -68,7 +71,7 @@ Permission denied
|
|||||||
-----------------
|
-----------------
|
||||||
You need the `sudo` permission to install Python packages. Try
|
You need the `sudo` permission to install Python packages. Try
|
||||||
|
|
||||||
> sudo platformio upgrade
|
> sudo pip install -U platformio
|
||||||
|
|
||||||
WARNING! Don't use `sudo` for the rest PlatformIO commands.
|
WARNING! Don't use `sudo` for the rest PlatformIO commands.
|
||||||
""", fg="yellow", err=True)
|
""", fg="yellow", err=True)
|
||||||
|
@@ -195,6 +195,7 @@ class UpgradeError(PlatformioException):
|
|||||||
|
|
||||||
MESSAGE = """%s
|
MESSAGE = """%s
|
||||||
|
|
||||||
|
* Upgrade using `pip install -U platformio`
|
||||||
* Try different installation/upgrading steps:
|
* Try different installation/upgrading steps:
|
||||||
http://docs.platformio.org/en/latest/installation.html
|
http://docs.platformio.org/en/latest/installation.html
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user