Improve upgrading command

This commit is contained in:
Ivan Kravets
2015-12-07 22:44:31 +02:00
parent dfb93e9682
commit 68c64cd942
2 changed files with 7 additions and 3 deletions

View File

@ -32,7 +32,6 @@ def cli():
fg="yellow")
cmds = (
["pip", "install", "--upgrade", "pip", "setuptools"],
["pip", "install", "--upgrade", "platformio"],
["platformio", "--version"]
)
@ -60,7 +59,11 @@ def cli():
if not r:
raise exception.UpgradeError(
"\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()):
click.secho("""
-----------------
@ -68,7 +71,7 @@ Permission denied
-----------------
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.
""", fg="yellow", err=True)

View File

@ -195,6 +195,7 @@ class UpgradeError(PlatformioException):
MESSAGE = """%s
* Upgrade using `pip install -U platformio`
* Try different installation/upgrading steps:
http://docs.platformio.org/en/latest/installation.html
"""