Reload command for remote, update, improved docs; Bump to 3.2b2

This commit is contained in:
Ivan Kravets
2016-11-12 00:28:49 +02:00
parent 5670b7af1f
commit 3d5fe149c3
20 changed files with 410 additions and 95 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
import sys
VERSION = (3, 2, "0b1")
VERSION = (3, 2, "0b2")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"
+1 -1
View File
@@ -129,7 +129,7 @@ An unexpected error occurred. Further steps:
============================================================
"""
click.secho(error_str, fg="red", err=True)
return 1
return int(str(e)) if str(e).isdigit() else 1
return 0
+16
View File
@@ -46,11 +46,27 @@ def remote_agent_start(**kwargs):
pioplus_call(sys.argv[1:])
@remote_agent.command("reload", short_help="Reload agents")
def remote_agent_reload():
pioplus_call(sys.argv[1:])
@remote_agent.command("list", short_help="List active agents")
def remote_agent_list():
pioplus_call(sys.argv[1:])
@cli.command(
"update", short_help="Update installed Platforms, Packages and Libraries")
@click.option(
"-c",
"--only-check",
is_flag=True,
help="Do not update, only check for new version")
def remote_update(only_check):
pioplus_call(sys.argv[1:])
@cli.command("run", short_help="Process project environments remotely")
@click.option("-e", "--environment", multiple=True)
@click.option("-t", "--target", multiple=True)
+1 -1
View File
@@ -113,7 +113,7 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose,
print_summary(results, start_time)
if any([r is False for r in results.values()]):
raise exception.ReturnErrorCode()
raise exception.ReturnErrorCode(1)
return True
+1 -1
View File
@@ -81,7 +81,7 @@ WARNING! Don't use `sudo` for the rest PlatformIO commands.
""",
fg="yellow",
err=True)
raise exception.ReturnErrorCode()
raise exception.ReturnErrorCode(1)
else:
raise exception.UpgradeError("\n".join(
[str(cmd), r['out'], r['err']]))
+2 -1
View File
@@ -25,7 +25,8 @@ class PlatformioException(Exception):
class ReturnErrorCode(PlatformioException):
pass
MESSAGE = "{0}"
class MinitermException(PlatformioException):
+26 -6
View File
@@ -23,14 +23,16 @@ from platformio.managers.package import PackageManager
PACKAGE_DEPS = {
"pysite": {
"name": "pysite-pioplus",
"requirements": "^0.2.0"
"requirements": ">=0.2.0,<2"
},
"tool": {
"name": "tool-pioplus",
"requirements": "^0.4.0"
"requirements": ">=0.5.0,<2"
}
}
AUTO_UPDATES_MAX = 100
class PioPlusPackageManager(PackageManager):
@@ -39,8 +41,6 @@ class PioPlusPackageManager(PackageManager):
self,
join(util.get_home_dir(), "packages"), [
"https://dl.bintray.com/platformio/dl-packages/manifest.json",
"https://sourceforge.net/projects/platformio-storage/files/"
"packages/manifest.json/download",
"https://dl.platformio.org/packages/manifest.json"
])
@@ -71,5 +71,25 @@ def pioplus_call(args, **kwargs):
os.environ['PYTHONPYSITEDIR'] = pm.get_package_dir(
PACKAGE_DEPS['pysite']['name'], PACKAGE_DEPS['pysite']['requirements'])
util.copy_pythonpath_to_osenv()
if subprocess.call([pioplus_path] + args, **kwargs) != 0:
raise exception.ReturnErrorCode()
code = subprocess.call([pioplus_path] + args, **kwargs)
# handle remote update request
if code == 13:
count_attr = "_update_count"
try:
count_value = getattr(pioplus_call, count_attr)
except AttributeError:
count_value = 0
setattr(pioplus_call, count_attr, 1)
count_value += 1
setattr(pioplus_call, count_attr, count_value)
if count_value < AUTO_UPDATES_MAX:
pioplus_update()
return pioplus_call(args, **kwargs)
# handle reload request
elif code == 14:
return pioplus_call(args, **kwargs)
if code != 0:
raise exception.ReturnErrorCode(1)