From f416f1e5a1896f725c2d5edba5b659c30c4886c6 Mon Sep 17 00:00:00 2001 From: Gustavo Jose de Sousa Date: Thu, 3 Mar 2016 17:13:33 -0300 Subject: [PATCH] waf: px4: implement --upload option We tweak the task's cmd_kw so that the user can see what is happening from the terminal (e.g. progress bar). --- Tools/ardupilotwaf/px4.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Tools/ardupilotwaf/px4.py b/Tools/ardupilotwaf/px4.py index c698d132a7..6f743d9023 100644 --- a/Tools/ardupilotwaf/px4.py +++ b/Tools/ardupilotwaf/px4.py @@ -5,10 +5,11 @@ Waf tool for PX4 build """ -from waflib import Task, Utils +from waflib import Logs, Task, Utils from waflib.TaskGen import after_method, before_method, feature import os +import sys _dynamic_env_data = {} def _load_dynamic_env_data(bld): @@ -124,11 +125,12 @@ def _update_firmware_sig(fw_task, firmware): _cp_px4io = None _firmware_semaphorish_tasks = [] +_upload_task = [] @feature('px4_ap_program') @after_method('process_source') def px4_firmware(self): - global _cp_px4io, _firmware_semaphorish_tasks + global _cp_px4io, _firmware_semaphorish_tasks, _upload_task version = self.env.get_flat('PX4_VERSION') if self.env.PX4_USE_PX4IO and not _cp_px4io: @@ -172,6 +174,14 @@ def px4_firmware(self): git_hashes.set_run_after(fw_task) _firmware_semaphorish_tasks.append(git_hashes) + if self.bld.options.upload: + if _upload_task: + Logs.warn('PX4: upload for %s ignored' % self.name) + return + _upload_task = self.create_cmake_build_task('px4', 'upload') + _upload_task.set_run_after(fw_task) + _firmware_semaphorish_tasks.append(_upload_task) + def _px4_taskgen(bld, **kw): if 'cls_keyword' in kw and not callable(kw['cls_keyword']): cls_keyword = str(kw['cls_keyword'])