From 121f66b2a1c0e93d0a01fa18973fdada3d4c736a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 11 Feb 2015 22:48:46 +0200 Subject: [PATCH 1/5] Fill history with the closed issues --- HISTORY.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 2a77543d..f0552192 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -19,7 +19,11 @@ Release History (`issue #42 `_) * Allowed to ignore some libs from *Library Dependency Finder* via `ignore_libs `_ option +* Output compiled size and static memory usage with `platformio run `__ + command (`issue #59 `_) * Fixed an issue with the libraries that are git repositories (`issue #49 `_) +* Fixed handling of assembly files (`issue #58 `_) +* Fixed compiling error if space is in user's folder (`issue #56 `_) * Fixed `AttributeError: 'module' object has no attribute 'disable_warnings'` when a version of `requests` package is less then 2.4.0 From 0e46dc222279ff0a7ac1eb8611c9db2034c0247a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 12 Feb 2015 00:15:36 +0200 Subject: [PATCH 2/5] Update settings list --- docs/userguide/cmd_settings.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/userguide/cmd_settings.rst b/docs/userguide/cmd_settings.rst index b914d46c..c001c16f 100644 --- a/docs/userguide/cmd_settings.rst +++ b/docs/userguide/cmd_settings.rst @@ -27,7 +27,7 @@ Get/List existing settings Examples ~~~~~~~~ -1. List all settings and current their values +1. List all settings and theirs current values .. code-block:: bash @@ -38,7 +38,9 @@ Examples auto_update_platforms Yes Automatically update platforms (Yes/No) check_libraries_interval 7 Check for the library updates interval (days) check_platformio_interval 3 Check for the new PlatformIO interval (days) - check_platforms_interval 7 Check for the platforms updates interval (days) + check_platforms_interval 7 Check for the platform updates interval (days) + enable_prompts Yes Can PlatformIO communicate with you via prompts: propose to install platforms which aren't installed yet, paginate over library search results and etc.)? ATTENTION!!! If you call PlatformIO like subprocess, please disable prompts to avoid blocking (Yes/No) + enable_telemetry Yes Shares commands, platforms and libraries usage to help us make PlatformIO better (Yes/No) 2. Show specified setting From 821ede1d2373b18819fd327d17b287ce3cbd3dd4 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 12 Feb 2015 13:26:37 +0200 Subject: [PATCH 3/5] Avoid errors when "upload speed" and "upload protocol" are missed in board definition file --- platformio/boards/arduino.json | 2 +- platformio/builder/main.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/platformio/boards/arduino.json b/platformio/boards/arduino.json index f3e6e5ec..88cbe334 100644 --- a/platformio/boards/arduino.json +++ b/platformio/boards/arduino.json @@ -560,5 +560,5 @@ "use_1200bps_touch": true, "wait_for_upload_port": false } - } + } } diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 3bde0b9d..88698c26 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -81,9 +81,11 @@ if "BOARD" in env: if "BOARD_F_CPU" not in env: env.Replace(BOARD_F_CPU="${BOARD_OPTIONS['build']['f_cpu']}") if "UPLOAD_PROTOCOL" not in env: - env.Replace(UPLOAD_PROTOCOL="${BOARD_OPTIONS['upload']['protocol']}") + env.Replace( + UPLOAD_PROTOCOL="${BOARD_OPTIONS['upload'].get('protocol', None)}") if "UPLOAD_SPEED" not in env: - env.Replace(UPLOAD_SPEED="${BOARD_OPTIONS['upload']['speed']}") + env.Replace( + UPLOAD_SPEED="${BOARD_OPTIONS['upload'].get('speed', None)}") if "IGNORE_LIBS" in env: env['IGNORE_LIBS'] = [l.strip() for l in env['IGNORE_LIBS'].split(",")] From d76f0bef7721dc10bdb7461f40f289084255b632 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 12 Feb 2015 14:24:31 +0200 Subject: [PATCH 4/5] Refactor get_boards method with exception handler --- platformio/util.py | 50 +++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/platformio/util.py b/platformio/util.py index 7b13f9fc..359a0dd1 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -10,9 +10,7 @@ from subprocess import PIPE, Popen import requests -from platformio import __apiurl__, __version__ -from platformio.exception import (APIRequestError, GetSerialPortsError, - NotPlatformProject) +from platformio import __apiurl__, __version__, exception try: from configparser import ConfigParser @@ -33,7 +31,7 @@ def get_home_dir(): if (config.has_section("platformio") and config.has_option("platformio", "home_dir")): home_dir = config.get("platformio", "home_dir") - except NotPlatformProject: + except exception.NotPlatformProject: pass if not home_dir: @@ -55,7 +53,7 @@ def get_lib_dir(): if lib_dir.startswith("~"): lib_dir = expanduser(lib_dir) return abspath(lib_dir) - except NotPlatformProject: + except exception.NotPlatformProject: pass return join(get_home_dir(), "lib") @@ -75,7 +73,7 @@ def get_pioenvs_dir(): def get_project_config(): path = join(get_project_dir(), "platformio.ini") if not isfile(path): - raise NotPlatformProject(get_project_dir()) + raise exception.NotPlatformProject(get_project_dir()) cp = ConfigParser() cp.read(path) return cp @@ -101,7 +99,7 @@ def get_serialports(): elif os_name == "posix": from serial.tools.list_ports_posix import comports else: - raise GetSerialPortsError(os_name) + raise exception.GetSerialPortsError(os_name) return[{"port": p, "description": d, "hwid": h} for p, d, h in comports()] @@ -127,14 +125,15 @@ def get_api_result(path, params=None, data=None): r.raise_for_status() except requests.exceptions.HTTPError as e: if result and "errors" in result: - raise APIRequestError(result['errors'][0]['title']) + raise exception.APIRequestError(result['errors'][0]['title']) else: - raise APIRequestError(e) + raise exception.APIRequestError(e) except requests.exceptions.ConnectionError: - raise APIRequestError( + raise exception.APIRequestError( "Could not connect to PlatformIO Registry Service") except ValueError: - raise APIRequestError("Invalid response: %s" % r.text.encode("utf-8")) + raise exception.APIRequestError( + "Invalid response: %s" % r.text.encode("utf-8")) finally: if r: r.close() @@ -143,15 +142,24 @@ def get_api_result(path, params=None, data=None): def get_boards(type_=None): boards = {} - bdirs = [join(get_source_dir(), "boards")] - if isdir(join(get_home_dir(), "boards")): - bdirs.append(join(get_home_dir(), "boards")) + try: + boards = get_boards._cache + except AttributeError: + bdirs = [join(get_source_dir(), "boards")] + if isdir(join(get_home_dir(), "boards")): + bdirs.append(join(get_home_dir(), "boards")) - for bdir in bdirs: - for json_file in listdir(bdir): - if not json_file.endswith(".json"): - continue - with open(join(bdir, json_file)) as f: - boards.update(json.load(f)) + for bdir in bdirs: + for json_file in listdir(bdir): + if not json_file.endswith(".json"): + continue + with open(join(bdir, json_file)) as f: + boards.update(json.load(f)) + get_boards._cache = boards - return boards[type_] if type_ is not None else boards + if type_ is None: + return boards + else: + if type_ not in boards: + raise exception.UnknownBoard(type_) + return boards[type_] From 42caf7865c0ca3f934c6814d781a163fcb7390bd Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 12 Feb 2015 14:32:05 +0200 Subject: [PATCH 5/5] Fix pylint warnings --- platformio/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio/util.py b/platformio/util.py index 359a0dd1..305a37bd 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -143,7 +143,7 @@ def get_api_result(path, params=None, data=None): def get_boards(type_=None): boards = {} try: - boards = get_boards._cache + boards = get_boards._cache # pylint: disable=W0212 except AttributeError: bdirs = [join(get_source_dir(), "boards")] if isdir(join(get_home_dir(), "boards")): @@ -155,7 +155,7 @@ def get_boards(type_=None): continue with open(join(bdir, json_file)) as f: boards.update(json.load(f)) - get_boards._cache = boards + get_boards._cache = boards # pylint: disable=W0212 if type_ is None: return boards