From 2b4b2eb571d01ae62f81c8a6f5d8575553901d24 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 18 Jan 2018 22:04:43 +0200 Subject: [PATCH 01/98] Pass a list iterator directly to "any" or "all" functions --- platformio/builder/tools/piolib.py | 7 +++---- platformio/builder/tools/pioupload.py | 4 ++-- platformio/builder/tools/platformio.py | 2 +- platformio/commands/run.py | 4 ++-- platformio/commands/upgrade.py | 4 ++-- .../ide/tpls/visualstudio/platformio.vcxproj.filters.tpl | 2 +- platformio/ide/tpls/visualstudio/platformio.vcxproj.tpl | 2 +- platformio/managers/lib.py | 4 ++-- 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index f20b6b08..01cd4f2f 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -57,10 +57,9 @@ class LibBuilderFactory(object): @staticmethod def get_used_frameworks(env, path): - if any([ + if any( isfile(join(path, fname)) - for fname in ("library.properties", "keywords.txt") - ]): + for fname in ("library.properties", "keywords.txt")): return ["arduino"] if isfile(join(path, "module.json")): @@ -156,7 +155,7 @@ class LibBuilderBase(object): @property def include_dir(self): - if not all([isdir(join(self.path, d)) for d in ("include", "src")]): + if not all(isdir(join(self.path, d)) for d in ("include", "src")): return None return join(self.path, "include") diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index ab7b27ca..f867c78a 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -114,10 +114,10 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument mbed_pages = [ join(item['path'], n) for n in ("mbed.htm", "mbed.html") ] - if any([isfile(p) for p in mbed_pages]): + if any(isfile(p) for p in mbed_pages): return item['path'] if item['name'] \ - and any([l in item['name'].lower() for l in msdlabels]): + and any(l in item['name'].lower() for l in msdlabels): return item['path'] return None diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index f9dd5386..0ca092de 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -68,7 +68,7 @@ def BuildProgram(env): # append specified LD_SCRIPT if ("LDSCRIPT_PATH" in env - and not any(["-Wl,-T" in f for f in env['LINKFLAGS']])): + and not any("-Wl,-T" in f for f in env['LINKFLAGS'])): env.Append(LINKFLAGS=['-Wl,-T"$LDSCRIPT_PATH"']) # enable "cyclic reference" for linker diff --git a/platformio/commands/run.py b/platformio/commands/run.py index f75a07c9..d459ae6d 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -111,7 +111,7 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, "nobuild" not in ep.get_build_targets(): ctx.invoke(cmd_device_monitor) - found_error = any([status is False for (_, status) in results]) + found_error = any(status is False for (_, status) in results) if (found_error or not silent) and len(results) > 1: click.echo() @@ -411,6 +411,6 @@ def calculate_project_hash(): for root, _, files in walk(d): for f in files: path = join(root, f) - if not any([s in path for s in (".git", ".svn", ".pioenvs")]): + if not any(s in path for s in (".git", ".svn", ".pioenvs")): structure.append(path) return sha1(",".join(sorted(structure))).hexdigest() if structure else "" diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index 97014d2b..bcc202ab 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -36,7 +36,7 @@ def cli(dev): # kill all PIO Home servers, they block `pioplus` binary shutdown_servers() - to_develop = dev or not all([c.isdigit() for c in __version__ if c != "."]) + to_develop = dev or not all(c.isdigit() for c in __version__ if c != ".") cmds = ([ "pip", "install", "--upgrade", "https://github.com/platformio/platformio-core/archive/develop.zip" @@ -69,7 +69,7 @@ def cli(dev): if not r: raise exception.UpgradeError("\n".join([str(cmd), str(e)])) permission_errors = ("permission denied", "not permitted") - if (any([m in r['err'].lower() for m in permission_errors]) + if (any(m in r['err'].lower() for m in permission_errors) and "windows" not in util.get_systype()): click.secho( """ diff --git a/platformio/ide/tpls/visualstudio/platformio.vcxproj.filters.tpl b/platformio/ide/tpls/visualstudio/platformio.vcxproj.filters.tpl index d66bb4be..b29cb31f 100644 --- a/platformio/ide/tpls/visualstudio/platformio.vcxproj.filters.tpl +++ b/platformio/ide/tpls/visualstudio/platformio.vcxproj.filters.tpl @@ -15,7 +15,7 @@ % for file in src_files: - % if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]): + % if any(file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")): Header Files diff --git a/platformio/ide/tpls/visualstudio/platformio.vcxproj.tpl b/platformio/ide/tpls/visualstudio/platformio.vcxproj.tpl index b27a7ab2..82a011ad 100644 --- a/platformio/ide/tpls/visualstudio/platformio.vcxproj.tpl +++ b/platformio/ide/tpls/visualstudio/platformio.vcxproj.tpl @@ -60,7 +60,7 @@ % for file in src_files: - % if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]): + % if any(file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")): Header Files diff --git a/platformio/managers/lib.py b/platformio/managers/lib.py index 09c5ef12..e900fd97 100644 --- a/platformio/managers/lib.py +++ b/platformio/managers/lib.py @@ -365,7 +365,7 @@ class LibraryManager(BasePkgManager): for filters in self.normalize_dependencies(manifest['dependencies']): assert "name" in filters - if any([s in filters.get("version", "") for s in ("\\", "/")]): + if any(s in filters.get("version", "") for s in ("\\", "/")): self.install( "{name}={version}".format(**filters), silent=silent, @@ -420,6 +420,6 @@ def get_builtin_libs(storage_names=None): @util.memoized def is_builtin_lib(name): for storage in get_builtin_libs(): - if any([l.get("name") == name for l in storage['items']]): + if any(l.get("name") == name for l in storage['items']): return True return False From dcb299e9b91eddec66f5ca1ee6bbede62b9419c1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 18 Jan 2018 22:12:32 +0200 Subject: [PATCH 02/98] Use dynamic "build_dir" when checking project for structure chnages --- platformio/commands/run.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index d459ae6d..02f746cc 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -15,7 +15,7 @@ from datetime import datetime from hashlib import sha1 from os import getcwd, makedirs, walk -from os.path import getmtime, isdir, isfile, join +from os.path import basename, getmtime, isdir, isfile, join from time import time import click @@ -405,12 +405,14 @@ def check_project_envs(config, environments): def calculate_project_hash(): structure = [__version__] + build_dir_name = basename(util.get_projectbuild_dir()) for d in (util.get_projectsrc_dir(), util.get_projectlib_dir()): if not isdir(d): continue for root, _, files in walk(d): for f in files: path = join(root, f) - if not any(s in path for s in (".git", ".svn", ".pioenvs")): + if not any( + s in path for s in (".git", ".svn", build_dir_name)): structure.append(path) return sha1(",".join(sorted(structure))).hexdigest() if structure else "" From 86667c5664d76df2a2bcca3e5123ea452b3ffd88 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 18 Jan 2018 22:13:36 +0200 Subject: [PATCH 03/98] Bump version to 3.5.2a1 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index db38e271..06bd01d7 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, 1) +VERSION = (3, 5, "2a1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From e615e7529ee559b1383aadb274097087916ec29f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 24 Jan 2018 14:34:08 +0200 Subject: [PATCH 04/98] Fix issue with downloader when dependency URL ends with "/" --- docs | 2 +- platformio/downloader.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index 2e04299a..a65d0426 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 2e04299a170b3654d9f4ec3c78392fb9202e829b +Subproject commit a65d04269399f6170e112b56aace6b368835254b diff --git a/platformio/downloader.py b/platformio/downloader.py index 4dc84a83..df9f65a2 100644 --- a/platformio/downloader.py +++ b/platformio/downloader.py @@ -48,7 +48,7 @@ class FileDownloader(object): "'", "") self._fname = self._fname.encode("utf8") else: - self._fname = url.split("/")[-1] + self._fname = [p for p in url.split("/") if p][-1] self._progressbar = None self._destination = self._fname From c0b277d9c8f22fe1b6502fcefe4409f6989ee7c6 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 24 Jan 2018 14:56:15 +0200 Subject: [PATCH 05/98] Handle "os.mbed.com" URL as Mercurial (hg) repository --- platformio/managers/package.py | 4 +++- tests/test_managers.py | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/platformio/managers/package.py b/platformio/managers/package.py index 0b1e0ad1..905b756a 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -553,7 +553,9 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin): hg_conditions = [ # Handle Developer Mbed URL # (https://developer.mbed.org/users/user/code/package/) - text.startswith("https://developer.mbed.org") + # (https://os.mbed.com/users/user/code/package/) + text.startswith("https://developer.mbed.org"), + text.startswith("https://os.mbed.com") ] if any(git_conditions): url = "git+" + text diff --git a/tests/test_managers.py b/tests/test_managers.py index 6fe2f273..ee2d5df1 100644 --- a/tests/test_managers.py +++ b/tests/test_managers.py @@ -82,6 +82,11 @@ def test_pkg_input_parser(): ("package", None, "hg+https://developer.mbed.org/users/user/code/package/") ], + [ + "https://os.mbed.com/users/user/code/package/", + ("package", None, + "hg+https://os.mbed.com/users/user/code/package/") + ], [ "https://github.com/user/package#v1.2.3", ("package", None, "git+https://github.com/user/package#v1.2.3") From de523493b2266eac6b2e3d7bf861d85b71f618c2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 24 Jan 2018 14:56:44 +0200 Subject: [PATCH 06/98] Improve support for old mbed libraries without manifest --- HISTORY.rst | 6 ++++++ platformio/builder/tools/piolib.py | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index c9416975..65613517 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,12 @@ Release Notes PlatformIO 3.0 -------------- +3.5.2 (2018-??-??) +~~~~~~~~~~~~~~~~~~ + +* Handle "os.mbed.com" URL as Mercurial (hg) repository +* Improved support for old mbed libraries without manifest + 3.5.1 (2018-01-18) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 01cd4f2f..a6bd70e6 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -516,8 +516,20 @@ class MbedLibBuilder(LibBuilderBase): include_dirs = LibBuilderBase.get_include_dirs(self) if self.path not in include_dirs: include_dirs.append(self.path) + + # library with module.json for p in self._manifest.get("extraIncludes", []): include_dirs.append(join(self.path, p)) + + # old mbed library without manifest, add to CPPPATH all folders + if not self._manifest: + for root, _, __ in os.walk(self.path): + part = root.replace(self.path, "").lower() + if any(s in part for s in ("%s." % sep, "test", "example")): + continue + if root not in include_dirs: + include_dirs.append(root) + return include_dirs def is_frameworks_compatible(self, frameworks): From f512ccbe682876198d75b8e97674e281677d4843 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 24 Jan 2018 15:53:28 +0200 Subject: [PATCH 07/98] Fix issue with duplicated "include" records when generating data for IDE // Resolve #1301 --- platformio/builder/tools/pioide.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/platformio/builder/tools/pioide.py b/platformio/builder/tools/pioide.py index 726d52dd..e3f98ca4 100644 --- a/platformio/builder/tools/pioide.py +++ b/platformio/builder/tools/pioide.py @@ -53,7 +53,13 @@ def _dump_includes(env): if unity_dir: includes.append(unity_dir) - return includes + # remove dupicates + result = [] + for item in includes: + if item not in result: + result.append(item) + + return result def _get_gcc_defines(env): From 717a6995469cd93f496079f9462aa7e190aaa6b2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 24 Jan 2018 16:10:14 +0200 Subject: [PATCH 08/98] Bump version to 3.5.2a2 --- HISTORY.rst | 4 +++- platformio/__init__.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 65613517..9e7c2e49 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,8 +7,10 @@ PlatformIO 3.0 3.5.2 (2018-??-??) ~~~~~~~~~~~~~~~~~~ -* Handle "os.mbed.com" URL as Mercurial (hg) repository +* Handle "os.mbed.com" URL as a Mercurial (hg) repository * Improved support for old mbed libraries without manifest +* Fixed issue with duplicated "include" records when generating data for IDE + (`issue #1301 `_) 3.5.1 (2018-01-18) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index 06bd01d7..181f5816 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2a1") +VERSION = (3, 5, "2a2") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From fa738650daf070dd1686f97ff7105207f8a487b7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 24 Jan 2018 17:22:28 +0200 Subject: [PATCH 09/98] Add special prefix for BlackMagic probe for Windows COM ports >= COM10 --- platformio/builder/tools/pioupload.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index f867c78a..21cf4149 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -133,7 +133,8 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument port = item['port'] if upload_protocol.startswith("blackmagic") \ and "GDB" in item['description']: - return port + return ("\\\\.\\%s" % port if system() == "Windows" + and port.startswith("COM") and len(port) > 4 else port) for hwid in board_hwids: hwid_str = ("%s:%s" % (hwid[0], hwid[1])).replace("0x", "") if hwid_str in item['hwid']: From b8fde283fd36788d394d14070634e0163a766464 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 24 Jan 2018 18:33:41 +0200 Subject: [PATCH 10/98] Use util.get_systype when checking for system --- platformio/builder/tools/piolib.py | 5 +++-- platformio/builder/tools/pioupload.py | 5 ++--- platformio/util.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index a6bd70e6..7c74ab0b 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -23,7 +23,6 @@ import sys from glob import glob from os.path import (basename, commonprefix, dirname, isdir, isfile, join, realpath, sep) -from platform import system import SCons.Scanner from SCons.Script import ARGUMENTS, COMMAND_LINE_TARGETS, DefaultEnvironment @@ -82,6 +81,8 @@ class LibBuilderFactory(object): class LibBuilderBase(object): + IS_WINDOWS = "windows" in util.get_systype() + LDF_MODES = ["off", "chain", "deep", "chain+", "deep+"] LDF_MODE_DEFAULT = "chain" @@ -119,7 +120,7 @@ class LibBuilderBase(object): def __contains__(self, path): p1 = self.path p2 = path - if system() == "Windows": + if self.IS_WINDOWS: p1 = p1.lower() p2 = p2.lower() return commonprefix((p1 + sep, p2)) == p1 + sep diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 21cf4149..45988330 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -18,7 +18,6 @@ import sys from fnmatch import fnmatch from os import environ from os.path import isfile, join -from platform import system from shutil import copyfile from time import sleep @@ -133,7 +132,7 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument port = item['port'] if upload_protocol.startswith("blackmagic") \ and "GDB" in item['description']: - return ("\\\\.\\%s" % port if system() == "Windows" + return ("\\\\.\\%s" % port if "windows" in util.get_systype() and port.startswith("COM") and len(port) > 4 else port) for hwid in board_hwids: hwid_str = ("%s:%s" % (hwid[0], hwid[1])).replace("0x", "") @@ -149,7 +148,7 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument and not env.subst("$UPLOAD_PROTOCOL"): env.Replace(UPLOAD_PORT=_look_for_mbed_disk()) else: - if (system() == "Linux" and not any([ + if ("linux" in util.get_systype() and not any([ isfile("/etc/udev/rules.d/99-platformio-udev.rules"), isfile("/lib/udev/rules.d/99-platformio-udev.rules") ])): diff --git a/platformio/util.py b/platformio/util.py index 53c23918..61f26169 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -431,7 +431,7 @@ def get_serial_ports(filter_hwid=False): for p, d, h in comports(): if not p: continue - if platform.system() == "Windows": + if "windows" in get_systype(): try: d = unicode(d, errors="ignore") except TypeError: @@ -443,7 +443,7 @@ def get_serial_ports(filter_hwid=False): return result # fix for PySerial - if not result and platform.system() == "Darwin": + if not result and "darwin" in get_systype(): for p in glob("/dev/tty.*"): result.append({"port": p, "description": "n/a", "hwid": "n/a"}) return result @@ -455,7 +455,7 @@ get_serialports = get_serial_ports def get_logical_devices(): items = [] - if platform.system() == "Windows": + if "windows" in get_systype(): try: result = exec_command( ["wmic", "logicaldisk", "get", "name,VolumeName"]).get( From dabe9ba2a797f396d79127a00ed49244e5a78442 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 25 Jan 2018 14:26:15 +0200 Subject: [PATCH 11/98] Show all available upload protocols before firmware uploading --- HISTORY.rst | 1 + platformio/builder/main.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 9e7c2e49..5fa9c650 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,7 @@ PlatformIO 3.0 3.5.2 (2018-??-??) ~~~~~~~~~~~~~~~~~~ +* Show all available upload protocols before firmware uploading * Handle "os.mbed.com" URL as a Mercurial (hg) repository * Improved support for old mbed libraries without manifest * Fixed issue with duplicated "include" records when generating data for IDE diff --git a/platformio/builder/main.py b/platformio/builder/main.py index c729e4af..8fc405f5 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -20,7 +20,7 @@ from os.path import expanduser, join from time import time from SCons.Script import (ARGUMENTS, COMMAND_LINE_TARGETS, DEFAULT_TARGETS, - AllowSubstExceptions, AlwaysBuild, + Action, AllowSubstExceptions, AlwaysBuild, DefaultEnvironment, Variables) from platformio import util @@ -182,3 +182,16 @@ if "idedata" in COMMAND_LINE_TARGETS: "See explanation in FAQ > Troubleshooting > Building\n" "http://docs.platformio.org/page/faq.html\n\n") env.Exit(1) + + +def print_upload_protocols_info(source, target, env): + selected = env.subst("$UPLOAD_PROTOCOL") + available = env.BoardConfig().get("upload", {}).get( + "protocols", [selected]) + print "Available: %s" % ", ".join(available) + print "Selected: %s" % selected + + +env.AddPreAction(["upload", "program"], + Action(print_upload_protocols_info, + "Configuring upload protocol...")) From f8dafbca8063e893ddaa09855607c813a577d1ac Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 25 Jan 2018 17:58:52 +0200 Subject: [PATCH 12/98] Show device system information (MCU, Frequency, RAM, Flash, Debugging tools) in a build log --- HISTORY.rst | 4 +- docs | 2 +- platformio/builder/main.py | 3 +- platformio/builder/tools/pioplatform.py | 50 ++++++++++++++++++++++++- platformio/builder/tools/platformio.py | 2 + platformio/commands/boards.py | 16 ++------ platformio/managers/platform.py | 8 ++-- platformio/util.py | 17 +++++++++ 8 files changed, 82 insertions(+), 20 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 5fa9c650..384188b4 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,7 +7,9 @@ PlatformIO 3.0 3.5.2 (2018-??-??) ~~~~~~~~~~~~~~~~~~ -* Show all available upload protocols before firmware uploading +* Show device system information (MCU, Frequency, RAM, Flash, Debugging tools) + in a build log +* Show all available upload protocols before firmware uploading in a build log * Handle "os.mbed.com" URL as a Mercurial (hg) repository * Improved support for old mbed libraries without manifest * Fixed issue with duplicated "include" records when generating data for IDE diff --git a/docs b/docs index a65d0426..ec9ec10d 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit a65d04269399f6170e112b56aace6b368835254b +Subproject commit ec9ec10dcd7a335729503f4cedd3a2f0c06e5e6d diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 8fc405f5..ef6be34a 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -184,7 +184,8 @@ if "idedata" in COMMAND_LINE_TARGETS: env.Exit(1) -def print_upload_protocols_info(source, target, env): +def print_upload_protocols_info( # pylint: disable=unused-argument + source, target, _): selected = env.subst("$UPLOAD_PROTOCOL") available = env.BoardConfig().get("upload", {}).get( "protocols", [selected]) diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index 02519dbe..80fb5e67 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -41,8 +41,9 @@ def PioPlatform(env): def BoardConfig(env, board=None): p = initPioPlatform(env['PLATFORM_MANIFEST']) try: - assert env.get("BOARD", board), "BoardConfig: Board is not defined" - config = p.board_config(board if board else env.get("BOARD")) + board = board or env.get("BOARD") + assert board, "BoardConfig: Board is not defined" + config = p.board_config(board) except (AssertionError, exception.UnknownBoard) as e: sys.stderr.write("Error: %s\n" % str(e)) env.Exit(1) @@ -97,6 +98,50 @@ def LoadPioPlatform(env, variables): env.Replace(LDSCRIPT_PATH=board_config.get("build.ldscript")) +def PrintSystemInfo(env): + data = [] + debug_tools = None + mcu = env.subst("$BOARD_MCU") + f_cpu = env.subst("$BOARD_F_CPU") + if mcu: + data.append(mcu.upper()) + if f_cpu: + f_cpu = int("".join([c for c in str(f_cpu) if c.isdigit()])) + data.append("%dMHz" % (f_cpu / 1000000)) + + if "BOARD" in env: + board_config = env.BoardConfig() + debug_tools = board_config.get("debug", {}).get("tools") + ram = board_config.get("upload", {}).get("maximum_ram_size") + flash = board_config.get("upload", {}).get("maximum_size") + for (key, value) in (("RAM", ram), ("Flash", flash)): + if not value: + continue + data.append("%s/%s" % (key, util.format_filesize(value))) + + if data: + print "System: %s" % " ".join(data) + + # Debugging + if not debug_tools: + return + + data = [] + onboard = [] + external = [] + for key, value in debug_tools.items(): + if value.get("onboard"): + onboard.append(key) + else: + external.append(key) + if onboard: + data.append("ON-BORD(%s)" % ", ".join(sorted(onboard))) + if external: + data.append("EXTERNAL(%s)" % ", ".join(sorted(external))) + + print "Debug: %s" % " ".join(data) + + def exists(_): return True @@ -106,4 +151,5 @@ def generate(env): env.AddMethod(BoardConfig) env.AddMethod(GetFrameworkScript) env.AddMethod(LoadPioPlatform) + env.AddMethod(PrintSystemInfo) return env diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 0ca092de..a02a6fe9 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -42,6 +42,8 @@ def BuildProgram(env): _append_pio_macros() + env.PrintSystemInfo() + # fix ASM handling under non-casitive OS if not case_sensitive_suffixes(".s", ".S"): env.Replace(AS="$CC", ASCOM="$ASPPCOM") diff --git a/platformio/commands/boards.py b/platformio/commands/boards.py index e4921354..5764b9f8 100644 --- a/platformio/commands/boards.py +++ b/platformio/commands/boards.py @@ -16,6 +16,7 @@ import json import click +from platformio import util from platformio.managers.platform import PlatformManager @@ -60,22 +61,13 @@ def print_boards(boards): click.echo("-" * terminal_width) for board in boards: - ram_size = board['ram'] - if ram_size >= 1024: - if ram_size % 1024: - ram_size = "%.1fkB" % (ram_size / 1024.0) - else: - ram_size = "%dkB" % (ram_size / 1024) - else: - ram_size = "%dB" % ram_size - click.echo( BOARDLIST_TPL.format( type=click.style(board['id'], fg="cyan"), mcu=board['mcu'], - frequency="%dMhz" % (board['fcpu'] / 1000000), - flash="%dkB" % (board['rom'] / 1024), - ram=ram_size, + frequency="%dMHz" % (board['fcpu'] / 1000000), + flash=util.format_filesize(board['rom']), + ram=util.format_filesize(board['ram']), name=board['name'])) diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index b3090705..1485059f 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -684,9 +684,11 @@ class PlatformBoardConfig(object): "mcu": self._manifest.get("build", {}).get("mcu", "").upper(), "fcpu": - int( - re.sub(r"[^\d]+", "", - self._manifest.get("build", {}).get("f_cpu", "0L"))), + int("".join([ + c for c in str( + self._manifest.get("build", {}).get("f_cpu", "0L")) + if c.isdigit() + ])), "ram": self._manifest.get("upload", {}).get("maximum_ram_size", 0), "rom": diff --git a/platformio/util.py b/platformio/util.py index 61f26169..526d69e7 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -743,6 +743,23 @@ def parse_date(datestr): return time.strptime(datestr) +def format_filesize(filesize): + base = 1024 + unit = 0 + suffix = "B" + filesize = float(filesize) + if filesize < base: + return "%d%s" % (filesize, suffix) + for i, suffix in enumerate("KMGTPEZY"): + unit = base**(i + 2) + if filesize >= unit: + continue + if filesize % (base**(i + 1)): + return "%.2f%s" % ((base * filesize / unit), suffix) + break + return "%d%s" % ((base * filesize / unit), suffix) + + def rmtree_(path): def _onerror(_, name, __): From 6b826abce0d967ae5be91bfa284910c261796e19 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 25 Jan 2018 18:03:10 +0200 Subject: [PATCH 13/98] Bump version to 3.5.2a3 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 181f5816..1dbc191b 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2a2") +VERSION = (3, 5, "2a3") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 1412f085b8e54841c4dfd441f8d09bc2d51133f2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 25 Jan 2018 18:12:36 +0200 Subject: [PATCH 14/98] Minor improvements --- platformio/builder/main.py | 12 +----------- platformio/builder/tools/pioplatform.py | 9 +++++++++ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index ef6be34a..9c8ad03b 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -183,16 +183,6 @@ if "idedata" in COMMAND_LINE_TARGETS: "http://docs.platformio.org/page/faq.html\n\n") env.Exit(1) - -def print_upload_protocols_info( # pylint: disable=unused-argument - source, target, _): - selected = env.subst("$UPLOAD_PROTOCOL") - available = env.BoardConfig().get("upload", {}).get( - "protocols", [selected]) - print "Available: %s" % ", ".join(available) - print "Selected: %s" % selected - - env.AddPreAction(["upload", "program"], - Action(print_upload_protocols_info, + Action(lambda source, target, env: env.PrintUploadInfo(), "Configuring upload protocol...")) diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index 80fb5e67..a042b437 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -142,6 +142,14 @@ def PrintSystemInfo(env): print "Debug: %s" % " ".join(data) +def PrintUploadInfo(env): + selected = env.subst("$UPLOAD_PROTOCOL") + available = env.BoardConfig().get("upload", {}).get( + "protocols", [selected]) + print "Available: %s" % ", ".join(available) + print "Selected: %s" % selected + + def exists(_): return True @@ -152,4 +160,5 @@ def generate(env): env.AddMethod(GetFrameworkScript) env.AddMethod(LoadPioPlatform) env.AddMethod(PrintSystemInfo) + env.AddMethod(PrintUploadInfo) return env From 7a40992cc158db926efe38aca5c13b70532be6a1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 26 Jan 2018 19:53:07 +0200 Subject: [PATCH 15/98] Add aliases for LDF compatibility modes --- HISTORY.rst | 2 ++ docs | 2 +- platformio/builder/tools/piolib.py | 38 +++++++++++++++++------------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 384188b4..86130c76 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,8 @@ PlatformIO 3.0 3.5.2 (2018-??-??) ~~~~~~~~~~~~~~~~~~ +* Added aliases (off, light, strict) for + `LDF Compatibility Modes `__ * Show device system information (MCU, Frequency, RAM, Flash, Debugging tools) in a build log * Show all available upload protocols before firmware uploading in a build log diff --git a/docs b/docs index ec9ec10d..86ba500a 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ec9ec10dcd7a335729503f4cedd3a2f0c06e5e6d +Subproject commit 86ba500affa389263f4b97e6480192f3544f0041 diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 7c74ab0b..e98e96ed 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -86,8 +86,8 @@ class LibBuilderBase(object): LDF_MODES = ["off", "chain", "deep", "chain+", "deep+"] LDF_MODE_DEFAULT = "chain" - COMPAT_MODES = [0, 1, 2] - COMPAT_MODE_DEFAULT = 1 + COMPAT_MODES = ["off", "light", "strict"] + COMPAT_MODE_DEFAULT = "light" CLASSIC_SCANNER = SCons.Scanner.C.CScanner() ADVANCED_SCANNER = SCons.Scanner.C.CScanner(advanced=True) @@ -230,12 +230,15 @@ class LibBuilderBase(object): @staticmethod def validate_compat_mode(mode): - try: - mode = int(mode) - assert mode in LibBuilderBase.COMPAT_MODES + if isinstance(mode, basestring): + mode = mode.strip().lower() + if mode in LibBuilderBase.COMPAT_MODES: return mode - except (AssertionError, ValueError): - return LibBuilderBase.COMPAT_MODE_DEFAULT + try: + return LibBuilderBase.COMPAT_MODES[int(mode)] + except (IndexError, ValueError): + pass + return LibBuilderBase.COMPAT_MODE_DEFAULT def is_platforms_compatible(self, platforms): return True @@ -743,13 +746,13 @@ def GetLibBuilders(env): # pylint: disable=too-many-branches if verbose: sys.stderr.write("Ignored library %s\n" % lb.path) return None - if compat_mode > 1 and not lb.is_platforms_compatible( + if compat_mode == "strict" and not lb.is_platforms_compatible( env['PIOPLATFORM']): if verbose: sys.stderr.write( "Platform incompatible library %s\n" % lb.path) return False - if compat_mode > 0 and "PIOFRAMEWORK" in env and \ + if compat_mode == "light" and "PIOFRAMEWORK" in env and \ not lb.is_frameworks_compatible(env.get("PIOFRAMEWORK", [])): if verbose: sys.stderr.write( @@ -828,20 +831,23 @@ def BuildProjectLibraries(env): if lb.depbuilders: print_deps_tree(lb, level + 1) - print "Collected %d compatible libraries" % len(lib_builders) - print "Scanning dependencies..." - project = ProjectAsLibBuilder(env, "$PROJECT_DIR") project.env = env + ldf_mode = LibBuilderBase.lib_ldf_mode.fget(project) + + print "Library Dependency Finder -> http://bit.ly/configure-pio-ldf" + print "Modes: Finder/%s Compatibility/%s" % (ldf_mode, + project.lib_compat_mode) + print "Collected %d compatible libraries" % len(lib_builders) + + print "Scanning dependencies..." project.search_deps_recursive() - if (LibBuilderBase.validate_ldf_mode( - env.get("LIB_LDF_MODE", LibBuilderBase.LDF_MODE_DEFAULT)) - .startswith("chain") and project.depbuilders): + if ldf_mode.startswith("chain") and project.depbuilders: correct_found_libs() if project.depbuilders: - print "Library Dependency Graph ( http://bit.ly/configure-pio-ldf )" + print "Dependency Graph" print_deps_tree(project) else: print "No dependencies" From 59337c71c15a81e4dbccbb00d3aa8f37407a5888 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 26 Jan 2018 20:04:43 +0200 Subject: [PATCH 16/98] Upgrad build system to SCons 3.0 // Issue #895 --- HISTORY.rst | 2 ++ platformio/builder/tools/piolib.py | 12 +++++------- platformio/managers/core.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 86130c76..b00fde2d 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,8 @@ PlatformIO 3.0 3.5.2 (2018-??-??) ~~~~~~~~~~~~~~~~~~ +* Upgraded build system to `SCons `__ 3.0 + (`issue #895 `_) * Added aliases (off, light, strict) for `LDF Compatibility Modes `__ * Show device system information (MCU, Frequency, RAM, Flash, Debugging tools) diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index e98e96ed..9c17daec 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -90,7 +90,7 @@ class LibBuilderBase(object): COMPAT_MODE_DEFAULT = "light" CLASSIC_SCANNER = SCons.Scanner.C.CScanner() - ADVANCED_SCANNER = SCons.Scanner.C.CScanner(advanced=True) + CCONDITIONAL_SCANNER = SCons.Scanner.C.CConditionalScanner() PARSE_SRC_BY_H_NAME = True _INCLUDE_DIRS_CACHE = None @@ -343,17 +343,15 @@ class LibBuilderBase(object): for path in self._validate_search_files(search_files): try: assert "+" in self.lib_ldf_mode - incs = self.env.File(path).get_found_includes( - self.env, LibBuilderBase.ADVANCED_SCANNER, - tuple(include_dirs)) + incs = LibBuilderBase.CCONDITIONAL_SCANNER( + self.env.File(path), self.env, tuple(include_dirs)) except Exception as e: # pylint: disable=broad-except if self.verbose and "+" in self.lib_ldf_mode: sys.stderr.write( "Warning! Classic Pre Processor is used for `%s`, " "advanced has failed with `%s`\n" % (path, e)) - _incs = self.env.File(path).get_found_includes( - self.env, LibBuilderBase.CLASSIC_SCANNER, - tuple(include_dirs)) + _incs = LibBuilderBase.CLASSIC_SCANNER( + self.env.File(path), self.env, tuple(include_dirs)) incs = [] for inc in _incs: incs.append(inc) diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 3d1e8721..c417fb4b 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -25,7 +25,7 @@ CORE_PACKAGES = { "contrib-pysite": ">=0.1.2,<2", "tool-pioplus": ">=0.13.3,<2", "tool-unity": "~1.20302.1", - "tool-scons": "~3.20501.2" + "tool-scons": ">=3.30000.0,<4" } PIOPLUS_AUTO_UPDATES_MAX = 100 From b6ad672f6a1c1ab59ac44705a82cadac0cedc305 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 26 Jan 2018 20:50:33 +0200 Subject: [PATCH 17/98] Use SCons "gas" tool instead of "as" --- platformio/builder/main.py | 2 +- platformio/builder/tools/piolib.py | 7 ++++--- platformio/builder/tools/platformio.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 9c8ad03b..3ae92943 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -75,7 +75,7 @@ MULTILINE_VARS = [ DEFAULT_ENV_OPTIONS = dict( tools=[ - "ar", "as", "gcc", "g++", "gnulink", "platformio", "pioplatform", + "ar", "gas", "gcc", "g++", "gnulink", "platformio", "pioplatform", "piowinhooks", "piolib", "pioupload", "piomisc", "pioide" ], # yapf: disable toolpath=[join(util.get_source_dir(), "builder", "tools")], diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 9c17daec..bc08f4f1 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -796,9 +796,8 @@ def GetLibBuilders(env): # pylint: disable=too-many-branches def BuildProjectLibraries(env): - lib_builders = env.GetLibBuilders() - def correct_found_libs(): + def correct_found_libs(lib_builders): # build full dependency graph found_lbs = [lb for lb in lib_builders if lb.dependent] for lb in lib_builders: @@ -836,13 +835,15 @@ def BuildProjectLibraries(env): print "Library Dependency Finder -> http://bit.ly/configure-pio-ldf" print "Modes: Finder/%s Compatibility/%s" % (ldf_mode, project.lib_compat_mode) + + lib_builders = env.GetLibBuilders() print "Collected %d compatible libraries" % len(lib_builders) print "Scanning dependencies..." project.search_deps_recursive() if ldf_mode.startswith("chain") and project.depbuilders: - correct_found_libs() + correct_found_libs(lib_builders) if project.depbuilders: print "Dependency Graph" diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index a02a6fe9..4becee3e 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -44,7 +44,7 @@ def BuildProgram(env): env.PrintSystemInfo() - # fix ASM handling under non-casitive OS + # fix ASM handling under non case-sensitive OS if not case_sensitive_suffixes(".s", ".S"): env.Replace(AS="$CC", ASCOM="$ASPPCOM") From 316c2c6e1a363f95d75bf5e0d7a73de91a973ed3 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 26 Jan 2018 22:24:49 +0200 Subject: [PATCH 18/98] Improve calculating of project hash --- platformio/commands/run.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 02f746cc..5bc7187b 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -15,7 +15,7 @@ from datetime import datetime from hashlib import sha1 from os import getcwd, makedirs, walk -from os.path import basename, getmtime, isdir, isfile, join +from os.path import getmtime, isdir, isfile, join from time import time import click @@ -404,15 +404,14 @@ def check_project_envs(config, environments): def calculate_project_hash(): + check_suffixes = (".c", ".cc", ".cpp", ".h", ".hpp", ".s", ".S") structure = [__version__] - build_dir_name = basename(util.get_projectbuild_dir()) for d in (util.get_projectsrc_dir(), util.get_projectlib_dir()): if not isdir(d): continue for root, _, files in walk(d): for f in files: path = join(root, f) - if not any( - s in path for s in (".git", ".svn", build_dir_name)): + if path.endswith(check_suffixes): structure.append(path) - return sha1(",".join(sorted(structure))).hexdigest() if structure else "" + return sha1(",".join(sorted(structure))).hexdigest() From 31700c6bfc1ddd0d7058d88201abcfe78677678d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 27 Jan 2018 00:18:32 +0200 Subject: [PATCH 19/98] Fix issue with detecting media disk when mbed upload protocol is specified --- platformio/builder/tools/pioplatform.py | 9 --------- platformio/builder/tools/pioupload.py | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index a042b437..80fb5e67 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -142,14 +142,6 @@ def PrintSystemInfo(env): print "Debug: %s" % " ".join(data) -def PrintUploadInfo(env): - selected = env.subst("$UPLOAD_PROTOCOL") - available = env.BoardConfig().get("upload", {}).get( - "protocols", [selected]) - print "Available: %s" % ", ".join(available) - print "Selected: %s" % selected - - def exists(_): return True @@ -160,5 +152,4 @@ def generate(env): env.AddMethod(GetFrameworkScript) env.AddMethod(LoadPioPlatform) env.AddMethod(PrintSystemInfo) - env.AddMethod(PrintUploadInfo) return env diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 45988330..4e404956 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -144,8 +144,9 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument print env.subst("Use manually specified: $UPLOAD_PORT") return - if "mbed" in env.subst("$PIOFRAMEWORK") \ - and not env.subst("$UPLOAD_PROTOCOL"): + if (env.subst("$UPLOAD_PROTOCOL") == "mbed" + or ("mbed" in env.subst("$PIOFRAMEWORK") + and not env.subst("$UPLOAD_PROTOCOL"))): env.Replace(UPLOAD_PORT=_look_for_mbed_disk()) else: if ("linux" in util.get_systype() and not any([ @@ -212,6 +213,14 @@ def CheckUploadSize(_, target, source, env): # pylint: disable=W0613,W0621 env.Exit(1) +def PrintUploadInfo(env): + selected = env.subst("$UPLOAD_PROTOCOL") + available = env.BoardConfig().get("upload", {}).get( + "protocols", [selected]) + print "Available: %s" % ", ".join(available) + print "Selected: %s" % selected + + def exists(_): return True @@ -223,4 +232,5 @@ def generate(env): env.AddMethod(AutodetectUploadPort) env.AddMethod(UploadToDisk) env.AddMethod(CheckUploadSize) + env.AddMethod(PrintUploadInfo) return env From 8186aed8d997c077a22bad3517955ac016d7f057 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 27 Jan 2018 00:52:45 +0200 Subject: [PATCH 20/98] Bump version to 3.5.2a4 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 1dbc191b..77a15484 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2a3") +VERSION = (3, 5, "2a4") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 59fb4b103fce2ffdee83d1cdc7941dc2e8922fb9 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 27 Jan 2018 01:16:37 +0200 Subject: [PATCH 21/98] Fix issue when project without a specified board can't be uploaded // Resolve #1313 --- platformio/builder/tools/pioupload.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 4e404956..f82b75da 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -214,11 +214,12 @@ def CheckUploadSize(_, target, source, env): # pylint: disable=W0613,W0621 def PrintUploadInfo(env): - selected = env.subst("$UPLOAD_PROTOCOL") - available = env.BoardConfig().get("upload", {}).get( - "protocols", [selected]) - print "Available: %s" % ", ".join(available) - print "Selected: %s" % selected + configured = env.subst("$UPLOAD_PROTOCOL") + if "BOARD" in env: + available = env.BoardConfig().get("upload", {}).get( + "protocols", [configured]) + print "Available: %s" % ", ".join(available) + print "Configured: %s" % configured def exists(_): From 332472e84b786d715fcca8fedf78d6fef2c21ff3 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 Jan 2018 00:17:55 +0200 Subject: [PATCH 22/98] Save temporary file in unicode for INO2CPP --- platformio/builder/tools/piomisc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 7c08237f..2c61c1db 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -15,6 +15,7 @@ from __future__ import absolute_import import atexit +import io import re import sys from os import environ, remove, walk @@ -84,7 +85,7 @@ class InoToCPPConverter(object): def _gcc_preprocess(self, contents, out_file): tmp_path = mkstemp()[1] - with open(tmp_path, "w") as fp: + with io.open(tmp_path, mode="w", encoding="utf-8") as fp: fp.write(contents) self.env.Execute( self.env.VerboseAction( From 6235328194c75fa1790f8c85206296f8da577841 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 Jan 2018 00:28:21 +0200 Subject: [PATCH 23/98] Bump version to 3.5.2a5 --- platformio/__init__.py | 2 +- tests/ino2cpp/basic/basic.ino | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 77a15484..27e31b8b 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2a4") +VERSION = (3, 5, "2a5") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/tests/ino2cpp/basic/basic.ino b/tests/ino2cpp/basic/basic.ino index 88ac301c..0c5d7511 100644 --- a/tests/ino2cpp/basic/basic.ino +++ b/tests/ino2cpp/basic/basic.ino @@ -48,3 +48,5 @@ void myFunction(struct Item *item) { void fooCallback(){ } + +// юнікод From 640aa72cffad1adc4433b57cd9c36d947f83284f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 30 Jan 2018 14:49:10 +0200 Subject: [PATCH 24/98] Minor fix --- platformio/managers/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/managers/package.py b/platformio/managers/package.py index 905b756a..29761195 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -478,7 +478,7 @@ class PkgInstallerMixin(object): target_dirname = "%s@src-%s" % ( pkg_dirname, hashlib.md5(cur_manifest['__src_url']).hexdigest()) - os.rename(pkg_dir, join(self.package_dir, target_dirname)) + os.rename(pkg_dir, join(self.package_dir, str(target_dirname))) # fix to a version elif action == 2: target_dirname = "%s@%s" % (pkg_dirname, From fc53cb448977465d069a70cd5a3c6197aaa8222a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 30 Jan 2018 15:14:55 +0200 Subject: [PATCH 25/98] Revert back to SCons 2.0, a lot of issues with non-unicode locales // Issue #895 --- HISTORY.rst | 2 -- platformio/managers/core.py | 2 +- platformio/managers/package.py | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index b00fde2d..86130c76 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,8 +7,6 @@ PlatformIO 3.0 3.5.2 (2018-??-??) ~~~~~~~~~~~~~~~~~~ -* Upgraded build system to `SCons `__ 3.0 - (`issue #895 `_) * Added aliases (off, light, strict) for `LDF Compatibility Modes `__ * Show device system information (MCU, Frequency, RAM, Flash, Debugging tools) diff --git a/platformio/managers/core.py b/platformio/managers/core.py index c417fb4b..1de8aa5f 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -25,7 +25,7 @@ CORE_PACKAGES = { "contrib-pysite": ">=0.1.2,<2", "tool-pioplus": ">=0.13.3,<2", "tool-unity": "~1.20302.1", - "tool-scons": ">=3.30000.0,<4" + "tool-scons": "~2.20501.3" } PIOPLUS_AUTO_UPDATES_MAX = 100 diff --git a/platformio/managers/package.py b/platformio/managers/package.py index 29761195..905b756a 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -478,7 +478,7 @@ class PkgInstallerMixin(object): target_dirname = "%s@src-%s" % ( pkg_dirname, hashlib.md5(cur_manifest['__src_url']).hexdigest()) - os.rename(pkg_dir, join(self.package_dir, str(target_dirname))) + os.rename(pkg_dir, join(self.package_dir, target_dirname)) # fix to a version elif action == 2: target_dirname = "%s@%s" % (pkg_dirname, From 4980d3e4bb3cb0ba4d12630d8ec5257066cb2687 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 30 Jan 2018 15:25:17 +0200 Subject: [PATCH 26/98] Bump version to 3.5.2a6 --- platformio/__init__.py | 2 +- platformio/builder/tools/piomisc.py | 3 +-- tests/conftest.py | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 27e31b8b..28d771e9 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2a5") +VERSION = (3, 5, "2a6") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 2c61c1db..7c08237f 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -15,7 +15,6 @@ from __future__ import absolute_import import atexit -import io import re import sys from os import environ, remove, walk @@ -85,7 +84,7 @@ class InoToCPPConverter(object): def _gcc_preprocess(self, contents, out_file): tmp_path = mkstemp()[1] - with io.open(tmp_path, mode="w", encoding="utf-8") as fp: + with open(tmp_path, "w") as fp: fp.write(contents) self.env.Execute( self.env.VerboseAction( diff --git a/tests/conftest.py b/tests/conftest.py index 5b8103c9..02d16069 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -24,8 +24,8 @@ from platformio import util def validate_cliresult(): def decorator(result): - assert result.exit_code == 0 - assert not result.exception + assert result.exit_code == 0, result.output + assert not result.exception, result.output return decorator From 1890162f3fbbb6a7a74bbb25b9c5964e6127dc87 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 30 Jan 2018 21:33:56 +0200 Subject: [PATCH 27/98] VSCode: add a new "Pre-Debug" task and run it before debugging session --- platformio/ide/tpls/vscode/.vscode/launch.json.tpl | 6 ++++-- platformio/managers/core.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/platformio/ide/tpls/vscode/.vscode/launch.json.tpl b/platformio/ide/tpls/vscode/.vscode/launch.json.tpl index 409c1b98..900d1438 100644 --- a/platformio/ide/tpls/vscode/.vscode/launch.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/launch.json.tpl @@ -5,11 +5,13 @@ { "type": "gdb", "request": "launch", - "cwd": "${workspaceRoot}", + "cwd": "${workspaceFolder}", "name": "PlatformIO Debugger", "target": "{{prog_path.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", "gdbpath": "{{join(dirname(platformio_path), "piodebuggdb").replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", - "autorun": [ "source .pioinit" ] + "autorun": [ "source .pioinit" ], + "preLaunchTask": "PlatformIO: Pre-Debug", + "internalConsoleOptions": "openOnSessionStart" } ] } \ No newline at end of file diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 1de8aa5f..9789b763 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -23,7 +23,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "contrib-piohome": ">=0.6.1,<2", "contrib-pysite": ">=0.1.2,<2", - "tool-pioplus": ">=0.13.3,<2", + "tool-pioplus": ">=0.13.5,<2", "tool-unity": "~1.20302.1", "tool-scons": "~2.20501.3" } From 19d2dfdad0fb35080d1f8fe67431726c117b2c56 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 30 Jan 2018 21:34:10 +0200 Subject: [PATCH 28/98] Bump version to 3.5.2a7 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 28d771e9..7fa12f6a 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2a6") +VERSION = (3, 5, "2a7") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 00782fc624cdd9ab7ecac8e67fe86fb8dde7f706 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 30 Jan 2018 23:31:21 +0200 Subject: [PATCH 29/98] Cosmetic changes --- platformio/builder/tools/pioplatform.py | 4 ++-- platformio/builder/tools/pioupload.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index 80fb5e67..a0e19af0 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -135,9 +135,9 @@ def PrintSystemInfo(env): else: external.append(key) if onboard: - data.append("ON-BORD(%s)" % ", ".join(sorted(onboard))) + data.append("ON-BORD/%s" % ", ".join(sorted(onboard))) if external: - data.append("EXTERNAL(%s)" % ", ".join(sorted(external))) + data.append("EXTERNAL/%s" % ", ".join(sorted(external))) print "Debug: %s" % " ".join(data) diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index f82b75da..9b745dac 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -215,11 +215,14 @@ def CheckUploadSize(_, target, source, env): # pylint: disable=W0613,W0621 def PrintUploadInfo(env): configured = env.subst("$UPLOAD_PROTOCOL") + available = [] if "BOARD" in env: available = env.BoardConfig().get("upload", {}).get( "protocols", [configured]) + if available: print "Available: %s" % ", ".join(available) - print "Configured: %s" % configured + if configured: + print "Configured: upload_protocol = %s" % configured def exists(_): From c9e578f977a51851a4154f3b1b6b7e0ad1c89c53 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 31 Jan 2018 01:11:25 +0200 Subject: [PATCH 30/98] Do not show debug console by default for VSCode --- platformio/ide/tpls/vscode/.vscode/launch.json.tpl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platformio/ide/tpls/vscode/.vscode/launch.json.tpl b/platformio/ide/tpls/vscode/.vscode/launch.json.tpl index 900d1438..258020b9 100644 --- a/platformio/ide/tpls/vscode/.vscode/launch.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/launch.json.tpl @@ -10,8 +10,7 @@ "target": "{{prog_path.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", "gdbpath": "{{join(dirname(platformio_path), "piodebuggdb").replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", "autorun": [ "source .pioinit" ], - "preLaunchTask": "PlatformIO: Pre-Debug", - "internalConsoleOptions": "openOnSessionStart" + "preLaunchTask": "PlatformIO: Pre-Debug" } ] } \ No newline at end of file From 3b99dabbf4c4caf666127336ee572f3d9c21904e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 1 Feb 2018 22:20:26 +0200 Subject: [PATCH 31/98] Add example with executing of a custom script before upload action --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 86ba500a..abdd03e3 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 86ba500affa389263f4b97e6480192f3544f0041 +Subproject commit abdd03e38d681c21e1a49fb8b17ec772a0ac1625 From 17dc5f594f04a1b9600b50d5f8213f1f826763fc Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 2 Feb 2018 17:51:54 +0200 Subject: [PATCH 32/98] VSCode: Show debug console for each session --- platformio/ide/tpls/vscode/.vscode/launch.json.tpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio/ide/tpls/vscode/.vscode/launch.json.tpl b/platformio/ide/tpls/vscode/.vscode/launch.json.tpl index 258020b9..900d1438 100644 --- a/platformio/ide/tpls/vscode/.vscode/launch.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/launch.json.tpl @@ -10,7 +10,8 @@ "target": "{{prog_path.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", "gdbpath": "{{join(dirname(platformio_path), "piodebuggdb").replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", "autorun": [ "source .pioinit" ], - "preLaunchTask": "PlatformIO: Pre-Debug" + "preLaunchTask": "PlatformIO: Pre-Debug", + "internalConsoleOptions": "openOnSessionStart" } ] } \ No newline at end of file From 195444b253a5399b77d68c941a85486a57b10e31 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 3 Feb 2018 01:34:01 +0200 Subject: [PATCH 33/98] Refactor dev/platforms and frameworks docs --- docs | 2 +- platformio/exception.py | 4 +- scripts/docspregen.py | 308 +++++++++++++++++++++++++++------------- 3 files changed, 212 insertions(+), 102 deletions(-) diff --git a/docs b/docs index abdd03e3..027b612f 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit abdd03e38d681c21e1a49fb8b17ec772a0ac1625 +Subproject commit 027b612f55f36479ffe9983cdc8493d3255db7ab diff --git a/platformio/exception.py b/platformio/exception.py index 073ea4f7..1b8f3f45 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -98,8 +98,8 @@ class UndefinedPackageVersion(PlatformioException): class PackageInstallError(PlatformioException): MESSAGE = ("Could not install '{0}' with version requirements '{1}' " - "for your system '{2}'.\n" - "More details: http://bit.ly/faq-package-manager") + "for your system '{2}'.\n\n" + "Please try this solution -> http://bit.ly/faq-package-manager") class FDUnrecognizedStatusCode(PlatformioException): diff --git a/scripts/docspregen.py b/scripts/docspregen.py index 585b9ea2..7445ff13 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from math import ceil from os.path import dirname, isfile, join, realpath from sys import exit as sys_exit from sys import path @@ -36,37 +35,42 @@ def is_compat_platform_and_framework(platform, framework): return False -def generate_boards(boards, extend_debug=False): +def campaign_url(url): + if "?" in url: + url += "&" + else: + url += "?" + return url + "utm_source=platformio&utm_medium=docs" - def _round_memory_size(size): - if size == 1: - return 1 - - size = ceil(size) - for b in (64, 32, 16, 8, 4, 2, 1): - if b < size: - return int(ceil(size / b) * b) - assert NotImplemented() +def generate_boards(boards, extend_debug=False, skip_columns=None): + columns = [ + ("ID", "``{id}``"), + ("Name", "`{name} <{url}>`_"), + ("Platform", ":ref:`{platform_title} `"), + ("Debug", "{debug}"), + ("MCU", "{mcu}"), + ("Frequency", "{f_cpu:d} MHz"), + ("Flash", "{rom}"), + ("RAM", "{ram}"), + ] platforms = {m['name']: m['title'] for m in PLATFORM_MANIFESTS} - lines = [] lines.append(""" .. list-table:: :header-rows: 1 +""") - * - ID - - Name - - Platform - - Debug - - Microcontroller - - Frequency - - Flash - - RAM""") + # add header + for (name, template) in columns: + if skip_columns and name in skip_columns: + continue + prefix = " * - " if name == "ID" else " - " + lines.append(prefix + name) for data in sorted(boards, key=lambda item: item['id']): - debug = [":ref:`Yes `" if data['debug'] else ""] + debug = [":ref:`Yes `" if data['debug'] else "No"] if extend_debug and data['debug']: debug = [] for name, options in data['debug']['tools'].items(): @@ -81,28 +85,74 @@ def generate_boards(boards, extend_debug=False): else: debug.append(tool) - board_ram = float(data['ram']) / 1024 - lines.append(""" - * - ``{id}`` - - `{name} <{url}>`_ - - :ref:`{platform_title} ` - - {debug} - - {mcu} - - {f_cpu:d} MHz - - {rom} Kb - - {ram} Kb""".format( + variables = dict( id=data['id'], name=data['name'], platform=data['platform'], platform_title=platforms[data['platform']], debug=", ".join(debug), - url=data['url'], + url=campaign_url(data['url']), mcu=data['mcu'].upper(), f_cpu=int(data['fcpu']) / 1000000, - ram=int(board_ram) if board_ram % 1 == 0 else board_ram, - rom=_round_memory_size(data['rom'] / 1024))) + ram=util.format_filesize(data['ram']), + rom=util.format_filesize(data['rom'])) - return "\n".join(lines + [""]) + for (name, template) in columns: + if skip_columns and name in skip_columns: + continue + prefix = " * - " if name == "ID" else " - " + lines.append(prefix + template.format(**variables)) + + if lines: + lines.append("") + + return lines + + +def generate_debug_boards(boards, skip_columns=None): + lines = [] + onboard_debug = [ + b for b in boards if b['debug'] and any( + t.get("onboard") for (_, t) in b['debug']['tools'].items()) + ] + external_debug = [ + b for b in boards if b['debug'] and b not in onboard_debug + ] + if onboard_debug or external_debug: + lines.append(""" +Debugging +--------- + +:ref:`piodebug` - "1-click" solution for debugging with a zero configuration. + +Supported debugging tools are listed in "Debug" column. For more detailed +information, please scroll table by horizontal. +You can switch between debugging :ref:`debugging_tools` using +:ref:`projectconf_debug_tool` options. +""") + if onboard_debug: + lines.append(""" +On-Board tools +~~~~~~~~~~~~~~ + +Boards listed below have on-board debugging tools and **ARE READY** for debugging! +You do not need to use/buy external debugger. +""") + lines.extend( + generate_boards( + onboard_debug, extend_debug=True, skip_columns=skip_columns)) + if external_debug: + lines.append(""" +External tools +~~~~~~~~~~~~~~ + +Boards listed below are compatible with :ref:`piodebug` but depend on external +debugging tools. See "Debug" column for compatible debugging tools. +""") + lines.extend( + generate_boards( + external_debug, extend_debug=True, skip_columns=skip_columns)) + return lines def generate_packages(platform, packagenames, is_embedded): @@ -124,7 +174,7 @@ Packages * - `{name} <{url}>`__ - {description}""".format( name=name, - url=API_PACKAGES[name]['url'], + url=campaign_url(API_PACKAGES[name]['url']), description=API_PACKAGES[name]['description'])) if is_embedded: @@ -160,8 +210,13 @@ Packages return "\n".join(lines) -def generate_platform(name): +def generate_platform(name, has_extra=False): print "Processing platform: %s" % name + + compatible_boards = [ + board for board in BOARDS if name in board['platform'] + ] + lines = [] lines.append( @@ -188,16 +243,45 @@ def generate_platform(name): lines.append(p.description) lines.append(""" For more detailed information please visit `vendor site <%s>`_.""" % - p.vendor_url) + campaign_url(p.vendor_url)) lines.append(""" .. contents:: Contents - :local:""") + :local: + :depth: 1 +""") + + # + # Extra + # + if has_extra: + lines.append(".. include:: %s_extra.rst" % p.name) + + # + # Examples + # + lines.append(""" +Examples +-------- + +Examples are located in `%s development platform repository <%s>`_. +""" % (p.title, + campaign_url( + "https://github.com/platformio/platform-%s/tree/develop/examples" % + p.name))) + + # + # Debugging + # + if compatible_boards: + lines.extend( + generate_debug_boards( + compatible_boards, skip_columns=["Platform"])) # # Packages # - _packages_content = generate_packages(name, - p.packages.keys(), p.is_embedded()) + _packages_content = generate_packages(name, p.packages.keys(), + p.is_embedded()) if _packages_content: lines.append(_packages_content) @@ -226,16 +310,13 @@ Frameworks # # Boards # - vendors = {} - for board in BOARDS: - vendor = board['vendor'] - if name in board['platform']: - if vendor in vendors: - vendors[vendor].append(board) - else: - vendors[vendor] = [board] + if compatible_boards: + vendors = {} + for board in compatible_boards: + if board['vendor'] not in vendors: + vendors[board['vendor']] = [] + vendors[board['vendor']].append(board) - if vendors: lines.append(""" Boards ------ @@ -247,10 +328,10 @@ Boards horizontal. """) - for vendor, boards in sorted(vendors.iteritems()): - lines.append(str(vendor)) - lines.append("~" * len(vendor)) - lines.append(generate_boards(boards)) + for vendor, boards in sorted(vendors.items()): + lines.append(str(vendor)) + lines.append("~" * len(vendor)) + lines.extend(generate_boards(boards, skip_columns=["Platform"])) return "\n".join(lines) @@ -262,13 +343,24 @@ def update_platform_docs(): dirname(realpath(__file__)), "..", "docs", "platforms") rst_path = join(platforms_dir, "%s.rst" % name) with open(rst_path, "w") as f: - f.write(generate_platform(name)) - if isfile(join(platforms_dir, "%s_extra.rst" % name)): - f.write("\n.. include:: %s_extra.rst\n" % name) + f.write( + generate_platform(name, + isfile( + join(platforms_dir, + "%s_extra.rst" % name)))) -def generate_framework(type_, data): +def generate_framework(type_, data, has_extra=False): print "Processing framework: %s" % type_ + + compatible_platforms = [ + m for m in PLATFORM_MANIFESTS + if is_compat_platform_and_framework(m['name'], type_) + ] + compatible_boards = [ + board for board in BOARDS if type_ in board['frameworks'] + ] + lines = [] lines.append( @@ -294,13 +386,38 @@ def generate_framework(type_, data): lines.append(data['description']) lines.append(""" For more detailed information please visit `vendor site <%s>`_. -""" % data['url']) +""" % campaign_url(data['url'])) lines.append(""" .. contents:: Contents - :local:""") + :local: + :depth: 1""") - lines.append(""" + # Extra + if has_extra: + lines.append(".. include:: %s_extra.rst" % type_) + + # + # Debugging + # + if compatible_boards: + lines.extend(generate_debug_boards(compatible_boards)) + + if compatible_platforms: + # examples + lines.append(""" +Examples +-------- +""") + for manifest in compatible_platforms: + lines.append("* `%s for %s <%s>`_" % ( + data['title'], manifest['title'], + campaign_url( + "https://github.com/platformio/platform-%s/tree/develop/examples" + % manifest['name']))) + + # Platforms + lines.append(""" Platforms --------- .. list-table:: @@ -309,21 +426,23 @@ Platforms * - Name - Description""") - _found_platform = False - for manifest in PLATFORM_MANIFESTS: - if not is_compat_platform_and_framework(manifest['name'], type_): - continue - _found_platform = True - p = PlatformFactory.newPlatform(manifest['name']) - lines.append( - """ + for manifest in compatible_platforms: + p = PlatformFactory.newPlatform(manifest['name']) + lines.append(""" * - :ref:`platform_{type_}` - - {description}""" - .format(type_=manifest['name'], description=p.description)) - if not _found_platform: - del lines[-1] + - {description}""".format( + type_=manifest['name'], description=p.description)) - lines.append(""" + # + # Boards + # + if compatible_boards: + vendors = {} + for board in compatible_boards: + if board['vendor'] not in vendors: + vendors[board['vendor']] = [] + vendors[board['vendor']].append(board) + lines.append(""" Boards ------ @@ -332,20 +451,10 @@ Boards `PlatformIO Boards Explorer `_ * For more detailed ``board`` information please scroll tables below by horizontal. """) - - vendors = {} - for data in BOARDS: - frameworks = data['frameworks'] or [] - vendor = data['vendor'] - if type_ in frameworks: - if vendor in vendors: - vendors[vendor].append(data) - else: - vendors[vendor] = [data] - for vendor, boards in sorted(vendors.iteritems()): - lines.append(str(vendor)) - lines.append("~" * len(vendor)) - lines.append(generate_boards(boards)) + for vendor, boards in sorted(vendors.items()): + lines.append(str(vendor)) + lines.append("~" * len(vendor)) + lines.extend(generate_boards(boards)) return "\n".join(lines) @@ -356,9 +465,11 @@ def update_framework_docs(): dirname(realpath(__file__)), "..", "docs", "frameworks") rst_path = join(frameworks_dir, "%s.rst" % name) with open(rst_path, "w") as f: - f.write(generate_framework(name, framework)) - if isfile(join(frameworks_dir, "%s_extra.rst" % name)): - f.write("\n.. include:: %s_extra.rst\n" % name) + f.write( + generate_framework(name, framework, + isfile( + join(frameworks_dir, + "%s_extra.rst" % name)))) def update_create_platform_doc(): @@ -444,7 +555,7 @@ popular embedded boards and IDE. for vendor, boards in sorted(vendors.iteritems()): lines.append(str(vendor)) lines.append("~" * len(vendor)) - lines.append(generate_boards(boards)) + lines.extend(generate_boards(boards)) emboards_rst = join( dirname(realpath(__file__)), "..", "docs", "platforms", @@ -484,11 +595,10 @@ Platforms if manifest['name'] not in platforms: continue p = PlatformFactory.newPlatform(manifest['name']) - lines.append( - """ + lines.append(""" * - :ref:`platform_{type_}` - - {description}""" - .format(type_=manifest['name'], description=p.description)) + - {description}""".format( + type_=manifest['name'], description=p.description)) # Frameworks lines.append(""" @@ -517,11 +627,11 @@ Boards for vendor, boards in sorted(vendors.iteritems()): lines.append(str(vendor)) lines.append("~" * len(vendor)) - lines.append(generate_boards(boards, extend_debug=True)) + lines.extend(generate_boards(boards, extend_debug=True)) with open( - join(util.get_source_dir(), "..", "docs", "plus", - "debugging.rst"), "r+") as fp: + join(util.get_source_dir(), "..", "docs", "plus", "debugging.rst"), + "r+") as fp: content = fp.read() fp.seek(0) fp.truncate() From 718d1f2de1dfa26baa63610f078cb7792957058d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 3 Feb 2018 21:08:45 +0200 Subject: [PATCH 34/98] Use examples from development platforms --- docs | 2 +- examples | 2 +- scripts/docspregen.py | 83 ++++++++++++++++++++++++++++++++++++++----- 3 files changed, 77 insertions(+), 10 deletions(-) diff --git a/docs b/docs index 027b612f..fad3acb4 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 027b612f55f36479ffe9983cdc8493d3255db7ab +Subproject commit fad3acb40fbbe947644790e9638c75d0958a4fe9 diff --git a/examples b/examples index 2d081875..4920eec1 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 2d08187562e83b2b3d3a2d9f4d124c25f2629506 +Subproject commit 4920eec1fcfdbf04f1e17098d457dff2d0eb7a6d diff --git a/scripts/docspregen.py b/scripts/docspregen.py index 7445ff13..fa188649 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from os.path import dirname, isfile, join, realpath +import os +import urlparse +from os.path import dirname, isdir, isfile, join, realpath from sys import exit as sys_exit from sys import path @@ -35,12 +37,15 @@ def is_compat_platform_and_framework(platform, framework): return False -def campaign_url(url): - if "?" in url: - url += "&" - else: - url += "?" - return url + "utm_source=platformio&utm_medium=docs" +def campaign_url(url, source="platformio", medium="docs"): + data = urlparse.urlparse(url) + query = data.query + if query: + query += "&" + query += "utm_source=%s&utm_medium=%s" % (source, medium) + return urlparse.urlunparse( + urlparse.ParseResult(data.scheme, data.netloc, data.path, data.params, + query, data.fragment)) def generate_boards(boards, extend_debug=False, skip_columns=None): @@ -263,11 +268,19 @@ For more detailed information please visit `vendor site <%s>`_.""" % Examples -------- -Examples are located in `%s development platform repository <%s>`_. +Examples are listed from `%s development platform repository <%s>`_: """ % (p.title, campaign_url( "https://github.com/platformio/platform-%s/tree/develop/examples" % p.name))) + examples_dir = join(p.get_dir(), "examples") + if isdir(examples_dir): + for eitem in os.listdir(examples_dir): + if not isdir(join(examples_dir, eitem)): + continue + url = ("https://github.com/platformio/platform-%s" + "/tree/develop/examples/%s" % (p.name, eitem)) + lines.append("* `%s <%s>`_" % (eitem, campaign_url(url))) # # Debugging @@ -639,12 +652,66 @@ Boards "\n".join(lines)) +def update_examples_readme(): + examples_dir = join(util.get_source_dir(), "..", "examples") + + # Platforms + embedded = [] + desktop = [] + for manifest in PLATFORM_MANIFESTS: + p = PlatformFactory.newPlatform(manifest['name']) + url = campaign_url( + "http://docs.platformio.org/en/latest/platforms/%s.html#examples" % + p.name, + source="github", + medium="examples") + line = "* [%s](%s)" % (p.title, url) + if p.is_embedded(): + embedded.append(line) + else: + desktop.append(line) + + # Frameworks + frameworks = [] + for framework in API_FRAMEWORKS: + url = campaign_url( + "http://docs.platformio.org/en/latest/frameworks/%s.html#examples" + % framework['name'], + source="github", + medium="examples") + frameworks.append("* [%s](%s)" % (framework['title'], url)) + + with open(join(examples_dir, "README.md"), "w") as fp: + fp.write("""# PlatformIO Project Examples + +- [Development platforms](#development-platforms): + - [Embedded](#embedded) + - [Desktop](#desktop) +- [Frameworks](#frameworks) + +## Development platforms + +### Embedded + +%s + +### Desktop + +%s + +## Frameworks + +%s +""" % ("\n".join(embedded), "\n".join(desktop), "\n".join(frameworks))) + + def main(): update_create_platform_doc() update_platform_docs() update_framework_docs() update_embedded_boards() update_debugging() + update_examples_readme() if __name__ == "__main__": From 4360ff7463f7aa171913d7bc991ba8a637e2c306 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 3 Feb 2018 22:59:41 +0200 Subject: [PATCH 35/98] Use examples from dev/platforms for test --- examples | 2 +- scripts/install_devplatforms.py | 30 ++++++++++++++++++++++++++++ tests/test_examples.py | 35 +++++++++++++++++++++++++++------ tox.ini | 1 + 4 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 scripts/install_devplatforms.py diff --git a/examples b/examples index 4920eec1..52af061b 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 4920eec1fcfdbf04f1e17098d457dff2d0eb7a6d +Subproject commit 52af061b6a57669827bddf90a2f645ddd2a277b9 diff --git a/scripts/install_devplatforms.py b/scripts/install_devplatforms.py new file mode 100644 index 00000000..34e3e082 --- /dev/null +++ b/scripts/install_devplatforms.py @@ -0,0 +1,30 @@ +# Copyright (c) 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +import subprocess +import sys + + +def main(): + platforms = json.loads( + subprocess.check_output( + ["platformio", "platform", "search", "--json-output"])) + for platform in platforms: + subprocess.check_call( + ["platformio", "platform", "install", platform['repository']]) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tests/test_examples.py b/tests/test_examples.py index 4d2a1a52..20e9cb63 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import random from glob import glob from os import listdir, walk from os.path import dirname, getsize, isdir, isfile, join, normpath @@ -19,17 +20,32 @@ from os.path import dirname, getsize, isdir, isfile, join, normpath import pytest from platformio import util +from platformio.managers.platform import PlatformFactory, PlatformManager def pytest_generate_tests(metafunc): if "pioproject_dir" not in metafunc.fixturenames: return - example_dirs = normpath(join(dirname(__file__), "..", "examples")) - project_dirs = [] - for root, _, files in walk(example_dirs): - if "platformio.ini" not in files or ".skiptest" in files: + examples_dirs = [] + + # repo examples + examples_dirs.append(normpath(join(dirname(__file__), "..", "examples"))) + + # dev/platforms + for manifest in PlatformManager().get_installed(): + p = PlatformFactory.newPlatform(manifest['__pkg_dir']) + if not p.is_embedded(): continue - project_dirs.append(root) + examples_dir = join(p.get_dir(), "examples") + assert isdir(examples_dir) + examples_dirs.append(examples_dir) + + project_dirs = [] + for examples_dir in examples_dirs: + for root, _, files in walk(examples_dir): + if "platformio.ini" not in files or ".skiptest" in files: + continue + project_dirs.append(root) project_dirs.sort() metafunc.parametrize("pioproject_dir", project_dirs) @@ -41,7 +57,14 @@ def test_run(pioproject_dir): if isdir(build_dir): util.rmtree_(build_dir) - result = util.exec_command(["platformio", "--force", "run"]) + env_names = [] + for section in util.load_project_config().sections(): + if section.startswith("env:"): + env_names.append(section[4:]) + + result = util.exec_command( + ["platformio", "run", "-e", + random.choice(env_names)]) if result['returncode'] != 0: pytest.fail(result) diff --git a/tox.ini b/tox.ini index f1196266..6432347f 100644 --- a/tox.ini +++ b/tox.ini @@ -58,6 +58,7 @@ deps = pytest commands = {envpython} --version + {envpython} scripts/install_devplatforms.py py.test -v --basetemp="{envtmpdir}" tests [testenv:skipexamples] From 8913f1b1eace91f0c177bf107934c47c9504d01e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 3 Feb 2018 23:04:46 +0200 Subject: [PATCH 36/98] Don't install desktop dev/platforms --- scripts/install_devplatforms.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install_devplatforms.py b/scripts/install_devplatforms.py index 34e3e082..58d28bd1 100644 --- a/scripts/install_devplatforms.py +++ b/scripts/install_devplatforms.py @@ -22,6 +22,8 @@ def main(): subprocess.check_output( ["platformio", "platform", "search", "--json-output"])) for platform in platforms: + if platform['forDesktop']: + continue subprocess.check_call( ["platformio", "platform", "install", platform['repository']]) From 55b8ff7e74d808bb8953938469ca721d06fed4c2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 4 Feb 2018 00:08:28 +0200 Subject: [PATCH 37/98] Fold install dev/platform output for CI --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 6432347f..26327fd7 100644 --- a/tox.ini +++ b/tox.ini @@ -58,7 +58,9 @@ deps = pytest commands = {envpython} --version + {envpython} -c "print 'travis_fold:start:install_devplatforms'" {envpython} scripts/install_devplatforms.py + {envpython} -c "print 'travis_fold:end:install_devplatforms'" py.test -v --basetemp="{envtmpdir}" tests [testenv:skipexamples] From c5af85f123aa3056b1d7d9190581b6754ec4eb59 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 4 Feb 2018 01:04:53 +0200 Subject: [PATCH 38/98] Fix issue with multiple OneWire libs and infinite pause --- tests/commands/test_lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/commands/test_lib.py b/tests/commands/test_lib.py index 8513d401..a4c31bce 100644 --- a/tests/commands/test_lib.py +++ b/tests/commands/test_lib.py @@ -253,7 +253,7 @@ def test_lib_show(clirunner, validate_cliresult): validate_cliresult(result) assert all( [s in result.output for s in ("ArduinoJson", "Arduino", "Atmel AVR")]) - result = clirunner.invoke(cmd_lib, ["show", "OneWire"]) + result = clirunner.invoke(cmd_lib, ["show", "OneWire", "--json-output"]) validate_cliresult(result) assert "OneWire" in result.output From aa57924488b2ede1982f307c5acef36de216fe92 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 4 Feb 2018 01:46:57 +0200 Subject: [PATCH 39/98] Fix command:ci test --- tests/commands/test_ci.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/commands/test_ci.py b/tests/commands/test_ci.py index 2ab76544..ec4077ba 100644 --- a/tests/commands/test_ci.py +++ b/tests/commands/test_ci.py @@ -15,6 +15,7 @@ from os.path import join from platformio.commands.ci import cli as cmd_ci +from platformio.commands.lib import cli as cmd_lib def test_ci_empty(clirunner): @@ -25,27 +26,31 @@ def test_ci_empty(clirunner): def test_ci_boards(clirunner, validate_cliresult): result = clirunner.invoke(cmd_ci, [ - join("examples", "atmelavr", "arduino-internal-libs", "src", - "ChatServer.ino"), "-b", "uno", "-b", "leonardo" + join("examples", "wiring-blink", "src", "main.cpp"), "-b", "uno", "-b", + "leonardo" ]) validate_cliresult(result) def test_ci_project_conf(clirunner, validate_cliresult): - project_dir = join("examples", "atmelavr", "arduino-internal-libs") + project_dir = join("examples", "wiring-blink") result = clirunner.invoke(cmd_ci, [ - join(project_dir, "src", "ChatServer.ino"), "--project-conf", + join(project_dir, "src", "main.cpp"), "--project-conf", join(project_dir, "platformio.ini") ]) validate_cliresult(result) - assert all([s in result.output for s in ("ethernet", "leonardo", "yun")]) + assert "uno" in result.output -def test_ci_lib_and_board(clirunner, validate_cliresult): - example_dir = join("examples", "atmelavr", "arduino-external-libs") +def test_ci_lib_and_board(clirunner, tmpdir_factory, validate_cliresult): + storage_dir = str(tmpdir_factory.mktemp("lib")) + result = clirunner.invoke( + cmd_lib, ["--storage-dir", storage_dir, "install", "1@2.3.2"]) + validate_cliresult(result) + result = clirunner.invoke(cmd_ci, [ - join(example_dir, "lib", "OneWire", "examples", "DS2408_Switch", + join(storage_dir, "OneWire_ID1", "examples", "DS2408_Switch", "DS2408_Switch.pde"), "-l", - join(example_dir, "lib", "OneWire"), "-b", "uno" + join(storage_dir, "OneWire_ID1"), "-b", "uno" ]) validate_cliresult(result) From f358a4ff57990a85276c9f8580639cd1079a046e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 5 Feb 2018 12:25:24 +0200 Subject: [PATCH 40/98] Ignore unit-testing/calculator from CI test --- examples | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples b/examples index 52af061b..ba8888f5 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 52af061b6a57669827bddf90a2f645ddd2a277b9 +Subproject commit ba8888f5747cf59d80eb6ed7660755c6db82d332 From 33a05fa7ca79f388591c8d8517d0333933eb870e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 5 Feb 2018 13:16:12 +0200 Subject: [PATCH 41/98] Update README --- README.rst | 117 +++++++++++++++++++++++++++-------------------------- 1 file changed, 60 insertions(+), 57 deletions(-) diff --git a/README.rst b/README.rst index 82898d08..5dd3a18b 100644 --- a/README.rst +++ b/README.rst @@ -18,101 +18,104 @@ PlatformIO :alt: License .. image:: https://img.shields.io/PlatformIO/Community.png :alt: Community Forums - :target: https://community.platformio.org + :target: https://community.platformio.org?utm_source=github&utm_medium=core .. image:: https://img.shields.io/PlatformIO/Plus.png?color=orange :alt: PlatformIO Plus: Professional solutions for an awesome open source PlatformIO ecosystem - :target: https://pioplus.com + :target: http://platformio.org/pricing?utm_source=github&utm_medium=core -**Quick Links:** `Home Page `_ | -`PlatformIO Plus `_ | -`PlatformIO IDE `_ | +**Quick Links:** `Home Page `_ | +`PlatformIO Plus `_ | +`PlatformIO IDE `_ | `Project Examples `_ | -`Docs `_ | -`Donate `_ | -`Contact Us `_ +`Docs `_ | +`Donate `_ | +`Contact Us `_ **Social:** `Twitter `_ | `Facebook `_ | `Hackaday `_ | `Bintray `_ | -`Community `_ +`Community `_ .. image:: https://raw.githubusercontent.com/platformio/platformio-web/develop/app/images/platformio-ide-laptop.png - :target: http://platformio.org + :target: http://platformio.org?utm_source=github&utm_medium=core -`PlatformIO `_ is an open source ecosystem for IoT +`PlatformIO `_ is an open source ecosystem for IoT development. Cross-platform IDE and unified debugger. Remote unit testing and firmware updates. Get Started ----------- -* `What is PlatformIO? `_ +* `What is PlatformIO? `_ Products -------- -* `PlatformIO IDE `_ -* `PlatformIO Core `_ -* `PIO Remote™ `_ -* `PIO Unified Debugger `_ -* `PIO Unit Testing `_ -* `PIO Delivery™ `_ -* `Cloud Builder `_ +* `PlatformIO IDE `_ +* `PlatformIO Core (CLI) `_ +* `PIO Remote™ `_ +* `PIO Unified Debugger `_ +* `PIO Unit Testing `_ +* `PIO Delivery™ `_ +* `Cloud Builder `_ Registry -------- -* `Libraries `_ -* `Development Platforms `_ -* `Frameworks `_ -* `Embedded Boards `_ +* `Libraries `_ +* `Development Platforms `_ +* `Frameworks `_ +* `Embedded Boards `_ Solutions --------- -* `Library Manager `_ -* `Cloud IDEs Integration `_ -* `Standalone IDEs Integration `_ -* `Continuous Integration `_ +* `Library Manager `_ +* `Cloud IDEs Integration `_ +* `Standalone IDEs Integration `_ +* `Continuous Integration `_ Development Platforms --------------------- -* `Atmel AVR `_ -* `Atmel SAM `_ -* `Espressif 32 `_ -* `Espressif 8266 `_ -* `Freescale Kinetis `_ -* `Intel ARC32 `_ -* `Lattice iCE40 `_ -* `Maxim 32 `_ -* `Microchip PIC32 `_ -* `Nordic nRF51 `_ -* `Nordic nRF52 `_ -* `NXP LPC `_ -* `Silicon Labs EFM32 `_ -* `ST STM32 `_ -* `Teensy `_ -* `TI MSP430 `_ -* `TI Tiva `_ -* `WIZNet W7500 `_ +* `Atmel AVR `_ +* `Atmel SAM `_ +* `Espressif 32 `_ +* `Espressif 8266 `_ +* `Freescale Kinetis `_ +* `Intel ARC32 `_ +* `Lattice iCE40 `_ +* `Maxim 32 `_ +* `Microchip PIC32 `_ +* `Nordic nRF51 `_ +* `Nordic nRF52 `_ +* `NXP LPC `_ +* `Silicon Labs EFM32 `_ +* `ST STM32 `_ +* `Teensy `_ +* `TI MSP430 `_ +* `TI Tiva `_ +* `WIZNet W7500 `_ Frameworks ---------- -* `Arduino `_ -* `ARTIK SDK `_ -* `CMSIS `_ -* `Energia `_ -* `ESP-IDF `_ -* `libOpenCM3 `_ -* `mbed `_ -* `Pumbaa `_ -* `Simba `_ -* `SPL `_ -* `STM32Cube `_ -* `WiringPi `_ +* `Arduino `_ +* `ARTIK SDK `_ +* `CMSIS `_ +* `Energia `_ +* `ESP-IDF `_ +* `ESP8266 Non-OS SDK `_ +* `ESP8266 RTOS SDK `_ +* `libOpenCM3 `_ +* `mbed `_ +* `Pumbaa `_ +* `Simba `_ +* `SPL `_ +* `STM32Cube `_ +* `Tizen RT `_ +* `WiringPi `_ Contributing ------------ From 20641bb4ff8fb6e5d4b911600dc7c3e48355b711 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 5 Feb 2018 17:30:44 +0200 Subject: [PATCH 42/98] Sync docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index fad3acb4..05232239 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit fad3acb40fbbe947644790e9638c75d0958a4fe9 +Subproject commit 05232239555835cb4c5a82a943df740daf3382cc From 53afdc5e02661eeed4ecda0a4a4c630327239c48 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 5 Feb 2018 21:44:37 +0200 Subject: [PATCH 43/98] Fix project generator for Qt Creator IDE // Resolve #1303 Resolve #1323 --- HISTORY.rst | 3 +++ platformio/ide/tpls/qtcreator/platformio.pro.tpl | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 86130c76..1bab1b2e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -14,6 +14,9 @@ PlatformIO 3.0 * Show all available upload protocols before firmware uploading in a build log * Handle "os.mbed.com" URL as a Mercurial (hg) repository * Improved support for old mbed libraries without manifest +* Fixed project generator for Qt Creator IDE + (`issue #1303 `_, + `issue #1323 `_) * Fixed issue with duplicated "include" records when generating data for IDE (`issue #1301 `_) diff --git a/platformio/ide/tpls/qtcreator/platformio.pro.tpl b/platformio/ide/tpls/qtcreator/platformio.pro.tpl index 1ef5f8eb..19abc468 100644 --- a/platformio/ide/tpls/qtcreator/platformio.pro.tpl +++ b/platformio/ide/tpls/qtcreator/platformio.pro.tpl @@ -14,7 +14,8 @@ INCLUDEPATH += "{{include}}" % end % for define in defines: -DEFINES += {{!define}} +% tokens = define.split("##", 1) +DEFINES += "{{tokens[0].strip()}}" % end OTHER_FILES += platformio.ini From e5543b2aee5359dff29b432b38c9ade0e82ae91e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 6 Feb 2018 00:36:52 +0200 Subject: [PATCH 44/98] Fix broken RST --- HISTORY.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 1bab1b2e..958cc687 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -16,7 +16,7 @@ PlatformIO 3.0 * Improved support for old mbed libraries without manifest * Fixed project generator for Qt Creator IDE (`issue #1303 `_, - `issue #1323 `_) + `issue #1323 `_) * Fixed issue with duplicated "include" records when generating data for IDE (`issue #1301 `_) From 1362630ed64d7812b69609ac176788a8a11de340 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 6 Feb 2018 01:54:34 +0200 Subject: [PATCH 45/98] Raise an error when invalid environment name was set for `env_default` option --- platformio/commands/run.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 5bc7187b..f5f00670 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -71,14 +71,14 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, fg="yellow") config = util.load_project_config() - check_project_defopts(config) - assert check_project_envs(config, environment) - env_default = None if config.has_option("platformio", "env_default"): env_default = util.parse_conf_multi_values( config.get("platformio", "env_default")) + check_project_defopts(config) + check_project_envs(config, environment or env_default) + results = [] start_time = time() for section in config.sections(): From e7e80ff15299d7683b5f6c0fd96fb60bd721ce96 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 6 Feb 2018 11:25:38 +0200 Subject: [PATCH 46/98] Fix issue when no environment is specified --- platformio/commands/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index f5f00670..cf6f7ae7 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -77,7 +77,7 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, config.get("platformio", "env_default")) check_project_defopts(config) - check_project_envs(config, environment or env_default) + check_project_envs(config, environment or env_default or []) results = [] start_time = time() From d428d18fae0ee91bec13c6df88da5dffdd2de328 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 6 Feb 2018 11:26:26 +0200 Subject: [PATCH 47/98] Bump version to 3.5.2a8 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 7fa12f6a..d583cd77 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2a7") +VERSION = (3, 5, "2a8") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 31edb2a570016318c480676b480cfe7b147f384f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 6 Feb 2018 11:27:44 +0200 Subject: [PATCH 48/98] Minor fix --- platformio/commands/run.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index cf6f7ae7..f2b12c4c 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -77,7 +77,7 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, config.get("platformio", "env_default")) check_project_defopts(config) - check_project_envs(config, environment or env_default or []) + check_project_envs(config, environment or env_default) results = [] start_time = time() @@ -392,12 +392,12 @@ def check_project_defopts(config): return False -def check_project_envs(config, environments): +def check_project_envs(config, environments=None): if not config.sections(): raise exception.ProjectEnvsNotAvailable() known = set([s[4:] for s in config.sections() if s.startswith("env:")]) - unknown = set(environments) - known + unknown = set(environments or []) - known if unknown: raise exception.UnknownEnvNames(", ".join(unknown), ", ".join(known)) return True From 904c5464c3d86b87260384fd2a14e2264f9c8168 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Feb 2018 15:28:34 +0200 Subject: [PATCH 49/98] Add user libraries before built-in (frameworks, toolchains) --- platformio/builder/tools/platformio.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 4becee3e..0e96cbc4 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -65,8 +65,8 @@ def BuildProgram(env): # restore PIO macros if it was deleted by framework _append_pio_macros() - # build dependent libs - env.Append(LIBS=env.BuildProjectLibraries()) + # build dependent libs; place them before built-in libs + env.Prepend(LIBS=env.BuildProjectLibraries()) # append specified LD_SCRIPT if ("LDSCRIPT_PATH" in env From f7023aa8fff2d97d2ba1e181c8f3665a2463d2e2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Feb 2018 19:44:02 +0200 Subject: [PATCH 50/98] Print platform information while processing environment --- docs | 2 +- platformio/builder/tools/pioplatform.py | 23 ++++++++++++++--------- platformio/builder/tools/platformio.py | 2 +- platformio/util.py | 4 ++-- scripts/docspregen.py | 2 +- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/docs b/docs index 05232239..b32cd4a5 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 05232239555835cb4c5a82a943df740daf3382cc +Subproject commit b32cd4a5f86d783276fc272f17fcd70d196ad9fa diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index a0e19af0..cebdc116 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -98,29 +98,34 @@ def LoadPioPlatform(env, variables): env.Replace(LDSCRIPT_PATH=board_config.get("build.ldscript")) -def PrintSystemInfo(env): - data = [] - debug_tools = None +def PrintConfiguration(env): # pylint: disable=too-many-branches + platform_data = ["Platform: %s ::" % env.PioPlatform().title] + system_data = ["System:"] mcu = env.subst("$BOARD_MCU") f_cpu = env.subst("$BOARD_F_CPU") if mcu: - data.append(mcu.upper()) + system_data.append(mcu.upper()) if f_cpu: f_cpu = int("".join([c for c in str(f_cpu) if c.isdigit()])) - data.append("%dMHz" % (f_cpu / 1000000)) + system_data.append("%dMHz" % (f_cpu / 1000000)) + debug_tools = None if "BOARD" in env: board_config = env.BoardConfig() + platform_data.append(board_config.get("name")) + debug_tools = board_config.get("debug", {}).get("tools") ram = board_config.get("upload", {}).get("maximum_ram_size") flash = board_config.get("upload", {}).get("maximum_size") for (key, value) in (("RAM", ram), ("Flash", flash)): if not value: continue - data.append("%s/%s" % (key, util.format_filesize(value))) + system_data.append("%s/%s" % (key, util.format_filesize(value))) - if data: - print "System: %s" % " ".join(data) + if platform_data: + print " ".join(platform_data) + if system_data: + print " ".join(system_data) # Debugging if not debug_tools: @@ -151,5 +156,5 @@ def generate(env): env.AddMethod(BoardConfig) env.AddMethod(GetFrameworkScript) env.AddMethod(LoadPioPlatform) - env.AddMethod(PrintSystemInfo) + env.AddMethod(PrintConfiguration) return env diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 0e96cbc4..61f91981 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -42,7 +42,7 @@ def BuildProgram(env): _append_pio_macros() - env.PrintSystemInfo() + env.PrintConfiguration() # fix ASM handling under non case-sensitive OS if not case_sensitive_suffixes(".s", ".S"): diff --git a/platformio/util.py b/platformio/util.py index 526d69e7..c569f04a 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -755,9 +755,9 @@ def format_filesize(filesize): if filesize >= unit: continue if filesize % (base**(i + 1)): - return "%.2f%s" % ((base * filesize / unit), suffix) + return "%.2f%sB" % ((base * filesize / unit), suffix) break - return "%d%s" % ((base * filesize / unit), suffix) + return "%d%sB" % ((base * filesize / unit), suffix) def rmtree_(path): diff --git a/scripts/docspregen.py b/scripts/docspregen.py index fa188649..4384eee6 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -55,7 +55,7 @@ def generate_boards(boards, extend_debug=False, skip_columns=None): ("Platform", ":ref:`{platform_title} `"), ("Debug", "{debug}"), ("MCU", "{mcu}"), - ("Frequency", "{f_cpu:d} MHz"), + ("Frequency", "{f_cpu:d}MHz"), ("Flash", "{rom}"), ("RAM", "{ram}"), ] From aac0b2992912f5df22b8fa0bcd77e2e2fec45364 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 9 Feb 2018 01:23:02 +0200 Subject: [PATCH 51/98] Dump only "platform, board and framework" by default when processing environment --- platformio/builder/tools/pioplatform.py | 2 +- platformio/builder/tools/pioupload.py | 8 ++++---- platformio/commands/run.py | 12 +++++++----- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index cebdc116..38da971e 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -99,7 +99,7 @@ def LoadPioPlatform(env, variables): def PrintConfiguration(env): # pylint: disable=too-many-branches - platform_data = ["Platform: %s ::" % env.PioPlatform().title] + platform_data = ["Platform: %s >" % env.PioPlatform().title] system_data = ["System:"] mcu = env.subst("$BOARD_MCU") f_cpu = env.subst("$BOARD_F_CPU") diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 9b745dac..ff7af319 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -215,12 +215,12 @@ def CheckUploadSize(_, target, source, env): # pylint: disable=W0613,W0621 def PrintUploadInfo(env): configured = env.subst("$UPLOAD_PROTOCOL") - available = [] + available = [configured] if configured else [] if "BOARD" in env: - available = env.BoardConfig().get("upload", {}).get( - "protocols", [configured]) + available.extend(env.BoardConfig().get("upload", {}).get( + "protocols", [])) if available: - print "Available: %s" % ", ".join(available) + print "Available: %s" % ", ".join(sorted(available)) if configured: print "Configured: upload_protocol = %s" % configured diff --git a/platformio/commands/run.py b/platformio/commands/run.py index f2b12c4c..fb185e8b 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -124,6 +124,8 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, class EnvironmentProcessor(object): + DEFAULT_DUMP_OPTIONS = ("platform", "framework", "board") + KNOWN_OPTIONS = ("platform", "framework", "board", "board_mcu", "board_f_cpu", "board_f_flash", "board_flash_mode", "build_flags", "src_build_flags", "build_unflags", @@ -176,19 +178,19 @@ class EnvironmentProcessor(object): def process(self): terminal_width, _ = click.get_terminal_size() start_time = time() + env_dump = [] for k, v in self.options.items(): self.options[k] = self.options[k].strip() + if self.verbose or k in self.DEFAULT_DUMP_OPTIONS: + env_dump.append( + "%s: %s" % (k, ", ".join(util.parse_conf_multi_values(v)))) if not self.silent: click.echo("[%s] Processing %s (%s)" % (datetime.now().strftime("%c"), click.style(self.name, fg="cyan", bold=True), - "; ".join([ - "%s: %s" % - (k, ", ".join(util.parse_conf_multi_values(v))) - for k, v in self.options.items() - ]))) + "; ".join(env_dump))) click.secho("-" * terminal_width, bold=True) self.options = self._validate_options(self.options) From 46cca359e75912c7342cefd8696acab8272cf526 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 9 Feb 2018 01:30:35 +0200 Subject: [PATCH 52/98] Bump version to 3.5.2b1 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index d583cd77..c4d3f283 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2a8") +VERSION = (3, 5, "2b1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From cc08bb0fd0feafefbd598efad5f02613e949d44f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 9 Feb 2018 14:31:22 +0200 Subject: [PATCH 53/98] Document how to switch between stable release and upstream dev/platform --- docs | 2 +- scripts/docspregen.py | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs b/docs index b32cd4a5..2d67adb9 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit b32cd4a5f86d783276fc272f17fcd70d196ad9fa +Subproject commit 2d67adb9edcbdceef5ed78b31896030f07e5e534 diff --git a/scripts/docspregen.py b/scripts/docspregen.py index 4384eee6..51b2ff48 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -290,6 +290,32 @@ Examples are listed from `%s development platform repository <%s>`_: generate_debug_boards( compatible_boards, skip_columns=["Platform"])) + # + # Development version of dev/platform + # + lines.append(""" +Stable and upstream versions +---------------------------- + +You can switch between `stable releases `__ +of {title} development platform and the latest upstream version using +:ref:`projectconf_env_platform` option as described below: + +.. code-block:: ini + + ; Custom stable version + [env:stable] + platform ={name}@x.y.z + board = ... + ... + + ; The latest upstream/development version + [env:upstream] + platform = https://github.com/platformio/platform-{name}.git + board = ... + ... +""".format(name=p.name, title=p.title)) + # # Packages # From 231bd8b2947fa2c9986b4a520c68dae8c3982a22 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 9 Feb 2018 21:47:59 +0200 Subject: [PATCH 54/98] Implement autodetecting of default debug tool --- platformio/builder/main.py | 6 ++++- platformio/builder/tools/piolib.py | 6 ++--- platformio/builder/tools/pioplatform.py | 11 ++++++---- platformio/builder/tools/pioupload.py | 4 ++-- platformio/commands/run.py | 11 +++++----- platformio/exception.py | 12 ++++++++++ platformio/managers/platform.py | 29 +++++++++++++++++++++++++ 7 files changed, 63 insertions(+), 16 deletions(-) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 3ae92943..04a19eba 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -64,7 +64,11 @@ commonvars.AddVariables( ("UPLOAD_PROTOCOL",), ("UPLOAD_SPEED",), ("UPLOAD_FLAGS",), - ("UPLOAD_RESETMETHOD",) + ("UPLOAD_RESETMETHOD",), + + # debug options + ("DEBUG_TOOL",), + ) # yapf: disable diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index bc08f4f1..bfaa447e 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -832,9 +832,9 @@ def BuildProjectLibraries(env): project.env = env ldf_mode = LibBuilderBase.lib_ldf_mode.fget(project) - print "Library Dependency Finder -> http://bit.ly/configure-pio-ldf" - print "Modes: Finder/%s Compatibility/%s" % (ldf_mode, - project.lib_compat_mode) + print "Library Dependency Finder (LDF) -> http://bit.ly/configure-pio-ldf" + print "LDF MODES: FINDER/%s COMPATIBILITY/%s" % (ldf_mode, + project.lib_compat_mode) lib_builders = env.GetLibBuilders() print "Collected %d compatible libraries" % len(lib_builders) diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index 38da971e..c668eaef 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -99,8 +99,8 @@ def LoadPioPlatform(env, variables): def PrintConfiguration(env): # pylint: disable=too-many-branches - platform_data = ["Platform: %s >" % env.PioPlatform().title] - system_data = ["System:"] + platform_data = ["PLATFORM: %s >" % env.PioPlatform().title] + system_data = ["SYSTEM:"] mcu = env.subst("$BOARD_MCU") f_cpu = env.subst("$BOARD_F_CPU") if mcu: @@ -131,7 +131,10 @@ def PrintConfiguration(env): # pylint: disable=too-many-branches if not debug_tools: return - data = [] + data = [ + "CURRENT/%s" % board_config.get_debug_tool_name( + env.subst("$DEBUG_TOOL")) + ] onboard = [] external = [] for key, value in debug_tools.items(): @@ -144,7 +147,7 @@ def PrintConfiguration(env): # pylint: disable=too-many-branches if external: data.append("EXTERNAL/%s" % ", ".join(sorted(external))) - print "Debug: %s" % " ".join(data) + print "DEBUG: %s" % " ".join(data) def exists(_): diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index ff7af319..7afa8587 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -220,9 +220,9 @@ def PrintUploadInfo(env): available.extend(env.BoardConfig().get("upload", {}).get( "protocols", [])) if available: - print "Available: %s" % ", ".join(sorted(available)) + print "AVAILABLE: %s" % ", ".join(sorted(available)) if configured: - print "Configured: upload_protocol = %s" % configured + print "CURRENT: upload_protocol = %s" % configured def exists(_): diff --git a/platformio/commands/run.py b/platformio/commands/run.py index fb185e8b..14db42a7 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -141,12 +141,11 @@ class EnvironmentProcessor(object): "monitor_dtr") IGNORE_BUILD_OPTIONS = ("test_transport", "test_filter", "test_ignore", - "test_port", "test_speed", "debug_tool", - "debug_port", "debug_init_cmds", - "debug_extra_cmds", "debug_server", - "debug_init_break", "debug_load_cmd", - "monitor_port", "monitor_baud", "monitor_rts", - "monitor_dtr") + "test_port", "test_speed", "debug_port", + "debug_init_cmds", "debug_extra_cmds", + "debug_server", "debug_init_break", + "debug_load_cmd", "monitor_port", "monitor_baud", + "monitor_rts", "monitor_dtr") REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"} diff --git a/platformio/exception.py b/platformio/exception.py index 1b8f3f45..afedf5a9 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -238,3 +238,15 @@ class CygwinEnvDetected(PlatformioException): MESSAGE = ("PlatformIO does not work within Cygwin environment. " "Use native Terminal instead.") + + +class DebugSupportError(PlatformioException): + + MESSAGE = ("Currently, PlatformIO does not support debugging for `{0}`.\n" + "Please mail contact@pioplus.com or visit " + "< http://docs.platformio.org/page/plus/debugging.html >") + + +class DebugInvalidOptions(PlatformioException): + + pass diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index 1485059f..53fec46f 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -715,3 +715,32 @@ class PlatformBoardConfig(object): if key in ("default", "onboard"): tools[name][key] = value return {"tools": tools} + + def get_debug_tool_name(self, custom=None): + debug_tools = self._manifest.get("debug", {}).get("tools") + tool_name = custom + if tool_name == "custom": + return tool_name + if not debug_tools: + raise exception.DebugSupportError(self._manifest['name']) + if tool_name: + if tool_name in debug_tools: + return tool_name + raise exception.DebugInvalidOptions( + "Unknown debug tool `%s`. Please use one of `%s` or `custom`" % + (tool_name, ", ".join(sorted(debug_tools.keys())))) + + # automatically select best tool + default = [] + onboard = [] + external = [] + for key, value in debug_tools.items(): + if value.get("default"): + default.append(key) + elif value.get("onboard"): + onboard.append(key) + external.append(key) + + assert default or onboard or external + return (default[0] if default else onboard[0] + if onboard else external[0]) From 8736e7bfb000450a94c2c153e415f1aa8e285c07 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 10 Feb 2018 17:00:45 +0200 Subject: [PATCH 55/98] Bump version to 3.5.2b2 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index c4d3f283..6fec4c34 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2b1") +VERSION = (3, 5, "2b2") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From b553b8f9dfa57c3cdbd75e10dc8be95e0777cb57 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 10 Feb 2018 18:09:23 +0200 Subject: [PATCH 56/98] Sort debug tools by name --- platformio/managers/platform.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index 53fec46f..ea238e61 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -731,16 +731,18 @@ class PlatformBoardConfig(object): (tool_name, ", ".join(sorted(debug_tools.keys())))) # automatically select best tool - default = [] - onboard = [] - external = [] + data = {"default": [], "onboard": [], "external": []} for key, value in debug_tools.items(): if value.get("default"): - default.append(key) + data['default'].append(key) elif value.get("onboard"): - onboard.append(key) - external.append(key) + data['onboard'].append(key) + data['external'].append(key) - assert default or onboard or external - return (default[0] if default else onboard[0] - if onboard else external[0]) + for key, value in data.items(): + print key + if not value: + continue + return sorted(value)[0] + + assert any(item for item in data) From 06cce20707040b63b94d438ad01204ff7bdf1034 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 12 Feb 2018 17:27:20 +0200 Subject: [PATCH 57/98] Minor formatting to the system info --- platformio/builder/tools/piolib.py | 6 +++--- platformio/builder/tools/pioplatform.py | 12 +++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index bfaa447e..44988375 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -832,9 +832,9 @@ def BuildProjectLibraries(env): project.env = env ldf_mode = LibBuilderBase.lib_ldf_mode.fget(project) - print "Library Dependency Finder (LDF) -> http://bit.ly/configure-pio-ldf" - print "LDF MODES: FINDER/%s COMPATIBILITY/%s" % (ldf_mode, - project.lib_compat_mode) + print "Library Dependency Finder -> http://bit.ly/configure-pio-ldf" + print "LDF MODES: FINDER(%s) COMPATIBILITY(%s)" % (ldf_mode, + project.lib_compat_mode) lib_builders = env.GetLibBuilders() print "Collected %d compatible libraries" % len(lib_builders) diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index c668eaef..e2735b01 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -117,10 +117,8 @@ def PrintConfiguration(env): # pylint: disable=too-many-branches debug_tools = board_config.get("debug", {}).get("tools") ram = board_config.get("upload", {}).get("maximum_ram_size") flash = board_config.get("upload", {}).get("maximum_size") - for (key, value) in (("RAM", ram), ("Flash", flash)): - if not value: - continue - system_data.append("%s/%s" % (key, util.format_filesize(value))) + system_data.append("%s (%s Flash)" % (util.format_filesize(ram), + util.format_filesize(flash))) if platform_data: print " ".join(platform_data) @@ -132,7 +130,7 @@ def PrintConfiguration(env): # pylint: disable=too-many-branches return data = [ - "CURRENT/%s" % board_config.get_debug_tool_name( + "CURRENT(%s)" % board_config.get_debug_tool_name( env.subst("$DEBUG_TOOL")) ] onboard = [] @@ -143,9 +141,9 @@ def PrintConfiguration(env): # pylint: disable=too-many-branches else: external.append(key) if onboard: - data.append("ON-BORD/%s" % ", ".join(sorted(onboard))) + data.append("ON-BORD(%s)" % ", ".join(sorted(onboard))) if external: - data.append("EXTERNAL/%s" % ", ".join(sorted(external))) + data.append("EXTERNAL(%s)" % ", ".join(sorted(external))) print "DEBUG: %s" % " ".join(data) From d7f7418812f3bafa17cc40f059156d7748b6e4a1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 12 Feb 2018 18:31:31 +0200 Subject: [PATCH 58/98] Sync docs with hardware changes --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 2d67adb9..13e45395 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 2d67adb9edcbdceef5ed78b31896030f07e5e534 +Subproject commit 13e45395093b14ef9272c177becc6743e898d6ab From 0763a54af353e612419663f71e5697659f975f22 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 12 Feb 2018 19:32:02 +0200 Subject: [PATCH 59/98] Add Atmel-ICE debugging tool --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 13e45395..4c827a75 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 13e45395093b14ef9272c177becc6743e898d6ab +Subproject commit 4c827a754480d5f3d97db78c628d17925651afd1 From acefc8d2766b9fa9ffe3cfd915119d38ca37925c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Feb 2018 00:19:07 +0200 Subject: [PATCH 60/98] Remove debug code --- platformio/managers/platform.py | 1 - 1 file changed, 1 deletion(-) diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index ea238e61..fb2c2f93 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -740,7 +740,6 @@ class PlatformBoardConfig(object): data['external'].append(key) for key, value in data.items(): - print key if not value: continue return sorted(value)[0] From 591e876660a48699c2617a69abdc8378b79e77a1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Feb 2018 01:34:24 +0200 Subject: [PATCH 61/98] Move http://platformio.org to https://platformio.org --- HISTORY.rst | 8 +-- README.rst | 98 ++++++++++++++++---------------- docs | 2 +- examples | 2 +- platformio/__init__.py | 2 +- platformio/commands/lib.py | 4 +- platformio/commands/platform.py | 2 +- platformio/maintenance.py | 2 +- platformio/managers/lib.py | 2 +- platformio/managers/platform.py | 4 +- scripts/99-platformio-udev.rules | 2 +- scripts/docspregen.py | 6 +- tests/commands/test_lib.py | 2 +- 13 files changed, 68 insertions(+), 68 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 958cc687..eb4bda94 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -508,7 +508,7 @@ PlatformIO 2.0 * Added support for `emonPi `__, the OpenEnergyMonitor system (`issue #687 `_) -* Added support for `SPL `__ +* Added support for `SPL `__ framework for STM32F0 boards (`issue #683 `_) * Added support for `Arduboy DevKit `__, the game system @@ -1199,7 +1199,7 @@ PlatformIO 1.0 1.5.0 (2015-05-15) ~~~~~~~~~~~~~~~~~~ -* Added support of `Framework mbed `_ +* Added support of `Framework mbed `_ for Teensy 3.1 (`issue #183 `_) * Added GDB as alternative uploader to `ststm32 `__ platform @@ -1284,9 +1284,9 @@ PlatformIO 1.0 `ststm32 `__ development platform * Created new `Frameworks `__ - page in documentation and added to `PlatformIO Web Site `_ + page in documentation and added to `PlatformIO Web Site `_ (`issue #115 `_) -* Introduced online `Embedded Boards Explorer `_ +* Introduced online `Embedded Boards Explorer `_ * Automatically append define ``-DPLATFORMIO=%version%`` to builder (`issue #105 `_) * Renamed ``stm32`` development platform to diff --git a/README.rst b/README.rst index 5dd3a18b..bfb2ebf9 100644 --- a/README.rst +++ b/README.rst @@ -21,15 +21,15 @@ PlatformIO :target: https://community.platformio.org?utm_source=github&utm_medium=core .. image:: https://img.shields.io/PlatformIO/Plus.png?color=orange :alt: PlatformIO Plus: Professional solutions for an awesome open source PlatformIO ecosystem - :target: http://platformio.org/pricing?utm_source=github&utm_medium=core + :target: https://platformio.org/pricing?utm_source=github&utm_medium=core -**Quick Links:** `Home Page `_ | -`PlatformIO Plus `_ | -`PlatformIO IDE `_ | +**Quick Links:** `Home Page `_ | +`PlatformIO Plus `_ | +`PlatformIO IDE `_ | `Project Examples `_ | `Docs `_ | -`Donate `_ | -`Contact Us `_ +`Donate `_ | +`Contact Us `_ **Social:** `Twitter `_ | `Facebook `_ | @@ -38,9 +38,9 @@ PlatformIO `Community `_ .. image:: https://raw.githubusercontent.com/platformio/platformio-web/develop/app/images/platformio-ide-laptop.png - :target: http://platformio.org?utm_source=github&utm_medium=core + :target: https://platformio.org?utm_source=github&utm_medium=core -`PlatformIO `_ is an open source ecosystem for IoT +`PlatformIO `_ is an open source ecosystem for IoT development. Cross-platform IDE and unified debugger. Remote unit testing and firmware updates. @@ -52,70 +52,70 @@ Get Started Products -------- -* `PlatformIO IDE `_ +* `PlatformIO IDE `_ * `PlatformIO Core (CLI) `_ * `PIO Remote™ `_ * `PIO Unified Debugger `_ * `PIO Unit Testing `_ -* `PIO Delivery™ `_ -* `Cloud Builder `_ +* `PIO Delivery™ `_ +* `Cloud Builder `_ Registry -------- -* `Libraries `_ -* `Development Platforms `_ -* `Frameworks `_ -* `Embedded Boards `_ +* `Libraries `_ +* `Development Platforms `_ +* `Frameworks `_ +* `Embedded Boards `_ Solutions --------- * `Library Manager `_ -* `Cloud IDEs Integration `_ +* `Cloud IDEs Integration `_ * `Standalone IDEs Integration `_ * `Continuous Integration `_ Development Platforms --------------------- -* `Atmel AVR `_ -* `Atmel SAM `_ -* `Espressif 32 `_ -* `Espressif 8266 `_ -* `Freescale Kinetis `_ -* `Intel ARC32 `_ -* `Lattice iCE40 `_ -* `Maxim 32 `_ -* `Microchip PIC32 `_ -* `Nordic nRF51 `_ -* `Nordic nRF52 `_ -* `NXP LPC `_ -* `Silicon Labs EFM32 `_ -* `ST STM32 `_ -* `Teensy `_ -* `TI MSP430 `_ -* `TI Tiva `_ -* `WIZNet W7500 `_ +* `Atmel AVR `_ +* `Atmel SAM `_ +* `Espressif 32 `_ +* `Espressif 8266 `_ +* `Freescale Kinetis `_ +* `Intel ARC32 `_ +* `Lattice iCE40 `_ +* `Maxim 32 `_ +* `Microchip PIC32 `_ +* `Nordic nRF51 `_ +* `Nordic nRF52 `_ +* `NXP LPC `_ +* `Silicon Labs EFM32 `_ +* `ST STM32 `_ +* `Teensy `_ +* `TI MSP430 `_ +* `TI Tiva `_ +* `WIZNet W7500 `_ Frameworks ---------- -* `Arduino `_ -* `ARTIK SDK `_ -* `CMSIS `_ -* `Energia `_ -* `ESP-IDF `_ -* `ESP8266 Non-OS SDK `_ -* `ESP8266 RTOS SDK `_ -* `libOpenCM3 `_ -* `mbed `_ -* `Pumbaa `_ -* `Simba `_ -* `SPL `_ -* `STM32Cube `_ -* `Tizen RT `_ -* `WiringPi `_ +* `Arduino `_ +* `ARTIK SDK `_ +* `CMSIS `_ +* `Energia `_ +* `ESP-IDF `_ +* `ESP8266 Non-OS SDK `_ +* `ESP8266 RTOS SDK `_ +* `libOpenCM3 `_ +* `mbed `_ +* `Pumbaa `_ +* `Simba `_ +* `SPL `_ +* `STM32Cube `_ +* `Tizen RT `_ +* `WiringPi `_ Contributing ------------ diff --git a/docs b/docs index 4c827a75..1a59e06e 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 4c827a754480d5f3d97db78c628d17925651afd1 +Subproject commit 1a59e06e021de0f1ecd710ac2bcb7b66897c7dd7 diff --git a/examples b/examples index ba8888f5..db8b4f3c 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit ba8888f5747cf59d80eb6ed7660755c6db82d332 +Subproject commit db8b4f3c77cf9694986eb55280038c37dd43548a diff --git a/platformio/__init__.py b/platformio/__init__.py index 6fec4c34..447ba79c 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -24,7 +24,7 @@ __description__ = ( "Remote unit testing and firmware updates. " "Arduino, ARM mbed, Espressif (ESP8266/ESP32), STM32, PIC32, nRF51/nRF52, " "FPGA, CMSIS, SPL, AVR, Samsung ARTIK, libOpenCM3") -__url__ = "http://platformio.org" +__url__ = "https://platformio.org" __author__ = "Ivan Kravets" __email__ = "me@ikravets.com" diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index 87f87d7c..12c066d5 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -428,7 +428,7 @@ def lib_stats(json_output): time.strftime("%c", util.parse_date(item['date'])) if "date" in item else ""), url=click.style( - "http://platformio.org/lib/show/%s/%s" % + "https://platformio.org/lib/show/%s/%s" % (item['id'], quote(item['name'])), fg="blue"))) @@ -437,7 +437,7 @@ def lib_stats(json_output): printitem_tpl.format( name=click.style(name, fg="cyan"), url=click.style( - "http://platformio.org/lib/search?query=" + + "https://platformio.org/lib/search?query=" + quote("keyword:%s" % name), fg="blue"))) diff --git a/platformio/commands/platform.py b/platformio/commands/platform.py index 8fcc70b0..f6307be5 100644 --- a/platformio/commands/platform.py +++ b/platformio/commands/platform.py @@ -195,7 +195,7 @@ def platform_frameworks(query, json_output): if query and query.lower() not in search_data.lower(): continue framework['homepage'] = ( - "http://platformio.org/frameworks/" + framework['name']) + "https://platformio.org/frameworks/" + framework['name']) framework['platforms'] = [ platform['name'] for platform in _get_registry_platforms() if framework['name'] in platform['frameworks'] diff --git a/platformio/maintenance.py b/platformio/maintenance.py index abbd7ca2..35f0e173 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -222,7 +222,7 @@ def after_upgrade(ctx): click.echo( "- %s PlatformIO IDE for IoT development > %s" % (click.style("try", fg="cyan"), - click.style("http://platformio.org/platformio-ide", fg="cyan"))) + click.style("https://platformio.org/platformio-ide", fg="cyan"))) if not util.is_ci(): click.echo("- %s us with PlatformIO Plus > %s" % (click.style("support", fg="cyan"), diff --git a/platformio/managers/lib.py b/platformio/managers/lib.py index e900fd97..c1e5ab96 100644 --- a/platformio/managers/lib.py +++ b/platformio/managers/lib.py @@ -282,7 +282,7 @@ class LibraryManager(BasePkgManager): raise exception.LibNotFound(str(filters)) if not silent: click.echo("Found: %s" % click.style( - "http://platformio.org/lib/show/{id}/{name}".format( + "https://platformio.org/lib/show/{id}/{name}".format( **lib_info), fg="blue")) return int(lib_info['id']) diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index fb2c2f93..99da018e 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -427,10 +427,10 @@ class PlatformRunMixin(object): """.format(filename=filename, filename_styled=click.style(filename, fg="cyan"), link=click.style( - "http://platformio.org/lib/search?query=header:%s" % quote( + "https://platformio.org/lib/search?query=header:%s" % quote( filename, safe=""), fg="blue"), - dots="*" * (55 + len(filename))) + dots="*" * (56 + len(filename))) click.echo(banner, err=True) @staticmethod diff --git a/scripts/99-platformio-udev.rules b/scripts/99-platformio-udev.rules index 5703cd26..7affcad8 100644 --- a/scripts/99-platformio-udev.rules +++ b/scripts/99-platformio-udev.rules @@ -16,7 +16,7 @@ # INSTALLATION # -# UDEV Rules for PlatformIO supported boards, http://platformio.org/boards +# UDEV Rules for PlatformIO supported boards, https://platformio.org/boards # # The latest version of this file may be found at: # https://github.com/platformio/platformio-core/blob/develop/scripts/99-platformio-udev.rules diff --git a/scripts/docspregen.py b/scripts/docspregen.py index 51b2ff48..e0155a13 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -362,7 +362,7 @@ Boards .. note:: * You can list pre-configured boards by :ref:`cmd_boards` command or - `PlatformIO Boards Explorer `_ + `PlatformIO Boards Explorer `_ * For more detailed ``board`` information please scroll tables below by horizontal. """) @@ -487,7 +487,7 @@ Boards .. note:: * You can list pre-configured boards by :ref:`cmd_boards` command or - `PlatformIO Boards Explorer `_ + `PlatformIO Boards Explorer `_ * For more detailed ``board`` information please scroll tables below by horizontal. """) for vendor, boards in sorted(vendors.items()): @@ -574,7 +574,7 @@ popular embedded boards and IDE. .. note:: * You can list pre-configured boards by :ref:`cmd_boards` command or - `PlatformIO Boards Explorer `_ + `PlatformIO Boards Explorer `_ * For more detailed ``board`` information please scroll tables below by horizontal. """) diff --git a/tests/commands/test_lib.py b/tests/commands/test_lib.py index a4c31bce..12debd8c 100644 --- a/tests/commands/test_lib.py +++ b/tests/commands/test_lib.py @@ -270,7 +270,7 @@ def test_lib_stats(clirunner, validate_cliresult): validate_cliresult(result) assert all([ s in result.output - for s in ("UPDATED", "POPULAR", "http://platformio.org/lib/show") + for s in ("UPDATED", "POPULAR", "https://platformio.org/lib/show") ]) result = clirunner.invoke(cmd_lib, ["stats", "--json-output"]) From 0c2f97341262d6eeafd6b255eaf20f1fd7be6f7b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Feb 2018 19:24:02 +0200 Subject: [PATCH 62/98] Mark project source and library directories for CLion IDE // Resolve #1359 Resolve #897 Resolve #1345 --- HISTORY.rst | 6 ++- platformio/builder/tools/pioplatform.py | 4 +- platformio/ide/projectgenerator.py | 41 ++++++++------------ platformio/ide/tpls/clion/.idea/misc.xml.tpl | 16 ++++++++ platformio/ide/tpls/clion/CMakeLists.txt.tpl | 14 ------- 5 files changed, 39 insertions(+), 42 deletions(-) create mode 100644 platformio/ide/tpls/clion/.idea/misc.xml.tpl diff --git a/HISTORY.rst b/HISTORY.rst index eb4bda94..5abe1a70 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -8,7 +8,7 @@ PlatformIO 3.0 ~~~~~~~~~~~~~~~~~~ * Added aliases (off, light, strict) for - `LDF Compatibility Modes `__ + `LDF Compatibility Mode `__ * Show device system information (MCU, Frequency, RAM, Flash, Debugging tools) in a build log * Show all available upload protocols before firmware uploading in a build log @@ -17,6 +17,10 @@ PlatformIO 3.0 * Fixed project generator for Qt Creator IDE (`issue #1303 `_, `issue #1323 `_) +* Mark project source and library directories for CLion IDE + (`issue #1359 `_, + `issue #1345 `_, + `issue #897 `_) * Fixed issue with duplicated "include" records when generating data for IDE (`issue #1301 `_) diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index e2735b01..4532f440 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -117,8 +117,8 @@ def PrintConfiguration(env): # pylint: disable=too-many-branches debug_tools = board_config.get("debug", {}).get("tools") ram = board_config.get("upload", {}).get("maximum_ram_size") flash = board_config.get("upload", {}).get("maximum_size") - system_data.append("%s (%s Flash)" % (util.format_filesize(ram), - util.format_filesize(flash))) + system_data.append("%s RAM (%s Flash)" % (util.format_filesize(ram), + util.format_filesize(flash))) if platform_data: print " ".join(platform_data) diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index e1d5b12a..79009657 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -30,11 +30,8 @@ class ProjectGenerator(object): self.project_dir = project_dir self.ide = ide self.env_name = env_name + self._tplvars = {} - - with util.cd(self.project_dir): - self.project_src_dir = util.get_projectsrc_dir() - self._gather_tplvars() @staticmethod @@ -92,7 +89,7 @@ class ProjectGenerator(object): def get_src_files(self): result = [] with util.cd(self.project_dir): - for root, _, files in os.walk(self.project_src_dir): + for root, _, files in os.walk(util.get_projectsrc_dir()): for f in files: result.append(relpath(join(root, f))) return result @@ -153,26 +150,20 @@ class ProjectGenerator(object): def _gather_tplvars(self): self._tplvars.update(self.get_project_env()) self._tplvars.update(self.get_project_build_data()) - self._tplvars.update({ - "project_name": - self.get_project_name(), - "src_files": - self.get_src_files(), - "user_home_dir": - abspath(expanduser("~")), - "project_dir": - self.project_dir, - "project_src_dir": - self.project_src_dir, - "systype": - util.get_systype(), - "platformio_path": - self._fix_os_path(util.where_is_program("platformio")), - "env_pathsep": - os.pathsep, - "env_path": - self._fix_os_path(os.getenv("PATH")) - }) + with util.cd(self.project_dir): + self._tplvars.update({ + "project_name": self.get_project_name(), + "src_files": self.get_src_files(), + "user_home_dir": abspath(expanduser("~")), + "project_dir": self.project_dir, + "project_src_dir": util.get_projectsrc_dir(), + "project_lib_dir": util.get_projectlib_dir(), + "systype": util.get_systype(), + "platformio_path": self._fix_os_path( + util.where_is_program("platformio")), + "env_pathsep": os.pathsep, + "env_path": self._fix_os_path(os.getenv("PATH")) + }) # yapf: disable @staticmethod def _fix_os_path(path): diff --git a/platformio/ide/tpls/clion/.idea/misc.xml.tpl b/platformio/ide/tpls/clion/.idea/misc.xml.tpl new file mode 100644 index 00000000..2b0c16ca --- /dev/null +++ b/platformio/ide/tpls/clion/.idea/misc.xml.tpl @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/platformio/ide/tpls/clion/CMakeLists.txt.tpl b/platformio/ide/tpls/clion/CMakeLists.txt.tpl index 075bc805..63274c43 100644 --- a/platformio/ide/tpls/clion/CMakeLists.txt.tpl +++ b/platformio/ide/tpls/clion/CMakeLists.txt.tpl @@ -51,18 +51,4 @@ add_custom_target( WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) -if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib) - add_custom_target( - CODE_COMPLETION_PIOLIB - SOURCES lib - ) -endif() - -if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.piolibdeps) - add_custom_target( - CODE_COMPLETION_PIOLIBDEPS - SOURCES .piolibdeps - ) -endif() - add_executable(${PROJECT_NAME} ${SRC_LIST}) From f86885a523fa111ef5b103e2b77603b4bf0a09d9 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Feb 2018 23:21:19 +0200 Subject: [PATCH 63/98] Typo fix --- platformio/builder/tools/pioplatform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index 4532f440..6a77bc74 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -141,7 +141,7 @@ def PrintConfiguration(env): # pylint: disable=too-many-branches else: external.append(key) if onboard: - data.append("ON-BORD(%s)" % ", ".join(sorted(onboard))) + data.append("ON-BOARD(%s)" % ", ".join(sorted(onboard))) if external: data.append("EXTERNAL(%s)" % ", ".join(sorted(external))) From 18c6fe98ee904906d5308c2bc165c902a093be76 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 15 Feb 2018 02:00:12 +0200 Subject: [PATCH 64/98] Search for a library using PIO Library Registry ID --- HISTORY.rst | 1 + docs | 2 +- platformio/commands/lib.py | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 5abe1a70..4555f655 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,6 +9,7 @@ PlatformIO 3.0 * Added aliases (off, light, strict) for `LDF Compatibility Mode `__ +* Search for a library using PIO Library Registry ID ``id:X`` (e.g. ``pio lib search id:13``) * Show device system information (MCU, Frequency, RAM, Flash, Debugging tools) in a build log * Show all available upload protocols before firmware uploading in a build log diff --git a/docs b/docs index 1a59e06e..e050d472 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 1a59e06e021de0f1ecd710ac2bcb7b66897c7dd7 +Subproject commit e050d472ea75ae8cd088da1d4b3fc37cd8e2b245 diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index 12c066d5..ee2ec01d 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -186,6 +186,7 @@ def print_lib_item(item): @click.argument("query", required=False, nargs=-1) @click.option("--json-output", is_flag=True) @click.option("--page", type=click.INT, default=1) +@click.option("--id", multiple=True) @click.option("-n", "--name", multiple=True) @click.option("-a", "--author", multiple=True) @click.option("-k", "--keyword", multiple=True) From 6b36a29858056edece4298067811105a84b97bf9 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 15 Feb 2018 19:44:29 +0200 Subject: [PATCH 65/98] Control PIO Unified Debugger and its firmware loading mode using "debug_load_mode" option --- HISTORY.rst | 3 +++ docs | 2 +- platformio/commands/run.py | 9 +++++---- platformio/managers/core.py | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 4555f655..83d20732 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,9 @@ PlatformIO 3.0 3.5.2 (2018-??-??) ~~~~~~~~~~~~~~~~~~ +* Control `PIO Unified Debugger `__ + and its firmware loading mode using + `debug_load_mode `__ option * Added aliases (off, light, strict) for `LDF Compatibility Mode `__ * Search for a library using PIO Library Registry ID ``id:X`` (e.g. ``pio lib search id:13``) diff --git a/docs b/docs index e050d472..a77f8fc8 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit e050d472ea75ae8cd088da1d4b3fc37cd8e2b245 +Subproject commit a77f8fc882916e68c12dcc275cdc8145f26b5888 diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 14db42a7..50ff22b0 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -137,15 +137,16 @@ class EnvironmentProcessor(object): "test_ignore", "test_port", "test_speed", "debug_tool", "debug_port", "debug_init_cmds", "debug_extra_cmds", "debug_server", "debug_init_break", "debug_load_cmd", - "monitor_port", "monitor_baud", "monitor_rts", - "monitor_dtr") + "debug_load_mode", "monitor_port", "monitor_baud", + "monitor_rts", "monitor_dtr") IGNORE_BUILD_OPTIONS = ("test_transport", "test_filter", "test_ignore", "test_port", "test_speed", "debug_port", "debug_init_cmds", "debug_extra_cmds", "debug_server", "debug_init_break", - "debug_load_cmd", "monitor_port", "monitor_baud", - "monitor_rts", "monitor_dtr") + "debug_load_cmd", "debug_load_mode", + "monitor_port", "monitor_baud", "monitor_rts", + "monitor_dtr") REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"} diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 9789b763..024bf8a1 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -23,7 +23,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "contrib-piohome": ">=0.6.1,<2", "contrib-pysite": ">=0.1.2,<2", - "tool-pioplus": ">=0.13.5,<2", + "tool-pioplus": ">=0.14.0,<2", "tool-unity": "~1.20302.1", "tool-scons": "~2.20501.3" } From 1d6dcb1c5a254807829f18f359c1ad8e74833fd1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 15 Feb 2018 19:44:51 +0200 Subject: [PATCH 66/98] Bump version to 3.5.2b3 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 447ba79c..93d22df6 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2b2") +VERSION = (3, 5, "2b3") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From f1f42c6888f8143da97251dd74e1490762acf16a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 16 Feb 2018 14:52:36 +0200 Subject: [PATCH 67/98] Fix issue with PIO Unified Debugger and "debug_load_mode = always" --- docs | 2 +- platformio/managers/core.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index a77f8fc8..61c8aa30 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit a77f8fc882916e68c12dcc275cdc8145f26b5888 +Subproject commit 61c8aa308d5739c7c6acb27aef65ccbf43a48c9b diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 024bf8a1..246eb7a0 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -23,7 +23,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "contrib-piohome": ">=0.6.1,<2", "contrib-pysite": ">=0.1.2,<2", - "tool-pioplus": ">=0.14.0,<2", + "tool-pioplus": ">=0.14.1,<2", "tool-unity": "~1.20302.1", "tool-scons": "~2.20501.3" } From 1fce214a6b338e5f0675533df9389fb5c0c0b0a7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 16 Feb 2018 14:53:00 +0200 Subject: [PATCH 68/98] Bump version to 3.5.2b4 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 93d22df6..0bb16fd2 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2b3") +VERSION = (3, 5, "2b4") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From be306224e377549bbd9b4466a12e6b80c7217e2b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 17 Feb 2018 17:13:30 +0200 Subject: [PATCH 69/98] Document creating of a "Custom build target" --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 61c8aa30..ac3b3bd9 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 61c8aa308d5739c7c6acb27aef65ccbf43a48c9b +Subproject commit ac3b3bd94f76bf46d2ca8d1d921bad886ee1bafe From aa0b6c207164ceef189533f48ccfb56a45c3d9c8 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 19 Feb 2018 20:37:57 +0200 Subject: [PATCH 70/98] Sync boards from ST STM32 --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index ac3b3bd9..4e3146c4 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ac3b3bd94f76bf46d2ca8d1d921bad886ee1bafe +Subproject commit 4e3146c43eaa3ac177f5aff3f3a797123f921280 From cdee2423332cd829f15fc005c2ae449d8a89df9b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 20 Feb 2018 01:10:27 +0200 Subject: [PATCH 71/98] Builder: append target suffix to the filename instead of replacing --- platformio/builder/main.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 04a19eba..ea02734d 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -19,6 +19,7 @@ from os import environ from os.path import expanduser, join from time import time +from SCons import Builder, Util from SCons.Script import (ARGUMENTS, COMMAND_LINE_TARGETS, DEFAULT_TARGETS, Action, AllowSubstExceptions, AlwaysBuild, DefaultEnvironment, Variables) @@ -27,6 +28,19 @@ from platformio import util AllowSubstExceptions(NameError) + +def scons_patched_match_splitext(path, suffixes=None): + """ + Patch SCons version, append $OBJSUFFIX to the end of each target + """ + result = Util.splitext(path) + if result[1] in (suffixes or []): + return (path, result[1]) + return result + + +Builder.match_splitext = scons_patched_match_splitext + # allow common variables from INI file commonvars = Variables(None) commonvars.AddVariables( From a3457dfca6594c34cdbe484c426dc214349ecb78 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 20 Feb 2018 01:11:25 +0200 Subject: [PATCH 72/98] Bump version to 3.5.2b5 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 0bb16fd2..69a5b16a 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2b4") +VERSION = (3, 5, "2b5") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 7c0cd12f808a9ace4770bf504acddf07518a7507 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 20 Feb 2018 01:15:52 +0200 Subject: [PATCH 73/98] Builder: append target suffix to the filename instead of replacing --- platformio/builder/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index ea02734d..160c9038 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -34,7 +34,7 @@ def scons_patched_match_splitext(path, suffixes=None): Patch SCons version, append $OBJSUFFIX to the end of each target """ result = Util.splitext(path) - if result[1] in (suffixes or []): + if suffixes and result[1] and result[1] in suffixes: return (path, result[1]) return result From 1cb1af3375ad48714d65f60b99418a84d03a4d8f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 20 Feb 2018 14:29:20 +0200 Subject: [PATCH 74/98] Revert back caching for Travis.CI --- docs | 2 +- platformio/builder/main.py | 10 +++++----- platformio/commands/init.py | 12 ++++++++++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/docs b/docs index 4e3146c4..45a54d74 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 4e3146c43eaa3ac177f5aff3f3a797123f921280 +Subproject commit 45a54d7499ec5d1d3fd3e299c5cf793704318c71 diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 160c9038..9b227c42 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -31,12 +31,12 @@ AllowSubstExceptions(NameError) def scons_patched_match_splitext(path, suffixes=None): """ - Patch SCons version, append $OBJSUFFIX to the end of each target + Patch SCons Builder, append $OBJSUFFIX to the end of each target """ - result = Util.splitext(path) - if suffixes and result[1] and result[1] in suffixes: - return (path, result[1]) - return result + tokens = Util.splitext(path) + if suffixes and tokens[1] and tokens[1] in suffixes: + return (path, tokens[1]) + return tokens Builder.match_splitext = scons_patched_match_splitext diff --git a/platformio/commands/init.py b/platformio/commands/init.py index 7cfc0672..dadf3e77 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -231,8 +231,14 @@ def init_ci_conf(project_dir): # python: # - "2.7" # +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# # install: # - pip install -U platformio +# - platformio update # # script: # - platformio run @@ -246,6 +252,11 @@ def init_ci_conf(project_dir): # python: # - "2.7" # +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# # env: # - PLATFORMIO_CI_SRC=path/to/test/file.c # - PLATFORMIO_CI_SRC=examples/file.ino @@ -253,6 +264,7 @@ def init_ci_conf(project_dir): # # install: # - pip install -U platformio +# - platformio update # # script: # - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N From ba0e87b9781915b63b5fdc5621c022b61e7e4d44 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 20 Feb 2018 14:38:47 +0200 Subject: [PATCH 75/98] Fix issue with mDNS lookup service // Resolve #1310 --- platformio/managers/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 246eb7a0..82590704 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "contrib-piohome": ">=0.6.1,<2", - "contrib-pysite": ">=0.1.2,<2", + "contrib-pysite": ">=0.1.5,<2", "tool-pioplus": ">=0.14.1,<2", "tool-unity": "~1.20302.1", "tool-scons": "~2.20501.3" From 3a52f35fe5bf4c96e9720ea6711c138901ad8fe6 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 20 Feb 2018 15:06:35 +0200 Subject: [PATCH 76/98] Add "udev" to FAQ --- docs | 2 +- platformio/builder/tools/pioupload.py | 4 +- scripts/98-openocd-udev.rules | 163 -------------------------- scripts/99-platformio-udev.rules | 160 +++++++++++++++++++++---- scripts/docspregen.py | 3 +- 5 files changed, 139 insertions(+), 193 deletions(-) delete mode 100644 scripts/98-openocd-udev.rules diff --git a/docs b/docs index 45a54d74..a0e3e4b6 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 45a54d7499ec5d1d3fd3e299c5cf793704318c71 +Subproject commit a0e3e4b61ebca136efcc792fca746bb602f26595 diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 7afa8587..7bc036fb 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -156,8 +156,8 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument sys.stderr.write( "\nWarning! Please install `99-platformio-udev.rules` and " "check that your board's PID and VID are listed in the rules." - "\n https://raw.githubusercontent.com/platformio/platformio" - "/develop/scripts/99-platformio-udev.rules\n") + "\n http://docs.platformio.org/en/latest/faq.html" + "#platformio-udev-rules\n") env.Replace(UPLOAD_PORT=_look_for_serial_port()) if env.subst("$UPLOAD_PORT"): diff --git a/scripts/98-openocd-udev.rules b/scripts/98-openocd-udev.rules deleted file mode 100644 index c6ff3083..00000000 --- a/scripts/98-openocd-udev.rules +++ /dev/null @@ -1,163 +0,0 @@ -# UDEV Rules for debug adapters/boards supported by OpenOCD - -# -# INSTALLATION -# - -# -# The latest version of this file may be found at: -# https://github.com/platformio/platformio-core/blob/develop/scripts/98-openocd-udev.rules -# -# This file must be placed at: -# /etc/udev/rules.d/98-openocd-udev.rules (preferred location) -# or -# /lib/udev/rules.d/98-openocd-udev.rules (req'd on some broken systems) -# -# To install, type this command in a terminal: -# sudo cp 98-openocd-udev.rules /etc/udev/rules.d/98-openocd-udev.rules -# -# Restart "udev" management tool: -# sudo service udev restart -# or -# sudo udevadm control --reload-rules -# sudo udevadm trigger -# -# Ubuntu/Debian users may need to add own “username” to the “dialout” group if -# they are not “root”, doing this issuing a -# sudo usermod -a -G dialout $USER -# sudo usermod -a -G plugdev $USER -# -# After this file is installed, physically unplug and reconnect your adapter/board. - -ACTION!="add|change", GOTO="openocd_rules_end" -SUBSYSTEM!="usb|tty|hidraw", GOTO="openocd_rules_end" - -# Please keep this list sorted by VID:PID - -# opendous and estick -ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="204f", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Original FT232/FT245 VID:PID -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Original FT2232 VID:PID -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Original FT4232 VID:PID -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Original FT232H VID:PID -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# DISTORTEC JTAG-lock-pick Tiny 2 -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8220", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# TUMPA, TUMPA Lite -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8a98", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8a99", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# XDS100v2 -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="a6d0", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Xverve Signalyzer Tool (DT-USB-ST), Signalyzer LITE (DT-USB-SLITE) -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bca0", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bca1", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# TI/Luminary Stellaris Evaluation Board FTDI (several) -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bcd9", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# TI/Luminary Stellaris In-Circuit Debug Interface FTDI (ICDI) Board -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bcda", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# egnite Turtelizer 2 -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bdc8", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Section5 ICEbear -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="c140", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="c141", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Amontec JTAGkey and JTAGkey-tiny -ATTRS{idVendor}=="0403", ATTRS{idProduct}=="cff8", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# TI ICDI -ATTRS{idVendor}=="0451", ATTRS{idProduct}=="c32a", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# STLink v1 -ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3744", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# STLink v2 -ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# STLink v2-1 -ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Hilscher NXHX Boards -ATTRS{idVendor}=="0640", ATTRS{idProduct}=="0028", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Hitex STR9-comStick -ATTRS{idVendor}=="0640", ATTRS{idProduct}=="002c", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Hitex STM32-PerformanceStick -ATTRS{idVendor}=="0640", ATTRS{idProduct}=="002d", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Altera USB Blaster -ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6001", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Amontec JTAGkey-HiSpeed -ATTRS{idVendor}=="0fbb", ATTRS{idProduct}=="1000", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# SEGGER J-Link -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0101", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0102", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0103", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0104", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0105", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0107", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0108", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1010", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1011", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1012", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1013", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1014", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1015", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1016", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1017", MODE="660", GROUP="plugdev", TAG+="uaccess" -ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1018", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Raisonance RLink -ATTRS{idVendor}=="138e", ATTRS{idProduct}=="9000", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Debug Board for Neo1973 -ATTRS{idVendor}=="1457", ATTRS{idProduct}=="5118", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Olimex ARM-USB-OCD -ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="0003", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Olimex ARM-USB-OCD-TINY -ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="0004", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Olimex ARM-JTAG-EW -ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="001e", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Olimex ARM-USB-OCD-TINY-H -ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="002a", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Olimex ARM-USB-OCD-H -ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="002b", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# USBprog with OpenOCD firmware -ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c63", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# TI/Luminary Stellaris In-Circuit Debug Interface (ICDI) Board -ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Marvell Sheevaplug -ATTRS{idVendor}=="9e88", ATTRS{idProduct}=="9e8f", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# Keil Software, Inc. ULink -ATTRS{idVendor}=="c251", ATTRS{idProduct}=="2710", MODE="660", GROUP="plugdev", TAG+="uaccess" - -# CMSIS-DAP compatible adapters -ATTRS{product}=="*CMSIS-DAP*", MODE="660", GROUP="plugdev", TAG+="uaccess" - -LABEL="openocd_rules_end" diff --git a/scripts/99-platformio-udev.rules b/scripts/99-platformio-udev.rules index 7affcad8..6daaf922 100644 --- a/scripts/99-platformio-udev.rules +++ b/scripts/99-platformio-udev.rules @@ -12,35 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +##################################################################################### # # INSTALLATION # +# Please visit > http://docs.platformio.org/en/latest/faq.html#platformio-udev-rules +# +##################################################################################### -# UDEV Rules for PlatformIO supported boards, https://platformio.org/boards # -# The latest version of this file may be found at: -# https://github.com/platformio/platformio-core/blob/develop/scripts/99-platformio-udev.rules +# Boards # -# This file must be placed at: -# /etc/udev/rules.d/99-platformio-udev.rules (preferred location) -# or -# /lib/udev/rules.d/99-platformio-udev.rules (req'd on some broken systems) -# -# To install, type this command in a terminal: -# sudo cp 99-platformio-udev.rules /etc/udev/rules.d/99-platformio-udev.rules -# -# Restart "udev" management tool: -# sudo service udev restart -# or -# sudo udevadm control --reload-rules -# sudo udevadm trigger -# -# Ubuntu/Debian users may need to add own “username” to the “dialout” group if -# they are not “root”, doing this issuing a -# sudo usermod -a -G dialout $USER -# sudo usermod -a -G plugdev $USER -# -# After this file is installed, physically unplug and reconnect your board. # CP210X USB UART SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE:="0666" @@ -89,9 +71,137 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", MODE="0666 #TI MSP430 Launchpad SUBSYSTEMS=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="f432", MODE="0666" -# CMSIS-DAP compatible adapters -ATTRS{product}=="*CMSIS-DAP*", MODE="664", GROUP="plugdev" + +# +# Debuggers +# # Black Magic Probe SUBSYSTEM=="tty", ATTRS{interface}=="Black Magic GDB Server" SUBSYSTEM=="tty", ATTRS{interface}=="Black Magic UART Port" + +# opendous and estick +ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="204f", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Original FT232/FT245 VID:PID +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Original FT2232 VID:PID +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Original FT4232 VID:PID +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Original FT232H VID:PID +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# DISTORTEC JTAG-lock-pick Tiny 2 +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8220", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# TUMPA, TUMPA Lite +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8a98", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8a99", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# XDS100v2 +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="a6d0", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Xverve Signalyzer Tool (DT-USB-ST), Signalyzer LITE (DT-USB-SLITE) +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bca0", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bca1", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# TI/Luminary Stellaris Evaluation Board FTDI (several) +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bcd9", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# TI/Luminary Stellaris In-Circuit Debug Interface FTDI (ICDI) Board +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bcda", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# egnite Turtelizer 2 +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bdc8", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Section5 ICEbear +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="c140", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="c141", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Amontec JTAGkey and JTAGkey-tiny +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="cff8", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# TI ICDI +ATTRS{idVendor}=="0451", ATTRS{idProduct}=="c32a", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# STLink v1 +ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3744", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# STLink v2 +ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# STLink v2-1 +ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Hilscher NXHX Boards +ATTRS{idVendor}=="0640", ATTRS{idProduct}=="0028", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Hitex STR9-comStick +ATTRS{idVendor}=="0640", ATTRS{idProduct}=="002c", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Hitex STM32-PerformanceStick +ATTRS{idVendor}=="0640", ATTRS{idProduct}=="002d", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Altera USB Blaster +ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6001", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Amontec JTAGkey-HiSpeed +ATTRS{idVendor}=="0fbb", ATTRS{idProduct}=="1000", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# SEGGER J-Link +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0101", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0102", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0103", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0104", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0105", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0107", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0108", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1010", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1011", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1012", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1013", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1014", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1015", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1016", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1017", MODE="660", GROUP="plugdev", TAG+="uaccess" +ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1018", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Raisonance RLink +ATTRS{idVendor}=="138e", ATTRS{idProduct}=="9000", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Debug Board for Neo1973 +ATTRS{idVendor}=="1457", ATTRS{idProduct}=="5118", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Olimex ARM-USB-OCD +ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="0003", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Olimex ARM-USB-OCD-TINY +ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="0004", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Olimex ARM-JTAG-EW +ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="001e", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Olimex ARM-USB-OCD-TINY-H +ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="002a", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Olimex ARM-USB-OCD-H +ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="002b", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# USBprog with OpenOCD firmware +ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c63", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# TI/Luminary Stellaris In-Circuit Debug Interface (ICDI) Board +ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Marvell Sheevaplug +ATTRS{idVendor}=="9e88", ATTRS{idProduct}=="9e8f", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# Keil Software, Inc. ULink +ATTRS{idVendor}=="c251", ATTRS{idProduct}=="2710", MODE="660", GROUP="plugdev", TAG+="uaccess" + +# CMSIS-DAP compatible adapters +ATTRS{product}=="*CMSIS-DAP*", MODE="660", GROUP="plugdev", TAG+="uaccess" diff --git a/scripts/docspregen.py b/scripts/docspregen.py index e0155a13..b0e28c1e 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -187,8 +187,7 @@ Packages .. warning:: **Linux Users**: - * Install "udev" rules file `99-platformio-udev.rules `_ - (an instruction is located inside a file). + * Install "udev" rules :ref:`faq_udev_rules` * Raspberry Pi users, please read this article `Enable serial port on Raspberry Pi `__. """) From cfb9ec77ce3bede7de36dd3c078ff52fff3fe332 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 24 Feb 2018 01:40:49 +0200 Subject: [PATCH 77/98] Keep VSCode CPP DB in workspace --- docs | 2 +- platformio/ide/tpls/vscode/.gitignore.tpl | 1 + platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs b/docs index a0e3e4b6..50d68ae2 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit a0e3e4b61ebca136efcc792fca746bb602f26595 +Subproject commit 50d68ae256855aabf5ef98484e2e13ed1420e45d diff --git a/platformio/ide/tpls/vscode/.gitignore.tpl b/platformio/ide/tpls/vscode/.gitignore.tpl index f92113ad..eb9d2d5c 100644 --- a/platformio/ide/tpls/vscode/.gitignore.tpl +++ b/platformio/ide/tpls/vscode/.gitignore.tpl @@ -1,4 +1,5 @@ .pioenvs .piolibdeps +.vscode/*.db .vscode/c_cpp_properties.json .vscode/launch.json diff --git a/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl b/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl index ced616b7..33672349 100644 --- a/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl @@ -18,7 +18,7 @@ ], "browse": { "limitSymbolsToIncludedHeaders": true, - "databaseFilename": "", + "databaseFilename": "./.vscode/.browse.VC.db", "path": [ % for include in includes: "{{include.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", From e95354afebbdbf131b84a24a7724ef3a0fc4effe Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 24 Feb 2018 01:51:07 +0200 Subject: [PATCH 78/98] Bump version to 3.5.2rc1 --- platformio/__init__.py | 2 +- platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 69a5b16a..977313ef 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2b5") +VERSION = (3, 5, "2rc1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl b/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl index 33672349..5efe4c0c 100644 --- a/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl @@ -18,7 +18,7 @@ ], "browse": { "limitSymbolsToIncludedHeaders": true, - "databaseFilename": "./.vscode/.browse.VC.db", + "databaseFilename": "./.vscode/.browse.c_cpp.db", "path": [ % for include in includes: "{{include.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", From 2ccb30b0f09a991d3298686418987fc610dd7c6f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 2 Mar 2018 14:31:24 +0200 Subject: [PATCH 79/98] Print VCS version if available in LDF Graph --- platformio/builder/tools/piolib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 44988375..b3b02972 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -815,7 +815,7 @@ def BuildProjectLibraries(env): vcs_info = lb.vcs_info if lb.version: title += " v%s" % lb.version - if vcs_info: + if vcs_info and vcs_info.get("version"): title += " #%s" % vcs_info.get("version") sys.stdout.write("%s|-- %s" % (margin, title)) if int(ARGUMENTS.get("PIOVERBOSE", 0)): From d1c7f56950d2651a6b44f8c8ac16322e0ddd7a35 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 2 Mar 2018 14:40:35 +0200 Subject: [PATCH 80/98] Add example with a custom name for library dependency --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 50d68ae2..ab5043d2 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 50d68ae256855aabf5ef98484e2e13ed1420e45d +Subproject commit ab5043d206a69af5654b3831d55c3c7a8c325050 From 6ec1890f520f55c51d784a13afcf614a569e4146 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 3 Mar 2018 14:36:17 +0200 Subject: [PATCH 81/98] Fix GitHub's "TLSV1_ALERT_PROTOCOL_VERSION" issue when upgrading PIO Core to development version --- platformio/app.py | 2 +- platformio/commands/upgrade.py | 36 +++++++++++++++++++++++++++++----- platformio/util.py | 5 +++++ tests/test_maintenance.py | 4 +--- 4 files changed, 38 insertions(+), 9 deletions(-) diff --git a/platformio/app.py b/platformio/app.py index f6015d36..8ca1ba4c 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -141,7 +141,7 @@ class ContentCache(object): self._db_path = None self._lockfile = None - self.cache_dir = cache_dir or join(util.get_home_dir(), ".cache") + self.cache_dir = cache_dir or util.get_cache_dir() self._db_path = join(self.cache_dir, "db.data") def __enter__(self): diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index bcc202ab..a1efb8f2 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os import re +from zipfile import ZipFile import click import requests @@ -37,11 +39,8 @@ def cli(dev): shutdown_servers() to_develop = dev or not all(c.isdigit() for c in __version__ if c != ".") - cmds = ([ - "pip", "install", "--upgrade", - "https://github.com/platformio/platformio-core/archive/develop.zip" - if to_develop else "platformio" - ], ["platformio", "--version"]) + cmds = (["pip", "install", "--upgrade", + get_pip_package(to_develop)], ["platformio", "--version"]) cmd = None r = None @@ -92,6 +91,33 @@ WARNING! Don't use `sudo` for the rest PlatformIO commands. return True +def get_pip_package(to_develop): + pkg_name = "platformio" + if not to_develop: + return pkg_name + cache_dir = util.get_cache_dir() + if not os.path.isdir(cache_dir): + os.makedirs(cache_dir) + pkg_name = os.path.join(cache_dir, "piocoredevelop.zip") + try: + with open(pkg_name, "w") as fp: + r = util.exec_command( + [ + "curl", "-fsSL", "https://github.com/platformio/" + "platformio-core/archive/develop.zip" + ], + stdout=fp, + universal_newlines=True) + assert r['returncode'] == 0 + # check ZIP structure + with ZipFile(pkg_name) as zp: + assert zp.testzip() is None + return pkg_name + except: # pylint: disable=bare-except + pass + return "platformio" + + def get_latest_version(): try: if not str(VERSION[2]).isdigit(): diff --git a/platformio/util.py b/platformio/util.py index c569f04a..459b85e2 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -253,6 +253,11 @@ def get_home_dir(): return home_dir +def get_cache_dir(): + return get_project_optional_dir("cache_dir", join(get_home_dir(), + ".cache")) + + def get_source_dir(): curpath = abspath(__file__) if not isfile(curpath): diff --git a/tests/test_maintenance.py b/tests/test_maintenance.py index 667c1563..ec9d749a 100644 --- a/tests/test_maintenance.py +++ b/tests/test_maintenance.py @@ -44,9 +44,7 @@ def test_after_upgrade_2_to_3(clirunner, validate_cliresult, result = clirunner.invoke(cli_pio, ["settings", "get"]) validate_cliresult(result) - assert "upgraded to 3" - assert isolated_pio_home.join("platforms", "native", - "platform.json").check() + assert "upgraded to 3" in result.output # check PlatformIO 3.0 boards assert board_ids == set([p.basename[:-5] for p in boards.listdir()]) From 9415b369e1dc90986aa70bd29643ed8baeb0699e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 3 Mar 2018 14:37:08 +0200 Subject: [PATCH 82/98] Bump version to 3.5.2rc2 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 977313ef..8a301fdf 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2rc1") +VERSION = (3, 5, "2rc2") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 3a16ecbaa1c573f47af9f27c8f19f5ccfe2867b7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 4 Mar 2018 11:29:03 +0200 Subject: [PATCH 83/98] Typo fix --- platformio/commands/upgrade.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index a1efb8f2..a1068eea 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -92,9 +92,8 @@ WARNING! Don't use `sudo` for the rest PlatformIO commands. def get_pip_package(to_develop): - pkg_name = "platformio" if not to_develop: - return pkg_name + return "platformio" cache_dir = util.get_cache_dir() if not os.path.isdir(cache_dir): os.makedirs(cache_dir) @@ -115,7 +114,7 @@ def get_pip_package(to_develop): return pkg_name except: # pylint: disable=bare-except pass - return "platformio" + return "https://github.com/platformio/platformio-core/archive/develop.zip" def get_latest_version(): From 3d300414acd1e5efdec3216e23a4b5b1d61fd9e7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 5 Mar 2018 15:50:49 +0200 Subject: [PATCH 84/98] Multiple themes (Dark & Light) for PlatformIO Home --- HISTORY.rst | 1 + platformio/commands/upgrade.py | 11 ++++------- platformio/managers/core.py | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 83d20732..7be5e06f 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,7 @@ PlatformIO 3.0 3.5.2 (2018-??-??) ~~~~~~~~~~~~~~~~~~ +* Multiple themes (Dark & Light) for `PlatformIO Home `__ * Control `PIO Unified Debugger `__ and its firmware loading mode using `debug_load_mode `__ option diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index a1068eea..3c54764b 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -94,6 +94,8 @@ WARNING! Don't use `sudo` for the rest PlatformIO commands. def get_pip_package(to_develop): if not to_develop: return "platformio" + dl_url = ("https://github.com/platformio/" + "platformio-core/archive/develop.zip") cache_dir = util.get_cache_dir() if not os.path.isdir(cache_dir): os.makedirs(cache_dir) @@ -101,12 +103,7 @@ def get_pip_package(to_develop): try: with open(pkg_name, "w") as fp: r = util.exec_command( - [ - "curl", "-fsSL", "https://github.com/platformio/" - "platformio-core/archive/develop.zip" - ], - stdout=fp, - universal_newlines=True) + ["curl", "-fsSL", dl_url], stdout=fp, universal_newlines=True) assert r['returncode'] == 0 # check ZIP structure with ZipFile(pkg_name) as zp: @@ -114,7 +111,7 @@ def get_pip_package(to_develop): return pkg_name except: # pylint: disable=bare-except pass - return "https://github.com/platformio/platformio-core/archive/develop.zip" + return dl_url def get_latest_version(): diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 82590704..38d01268 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -21,7 +21,7 @@ from platformio import __version__, exception, util from platformio.managers.package import PackageManager CORE_PACKAGES = { - "contrib-piohome": ">=0.6.1,<2", + "contrib-piohome": ">=0.7.0,<2", "contrib-pysite": ">=0.1.5,<2", "tool-pioplus": ">=0.14.1,<2", "tool-unity": "~1.20302.1", From b1c9eb902263d1c8b7c1eeea30b270f9652960fc Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 5 Mar 2018 15:51:23 +0200 Subject: [PATCH 85/98] Bump version to 3.5.2rc3 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 8a301fdf..395859da 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2rc2") +VERSION = (3, 5, "2rc3") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From ef861ed7027a7e37cebd659efd2ad1c4eeebce7e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 6 Mar 2018 10:38:41 +0200 Subject: [PATCH 86/98] Use workspace folder for VSCode CPP tool DB files --- platformio/ide/tpls/vscode/.gitignore.tpl | 2 +- platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl | 2 +- platformio/ide/tpls/vscode/.vscode/launch.json.tpl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platformio/ide/tpls/vscode/.gitignore.tpl b/platformio/ide/tpls/vscode/.gitignore.tpl index eb9d2d5c..6a010304 100644 --- a/platformio/ide/tpls/vscode/.gitignore.tpl +++ b/platformio/ide/tpls/vscode/.gitignore.tpl @@ -1,5 +1,5 @@ .pioenvs .piolibdeps -.vscode/*.db +.vscode/.browse.c_cpp.db* .vscode/c_cpp_properties.json .vscode/launch.json diff --git a/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl b/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl index 5efe4c0c..d428393d 100644 --- a/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl @@ -18,7 +18,7 @@ ], "browse": { "limitSymbolsToIncludedHeaders": true, - "databaseFilename": "./.vscode/.browse.c_cpp.db", + "databaseFilename": "${workspaceRoot}/.vscode/.browse.c_cpp.db", "path": [ % for include in includes: "{{include.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", diff --git a/platformio/ide/tpls/vscode/.vscode/launch.json.tpl b/platformio/ide/tpls/vscode/.vscode/launch.json.tpl index 900d1438..788edc2a 100644 --- a/platformio/ide/tpls/vscode/.vscode/launch.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/launch.json.tpl @@ -5,7 +5,7 @@ { "type": "gdb", "request": "launch", - "cwd": "${workspaceFolder}", + "cwd": "${workspaceRoot}", "name": "PlatformIO Debugger", "target": "{{prog_path.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", "gdbpath": "{{join(dirname(platformio_path), "piodebuggdb").replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", From 3269d243a87945854d927c400b41aab23246e6b8 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 6 Mar 2018 12:06:52 +0200 Subject: [PATCH 87/98] Firmware memory size explanation: text, data and bss --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index ab5043d2..f32c300c 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ab5043d206a69af5654b3831d55c3c7a8c325050 +Subproject commit f32c300c1c19b399421da4ce5aeb148fa1dc3a32 From 90993ec69f819ee934fba70ea40ee64425cda5f1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Mar 2018 13:48:59 +0200 Subject: [PATCH 88/98] Docs: Show onboard debug tools before --- docs | 2 +- scripts/docspregen.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs b/docs index f32c300c..cbb1112b 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit f32c300c1c19b399421da4ce5aeb148fa1dc3a32 +Subproject commit cbb1112bca68b42e1e03c1344e905579bb1df0a1 diff --git a/scripts/docspregen.py b/scripts/docspregen.py index b0e28c1e..9d1c2371 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -77,7 +77,8 @@ def generate_boards(boards, extend_debug=False, skip_columns=None): for data in sorted(boards, key=lambda item: item['id']): debug = [":ref:`Yes `" if data['debug'] else "No"] if extend_debug and data['debug']: - debug = [] + debug_onboard = [] + debug_external = [] for name, options in data['debug']['tools'].items(): attrs = [] if options.get("default"): @@ -86,9 +87,12 @@ def generate_boards(boards, extend_debug=False, skip_columns=None): attrs.append("on-board") tool = ":ref:`debugging_tool_%s`" % name if attrs: - debug.append("%s (%s)" % (tool, ", ".join(attrs))) + tool = "%s (%s)" % (tool, ", ".join(attrs)) + if options.get("onboard"): + debug_onboard.append(tool) else: - debug.append(tool) + debug_external.append(tool) + debug = sorted(debug_onboard) + sorted(debug_external) variables = dict( id=data['id'], From e0ce40d6b3ca9c2f5ed48cfa6a58d37c5db35a73 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Mar 2018 16:30:21 +0200 Subject: [PATCH 89/98] Ability to specify a name for new project --- HISTORY.rst | 7 ++++++- platformio/managers/core.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 7be5e06f..f780dc9a 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,7 +7,12 @@ PlatformIO 3.0 3.5.2 (2018-??-??) ~~~~~~~~~~~~~~~~~~ -* Multiple themes (Dark & Light) for `PlatformIO Home `__ +* `PlatformIO Home `__ - + interact with PlatformIO ecosystem using modern and cross-platform GUI: + + - Multiple themes (Dark & Light) + - Ability to specify a name for new project + * Control `PIO Unified Debugger `__ and its firmware loading mode using `debug_load_mode `__ option diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 38d01268..0a94cfa4 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -21,9 +21,9 @@ from platformio import __version__, exception, util from platformio.managers.package import PackageManager CORE_PACKAGES = { - "contrib-piohome": ">=0.7.0,<2", + "contrib-piohome": ">=0.7.1,<2", "contrib-pysite": ">=0.1.5,<2", - "tool-pioplus": ">=0.14.1,<2", + "tool-pioplus": ">=0.14.3,<2", "tool-unity": "~1.20302.1", "tool-scons": "~2.20501.3" } From ade6c25056257eea8b989af162ed7a7a9ab0e98b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Mar 2018 17:01:53 +0200 Subject: [PATCH 90/98] Docs: Arduino Core ESP32 Wiki --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index cbb1112b..c1a35b7d 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit cbb1112bca68b42e1e03c1344e905579bb1df0a1 +Subproject commit c1a35b7d0d73902c00028fd0ce1948a6381a1719 From e5b73dcd2b99769a4f42cac73b401a9bda22f4aa Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Mar 2018 20:46:31 +0200 Subject: [PATCH 91/98] Fix issue when custom board is used with the same ID --- platformio/managers/platform.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index 99da018e..f147b762 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -563,9 +563,9 @@ class PlatformBase( # pylint: disable=too-many-public-methods if not isdir(boards_dir): continue manifest_path = join(boards_dir, "%s.json" % id_) - if not isfile(manifest_path): - continue - _append_board(id_, manifest_path) + if isfile(manifest_path): + _append_board(id_, manifest_path) + break if id_ not in self._BOARDS_CACHE: raise exception.UnknownBoard(id_) return self._BOARDS_CACHE[id_] if id_ else self._BOARDS_CACHE From 93d524a392b180b4579b5b67ceb0a2d6b409b88a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Mar 2018 20:47:09 +0200 Subject: [PATCH 92/98] Bump version to 3.5.2rc4 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 395859da..9bf36bd5 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2rc3") +VERSION = (3, 5, "2rc4") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 8676f471f1e4764d99dbabe1af88b0843d1fe308 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Mar 2018 22:48:21 +0200 Subject: [PATCH 93/98] Docs: Update url for Sanguino boards --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index c1a35b7d..e9e78d04 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit c1a35b7d0d73902c00028fd0ce1948a6381a1719 +Subproject commit e9e78d043e4a1ba699f3e8e2b12bfeeeb18b1bd7 From 105cd0fa71fbe6d187e0ede9c10bf20be547f7f5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Mar 2018 23:35:03 +0200 Subject: [PATCH 94/98] Use custom object suffix only for Arduino/Energia frameworks --- platformio/builder/main.py | 14 -------------- platformio/builder/tools/platformio.py | 22 +++++++++++++++++----- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 9b227c42..04a19eba 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -19,7 +19,6 @@ from os import environ from os.path import expanduser, join from time import time -from SCons import Builder, Util from SCons.Script import (ARGUMENTS, COMMAND_LINE_TARGETS, DEFAULT_TARGETS, Action, AllowSubstExceptions, AlwaysBuild, DefaultEnvironment, Variables) @@ -28,19 +27,6 @@ from platformio import util AllowSubstExceptions(NameError) - -def scons_patched_match_splitext(path, suffixes=None): - """ - Patch SCons Builder, append $OBJSUFFIX to the end of each target - """ - tokens = Util.splitext(path) - if suffixes and tokens[1] and tokens[1] in suffixes: - return (path, tokens[1]) - return tokens - - -Builder.match_splitext = scons_patched_match_splitext - # allow common variables from INI file commonvars = Variables(None) commonvars.AddVariables( diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 61f91981..da82de85 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -20,10 +20,9 @@ from glob import glob from os import sep, walk from os.path import basename, dirname, isdir, join, realpath -from SCons.Action import Action +from SCons import Action, Builder, Util from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, DefaultEnvironment, SConscript) -from SCons.Util import case_sensitive_suffixes, is_Sequence from platformio.util import glob_escape, pioversion_to_intstr @@ -33,6 +32,16 @@ SRC_BUILD_EXT = SRC_C_EXT + ["S", "spp", "SPP", "sx", "s", "asm", "ASM"] SRC_FILTER_DEFAULT = ["+<*>", "-<.git%s>" % sep, "-" % sep] +def scons_patched_match_splitext(path, suffixes=None): + """ + Patch SCons Builder, append $OBJSUFFIX to the end of each target + """ + tokens = Util.splitext(path) + if suffixes and tokens[1] and tokens[1] in suffixes: + return (path, tokens[1]) + return tokens + + def BuildProgram(env): def _append_pio_macros(): @@ -45,7 +54,7 @@ def BuildProgram(env): env.PrintConfiguration() # fix ASM handling under non case-sensitive OS - if not case_sensitive_suffixes(".s", ".S"): + if not Util.case_sensitive_suffixes(".s", ".S"): env.Replace(AS="$CC", ASCOM="$ASPPCOM") if "__debug" in COMMAND_LINE_TARGETS: @@ -101,7 +110,8 @@ def BuildProgram(env): program = env.Program( join("$BUILD_DIR", env.subst("$PROGNAME")), env['PIOBUILDFILES']) - checksize_action = Action(env.CheckUploadSize, "Checking program size") + checksize_action = Action.Action(env.CheckUploadSize, + "Checking program size") AlwaysBuild(env.Alias("checkprogsize", program, checksize_action)) if set(["upload", "program"]) & set(COMMAND_LINE_TARGETS): env.AddPostAction(program, checksize_action) @@ -116,7 +126,7 @@ def ProcessFlags(env, flags): # pylint: disable=too-many-branches flags = " ".join(flags) parsed_flags = env.ParseFlags(str(flags)) for flag in parsed_flags.pop("CPPDEFINES"): - if not is_Sequence(flag): + if not Util.is_Sequence(flag): env.Append(CPPDEFINES=flag) continue _key, _value = flag[:2] @@ -258,6 +268,8 @@ def BuildFrameworks(env, frameworks): for f in frameworks: if f in ("arduino", "energia"): + # Arduino IDE appends .o the end of filename + Builder.match_splitext = scons_patched_match_splitext env.ConvertInoToCpp() if f in board_frameworks: From 7e875553c236a714a5c1286d82aedfa4e6cf08e5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 8 Mar 2018 16:29:09 +0200 Subject: [PATCH 95/98] Allow to control maximum depth of nested includes for conditional PreProcessor --- platformio/builder/tools/piolib.py | 10 +++++++++- platformio/managers/core.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index b3b02972..b865771b 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -91,6 +91,11 @@ class LibBuilderBase(object): CLASSIC_SCANNER = SCons.Scanner.C.CScanner() CCONDITIONAL_SCANNER = SCons.Scanner.C.CConditionalScanner() + # Max depth of nested includes: + # -1 = unlimited + # 0 - disabled nesting + # >0 - number of allowed nested includes + CCONDITIONAL_SCANNER_DEPTH = 99 PARSE_SRC_BY_H_NAME = True _INCLUDE_DIRS_CACHE = None @@ -344,7 +349,10 @@ class LibBuilderBase(object): try: assert "+" in self.lib_ldf_mode incs = LibBuilderBase.CCONDITIONAL_SCANNER( - self.env.File(path), self.env, tuple(include_dirs)) + self.env.File(path), + self.env, + tuple(include_dirs), + depth=self.CCONDITIONAL_SCANNER_DEPTH) except Exception as e: # pylint: disable=broad-except if self.verbose and "+" in self.lib_ldf_mode: sys.stderr.write( diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 0a94cfa4..99b59de1 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -25,7 +25,7 @@ CORE_PACKAGES = { "contrib-pysite": ">=0.1.5,<2", "tool-pioplus": ">=0.14.3,<2", "tool-unity": "~1.20302.1", - "tool-scons": "~2.20501.3" + "tool-scons": "~2.20501.4" } PIOPLUS_AUTO_UPDATES_MAX = 100 From 5e6d1d9361625de2d25f602752648ef475dd320b Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 12 Mar 2018 15:58:08 +0100 Subject: [PATCH 96/98] Fix CLion not recognizing includes in lib and .piolibdeps (#1429) --- platformio/ide/projectgenerator.py | 1 + platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index 79009657..cde75693 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -158,6 +158,7 @@ class ProjectGenerator(object): "project_dir": self.project_dir, "project_src_dir": util.get_projectsrc_dir(), "project_lib_dir": util.get_projectlib_dir(), + "project_libdeps_dir": util.get_projectlibdeps_dir(), "systype": util.get_systype(), "platformio_path": self._fix_os_path( util.where_is_program("platformio")), diff --git a/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl b/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl index 6efdb036..3c4bed47 100644 --- a/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl +++ b/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl @@ -24,4 +24,4 @@ include_directories("{{include.replace("\\", "/")}}") % end % end -FILE(GLOB_RECURSE SRC_LIST "{{project_src_dir.replace("\\", "/")}}/*.*") +FILE(GLOB_RECURSE SRC_LIST "{{project_src_dir.replace("\\", "/")}}/*.*" "{{project_lib_dir.replace("\\", "/")}}/*.*" "{{project_libdeps_dir.replace("\\", "/")}}/*.*") From f63a6d73ee2e8a947e2c2b8eb3936573c30558c3 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 12 Mar 2018 19:22:55 +0200 Subject: [PATCH 97/98] Add "include_dir" to known options list // Resolve #1433 --- platformio/commands/run.py | 40 +++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 50ff22b0..c0aab27f 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -126,19 +126,25 @@ class EnvironmentProcessor(object): DEFAULT_DUMP_OPTIONS = ("platform", "framework", "board") - KNOWN_OPTIONS = ("platform", "framework", "board", "board_mcu", - "board_f_cpu", "board_f_flash", "board_flash_mode", - "build_flags", "src_build_flags", "build_unflags", - "src_filter", "extra_scripts", "targets", "upload_port", - "upload_protocol", "upload_speed", "upload_flags", - "upload_resetmethod", "lib_deps", "lib_ignore", - "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode", - "lib_archive", "piotest", "test_transport", "test_filter", - "test_ignore", "test_port", "test_speed", "debug_tool", - "debug_port", "debug_init_cmds", "debug_extra_cmds", - "debug_server", "debug_init_break", "debug_load_cmd", - "debug_load_mode", "monitor_port", "monitor_baud", - "monitor_rts", "monitor_dtr") + KNOWN_PLATFORMIO_OPTIONS = ("env_default", "home_dir", "lib_dir", + "libdeps_dir", "include_dir", "src_dir", + "build_dir", "data_dir", "test_dir", + "boards_dir", "lib_extra_dirs") + + KNOWN_ENV_OPTIONS = ("platform", "framework", "board", "board_mcu", + "board_f_cpu", "board_f_flash", "board_flash_mode", + "build_flags", "src_build_flags", "build_unflags", + "src_filter", "extra_scripts", "targets", + "upload_port", "upload_protocol", "upload_speed", + "upload_flags", "upload_resetmethod", "lib_deps", + "lib_ignore", "lib_extra_dirs", "lib_ldf_mode", + "lib_compat_mode", "lib_archive", "piotest", + "test_transport", "test_filter", "test_ignore", + "test_port", "test_speed", "debug_tool", "debug_port", + "debug_init_cmds", "debug_extra_cmds", "debug_server", + "debug_init_break", "debug_load_cmd", + "debug_load_mode", "monitor_port", "monitor_baud", + "monitor_rts", "monitor_dtr") IGNORE_BUILD_OPTIONS = ("test_transport", "test_filter", "test_ignore", "test_port", "test_speed", "debug_port", @@ -231,7 +237,7 @@ class EnvironmentProcessor(object): v = self.RENAMED_PLATFORMS[v] # warn about unknown options - if k not in self.KNOWN_OPTIONS and not k.startswith("custom_"): + if k not in self.KNOWN_ENV_OPTIONS and not k.startswith("custom_"): click.secho( "Detected non-PlatformIO `%s` option in `[env:%s]` section" % (k, self.name), @@ -381,10 +387,8 @@ def print_summary(results, start_time): def check_project_defopts(config): if not config.has_section("platformio"): return True - known = ("env_default", "home_dir", "lib_dir", "libdeps_dir", "src_dir", - "build_dir", "data_dir", "test_dir", "boards_dir", - "lib_extra_dirs") - unknown = set([k for k, _ in config.items("platformio")]) - set(known) + unknown = set([k for k, _ in config.items("platformio")]) - set( + EnvironmentProcessor.KNOWN_PLATFORMIO_OPTIONS) if not unknown: return True click.secho( From bc323252e8ac9d6ce91cb99961aa7cb3bb6fb2f9 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Mar 2018 12:00:01 +0200 Subject: [PATCH 98/98] Bump version to 3.5.2 (issue #1301 issue #1313 issue #1323 issue #1303 issue #1029 issue #1310 issue #1390 issue #1312 issue #1433) --- HISTORY.rst | 2 +- platformio/__init__.py | 2 +- platformio/managers/core.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index f780dc9a..b672ab6c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,7 +4,7 @@ Release Notes PlatformIO 3.0 -------------- -3.5.2 (2018-??-??) +3.5.2 (2018-03-13) ~~~~~~~~~~~~~~~~~~ * `PlatformIO Home `__ - diff --git a/platformio/__init__.py b/platformio/__init__.py index 9bf36bd5..1a98a778 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 5, "2rc4") +VERSION = (3, 5, 2) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 99b59de1..9f3cc628 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -23,7 +23,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "contrib-piohome": ">=0.7.1,<2", "contrib-pysite": ">=0.1.5,<2", - "tool-pioplus": ">=0.14.3,<2", + "tool-pioplus": ">=0.14.5,<2", "tool-unity": "~1.20302.1", "tool-scons": "~2.20501.4" }