From 72091cf4a6dcca59bd6a7b4504c49db3416ae8d1 Mon Sep 17 00:00:00 2001 From: "DESKTOP-36KV42A\\guill" Date: Thu, 28 Sep 2017 13:56:36 -0300 Subject: [PATCH] Bug fix adding the `upload_speed` flag (issue: https://github.com/gepd/Deviot/issues/183) --- libraries/preferences_bridge.py | 8 +++++--- platformio/upload.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/preferences_bridge.py b/libraries/preferences_bridge.py index 68ee807..b0bc475 100644 --- a/libraries/preferences_bridge.py +++ b/libraries/preferences_bridge.py @@ -18,6 +18,7 @@ class PreferencesBridge(PioBridge): def __init__(self): super(PreferencesBridge, self).__init__() + self.init_option = None def save_selected_board(self, board_id): """Store Board @@ -227,7 +228,7 @@ def programmer(self, wipe=False): with open(ini_path, 'w') as configfile: config.write(configfile) - def add_option(self, option_name, wipe=False): + def add_option(self, option_name, wipe=False, append=False): """Add option Adds the option `option_name` into platformio.ini. The value @@ -239,6 +240,8 @@ def add_option(self, option_name, wipe=False): Keyword Arguments: wipe {bool} -- when is true remove the option from platformio.ini (default: {False}) + append {bool} -- when is true, when is true it appends + the given data """ option = get_setting(option_name, None) ini_path = self.get_ini_path() @@ -260,7 +263,7 @@ def add_option(self, option_name, wipe=False): # add option if(not wipe and option and option not in current): - if(self.init_option): + if(self.init_option and append): option = self.init_option + ', ' + option config.set(environment, option_name, option) @@ -274,7 +277,6 @@ def add_option(self, option_name, wipe=False): else: config.remove_option(environment, option_name) write_file = True - self.init_option = None # save in file if(write_file): diff --git a/platformio/upload.py b/platformio/upload.py index d56c25f..bb67054 100644 --- a/platformio/upload.py +++ b/platformio/upload.py @@ -51,7 +51,7 @@ def start_upload(self): self.add_board() # add extra library board - self.add_option('lib_extra_dirs') + self.add_option('lib_extra_dirs', append=True) # check if there is a new speed to overwrite self.add_option('upload_speed')