From d77dea5fe1ab0462923ae14fd37ba81c2c358c31 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 28 Mar 2017 21:47:54 +0300 Subject: [PATCH 001/155] Describe how to remove registry records by Atom on Windows --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index d20acf36..00f8cfe7 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit d20acf36318cda3594f03e7fb075810e9180d64c +Subproject commit 00f8cfe790bd9b7a7649acf45376f6f6df646a4b From fe7c93d0042abceac2b2bb2086a3d3e31af3aac1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 29 Mar 2017 17:49:01 +0300 Subject: [PATCH 002/155] =?UTF-8?q?Multi-line=20support=20for=20the=20diff?= =?UTF-8?q?erent=20options=20in=20=E2=80=9Cplatformio.ini=E2=80=9D=20//=20?= =?UTF-8?q?Resolve=20#889?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HISTORY.rst | 7 +++++++ platformio/__init__.py | 2 +- platformio/builder/main.py | 10 +++++++--- platformio/commands/run.py | 12 +++++++----- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index e10513ed..b0d95700 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,13 @@ Release Notes PlatformIO 3.0 -------------- +3.4.0 (2017-??-??) +~~~~~~~~~~~~~~~~~~ + +* Multi-line support for the different options in `Project Configuration File "platformio.ini" `__, + such as: ``build_flags``, ``build_unflags``, etc. + (`issue #889 `_) + 3.3.0 (2017-03-27) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index d5bbee86..1067bc86 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 3, 0) +VERSION = (3, 4, "0a1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 5fbc2174..3b9bf46d 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -106,6 +106,8 @@ env = DefaultEnvironment(**DEFAULT_ENV_OPTIONS) for k in commonvars.keys(): if k in env: env[k] = base64.b64decode(env[k]) + if "\n" in env[k]: + env[k] = [v.strip() for v in env[k].split("\n") if v.strip()] if env.GetOption('clean'): env.PioClean(env.subst("$BUILD_DIR")) @@ -121,21 +123,23 @@ for var in ("BUILD_FLAGS", "SRC_BUILD_FLAGS", "SRC_FILTER", "EXTRA_SCRIPT", continue if var in ("UPLOAD_PORT", "EXTRA_SCRIPT") or not env.get(var): env[var] = environ.get(k) + elif isinstance(env[var], list): + env.Append(**{var: environ.get(k)}) else: env[var] = "%s%s%s" % (environ.get(k), ", " if var == "LIB_EXTRA_DIRS" else " ", env[var]) # Parse comma separated items for opt in ("PIOFRAMEWORK", "LIB_DEPS", "LIB_IGNORE", "LIB_EXTRA_DIRS"): - if opt not in env: + if opt not in env or isinstance(env[opt], list): continue env[opt] = [l.strip() for l in env[opt].split(", ") if l.strip()] # Configure extra library source directories for LDF if util.get_project_optional_dir("lib_extra_dirs"): + items = util.get_project_optional_dir("lib_extra_dirs") env.Prepend(LIBSOURCE_DIRS=[ - l.strip() - for l in util.get_project_optional_dir("lib_extra_dirs").split(", ") + l.strip() for l in items.split("\n" if "\n" in items else ", ") if l.strip() ]) env.Prepend(LIBSOURCE_DIRS=env.get("LIB_EXTRA_DIRS", [])) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 36e56ff6..9818dd95 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -161,13 +161,15 @@ class EnvironmentProcessor(object): # multi-line values to one line for k, v in self.options.items(): if "\n" in v: - self.options[k] = self.options[k].strip().replace("\n", ", ") + self.options[k] = self.options[k].strip() 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, v) for k, v in self.options.items()]))) + click.echo("[%s] Processing %s (%s)" % + (datetime.now().strftime("%c"), click.style( + self.name, fg="cyan", bold=True), ", ".join([ + "%s: %s" % (k, v.replace("\n", ", ")) + for k, v in self.options.items() + ]))) click.secho("-" * terminal_width, bold=True) self.options = self._validate_options(self.options) From 75e1173f80515a8aacb41319ce8aa65d2c20423c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 31 Mar 2017 18:55:19 +0300 Subject: [PATCH 003/155] Initial support for debugging // Resolve #514 --- docs | 2 +- platformio/builder/main.py | 15 ++- platformio/builder/tools/piodebug.py | 98 ++++++++++++++++ platformio/builder/tools/pioide.py | 149 +++++++++++++++++++++++++ platformio/builder/tools/piomisc.py | 78 ------------- platformio/builder/tools/platformio.py | 3 + platformio/commands/debug.py | 39 +++++++ platformio/commands/run.py | 3 +- platformio/managers/core.py | 2 +- 9 files changed, 305 insertions(+), 84 deletions(-) create mode 100644 platformio/builder/tools/piodebug.py create mode 100644 platformio/builder/tools/pioide.py create mode 100644 platformio/commands/debug.py diff --git a/docs b/docs index 00f8cfe7..ecd4a795 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 00f8cfe790bd9b7a7649acf45376f6f6df646a4b +Subproject commit ecd4a795a4c72842d12711615b3ac6c1803dad01 diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 3b9bf46d..aa8428ed 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -62,13 +62,20 @@ commonvars.AddVariables( ("UPLOAD_PROTOCOL",), ("UPLOAD_SPEED",), ("UPLOAD_FLAGS",), - ("UPLOAD_RESETMETHOD",) + ("UPLOAD_RESETMETHOD",), + + # debug options + ("DEBUG_LINK",), + ("DEBUG_PORT",), + ("DEBUG_GDBINIT",) + ) # yapf: disable DEFAULT_ENV_OPTIONS = dict( tools=[ "ar", "as", "gcc", "g++", "gnulink", "platformio", "pioplatform", - "piowinhooks", "piolib", "piotest", "pioupload", "piomisc" + "piowinhooks", "piolib", "piotest", "pioupload", "piomisc", "pioide", + "piodebug" ], # yapf: disable toolpath=[join(util.get_source_dir(), "builder", "tools")], variables=commonvars, @@ -77,7 +84,6 @@ DEFAULT_ENV_OPTIONS = dict( PIOVARIABLES=commonvars.keys(), ENV=environ, UNIX_TIME=int(time()), - PROGNAME="program", PIOHOME_DIR=util.get_home_dir(), PROJECT_DIR=util.get_project_dir(), PROJECTSRC_DIR=util.get_projectsrc_dir(), @@ -91,6 +97,8 @@ DEFAULT_ENV_OPTIONS = dict( util.get_projectlib_dir(), util.get_projectlibdeps_dir(), join("$PIOHOME_DIR", "lib") ], + PROGNAME="program", + PROG_PATH=join("$BUILD_DIR", "$PROGNAME$PROGSUFFIX"), PYTHONEXE=util.get_pythonexe_path()) if not int(ARGUMENTS.get("PIOVERBOSE", 0)): @@ -150,6 +158,7 @@ env.SConscriptChdir(0) env.SConsignFile(join("$PROJECTPIOENVS_DIR", ".sconsign.dblite")) env.SConscript("$BUILD_SCRIPT") +AlwaysBuild(env.Alias("__debug", DEFAULT_TARGETS + ["size"])) AlwaysBuild(env.Alias("__test", DEFAULT_TARGETS + ["size"])) if "UPLOAD_FLAGS" in env: diff --git a/platformio/builder/tools/piodebug.py b/platformio/builder/tools/piodebug.py new file mode 100644 index 00000000..78ef4862 --- /dev/null +++ b/platformio/builder/tools/piodebug.py @@ -0,0 +1,98 @@ +# Copyright 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. + +from __future__ import absolute_import + +import sys +from fnmatch import fnmatch + +from platformio import util + + +def ProcessDebug(env): + env.Append( + BUILD_FLAGS=["-Og", "-ggdb"], + BUILD_UNFLAGS=["-Os", "-O0", "-O1", "-O2", "-O3"]) + + +def DebugLinkSettings(env): + if "BOARD" not in env: + return + board_debug = env.BoardConfig().get("debug") + if not board_debug or not board_debug.get("links"): + return + debug_links = board_debug.get("links") + link_name = (env.subst("$DEBUG_LINK") or + board_debug.get("default_link", debug_links.keys()[0])) + settings = debug_links.get(link_name) + if not settings: + return + settings.update({"name": link_name}) + return settings + + +def AutodetectDebugPort(env): + + def _get_pattern(): + if "DEBUG_PORT" not in env: + return None + if set(["*", "?", "[", "]"]) & set(env['DEBUG_PORT']): + return env['DEBUG_PORT'] + return None + + def _is_match_pattern(port): + pattern = _get_pattern() + if not pattern: + return True + return fnmatch(port, pattern) + + def _look_for_serial_port(hwids): + port = None + for item in util.get_serialports(filter_hwid=True): + if not _is_match_pattern(item['port']): + continue + if "GDB" in item['port']: + return item['port'] + for hwid in hwids: + hwid_str = ("%s:%s" % (hwid[0], hwid[1])).replace("0x", "") + if hwid_str in item['hwid']: + return port + return port + + if "BOARD" not in env or ("DEBUG_PORT" in env and not _get_pattern()): + return + + link_settings = env.DebugLinkSettings() + if not link_settings: + return + if not link_settings.get("require_debug_port"): + return + env.Replace( + DEBUG_PORT=_look_for_serial_port(link_settings.get("hwids", []))) + + if not env.subst("$DEBUG_PORT"): + sys.stderr.write( + "Error: Please specify `debug_port` for environment.\n") + env.Exit(1) + + +def exists(_): + return True + + +def generate(env): + env.AddMethod(ProcessDebug) + env.AddMethod(DebugLinkSettings) + env.AddMethod(AutodetectDebugPort) + return env diff --git a/platformio/builder/tools/pioide.py b/platformio/builder/tools/pioide.py new file mode 100644 index 00000000..95c7b974 --- /dev/null +++ b/platformio/builder/tools/pioide.py @@ -0,0 +1,149 @@ +# Copyright 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. + +from __future__ import absolute_import + +from glob import glob +from os.path import join + +from SCons.Defaults import processDefines + +from platformio import util + + +def dump_includes(env): + includes = [] + + for item in env.get("CPPPATH", []): + includes.append(env.subst(item)) + + # installed libs + for lb in env.GetLibBuilders(): + includes.extend(lb.get_inc_dirs()) + + # includes from toolchains + p = env.PioPlatform() + for name in p.get_installed_packages(): + if p.get_package_type(name) != "toolchain": + continue + toolchain_dir = util.glob_escape(p.get_package_dir(name)) + toolchain_incglobs = [ + join(toolchain_dir, "*", "include*"), + join(toolchain_dir, "lib", "gcc", "*", "*", "include*") + ] + for g in toolchain_incglobs: + includes.extend(glob(g)) + + return includes + + +def dump_defines(env): + defines = [] + # global symbols + for item in processDefines(env.get("CPPDEFINES", [])): + defines.append(env.subst(item).replace('\\', '')) + + # special symbol for Atmel AVR MCU + if env['PIOPLATFORM'] == "atmelavr": + defines.append( + "__AVR_%s__" % env.BoardConfig().get("build.mcu").upper() + .replace("ATMEGA", "ATmega").replace("ATTINY", "ATtiny")) + return defines + + +def dump_debug(env): + + def _dump_server(configuration): + if not configuration: + return + if not set(configuration.keys()) >= set(["package", "executable"]): + return + pkg_dir = env.PioPlatform().get_package_dir(configuration['package']) + if not pkg_dir: + return + return { + "cwd": pkg_dir, + "executable": configuration['executable'], + "arguments": configuration.get("arguments") + } + + gdbinit = None + if "DEBUG_GDBINIT" in env: + if isinstance(env['DEBUG_GDBINIT'], list): + gdbinit = env['DEBUG_GDBINIT'] + else: + gdbinit = [env['DEBUG_GDBINIT']] + + link_settings = env.DebugLinkSettings() + if link_settings and not gdbinit: + gdbinit = link_settings.get("gdbinit") + + env.AutodetectDebugPort() + + return { + "gdb_path": util.where_is_program( + env.subst("$GDB"), env.subst("${ENV['PATH']}")), + "prog_path": env.subst("$PROG_PATH"), + "link": link_settings['name'] if link_settings else None, + "gdbinit": [env.subst(cmd) for cmd in gdbinit] if gdbinit else None, + "port": env.subst("$DEBUG_PORT"), + "server": (_dump_server(link_settings['server']) + if link_settings and "server" in link_settings else None) + } + + +def DumpIDEData(env): + LINTCCOM = "$CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS" + LINTCXXCOM = "$CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS" + + data = { + "libsource_dirs": + [env.subst(l) for l in env.get("LIBSOURCE_DIRS", [])], + "defines": dump_defines(env), + "includes": dump_includes(env), + "debug": dump_debug(env), + "cc_flags": env.subst(LINTCCOM), + "cxx_flags": env.subst(LINTCXXCOM), + "cc_path": util.where_is_program( + env.subst("$CC"), env.subst("${ENV['PATH']}")), + "cxx_path": util.where_is_program( + env.subst("$CXX"), env.subst("${ENV['PATH']}")), + } + + env_ = env.Clone() + # https://github.com/platformio/platformio-atom-ide/issues/34 + _new_defines = [] + for item in processDefines(env_.get("CPPDEFINES", [])): + item = item.replace('\\"', '"') + if " " in item: + _new_defines.append(item.replace(" ", "\\\\ ")) + else: + _new_defines.append(item) + env_.Replace(CPPDEFINES=_new_defines) + + data.update({ + "cc_flags": env_.subst(LINTCCOM), + "cxx_flags": env_.subst(LINTCXXCOM) + }) + + return data + + +def exists(_): + return True + + +def generate(env): + env.AddMethod(DumpIDEData) + return env diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 2aa259e3..6dc3296a 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -17,13 +17,11 @@ from __future__ import absolute_import import atexit import re import sys -from glob import glob from os import environ, remove, walk from os.path import basename, isdir, isfile, join, relpath from tempfile import mkstemp from SCons.Action import Action -from SCons.Defaults import processDefines from SCons.Script import ARGUMENTS from platformio import util @@ -200,81 +198,6 @@ def _delete_file(path): pass -def DumpIDEData(env): - - def get_includes(env_): - includes = [] - - for item in env_.get("CPPPATH", []): - includes.append(env_.subst(item)) - - # installed libs - for lb in env.GetLibBuilders(): - includes.extend(lb.get_inc_dirs()) - - # includes from toolchains - p = env.PioPlatform() - for name in p.get_installed_packages(): - if p.get_package_type(name) != "toolchain": - continue - toolchain_dir = util.glob_escape(p.get_package_dir(name)) - toolchain_incglobs = [ - join(toolchain_dir, "*", "include*"), - join(toolchain_dir, "lib", "gcc", "*", "*", "include*") - ] - for g in toolchain_incglobs: - includes.extend(glob(g)) - - return includes - - def get_defines(env_): - defines = [] - # global symbols - for item in processDefines(env_.get("CPPDEFINES", [])): - defines.append(env_.subst(item).replace('\\', '')) - - # special symbol for Atmel AVR MCU - if env['PIOPLATFORM'] == "atmelavr": - defines.append( - "__AVR_%s__" % env.BoardConfig().get("build.mcu").upper() - .replace("ATMEGA", "ATmega").replace("ATTINY", "ATtiny")) - return defines - - LINTCCOM = "$CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS" - LINTCXXCOM = "$CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS" - env_ = env.Clone() - - data = { - "libsource_dirs": - [env_.subst(l) for l in env_.get("LIBSOURCE_DIRS", [])], - "defines": get_defines(env_), - "includes": get_includes(env_), - "cc_flags": env_.subst(LINTCCOM), - "cxx_flags": env_.subst(LINTCXXCOM), - "cc_path": util.where_is_program( - env_.subst("$CC"), env_.subst("${ENV['PATH']}")), - "cxx_path": util.where_is_program( - env_.subst("$CXX"), env_.subst("${ENV['PATH']}")) - } - - # https://github.com/platformio/platformio-atom-ide/issues/34 - _new_defines = [] - for item in processDefines(env_.get("CPPDEFINES", [])): - item = item.replace('\\"', '"') - if " " in item: - _new_defines.append(item.replace(" ", "\\\\ ")) - else: - _new_defines.append(item) - env_.Replace(CPPDEFINES=_new_defines) - - data.update({ - "cc_flags": env_.subst(LINTCCOM), - "cxx_flags": env_.subst(LINTCXXCOM) - }) - - return data - - def GetCompilerType(env): try: sysenv = environ.copy() @@ -352,7 +275,6 @@ def exists(_): def generate(env): env.AddMethod(ConvertInoToCpp) - env.AddMethod(DumpIDEData) env.AddMethod(GetCompilerType) env.AddMethod(GetActualLDScript) env.AddMethod(VerboseAction) diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index e23d78d0..fe67fb65 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -45,6 +45,9 @@ def BuildProgram(env): if not case_sensitive_suffixes(".s", ".S"): env.Replace(AS="$CC", ASCOM="$ASPPCOM") + if "__debug" in COMMAND_LINE_TARGETS: + env.ProcessDebug() + # process extra flags from board if "BOARD" in env and "build.extra_flags" in env.BoardConfig(): env.ProcessFlags(env.BoardConfig().get("build.extra_flags")) diff --git a/platformio/commands/debug.py b/platformio/commands/debug.py new file mode 100644 index 00000000..24acae6c --- /dev/null +++ b/platformio/commands/debug.py @@ -0,0 +1,39 @@ +# Copyright 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 sys +from os import getcwd + +import click + +from platformio.managers.core import pioplus_call + + +@click.command("debug", short_help="Project Debugger") +@click.option( + "-d", + "--project-dir", + default=getcwd, + type=click.Path( + exists=True, + file_okay=False, + dir_okay=True, + writable=True, + resolve_path=True)) +@click.option("--environment", "-e", metavar="") +@click.option("--configuration", is_flag=True) +@click.option("--json-output", is_flag=True) +@click.option("--verbose", "-v", is_flag=True) +def cli(*args, **kwargs): # pylint: disable=unused-argument + pioplus_call(sys.argv[1:]) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 9818dd95..bd8a77e7 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -129,7 +129,8 @@ class EnvironmentProcessor(object): "upload_port", "upload_protocol", "upload_speed", "upload_flags", "upload_resetmethod", "lib_install", "lib_deps", "lib_force", "lib_ignore", "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode", - "test_ignore", "test_port", "piotest") + "test_ignore", "test_port", "piotest", "debug_link", "debug_port", + "debug_gdbinit") REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"} diff --git a/platformio/managers/core.py b/platformio/managers/core.py index c711fcc6..7f838a7f 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "pysite-pioplus": ">=0.3.0,<2", - "tool-pioplus": ">=0.6.10,<2", + "tool-pioplus": ">=0.7.1,<2", "tool-unity": "~1.20302.1", "tool-scons": "~3.20501.2" } From 62e755ce609f75ef319ddd9837d9c1fd6452fd1e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 31 Mar 2017 19:50:26 +0300 Subject: [PATCH 004/155] =?UTF-8?q?Quick=20fix=20when=20board=20doesn?= =?UTF-8?q?=E2=80=99t=20have=20debug=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformio/builder/tools/piodebug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/builder/tools/piodebug.py b/platformio/builder/tools/piodebug.py index 78ef4862..e429e2dc 100644 --- a/platformio/builder/tools/piodebug.py +++ b/platformio/builder/tools/piodebug.py @@ -29,7 +29,7 @@ def ProcessDebug(env): def DebugLinkSettings(env): if "BOARD" not in env: return - board_debug = env.BoardConfig().get("debug") + board_debug = env.BoardConfig().get("debug", {}) if not board_debug or not board_debug.get("links"): return debug_links = board_debug.get("links") From 7a8aff47e954ac8ebded04a42ed5e75301155523 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 31 Mar 2017 20:20:07 +0300 Subject: [PATCH 005/155] Be silent when upper level asks --- 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 6adb753e..06b1c30f 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -607,7 +607,7 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin): name, requirements, url = self.parse_pkg_input(name, requirements) package_dir = self.get_package_dir(name, requirements, url) - if not package_dir or not silent: + if not package_dir and not silent: msg = "Installing " + click.style(name, fg="cyan") if requirements: msg += " @ " + requirements From 8055c84087e8c749835bce9c1ad529045b7c408a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Apr 2017 01:13:28 +0300 Subject: [PATCH 006/155] Add OpenOCD dev rules --- docs | 2 +- platformio/builder/tools/piodebug.py | 18 ++++ scripts/98-openocd-udev.rules | 153 +++++++++++++++++++++++++++ 3 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 scripts/98-openocd-udev.rules diff --git a/docs b/docs index ecd4a795..b40924ea 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ecd4a795a4c72842d12711615b3ac6c1803dad01 +Subproject commit b40924ea07c2de937a3812e6c3a362904475ad21 diff --git a/platformio/builder/tools/piodebug.py b/platformio/builder/tools/piodebug.py index e429e2dc..bb66121e 100644 --- a/platformio/builder/tools/piodebug.py +++ b/platformio/builder/tools/piodebug.py @@ -16,6 +16,8 @@ from __future__ import absolute_import import sys from fnmatch import fnmatch +from os.path import isfile +from platform import system from platformio import util @@ -78,6 +80,22 @@ def AutodetectDebugPort(env): return if not link_settings.get("require_debug_port"): return + + need_openocd_rules = [ + system() == "Linux", + "openocd" in link_settings.get("server", {}).get("package", ""), + not any([ + isfile("/etc/udev/rules.d/98-openocd-udev.rules"), + isfile("/lib/udev/rules.d/98-openocd-udev.rules") + ]) + ] + if all(need_openocd_rules): + sys.stderr.write( + "\nWarning! Please install `98-openocd-udev.rules` and check " + "that your debug adapter's PID and VID are listed in the rules." + "\n https://raw.githubusercontent.com/platformio/platformio" + "/develop/scripts/98-openocd-udev.rules\n") + env.Replace( DEBUG_PORT=_look_for_serial_port(link_settings.get("hwids", []))) diff --git a/scripts/98-openocd-udev.rules b/scripts/98-openocd-udev.rules new file mode 100644 index 00000000..f3a50711 --- /dev/null +++ b/scripts/98-openocd-udev.rules @@ -0,0 +1,153 @@ +# UDEV Rules for debug adapters/boards supported by OpenOCD +# +# 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 +# +# 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" From 73f4bce99aba797eb89f7947d90d96b2f42355b5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Apr 2017 14:35:55 +0300 Subject: [PATCH 007/155] =?UTF-8?q?Rename=20=E2=80=9Cdebug=5Flink=E2=80=9D?= =?UTF-8?q?=20option=20to=20=E2=80=9Cdebug=5Ftool=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs | 2 +- platformio/__init__.py | 2 +- platformio/builder/main.py | 2 +- platformio/builder/tools/piodebug.py | 26 +++++++++++++------------- platformio/builder/tools/pioide.py | 21 ++++++++++++--------- platformio/commands/run.py | 2 +- platformio/managers/core.py | 2 +- 7 files changed, 30 insertions(+), 27 deletions(-) diff --git a/docs b/docs index b40924ea..449625ca 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit b40924ea07c2de937a3812e6c3a362904475ad21 +Subproject commit 449625cac218da2319107c93950af591645747a6 diff --git a/platformio/__init__.py b/platformio/__init__.py index 1067bc86..04858912 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0a1") +VERSION = (3, 4, "0a2") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/builder/main.py b/platformio/builder/main.py index aa8428ed..f6d32c4b 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -65,7 +65,7 @@ commonvars.AddVariables( ("UPLOAD_RESETMETHOD",), # debug options - ("DEBUG_LINK",), + ("DEBUG_TOOL",), ("DEBUG_PORT",), ("DEBUG_GDBINIT",) diff --git a/platformio/builder/tools/piodebug.py b/platformio/builder/tools/piodebug.py index bb66121e..74c53253 100644 --- a/platformio/builder/tools/piodebug.py +++ b/platformio/builder/tools/piodebug.py @@ -28,19 +28,19 @@ def ProcessDebug(env): BUILD_UNFLAGS=["-Os", "-O0", "-O1", "-O2", "-O3"]) -def DebugLinkSettings(env): +def DebugToolSettings(env): if "BOARD" not in env: return board_debug = env.BoardConfig().get("debug", {}) - if not board_debug or not board_debug.get("links"): + if not board_debug or not board_debug.get("tools"): return - debug_links = board_debug.get("links") - link_name = (env.subst("$DEBUG_LINK") or - board_debug.get("default_link", debug_links.keys()[0])) - settings = debug_links.get(link_name) + debug_tools = board_debug.get("tools") + tool_name = (env.subst("$DEBUG_TOOL") or + board_debug.get("default_tool", debug_tools.keys()[0])) + settings = debug_tools.get(tool_name) if not settings: return - settings.update({"name": link_name}) + settings.update({"name": tool_name}) return settings @@ -75,15 +75,15 @@ def AutodetectDebugPort(env): if "BOARD" not in env or ("DEBUG_PORT" in env and not _get_pattern()): return - link_settings = env.DebugLinkSettings() - if not link_settings: + tool_settings = env.DebugToolSettings() + if not tool_settings: return - if not link_settings.get("require_debug_port"): + if not tool_settings.get("require_debug_port"): return need_openocd_rules = [ system() == "Linux", - "openocd" in link_settings.get("server", {}).get("package", ""), + "openocd" in tool_settings.get("server", {}).get("package", ""), not any([ isfile("/etc/udev/rules.d/98-openocd-udev.rules"), isfile("/lib/udev/rules.d/98-openocd-udev.rules") @@ -97,7 +97,7 @@ def AutodetectDebugPort(env): "/develop/scripts/98-openocd-udev.rules\n") env.Replace( - DEBUG_PORT=_look_for_serial_port(link_settings.get("hwids", []))) + DEBUG_PORT=_look_for_serial_port(tool_settings.get("hwids", []))) if not env.subst("$DEBUG_PORT"): sys.stderr.write( @@ -111,6 +111,6 @@ def exists(_): def generate(env): env.AddMethod(ProcessDebug) - env.AddMethod(DebugLinkSettings) + env.AddMethod(DebugToolSettings) env.AddMethod(AutodetectDebugPort) return env diff --git a/platformio/builder/tools/pioide.py b/platformio/builder/tools/pioide.py index 95c7b974..ce998a90 100644 --- a/platformio/builder/tools/pioide.py +++ b/platformio/builder/tools/pioide.py @@ -15,7 +15,7 @@ from __future__ import absolute_import from glob import glob -from os.path import join +from os.path import join, sep from SCons.Defaults import processDefines @@ -64,6 +64,9 @@ def dump_defines(env): def dump_debug(env): + def _fix_path_sep(path): + return path.replace("/", sep).replace("\\", sep) + def _dump_server(configuration): if not configuration: return @@ -74,8 +77,8 @@ def dump_debug(env): return return { "cwd": pkg_dir, - "executable": configuration['executable'], - "arguments": configuration.get("arguments") + "executable": _fix_path_sep(configuration['executable']), + "arguments": _fix_path_sep(configuration.get("arguments")) } gdbinit = None @@ -85,9 +88,9 @@ def dump_debug(env): else: gdbinit = [env['DEBUG_GDBINIT']] - link_settings = env.DebugLinkSettings() - if link_settings and not gdbinit: - gdbinit = link_settings.get("gdbinit") + tool_settings = env.DebugToolSettings() + if tool_settings and not gdbinit: + gdbinit = tool_settings.get("gdbinit") env.AutodetectDebugPort() @@ -95,11 +98,11 @@ def dump_debug(env): "gdb_path": util.where_is_program( env.subst("$GDB"), env.subst("${ENV['PATH']}")), "prog_path": env.subst("$PROG_PATH"), - "link": link_settings['name'] if link_settings else None, + "tool": tool_settings['name'] if tool_settings else None, "gdbinit": [env.subst(cmd) for cmd in gdbinit] if gdbinit else None, "port": env.subst("$DEBUG_PORT"), - "server": (_dump_server(link_settings['server']) - if link_settings and "server" in link_settings else None) + "server": (_dump_server(tool_settings['server']) + if tool_settings and "server" in tool_settings else None) } diff --git a/platformio/commands/run.py b/platformio/commands/run.py index bd8a77e7..f0643911 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -129,7 +129,7 @@ class EnvironmentProcessor(object): "upload_port", "upload_protocol", "upload_speed", "upload_flags", "upload_resetmethod", "lib_install", "lib_deps", "lib_force", "lib_ignore", "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode", - "test_ignore", "test_port", "piotest", "debug_link", "debug_port", + "test_ignore", "test_port", "piotest", "debug_tool", "debug_port", "debug_gdbinit") REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"} diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 7f838a7f..c0620855 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "pysite-pioplus": ">=0.3.0,<2", - "tool-pioplus": ">=0.7.1,<2", + "tool-pioplus": ">=0.7.3,<2", "tool-unity": "~1.20302.1", "tool-scons": "~3.20501.2" } From 48ed0a508ceb144ff9bffe3702ac5594f7004bdf Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Apr 2017 14:51:57 +0300 Subject: [PATCH 008/155] Correct path in debug configuration --- platformio/builder/tools/pioide.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platformio/builder/tools/pioide.py b/platformio/builder/tools/pioide.py index ce998a90..6c316d29 100644 --- a/platformio/builder/tools/pioide.py +++ b/platformio/builder/tools/pioide.py @@ -65,7 +65,11 @@ def dump_defines(env): def dump_debug(env): def _fix_path_sep(path): - return path.replace("/", sep).replace("\\", sep) + result = [] + items = path if isinstance(path, list) else [path] + for item in items: + result.append(item.replace("/", sep).replace("\\", sep)) + return result if isinstance(path, list) else result[0] def _dump_server(configuration): if not configuration: From 97185fffb87de0dbaa20b035b7f6f24bb4cf0029 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Apr 2017 15:40:52 +0300 Subject: [PATCH 009/155] Bump 3.4.0a3 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 04858912..42f41245 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0a2") +VERSION = (3, 4, "0a3") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From f4c9d0902027dab7b9da384b0b329b8bb15ad294 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Apr 2017 19:19:37 +0300 Subject: [PATCH 010/155] Typo fix --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 449625ca..83a1aff8 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 449625cac218da2319107c93950af591645747a6 +Subproject commit 83a1aff8eba544216e96dc2da1d79e8005642d22 From a60792d20e9ff6e50af3bc7f5121f39e760e1f40 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Apr 2017 23:26:02 +0300 Subject: [PATCH 011/155] Add temporary link to community forum for debugging discussion --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 83a1aff8..59a598a5 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 83a1aff8eba544216e96dc2da1d79e8005642d22 +Subproject commit 59a598a55f7b509926436bf4ea4a9be65c7358b9 From b5217682fdc90914e4b729b67cec47b7f87936a3 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 2 Apr 2017 21:58:38 +0300 Subject: [PATCH 012/155] Fix multi line items for lib_deps // Resolve #931 --- platformio/__init__.py | 2 +- platformio/commands/run.py | 14 +++++++------- platformio/managers/package.py | 2 +- platformio/telemetry.py | 5 ++++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 42f41245..46b06219 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0a3") +VERSION = (3, 4, "0a4") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/commands/run.py b/platformio/commands/run.py index f0643911..0565cd43 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -78,7 +78,7 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, if config.has_option("platformio", "env_default"): env_default = [ e.strip() - for e in config.get("platformio", "env_default").split(",") + for e in config.get("platformio", "env_default").split(", ") ] results = [] @@ -159,15 +159,13 @@ class EnvironmentProcessor(object): terminal_width, _ = click.get_terminal_size() start_time = time() - # multi-line values to one line for k, v in self.options.items(): - if "\n" in v: - self.options[k] = self.options[k].strip() + self.options[k] = self.options[k].strip() if not self.silent: click.echo("[%s] Processing %s (%s)" % (datetime.now().strftime("%c"), click.style( - self.name, fg="cyan", bold=True), ", ".join([ + self.name, fg="cyan", bold=True), "; ".join([ "%s: %s" % (k, v.replace("\n", ", ")) for k, v in self.options.items() ]))) @@ -236,7 +234,7 @@ class EnvironmentProcessor(object): if self.targets: targets = [t for t in self.targets] elif "targets" in self.options: - targets = self.options['targets'].split() + targets = self.options['targets'].split(", ") return targets def _run(self): @@ -258,7 +256,9 @@ class EnvironmentProcessor(object): ], self.verbose) if "lib_deps" in self.options: _autoinstall_libdeps(self.cmd_ctx, [ - d.strip() for d in self.options['lib_deps'].split(", ") + d.strip() + for d in self.options['lib_deps'].split( + "\n" if "\n" in self.options['lib_deps'] else ", ") if d.strip() ], self.verbose) diff --git a/platformio/managers/package.py b/platformio/managers/package.py index 06b1c30f..6adb753e 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -607,7 +607,7 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin): name, requirements, url = self.parse_pkg_input(name, requirements) package_dir = self.get_package_dir(name, requirements, url) - if not package_dir and not silent: + if not package_dir or not silent: msg = "Installing " + click.style(name, fg="cyan") if requirements: msg += " @ " + requirements diff --git a/platformio/telemetry.py b/platformio/telemetry.py index 8b3fd7a1..b614b4f7 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -278,7 +278,10 @@ def measure_ci(): def on_run_environment(options, targets): - opts = ["%s=%s" % (opt, value) for opt, value in sorted(options.items())] + opts = [ + "%s=%s" % (opt, value.replace("\n", ", ") if "\n" in value else value) + for opt, value in sorted(options.items()) + ] targets = [t.title() for t in targets or ["run"]] on_event("Env", " ".join(targets), "&".join(opts)) From ba17c57026c48d293408b7e323e1ca5089e8e492 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 12 Apr 2017 20:25:43 +0300 Subject: [PATCH 013/155] Update history --- HISTORY.rst | 8 ++++++++ docs | 2 +- examples | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index b0d95700..df3844fe 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -11,6 +11,14 @@ PlatformIO 3.0 such as: ``build_flags``, ``build_unflags``, etc. (`issue #889 `_) + +------- + +* Development platform `Espressif 32 `__ + + + Update ESP-IDF framework to v2.0 + + 3.3.0 (2017-03-27) ~~~~~~~~~~~~~~~~~~ diff --git a/docs b/docs index 59a598a5..9cae82ca 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 59a598a55f7b509926436bf4ea4a9be65c7358b9 +Subproject commit 9cae82ca3a787b752d17265001639bb1eed82347 diff --git a/examples b/examples index 60609b12..37a5fa53 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 60609b12231c46df6be2c8a0a5a7d42ca3bcc65d +Subproject commit 37a5fa5304b7880b786cbe34767fa07b45591786 From 59b65ba66864f7720f878462b925315aa5c6fa87 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 13 Apr 2017 20:02:08 +0300 Subject: [PATCH 014/155] Check mbed html page before uploading --- platformio/builder/tools/pioupload.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 7f2fd42e..8a1ce49b 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -107,7 +107,10 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument if (item['name'] and any([l in item['name'].lower() for l in msdlabels])): return item['disk'] - if isfile(join(item['disk'], "mbed.html")): + if any([ + isfile(join(item['disk'], n)) + for n in ("mbed.htm", "mbed.html") + ]): return item['disk'] return None From d16fd73b056582d150f0d79093c666c98997dec6 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 14 Apr 2017 18:05:15 +0300 Subject: [PATCH 015/155] Better detecting of mbed-enabled media disk --- platformio/builder/tools/pioupload.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 8a1ce49b..9949bc41 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -100,17 +100,17 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument return fnmatch(port, pattern) def _look_for_mbed_disk(): - msdlabels = ("mbed", "nucleo", "frdm", "microbit") + msdlabels = ("mbed", "nucleo", "frdm", "microbit", "node") for item in util.get_logicaldisks(): if not _is_match_pattern(item['disk']): continue if (item['name'] and any([l in item['name'].lower() for l in msdlabels])): return item['disk'] - if any([ - isfile(join(item['disk'], n)) - for n in ("mbed.htm", "mbed.html") - ]): + mbed_pages = [ + join(item['disk'], n) for n in ("mbed.htm", "mbed.html") + ] + if any([isfile(p) for p in mbed_pages]): return item['disk'] return None From c7249aadf33fff696f8d3ac0b91e66a3110c67f0 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 14 Apr 2017 23:16:52 +0300 Subject: [PATCH 016/155] =?UTF-8?q?Generate=20=E2=80=9CSRC=5FFILTER?= =?UTF-8?q?=E2=80=9D=20on-the-fly=20for=20a=20custom=20library?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs | 2 +- platformio/builder/tools/piolib.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs b/docs index 9cae82ca..310c5426 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 9cae82ca3a787b752d17265001639bb1eed82347 +Subproject commit 310c542680b833866ef3256bd0b28ea763e1a9cd diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 57163ee9..0531d65e 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -100,6 +100,9 @@ class LibBuilderBase(object): self._circular_deps = list() self._scanned_paths = list() + # reset source filter, could be overridden with extra script + self.env['SRC_FILTER'] = "" + # process extra options and append to build environment self.process_extra_options() @@ -225,6 +228,7 @@ class LibBuilderBase(object): self.env.ProcessUnFlags(self.build_unflags) self.env.ProcessFlags(self.build_flags) if self.extra_script: + self.env.SConscriptChdir(1) self.env.SConscript( realpath(self.extra_script), exports={"env": self.env, @@ -513,6 +517,8 @@ class PlatformIOLibBuilder(LibBuilderBase): def src_filter(self): if "srcFilter" in self._manifest.get("build", {}): return self._manifest.get("build").get("srcFilter") + elif self.env['SRC_FILTER']: + return self.env['SRC_FILTER'] elif self._is_arduino_manifest(): return ArduinoLibBuilder.src_filter.fget(self) return LibBuilderBase.src_filter.fget(self) From f194a1a5726d100838a17d75de55a61ad04e5029 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 15 Apr 2017 12:55:34 +0300 Subject: [PATCH 017/155] Fix debug port auto-detecting --- platformio/builder/tools/piodebug.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/platformio/builder/tools/piodebug.py b/platformio/builder/tools/piodebug.py index 74c53253..4f841c26 100644 --- a/platformio/builder/tools/piodebug.py +++ b/platformio/builder/tools/piodebug.py @@ -60,7 +60,6 @@ def AutodetectDebugPort(env): return fnmatch(port, pattern) def _look_for_serial_port(hwids): - port = None for item in util.get_serialports(filter_hwid=True): if not _is_match_pattern(item['port']): continue @@ -69,8 +68,8 @@ def AutodetectDebugPort(env): for hwid in hwids: hwid_str = ("%s:%s" % (hwid[0], hwid[1])).replace("0x", "") if hwid_str in item['hwid']: - return port - return port + return item['port'] + return None if "BOARD" not in env or ("DEBUG_PORT" in env and not _get_pattern()): return From 64ed76762e8502ddde9fb06733a7e416eaa45d29 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 15 Apr 2017 16:19:41 +0300 Subject: [PATCH 018/155] Update Git-submodules for development platforms and libraries which were installed from repository --- HISTORY.rst | 6 +++++- platformio/vcsclient.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index df3844fe..0f5843c4 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -10,7 +10,11 @@ PlatformIO 3.0 * Multi-line support for the different options in `Project Configuration File "platformio.ini" `__, such as: ``build_flags``, ``build_unflags``, etc. (`issue #889 `_) - +* Handle dynamic ``SRC_FILTER`` environment variable from + `library.json extra script `__ +* Improved auto-detecting of mbed-enabled media disks +* Update Git-submodules for development platforms and libraries which were + installed from repository ------- diff --git a/platformio/vcsclient.py b/platformio/vcsclient.py index 4b43e0a5..8a35e794 100644 --- a/platformio/vcsclient.py +++ b/platformio/vcsclient.py @@ -152,7 +152,7 @@ class GitClient(VCSClientBase): return True def update(self): - args = ["pull"] + args = ["pull", "--recurse-submodules"] return self.run_cmd(args) def get_current_revision(self): From 44be1dc1c79209f8b669e9a0ee902046791794c1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 15 Apr 2017 16:36:59 +0300 Subject: [PATCH 019/155] Some fixes for new PyLint --- platformio/__main__.py | 8 ++++---- platformio/app.py | 4 ++-- platformio/builder/tools/piomisc.py | 3 +-- platformio/builder/tools/platformio.py | 2 +- platformio/commands/lib.py | 10 +++++----- platformio/exception.py | 3 +-- platformio/managers/package.py | 3 +-- platformio/managers/platform.py | 6 ++---- platformio/util.py | 9 ++++----- tox.ini | 3 +-- 10 files changed, 22 insertions(+), 29 deletions(-) diff --git a/platformio/__main__.py b/platformio/__main__.py index 72502afa..3dd83244 100644 --- a/platformio/__main__.py +++ b/platformio/__main__.py @@ -37,16 +37,16 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904 cmds.sort() return cmds - def get_command(self, ctx, name): + def get_command(self, ctx, cmd_name): mod = None try: - mod = __import__("platformio.commands." + name, None, None, + mod = __import__("platformio.commands." + cmd_name, None, None, ["cli"]) except ImportError: try: - return self._handle_obsolate_command(name) + return self._handle_obsolate_command(cmd_name) except AttributeError: - raise click.UsageError('No such command "%s"' % name, ctx) + raise click.UsageError('No such command "%s"' % cmd_name, ctx) return mod.cli @staticmethod diff --git a/platformio/app.py b/platformio/app.py index e6cbc0b2..79fa9c01 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -156,7 +156,7 @@ class ContentCache(object): found = True if isfile(path): remove(path) - if not len(listdir(dirname(path))): + if not listdir(dirname(path)): util.rmtree_(dirname(path)) if found and self._lock_dbindex(): @@ -228,7 +228,7 @@ class ContentCache(object): if not isdir(dirname(cache_path)): os.makedirs(dirname(cache_path)) with open(cache_path, "wb") as fp: - if isinstance(data, dict) or isinstance(data, list): + if isinstance(data, (dict, list)): json.dump(data, fp) else: fp.write(str(data)) diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 6dc3296a..ba6f496e 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -252,8 +252,7 @@ def GetActualLDScript(env): def VerboseAction(_, act, actstr): if int(ARGUMENTS.get("PIOVERBOSE", 0)): return act - else: - return Action(act, actstr) + return Action(act, actstr) def PioClean(env, clean_dir): diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index fe67fb65..8b09e248 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -186,7 +186,7 @@ def MatchSourceFiles(env, src_dir, src_filter=None): src_dir = env.subst(src_dir) src_filter = src_filter or SRC_FILTER_DEFAULT - if isinstance(src_filter, list) or isinstance(src_filter, tuple): + if isinstance(src_filter, (list, tuple)): src_filter = " ".join(src_filter) matches = set() diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index 068c96b5..45984157 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -295,14 +295,14 @@ def lib_builtin(storage, json_output): if json_output: return click.echo(json.dumps(items)) - for storage in items: - if not storage['items']: + for storage_ in items: + if not storage_['items']: continue - click.secho(storage['name'], fg="green") - click.echo("*" * len(storage['name'])) + click.secho(storage_['name'], fg="green") + click.echo("*" * len(storage_['name'])) click.echo() - for item in sorted(storage['items'], key=lambda i: i['name']): + for item in sorted(storage_['items'], key=lambda i: i['name']): print_lib_item(item) diff --git a/platformio/exception.py b/platformio/exception.py index 0f0530b6..346156c7 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -20,8 +20,7 @@ class PlatformioException(Exception): def __str__(self): # pragma: no cover if self.MESSAGE: return self.MESSAGE.format(*self.args) - else: - return Exception.__str__(self) + return Exception.__str__(self) class ReturnErrorCode(PlatformioException): diff --git a/platformio/managers/package.py b/platformio/managers/package.py index 6adb753e..efae4803 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -69,8 +69,7 @@ class PackageRepoIterator(object): if self.package in manifest: return manifest[self.package] - else: - return self.next() + return self.next() class PkgRepoMixin(object): diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index 99a38d86..ccd89b15 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -63,7 +63,7 @@ class PlatformManager(BasePkgManager): skip_default_package=False, trigger_event=True, silent=False, - **_): # pylint: disable=too-many-arguments + **_): # pylint: disable=too-many-arguments, arguments-differ platform_dir = BasePkgManager.install( self, name, requirements, silent=silent) p = PlatformFactory.newPlatform(platform_dir) @@ -305,9 +305,7 @@ class PlatformPackagesMixin(object): version = self.packages[name].get("version", "") if self.is_valid_requirements(version): return self.pm.get_package_dir(name, version) - else: - return self.pm.get_package_dir(*self._parse_pkg_input(name, - version)) + return self.pm.get_package_dir(*self._parse_pkg_input(name, version)) def get_package_version(self, name): pkg_dir = self.get_package_dir(name) diff --git a/platformio/util.py b/platformio/util.py index 4d345830..2f260bb5 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -46,7 +46,7 @@ class ProjectConfig(ConfigParser): VARTPL_RE = re.compile(r"\$\{([^\.\}]+)\.([^\}]+)\}") - def items(self, section, **_): + def items(self, section, **_): # pylint: disable=arguments-differ items = [] for option in ConfigParser.options(self, section): items.append((option, self.get(section, option))) @@ -130,10 +130,9 @@ class memoized(object): return self.func(*args) if args in self.cache: return self.cache[args] - else: - value = self.func(*args) - self.cache[args] = value - return value + value = self.func(*args) + self.cache[args] = value + return value def __repr__(self): '''Return the function's docstring.''' diff --git a/tox.ini b/tox.ini index 0c09acce..406d179c 100644 --- a/tox.ini +++ b/tox.ini @@ -21,10 +21,9 @@ usedevelop = True deps = isort flake8 - yapf + yapf<0.16 pylint pytest - show commands = python --version [testenv:docs] From abb2fb70450b0f406b0f5be50d0ef15b82ec1d10 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 15 Apr 2017 16:51:15 +0300 Subject: [PATCH 020/155] =?UTF-8?q?Add=20support=20for=20=E2=80=9C.*cc?= =?UTF-8?q?=E2=80=9D=20extension=20//=20Resolve=20#939?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HISTORY.rst | 6 ++++-- platformio/builder/tools/piolib.py | 3 ++- platformio/builder/tools/platformio.py | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 0f5843c4..5b4f13df 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -13,8 +13,10 @@ PlatformIO 3.0 * Handle dynamic ``SRC_FILTER`` environment variable from `library.json extra script `__ * Improved auto-detecting of mbed-enabled media disks -* Update Git-submodules for development platforms and libraries which were - installed from repository +* Automatically update Git-submodules for development platforms and libraries + that were installed from repository +* Add support for ``.*cc`` extension + (`issue #939 `_) ------- diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 0531d65e..1daedc6b 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -65,7 +65,8 @@ class LibBuilderFactory(object): # check source files for root, _, files in os.walk(path, followlinks=True): for fname in files: - if not env.IsFileWithExt(fname, ("c", "cpp", "h", "hpp")): + if not env.IsFileWithExt( + fname, piotool.SRC_BUILD_EXT + piotool.SRC_HEADER_EXT): continue with open(join(root, fname)) as f: content = f.read() diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 8b09e248..1f2186cf 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -27,7 +27,7 @@ from SCons.Util import case_sensitive_suffixes, is_Sequence from platformio.util import glob_escape, pioversion_to_intstr -SRC_BUILD_EXT = ["c", "cpp", "S", "spp", "SPP", "sx", "s", "asm", "ASM"] +SRC_BUILD_EXT = ["c", "cc", "cpp", "S", "spp", "SPP", "sx", "s", "asm", "ASM"] SRC_HEADER_EXT = ["h", "hpp"] SRC_FILTER_DEFAULT = ["+<*>", "-<.git%s>" % sep, "-" % sep] From d0f2aa38ca6379795139f25fe2fc97f5e4dc6d0e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 15 Apr 2017 20:32:11 +0300 Subject: [PATCH 021/155] Fixed infinite dependency installing when repository consists of multiple libraries // Resolve #935 --- HISTORY.rst | 3 +++ platformio/managers/lib.py | 2 +- platformio/managers/package.py | 30 +++++++++++++++--------------- tests/commands/test_lib.py | 16 +++++++++++++--- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 5b4f13df..354daa46 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -17,6 +17,9 @@ PlatformIO 3.0 that were installed from repository * Add support for ``.*cc`` extension (`issue #939 `_) +* Fixed infinite dependency installing when repository consists of multiple + libraries + (`issue #935 `_) ------- diff --git a/platformio/managers/lib.py b/platformio/managers/lib.py index 68bc1ce7..32cf6308 100644 --- a/platformio/managers/lib.py +++ b/platformio/managers/lib.py @@ -64,7 +64,7 @@ class LibraryManager(BasePkgManager): if not manifest: return manifest - # if Arudino library.properties + # if Arduino library.properties if "sentence" in manifest: manifest['frameworks'] = ["arduino"] manifest['description'] = manifest['sentence'] diff --git a/platformio/managers/package.py b/platformio/managers/package.py index efae4803..5521325e 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -197,6 +197,8 @@ class PkgInstallerMixin(object): return name def get_src_manifest_path(self, pkg_dir): + if not isdir(pkg_dir): + return None for item in os.listdir(pkg_dir): if not isdir(join(pkg_dir, item)): continue @@ -223,20 +225,19 @@ class PkgInstallerMixin(object): if result: return result - manifest_path = self.get_manifest_path(pkg_dir) - if not manifest_path: - return None - - # if non-registry packages: VCS or archive - src_manifest_path = self.get_src_manifest_path(pkg_dir) + manifest = {} src_manifest = None + manifest_path = self.get_manifest_path(pkg_dir) + src_manifest_path = self.get_src_manifest_path(pkg_dir) if src_manifest_path: src_manifest = util.load_json(src_manifest_path) - manifest = {} - if manifest_path.endswith(".json"): + if not manifest_path and not src_manifest_path: + return None + + if manifest_path and manifest_path.endswith(".json"): manifest = util.load_json(manifest_path) - elif manifest_path.endswith(".properties"): + elif manifest_path and manifest_path.endswith(".properties"): with codecs.open(manifest_path, encoding="utf-8") as fp: for line in fp.readlines(): if "=" not in line: @@ -344,7 +345,6 @@ class PkgInstallerMixin(object): requirements=None, sha1=None, track=False): - pkg_dir = None tmp_dir = mkdtemp("-package", "_tmp_installing-", self.package_dir) src_manifest_dir = None src_manifest = {"name": name, "url": url, "requirements": requirements} @@ -368,19 +368,19 @@ class PkgInstallerMixin(object): src_manifest_dir = vcs.storage_dir src_manifest['version'] = vcs.get_current_revision() - pkg_dir = self.find_pkg_root(tmp_dir) - # write source data to a special manifest + _tmp_dir = tmp_dir if track: if not src_manifest_dir: - src_manifest_dir = join(pkg_dir, ".pio") + _tmp_dir = self.find_pkg_root(tmp_dir) + src_manifest_dir = join(_tmp_dir, ".pio") self._update_src_manifest(src_manifest, src_manifest_dir) - pkg_dir = self._install_from_tmp_dir(pkg_dir, requirements) + return self._install_from_tmp_dir(_tmp_dir, requirements) finally: if isdir(tmp_dir): util.rmtree_(tmp_dir) - return pkg_dir + return def _update_src_manifest(self, data, src_dir): if not isdir(src_dir): diff --git a/tests/commands/test_lib.py b/tests/commands/test_lib.py index d0ae5665..104213af 100644 --- a/tests/commands/test_lib.py +++ b/tests/commands/test_lib.py @@ -112,6 +112,7 @@ def test_global_install_repository(clirunner, validate_cliresult, "https://github.com/gioblu/PJON.git#6.2", "https://github.com/bblanchon/ArduinoJson.git", "https://gitlab.com/ivankravets/rs485-nodeproto.git", + "https://github.com/platformio/platformio-libmirror.git", # "https://developer.mbed.org/users/simon/code/TextLCD/", "knolleary/pubsubclient" ]) @@ -124,6 +125,14 @@ def test_global_install_repository(clirunner, validate_cliresult, ] assert set(items1) >= set(items2) + # check lib with duplicate URL + result = clirunner.invoke(cmd_lib, [ + "-g", "install", + "https://github.com/platformio/platformio-libmirror.git" + ]) + validate_cliresult(result) + assert "is already installed" in result.output + def test_global_lib_list(clirunner, validate_cliresult, isolated_pio_home): result = clirunner.invoke(cmd_lib, ["-g", "list"]) @@ -141,7 +150,8 @@ def test_global_lib_list(clirunner, validate_cliresult, isolated_pio_home): items2 = [ "OneWire", "DHT22", "PJON", "ESPAsyncTCP", "ArduinoJson", "PubSubClient", "rs485-nodeproto", "Adafruit ST7735 Library", - "RadioHead-1.62", "DallasTemperature", "NeoPixelBus", "IRremoteESP8266" + "RadioHead-1.62", "DallasTemperature", "NeoPixelBus", + "IRremoteESP8266", "platformio-libmirror" ] assert set(items1) == set(items2) @@ -175,7 +185,7 @@ def test_global_lib_update(clirunner, validate_cliresult, isolated_pio_home): validate_cliresult(result) validate_cliresult(result) assert result.output.count("[Skip]") == 5 - assert result.output.count("[Up-to-date]") == 9 + assert result.output.count("[Up-to-date]") == 10 assert "Uninstalling ArduinoJson @ 5.7.3" in result.output assert "Uninstalling IRremoteESP8266 @ fee16e880b" in result.output @@ -208,7 +218,7 @@ def test_global_lib_uninstall(clirunner, validate_cliresult, "ArduinoJson", "ArduinoJson_ID64@5.6.7", "DallasTemperature_ID54", "DHT22_ID58", "ESPAsyncTCP_ID305", "NeoPixelBus_ID547", "PJON", "PJON@src-79de467ebe19de18287becff0a1fb42d", "PubSubClient", - "RadioHead-1.62", "rs485-nodeproto" + "RadioHead-1.62", "rs485-nodeproto", "platformio-libmirror" ] assert set(items1) == set(items2) From dff3c7d093ab12646fba098acde366057a4a1599 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 15 Apr 2017 21:02:47 +0300 Subject: [PATCH 022/155] Bump 3.4.0a5 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 46b06219..b679528f 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0a4") +VERSION = (3, 4, "0a5") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From bd4636c98f9d3371375472d4395b59ce9e7f5487 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 15 Apr 2017 21:28:01 +0300 Subject: [PATCH 023/155] Fix installing package from archive --- platformio/managers/package.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/platformio/managers/package.py b/platformio/managers/package.py index 5521325e..ce73c5d8 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -368,12 +368,13 @@ class PkgInstallerMixin(object): src_manifest_dir = vcs.storage_dir src_manifest['version'] = vcs.get_current_revision() - # write source data to a special manifest _tmp_dir = tmp_dir + if not src_manifest_dir: + _tmp_dir = self.find_pkg_root(tmp_dir) + src_manifest_dir = join(_tmp_dir, ".pio") + + # write source data to a special manifest if track: - if not src_manifest_dir: - _tmp_dir = self.find_pkg_root(tmp_dir) - src_manifest_dir = join(_tmp_dir, ".pio") self._update_src_manifest(src_manifest, src_manifest_dir) return self._install_from_tmp_dir(_tmp_dir, requirements) From a63592894c40700e1a118e88f185bb68eae42abe Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 15 Apr 2017 21:28:23 +0300 Subject: [PATCH 024/155] Bump 3.4.0a6 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index b679528f..18b57ffa 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0a5") +VERSION = (3, 4, "0a6") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From e976c617f7d10925deb3baf1819ff6aef4b7690e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 24 Apr 2017 13:35:08 +0300 Subject: [PATCH 025/155] Note about LDF and Dependency Finder Mode --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 310c5426..df9accd1 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 310c542680b833866ef3256bd0b28ea763e1a9cd +Subproject commit df9accd13b4c4a9cf379b09e8b032c61b36aab43 From ae3aeeca691e836ad47d9c9faedd9919b6c6e529 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 24 Apr 2017 16:25:01 +0300 Subject: [PATCH 026/155] Update history --- HISTORY.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 354daa46..8bcb39ad 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -25,7 +25,9 @@ PlatformIO 3.0 * Development platform `Espressif 32 `__ + + Add support for FireBeetle-ESP32 and IntoRobot Fig + Update ESP-IDF framework to v2.0 + + Update core for Arduino framework 3.3.0 (2017-03-27) From 1344ab5bb60ba775474201f48d4c13f1213ba76a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 25 Apr 2017 19:53:21 +0300 Subject: [PATCH 027/155] Typo fix with account register command --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index df9accd1..f4fb5abd 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit df9accd13b4c4a9cf379b09e8b032c61b36aab43 +Subproject commit f4fb5abdb3f3528f7fe7ceb9238750072050a497 From 6b0467ead53ab3e925a354b62a61116262308125 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 27 Apr 2017 18:28:50 +0300 Subject: [PATCH 028/155] Use internal context to fetch IDE data --- platformio/ide/projectgenerator.py | 27 ++++++++++++++++----------- platformio/util.py | 9 +++++++++ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index e1efa469..711e01af 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -15,11 +15,14 @@ import json import os import re +from cStringIO import StringIO from os.path import abspath, basename, expanduser, isdir, isfile, join, relpath import bottle +import click -from platformio import app, exception, util +from platformio import exception, util +from platformio.commands.run import cli as cmd_run class ProjectGenerator(object): @@ -61,18 +64,20 @@ class ProjectGenerator(object): envdata = self.get_project_env() if "env_name" not in envdata: return data - cmd = [util.get_pythonexe_path(), "-m", "platformio", "-f"] - if app.get_session_var("caller_id"): - cmd.extend(["-c", app.get_session_var("caller_id")]) - cmd.extend(["run", "-t", "idedata", "-e", envdata['env_name']]) - cmd.extend(["-d", self.project_dir]) - result = util.exec_command(cmd) - if result['returncode'] != 0 or '"includes":' not in result['out']: - raise exception.PlatformioException( - "\n".join([result['out'], result['err']])) + out = StringIO() + with util.capture_stdout(out): + click.get_current_context().invoke( + cmd_run, + project_dir=self.project_dir, + environment=[envdata['env_name']], + target=["idedata"]) + result = out.getvalue() - for line in result['out'].split("\n"): + if '"includes":' not in result: + raise exception.PlatformioException(result) + + for line in result.split("\n"): line = line.strip() if line.startswith('{"') and line.endswith("}"): data = json.loads(line) diff --git a/platformio/util.py b/platformio/util.py index 2f260bb5..ddeccc5e 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -22,6 +22,7 @@ import socket import stat import subprocess import sys +from contextlib import contextmanager from glob import glob from os.path import (abspath, basename, dirname, expanduser, isdir, isfile, join, normpath, splitdrive) @@ -160,6 +161,14 @@ def singleton(cls): return get_instance +@contextmanager +def capture_stdout(output): + stdout = sys.stdout + sys.stdout = output + yield + sys.stdout = stdout + + def load_json(file_path): try: with open(file_path, "r") as f: From 384c3c45e4a843347c812c1a91bb6628f1377d23 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 27 Apr 2017 18:30:40 +0300 Subject: [PATCH 029/155] =?UTF-8?q?Add=20=E2=80=9Cboards=5Fdir=E2=80=9D=20?= =?UTF-8?q?to=20known=20[platformio]=20option=20//=20Resolve=20#949?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformio/commands/run.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 0565cd43..8c6e42ca 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -358,8 +358,9 @@ def print_summary(results, start_time): def check_project_defopts(config): if not config.has_section("platformio"): return True - known = ("home_dir", "lib_dir", "libdeps_dir", "src_dir", "envs_dir", - "data_dir", "test_dir", "env_default", "lib_extra_dirs") + known = ("env_default", "home_dir", "lib_dir", "libdeps_dir", "src_dir", + "envs_dir", "data_dir", "test_dir", "boards_dir", + "lib_extra_dirs") unknown = set([k for k, _ in config.items("platformio")]) - set(known) if not unknown: return True From 3d2df9f9a9bcb68f2db88c11480851711f1e4a79 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 27 Apr 2017 18:39:57 +0300 Subject: [PATCH 030/155] Fix linter error "unity.h does not exist" for Unit Testing // Resolve #947 --- HISTORY.rst | 4 ++++ platformio/builder/tools/pioide.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 8bcb39ad..f6c3274e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -20,6 +20,10 @@ PlatformIO 3.0 * Fixed infinite dependency installing when repository consists of multiple libraries (`issue #935 `_) +* Don't warn about known ``boards_dir`` option + (`pull #949 `_) +* Fixed linter error "unity.h does not exist" for Unit Testing + (`issue #947 `_) ------- diff --git a/platformio/builder/tools/pioide.py b/platformio/builder/tools/pioide.py index 6c316d29..4b4e7fdd 100644 --- a/platformio/builder/tools/pioide.py +++ b/platformio/builder/tools/pioide.py @@ -20,6 +20,7 @@ from os.path import join, sep from SCons.Defaults import processDefines from platformio import util +from platformio.managers.core import get_core_package_dir def dump_includes(env): @@ -45,6 +46,10 @@ def dump_includes(env): for g in toolchain_incglobs: includes.extend(glob(g)) + unity_dir = get_core_package_dir("tool-unity") + if unity_dir: + includes.append(unity_dir) + return includes From 969e72c4a41975770f3d17a027f0c78076922654 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 27 Apr 2017 20:01:17 +0300 Subject: [PATCH 031/155] =?UTF-8?q?Fix=20issue=20when=20Library=20Dependen?= =?UTF-8?q?cy=20Finder=20(LDF)=20does=20not=20handle=20custom=20=E2=80=9Cs?= =?UTF-8?q?rc=5Fdir=E2=80=9D=20//=20Resolve=20#942?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HISTORY.rst | 3 +++ platformio/builder/tools/piolib.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index f6c3274e..82e88c12 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -24,6 +24,9 @@ PlatformIO 3.0 (`pull #949 `_) * Fixed linter error "unity.h does not exist" for Unit Testing (`issue #947 `_) +* Fixed issue when `Library Dependency Finder (LDF) `__ + does not handle custom ``src_dir`` + (`issue #942 `_) ------- diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 1daedc6b..4798f24d 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -411,6 +411,10 @@ class ProjectAsLibBuilder(LibBuilderBase): LibBuilderBase.__init__(self, *args, **kwargs) self._is_built = True + @property + def src_dir(self): + return self.env.subst("$PROJECTSRC_DIR") + @property def lib_ldf_mode(self): mode = LibBuilderBase.lib_ldf_mode.fget(self) From 81c96808b604d3b52dfdeaea0a4aa0f558af7175 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 27 Apr 2017 20:53:54 +0300 Subject: [PATCH 032/155] =?UTF-8?q?Don=E2=80=99t=20override=20LED=5FBUILTI?= =?UTF-8?q?N=20with=20macro;=20sometime=20it=20is=20defined=20as=20static?= =?UTF-8?q?=20variable=20//=20Resolve=20#933?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs | 2 +- examples | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index f4fb5abd..723f9369 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit f4fb5abdb3f3528f7fe7ceb9238750072050a497 +Subproject commit 723f9369f5fcc77936b473834abdd4bb6c397806 diff --git a/examples b/examples index 37a5fa53..9d57e3c8 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 37a5fa5304b7880b786cbe34767fa07b45591786 +Subproject commit 9d57e3c84dd738dcb1597a6d8611d9f6feca327d From 9658bcdb73535d928d342815226a1cc948a2e356 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 28 Apr 2017 01:38:25 +0300 Subject: [PATCH 033/155] The Unified Debugger --- platformio/__main__.py | 15 ++-- platformio/builder/main.py | 10 +-- platformio/builder/tools/piodebug.py | 115 --------------------------- platformio/builder/tools/pioide.py | 54 +------------ platformio/builder/tools/piomisc.py | 33 +++++++- platformio/builder/tools/piotest.py | 48 ----------- platformio/commands/debug.py | 9 ++- platformio/commands/run.py | 23 +++--- platformio/maintenance.py | 7 +- platformio/managers/core.py | 2 +- platformio/managers/platform.py | 12 +++ setup.py | 1 + 12 files changed, 87 insertions(+), 242 deletions(-) delete mode 100644 platformio/builder/tools/piodebug.py delete mode 100644 platformio/builder/tools/piotest.py diff --git a/platformio/__main__.py b/platformio/__main__.py index 3dd83244..da14d0dc 100644 --- a/platformio/__main__.py +++ b/platformio/__main__.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from os import getenv, listdir +import os +import sys from os.path import join from platform import system -from sys import exit as sys_exit from traceback import format_exc import click @@ -29,7 +29,7 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904 def list_commands(self, ctx): cmds = [] - for filename in listdir(join(get_source_dir(), "commands")): + for filename in os.listdir(join(get_source_dir(), "commands")): if filename.startswith("__init__"): continue if filename.endswith(".py"): @@ -96,7 +96,7 @@ def main(): "< https://github.com/platformio/platformio-core/issues/252 >") # handle PLATFORMIO_FORCE_COLOR - if str(getenv("PLATFORMIO_FORCE_COLOR", "")).lower() == "true": + if str(os.getenv("PLATFORMIO_FORCE_COLOR", "")).lower() == "true": try: # pylint: disable=protected-access click._compat.isatty = lambda stream: True @@ -133,5 +133,10 @@ An unexpected error occurred. Further steps: return 0 +def debug_gdb_main(): + sys.argv = [sys.argv[0], "debug", "--interface", "gdb"] + sys.argv[1:] + return main() + + if __name__ == "__main__": - sys_exit(main()) + sys.exit(main()) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index f6d32c4b..83eb6029 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -62,20 +62,14 @@ commonvars.AddVariables( ("UPLOAD_PROTOCOL",), ("UPLOAD_SPEED",), ("UPLOAD_FLAGS",), - ("UPLOAD_RESETMETHOD",), - - # debug options - ("DEBUG_TOOL",), - ("DEBUG_PORT",), - ("DEBUG_GDBINIT",) + ("UPLOAD_RESETMETHOD",) ) # yapf: disable DEFAULT_ENV_OPTIONS = dict( tools=[ "ar", "as", "gcc", "g++", "gnulink", "platformio", "pioplatform", - "piowinhooks", "piolib", "piotest", "pioupload", "piomisc", "pioide", - "piodebug" + "piowinhooks", "piolib", "pioupload", "piomisc", "pioide" ], # yapf: disable toolpath=[join(util.get_source_dir(), "builder", "tools")], variables=commonvars, diff --git a/platformio/builder/tools/piodebug.py b/platformio/builder/tools/piodebug.py deleted file mode 100644 index 4f841c26..00000000 --- a/platformio/builder/tools/piodebug.py +++ /dev/null @@ -1,115 +0,0 @@ -# Copyright 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. - -from __future__ import absolute_import - -import sys -from fnmatch import fnmatch -from os.path import isfile -from platform import system - -from platformio import util - - -def ProcessDebug(env): - env.Append( - BUILD_FLAGS=["-Og", "-ggdb"], - BUILD_UNFLAGS=["-Os", "-O0", "-O1", "-O2", "-O3"]) - - -def DebugToolSettings(env): - if "BOARD" not in env: - return - board_debug = env.BoardConfig().get("debug", {}) - if not board_debug or not board_debug.get("tools"): - return - debug_tools = board_debug.get("tools") - tool_name = (env.subst("$DEBUG_TOOL") or - board_debug.get("default_tool", debug_tools.keys()[0])) - settings = debug_tools.get(tool_name) - if not settings: - return - settings.update({"name": tool_name}) - return settings - - -def AutodetectDebugPort(env): - - def _get_pattern(): - if "DEBUG_PORT" not in env: - return None - if set(["*", "?", "[", "]"]) & set(env['DEBUG_PORT']): - return env['DEBUG_PORT'] - return None - - def _is_match_pattern(port): - pattern = _get_pattern() - if not pattern: - return True - return fnmatch(port, pattern) - - def _look_for_serial_port(hwids): - for item in util.get_serialports(filter_hwid=True): - if not _is_match_pattern(item['port']): - continue - if "GDB" in item['port']: - return item['port'] - for hwid in hwids: - hwid_str = ("%s:%s" % (hwid[0], hwid[1])).replace("0x", "") - if hwid_str in item['hwid']: - return item['port'] - return None - - if "BOARD" not in env or ("DEBUG_PORT" in env and not _get_pattern()): - return - - tool_settings = env.DebugToolSettings() - if not tool_settings: - return - if not tool_settings.get("require_debug_port"): - return - - need_openocd_rules = [ - system() == "Linux", - "openocd" in tool_settings.get("server", {}).get("package", ""), - not any([ - isfile("/etc/udev/rules.d/98-openocd-udev.rules"), - isfile("/lib/udev/rules.d/98-openocd-udev.rules") - ]) - ] - if all(need_openocd_rules): - sys.stderr.write( - "\nWarning! Please install `98-openocd-udev.rules` and check " - "that your debug adapter's PID and VID are listed in the rules." - "\n https://raw.githubusercontent.com/platformio/platformio" - "/develop/scripts/98-openocd-udev.rules\n") - - env.Replace( - DEBUG_PORT=_look_for_serial_port(tool_settings.get("hwids", []))) - - if not env.subst("$DEBUG_PORT"): - sys.stderr.write( - "Error: Please specify `debug_port` for environment.\n") - env.Exit(1) - - -def exists(_): - return True - - -def generate(env): - env.AddMethod(ProcessDebug) - env.AddMethod(DebugToolSettings) - env.AddMethod(AutodetectDebugPort) - return env diff --git a/platformio/builder/tools/pioide.py b/platformio/builder/tools/pioide.py index 4b4e7fdd..11a57474 100644 --- a/platformio/builder/tools/pioide.py +++ b/platformio/builder/tools/pioide.py @@ -15,7 +15,7 @@ from __future__ import absolute_import from glob import glob -from os.path import join, sep +from os.path import join from SCons.Defaults import processDefines @@ -67,54 +67,6 @@ def dump_defines(env): return defines -def dump_debug(env): - - def _fix_path_sep(path): - result = [] - items = path if isinstance(path, list) else [path] - for item in items: - result.append(item.replace("/", sep).replace("\\", sep)) - return result if isinstance(path, list) else result[0] - - def _dump_server(configuration): - if not configuration: - return - if not set(configuration.keys()) >= set(["package", "executable"]): - return - pkg_dir = env.PioPlatform().get_package_dir(configuration['package']) - if not pkg_dir: - return - return { - "cwd": pkg_dir, - "executable": _fix_path_sep(configuration['executable']), - "arguments": _fix_path_sep(configuration.get("arguments")) - } - - gdbinit = None - if "DEBUG_GDBINIT" in env: - if isinstance(env['DEBUG_GDBINIT'], list): - gdbinit = env['DEBUG_GDBINIT'] - else: - gdbinit = [env['DEBUG_GDBINIT']] - - tool_settings = env.DebugToolSettings() - if tool_settings and not gdbinit: - gdbinit = tool_settings.get("gdbinit") - - env.AutodetectDebugPort() - - return { - "gdb_path": util.where_is_program( - env.subst("$GDB"), env.subst("${ENV['PATH']}")), - "prog_path": env.subst("$PROG_PATH"), - "tool": tool_settings['name'] if tool_settings else None, - "gdbinit": [env.subst(cmd) for cmd in gdbinit] if gdbinit else None, - "port": env.subst("$DEBUG_PORT"), - "server": (_dump_server(tool_settings['server']) - if tool_settings and "server" in tool_settings else None) - } - - def DumpIDEData(env): LINTCCOM = "$CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS" LINTCXXCOM = "$CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS" @@ -124,13 +76,15 @@ def DumpIDEData(env): [env.subst(l) for l in env.get("LIBSOURCE_DIRS", [])], "defines": dump_defines(env), "includes": dump_includes(env), - "debug": dump_debug(env), "cc_flags": env.subst(LINTCCOM), "cxx_flags": env.subst(LINTCXXCOM), "cc_path": util.where_is_program( env.subst("$CC"), env.subst("${ENV['PATH']}")), "cxx_path": util.where_is_program( env.subst("$CXX"), env.subst("${ENV['PATH']}")), + "gdb_path": util.where_is_program( + env.subst("$GDB"), env.subst("${ENV['PATH']}")), + "prog_path": env.subst("$PROG_PATH") } env_ = env.Clone() diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index ba6f496e..8fef5006 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -18,13 +18,14 @@ import atexit import re import sys from os import environ, remove, walk -from os.path import basename, isdir, isfile, join, relpath +from os.path import basename, isdir, isfile, join, relpath, sep from tempfile import mkstemp from SCons.Action import Action from SCons.Script import ARGUMENTS from platformio import util +from platformio.managers.core import get_core_package_dir class InoToCPPConverter(object): @@ -268,6 +269,34 @@ def PioClean(env, clean_dir): env.Exit(0) +def ProcessDebug(env): + if not env.subst("$PIODEBUGFLAGS"): + env.Replace(PIODEBUGFLAGS=["-Og", "-g3", "-ggdb"]) + env.Append( + BUILD_FLAGS=env.get("PIODEBUGFLAGS", []), + BUILD_UNFLAGS=["-Os", "-O0", "-O1", "-O2", "-O3"]) + + +def ProcessTest(env): + env.Append( + CPPDEFINES=["UNIT_TEST", "UNITY_INCLUDE_CONFIG_H"], + CPPPATH=[join("$BUILD_DIR", "UnityTestLib")]) + unitylib = env.BuildLibrary( + join("$BUILD_DIR", "UnityTestLib"), get_core_package_dir("tool-unity")) + env.Prepend(LIBS=[unitylib]) + + src_filter = None + if "PIOTEST" in env: + src_filter = "+" + src_filter += " +<%s%s>" % (env['PIOTEST'], sep) + + return env.CollectBuildFiles( + "$BUILDTEST_DIR", + "$PROJECTTEST_DIR", + src_filter=src_filter, + duplicate=False) + + def exists(_): return True @@ -278,4 +307,6 @@ def generate(env): env.AddMethod(GetActualLDScript) env.AddMethod(VerboseAction) env.AddMethod(PioClean) + env.AddMethod(ProcessDebug) + env.AddMethod(ProcessTest) return env diff --git a/platformio/builder/tools/piotest.py b/platformio/builder/tools/piotest.py deleted file mode 100644 index 04035e9c..00000000 --- a/platformio/builder/tools/piotest.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 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. - -from __future__ import absolute_import - -from os.path import join, sep - -from platformio.managers.core import get_core_package_dir - - -def ProcessTest(env): - env.Append( - CPPDEFINES=["UNIT_TEST", "UNITY_INCLUDE_CONFIG_H"], - CPPPATH=[join("$BUILD_DIR", "UnityTestLib")]) - unitylib = env.BuildLibrary( - join("$BUILD_DIR", "UnityTestLib"), get_core_package_dir("tool-unity")) - env.Prepend(LIBS=[unitylib]) - - src_filter = None - if "PIOTEST" in env: - src_filter = "+" - src_filter += " +<%s%s>" % (env['PIOTEST'], sep) - - return env.CollectBuildFiles( - "$BUILDTEST_DIR", - "$PROJECTTEST_DIR", - src_filter=src_filter, - duplicate=False) - - -def exists(_): - return True - - -def generate(env): - env.AddMethod(ProcessTest) - return env diff --git a/platformio/commands/debug.py b/platformio/commands/debug.py index 24acae6c..7ea97940 100644 --- a/platformio/commands/debug.py +++ b/platformio/commands/debug.py @@ -20,7 +20,10 @@ import click from platformio.managers.core import pioplus_call -@click.command("debug", short_help="Project Debugger") +@click.command( + "debug", + context_settings=dict(ignore_unknown_options=True), + short_help="The Unified Debugger") @click.option( "-d", "--project-dir", @@ -32,8 +35,8 @@ from platformio.managers.core import pioplus_call writable=True, resolve_path=True)) @click.option("--environment", "-e", metavar="") -@click.option("--configuration", is_flag=True) -@click.option("--json-output", is_flag=True) @click.option("--verbose", "-v", is_flag=True) +@click.option("--interface", type=click.Choice(["gdb"])) +@click.argument("__unprocessed", nargs=-1, type=click.UNPROCESSED) def cli(*args, **kwargs): # pylint: disable=unused-argument pioplus_call(sys.argv[1:]) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 8c6e42ca..e723b085 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -122,15 +122,18 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, class EnvironmentProcessor(object): - 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_script", "targets", - "upload_port", "upload_protocol", "upload_speed", "upload_flags", - "upload_resetmethod", "lib_install", "lib_deps", "lib_force", - "lib_ignore", "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode", - "test_ignore", "test_port", "piotest", "debug_tool", "debug_port", - "debug_gdbinit") + 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_script", "targets", "upload_port", + "upload_protocol", "upload_speed", "upload_flags", + "upload_resetmethod", "lib_deps", "lib_ignore", + "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode", + "piotest", "test_ignore", "test_port", "debug_tool", + "debug_port", "debug_init_cmds", "debug_extra_cmds") + + IGNORE_BUILD_OPTIONS = ("debug_tool", "debug_port", "debug_init_cmds", + "debug_extra_cmds") REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"} @@ -224,6 +227,8 @@ class EnvironmentProcessor(object): for k, v in self.options.items(): if k in self.REMAPED_OPTIONS: k = self.REMAPED_OPTIONS[k] + if k in self.IGNORE_BUILD_OPTIONS: + continue if k == "targets" or (k == "upload_port" and self.upload_port): continue variables[k] = v diff --git a/platformio/maintenance.py b/platformio/maintenance.py index df811972..360bc960 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -38,8 +38,11 @@ def in_silence(ctx=None): ctx = ctx or app.get_session_var("command_ctx") assert ctx ctx_args = ctx.args or [] - return (ctx_args and - (ctx.args[0] == "upgrade" or "--json-output" in ctx_args)) + conditions = [ + ctx.args[0] == "upgrade", "--json-output" in ctx_args, + "--version" in ctx_args + ] + return ctx_args and any(conditions) def on_platformio_start(ctx, force, caller): diff --git a/platformio/managers/core.py b/platformio/managers/core.py index c0620855..23c67bb4 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "pysite-pioplus": ">=0.3.0,<2", - "tool-pioplus": ">=0.7.3,<2", + "tool-pioplus": ">=0.8.1,<2", "tool-unity": "~1.20302.1", "tool-scons": "~3.20501.2" } diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index ccd89b15..ad2800de 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -643,6 +643,18 @@ class PlatformBoardConfig(object): "ram": self._manifest.get("upload", {}).get("maximum_ram_size", 0), "rom": self._manifest.get("upload", {}).get("maximum_size", 0), "frameworks": self._manifest.get("frameworks"), + "debug": self.get_debug_data(), "vendor": self._manifest['vendor'], "url": self._manifest['url'] } + + def get_debug_data(self): + if not self._manifest.get("debug", {}).get("tools"): + return + tools = {} + for name, options in self._manifest['debug']['tools'].items(): + tools[name] = {} + for key, value in options.items(): + if key in ("default", "onboard"): + tools[name][key] = value + return {"tools": tools} diff --git a/setup.py b/setup.py index ae4ad614..d7ed7447 100644 --- a/setup.py +++ b/setup.py @@ -51,6 +51,7 @@ setup( entry_points={ "console_scripts": [ "pio = platformio.__main__:main", + "piodebuggdb = platformio.__main__:debug_gdb_main", "platformio = platformio.__main__:main" ] }, From 46e82e08ce4a8270354f1868e21da65f1bbcaf84 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 28 Apr 2017 01:39:29 +0300 Subject: [PATCH 034/155] Bump version to 3.4.0a7 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 18b57ffa..b5c997fc 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0a6") +VERSION = (3, 4, "0a7") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 1e5df747cd8f7eaa8f8c0d5e85a647e8ab1af538 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 28 Apr 2017 18:10:37 +0300 Subject: [PATCH 035/155] Handle ``env_default`` in "platformio.ini" when re-initializing a project // Resolve #950 --- HISTORY.rst | 7 +++++-- platformio/commands/init.py | 30 +++++++++++++----------------- platformio/ide/projectgenerator.py | 12 ++++++------ 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 82e88c12..c56a4597 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -17,11 +17,14 @@ PlatformIO 3.0 that were installed from repository * Add support for ``.*cc`` extension (`issue #939 `_) +* Handle ``env_default`` in `Project Configuration File "platformio.ini" `__ + when re-initializing a project + (`issue #950 `_) +* Don't warn about known ``boards_dir`` option + (`pull #949 `_) * Fixed infinite dependency installing when repository consists of multiple libraries (`issue #935 `_) -* Don't warn about known ``boards_dir`` option - (`pull #949 `_) * Fixed linter error "unity.h does not exist" for Unit Testing (`issue #947 `_) * Fixed issue when `Library Dependency Finder (LDF) `__ diff --git a/platformio/commands/init.py b/platformio/commands/init.py index fb303641..0ee751c0 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -96,21 +96,10 @@ def cli( ide is not None) if ide: - if not board: - board = get_first_board(project_dir) - if board: - board = [board] - if not board: + env_name = get_best_envname(project_dir, board) + if not env_name: raise exception.BoardNotDefined() - if len(board) > 1: - click.secho( - "Warning! You have initialised project with more than 1 board" - " for the specified IDE.\n" - "However, the IDE features (code autocompletion, syntax " - "linter) have been configured for the first board '%s' from " - "your list '%s'." % (board[0], ", ".join(board)), - fg="yellow") - pg = ProjectGenerator(project_dir, ide, board[0]) + pg = ProjectGenerator(project_dir, ide, env_name) pg.generate() if not silent: @@ -126,13 +115,20 @@ def cli( fg="green") -def get_first_board(project_dir): +def get_best_envname(project_dir, boards=None): config = util.load_project_config(project_dir) + env_default = None + if config.has_option("platformio", "env_default"): + env_default = config.get("platformio", + "env_default").split(", ")[0].strip() + if env_default: + return env_default for section in config.sections(): if not section.startswith("env:"): continue - elif config.has_option(section, "board"): - return config.get(section, "board") + elif config.has_option(section, "board") and (not boards or config.get( + section, "board") in boards): + return section[4:] return None diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index 711e01af..6020a7e4 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -27,10 +27,10 @@ from platformio.commands.run import cli as cmd_run class ProjectGenerator(object): - def __init__(self, project_dir, ide, board): + def __init__(self, project_dir, ide, env_name): self.project_dir = project_dir self.ide = ide - self.board = board + self.env_name = env_name self._tplvars = {} with util.cd(self.project_dir): @@ -46,23 +46,23 @@ class ProjectGenerator(object): @util.memoized def get_project_env(self): - data = {"env_name": "PlatformIO"} + data = None config = util.load_project_config(self.project_dir) for section in config.sections(): if not section.startswith("env:"): continue + if self.env_name != section[4:]: + continue data = {"env_name": section[4:]} for k, v in config.items(section): data[k] = v - if self.board == data.get("board"): - break return data @util.memoized def get_project_build_data(self): data = {"defines": [], "includes": [], "cxx_path": None} envdata = self.get_project_env() - if "env_name" not in envdata: + if not envdata: return data out = StringIO() From d55f28e3d7820ba8ff4b33aaeec84d02a2a4ec2a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 28 Apr 2017 19:00:12 +0300 Subject: [PATCH 036/155] Bump version to 3.4.0a8 --- platformio/__init__.py | 2 +- platformio/managers/core.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index b5c997fc..3813780b 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0a7") +VERSION = (3, 4, "0a8") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 23c67bb4..5cb8b258 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "pysite-pioplus": ">=0.3.0,<2", - "tool-pioplus": ">=0.8.1,<2", + "tool-pioplus": ">=0.8.2,<2", "tool-unity": "~1.20302.1", "tool-scons": "~3.20501.2" } From 13cd09d161c44d7a3365ed9183caefd6f8261373 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 29 Apr 2017 01:42:23 +0300 Subject: [PATCH 037/155] PIO Unified Debugger --- HISTORY.rst | 8 ++++ docs | 2 +- scripts/docspregen.py | 83 +++++++++++++++++++++++++++++++++++++ tests/commands/test_init.py | 2 +- 4 files changed, 93 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index c56a4597..86f9f294 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,14 @@ PlatformIO 3.0 3.4.0 (2017-??-??) ~~~~~~~~~~~~~~~~~~ +* `PIO Unified Debugger `__ + + - 100+ boards + - Multiple architectures and development platforms + - Zero Configuration + - Compatibility with the popular IDEs: Eclipse, Atom, VSCode, Sublime Text, etc + - Windows, MacOS, Linux (+ARMv6-8) + * Multi-line support for the different options in `Project Configuration File "platformio.ini" `__, such as: ``build_flags``, ``build_unflags``, etc. (`issue #889 `_) diff --git a/docs b/docs index 723f9369..78fb29eb 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 723f9369f5fcc77936b473834abdd4bb6c397806 +Subproject commit 78fb29eb21d2ac7a0382dc3806af89e1176371ad diff --git a/scripts/docspregen.py b/scripts/docspregen.py index e67c9e50..3b1f93d9 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -48,6 +48,8 @@ def generate_boards(boards): return int(ceil(size / b) * b) assert NotImplemented() + platforms = {m['name']: m['title'] for m in PLATFORM_MANIFESTS} + lines = [] lines.append(""" @@ -56,6 +58,7 @@ def generate_boards(boards): * - ID - Name + - Platform - Microcontroller - Frequency - Flash @@ -66,12 +69,15 @@ def generate_boards(boards): lines.append(""" * - ``{id}`` - `{name} <{url}>`_ + - :ref:`{platform_title} ` - {mcu} - {f_cpu:d} MHz - {rom} Kb - {ram} Kb""".format( id=data['id'], name=data['name'], + platform=data['platform'], + platform_title=platforms[data['platform']], url=data['url'], mcu=data['mcu'].upper(), f_cpu=int(data['fcpu']) / 1000000, @@ -423,11 +429,88 @@ popular embedded boards and IDE. f.write("\n".join(lines)) +def update_debugging(): + vendors = {} + platforms = [] + frameworks = [] + for data in BOARDS: + if not data['debug']: + continue + platforms.append(data['platform']) + frameworks.extend(data['frameworks']) + vendor = data['vendor'] + if vendor in vendors: + vendors[vendor].append(data) + else: + vendors[vendor] = [data] + + lines = [] + # Platforms + lines.append(""".. _debugging_platforms: + +Platforms +--------- +.. list-table:: + :header-rows: 1 + + * - Name + - Description""") + + for manifest in PLATFORM_MANIFESTS: + if manifest['name'] not in platforms: + continue + p = PlatformFactory.newPlatform(manifest['name']) + lines.append( + """ + * - :ref:`platform_{type_}` + - {description}""" + .format(type_=manifest['name'], description=p.description)) + + # Frameworks + lines.append(""" +Frameworks +---------- +.. list-table:: + :header-rows: 1 + + * - Name + - Description""") + for framework in API_FRAMEWORKS: + if framework['name'] not in frameworks: + continue + lines.append(""" + * - :ref:`framework_{name}` + - {description}""".format(**framework)) + + # Boards + lines.append(""" +Boards +------ + +.. note:: + For more detailed ``board`` information please scroll tables below by horizontal. +""") + for vendor, boards in sorted(vendors.iteritems()): + lines.append(str(vendor)) + lines.append("~" * len(vendor)) + lines.append(generate_boards(boards)) + + with open( + join(util.get_source_dir(), "..", "docs", "plus", + "debugging.rst"), "r+") as fp: + content = fp.read() + fp.seek(0) + fp.truncate() + fp.write(content[:content.index(".. _debugging_platforms:")] + + "\n".join(lines)) + + def main(): update_create_platform_doc() update_platform_docs() update_framework_docs() update_embedded_boards() + update_debugging() if __name__ == "__main__": diff --git a/tests/commands/test_init.py b/tests/commands/test_init.py index 3f0cb3d7..6f366f90 100644 --- a/tests/commands/test_init.py +++ b/tests/commands/test_init.py @@ -73,7 +73,7 @@ def test_init_ide_atom(clirunner, validate_cliresult, tmpdir): # switch to NodeMCU result = clirunner.invoke( - cmd_init, ["--ide", "atom", "-b", "nodemcuv2", "-b", "uno"]) + cmd_init, ["--ide", "atom", "-b", "nodemcuv2"]) validate_cliresult(result) validate_pioproject(str(tmpdir)) assert "arduinoespressif" in tmpdir.join(".clang_complete").read() From 7c31a9c9b8b7f39aa0521f9fe19fd12ae5b713bc Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 29 Apr 2017 01:58:35 +0300 Subject: [PATCH 038/155] Some correction for debug options --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 78fb29eb..6065cbe2 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 78fb29eb21d2ac7a0382dc3806af89e1176371ad +Subproject commit 6065cbe22b599c0ad2d3785357170eb47b917da5 From ba545bfa2967123787567ca1a5d9acaf39dcad6f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 29 Apr 2017 02:16:11 +0300 Subject: [PATCH 039/155] =?UTF-8?q?Docs=20for=20=E2=80=9Cdebug=5Ftool?= =?UTF-8?q?=E2=80=9D=20option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 6065cbe2..04b38cea 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 6065cbe22b599c0ad2d3785357170eb47b917da5 +Subproject commit 04b38ceaec69e7a1349162b6c7ec718609dbd4e0 From 7d92bcdf581380a60ed8d74785288b64edf017bc Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 30 Apr 2017 01:14:57 +0300 Subject: [PATCH 040/155] Debugging tools/probes --- docs | 2 +- scripts/docspregen.py | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/docs b/docs index 04b38cea..ac0f59ad 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 04b38ceaec69e7a1349162b6c7ec718609dbd4e0 +Subproject commit ac0f59ad37241ad7c47e05a5d69d1107f13b7019 diff --git a/scripts/docspregen.py b/scripts/docspregen.py index 3b1f93d9..00c67901 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -36,7 +36,7 @@ def is_compat_platform_and_framework(platform, framework): return False -def generate_boards(boards): +def generate_boards(boards, extend_debug=False): def _round_memory_size(size): if size == 1: @@ -59,17 +59,34 @@ def generate_boards(boards): * - ID - Name - Platform + - Debug - Microcontroller - Frequency - Flash - RAM""") for data in sorted(boards, key=lambda item: item['id']): + debug = [":ref:`Yes `" if data['debug'] else ""] + if extend_debug and data['debug']: + debug = [] + for name, options in data['debug']['tools'].items(): + attrs = [] + if options.get("default"): + attrs.append("default") + if options.get("onboard"): + attrs.append("on-board") + tool = ":ref:`debugging_tool_%s`" % name + if attrs: + debug.append("%s (%s)" % (tool, ", ".join(attrs))) + 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 @@ -78,6 +95,7 @@ def generate_boards(boards): name=data['name'], platform=data['platform'], platform_title=platforms[data['platform']], + debug=", ".join(debug), url=data['url'], mcu=data['mcu'].upper(), f_cpu=int(data['fcpu']) / 1000000, @@ -493,7 +511,7 @@ Boards for vendor, boards in sorted(vendors.iteritems()): lines.append(str(vendor)) lines.append("~" * len(vendor)) - lines.append(generate_boards(boards)) + lines.append(generate_boards(boards, extend_debug=True)) with open( join(util.get_source_dir(), "..", "docs", "plus", From 884859324dbe43f3fa2ca5bc32eb703ca0a085d1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 30 Apr 2017 01:52:06 +0300 Subject: [PATCH 041/155] User Guide (CLI) for PIO Unified Debugger --- docs | 2 +- platformio/commands/debug.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index ac0f59ad..9c6c114d 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ac0f59ad37241ad7c47e05a5d69d1107f13b7019 +Subproject commit 9c6c114dd5f1ebee72b8bacda036115a72955683 diff --git a/platformio/commands/debug.py b/platformio/commands/debug.py index 7ea97940..1a6e49b5 100644 --- a/platformio/commands/debug.py +++ b/platformio/commands/debug.py @@ -23,7 +23,7 @@ from platformio.managers.core import pioplus_call @click.command( "debug", context_settings=dict(ignore_unknown_options=True), - short_help="The Unified Debugger") + short_help="PIO Unified Debugger") @click.option( "-d", "--project-dir", From 56d4d545c178d48eb63c5071d9510d047c6eacf1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 1 May 2017 01:33:51 +0300 Subject: [PATCH 042/155] =?UTF-8?q?Don=E2=80=99t=20raise=20error=20when=20?= =?UTF-8?q?cache=20item=20has=20been=20deleted=20from=20another=20thread?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformio/app.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/platformio/app.py b/platformio/app.py index 79fa9c01..b38cc719 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -155,9 +155,12 @@ class ContentCache(object): continue found = True if isfile(path): - remove(path) - if not listdir(dirname(path)): - util.rmtree_(dirname(path)) + try: + remove(path) + if not listdir(dirname(path)): + util.rmtree_(dirname(path)) + except OSError: + pass if found and self._lock_dbindex(): with open(self._db_path, "w") as fp: From 30ff491a34b47fd0adc4c7395fa86b80b7919e64 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 3 May 2017 20:33:37 +0300 Subject: [PATCH 043/155] Remove extra delay before waiting for serial port --- platformio/builder/tools/pioupload.py | 1 - 1 file changed, 1 deletion(-) diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 9949bc41..dadb7cd7 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -56,7 +56,6 @@ def WaitForNewSerialPort(env, before): prev_port = env.subst("$UPLOAD_PORT") new_port = None elapsed = 0 - sleep(1) while elapsed < 5 and new_port is None: now = util.get_serialports() for p in now: From c69269ea3d1055d7956537d2b127a4793f9c2824 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 4 May 2017 00:36:52 +0300 Subject: [PATCH 044/155] Offline mode for PIO Account Show command --- platformio/commands/account.py | 3 ++- platformio/managers/core.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/platformio/commands/account.py b/platformio/commands/account.py index 6c48539a..baff541c 100644 --- a/platformio/commands/account.py +++ b/platformio/commands/account.py @@ -61,7 +61,8 @@ def account_forgot(**kwargs): pioplus_call(sys.argv[1:]) -@cli.command("show", short_help="PIO Account information: groups, permissions") +@cli.command("show", short_help="PIO Account information") +@click.option("--offline", is_flag=True) @click.option("--json-output", is_flag=True) def account_show(**kwargs): pioplus_call(sys.argv[1:]) diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 5cb8b258..df0b3e81 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "pysite-pioplus": ">=0.3.0,<2", - "tool-pioplus": ">=0.8.2,<2", + "tool-pioplus": ">=0.8.3,<2", "tool-unity": "~1.20302.1", "tool-scons": "~3.20501.2" } From d3d87a0bfb4982e90af71166090eb71c58009dc6 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 4 May 2017 01:17:28 +0300 Subject: [PATCH 045/155] Update history --- HISTORY.rst | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 86f9f294..a628f248 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -41,12 +41,48 @@ PlatformIO 3.0 ------- +* Development platform `Atmel SAM `__ + + + Support for `PIO Unified Debugger `__ + + Added support for MKRFox1200 board + + Updated Arduino SAMD Core to 1.6.14 + + Fixed firmware uploading Arduino Zero and USB-native boards + * Development platform `Espressif 32 `__ + Add support for FireBeetle-ESP32 and IntoRobot Fig + Update ESP-IDF framework to v2.0 + Update core for Arduino framework +* Development platform `Freescale Kinetis `__ + + + Support for `PIO Unified Debugger `__ + +* Development platform `Nordic nRF51 `__ + + + Support for `PIO Unified Debugger `__ + +* Development platform `NXP LPC `__ + + + Support for `PIO Unified Debugger `__ + +* Development platform `Silicon Labs EFM32 `__ + + + Support for `PIO Unified Debugger `__ + +* Development platform `Teensy `__ + + + Updated Teensy Loader CLI to v21 + + Updated Arduino Core to v1.36 + +* Development platform `TI MSP430 `__ + + + Support for `PIO Unified Debugger `__ + +* Development platform `TI TIVA `__ + + + Support for `PIO Unified Debugger `__ + 3.3.0 (2017-03-27) ~~~~~~~~~~~~~~~~~~ From a5973043b172775417ee03f15682b774f9abb309 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 4 May 2017 12:31:03 +0300 Subject: [PATCH 046/155] Allow to change account password with passed options --- platformio/commands/account.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platformio/commands/account.py b/platformio/commands/account.py index baff541c..dd559bd3 100644 --- a/platformio/commands/account.py +++ b/platformio/commands/account.py @@ -45,7 +45,9 @@ def account_logout(): @cli.command("password", short_help="Change password") -def account_password(): +@click.option("--old-password") +@click.option("--new-password") +def account_password(**kwargs): pioplus_call(sys.argv[1:]) From f3f8374253bc5fc08fd1fb32d1859c4a77f017ee Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 4 May 2017 19:06:38 +0300 Subject: [PATCH 047/155] A few updates for PIO Unified Debugger and PIO Account --- HISTORY.rst | 19 ++++++++++++++++++- docs | 2 +- platformio/__init__.py | 2 +- platformio/commands/account.py | 2 ++ platformio/maintenance.py | 15 +++++++++++---- platformio/managers/core.py | 2 +- 6 files changed, 34 insertions(+), 8 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index a628f248..47fc482c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -41,6 +41,16 @@ PlatformIO 3.0 ------- +* Development platform `Atmel AVR `__ + + + ATTiny Support (1634, x313, x4, x41, x5, x61, x7, x8) + (`issue #47 `_) + + New boards: Dwenguino, nicai-systems BOB3 coding bot, NIBO 2 robot, + NIBObee robot + + AVRDude TCP upload port (``net:host:port``) + (`pull #45 `_) + + Fixed uploading for LowPowerLab Moteino + * Development platform `Atmel SAM `__ + Support for `PIO Unified Debugger `__ @@ -50,7 +60,8 @@ PlatformIO 3.0 * Development platform `Espressif 32 `__ - + Add support for FireBeetle-ESP32 and IntoRobot Fig + + Added support for OTA (Over-The-Air) updates + + Added support for FireBeetle-ESP32 and IntoRobot Fig + Update ESP-IDF framework to v2.0 + Update core for Arduino framework @@ -70,6 +81,12 @@ PlatformIO 3.0 + Support for `PIO Unified Debugger `__ +* Development platform `ST STM32 `__ + + + Support for `PIO Unified Debugger `__ + + Added support for new boards: ST STM32F0308DISCOVERY + + Updated ``tool-stlink`` to v1.3.1 + * Development platform `Teensy `__ + Updated Teensy Loader CLI to v21 diff --git a/docs b/docs index 9c6c114d..1a6c873f 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 9c6c114dd5f1ebee72b8bacda036115a72955683 +Subproject commit 1a6c873fe5b670b3acb9bc08cbf7b4cd4395c015 diff --git a/platformio/__init__.py b/platformio/__init__.py index 3813780b..a134ebf9 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0a8") +VERSION = (3, 4, "0a9") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/commands/account.py b/platformio/commands/account.py index dd559bd3..b2bf9bb0 100644 --- a/platformio/commands/account.py +++ b/platformio/commands/account.py @@ -52,7 +52,9 @@ def account_password(**kwargs): @cli.command("token", short_help="Get or regenerate Authentication Token") +@click.option("-p", "--password") @click.option("--regenerate", is_flag=True) +@click.option("--json-output", is_flag=True) def account_token(**kwargs): pioplus_call(sys.argv[1:]) diff --git a/platformio/maintenance.py b/platformio/maintenance.py index 360bc960..66d8eb75 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -95,7 +95,9 @@ class Upgrader(object): self._upgraders = [ (semantic_version.Version("3.0.0-a.1"), self._upgrade_to_3_0_0), - (semantic_version.Version("3.0.0-b.11"), self._upgrade_to_3_0_0b11) + (semantic_version.Version("3.0.0-b.11"), + self._upgrade_to_3_0_0b11), + (semantic_version.Version("3.4.0-a.9"), self._update_dev_platforms) ] def run(self, ctx): @@ -103,10 +105,10 @@ class Upgrader(object): return True result = [True] - for item in self._upgraders: - if self.from_version >= item[0] or self.to_version < item[0]: + for version, callback in self._upgraders: + if self.from_version >= version or self.to_version < version: continue - result.append(item[1](ctx)) + result.append(callback(ctx)) return all(result) @@ -147,6 +149,11 @@ class Upgrader(object): ctx.invoke(cmd_platform_uninstall, platforms=["espressif"]) return True + @staticmethod + def _update_dev_platforms(ctx): + ctx.invoke(cmd_platform_update) + return True + def after_upgrade(ctx): last_version = app.get_state_item("last_version", "0.0.0") diff --git a/platformio/managers/core.py b/platformio/managers/core.py index df0b3e81..3dc7f8ff 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "pysite-pioplus": ">=0.3.0,<2", - "tool-pioplus": ">=0.8.3,<2", + "tool-pioplus": ">=0.8.5,<2", "tool-unity": "~1.20302.1", "tool-scons": "~3.20501.2" } From d37c6fcdce7c08c380c1ad567b9efac965a29ee6 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 4 May 2017 21:02:32 +0300 Subject: [PATCH 048/155] Use root directory for PIO Home when path contains non-ascii characters // Resolve #951 Resolve #952 --- HISTORY.rst | 5 ++++- platformio/util.py | 16 ++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 47fc482c..24dbb02e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -28,6 +28,9 @@ PlatformIO 3.0 * Handle ``env_default`` in `Project Configuration File "platformio.ini" `__ when re-initializing a project (`issue #950 `_) +* Use root directory for PIO Home when path contains non-ascii characters + (`issue #951 `_, + `issue #952 `_) * Don't warn about known ``boards_dir`` option (`pull #949 `_) * Fixed infinite dependency installing when repository consists of multiple @@ -44,7 +47,7 @@ PlatformIO 3.0 * Development platform `Atmel AVR `__ + ATTiny Support (1634, x313, x4, x41, x5, x61, x7, x8) - (`issue #47 `_) + (`issue #47 `__) + New boards: Dwenguino, nicai-systems BOB3 coding bot, NIBO 2 robot, NIBObee robot + AVRDude TCP upload port (``net:host:port``) diff --git a/platformio/util.py b/platformio/util.py index ddeccc5e..85071260 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -220,15 +220,19 @@ def get_project_optional_dir(name, default=None): def get_home_dir(): home_dir = get_project_optional_dir("home_dir", join(expanduser("~"), ".platformio")) - + win_home_dir = None if "windows" in get_systype(): - try: - home_dir.encode("utf8") - except UnicodeDecodeError: - home_dir = splitdrive(home_dir)[0] + "\\.platformio" + win_home_dir = splitdrive(home_dir)[0] + "\\.platformio" + if isdir(win_home_dir): + home_dir = win_home_dir if not isdir(home_dir): - os.makedirs(home_dir) + try: + os.makedirs(home_dir) + except WindowsError: + if win_home_dir: + os.makedirs(win_home_dir) + home_dir = win_home_dir assert isdir(home_dir) return home_dir From 70df106f5758827dceafa337d67800b1002a9325 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 4 May 2017 21:02:59 +0300 Subject: [PATCH 049/155] Bump version to 3.4.0b1 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index a134ebf9..06dfa84c 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0a9") +VERSION = (3, 4, "0b1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From a8da7dcfd3e039e13431c1167f721272de0aad52 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 5 May 2017 13:02:20 +0300 Subject: [PATCH 050/155] Fix PyLint warning --- platformio/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/util.py b/platformio/util.py index 85071260..35079b16 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -229,7 +229,7 @@ def get_home_dir(): if not isdir(home_dir): try: os.makedirs(home_dir) - except WindowsError: + except: # pylint: disable=bare-except if win_home_dir: os.makedirs(win_home_dir) home_dir = win_home_dir From 2827e7dc3a8f5cdf2d75a4d23f47b51c198a7492 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 5 May 2017 19:45:54 +0300 Subject: [PATCH 051/155] Fixed issue when debugger fails with a space in path to a project // Resolve #954 --- docs | 2 +- platformio/managers/core.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index 1a6c873f..53ab5b0d 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 1a6c873fe5b670b3acb9bc08cbf7b4cd4395c015 +Subproject commit 53ab5b0db3de174117f47ce87236d033b20c133a diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 3dc7f8ff..2d02ce04 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "pysite-pioplus": ">=0.3.0,<2", - "tool-pioplus": ">=0.8.5,<2", + "tool-pioplus": ">=0.8.6,<2", "tool-unity": "~1.20302.1", "tool-scons": "~3.20501.2" } From 866b3e915a67fe0defe535ee1acdd4b086475dcb Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 6 May 2017 14:43:08 +0300 Subject: [PATCH 052/155] Add link to PIO Unified Debugger to PIO Account page --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 53ab5b0d..c1677697 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 53ab5b0db3de174117f47ce87236d033b20c133a +Subproject commit c1677697bc6cb2e2f5bccd407d467b10833736eb From 90cefe48094511408ed94fa685305ebaab4560ac Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 7 May 2017 00:43:39 +0300 Subject: [PATCH 053/155] Bump version to 3.4.0b2 --- platformio/__init__.py | 2 +- platformio/managers/core.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 06dfa84c..0e29c134 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0b1") +VERSION = (3, 4, "0b2") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 2d02ce04..8796f8bb 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "pysite-pioplus": ">=0.3.0,<2", - "tool-pioplus": ">=0.8.6,<2", + "tool-pioplus": ">=0.8.8,<2", "tool-unity": "~1.20302.1", "tool-scons": "~3.20501.2" } From 1e2e409e8dfc5ca29009ecc0726140934635d124 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 7 May 2017 20:48:38 +0300 Subject: [PATCH 054/155] Add info about PIO Unified Debugger --- README.rst | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index 44a24151..ee868db8 100644 --- a/README.rst +++ b/README.rst @@ -37,12 +37,12 @@ PlatformIO `Bintray `_ | `Community `_ -.. image:: http://docs.platformio.org/en/stable/_static/platformio-logo.png +.. image:: https://raw.githubusercontent.com/platformio/platformio-web/develop/app/images/platformio-ide-laptop.png :target: http://platformio.org `PlatformIO `_ is an open source ecosystem for IoT -development. Cross-platform build system and library manager. Continuous and -IDE integration. Arduino, ESP8266 and ARM mbed compatible +development. Cross-platform build system, unified debugger and library manager. +Continuous and IDE integration. Arduino, ESP8266 and ARM mbed compatible * **PlatformIO IDE** - The next-generation integrated development environment for IoT. C/C++ Intelligent Code Completion and Smart Code Linter for the super-fast coding. @@ -60,13 +60,10 @@ IDE integration. Arduino, ESP8266 and ARM mbed compatible platforms and frameworks; learn via examples; be up-to-date with the latest version. -*Atmel AVR & SAM, Espressif, Freescale Kinetis, Intel ARC32, Lattice iCE40, +*Atmel AVR & SAM, Espressif 8266 & 32, Freescale Kinetis, Intel ARC32, Lattice iCE40, Microchip PIC32, Nordic nRF51, NXP LPC, Silicon Labs EFM32, ST STM32, TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc.* -.. image:: http://docs.platformio.org/en/stable/_static/platformio-demo-wiring.gif - :target: http://platformio.org - * `PlatformIO Plus and professional solutions `_ * `PlatformIO IDE `_ * `Get Started `_ From 4beecd62a8f7cc025116d57b417604fcd04f5381 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 7 May 2017 21:00:21 +0300 Subject: [PATCH 055/155] Update PIO IDE main picture with Unified Debugger --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index c1677697..9047fff9 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit c1677697bc6cb2e2f5bccd407d467b10833736eb +Subproject commit 9047fff9bba95c42a4b86b80c26da06084d3a3a2 From 861e68ab3c5736bd750f3c045707ca9d27d8c355 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 8 May 2017 16:39:06 +0300 Subject: [PATCH 056/155] Depend on a new PIO Core+ --- 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 8796f8bb..e5a86447 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "pysite-pioplus": ">=0.3.0,<2", - "tool-pioplus": ">=0.8.8,<2", + "tool-pioplus": ">=0.8.10,<2", "tool-unity": "~1.20302.1", "tool-scons": "~3.20501.2" } From c14ba162977d396573f450280815b87d0a02f8b5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 10 May 2017 02:06:09 +0300 Subject: [PATCH 057/155] Fix linke to images --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 9047fff9..fcd6682c 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 9047fff9bba95c42a4b86b80c26da06084d3a3a2 +Subproject commit fcd6682c9f6cf34377577663eb649782f9fbb300 From 5eb2fc67e5401544e71b0cf9f96010e984ed959b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 11 May 2017 14:49:44 +0300 Subject: [PATCH 058/155] Skip network driver when searching for mbed disk --- 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 dadb7cd7..27b1c744 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -99,18 +99,19 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument return fnmatch(port, pattern) def _look_for_mbed_disk(): - msdlabels = ("mbed", "nucleo", "frdm", "microbit", "node") + msdlabels = ("mbed", "nucleo", "frdm", "microbit") for item in util.get_logicaldisks(): - if not _is_match_pattern(item['disk']): + if item['disk'].startswith("/net") or not _is_match_pattern( + item['disk']): continue - if (item['name'] and - any([l in item['name'].lower() for l in msdlabels])): - return item['disk'] mbed_pages = [ join(item['disk'], n) for n in ("mbed.htm", "mbed.html") ] if any([isfile(p) for p in mbed_pages]): return item['disk'] + if (item['name'] and + any([l in item['name'].lower() for l in msdlabels])): + return item['disk'] return None def _look_for_serial_port(): From 6941b822b6a9cac77d463f099f13c754fc59ed7c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 18 May 2017 21:51:38 +0300 Subject: [PATCH 059/155] Custom debugging configuration --- HISTORY.rst | 6 +++--- docs | 2 +- platformio/commands/run.py | 21 +++++++++++---------- platformio/managers/core.py | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 24dbb02e..9501fe34 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -63,10 +63,10 @@ PlatformIO 3.0 * Development platform `Espressif 32 `__ + + New boards: Adafruit Feather, FireBeetle-ESP32, IntoRobot Fig, NodeMCU-32S, Onehorse ESP32 Dev Module, and Widora AIR + Added support for OTA (Over-The-Air) updates - + Added support for FireBeetle-ESP32 and IntoRobot Fig - + Update ESP-IDF framework to v2.0 - + Update core for Arduino framework + + Updated ESP-IDF framework to v2.0 + + Updated core for Arduino framework * Development platform `Freescale Kinetis `__ diff --git a/docs b/docs index fcd6682c..2632e42e 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit fcd6682c9f6cf34377577663eb649782f9fbb300 +Subproject commit 2632e42e8abd26cd190f18b92ae39fdd0cf484ff diff --git a/platformio/commands/run.py b/platformio/commands/run.py index e723b085..76cdc52c 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -122,18 +122,19 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, class EnvironmentProcessor(object): - 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_script", "targets", "upload_port", - "upload_protocol", "upload_speed", "upload_flags", - "upload_resetmethod", "lib_deps", "lib_ignore", - "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode", - "piotest", "test_ignore", "test_port", "debug_tool", - "debug_port", "debug_init_cmds", "debug_extra_cmds") + 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_script", "targets", + "upload_port", "upload_protocol", "upload_speed", "upload_flags", + "upload_resetmethod", "lib_deps", "lib_ignore", "lib_extra_dirs", + "lib_ldf_mode", "lib_compat_mode", "piotest", "test_ignore", + "test_port", "debug_tool", "debug_port", "debug_init_cmds", + "debug_extra_cmds", "debug_server", "debug_init_break") IGNORE_BUILD_OPTIONS = ("debug_tool", "debug_port", "debug_init_cmds", - "debug_extra_cmds") + "debug_extra_cmds", "debug_server", + "debug_init_break") REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"} diff --git a/platformio/managers/core.py b/platformio/managers/core.py index e5a86447..6b8054f6 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "pysite-pioplus": ">=0.3.0,<2", - "tool-pioplus": ">=0.8.10,<2", + "tool-pioplus": ">=0.8.11,<2", "tool-unity": "~1.20302.1", "tool-scons": "~3.20501.2" } From 41f1806009de56663000613783b0d8b1302368e8 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 18 May 2017 21:52:22 +0300 Subject: [PATCH 060/155] Bump version to 3.4.0b3 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 0e29c134..3e907a85 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0b2") +VERSION = (3, 4, "0b3") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 90fc207bf2afcd6d1ecc6e49e0596183302b2f0a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 18 May 2017 21:59:42 +0300 Subject: [PATCH 061/155] =?UTF-8?q?Add=20missed=20=E2=80=9Cdebug=5Ftool?= =?UTF-8?q?=E2=80=9D=20options?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 2632e42e..83545016 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 2632e42e8abd26cd190f18b92ae39fdd0cf484ff +Subproject commit 8354501632ccd64b035c5c5a600ed72181227266 From c02d180e117cf81d8a7142a66da5da1196359a55 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 20 May 2017 01:18:49 +0300 Subject: [PATCH 062/155] Update custom J-Link GDB example --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 83545016..b3ed28a0 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 8354501632ccd64b035c5c5a600ed72181227266 +Subproject commit b3ed28a0a80893d043d0c359b9251c8e5c117443 From cb241b703ae7c6c63fd4d0e5c3651fe49733209a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 20 May 2017 02:17:00 +0300 Subject: [PATCH 063/155] Preload debugging firmware before debug session --- docs | 2 +- platformio/commands/run.py | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/docs b/docs index b3ed28a0..3c97d753 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit b3ed28a0a80893d043d0c359b9251c8e5c117443 +Subproject commit 3c97d753a2773acbb69f335fee4c65ea77b9d03b diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 76cdc52c..df521034 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -122,19 +122,20 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, class EnvironmentProcessor(object): - 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_script", "targets", - "upload_port", "upload_protocol", "upload_speed", "upload_flags", - "upload_resetmethod", "lib_deps", "lib_ignore", "lib_extra_dirs", - "lib_ldf_mode", "lib_compat_mode", "piotest", "test_ignore", - "test_port", "debug_tool", "debug_port", "debug_init_cmds", - "debug_extra_cmds", "debug_server", "debug_init_break") + 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_script", "targets", "upload_port", + "upload_protocol", "upload_speed", "upload_flags", + "upload_resetmethod", "lib_deps", "lib_ignore", + "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode", + "piotest", "test_ignore", "test_port", "debug_tool", + "debug_port", "debug_init_cmds", "debug_extra_cmds", + "debug_server", "debug_init_break", "debug_preload") IGNORE_BUILD_OPTIONS = ("debug_tool", "debug_port", "debug_init_cmds", "debug_extra_cmds", "debug_server", - "debug_init_break") + "debug_init_break", "debug_preload") REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"} From d367f726ba06220d2315605eeaf5d30c726d17f2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 21 May 2017 01:54:47 +0300 Subject: [PATCH 064/155] New boards --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 3c97d753..382137cf 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 3c97d753a2773acbb69f335fee4c65ea77b9d03b +Subproject commit 382137cfae5d6823385e7277d752f0988c23f6e8 From d5d3bb19de6cd0ccc35bccf2b642e6638d8873d7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 22 May 2017 21:14:05 +0300 Subject: [PATCH 065/155] Typo fix --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 382137cf..e238fb05 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 382137cfae5d6823385e7277d752f0988c23f6e8 +Subproject commit e238fb0513732bdceb78147764882d0989a2fed1 From 1e3673107600ea4b191bb58e1ef4b5a7e0f4cc1e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 24 May 2017 17:24:19 +0300 Subject: [PATCH 066/155] Update top navigation --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index e238fb05..80edf4a5 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit e238fb0513732bdceb78147764882d0989a2fed1 +Subproject commit 80edf4a5027a85a41c3eb8b063aec100bda31a1e From eafa586fdcdb03983228c4eb8fb203581017be8e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 26 May 2017 00:45:56 +0300 Subject: [PATCH 067/155] Implement a delete functionality for State & ContentCache --- platformio/app.py | 76 ++++++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/platformio/app.py b/platformio/app.py index b38cc719..6e44e5d0 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -142,31 +142,8 @@ class ContentCache(object): def __enter__(self): if not self._db_path or not isfile(self._db_path): return self - found = False - newlines = [] - with open(self._db_path) as fp: - for line in fp.readlines(): - if "=" not in line: - continue - line = line.strip() - expire, path = line.split("=") - if time() < int(expire) and isfile(path): - newlines.append(line) - continue - found = True - if isfile(path): - try: - remove(path) - if not listdir(dirname(path)): - util.rmtree_(dirname(path)) - except OSError: - pass - - if found and self._lock_dbindex(): - with open(self._db_path, "w") as fp: - fp.write("\n".join(newlines) + "\n") - self._unlock_dbindex() + self.delete() return self def __exit__(self, type_, value, traceback): @@ -190,6 +167,7 @@ class ContentCache(object): def _unlock_dbindex(self): if self._lockfile: self._lockfile.release() + return True def get_cache_path(self, key): assert len(key) > 3 @@ -213,20 +191,19 @@ class ContentCache(object): return data def set(self, key, data, valid): + cache_path = self.get_cache_path(key) + if isfile(cache_path): + self.delete(key) if not data: return if not isdir(self.cache_dir): os.makedirs(self.cache_dir) tdmap = {"s": 1, "m": 60, "h": 3600, "d": 86400} assert valid.endswith(tuple(tdmap.keys())) - cache_path = self.get_cache_path(key) expire_time = int(time() + tdmap[valid[-1]] * int(valid[:-1])) if not self._lock_dbindex(): return False - with open(self._db_path, "a") as fp: - fp.write("%s=%s\n" % (str(expire_time), cache_path)) - self._unlock_dbindex() if not isdir(dirname(cache_path)): os.makedirs(dirname(cache_path)) @@ -235,6 +212,43 @@ class ContentCache(object): json.dump(data, fp) else: fp.write(str(data)) + with open(self._db_path, "a") as fp: + fp.write("%s=%s\n" % (str(expire_time), cache_path)) + + return self._unlock_dbindex() + + def delete(self, keys=None): + """ Keys=None, delete expired items """ + if not keys: + keys = [] + if not isinstance(keys, list): + keys = [keys] + paths_for_delete = [self.get_cache_path(k) for k in keys] + found = False + newlines = [] + with open(self._db_path) as fp: + for line in fp.readlines(): + if "=" not in line: + continue + line = line.strip() + expire, path = line.split("=") + if time() < int(expire) and isfile(path) and \ + path not in paths_for_delete: + newlines.append(line) + continue + found = True + if isfile(path): + try: + remove(path) + if not listdir(dirname(path)): + util.rmtree_(dirname(path)) + except OSError: + pass + + if found and self._lock_dbindex(): + with open(self._db_path, "w") as fp: + fp.write("\n".join(newlines) + "\n") + self._unlock_dbindex() return True @@ -277,6 +291,12 @@ def set_state_item(name, value): data[name] = value +def delete_state_item(name): + with State(lock=True) as data: + if name in data: + del data[name] + + def get_setting(name): _env_name = "PLATFORMIO_SETTING_%s" % name.upper() if _env_name in environ: From 0a254c52c0e9de1ab44cb1119ab80f781ac13b86 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 26 May 2017 01:24:23 +0300 Subject: [PATCH 068/155] Updated mbed framework to 5.4.5/142 --- HISTORY.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 9501fe34..394dbf9e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -59,6 +59,7 @@ PlatformIO 3.0 + Support for `PIO Unified Debugger `__ + Added support for MKRFox1200 board + Updated Arduino SAMD Core to 1.6.14 + + Updated mbed framework to 5.4.5/142 + Fixed firmware uploading Arduino Zero and USB-native boards * Development platform `Espressif 32 `__ @@ -71,29 +72,35 @@ PlatformIO 3.0 * Development platform `Freescale Kinetis `__ + Support for `PIO Unified Debugger `__ + + Updated mbed framework to 5.4.5/142 * Development platform `Nordic nRF51 `__ + Support for `PIO Unified Debugger `__ + + Updated mbed framework to 5.4.5/142 * Development platform `NXP LPC `__ + Support for `PIO Unified Debugger `__ + + Updated mbed framework to 5.4.5/142 * Development platform `Silicon Labs EFM32 `__ + Support for `PIO Unified Debugger `__ + + Updated mbed framework to 5.4.5/142 * Development platform `ST STM32 `__ + Support for `PIO Unified Debugger `__ + Added support for new boards: ST STM32F0308DISCOVERY + Updated ``tool-stlink`` to v1.3.1 + + Updated mbed framework to 5.4.5/142 * Development platform `Teensy `__ + Updated Teensy Loader CLI to v21 + Updated Arduino Core to v1.36 + + Updated mbed framework to 5.4.5/142 * Development platform `TI MSP430 `__ From 5d87fc34615381538e65d58552656a037e42f574 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 26 May 2017 01:25:03 +0300 Subject: [PATCH 069/155] Project generator for VIM --- HISTORY.rst | 1 + docs | 2 +- platformio/ide/tpls/vim/.clang_complete.tpl | 6 ++++++ platformio/ide/tpls/vim/.gcc-flags.json.tpl | 8 ++++++++ platformio/ide/tpls/vim/.gitignore.tpl | 4 ++++ 5 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 platformio/ide/tpls/vim/.clang_complete.tpl create mode 100644 platformio/ide/tpls/vim/.gcc-flags.json.tpl create mode 100644 platformio/ide/tpls/vim/.gitignore.tpl diff --git a/HISTORY.rst b/HISTORY.rst index 394dbf9e..91206a86 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -15,6 +15,7 @@ PlatformIO 3.0 - Compatibility with the popular IDEs: Eclipse, Atom, VSCode, Sublime Text, etc - Windows, MacOS, Linux (+ARMv6-8) +* Project generator for `VIM `__ * Multi-line support for the different options in `Project Configuration File "platformio.ini" `__, such as: ``build_flags``, ``build_unflags``, etc. (`issue #889 `_) diff --git a/docs b/docs index 80edf4a5..3282dffb 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 80edf4a5027a85a41c3eb8b063aec100bda31a1e +Subproject commit 3282dffb6ad6dfefadb1ca012003937a5e41931a diff --git a/platformio/ide/tpls/vim/.clang_complete.tpl b/platformio/ide/tpls/vim/.clang_complete.tpl new file mode 100644 index 00000000..bc09ec0d --- /dev/null +++ b/platformio/ide/tpls/vim/.clang_complete.tpl @@ -0,0 +1,6 @@ +% for include in includes: +-I{{include}} +% end +% for define in defines: +-D{{!define}} +% end \ No newline at end of file diff --git a/platformio/ide/tpls/vim/.gcc-flags.json.tpl b/platformio/ide/tpls/vim/.gcc-flags.json.tpl new file mode 100644 index 00000000..5af2ea3a --- /dev/null +++ b/platformio/ide/tpls/vim/.gcc-flags.json.tpl @@ -0,0 +1,8 @@ +{ + "execPath": "{{ cxx_path.replace("\\", "/") }}", + "gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }}", + "gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }}", + "gccErrorLimit": 15, + "gccIncludePaths": "{{ ','.join(includes).replace("\\", "/") }}", + "gccSuppressWarnings": false +} diff --git a/platformio/ide/tpls/vim/.gitignore.tpl b/platformio/ide/tpls/vim/.gitignore.tpl new file mode 100644 index 00000000..5dac9f52 --- /dev/null +++ b/platformio/ide/tpls/vim/.gitignore.tpl @@ -0,0 +1,4 @@ +.pioenvs +.piolibdeps +.clang_complete +.gcc-flags.json From 548d0692ba7c54bb7a634eb4adfc3c0237dd4c44 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 26 May 2017 01:25:46 +0300 Subject: [PATCH 070/155] Bump version to 3.4.0b4 --- README.rst | 3 +-- platformio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index ee868db8..be8fb1b8 100644 --- a/README.rst +++ b/README.rst @@ -41,8 +41,7 @@ PlatformIO :target: http://platformio.org `PlatformIO `_ is an open source ecosystem for IoT -development. Cross-platform build system, unified debugger and library manager. -Continuous and IDE integration. Arduino, ESP8266 and ARM mbed compatible +development. Cross-platform IDE and unified debugger. Remote unit testing and firmware updates. * **PlatformIO IDE** - The next-generation integrated development environment for IoT. C/C++ Intelligent Code Completion and Smart Code Linter for the super-fast coding. diff --git a/platformio/__init__.py b/platformio/__init__.py index 3e907a85..06fb75dc 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0b3") +VERSION = (3, 4, "0b4") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 5d6d49f7e15f6b7c9a10b05b1c5ebc5cf0e7fa7a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 27 May 2017 01:10:07 +0300 Subject: [PATCH 071/155] =?UTF-8?q?Implement=20=E2=80=9Cdebug=5Fload=5Fcmd?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs | 2 +- platformio/commands/run.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs b/docs index 3282dffb..2ae71c28 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 3282dffb6ad6dfefadb1ca012003937a5e41931a +Subproject commit 2ae71c287ca1f0fe090e806e825bd9108ad4368c diff --git a/platformio/commands/run.py b/platformio/commands/run.py index df521034..5f6f32c1 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -131,11 +131,11 @@ class EnvironmentProcessor(object): "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode", "piotest", "test_ignore", "test_port", "debug_tool", "debug_port", "debug_init_cmds", "debug_extra_cmds", - "debug_server", "debug_init_break", "debug_preload") + "debug_server", "debug_init_break", "debug_load_cmd") IGNORE_BUILD_OPTIONS = ("debug_tool", "debug_port", "debug_init_cmds", "debug_extra_cmds", "debug_server", - "debug_init_break", "debug_preload") + "debug_init_break", "debug_load_cmd") REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"} From bb55e5bc586002ca05bb7f1ae509150a7ec625cd Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 27 May 2017 01:20:32 +0300 Subject: [PATCH 072/155] Add chat button to docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 2ae71c28..9fa0e48e 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 2ae71c287ca1f0fe090e806e825bd9108ad4368c +Subproject commit 9fa0e48e5844938ecf7a9407d417f5d3ba552671 From 021f0323cbf57c9c477b1930f2491ea8f5b0f097 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 27 May 2017 01:21:56 +0300 Subject: [PATCH 073/155] Bump version to 3.4.0b5 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 06fb75dc..afea18f8 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0b4") +VERSION = (3, 4, "0b5") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 074e262e663f2a7c4dcc318dafead41cc34093b3 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 27 May 2017 02:35:48 +0300 Subject: [PATCH 074/155] Use BinTray when checking Internet connection // Resolve #968 --- platformio/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio/util.py b/platformio/util.py index 35079b16..f09f7acb 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -540,8 +540,8 @@ def get_api_result(url, params=None, data=None, auth=None, cache_valid=None): def internet_on(timeout=3): - host = "8.8.8.8" - port = 53 + host = "dl.bintray.com" + port = 443 try: socket.setdefaulttimeout(timeout) socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host, port)) From 20086b08163ed7d47119bce80aba42f302bfd320 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 27 May 2017 13:14:54 +0300 Subject: [PATCH 075/155] Note about Clang 3.9 --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 9fa0e48e..2c942c08 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 9fa0e48e5844938ecf7a9407d417f5d3ba552671 +Subproject commit 2c942c080b0159f8bc744a6441d68999538cfeec From 959dab4dc2a6170e9308ca4ef13113a211ca9f9e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 27 May 2017 13:20:54 +0300 Subject: [PATCH 076/155] Remove requests.packages.urllib3 tracks --- platformio/__main__.py | 1 - tests/conftest.py | 3 --- 2 files changed, 4 deletions(-) diff --git a/platformio/__main__.py b/platformio/__main__.py index 3a87a6be..bb5f9dc8 100644 --- a/platformio/__main__.py +++ b/platformio/__main__.py @@ -19,7 +19,6 @@ from platform import system from traceback import format_exc import click -import requests from platformio import __version__, exception, maintenance from platformio.util import get_source_dir diff --git a/tests/conftest.py b/tests/conftest.py index 46670a44..001dfc8e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,11 +15,8 @@ import os import pytest -import requests from click.testing import CliRunner -requests.packages.urllib3.disable_warnings() - @pytest.fixture(scope="module") def clirunner(): From 1bd159e60de722bdfdcc7fb9222ab9a355ad59a5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 27 May 2017 18:43:56 +0300 Subject: [PATCH 077/155] Notify about multiple installations of PIO Core // Resolve #961 --- HISTORY.rst | 4 +++- docs | 2 +- platformio/maintenance.py | 18 +++++++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 95734b04..971990f0 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -12,7 +12,7 @@ PlatformIO 3.0 - 100+ boards - Multiple architectures and development platforms - Zero Configuration - - Compatibility with the popular IDEs: Eclipse, Atom, VSCode, Sublime Text, etc + - Compatibility with the popular IDEs: Atom, VSCode, Eclipse, Sublime Text, etc - Windows, MacOS, Linux (+ARMv6-8) * Project generator for `VIM `__ @@ -21,6 +21,8 @@ PlatformIO 3.0 (`issue #889 `_) * Handle dynamic ``SRC_FILTER`` environment variable from `library.json extra script `__ +* Notify about multiple installations of PIO Core + (`issue #961 `_) * Improved auto-detecting of mbed-enabled media disks * Automatically update Git-submodules for development platforms and libraries that were installed from repository diff --git a/docs b/docs index 2c942c08..f49813d1 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 2c942c080b0159f8bc744a6441d68999538cfeec +Subproject commit f49813d1105cb4624bd6ab4c965346adb714ad5d diff --git a/platformio/maintenance.py b/platformio/maintenance.py index 66d8eb75..a5c9c853 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -156,12 +156,29 @@ class Upgrader(object): def after_upgrade(ctx): + terminal_width, _ = click.get_terminal_size() last_version = app.get_state_item("last_version", "0.0.0") if last_version == __version__: return if last_version == "0.0.0": app.set_state_item("last_version", __version__) + elif semantic_version.Version.coerce(util.pepver_to_semver( + last_version)) > semantic_version.Version.coerce( + util.pepver_to_semver(__version__)): + click.secho("*" * terminal_width, fg="yellow") + click.secho( + "Obsolete PIO Core v%s is used (previous was %s)" % + (__version__, last_version), + fg="yellow") + click.secho( + "Please remove multiple PIO Cores from a system:", fg="yellow") + click.secho( + "http://docs.platformio.org/page/faq.html" + "#multiple-pio-cores-in-a-system", + fg="cyan") + click.secho("*" * terminal_width, fg="yellow") + return else: click.secho("Please wait while upgrading PlatformIO...", fg="yellow") app.clean_cache() @@ -185,7 +202,6 @@ def after_upgrade(ctx): click.echo("") # PlatformIO banner - terminal_width, _ = click.get_terminal_size() click.echo("*" * terminal_width) click.echo("If you like %s, please:" % (click.style( "PlatformIO", fg="cyan"))) From fa24d616807691a732a9dfa3c8828f6f3e1f9f8f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 May 2017 00:30:23 +0300 Subject: [PATCH 078/155] Project generator for VSCode IDE // Issue #619 Resolve #960 --- docs | 2 +- platformio/__init__.py | 2 +- platformio/ide/tpls/vscode/.gitignore.tpl | 3 + .../vscode/.vscode/c_cpp_properties.json.tpl | 28 +++++ .../tpls/vscode/.vscode/extensions.json.tpl | 9 ++ .../ide/tpls/vscode/.vscode/launch.json.tpl | 15 +++ .../ide/tpls/vscode/.vscode/settings.json.tpl | 14 +++ .../ide/tpls/vscode/.vscode/tasks.json.tpl | 104 ++++++++++++++++++ platformio/maintenance.py | 2 + 9 files changed, 177 insertions(+), 2 deletions(-) create mode 100644 platformio/ide/tpls/vscode/.gitignore.tpl create mode 100644 platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl create mode 100644 platformio/ide/tpls/vscode/.vscode/extensions.json.tpl create mode 100644 platformio/ide/tpls/vscode/.vscode/launch.json.tpl create mode 100644 platformio/ide/tpls/vscode/.vscode/settings.json.tpl create mode 100644 platformio/ide/tpls/vscode/.vscode/tasks.json.tpl diff --git a/docs b/docs index f49813d1..fb19765e 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit f49813d1105cb4624bd6ab4c965346adb714ad5d +Subproject commit fb19765e60ff3cf29bfd6480d0b094c1ed4b448d diff --git a/platformio/__init__.py b/platformio/__init__.py index 190b6ec7..520efae3 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0b6") +VERSION = (3, 4, "0b7") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/ide/tpls/vscode/.gitignore.tpl b/platformio/ide/tpls/vscode/.gitignore.tpl new file mode 100644 index 00000000..e22b3c16 --- /dev/null +++ b/platformio/ide/tpls/vscode/.gitignore.tpl @@ -0,0 +1,3 @@ +.pioenvs +.piolibdeps +.vscode/browse.vc.db* diff --git a/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl b/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl new file mode 100644 index 00000000..2e7d9417 --- /dev/null +++ b/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl @@ -0,0 +1,28 @@ +{ + "configurations": [ + { + "includePath": [ +% for include in includes: + "{{include.replace('"', '\\"')}}", +% end + "" + ], + "browse": { + "limitSymbolsToIncludedHeaders": true, + "databaseFilename": "", + "path": [ +% for include in includes: + "{{include.replace('"', '\\"')}}", +% end + "" + ] + }, + "defines": [ +% for define in defines: + "{{!define.replace('"', '\\"')}}", +% end + "" + ] + } + ] +} \ No newline at end of file diff --git a/platformio/ide/tpls/vscode/.vscode/extensions.json.tpl b/platformio/ide/tpls/vscode/.vscode/extensions.json.tpl new file mode 100644 index 00000000..7315e95d --- /dev/null +++ b/platformio/ide/tpls/vscode/.vscode/extensions.json.tpl @@ -0,0 +1,9 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + "ms-vscode.cpptools", + "webfreak.debug" + ] +} \ No newline at end of file diff --git a/platformio/ide/tpls/vscode/.vscode/launch.json.tpl b/platformio/ide/tpls/vscode/.vscode/launch.json.tpl new file mode 100644 index 00000000..a09b7dcd --- /dev/null +++ b/platformio/ide/tpls/vscode/.vscode/launch.json.tpl @@ -0,0 +1,15 @@ +% from os.path import dirname, join +{ + "version": "0.2.0", + "configurations": [ + { + "type": "gdb", + "request": "launch", + "cwd": "${workspaceRoot}", + "name": "PlatformIO Debugger", + "target": "{{prog_path.replace('"', '\\"')}}", + "gdbpath": "{{join(dirname(platformio_path), "piodebuggdb").replace('"', '\\"')}}", + "autorun": [ "source .pioinit" ] + } + ] +} \ No newline at end of file diff --git a/platformio/ide/tpls/vscode/.vscode/settings.json.tpl b/platformio/ide/tpls/vscode/.vscode/settings.json.tpl new file mode 100644 index 00000000..8958d2e1 --- /dev/null +++ b/platformio/ide/tpls/vscode/.vscode/settings.json.tpl @@ -0,0 +1,14 @@ +{ + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "**/.pioenvs": true, + "**/.piolibdeps": true, + ".vscode/BROWSE.VC.DB*": true + }, + "C_Cpp.intelliSenseEngine": "Default", + "C_Cpp.autocomplete": "Default" +} \ No newline at end of file diff --git a/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl b/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl new file mode 100644 index 00000000..87f7f656 --- /dev/null +++ b/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl @@ -0,0 +1,104 @@ +{ + "version": "0.1.0", + "command": "{{platformio_path}}", + "isShellCommand": true, + "args": ["-c", "vscode"], + "showOutput": "always", + "echoCommand": false, + "suppressTaskName": true, + "tasks": [ + { + "taskName": "PlatformIO: Build", + "isBuildCommand": true, + "args": ["run"], + "problemMatcher": { + "owner": "cpp", + "fileLocation": ["relative", "${workspaceRoot}"], + "pattern": { + "regexp": "^([^:\\n]+):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + } + }, + { + "taskName": "PlatformIO: Clean", + "args": ["run", "-t", "clean"] + }, + { + "taskName": "PlatformIO: Upload", + "args": ["run", "-t", "upload"], + "problemMatcher": { + "owner": "cpp", + "fileLocation": ["relative", "${workspaceRoot}"], + "pattern": { + "regexp": "^([^:\\n]+):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + } + }, + { + "taskName": "PlatformIO: Upload using Programmer", + "args": ["run", "-t", "program"], + "problemMatcher": { + "owner": "cpp", + "fileLocation": ["relative", "${workspaceRoot}"], + "pattern": { + "regexp": "^([^:\\n]+):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + } + }, + { + "taskName": "PlatformIO: Upload SPIFFS image", + "args": ["run", "-t", "uploadfs"], + "problemMatcher": { + "owner": "cpp", + "fileLocation": ["relative", "${workspaceRoot}"], + "pattern": { + "regexp": "^([^:\\n]+):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + } + }, + { + "taskName": "PlatformIO: Test", + "args": ["test"], + "problemMatcher": { + "owner": "cpp", + "fileLocation": ["relative", "${workspaceRoot}"], + "pattern": { + "regexp": "^([^:\\n]+):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + } + }, + { + "taskName": "PlatformIO: Update platforms and libraries", + "args": ["update"] + }, + { + "taskName": "PlatformIO: Upgrade PIO Core", + "args": ["upgrade"] + } + ] +} \ No newline at end of file diff --git a/platformio/maintenance.py b/platformio/maintenance.py index a5c9c853..183e3dd6 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -49,6 +49,8 @@ def on_platformio_start(ctx, force, caller): if not caller: if getenv("PLATFORMIO_CALLER"): caller = getenv("PLATFORMIO_CALLER") + elif getenv("VSCODE_PID") or getenv("VSCODE_NLS_CONFIG"): + caller = "vscode" elif util.is_container(): if getenv("C9_UID"): caller = "C9" From 7637e1ad690679dc0a991d2ee32a5cdb407577e2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 May 2017 02:06:58 +0300 Subject: [PATCH 079/155] Normalize Windows PATHs for VSCode --- platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl | 4 ++-- platformio/ide/tpls/vscode/.vscode/launch.json.tpl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 2e7d9417..d2de0f20 100644 --- a/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl @@ -3,7 +3,7 @@ { "includePath": [ % for include in includes: - "{{include.replace('"', '\\"')}}", + "{{include.replace('"', '\\"').replace('\\\\', '/').replace('\\', '/')}}", % end "" ], @@ -12,7 +12,7 @@ "databaseFilename": "", "path": [ % for include in includes: - "{{include.replace('"', '\\"')}}", + "{{include.replace('"', '\\"').replace('\\\\', '/').replace('\\', '/')}}", % end "" ] diff --git a/platformio/ide/tpls/vscode/.vscode/launch.json.tpl b/platformio/ide/tpls/vscode/.vscode/launch.json.tpl index a09b7dcd..745fee62 100644 --- a/platformio/ide/tpls/vscode/.vscode/launch.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/launch.json.tpl @@ -7,8 +7,8 @@ "request": "launch", "cwd": "${workspaceRoot}", "name": "PlatformIO Debugger", - "target": "{{prog_path.replace('"', '\\"')}}", - "gdbpath": "{{join(dirname(platformio_path), "piodebuggdb").replace('"', '\\"')}}", + "target": "{{prog_path.replace('"', '\\"').replace('\\\\', '/').replace('\\', '/')}}", + "gdbpath": "{{join(dirname(platformio_path), "piodebuggdb").replace('"', '\\"').replace('\\\\', '/').replace('\\', '/')}}", "autorun": [ "source .pioinit" ] } ] From 801ac28c117815ea5db9a0b4b67be4c005a9f44f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 May 2017 02:24:14 +0300 Subject: [PATCH 080/155] Update docs for VSCode --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index fb19765e..c2907d01 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit fb19765e60ff3cf29bfd6480d0b094c1ed4b448d +Subproject commit c2907d01879be3c36694ab261671018580bec964 From 50ec9e48bfbc2774cfc8f03c09e7514462f09148 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 May 2017 02:34:32 +0300 Subject: [PATCH 081/155] Specify particular platform for c_cpp configuration --- .../ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl | 9 +++++++++ 1 file changed, 9 insertions(+) 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 d2de0f20..f5db535f 100644 --- a/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl @@ -1,6 +1,15 @@ { "configurations": [ { +% import platform +% systype = platform.system().lower() +% if systype == "windows": + "name": "Win32", +% elif systype == "darwin": + "name": "Mac", +% else: + "name": "Linux", +% end "includePath": [ % for include in includes: "{{include.replace('"', '\\"').replace('\\\\', '/').replace('\\', '/')}}", From 641c981c4b25e0e34306f8943a179b6afc7aefe8 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 May 2017 02:59:43 +0300 Subject: [PATCH 082/155] Add VSCode to PlatformIO IDE section --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index c2907d01..63cae47c 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit c2907d01879be3c36694ab261671018580bec964 +Subproject commit 63cae47ce3739bc3dcf6c66cf93b6a50ba1c55ec From 68d7630b446f97f9e4e7dcb85e8c4f7fb537531f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 May 2017 13:12:59 +0300 Subject: [PATCH 083/155] Better path escaping --- platformio/__init__.py | 2 +- platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl | 4 ++-- platformio/ide/tpls/vscode/.vscode/launch.json.tpl | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 520efae3..b011259d 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0b7") +VERSION = (3, 4, "0b8") __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 f5db535f..5fea5091 100644 --- a/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl @@ -12,7 +12,7 @@ % end "includePath": [ % for include in includes: - "{{include.replace('"', '\\"').replace('\\\\', '/').replace('\\', '/')}}", + "{{include.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", % end "" ], @@ -21,7 +21,7 @@ "databaseFilename": "", "path": [ % for include in includes: - "{{include.replace('"', '\\"').replace('\\\\', '/').replace('\\', '/')}}", + "{{include.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", % end "" ] diff --git a/platformio/ide/tpls/vscode/.vscode/launch.json.tpl b/platformio/ide/tpls/vscode/.vscode/launch.json.tpl index 745fee62..409c1b98 100644 --- a/platformio/ide/tpls/vscode/.vscode/launch.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/launch.json.tpl @@ -7,8 +7,8 @@ "request": "launch", "cwd": "${workspaceRoot}", "name": "PlatformIO Debugger", - "target": "{{prog_path.replace('"', '\\"').replace('\\\\', '/').replace('\\', '/')}}", - "gdbpath": "{{join(dirname(platformio_path), "piodebuggdb").replace('"', '\\"').replace('\\\\', '/').replace('\\', '/')}}", + "target": "{{prog_path.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", + "gdbpath": "{{join(dirname(platformio_path), "piodebuggdb").replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", "autorun": [ "source .pioinit" ] } ] From 466d1b1c14757a3ee926d743f9f98009324ae6ee Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 29 May 2017 13:07:25 +0300 Subject: [PATCH 084/155] Remove C_CPP settings from VSCode --- platformio/ide/tpls/vscode/.vscode/settings.json.tpl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/platformio/ide/tpls/vscode/.vscode/settings.json.tpl b/platformio/ide/tpls/vscode/.vscode/settings.json.tpl index 8958d2e1..9138de66 100644 --- a/platformio/ide/tpls/vscode/.vscode/settings.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/settings.json.tpl @@ -8,7 +8,5 @@ "**/.pioenvs": true, "**/.piolibdeps": true, ".vscode/BROWSE.VC.DB*": true - }, - "C_Cpp.intelliSenseEngine": "Default", - "C_Cpp.autocomplete": "Default" + } } \ No newline at end of file From 908f0ba833bc431c6458f795b6a4eeed1a7dddc6 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 29 May 2017 15:41:56 +0300 Subject: [PATCH 085/155] Bump 3.4.0b9 --- platformio/__init__.py | 2 +- platformio/ide/tpls/vscode/.vscode/settings.json.tpl | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index b011259d..f3766efd 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0b8") +VERSION = (3, 4, "0b9") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/ide/tpls/vscode/.vscode/settings.json.tpl b/platformio/ide/tpls/vscode/.vscode/settings.json.tpl index 9138de66..dc0407f8 100644 --- a/platformio/ide/tpls/vscode/.vscode/settings.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/settings.json.tpl @@ -6,7 +6,6 @@ "**/CVS": true, "**/.DS_Store": true, "**/.pioenvs": true, - "**/.piolibdeps": true, - ".vscode/BROWSE.VC.DB*": true + "**/.piolibdeps": true } } \ No newline at end of file From 1e14792ea0f71700e5c7657d1ce3e34de765cca7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 29 May 2017 15:59:02 +0300 Subject: [PATCH 086/155] Update docs for VSCode --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 63cae47c..6d8705a2 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 63cae47ce3739bc3dcf6c66cf93b6a50ba1c55ec +Subproject commit 6d8705a27239e06b67b96c392103b969599f4e9c From 2ea9af81512efad1a2d27e678ca08bdaca30c448 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 29 May 2017 19:00:18 +0300 Subject: [PATCH 087/155] Update VSCode main picture --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 6d8705a2..d251ab48 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 6d8705a27239e06b67b96c392103b969599f4e9c +Subproject commit d251ab485835d492c0526b317eeee51c9ccdacde From 232a735dde89328d2755e9045d61b1d4269dcd03 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 29 May 2017 20:17:22 +0300 Subject: [PATCH 088/155] Improve VSCode docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index d251ab48..d859a73c 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit d251ab485835d492c0526b317eeee51c9ccdacde +Subproject commit d859a73c120130689fa8bc18e08dd8cdf51bfd5b From f6a3d9f4740390042963f2672d529dc787acd5d2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 29 May 2017 20:23:12 +0300 Subject: [PATCH 089/155] Add link to PIO IDE for VSCode extension in marketplace --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index d859a73c..4583facc 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit d859a73c120130689fa8bc18e08dd8cdf51bfd5b +Subproject commit 4583facc574562154a9a97a469e4de7810df878c From 198dadc209afff39484bd1b107728e142fa71717 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 30 May 2017 14:06:25 +0300 Subject: [PATCH 090/155] Verify that serial port is ready for connection before uploading --- platformio/builder/tools/pioupload.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 27b1c744..c76c1ef5 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -23,7 +23,7 @@ from shutil import copyfile from time import sleep from SCons.Node.Alias import Alias -from serial import Serial +from serial import Serial, SerialException from platformio import util @@ -72,6 +72,11 @@ def WaitForNewSerialPort(env, before): new_port = p['port'] break + try: + Serial(new_port) + except SerialException: + sleep(1) + if not new_port: sys.stderr.write("Error: Couldn't find a board on the selected port. " "Check that you have the correct port selected. " From 0c9e6ef577b4bc9f89dc8d1d1df310b63c4b2692 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 30 May 2017 19:42:32 +0300 Subject: [PATCH 091/155] Close serial port after verification --- 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 c76c1ef5..d715692a 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -73,7 +73,8 @@ def WaitForNewSerialPort(env, before): break try: - Serial(new_port) + s = Serial(new_port) + s.close() except SerialException: sleep(1) From b6f9220f3f2e529df83fb45831e8e401bc6d8ee8 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 30 May 2017 22:11:09 +0300 Subject: [PATCH 092/155] Minor improvements to docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 4583facc..c84c1b65 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 4583facc574562154a9a97a469e4de7810df878c +Subproject commit c84c1b658f61b4548042b561624674200199b79f From ff6353a1eaaed714c5d40f56846417ab469b9bf9 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 31 May 2017 00:56:05 +0300 Subject: [PATCH 093/155] VSCoe task as external program --- platformio/ide/tpls/vscode/.vscode/tasks.json.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl b/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl index 87f7f656..cbda431e 100644 --- a/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl @@ -1,7 +1,7 @@ { "version": "0.1.0", "command": "{{platformio_path}}", - "isShellCommand": true, + "isShellCommand": false, "args": ["-c", "vscode"], "showOutput": "always", "echoCommand": false, From aed6d9a91bd3b26e5dc6ad043c61c01eff4de65a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 31 May 2017 22:21:25 +0300 Subject: [PATCH 094/155] Nordic nRF52 & Maxim Integrated development platforms --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index c84c1b65..d2e222c7 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit c84c1b658f61b4548042b561624674200199b79f +Subproject commit d2e222c7e2b03b977d99113ed8636df387d9181d From 6502cf55527959f57765d82ab569f80423a3ee71 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 1 Jun 2017 15:14:52 +0300 Subject: [PATCH 095/155] Fix issue with INO to CPP converter and multiline strings --- platformio/builder/tools/piomisc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 8fef5006..c382a1eb 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -115,7 +115,7 @@ class InoToCPPConverter(object): elif stropen: newlines[len(newlines) - 1] += line[:-1] continue - elif stropen and line.endswith('";'): + elif stropen and line.endswith(('",', '";')): newlines[len(newlines) - 1] += line stropen = False newlines.append('#line %d "%s"' % From a53a38b5dda8330e7fa0fde3abab3008e79f0d20 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 1 Jun 2017 19:21:32 +0300 Subject: [PATCH 096/155] =?UTF-8?q?FAQ:=20=E2=80=98platformio=E2=80=99=20i?= =?UTF-8?q?s=20not=20recognized=20as=20an=20internal=20or=20external=20com?= =?UTF-8?q?mand?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index d2e222c7..89630419 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit d2e222c7e2b03b977d99113ed8636df387d9181d +Subproject commit 89630419d5ad6b5a176e33d614027da09eb4616f From e2811a4a28c2d68b4b200e1a6c8f4c74bf86a6ba Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 1 Jun 2017 19:47:50 +0300 Subject: [PATCH 097/155] Check PIO download storage for "Internet ON" --- docs | 2 +- platformio/util.py | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docs b/docs index 89630419..1666723f 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 89630419d5ad6b5a176e33d614027da09eb4616f +Subproject commit 1666723f26e84933e43638250cbf51e9553627f7 diff --git a/platformio/util.py b/platformio/util.py index f09f7acb..b8fc8aa5 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -540,14 +540,15 @@ def get_api_result(url, params=None, data=None, auth=None, cache_valid=None): def internet_on(timeout=3): - host = "dl.bintray.com" - port = 443 - try: - socket.setdefaulttimeout(timeout) - socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host, port)) - return True - except: # pylint: disable=bare-except - return False + socket.setdefaulttimeout(timeout) + for host in ("dl.bintray.com", "dl.platformio.org"): + try: + socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect( + (host, 80)) + return True + except: # pylint: disable=bare-except + pass + return False def get_pythonexe_path(): From 5da5bd43e4138ecef0b001cb312138e55d73c2ec Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 1 Jun 2017 19:53:05 +0300 Subject: [PATCH 098/155] Ensure that package exists --- platformio/managers/package.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio/managers/package.py b/platformio/managers/package.py index ce73c5d8..82d8c901 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -305,7 +305,8 @@ class PkgInstallerMixin(object): def get_package_dir(self, name, requirements=None, url=None): manifest = self.get_package(name, requirements, url) - return manifest.get("__pkg_dir") if manifest else None + return manifest.get("__pkg_dir") if manifest and isdir( + manifest.get("__pkg_dir")) else None def find_pkg_root(self, src_dir): if self.manifest_exists(src_dir): From 0376a92ebb8d9e4365b486d212ae4f1b940bd0a4 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 1 Jun 2017 21:35:26 +0300 Subject: [PATCH 099/155] FAQ: UnicodeDecodeError: Non-ASCII characters found in build environment --- docs | 2 +- platformio/builder/main.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs b/docs index 1666723f..e023a616 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 1666723f26e84933e43638250cbf51e9553627f7 +Subproject commit e023a61674cf63fb55e459bff3a633841bf8c193 diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 83eb6029..79b25f9e 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -14,6 +14,7 @@ import base64 import json +import sys from os import environ from os.path import join from time import time @@ -166,5 +167,13 @@ if "envdump" in COMMAND_LINE_TARGETS: env.Exit(0) if "idedata" in COMMAND_LINE_TARGETS: - print "\n%s\n" % json.dumps(env.DumpIDEData()) - env.Exit(0) + try: + print "\n%s\n" % json.dumps(env.DumpIDEData()) + env.Exit(0) + except UnicodeDecodeError: + sys.stderr.write( + "\nUnicodeDecodeError: Non-ASCII characters found in build " + "environment\n" + "See explanation in FAQ > Troubleshooting > Building\n" + "http://docs.platformio.org/page/faq.html\n\n") + env.Exit(1) From 52f0e556e2a9bc9b231234a0f60e0f2723fb354c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 2 Jun 2017 02:34:10 +0300 Subject: [PATCH 100/155] Do not overwrite workspace settings for VSCode --- docs | 2 +- platformio/ide/tpls/vscode/.vscode/settings.json.tpl | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 platformio/ide/tpls/vscode/.vscode/settings.json.tpl diff --git a/docs b/docs index e023a616..4142d352 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit e023a61674cf63fb55e459bff3a633841bf8c193 +Subproject commit 4142d35242c1864509bee007ad20f53285f47fc3 diff --git a/platformio/ide/tpls/vscode/.vscode/settings.json.tpl b/platformio/ide/tpls/vscode/.vscode/settings.json.tpl deleted file mode 100644 index dc0407f8..00000000 --- a/platformio/ide/tpls/vscode/.vscode/settings.json.tpl +++ /dev/null @@ -1,11 +0,0 @@ -{ - "files.exclude": { - "**/.git": true, - "**/.svn": true, - "**/.hg": true, - "**/CVS": true, - "**/.DS_Store": true, - "**/.pioenvs": true, - "**/.piolibdeps": true - } -} \ No newline at end of file From d30b8fffa1c8db1305a5bf617313a5dac15b7262 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 2 Jun 2017 02:34:52 +0300 Subject: [PATCH 101/155] Bump version to 3.4.0b10 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index f3766efd..9a299933 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0b9") +VERSION = (3, 4, "0b10") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 8127e8b2ff8a01219790f75c8ca938d643972b7b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 5 Jun 2017 01:46:31 +0300 Subject: [PATCH 102/155] Update docs for VSCode --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 4142d352..7bad8d98 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 4142d35242c1864509bee007ad20f53285f47fc3 +Subproject commit 7bad8d98f29b21a84f945f5651cee77fbcd1d5f2 From 45e75f7473ceacd80b2fd76eb5bb0e899653479b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 5 Jun 2017 16:02:39 +0300 Subject: [PATCH 103/155] 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. --- .coveragerc | 2 +- README.rst | 2 +- docs | 2 +- examples | 2 +- platformio/__init__.py | 2 +- platformio/__main__.py | 2 +- platformio/app.py | 2 +- platformio/builder/__init__.py | 2 +- platformio/builder/main.py | 2 +- platformio/builder/tools/__init__.py | 2 +- platformio/builder/tools/pioide.py | 2 +- platformio/builder/tools/piolib.py | 2 +- platformio/builder/tools/piomisc.py | 2 +- platformio/builder/tools/pioplatform.py | 2 +- platformio/builder/tools/pioupload.py | 2 +- platformio/builder/tools/piowinhooks.py | 2 +- platformio/builder/tools/platformio.py | 2 +- platformio/commands/__init__.py | 2 +- platformio/commands/account.py | 2 +- platformio/commands/boards.py | 2 +- platformio/commands/ci.py | 2 +- platformio/commands/debug.py | 2 +- platformio/commands/device.py | 2 +- platformio/commands/init.py | 2 +- platformio/commands/lib.py | 2 +- platformio/commands/platform.py | 2 +- platformio/commands/remote.py | 2 +- platformio/commands/run.py | 2 +- platformio/commands/settings.py | 2 +- platformio/commands/test.py | 2 +- platformio/commands/update.py | 2 +- platformio/commands/upgrade.py | 2 +- platformio/downloader.py | 2 +- platformio/exception.py | 2 +- platformio/ide/__init__.py | 2 +- platformio/ide/projectgenerator.py | 2 +- platformio/maintenance.py | 2 +- platformio/managers/__init__.py | 2 +- platformio/managers/core.py | 2 +- platformio/managers/lib.py | 2 +- platformio/managers/package.py | 2 +- platformio/managers/platform.py | 2 +- platformio/telemetry.py | 2 +- platformio/unpacker.py | 2 +- platformio/util.py | 2 +- platformio/vcsclient.py | 2 +- scripts/99-platformio-udev.rules | 2 +- scripts/docspregen.py | 8 ++++---- scripts/fixsymlink.py | 2 +- scripts/get-platformio.py | 2 +- setup.py | 2 +- tests/commands/test_boards.py | 2 +- tests/commands/test_ci.py | 2 +- tests/commands/test_init.py | 2 +- tests/commands/test_lib.py | 2 +- tests/commands/test_platform.py | 2 +- tests/commands/test_settings.py | 2 +- tests/commands/test_test.py | 2 +- tests/commands/test_update.py | 2 +- tests/conftest.py | 2 +- tests/test_examples.py | 2 +- tests/test_ino2cpp.py | 2 +- tests/test_maintenance.py | 2 +- tests/test_managers.py | 2 +- tests/test_pkgmanifest.py | 2 +- tox.ini | 4 ++-- 66 files changed, 70 insertions(+), 70 deletions(-) diff --git a/.coveragerc b/.coveragerc index 80716d3d..01ec788a 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/README.rst b/README.rst index be8fb1b8..3b136a36 100644 --- a/README.rst +++ b/README.rst @@ -191,7 +191,7 @@ See `contributing guidelines +Copyright (c) 2014-present PlatformIO The PlatformIO is licensed under the permissive Apache 2.0 license, so you can use it in both commercial and personal projects with confidence. diff --git a/docs b/docs index 7bad8d98..41943b7d 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 7bad8d98f29b21a84f945f5651cee77fbcd1d5f2 +Subproject commit 41943b7d599e63c71de76bab40a9233077fdfde2 diff --git a/examples b/examples index 9d57e3c8..18f010d8 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 9d57e3c84dd738dcb1597a6d8611d9f6feca327d +Subproject commit 18f010d8e2b112ba3140489c245e7ca0958d6828 diff --git a/platformio/__init__.py b/platformio/__init__.py index 9a299933..fb0e5549 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/__main__.py b/platformio/__main__.py index bb5f9dc8..b1872fd2 100644 --- a/platformio/__main__.py +++ b/platformio/__main__.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/app.py b/platformio/app.py index 6e44e5d0..704db38a 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/builder/__init__.py b/platformio/builder/__init__.py index 95899c71..b0514903 100644 --- a/platformio/builder/__init__.py +++ b/platformio/builder/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 79b25f9e..31fc8076 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/builder/tools/__init__.py b/platformio/builder/tools/__init__.py index 95899c71..b0514903 100644 --- a/platformio/builder/tools/__init__.py +++ b/platformio/builder/tools/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/builder/tools/pioide.py b/platformio/builder/tools/pioide.py index 11a57474..d0b27286 100644 --- a/platformio/builder/tools/pioide.py +++ b/platformio/builder/tools/pioide.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 4798f24d..2db543a6 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index c382a1eb..1f689b91 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index da15af18..3fbe607e 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index d715692a..e666276c 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/builder/tools/piowinhooks.py b/platformio/builder/tools/piowinhooks.py index c1b0895a..5ac19f5d 100644 --- a/platformio/builder/tools/piowinhooks.py +++ b/platformio/builder/tools/piowinhooks.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 1f2186cf..3998418d 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/__init__.py b/platformio/commands/__init__.py index 95899c71..b0514903 100644 --- a/platformio/commands/__init__.py +++ b/platformio/commands/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/account.py b/platformio/commands/account.py index b2bf9bb0..d728a558 100644 --- a/platformio/commands/account.py +++ b/platformio/commands/account.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/boards.py b/platformio/commands/boards.py index 5f5921c9..0d9d6015 100644 --- a/platformio/commands/boards.py +++ b/platformio/commands/boards.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/ci.py b/platformio/commands/ci.py index 82784eb4..0db1daa9 100644 --- a/platformio/commands/ci.py +++ b/platformio/commands/ci.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/debug.py b/platformio/commands/debug.py index 1a6e49b5..e43aeed1 100644 --- a/platformio/commands/debug.py +++ b/platformio/commands/debug.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/device.py b/platformio/commands/device.py index cba2054c..691180b6 100644 --- a/platformio/commands/device.py +++ b/platformio/commands/device.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/init.py b/platformio/commands/init.py index 0ee751c0..230594f1 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index 45984157..c9862ace 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/platform.py b/platformio/commands/platform.py index 70ac4b39..0e13610c 100644 --- a/platformio/commands/platform.py +++ b/platformio/commands/platform.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/remote.py b/platformio/commands/remote.py index 1945bf87..9b7ad5fb 100644 --- a/platformio/commands/remote.py +++ b/platformio/commands/remote.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 5f6f32c1..4a02e8bc 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/settings.py b/platformio/commands/settings.py index 08649221..a29d3997 100644 --- a/platformio/commands/settings.py +++ b/platformio/commands/settings.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/test.py b/platformio/commands/test.py index 34b30ec9..30a5de6c 100644 --- a/platformio/commands/test.py +++ b/platformio/commands/test.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/update.py b/platformio/commands/update.py index 41d0185d..65c44fac 100644 --- a/platformio/commands/update.py +++ b/platformio/commands/update.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index cc735393..a23c695a 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/downloader.py b/platformio/downloader.py index 356413c2..f4feaa61 100644 --- a/platformio/downloader.py +++ b/platformio/downloader.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/exception.py b/platformio/exception.py index 346156c7..8743e784 100644 --- a/platformio/exception.py +++ b/platformio/exception.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/ide/__init__.py b/platformio/ide/__init__.py index 95899c71..b0514903 100644 --- a/platformio/ide/__init__.py +++ b/platformio/ide/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index 6020a7e4..b03cc772 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/maintenance.py b/platformio/maintenance.py index 183e3dd6..0900b0b5 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/managers/__init__.py b/platformio/managers/__init__.py index 95899c71..b0514903 100644 --- a/platformio/managers/__init__.py +++ b/platformio/managers/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 6b8054f6..7849f05b 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/managers/lib.py b/platformio/managers/lib.py index 32cf6308..fea2a62a 100644 --- a/platformio/managers/lib.py +++ b/platformio/managers/lib.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/managers/package.py b/platformio/managers/package.py index 82d8c901..5d4386a6 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index ad2800de..e5f8f47e 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/telemetry.py b/platformio/telemetry.py index b614b4f7..3a2b4aad 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/unpacker.py b/platformio/unpacker.py index 67ca78a7..036dcc4c 100644 --- a/platformio/unpacker.py +++ b/platformio/unpacker.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/util.py b/platformio/util.py index b8fc8aa5..5b3d2302 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/platformio/vcsclient.py b/platformio/vcsclient.py index 8a35e794..e79da215 100644 --- a/platformio/vcsclient.py +++ b/platformio/vcsclient.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/scripts/99-platformio-udev.rules b/scripts/99-platformio-udev.rules index 3e8b63a0..7c7b410a 100644 --- a/scripts/99-platformio-udev.rules +++ b/scripts/99-platformio-udev.rules @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/scripts/docspregen.py b/scripts/docspregen.py index 00c67901..8b35f9ef 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. @@ -165,7 +165,7 @@ def generate_platform(name): lines = [] lines.append( - """.. Copyright 2014-present PlatformIO + """.. 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 @@ -271,7 +271,7 @@ def generate_framework(type_, data): lines = [] lines.append( - """.. Copyright 2014-present PlatformIO + """.. 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 @@ -395,7 +395,7 @@ def update_embedded_boards(): lines = [] lines.append( - """.. Copyright 2014-present PlatformIO + """.. 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 diff --git a/scripts/fixsymlink.py b/scripts/fixsymlink.py index 44a628fd..a73a0109 100644 --- a/scripts/fixsymlink.py +++ b/scripts/fixsymlink.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/scripts/get-platformio.py b/scripts/get-platformio.py index b70c9598..be6a4c87 100644 --- a/scripts/get-platformio.py +++ b/scripts/get-platformio.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/setup.py b/setup.py index d7ed7447..39046c36 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tests/commands/test_boards.py b/tests/commands/test_boards.py index 6b216146..c44ff438 100644 --- a/tests/commands/test_boards.py +++ b/tests/commands/test_boards.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tests/commands/test_ci.py b/tests/commands/test_ci.py index 884e9b50..04daeb33 100644 --- a/tests/commands/test_ci.py +++ b/tests/commands/test_ci.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tests/commands/test_init.py b/tests/commands/test_init.py index 6f366f90..4b7c0a94 100644 --- a/tests/commands/test_init.py +++ b/tests/commands/test_init.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tests/commands/test_lib.py b/tests/commands/test_lib.py index 104213af..31ed9809 100644 --- a/tests/commands/test_lib.py +++ b/tests/commands/test_lib.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tests/commands/test_platform.py b/tests/commands/test_platform.py index fe29ce58..bdc50916 100644 --- a/tests/commands/test_platform.py +++ b/tests/commands/test_platform.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tests/commands/test_settings.py b/tests/commands/test_settings.py index bec21889..c6cd33da 100644 --- a/tests/commands/test_settings.py +++ b/tests/commands/test_settings.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tests/commands/test_test.py b/tests/commands/test_test.py index e7086290..592bce0c 100644 --- a/tests/commands/test_test.py +++ b/tests/commands/test_test.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tests/commands/test_update.py b/tests/commands/test_update.py index f17f5bbd..b8309fb8 100644 --- a/tests/commands/test_update.py +++ b/tests/commands/test_update.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tests/conftest.py b/tests/conftest.py index 001dfc8e..b407b328 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tests/test_examples.py b/tests/test_examples.py index 42ff2b5e..86bc7741 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tests/test_ino2cpp.py b/tests/test_ino2cpp.py index 337eee72..0ef6e194 100644 --- a/tests/test_ino2cpp.py +++ b/tests/test_ino2cpp.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tests/test_maintenance.py b/tests/test_maintenance.py index fd71acf1..9fd7fd6b 100644 --- a/tests/test_maintenance.py +++ b/tests/test_maintenance.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tests/test_managers.py b/tests/test_managers.py index a9320def..e0d0b7a9 100644 --- a/tests/test_managers.py +++ b/tests/test_managers.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tests/test_pkgmanifest.py b/tests/test_pkgmanifest.py index f70dccde..a34d6864 100644 --- a/tests/test_pkgmanifest.py +++ b/tests/test_pkgmanifest.py @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. diff --git a/tox.ini b/tox.ini index 406d179c..7ced7a1c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,4 @@ -# Copyright 2014-present PlatformIO +# 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. @@ -21,7 +21,7 @@ usedevelop = True deps = isort flake8 - yapf<0.16 + yapf<0.17 pylint pytest commands = python --version From 4d1a135d76c4c6f22d2c0b1f95c92dfe722dbfdf Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 5 Jun 2017 16:05:05 +0300 Subject: [PATCH 104/155] Apply YAPF --- platformio/app.py | 6 ++- platformio/builder/main.py | 3 +- platformio/builder/tools/pioide.py | 27 ++++++++----- platformio/builder/tools/piolib.py | 27 +++++++------ platformio/builder/tools/piomisc.py | 8 ++-- platformio/builder/tools/pioplatform.py | 3 +- platformio/builder/tools/pioupload.py | 8 ++-- platformio/builder/tools/platformio.py | 7 ++-- platformio/commands/init.py | 7 ++-- platformio/commands/lib.py | 29 ++++++------- platformio/commands/platform.py | 4 +- platformio/commands/run.py | 26 ++++++------ platformio/downloader.py | 5 ++- platformio/ide/projectgenerator.py | 24 +++++++---- platformio/maintenance.py | 54 +++++++++++++------------ platformio/managers/lib.py | 15 +++---- platformio/managers/package.py | 26 ++++++------ platformio/managers/platform.py | 21 +++++----- platformio/telemetry.py | 5 ++- platformio/util.py | 20 ++++----- platformio/vcsclient.py | 8 ++-- 21 files changed, 183 insertions(+), 150 deletions(-) diff --git a/platformio/app.py b/platformio/app.py index 704db38a..d4bfdb3e 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -64,7 +64,8 @@ DEFAULT_SETTINGS = { "description": ("Telemetry service (Yes/No)"), - "value": True + "value": + True } } @@ -333,7 +334,8 @@ def set_session_var(name, value): def is_disabled_progressbar(): return any([ - get_session_var("force_option"), util.is_ci(), + get_session_var("force_option"), + util.is_ci(), getenv("PLATFORMIO_DISABLE_PROGRESSBAR") == "true" ]) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 31fc8076..679236bc 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -89,7 +89,8 @@ DEFAULT_ENV_OPTIONS = dict( BUILDSRC_DIR=join("$BUILD_DIR", "src"), BUILDTEST_DIR=join("$BUILD_DIR", "test"), LIBSOURCE_DIRS=[ - util.get_projectlib_dir(), util.get_projectlibdeps_dir(), + util.get_projectlib_dir(), + util.get_projectlibdeps_dir(), join("$PIOHOME_DIR", "lib") ], PROGNAME="program", diff --git a/platformio/builder/tools/pioide.py b/platformio/builder/tools/pioide.py index d0b27286..e05b2d79 100644 --- a/platformio/builder/tools/pioide.py +++ b/platformio/builder/tools/pioide.py @@ -74,17 +74,22 @@ def DumpIDEData(env): data = { "libsource_dirs": [env.subst(l) for l in env.get("LIBSOURCE_DIRS", [])], - "defines": dump_defines(env), - "includes": dump_includes(env), - "cc_flags": env.subst(LINTCCOM), - "cxx_flags": env.subst(LINTCXXCOM), - "cc_path": util.where_is_program( - env.subst("$CC"), env.subst("${ENV['PATH']}")), - "cxx_path": util.where_is_program( - env.subst("$CXX"), env.subst("${ENV['PATH']}")), - "gdb_path": util.where_is_program( - env.subst("$GDB"), env.subst("${ENV['PATH']}")), - "prog_path": env.subst("$PROG_PATH") + "defines": + dump_defines(env), + "includes": + dump_includes(env), + "cc_flags": + env.subst(LINTCCOM), + "cxx_flags": + env.subst(LINTCXXCOM), + "cc_path": + util.where_is_program(env.subst("$CC"), env.subst("${ENV['PATH']}")), + "cxx_path": + util.where_is_program(env.subst("$CXX"), env.subst("${ENV['PATH']}")), + "gdb_path": + util.where_is_program(env.subst("$GDB"), env.subst("${ENV['PATH']}")), + "prog_path": + env.subst("$PROG_PATH") } env_ = env.Clone() diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 2db543a6..8f7a1f52 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -39,8 +39,8 @@ class LibBuilderFactory(object): clsname = "PlatformIOLibBuilder" else: used_frameworks = LibBuilderFactory.get_used_frameworks(env, path) - common_frameworks = (set(env.get("PIOFRAMEWORK", [])) & - set(used_frameworks)) + common_frameworks = ( + set(env.get("PIOFRAMEWORK", [])) & set(used_frameworks)) if common_frameworks: clsname = "%sLibBuilder" % list(common_frameworks)[0].title() elif used_frameworks: @@ -134,8 +134,10 @@ class LibBuilderBase(object): @property def src_filter(self): return piotool.SRC_FILTER_DEFAULT + [ - "-" % os.sep, "-" % os.sep, "-" % - os.sep, "-" % os.sep + "-" % os.sep, + "-" % os.sep, + "-" % os.sep, + "-" % os.sep ] @property @@ -247,8 +249,9 @@ class LibBuilderBase(object): if (key in item and not self.items_in_list(self.env[env_key], item[key])): if self.verbose: - sys.stderr.write("Skip %s incompatible dependency %s\n" - % (key[:-1], item)) + sys.stderr.write( + "Skip %s incompatible dependency %s\n" % (key[:-1], + item)) skip = True if skip: continue @@ -337,8 +340,8 @@ class LibBuilderBase(object): if _already_depends(lb): if self.verbose: sys.stderr.write("Warning! Circular dependencies detected " - "between `%s` and `%s`\n" % - (self.path, lb.path)) + "between `%s` and `%s`\n" % (self.path, + lb.path)) self._circular_deps.append(lb) elif lb not in self._depbuilders: self._depbuilders.append(lb) @@ -604,14 +607,14 @@ def GetLibBuilders(env): # pylint: disable=too-many-branches if compat_mode > 1 and not lb.is_platforms_compatible( env['PIOPLATFORM']): if verbose: - sys.stderr.write("Platform incompatible library %s\n" % - lb.path) + sys.stderr.write( + "Platform incompatible library %s\n" % lb.path) return False if compat_mode > 0 and "PIOFRAMEWORK" in env and \ not lb.is_frameworks_compatible(env.get("PIOFRAMEWORK", [])): if verbose: - sys.stderr.write("Framework incompatible library %s\n" % - lb.path) + sys.stderr.write( + "Framework incompatible library %s\n" % lb.path) return False return True diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 1f689b91..f716347f 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -89,8 +89,8 @@ class InoToCPPConverter(object): self.env.Execute( self.env.VerboseAction( '$CXX -o "{0}" -x c++ -fpreprocessed -dD -E "{1}"'.format( - out_file, tmp_path), "Converting " + basename( - out_file[:-4]))) + out_file, + tmp_path), "Converting " + basename(out_file[:-4]))) atexit.register(_delete_file, tmp_path) return isfile(out_file) @@ -139,8 +139,8 @@ class InoToCPPConverter(object): prototypes = [] reserved_keywords = set(["if", "else", "while"]) for match in self.PROTOTYPE_RE.finditer(contents): - if (set([match.group(2).strip(), match.group(3).strip()]) & - reserved_keywords): + if (set([match.group(2).strip(), + match.group(3).strip()]) & reserved_keywords): continue prototypes.append(match) return prototypes diff --git a/platformio/builder/tools/pioplatform.py b/platformio/builder/tools/pioplatform.py index 3fbe607e..9be56410 100644 --- a/platformio/builder/tools/pioplatform.py +++ b/platformio/builder/tools/pioplatform.py @@ -81,7 +81,8 @@ def LoadPioPlatform(env, variables): board_config = env.BoardConfig() for k in variables.keys(): if (k in env or - not any([k.startswith("BOARD_"), k.startswith("UPLOAD_")])): + not any([k.startswith("BOARD_"), + k.startswith("UPLOAD_")])): continue _opt, _val = k.lower().split("_", 1) if _opt == "board": diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index e666276c..4492b464 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -107,8 +107,8 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument def _look_for_mbed_disk(): msdlabels = ("mbed", "nucleo", "frdm", "microbit") for item in util.get_logicaldisks(): - if item['disk'].startswith("/net") or not _is_match_pattern( - item['disk']): + if item['disk'].startswith( + "/net") or not _is_match_pattern(item['disk']): continue mbed_pages = [ join(item['disk'], n) for n in ("mbed.htm", "mbed.html") @@ -201,8 +201,8 @@ def CheckUploadSize(_, target, source, env): # pylint: disable=W0613,W0621 if used_size > max_size: sys.stderr.write("Error: The program size (%d bytes) is greater " - "than maximum allowed (%s bytes)\n" % - (used_size, max_size)) + "than maximum allowed (%s bytes)\n" % (used_size, + max_size)) env.Exit(1) diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 3998418d..fffb8e40 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -35,9 +35,10 @@ SRC_FILTER_DEFAULT = ["+<*>", "-<.git%s>" % sep, "-" % sep] def BuildProgram(env): def _append_pio_macros(): - env.AppendUnique(CPPDEFINES=[( - "PLATFORMIO", - int("{0:02d}{1:02d}{2:02d}".format(*pioversion_to_intstr())))]) + env.AppendUnique(CPPDEFINES=[ + ("PLATFORMIO", + int("{0:02d}{1:02d}{2:02d}".format(*pioversion_to_intstr()))) + ]) _append_pio_macros() diff --git a/platformio/commands/init.py b/platformio/commands/init.py index 230594f1..564010a1 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -84,8 +84,8 @@ def cli( click.style(project_dir, fg="cyan")) click.echo("%s - Project Configuration File" % click.style( "platformio.ini", fg="cyan")) - click.echo("%s - Put your source files here" % click.style( - "src", fg="cyan")) + click.echo( + "%s - Put your source files here" % click.style("src", fg="cyan")) click.echo("%s - Put here project specific (private) libraries" % click.style("lib", fg="cyan")) @@ -297,7 +297,8 @@ def fill_project_envs(ctx, project_dir, board_ids, project_option, env_prefix, config = util.load_project_config(project_dir) for section in config.sections(): cond = [ - section.startswith("env:"), config.has_option(section, "board") + section.startswith("env:"), + config.has_option(section, "board") ] if all(cond): used_boards.append(config.get(section, "board")) diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index c9862ace..5a4c9fbc 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -366,8 +366,9 @@ def lib_show(library, json_output): for v in lib['versions'] ])) blocks.append(("Unique Downloads", [ - "Today: %s" % lib['dlstats']['day'], "Week: %s" % - lib['dlstats']['week'], "Month: %s" % lib['dlstats']['month'] + "Today: %s" % lib['dlstats']['day'], + "Week: %s" % lib['dlstats']['week'], + "Month: %s" % lib['dlstats']['month'] ])) for (title, rows) in blocks: @@ -418,16 +419,16 @@ def lib_stats(json_output): click.echo("-" * terminal_width) def _print_lib_item(item): - click.echo(( - printitemdate_tpl if "date" in item else printitem_tpl - ).format( - name=click.style(item['name'], fg="cyan"), - date=str( - arrow.get(item['date']).humanize() if "date" in item else ""), - url=click.style( - "http://platformio.org/lib/show/%s/%s" % (item['id'], - quote(item['name'])), - fg="blue"))) + click.echo((printitemdate_tpl + if "date" in item else printitem_tpl).format( + name=click.style(item['name'], fg="cyan"), + date=str( + arrow.get(item['date']).humanize() + if "date" in item else ""), + url=click.style( + "http://platformio.org/lib/show/%s/%s" % + (item['id'], quote(item['name'])), + fg="blue"))) def _print_tag_item(name): click.echo( @@ -457,8 +458,8 @@ def lib_stats(json_output): _print_tag_item(item) click.echo() - for key, title in (("dlday", "Today"), ("dlweek", "Week"), - ("dlmonth", "Month")): + for key, title in (("dlday", "Today"), ("dlweek", "Week"), ("dlmonth", + "Month")): _print_title("Featured: " + title) _print_header(with_date=False) for item in result.get(key, []): diff --git a/platformio/commands/platform.py b/platformio/commands/platform.py index 0e13610c..ed9e17f8 100644 --- a/platformio/commands/platform.py +++ b/platformio/commands/platform.py @@ -269,8 +269,8 @@ def platform_show(platform, json_output): # pylint: disable=too-many-branches if item['type']: click.echo("Type: %s" % item['type']) click.echo("Requirements: %s" % item['requirements']) - click.echo("Installed: %s" % ("Yes" if item.get("version") else - "No (optional)")) + click.echo("Installed: %s" % + ("Yes" if item.get("version") else "No (optional)")) if "version" in item: click.echo("Version: %s" % item['version']) if "originalVersion" in item: diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 4a02e8bc..077460db 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -169,11 +169,12 @@ class EnvironmentProcessor(object): 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, v.replace("\n", ", ")) - for k, v in self.options.items() - ]))) + (datetime.now().strftime("%c"), + click.style(self.name, fg="cyan", bold=True), + "; ".join([ + "%s: %s" % (k, v.replace("\n", ", ")) + for k, v in self.options.items() + ]))) click.secho("-" * terminal_width, bold=True) self.options = self._validate_options(self.options) @@ -185,10 +186,10 @@ class EnvironmentProcessor(object): if is_error or "piotest_processor" not in self.cmd_ctx.meta: print_header( - "[%s] Took %.2f seconds" % ((click.style( - "ERROR", fg="red", bold=True) if is_error else click.style( - "SUCCESS", fg="green", bold=True)), - time() - start_time), + "[%s] Took %.2f seconds" % + ((click.style("ERROR", fg="red", bold=True) + if is_error else click.style( + "SUCCESS", fg="green", bold=True)), time() - start_time), is_error=is_error) return not is_error @@ -356,9 +357,10 @@ def print_summary(results, start_time): err=status is False) print_header( - "[%s] Took %.2f seconds" % ((click.style( - "SUCCESS", fg="green", bold=True) if successed else click.style( - "ERROR", fg="red", bold=True)), time() - start_time), + "[%s] Took %.2f seconds" % + ((click.style("SUCCESS", fg="green", bold=True) + if successed else click.style("ERROR", fg="red", bold=True)), + time() - start_time), is_error=not successed) diff --git a/platformio/downloader.py b/platformio/downloader.py index f4feaa61..986d3283 100644 --- a/platformio/downloader.py +++ b/platformio/downloader.py @@ -38,8 +38,9 @@ class FileDownloader(object): disposition = self._request.headers.get("content-disposition") if disposition and "filename=" in disposition: - self._fname = disposition[disposition.index("filename=") + - 9:].replace('"', "").replace("'", "") + self._fname = disposition[ + disposition.index("filename=") + 9:].replace('"', "").replace( + "'", "") self._fname = self._fname.encode("utf8") else: self._fname = url.split("/")[-1] diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index b03cc772..c12d4731 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -151,16 +151,24 @@ class ProjectGenerator(object): 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(), + "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")) + "env_pathsep": + os.pathsep, + "env_path": + self._fix_os_path(os.getenv("PATH")) }) @staticmethod diff --git a/platformio/maintenance.py b/platformio/maintenance.py index 0900b0b5..b51fbdf8 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -95,12 +95,12 @@ class Upgrader(object): self.to_version = semantic_version.Version.coerce( util.pepver_to_semver(to_version)) - self._upgraders = [ - (semantic_version.Version("3.0.0-a.1"), self._upgrade_to_3_0_0), - (semantic_version.Version("3.0.0-b.11"), - self._upgrade_to_3_0_0b11), - (semantic_version.Version("3.4.0-a.9"), self._update_dev_platforms) - ] + self._upgraders = [(semantic_version.Version("3.0.0-a.1"), + self._upgrade_to_3_0_0), + (semantic_version.Version("3.0.0-b.11"), + self._upgrade_to_3_0_0b11), + (semantic_version.Version("3.4.0-a.9"), + self._update_dev_platforms)] def run(self, ctx): if self.from_version > self.to_version: @@ -170,8 +170,8 @@ def after_upgrade(ctx): util.pepver_to_semver(__version__)): click.secho("*" * terminal_width, fg="yellow") click.secho( - "Obsolete PIO Core v%s is used (previous was %s)" % - (__version__, last_version), + "Obsolete PIO Core v%s is used (previous was %s)" % (__version__, + last_version), fg="yellow") click.secho( "Please remove multiple PIO Cores from a system:", fg="yellow") @@ -205,23 +205,25 @@ def after_upgrade(ctx): # PlatformIO banner click.echo("*" * terminal_width) - click.echo("If you like %s, please:" % (click.style( - "PlatformIO", fg="cyan"))) + click.echo("If you like %s, please:" % + (click.style("PlatformIO", fg="cyan"))) click.echo("- %s us on Twitter to stay up-to-date " - "on the latest project news > %s" % (click.style( - "follow", fg="cyan"), click.style( - "https://twitter.com/PlatformIO_Org", fg="cyan"))) - click.echo("- %s it on GitHub > %s" % - (click.style("star", fg="cyan"), click.style( - "https://github.com/platformio/platformio", fg="cyan"))) + "on the latest project news > %s" % + (click.style("follow", fg="cyan"), + click.style("https://twitter.com/PlatformIO_Org", fg="cyan"))) + click.echo( + "- %s it on GitHub > %s" % + (click.style("star", fg="cyan"), + click.style("https://github.com/platformio/platformio", fg="cyan"))) if not getenv("PLATFORMIO_IDE"): - click.echo("- %s PlatformIO IDE for IoT development > %s" % - (click.style("try", fg="cyan"), click.style( - "http://platformio.org/platformio-ide", fg="cyan"))) + click.echo( + "- %s PlatformIO IDE for IoT development > %s" % + (click.style("try", fg="cyan"), + click.style("http://platformio.org/platformio-ide", fg="cyan"))) if not util.is_ci(): - click.echo("- %s us with PlatformIO Plus > %s" % (click.style( - "support", fg="cyan"), click.style( - "https://pioplus.com", fg="cyan"))) + click.echo("- %s us with PlatformIO Plus > %s" % + (click.style("support", fg="cyan"), + click.style("https://pioplus.com", fg="cyan"))) click.echo("*" * terminal_width) click.echo("") @@ -284,8 +286,8 @@ def check_internal_updates(ctx, what): if manifest['name'] in outdated_items: continue conds = [ - pm.outdated(manifest['__pkg_dir']), what == "platforms" and - PlatformFactory.newPlatform( + pm.outdated(manifest['__pkg_dir']), + what == "platforms" and PlatformFactory.newPlatform( manifest['__pkg_dir']).are_outdated_packages() ] if any(conds): @@ -299,8 +301,8 @@ def check_internal_updates(ctx, what): click.echo("") click.echo("*" * terminal_width) click.secho( - "There are the new updates for %s (%s)" % - (what, ", ".join(outdated_items)), + "There are the new updates for %s (%s)" % (what, + ", ".join(outdated_items)), fg="yellow") if not app.get_setting("auto_update_" + what): diff --git a/platformio/managers/lib.py b/platformio/managers/lib.py index fea2a62a..5ce9fe99 100644 --- a/platformio/managers/lib.py +++ b/platformio/managers/lib.py @@ -226,9 +226,9 @@ class LibraryManager(BasePkgManager): cache_valid="30d") assert dl_data - return self._install_from_url( - name, dl_data['url'].replace("http://", "https://") - if app.get_setting("enable_ssl") else dl_data['url'], requirements) + return self._install_from_url(name, dl_data['url'].replace( + "http://", "https://") if app.get_setting("enable_ssl") else + dl_data['url'], requirements) def install( # pylint: disable=arguments-differ self, @@ -239,8 +239,8 @@ class LibraryManager(BasePkgManager): interactive=False): pkg_dir = None try: - _name, _requirements, _url = self.parse_pkg_input(name, - requirements) + _name, _requirements, _url = self.parse_pkg_input( + name, requirements) if not _url: name = "id=%d" % self.get_pkg_id_by_name( _name, @@ -309,8 +309,9 @@ class LibraryManager(BasePkgManager): if not isinstance(values, list): values = [v.strip() for v in values.split(",") if v] for value in values: - query.append('%s:"%s"' % (key[:-1] if key.endswith("s") else - key, value)) + query.append('%s:"%s"' % (key[:-1] + if key.endswith("s") else key, + value)) lib_info = None result = util.get_api_result( diff --git a/platformio/managers/package.py b/platformio/managers/package.py index 5d4386a6..9810a3d5 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -418,8 +418,8 @@ class PkgInstallerMixin(object): # package should satisfy requirements if requirements: mismatch_error = ( - "Package version %s doesn't satisfy requirements %s" % ( - tmp_manifest['version'], requirements)) + "Package version %s doesn't satisfy requirements %s" % + (tmp_manifest['version'], requirements)) try: assert tmp_semver and tmp_semver in semantic_version.Spec( requirements), mismatch_error @@ -651,18 +651,18 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin): if isdir(package): pkg_dir = package else: - name, requirements, url = self.parse_pkg_input(package, - requirements) + name, requirements, url = self.parse_pkg_input( + package, requirements) pkg_dir = self.get_package_dir(name, requirements, url) if not pkg_dir: - raise exception.UnknownPackage("%s @ %s" % - (package, requirements or "*")) + raise exception.UnknownPackage("%s @ %s" % (package, + requirements or "*")) manifest = self.load_manifest(pkg_dir) click.echo( - "Uninstalling %s @ %s: \t" % (click.style( - manifest['name'], fg="cyan"), manifest['version']), + "Uninstalling %s @ %s: \t" % + (click.style(manifest['name'], fg="cyan"), manifest['version']), nl=False) if islink(pkg_dir): @@ -674,9 +674,9 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin): # unfix package with the same name pkg_dir = self.get_package_dir(manifest['name']) if pkg_dir and "@" in pkg_dir: - os.rename( - pkg_dir, - join(self.package_dir, self.get_install_dirname(manifest))) + os.rename(pkg_dir, + join(self.package_dir, + self.get_install_dirname(manifest))) self.cache_reset() click.echo("[%s]" % click.style("OK", fg="green")) @@ -699,8 +699,8 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin): pkg_dir = self.get_package_dir(*self.parse_pkg_input(package)) if not pkg_dir: - raise exception.UnknownPackage("%s @ %s" % - (package, requirements or "*")) + raise exception.UnknownPackage("%s @ %s" % (package, + requirements or "*")) manifest = self.load_manifest(pkg_dir) name = manifest['name'] diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index e5f8f47e..015d9504 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -84,8 +84,8 @@ class PlatformManager(BasePkgManager): if isdir(package): pkg_dir = package else: - name, requirements, url = self.parse_pkg_input(package, - requirements) + name, requirements, url = self.parse_pkg_input( + package, requirements) pkg_dir = self.get_package_dir(name, requirements, url) p = PlatformFactory.newPlatform(pkg_dir) @@ -108,8 +108,8 @@ class PlatformManager(BasePkgManager): if isdir(package): pkg_dir = package else: - name, requirements, url = self.parse_pkg_input(package, - requirements) + name, requirements, url = self.parse_pkg_input( + package, requirements) pkg_dir = self.get_package_dir(name, requirements, url) p = PlatformFactory.newPlatform(pkg_dir) @@ -207,8 +207,8 @@ class PlatformFactory(object): else: if not requirements and "@" in name: name, requirements = name.rsplit("@", 1) - platform_dir = PlatformManager().get_package_dir(name, - requirements) + platform_dir = PlatformManager().get_package_dir( + name, requirements) if not platform_dir: raise exception.UnknownPlatform(name if not requirements else @@ -358,7 +358,8 @@ class PlatformRunMixin(object): util.get_pythonexe_path(), join(get_core_package_dir("tool-scons"), "script", "scons"), "-Q", "-j %d" % self.get_job_nums(), "--warn=no-no-parallel-support", - "-f", join(util.get_source_dir(), "builder", "main.py") + "-f", + join(util.get_source_dir(), "builder", "main.py") ] cmd.append("PIOVERBOSE=%d" % (1 if self.verbose else 0)) cmd += targets @@ -579,8 +580,10 @@ class PlatformBase( # pylint: disable=too-many-public-methods if not isdir(libcore_dir): continue storages.append({ - "name": "%s-core-%s" % (opts['package'], item), - "path": libcore_dir + "name": + "%s-core-%s" % (opts['package'], item), + "path": + libcore_dir }) return storages diff --git a/platformio/telemetry.py b/platformio/telemetry.py index 3a2b4aad..bcf39fbe 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -255,8 +255,9 @@ def measure_ci(): "label": getenv("APPVEYOR_REPO_NAME") }, "CIRCLECI": { - "label": "%s/%s" % (getenv("CIRCLE_PROJECT_USERNAME"), - getenv("CIRCLE_PROJECT_REPONAME")) + "label": + "%s/%s" % (getenv("CIRCLE_PROJECT_USERNAME"), + getenv("CIRCLE_PROJECT_REPONAME")) }, "TRAVIS": { "label": getenv("TRAVIS_REPO_SLUG") diff --git a/platformio/util.py b/platformio/util.py index 5b3d2302..df5d6c94 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -174,8 +174,8 @@ def load_json(file_path): with open(file_path, "r") as f: return json.load(f) except ValueError: - raise exception.PlatformioException("Could not load broken JSON: %s" % - file_path) + raise exception.PlatformioException( + "Could not load broken JSON: %s" % file_path) def get_systype(): @@ -282,8 +282,8 @@ def get_projectsrc_dir(): def get_projecttest_dir(): - return get_project_optional_dir("test_dir", - join(get_project_dir(), "test")) + return get_project_optional_dir("test_dir", join(get_project_dir(), + "test")) def get_projectboards_dir(): @@ -311,8 +311,8 @@ URL=http://docs.platformio.org/page/projectconf.html#envs-dir def get_projectdata_dir(): - return get_project_optional_dir("data_dir", - join(get_project_dir(), "data")) + return get_project_optional_dir("data_dir", join(get_project_dir(), + "data")) def load_project_config(path=None): @@ -495,8 +495,8 @@ def _get_api_result( else: raise exception.APIRequestError(e) except ValueError: - raise exception.APIRequestError("Invalid response: %s" % - r.text.encode("utf-8")) + raise exception.APIRequestError( + "Invalid response: %s" % r.text.encode("utf-8")) finally: if r: r.close() @@ -543,8 +543,8 @@ def internet_on(timeout=3): socket.setdefaulttimeout(timeout) for host in ("dl.bintray.com", "dl.platformio.org"): try: - socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect( - (host, 80)) + socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host, + 80)) return True except: # pylint: disable=bare-except pass diff --git a/platformio/vcsclient.py b/platformio/vcsclient.py index e79da215..3ef64fe1 100644 --- a/platformio/vcsclient.py +++ b/platformio/vcsclient.py @@ -37,8 +37,8 @@ class VCSClientFactory(object): if "#" in remote_url: remote_url, tag = remote_url.rsplit("#", 1) if not type_: - raise PlatformioException("VCS: Unknown repository type %s" % - remote_url) + raise PlatformioException( + "VCS: Unknown repository type %s" % remote_url) obj = getattr(modules[__name__], "%sClient" % type_.title())( src_dir, remote_url, tag, silent) assert isinstance(obj, VCSClientBase) @@ -103,8 +103,8 @@ class VCSClientBase(object): if result['returncode'] == 0: return result['out'].strip() raise PlatformioException( - "VCS: Could not receive an output from `%s` command (%s)" % ( - args, result)) + "VCS: Could not receive an output from `%s` command (%s)" % + (args, result)) class GitClient(VCSClientBase): From a37eb9868f3b20e982d0c3cd1a742fcb8ab60efc Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 6 Jun 2017 21:06:05 +0300 Subject: [PATCH 105/155] Skip broken PySerial 3.3 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 39046c36..19f50ea5 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ install_requires = [ "click>=5,<6", "colorama", "lockfile>=0.9.1,<0.13", - "pyserial>=3,<4", + "pyserial>=3,<4,!=3.3", "requests>=2.4.0,<3", "semantic_version>=2.5.0" ] From b04fc327c06e13ed7cafac5135269990326cac4e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Jun 2017 02:32:25 +0300 Subject: [PATCH 106/155] Configure Serial Port Monitor from `platformio.ini` // Resolve #787 --- HISTORY.rst | 2 ++ docs | 2 +- platformio/commands/device.py | 68 +++++++++++++++++++++++++++++------ 3 files changed, 60 insertions(+), 12 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 971990f0..beec09bb 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -15,6 +15,8 @@ PlatformIO 3.0 - Compatibility with the popular IDEs: Atom, VSCode, Eclipse, Sublime Text, etc - Windows, MacOS, Linux (+ARMv6-8) +* Configure Serial Port Monitor in `Project Configuration File "platformio.ini" `__ + (`issue #787 `_) * Project generator for `VIM `__ * Multi-line support for the different options in `Project Configuration File "platformio.ini" `__, such as: ``build_flags``, ``build_unflags``, etc. diff --git a/docs b/docs index 41943b7d..71c5c3f0 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 41943b7d599e63c71de76bab40a9233077fdfde2 +Subproject commit 71c5c3f0748b96727b37b854f5276c6305eea379 diff --git a/platformio/commands/device.py b/platformio/commands/device.py index 691180b6..201ae474 100644 --- a/platformio/commands/device.py +++ b/platformio/commands/device.py @@ -14,12 +14,12 @@ import json import sys +from os import getcwd import click from serial.tools import miniterm -from platformio.exception import MinitermException -from platformio.util import get_serialports +from platformio import exception, util @click.group(short_help="Monitor device or list existing") @@ -32,10 +32,10 @@ def cli(): def device_list(json_output): if json_output: - click.echo(json.dumps(get_serialports())) + click.echo(json.dumps(util.get_serialports())) return - for item in get_serialports(): + for item in util.get_serialports(): click.secho(item['port'], fg="cyan") click.echo("-" * len(item['port'])) click.echo("Hardware ID: %s" % item['hwid']) @@ -45,8 +45,7 @@ def device_list(json_output): @cli.command("monitor", short_help="Monitor device (Serial)") @click.option("--port", "-p", help="Port, a number or a device name") -@click.option( - "--baud", "-b", type=int, default=9600, help="Set baud rate, default=9600") +@click.option("--baud", "-b", type=int, help="Set baud rate, default=9600") @click.option( "--parity", default="N", @@ -98,15 +97,39 @@ def device_list(json_output): "--quiet", is_flag=True, help="Diagnostics: suppress non-error messages, default=Off") -def device_monitor(**kwargs): +@click.option( + "-d", + "--project-dir", + default=getcwd, + type=click.Path( + exists=True, file_okay=False, dir_okay=True, resolve_path=True)) +@click.option( + "-e", + "--environment", + help="Load configuration from `platformio.ini` and specified environment") +def device_monitor(**kwargs): # pylint: disable=too-many-branches + try: + project_options = get_project_options(kwargs['project_dir'], + kwargs['environment']) + monitor_options = {k: v for k, v in project_options or []} + if monitor_options: + for k in ("port", "baud", "rts", "dtr"): + k2 = "monitor_%s" % k + if kwargs[k] is None and k2 in monitor_options: + kwargs[k] = monitor_options[k2] + if k != "port": + kwargs[k] = int(kwargs[k]) + except exception.NotPlatformIOProject: + pass + if not kwargs['port']: - ports = get_serialports(filter_hwid=True) + ports = util.get_serialports(filter_hwid=True) if len(ports) == 1: kwargs['port'] = ports[0]['port'] sys.argv = ["monitor"] for k, v in kwargs.iteritems(): - if k in ("port", "baud", "rts", "dtr"): + if k in ("port", "baud", "rts", "dtr", "environment", "project_dir"): continue k = "--" + k.replace("_", "-") if isinstance(v, bool): @@ -121,8 +144,31 @@ def device_monitor(**kwargs): try: miniterm.main( default_port=kwargs['port'], - default_baudrate=kwargs['baud'], + default_baudrate=kwargs['baud'] or 9600, default_rts=kwargs['rts'], default_dtr=kwargs['dtr']) except Exception as e: - raise MinitermException(e) + raise exception.MinitermException(e) + + +def get_project_options(project_dir, environment): + config = util.load_project_config(project_dir) + if not config.sections(): + return + + known_envs = [s[4:] for s in config.sections() if s.startswith("env:")] + if environment: + if environment in known_envs: + return config.items("env:%s" % environment) + raise exception.UnknownEnvNames(environment, ", ".join(known_envs)) + + if not known_envs: + return + + if config.has_option("platformio", "env_default"): + env_default = config.get("platformio", + "env_default").split(", ")[0].strip() + if env_default and env_default in known_envs: + return config.items("env:%s" % env_default) + + return config.items("env:%s" % known_envs[0]) From 41312ef86d8c1b443dbadc4de7e844fa09100d3e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 7 Jun 2017 02:33:37 +0300 Subject: [PATCH 107/155] Bump version to 3.4.0b11 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index fb0e5549..79f26726 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0b10") +VERSION = (3, 4, "0b11") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From e8d7aae53c3fec0dbdc899b9fcc9eb3088e1bd30 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 9 Jun 2017 01:40:23 +0300 Subject: [PATCH 108/155] Use Terminal Runner for VSCode --- platformio/ide/tpls/vscode/.vscode/tasks.json.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl b/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl index cbda431e..a30289e3 100644 --- a/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl @@ -1,5 +1,6 @@ { "version": "0.1.0", + "runner": "terminal", "command": "{{platformio_path}}", "isShellCommand": false, "args": ["-c", "vscode"], From 70e4181b170025b374e238ea32e36397c19dff73 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 9 Jun 2017 01:40:50 +0300 Subject: [PATCH 109/155] Bump version to 3.4.0b12 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 79f26726..e4265804 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0b11") +VERSION = (3, 4, "0b12") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From b2c37311b96c2d0c0e9de41bf4d1b51e1d0adfd3 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 9 Jun 2017 11:45:42 +0300 Subject: [PATCH 110/155] Minor updates --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 71c5c3f0..129037e3 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 71c5c3f0748b96727b37b854f5276c6305eea379 +Subproject commit 129037e34b4a3c41b5d1c4555245a53f6209237a From 1827223b1c7f609a85f0e0605bc6250f193da961 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 11 Jun 2017 01:57:58 +0300 Subject: [PATCH 111/155] Update docs for Atom/VSCode; other improvements --- docs | 2 +- platformio/ide/tpls/vscode/.gitignore.tpl | 2 +- scripts/docspregen.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs b/docs index 129037e3..48ef737b 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 129037e34b4a3c41b5d1c4555245a53f6209237a +Subproject commit 48ef737b6ce546a20ea908005dc285513394b6a1 diff --git a/platformio/ide/tpls/vscode/.gitignore.tpl b/platformio/ide/tpls/vscode/.gitignore.tpl index e22b3c16..08e91a14 100644 --- a/platformio/ide/tpls/vscode/.gitignore.tpl +++ b/platformio/ide/tpls/vscode/.gitignore.tpl @@ -1,3 +1,3 @@ .pioenvs .piolibdeps -.vscode/browse.vc.db* +.vscode diff --git a/scripts/docspregen.py b/scripts/docspregen.py index 8b35f9ef..56453ada 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -66,7 +66,7 @@ def generate_boards(boards, extend_debug=False): - RAM""") for data in sorted(boards, key=lambda item: item['id']): - debug = [":ref:`Yes `" if data['debug'] else ""] + debug = [":ref:`Yes `" if data['debug'] else ""] if extend_debug and data['debug']: debug = [] for name, options in data['debug']['tools'].items(): From 571fe4dc04996ff63da6765cdf494ad033ad4b1d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Jun 2017 16:25:55 +0300 Subject: [PATCH 112/155] Reorganize examples --- examples | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples b/examples index 18f010d8..7799fbd8 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 18f010d8e2b112ba3140489c245e7ca0958d6828 +Subproject commit 7799fbd84144ed21046907bdac50004841f8b199 From c4f23be1dce517e2ef8e3fb42ab66f13aa188f00 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Jun 2017 20:39:21 +0300 Subject: [PATCH 113/155] Fix tests after examples reorganization --- tests/commands/test_ci.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/commands/test_ci.py b/tests/commands/test_ci.py index 04daeb33..9c77582b 100644 --- a/tests/commands/test_ci.py +++ b/tests/commands/test_ci.py @@ -25,15 +25,14 @@ def test_ci_empty(clirunner): def test_ci_boards(clirunner, validate_cliresult): result = clirunner.invoke(cmd_ci, [ - join("examples", "atmelavr-and-arduino", "arduino-internal-libs", - "src", "ChatServer.ino"), "-b", "uno", "-b", "leonardo" + join("examples", "atmelavr", "arduino-internal-libs", "src", + "ChatServer.ino"), "-b", "uno", "-b", "leonardo" ]) validate_cliresult(result) def test_ci_project_conf(clirunner, validate_cliresult): - project_dir = join("examples", "atmelavr-and-arduino", - "arduino-internal-libs") + project_dir = join("examples", "atmelavr", "arduino-internal-libs") result = clirunner.invoke(cmd_ci, [ join(project_dir, "src", "ChatServer.ino"), "--project-conf", join(project_dir, "platformio.ini") @@ -43,8 +42,7 @@ def test_ci_project_conf(clirunner, validate_cliresult): def test_ci_lib_and_board(clirunner, validate_cliresult): - example_dir = join("examples", "atmelavr-and-arduino", - "arduino-external-libs") + example_dir = join("examples", "atmelavr", "arduino-external-libs") result = clirunner.invoke(cmd_ci, [ join(example_dir, "lib", "OneWire", "examples", "DS2408_Switch", "DS2408_Switch.pde"), "-l", join(example_dir, "lib", "OneWire"), From dcdd55285639b81890348e7cd5eabe4cae822b78 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Jun 2017 21:01:23 +0300 Subject: [PATCH 114/155] Fix tests after examples reorganization --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 48ef737b..cf1e1587 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 48ef737b6ce546a20ea908005dc285513394b6a1 +Subproject commit cf1e15875bf80c5ad569f6713a0bf1b3e6d8040a From bb0063d5cf292293843fd343153be6246b0ed562 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 13 Jun 2017 21:07:58 +0300 Subject: [PATCH 115/155] Fix url for logo in docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index cf1e1587..dd0d99ad 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit cf1e15875bf80c5ad569f6713a0bf1b3e6d8040a +Subproject commit dd0d99ad454cd2bfc5141b77c9b2807810c74d34 From 2f40f329886bb82d141663dd145d1e83b1076d66 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 14 Jun 2017 14:34:15 +0300 Subject: [PATCH 116/155] Remove Project IDE examples --- docs | 2 +- tests/commands/test_test.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs b/docs index dd0d99ad..257718d2 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit dd0d99ad454cd2bfc5141b77c9b2807810c74d34 +Subproject commit 257718d2b59d624fddfb0ebf3d770aa2bab5e509 diff --git a/tests/commands/test_test.py b/tests/commands/test_test.py index 592bce0c..6346c788 100644 --- a/tests/commands/test_test.py +++ b/tests/commands/test_test.py @@ -20,10 +20,11 @@ from platformio import util def test_local_env(): - result = util.exec_command(["platformio", "test", "-d", - join("examples", "unit-testing", "calculator"), - "-e", "native"]) + result = util.exec_command([ + "platformio", "test", "-d", + join("examples", "unit-testing", "calculator"), "-e", "native" + ]) if result['returncode'] != 1: pytest.fail(result) - assert all( - [s in result['out'] for s in ("PASSED", "IGNORED", "FAILED")]) + assert all([s in result['out'] + for s in ("PASSED", "IGNORED", "FAILED")]), result['out'] From 8dde7e2efb8bd8d1627b7c35eb423b7dd226f052 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 14 Jun 2017 19:03:52 +0300 Subject: [PATCH 117/155] Cosmetic changes to icons --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 257718d2..ce836572 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 257718d2b59d624fddfb0ebf3d770aa2bab5e509 +Subproject commit ce836572ad07c489eb663143aaf76bc148868121 From fddcc3c965eeeb0fd86864f673561665b19702f6 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 14 Jun 2017 19:41:36 +0300 Subject: [PATCH 118/155] Fix SSL SNI issue for Python < 2.7.9 --- platformio/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio/util.py b/platformio/util.py index df5d6c94..ce763969 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -477,14 +477,14 @@ def _get_api_result( data=data, headers=headers, auth=auth, - verify=disable_ssl_check) + verify=not disable_ssl_check) else: r = _api_request_session().get( url, params=params, headers=headers, auth=auth, - verify=disable_ssl_check) + verify=not disable_ssl_check) result = r.json() r.raise_for_status() except requests.exceptions.HTTPError as e: From 0bdb877fe1bb2900a541feac24b480d77dc68c5e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 14 Jun 2017 19:55:44 +0300 Subject: [PATCH 119/155] Temporary use development version of PIO Core 3.4 --- scripts/get-platformio.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/get-platformio.py b/scripts/get-platformio.py index be6a4c87..7e052184 100644 --- a/scripts/get-platformio.py +++ b/scripts/get-platformio.py @@ -112,23 +112,25 @@ def install_pip(): def install_platformio(): r = None - cmd = ["-m", "pip.__main__" if sys.version_info < (2, 7, 0) else "pip"] + # cmd = ["pip", "install", "-U", "platformio"] + cmd = [ + "pip", "install", "-U", + "https://github.com/platformio/platformio-core/archive/develop.zip" + ] try: - r = exec_python_cmd(cmd + ["install", "-U", "platformio"]) + r = exec_python_cmd(cmd) assert r['returncode'] == 0 except AssertionError: - r = exec_python_cmd(cmd + ["--no-cache-dir", "install", "-U", - "platformio"]) + cmd.insert(1, "--no-cache-dir") + r = exec_python_cmd(cmd) if r: print_exec_result(r) def main(): - steps = [ - ("Fixing Windows %PATH% Environment", fix_winpython_pathenv), - ("Installing Python Package Manager", install_pip), - ("Installing PlatformIO and dependencies", install_platformio) - ] + steps = [("Fixing Windows %PATH% Environment", fix_winpython_pathenv), + ("Installing Python Package Manager", install_pip), + ("Installing PlatformIO and dependencies", install_platformio)] if not IS_WINDOWS: del steps[0] @@ -157,7 +159,7 @@ Permission denied You need the `sudo` permission to install Python packages. Try $ sudo python -c "$(curl -fsSL -https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)" +https://raw.githubusercontent.com/platformio/platformio/develop/scripts/get-platformio.py)" """) if is_error: From 8c7fa61f62bff1eb584d006b260ec071ada2baf5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 19 Jun 2017 11:39:31 +0300 Subject: [PATCH 120/155] Fix broken image for VSCode installation --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index ce836572..34ec8bc4 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ce836572ad07c489eb663143aaf76bc148868121 +Subproject commit 34ec8bc4f46b341eaeac90661280aaef5b65b707 From e3b976e189f74d069bdab406fbcc1422cf4b8ade Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 20 Jun 2017 15:24:20 +0300 Subject: [PATCH 121/155] Split docs for Project Configuration File into multiple subpages --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 34ec8bc4..a2e04b7f 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 34ec8bc4f46b341eaeac90661280aaef5b65b707 +Subproject commit a2e04b7fdb7a520db0705d61ebd239b720daf6a8 From 707384aeed94611627795603d2889a768a670dad Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 20 Jun 2017 15:41:43 +0300 Subject: [PATCH 122/155] Cosmetic updates for "Contents" --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index a2e04b7f..ac152877 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit a2e04b7fdb7a520db0705d61ebd239b720daf6a8 +Subproject commit ac1528773f120a57df871ede64f71c13f20d6f90 From 6ad1ce52395ddd517251ac57ad33d2d900312065 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 20 Jun 2017 16:57:47 +0300 Subject: [PATCH 123/155] Improve docs for Platforms and Framworks --- docs | 2 +- scripts/docspregen.py | 40 +++++++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/docs b/docs index ac152877..00924a1e 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ac1528773f120a57df871ede64f71c13f20d6f90 +Subproject commit 00924a1ed8bfabbe48ce4445b5ccace19301e28e diff --git a/scripts/docspregen.py b/scripts/docspregen.py index 56453ada..d6a7c21f 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -176,21 +176,22 @@ def generate_platform(name): See the License for the specific language governing permissions and limitations under the License. """) + p = PlatformFactory.newPlatform(name) - lines.append(".. _platform_%s:" % name) + lines.append(".. _platform_%s:" % p.name) lines.append("") - _title = "Platform ``%s``" % name - lines.append(_title) - lines.append("=" * len(_title)) - - p = PlatformFactory.newPlatform(name) + lines.append(p.title) + lines.append("=" * len(p.title)) + lines.append(":ref:`projectconf_env_platform` = ``%s``" % p.name) + lines.append("") lines.append(p.description) lines.append(""" For more detailed information please visit `vendor site <%s>`_.""" % p.vendor_url) lines.append(""" -.. contents::""") +.. contents:: Contents + :local:""") # # Packages @@ -286,15 +287,18 @@ def generate_framework(type_, data): lines.append(".. _framework_%s:" % type_) lines.append("") - _title = "Framework ``%s``" % type_ - lines.append(_title) - lines.append("=" * len(_title)) + lines.append(data['title']) + lines.append("=" * len(data['title'])) + lines.append(":ref:`projectconf_env_framework` = ``%s``" % type_) + lines.append("") lines.append(data['description']) lines.append(""" For more detailed information please visit `vendor site <%s>`_. """ % data['url']) - lines.append(".. contents::") + lines.append(""" +.. contents:: Contents + :local:""") lines.append(""" Platforms @@ -418,14 +422,16 @@ Rapid Embedded Development, Continuous and IDE integration in a few steps with PlatformIO thanks to built-in project generator for the most popular embedded boards and IDE. -* You can list pre-configured boards using :ref:`cmd_boards` command or - `PlatformIO Boards Explorer `_ -* For more detailed ``board`` information please scroll tables below by - horizontal. +.. note:: + * You can list pre-configured boards by :ref:`cmd_boards` command or + `PlatformIO Boards Explorer `_ + * For more detailed ``board`` information please scroll tables below by horizontal. """) - lines.append(".. contents::") - lines.append("") + lines.append(""" +.. contents:: Vendors + :local: + """) vendors = {} for data in BOARDS: From f78837d46789dca1ec53c852c077112647e31b09 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 20 Jun 2017 18:48:52 +0300 Subject: [PATCH 124/155] Custom transport for Unit Testing --- HISTORY.rst | 33 ++++++++++++----------- docs | 2 +- platformio/commands/platform.py | 2 +- platformio/commands/run.py | 47 ++++++++++++++++----------------- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index beec09bb..ef7b9d69 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -15,6 +15,7 @@ PlatformIO 3.0 - Compatibility with the popular IDEs: Atom, VSCode, Eclipse, Sublime Text, etc - Windows, MacOS, Linux (+ARMv6-8) +* Custom ``test_transport`` for `PIO Unit Testing `__ Engine * Configure Serial Port Monitor in `Project Configuration File "platformio.ini" `__ (`issue #787 `_) * Project generator for `VIM `__ @@ -137,11 +138,11 @@ PlatformIO 3.0 command (`issue #430 `_) * List supported frameworks, SDKs with a new - `pio platform frameworks `__ command + `pio platform frameworks `__ command * Visual Studio Code extension for PlatformIO (`issue #619 `_) * Added new options ``--no-reset``, ``--monitor-rts`` and ``--monitor-dtr`` - to `pio test `__ + to `pio test `__ command (allows to avoid automatic board's auto-reset when gathering test results) * Added support for templated methods in ``*.ino to *.cpp`` converter (`pull #858 `_) @@ -279,7 +280,7 @@ PlatformIO 3.0 * Custom boards per project with ``boards_dir`` option in `Project Configuration File "platformio.ini" `__ (`issue #515 `_) -* Unix shell-style wildcards for `upload_port `_ +* Unix shell-style wildcards for `upload_port `_ (`issue #839 `_) * Refactored `Library Dependency Finder (LDF) `__ C/C++ Preprocessor for conditional syntax (``#ifdef``, ``#if``, ``#else``, @@ -406,7 +407,7 @@ PlatformIO 3.0 * Improved Project Generator when custom ``--project-option`` is passed to `platformio init `__ command -* Deprecated ``lib_force`` option, please use `lib_deps `__ instead +* Deprecated ``lib_force`` option, please use `lib_deps `__ instead * Return valid exit code from ``plaformio test`` command * Fixed Project Generator for CLion IDE using Windows OS (`issue #785 `_) @@ -484,7 +485,7 @@ PlatformIO 3.0 * Library Manager 3.0 - + Project dependencies per build environment using `lib_deps `__ option + + Project dependencies per build environment using `lib_deps `__ option (`issue #413 `_) + `Semantic Versioning `__ for library commands and dependencies @@ -508,10 +509,10 @@ PlatformIO 3.0 + Check library compatibility with project environment before building (`issue #415 `_) + Control Library Dependency Finder for compatibility using - `lib_compat_mode `__ + `lib_compat_mode `__ option + Custom library storages/directories with - `lib_extra_dirs `__ option + `lib_extra_dirs `__ option (`issue #537 `_) + Handle extra build flags, source filters and build script from `library.json `__ @@ -767,11 +768,11 @@ PlatformIO 2.0 `platformio lib search `__ command (`issue #604 `_) -* Allowed to specify default environments `env_default `__ +* Allowed to specify default environments `env_default `__ which should be processed by default with ``platformio run`` command (`issue #576 `_) * Allowed to unflag(remove) base/initial flags using - `build_unflags `__ + `build_unflags `__ option (`issue #559 `_) * Allowed multiple VID/PID pairs when detecting serial ports @@ -1219,12 +1220,12 @@ PlatformIO 2.0 ~~~~~~~~~~~~~~~~~~ * Allowed to exclude/include source files from build process using - `src_filter `__ + `src_filter `__ (`issue #240 `_) * Launch own extra script before firmware building/uploading processes (`issue #239 `_) * Specify own path to the linker script (ld) using - `build_flags `__ + `build_flags `__ option (`issue #233 `_) * Specify library compatibility with the all platforms/frameworks @@ -1328,11 +1329,11 @@ PlatformIO 2.0 (`issue #192 `_) * Control verbosity of `platformio run `_ command via ``-v/--verbose`` option * Add library dependencies for build environment using - `lib_install `_ + `lib_install `_ option in ``platformio.ini`` (`issue #134 `_) * Specify libraries which are compatible with build environment using - `lib_use `_ + `lib_use `_ option in ``platformio.ini`` (`issue #148 `_) * Add more boards to PlatformIO project with @@ -1468,7 +1469,7 @@ PlatformIO 1.0 development platform * Added `Project Configuration `__ - option named `envs_dir `__ + option named `envs_dir `__ * Disabled "prompts" automatically for *Continuous Integration* systems (`issue #103 `_) * Fixed firmware uploading for @@ -1512,7 +1513,7 @@ PlatformIO 1.0 `#48 `_, `#50 `_, `#55 `_) -* Added `src_dir `__ +* Added `src_dir `__ option to ``[platformio]`` section of `platformio.ini `__ which allows to redefine location to project's source directory @@ -1523,7 +1524,7 @@ PlatformIO 1.0 commands which allows to return the output in `JSON `_ format (`issue #42 `_) * Allowed to ignore some libs from *Library Dependency Finder* via - `lib_ignore `_ option + `lib_ignore `_ option * Improved `platformio run `__ command: asynchronous output for build process, timing and detailed information about environment configuration diff --git a/docs b/docs index 00924a1e..58f08332 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 00924a1ed8bfabbe48ce4445b5ccace19301e28e +Subproject commit 58f083325e3fcb84672ac2a0718220286cb87f67 diff --git a/platformio/commands/platform.py b/platformio/commands/platform.py index ed9e17f8..53cd7fa5 100644 --- a/platformio/commands/platform.py +++ b/platformio/commands/platform.py @@ -81,7 +81,7 @@ def _get_installed_platform_data(platform, name=p.name, title=p.title, description=p.description, - version=p.version, # comment before dump + version=p.version, homepage=p.homepage, repository=p.repository_url, url=p.vendor_url, diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 077460db..4a9d6cc8 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -122,18 +122,19 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, class EnvironmentProcessor(object): - 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_script", "targets", "upload_port", - "upload_protocol", "upload_speed", "upload_flags", - "upload_resetmethod", "lib_deps", "lib_ignore", - "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode", - "piotest", "test_ignore", "test_port", "debug_tool", - "debug_port", "debug_init_cmds", "debug_extra_cmds", - "debug_server", "debug_init_break", "debug_load_cmd") + 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_script", "targets", + "upload_port", "upload_protocol", "upload_speed", "upload_flags", + "upload_resetmethod", "lib_deps", "lib_ignore", "lib_extra_dirs", + "lib_ldf_mode", "lib_compat_mode", "piotest", "test_transport", + "test_ignore", "test_port", "debug_tool", "debug_port", + "debug_init_cmds", "debug_extra_cmds", "debug_server", + "debug_init_break", "debug_load_cmd") - IGNORE_BUILD_OPTIONS = ("debug_tool", "debug_port", "debug_init_cmds", + IGNORE_BUILD_OPTIONS = ("test_transport", "test_ignore", "test_port", + "debug_tool", "debug_port", "debug_init_cmds", "debug_extra_cmds", "debug_server", "debug_init_break", "debug_load_cmd") @@ -168,13 +169,12 @@ class EnvironmentProcessor(object): self.options[k] = self.options[k].strip() 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, v.replace("\n", ", ")) - for k, v in self.options.items() - ]))) + click.echo("[%s] Processing %s (%s)" % ( + datetime.now().strftime("%c"), + click.style(self.name, fg="cyan", bold=True), "; ".join([ + "%s: %s" % (k, v.replace("\n", ", ")) + for k, v in self.options.items() + ]))) click.secho("-" * terminal_width, bold=True) self.options = self._validate_options(self.options) @@ -217,8 +217,8 @@ class EnvironmentProcessor(object): # warn about unknown options if k not in self.KNOWN_OPTIONS: click.secho( - "Detected non-PlatformIO `%s` option in `[env:]` section" % - k, + "Detected non-PlatformIO `%s` option in `[env:%s]` section" + % (k, self.name), fg="yellow") result[k] = v return result @@ -357,10 +357,9 @@ def print_summary(results, start_time): err=status is False) print_header( - "[%s] Took %.2f seconds" % - ((click.style("SUCCESS", fg="green", bold=True) - if successed else click.style("ERROR", fg="red", bold=True)), - time() - start_time), + "[%s] Took %.2f seconds" % ( + (click.style("SUCCESS", fg="green", bold=True) if successed else + click.style("ERROR", fg="red", bold=True)), time() - start_time), is_error=not successed) From cb549105291034fe1d5ab2a36850c43cbcbb6eb3 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 21 Jun 2017 01:03:09 +0300 Subject: [PATCH 125/155] Add configuration section for Unit Testing --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 58f08332..25aa9d79 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 58f083325e3fcb84672ac2a0718220286cb87f67 +Subproject commit 25aa9d7948f723c4cc3259857ef198f8acdd3fd2 From 89dc767a1ca7c14f6fff0222f053907c37d8b95f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 22 Jun 2017 01:14:23 +0300 Subject: [PATCH 126/155] Introduce Tutorials --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 25aa9d79..8534d037 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 25aa9d7948f723c4cc3259857ef198f8acdd3fd2 +Subproject commit 8534d037ded5b3c582e71982f8fa51721c219c57 From ebf9607c99eb22fe60236c5cae42a51baf893bc7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 22 Jun 2017 01:26:24 +0300 Subject: [PATCH 127/155] Cosmetic changes --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 8534d037..469d0fab 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 8534d037ded5b3c582e71982f8fa51721c219c57 +Subproject commit 469d0fabdd59eff3889a29fef3bdd575c76b8dcf From 613d92c32f861e369f5e7476e3e6a355b428a0ce Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 22 Jun 2017 14:23:09 +0300 Subject: [PATCH 128/155] Add source code to STM32Cube tutorial --- docs | 2 +- examples | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index 469d0fab..2b1179fe 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 469d0fabdd59eff3889a29fef3bdd575c76b8dcf +Subproject commit 2b1179fe331a9b50a0436223e88d33d9ebe200e5 diff --git a/examples b/examples index 7799fbd8..f8a58f93 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 7799fbd84144ed21046907bdac50004841f8b199 +Subproject commit f8a58f93862ec3da6664aa862520eaac739eca32 From 902b8e0a523026b88376bcaae7932530ef8cbd56 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 22 Jun 2017 23:23:44 +0300 Subject: [PATCH 129/155] Add example with using pyOCD for CMSIS-DAP based boards --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 2b1179fe..3967622b 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 2b1179fe331a9b50a0436223e88d33d9ebe200e5 +Subproject commit 3967622b034e467422c7024897c133054dd7e63d From a9543037b2a859c16e76e04c417faf950107cffe Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 23 Jun 2017 00:14:16 +0300 Subject: [PATCH 130/155] Add default environment to each example --- examples | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples b/examples index f8a58f93..372f45c9 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit f8a58f93862ec3da6664aa862520eaac739eca32 +Subproject commit 372f45c9d4394d1d1559057d59f5f5d22933d5d8 From 77a14f3c7b7ab081ef84020fe95fde4c6dbde2ae Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 23 Jun 2017 13:53:36 +0300 Subject: [PATCH 131/155] Note about "dialout" group for Ubuntu/Debian users; udev rule for USBasp V2.0 // Resolve #979 --- docs | 2 +- scripts/99-platformio-udev.rules | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs b/docs index 3967622b..d16893f5 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 3967622b034e467422c7024897c133054dd7e63d +Subproject commit d16893f5c94ca765adf86a409d87ab7deca23012 diff --git a/scripts/99-platformio-udev.rules b/scripts/99-platformio-udev.rules index 7c7b410a..aa8e868f 100644 --- a/scripts/99-platformio-udev.rules +++ b/scripts/99-platformio-udev.rules @@ -31,6 +31,10 @@ # 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 yourusername +# # After this file is installed, physically unplug and reconnect your board. # CP210X USB UART @@ -65,6 +69,9 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374?", MODE:="066 # USBtiny SUBSYSTEMS=="usb", ATTRS{idProduct}=="0c9f", ATTRS{idVendor}=="1781", MODE="0666" +# USBasp V2.0 +SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", MODE:="0666" + # Teensy boards ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", ENV{MTP_NO_PROBE}="1" From 6e7de3a01c971a37732d31c02ebc36a65af11655 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 23 Jun 2017 14:08:46 +0300 Subject: [PATCH 132/155] Sort platforms and frameworks by name --- platformio/commands/platform.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platformio/commands/platform.py b/platformio/commands/platform.py index 53cd7fa5..9699a4d7 100644 --- a/platformio/commands/platform.py +++ b/platformio/commands/platform.py @@ -202,6 +202,7 @@ def platform_frameworks(query, json_output): ] frameworks.append(framework) + frameworks = sorted(frameworks, key=lambda manifest: manifest['name']) if json_output: click.echo(json.dumps(frameworks)) else: @@ -219,6 +220,8 @@ def platform_list(json_output): manifest['__pkg_dir'], with_boards=False, expose_packages=False)) + + platforms = sorted(platforms, key=lambda manifest: manifest['name']) if json_output: click.echo(json.dumps(platforms)) else: From 2793059c70718b607d5594624e8454307f645aad Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 23 Jun 2017 14:48:01 +0300 Subject: [PATCH 133/155] Refactor library manager navigation --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index d16893f5..85c92434 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit d16893f5c94ca765adf86a409d87ab7deca23012 +Subproject commit 85c92434747daaf0d795217f9675dc08f56e46dc From adf30f36408c036dc9dd752422638abe717a07be Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 23 Jun 2017 15:38:24 +0300 Subject: [PATCH 134/155] Reorganize Tutorials and Demo for PIO Core --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 85c92434..e12c9227 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 85c92434747daaf0d795217f9675dc08f56e46dc +Subproject commit e12c922792492056b7ccc657aae539c71a3b9d25 From 178cf35a436d3c26ce137c4fe6ecc159a3c3b126 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 23 Jun 2017 16:06:22 +0300 Subject: [PATCH 135/155] Improve docs for CLion --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index e12c9227..ec9f7961 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit e12c922792492056b7ccc657aae539c71a3b9d25 +Subproject commit ec9f79618eec6482959e159e372fe6c6285bc434 From 60b668342f32a159d7e025e5384be1522ab71d39 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 23 Jun 2017 22:00:58 +0300 Subject: [PATCH 136/155] Integrate PIO Unified Debugger with Eclipse --- docs | 2 +- .../.settings/PlatformIO Debugger.launch.tpl | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 platformio/ide/tpls/eclipse/.settings/PlatformIO Debugger.launch.tpl diff --git a/docs b/docs index ec9f7961..dde2ce0a 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ec9f79618eec6482959e159e372fe6c6285bc434 +Subproject commit dde2ce0a652dbea9dbe8e53dc79d6fc437005d4c diff --git a/platformio/ide/tpls/eclipse/.settings/PlatformIO Debugger.launch.tpl b/platformio/ide/tpls/eclipse/.settings/PlatformIO Debugger.launch.tpl new file mode 100644 index 00000000..e27a3061 --- /dev/null +++ b/platformio/ide/tpls/eclipse/.settings/PlatformIO Debugger.launch.tpl @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 839fe8e02fc4214aec6c6b3f3a153e694bbd33ba Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 24 Jun 2017 00:06:58 +0300 Subject: [PATCH 137/155] Integrate PIO Unified Debugger with Sublime Text --- HISTORY.rst | 7 ++++--- docs | 2 +- .../ide/tpls/sublimetext/platformio.sublime-project.tpl | 9 ++++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index ef7b9d69..4592daf6 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,11 +9,12 @@ PlatformIO 3.0 * `PIO Unified Debugger `__ - - 100+ boards + - "1-click" solution, zero configuration + - Support for 100+ embedded boards - Multiple architectures and development platforms - - Zero Configuration - - Compatibility with the popular IDEs: Atom, VSCode, Eclipse, Sublime Text, etc - Windows, MacOS, Linux (+ARMv6-8) + - Built-in into `PlatformIO IDE for Atom `__ and `PlatformIO IDE for VScode `__ + - Integration with `Eclipse `__ and `Sublime Text `__ * Custom ``test_transport`` for `PIO Unit Testing `__ Engine * Configure Serial Port Monitor in `Project Configuration File "platformio.ini" `__ diff --git a/docs b/docs index dde2ce0a..f977cce6 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit dde2ce0a652dbea9dbe8e53dc79d6fc437005d4c +Subproject commit f977cce6a9a47f190a45357818c41e3792c7cfc1 diff --git a/platformio/ide/tpls/sublimetext/platformio.sublime-project.tpl b/platformio/ide/tpls/sublimetext/platformio.sublime-project.tpl index f189887b..bf27d97c 100644 --- a/platformio/ide/tpls/sublimetext/platformio.sublime-project.tpl +++ b/platformio/ide/tpls/sublimetext/platformio.sublime-project.tpl @@ -93,5 +93,12 @@ { "path": "." } - ] + ], + "settings": + { + "sublimegdb_workingdir": "{{project_dir}}", + "sublimegdb_exec_cmd": "-exec-continue", + "sublimegdb_commandline": "{{platformio_path}} -f -c sublimetext debug --interface=gdb --interpreter=mi -x .pioinit" + + } } From 93db0fa06467d514a832992a9bc3e2afaec3b959 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 24 Jun 2017 01:29:53 +0300 Subject: [PATCH 138/155] Improve WaitForNewSerialPort for atmega32u4 based boards --- platformio/__init__.py | 3 ++- platformio/builder/tools/pioupload.py | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index e4265804..33d50a56 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -32,8 +32,9 @@ __copyright__ = "Copyright 2014-present PlatformIO" __apiurl__ = "https://api.platformio.org" -if sys.version_info < (2, 7, 0) or sys.version_info >= (3, 0, 0): +if sys.version_info < (2, 7, 4) or sys.version_info >= (3, 0, 0): msg = ("PlatformIO version %s does not run under Python version %s.\n" + "Minimum supported version is 2.7.4, please upgrade Python. \n" "Python 3 is not yet supported.\n") sys.stderr.write(msg % (__version__, sys.version.split()[0])) sys.exit(1) diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 4492b464..4547858d 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -48,7 +48,6 @@ def TouchSerialPort(env, port, baudrate): s.close() except: # pylint: disable=W0702 pass - sleep(0.4) def WaitForNewSerialPort(env, before): @@ -56,11 +55,12 @@ def WaitForNewSerialPort(env, before): prev_port = env.subst("$UPLOAD_PORT") new_port = None elapsed = 0 + before = [p['port'] for p in before] while elapsed < 5 and new_port is None: - now = util.get_serialports() + now = [p['port'] for p in util.get_serialports()] for p in now: if p not in before: - new_port = p['port'] + new_port = p break before = now sleep(0.25) @@ -68,8 +68,8 @@ def WaitForNewSerialPort(env, before): if not new_port: for p in now: - if prev_port == p['port']: - new_port = p['port'] + if prev_port == p: + new_port = p break try: From 954ff8dca07fe30a2a7a06204bc10256481c1759 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 24 Jun 2017 01:32:05 +0300 Subject: [PATCH 139/155] Bump version to 3.4.0rc1 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 33d50a56..b0be387b 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0b12") +VERSION = (3, 4, "0rc1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 2849d78ece83d0cc143ab443698b86f779abf654 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 24 Jun 2017 02:13:03 +0300 Subject: [PATCH 140/155] Add requirements for Python and PIO Core+ --- platformio/__init__.py | 6 +++--- platformio/managers/core.py | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index b0be387b..5f9a3025 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -32,9 +32,9 @@ __copyright__ = "Copyright 2014-present PlatformIO" __apiurl__ = "https://api.platformio.org" -if sys.version_info < (2, 7, 4) or sys.version_info >= (3, 0, 0): - msg = ("PlatformIO version %s does not run under Python version %s.\n" - "Minimum supported version is 2.7.4, please upgrade Python. \n" +if sys.version_info < (2, 7, 0) or sys.version_info >= (3, 0, 0): + msg = ("PlatformIO Core v%s does not run under Python version %s.\n" + "Minimum supported version is 2.7, please upgrade Python.\n" "Python 3 is not yet supported.\n") sys.stderr.write(msg % (__version__, sys.version.split()[0])) sys.exit(1) diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 7849f05b..3b29af45 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -17,7 +17,7 @@ import subprocess import sys from os.path import join -from platformio import exception, util +from platformio import __version__, exception, util from platformio.managers.package import PackageManager CORE_PACKAGES = { @@ -63,6 +63,13 @@ def update_core_packages(only_check=False, silent=False): def pioplus_call(args, **kwargs): + if "windows" in util.get_systype() and sys.version_info < (2, 7, 6): + raise exception.PlatformioException( + "PlatformIO Core Plus v%s does not run under Python version %s.\n" + "Minimum supported version is 2.7.6, please upgrade Python.\n" + "Python 3 is not yet supported.\n" % (__version__, + sys.version.split()[0])) + pioplus_path = join(get_core_package_dir("tool-pioplus"), "pioplus") os.environ['PYTHONEXEPATH'] = util.get_pythonexe_path() os.environ['PYTHONPYSITEDIR'] = get_core_package_dir("pysite-pioplus") From f6960a0f98dede2398be63b81f4824ce323a107d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 24 Jun 2017 14:26:14 +0300 Subject: [PATCH 141/155] Update docs for Segger J-Link Tool --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index f977cce6..d242df40 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit f977cce6a9a47f190a45357818c41e3792c7cfc1 +Subproject commit d242df40dbb96bfe86dfacba43d7ba1782e2b15e From d8a0272bec319db198daccdcca7a3af8bdeadfa1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 24 Jun 2017 15:20:33 +0300 Subject: [PATCH 142/155] Escape non-valid file name characters when installing a new package (library) // Resolve #985 --- HISTORY.rst | 2 ++ platformio/managers/package.py | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 4592daf6..c4d0bdb1 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -40,6 +40,8 @@ PlatformIO 3.0 `issue #952 `_) * Don't warn about known ``boards_dir`` option (`pull #949 `_) +* Escape non-valid file name characters when installing a new package (library) + (`issue #985 `_) * Fixed infinite dependency installing when repository consists of multiple libraries (`issue #935 `_) diff --git a/platformio/managers/package.py b/platformio/managers/package.py index 9810a3d5..4e416392 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -126,6 +126,9 @@ class PkgRepoMixin(object): class PkgInstallerMixin(object): + PATH_ESCAPE_CHARS = ("/", "\\", "?", "%", "*", ":", "|", '"', "<", ">", + ".", "(", ")", "&", "#", ",", "'") + SRC_MANIFEST_NAME = ".piopkgmanager.json" FILE_CACHE_VALID = "1m" # 1 month @@ -189,9 +192,11 @@ class PkgInstallerMixin(object): fu = FileUnpacker(source_path, dest_dir) return fu.start() - @staticmethod - def get_install_dirname(manifest): + def get_install_dirname(self, manifest): name = manifest['name'] + for c in self.PATH_ESCAPE_CHARS: + if c in name: + name = name.replace(c, "_") if "id" in manifest: name += "_ID%d" % manifest['id'] return name From 1c5b08de59b2c5b4f48637a086450d7c1d73977a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 24 Jun 2017 15:45:48 +0300 Subject: [PATCH 143/155] Fixed cloning a package (library) from a private Git repository with custom user name and SSH port // Resolve #925 --- HISTORY.rst | 3 +++ platformio/managers/package.py | 8 ++++---- tests/test_managers.py | 5 +++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index c4d0bdb1..45f024b5 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -50,6 +50,9 @@ PlatformIO 3.0 * Fixed issue when `Library Dependency Finder (LDF) `__ does not handle custom ``src_dir`` (`issue #942 `_) +* Fixed cloning a package (library) from a private Git repository with + custom user name and SSH port + (`issue #925 `_) ------- diff --git a/platformio/managers/package.py b/platformio/managers/package.py index 4e416392..db207594 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -503,10 +503,10 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin): url_marker = "://" req_conditions = [ - not requirements, "@" in text, - (url_marker != "git@" and "://git@" not in text) or - text.count("@") > 1 - ] + not requirements, + "@" in text, + not url_marker.startswith("git") + ] # yapf: disable if all(req_conditions): text, requirements = text.rsplit("@", 1) if text.isdigit(): diff --git a/tests/test_managers.py b/tests/test_managers.py index e0d0b7a9..1f58e03e 100644 --- a/tests/test_managers.py +++ b/tests/test_managers.py @@ -127,6 +127,11 @@ def test_pkg_input_parser(): "git+ssh://git@gitlab.private-server.com/user/package#1.2.0", ("package", None, "git+ssh://git@gitlab.private-server.com/user/package#1.2.0") + ], + [ + "git+ssh://user@gitlab.private-server.com:1234/package#1.2.0", + ("package", None, + "git+ssh://user@gitlab.private-server.com:1234/package#1.2.0") ] ] for params, result in items: From 8f4c09a60012c476f480dfb3cfeaa428ff76271b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 24 Jun 2017 16:07:40 +0300 Subject: [PATCH 144/155] Better escaping for package file names --- platformio/commands/run.py | 41 ++++++++++++++++++---------------- platformio/managers/package.py | 12 ++++------ 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 4a9d6cc8..e6158e7d 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -122,16 +122,17 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, class EnvironmentProcessor(object): - 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_script", "targets", - "upload_port", "upload_protocol", "upload_speed", "upload_flags", - "upload_resetmethod", "lib_deps", "lib_ignore", "lib_extra_dirs", - "lib_ldf_mode", "lib_compat_mode", "piotest", "test_transport", - "test_ignore", "test_port", "debug_tool", "debug_port", - "debug_init_cmds", "debug_extra_cmds", "debug_server", - "debug_init_break", "debug_load_cmd") + 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_script", "targets", "upload_port", + "upload_protocol", "upload_speed", "upload_flags", + "upload_resetmethod", "lib_deps", "lib_ignore", + "lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode", + "piotest", "test_transport", "test_ignore", "test_port", + "debug_tool", "debug_port", "debug_init_cmds", + "debug_extra_cmds", "debug_server", "debug_init_break", + "debug_load_cmd") IGNORE_BUILD_OPTIONS = ("test_transport", "test_ignore", "test_port", "debug_tool", "debug_port", "debug_init_cmds", @@ -169,12 +170,13 @@ class EnvironmentProcessor(object): self.options[k] = self.options[k].strip() 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, v.replace("\n", ", ")) - for k, v in self.options.items() - ]))) + click.echo("[%s] Processing %s (%s)" % + (datetime.now().strftime("%c"), + click.style(self.name, fg="cyan", bold=True), + "; ".join([ + "%s: %s" % (k, v.replace("\n", ", ")) + for k, v in self.options.items() + ]))) click.secho("-" * terminal_width, bold=True) self.options = self._validate_options(self.options) @@ -357,9 +359,10 @@ def print_summary(results, start_time): err=status is False) print_header( - "[%s] Took %.2f seconds" % ( - (click.style("SUCCESS", fg="green", bold=True) if successed else - click.style("ERROR", fg="red", bold=True)), time() - start_time), + "[%s] Took %.2f seconds" % + ((click.style("SUCCESS", fg="green", bold=True) + if successed else click.style("ERROR", fg="red", bold=True)), + time() - start_time), is_error=not successed) diff --git a/platformio/managers/package.py b/platformio/managers/package.py index db207594..c05b90f6 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -16,6 +16,7 @@ import codecs import hashlib import json import os +import re import shutil from os.path import basename, getsize, isdir, isfile, islink, join from tempfile import mkdtemp @@ -126,9 +127,6 @@ class PkgRepoMixin(object): class PkgInstallerMixin(object): - PATH_ESCAPE_CHARS = ("/", "\\", "?", "%", "*", ":", "|", '"', "<", ">", - ".", "(", ")", "&", "#", ",", "'") - SRC_MANIFEST_NAME = ".piopkgmanager.json" FILE_CACHE_VALID = "1m" # 1 month @@ -192,11 +190,9 @@ class PkgInstallerMixin(object): fu = FileUnpacker(source_path, dest_dir) return fu.start() - def get_install_dirname(self, manifest): - name = manifest['name'] - for c in self.PATH_ESCAPE_CHARS: - if c in name: - name = name.replace(c, "_") + @staticmethod + def get_install_dirname(manifest): + name = re.sub(r"[^\da-z\_\-\. ]", "_", manifest['name'], flags=re.I) if "id" in manifest: name += "_ID%d" % manifest['id'] return name From 0c06982d756465f275c80bb3a045ee206940ef84 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 24 Jun 2017 18:40:30 +0300 Subject: [PATCH 145/155] =?UTF-8?q?Filter=20PIO=20Unit=20Testing=20tests?= =?UTF-8?q?=20using=20a=20new=20test=5Ffilter=20option=20in=20"platformio.?= =?UTF-8?q?ini"=20or=20`platformio=20test=20=E2=80=93filter`=20command=20/?= =?UTF-8?q?/=20Resolve=20#934?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HISTORY.rst | 4 ++++ docs | 2 +- platformio/commands/run.py | 9 +++++---- platformio/commands/test.py | 13 ++++++++++++- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 45f024b5..fb34f947 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -16,6 +16,10 @@ PlatformIO 3.0 - Built-in into `PlatformIO IDE for Atom `__ and `PlatformIO IDE for VScode `__ - Integration with `Eclipse `__ and `Sublime Text `__ +* Filter `PIO Unit Testing `__ + tests using a new ``test_filter`` option in `Project Configuration File "platformio.ini" `__ + or `platformio test --filter `__ command + (`issue #934 `_) * Custom ``test_transport`` for `PIO Unit Testing `__ Engine * Configure Serial Port Monitor in `Project Configuration File "platformio.ini" `__ (`issue #787 `_) diff --git a/docs b/docs index d242df40..ffee09c3 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit d242df40dbb96bfe86dfacba43d7ba1782e2b15e +Subproject commit ffee09c3508d2fc6c1feac721662ebf106ba03cb diff --git a/platformio/commands/run.py b/platformio/commands/run.py index e6158e7d..403a0a15 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -134,10 +134,11 @@ class EnvironmentProcessor(object): "debug_extra_cmds", "debug_server", "debug_init_break", "debug_load_cmd") - IGNORE_BUILD_OPTIONS = ("test_transport", "test_ignore", "test_port", - "debug_tool", "debug_port", "debug_init_cmds", - "debug_extra_cmds", "debug_server", - "debug_init_break", "debug_load_cmd") + IGNORE_BUILD_OPTIONS = ("test_transport", "test_filter", "test_ignore", + "test_port", "debug_tool", "debug_port", + "debug_init_cmds", "debug_extra_cmds", + "debug_server", "debug_init_break", + "debug_load_cmd") REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"} diff --git a/platformio/commands/test.py b/platformio/commands/test.py index 30a5de6c..4c6414c9 100644 --- a/platformio/commands/test.py +++ b/platformio/commands/test.py @@ -22,7 +22,18 @@ from platformio.managers.core import pioplus_call @click.command("test", short_help="Local Unit Testing") @click.option("--environment", "-e", multiple=True, metavar="") -@click.option("--ignore", "-i", multiple=True, metavar="") +@click.option( + "--filter", + "-f", + multiple=True, + metavar="", + help="Filter tests by a pattern") +@click.option( + "--ignore", + "-i", + multiple=True, + metavar="", + help="Ignore tests by a pattern") @click.option("--upload-port") @click.option("--test-port") @click.option( From 574bbd1692bb2308e7174cf3734a5d5a42af52a2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 24 Jun 2017 19:45:47 +0300 Subject: [PATCH 146/155] Update custom J-Link debug configuration --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index ffee09c3..90756ec9 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit ffee09c3508d2fc6c1feac721662ebf106ba03cb +Subproject commit 90756ec9f7138b0d147b70f28bdd3d85dd5da17a From 01afcb1c9eb6991e64523684811aaeaa53c0709c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 26 Jun 2017 17:14:38 +0300 Subject: [PATCH 147/155] =?UTF-8?q?New=20monitor=20target=20which=20allows?= =?UTF-8?q?=20to=20launch=20Serial=20Monitor=20automatically=20after=20suc?= =?UTF-8?q?cessful=20=E2=80=9Cbuild=E2=80=9D=20or=20=E2=80=9Cupload?= =?UTF-8?q?=E2=80=9D=20operations=20//=20Resolve=20#788?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HISTORY.rst | 4 ++++ docs | 2 +- platformio/commands/run.py | 18 +++++++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index fb34f947..cfcaedee 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -23,6 +23,10 @@ PlatformIO 3.0 * Custom ``test_transport`` for `PIO Unit Testing `__ Engine * Configure Serial Port Monitor in `Project Configuration File "platformio.ini" `__ (`issue #787 `_) +* New `monitor `__ + target which allows to launch Serial Monitor automatically after successful + "build" or "upload" operations + (`issue #788 `_) * Project generator for `VIM `__ * Multi-line support for the different options in `Project Configuration File "platformio.ini" `__, such as: ``build_flags``, ``build_unflags``, etc. diff --git a/docs b/docs index 90756ec9..dd628f3e 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 90756ec9f7138b0d147b70f28bdd3d85dd5da17a +Subproject commit dd628f3e8e500d27e3b12b1f80269327b11e5ab0 diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 403a0a15..fdd9cefe 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -21,6 +21,7 @@ from time import time import click from platformio import __version__, exception, telemetry, util +from platformio.commands.device import device_monitor as cmd_device_monitor from platformio.commands.lib import lib_install as cmd_lib_install from platformio.commands.lib import get_builtin_libs from platformio.commands.platform import \ @@ -107,7 +108,11 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, ep = EnvironmentProcessor(ctx, envname, options, target, upload_port, silent, verbose) - results.append((envname, ep.process())) + result = (envname, ep.process()) + results.append(result) + if result[1] and "monitor" in ep.get_build_targets() and \ + "nobuild" not in ep.get_build_targets(): + ctx.invoke(cmd_device_monitor) found_error = any([status is False for (_, status) in results]) @@ -226,7 +231,7 @@ class EnvironmentProcessor(object): result[k] = v return result - def _get_build_variables(self): + def get_build_variables(self): variables = {"pioenv": self.name} if self.upload_port: variables['upload_port'] = self.upload_port @@ -240,7 +245,7 @@ class EnvironmentProcessor(object): variables[k] = v return variables - def _get_build_targets(self): + def get_build_targets(self): targets = [] if self.targets: targets = [t for t in self.targets] @@ -252,11 +257,14 @@ class EnvironmentProcessor(object): if "platform" not in self.options: raise exception.UndefinedEnvPlatform(self.name) - build_vars = self._get_build_variables() - build_targets = self._get_build_targets() + build_vars = self.get_build_variables() + build_targets = self.get_build_targets() telemetry.on_run_environment(self.options, build_targets) + # skip monitor target, we call it above + if "monitor" in build_targets: + build_targets.remove("monitor") if "nobuild" not in build_targets: # install dependent libraries if "lib_install" in self.options: From 1ee53137ec864195878e9fc5515676636538de75 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 26 Jun 2017 17:51:11 +0300 Subject: [PATCH 148/155] Update udev rules guide --- docs | 2 +- scripts/98-openocd-udev.rules | 10 ++++++++++ scripts/99-platformio-udev.rules | 7 ++++++- scripts/docspregen.py | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/docs b/docs index dd628f3e..58574c07 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit dd628f3e8e500d27e3b12b1f80269327b11e5ab0 +Subproject commit 58574c074149656f1cfc5290122251ea6a5344c6 diff --git a/scripts/98-openocd-udev.rules b/scripts/98-openocd-udev.rules index f3a50711..c6ff3083 100644 --- a/scripts/98-openocd-udev.rules +++ b/scripts/98-openocd-udev.rules @@ -1,4 +1,9 @@ # 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 @@ -17,6 +22,11 @@ # 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" diff --git a/scripts/99-platformio-udev.rules b/scripts/99-platformio-udev.rules index aa8e868f..7adfcf0c 100644 --- a/scripts/99-platformio-udev.rules +++ b/scripts/99-platformio-udev.rules @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +# +# INSTALLATION +# + # UDEV Rules for PlatformIO supported boards, http://platformio.org/boards # # The latest version of this file may be found at: @@ -33,7 +37,8 @@ # # 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 yourusername +# sudo usermod -a -G dialout $USER +# sudo usermod -a -G plugdev $USER # # After this file is installed, physically unplug and reconnect your board. diff --git a/scripts/docspregen.py b/scripts/docspregen.py index d6a7c21f..8b14713d 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -132,29 +132,29 @@ Packages .. warning:: **Linux Users**: - * 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 yourusername``. - * Install "udev" rules file `99-platformio-udev.rules `_ - (an instruction is located in the file). - * Raspberry Pi users, please read this article - `Enable serial port on Raspberry Pi `__. + * Install "udev" rules file `99-platformio-udev.rules `_ + (an instruction is located inside a file). + * Raspberry Pi users, please read this article + `Enable serial port on Raspberry Pi `__. """) if platform == "teensy": lines.append(""" - **Windows Users:** Teensy programming uses only Windows built-in HID - drivers. When Teensy is programmed to act as a USB Serial device, - Windows XP, Vista, 7 and 8 require `this serial driver - `_ - is needed to access the COM port your program uses. No special driver - installation is necessary on Windows 10. + **Windows Users:** + + Teensy programming uses only Windows built-in HID + drivers. When Teensy is programmed to act as a USB Serial device, + Windows XP, Vista, 7 and 8 require `this serial driver + `_ + is needed to access the COM port your program uses. No special driver + installation is necessary on Windows 10. """) else: lines.append(""" - **Windows Users:** Please check that you have correctly installed USB - driver from board manufacturer + **Windows Users:** + Please check that you have a correctly installed USB driver from board + manufacturer """) return "\n".join(lines) From 820efaeb21b70115b112698ac9ddc422db5fd56f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 26 Jun 2017 18:04:40 +0300 Subject: [PATCH 149/155] Switch to stable PlatformIO --- scripts/get-platformio.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/get-platformio.py b/scripts/get-platformio.py index 7e052184..d9abf5d5 100644 --- a/scripts/get-platformio.py +++ b/scripts/get-platformio.py @@ -112,11 +112,11 @@ def install_pip(): def install_platformio(): r = None - # cmd = ["pip", "install", "-U", "platformio"] - cmd = [ - "pip", "install", "-U", - "https://github.com/platformio/platformio-core/archive/develop.zip" - ] + cmd = ["pip", "install", "-U", "platformio"] + # cmd = [ + # "pip", "install", "-U", + # "https://github.com/platformio/platformio-core/archive/develop.zip" + # ] try: r = exec_python_cmd(cmd) assert r['returncode'] == 0 From 7cc51035aa55a7dd9a315330eb57a12ed6e1aa4c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 26 Jun 2017 18:13:09 +0300 Subject: [PATCH 150/155] Add "Upload and Monitor" task for VSCode --- .../ide/tpls/vscode/.vscode/extensions.json.tpl | 9 --------- .../ide/tpls/vscode/.vscode/tasks.json.tpl | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 9 deletions(-) delete mode 100644 platformio/ide/tpls/vscode/.vscode/extensions.json.tpl diff --git a/platformio/ide/tpls/vscode/.vscode/extensions.json.tpl b/platformio/ide/tpls/vscode/.vscode/extensions.json.tpl deleted file mode 100644 index 7315e95d..00000000 --- a/platformio/ide/tpls/vscode/.vscode/extensions.json.tpl +++ /dev/null @@ -1,9 +0,0 @@ -{ - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format - "recommendations": [ - // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp - "ms-vscode.cpptools", - "webfreak.debug" - ] -} \ No newline at end of file diff --git a/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl b/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl index a30289e3..870cb566 100644 --- a/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/tasks.json.tpl @@ -77,6 +77,22 @@ } } }, + { + "taskName": "PlatformIO: Upload and Monitor", + "args": ["run", "-t", "upload", "-t", "monitor"], + "problemMatcher": { + "owner": "cpp", + "fileLocation": ["relative", "${workspaceRoot}"], + "pattern": { + "regexp": "^([^:\\n]+):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + } + }, { "taskName": "PlatformIO: Test", "args": ["test"], From b1780c54db84422161ac6521be2687cac2bfafe1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 26 Jun 2017 19:16:44 +0300 Subject: [PATCH 151/155] Depend on PIO Core+ v0.9 --- platformio/managers/core.py | 39 ++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 3b29af45..92faa2e9 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -22,7 +22,7 @@ from platformio.managers.package import PackageManager CORE_PACKAGES = { "pysite-pioplus": ">=0.3.0,<2", - "tool-pioplus": ">=0.8.11,<2", + "tool-pioplus": ">=0.9.0,<2", "tool-unity": "~1.20302.1", "tool-scons": "~3.20501.2" } @@ -41,6 +41,43 @@ class CorePackageManager(PackageManager): ("" if sys.version_info < (2, 7, 9) else "s") ]) + def install(self, name, requirements=None, *args, + **kwargs): # pylint: disable=arguments-differ + PackageManager.install(self, name, requirements, *args, **kwargs) + self.cleanup_packages() + return self.get_package_dir(name, requirements) + + def update(self, *args, **kwargs): # pylint: disable=arguments-differ + result = PackageManager.update(self, *args, **kwargs) + self.cleanup_packages() + return result + + def uninstall(self, package, requirements=None, trigger_event=True): + result = PackageManager.uninstall(self, package, requirements, + trigger_event) + # @Hook: when 'update' operation (trigger_event is False), + # don't cleanup packages or install them + if not trigger_event: + return result + self.cleanup_packages() + return result + + def cleanup_packages(self): + self.cache_reset() + best_pkg_versions = {} + for name, requirements in CORE_PACKAGES.items(): + pkg_dir = self.get_package_dir(name, requirements) + if not pkg_dir: + continue + best_pkg_versions[name] = self.load_manifest(pkg_dir)['version'] + for manifest in self.get_installed(): + if manifest['name'] not in best_pkg_versions: + continue + if manifest['version'] != best_pkg_versions[manifest['name']]: + self.uninstall(manifest['__pkg_dir'], trigger_event=False) + self.cache_reset() + return True + def get_core_package_dir(name): assert name in CORE_PACKAGES From d0f6c69135b1dbcab46ea99605f8c4cdf47b021b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 26 Jun 2017 19:18:41 +0300 Subject: [PATCH 152/155] Minor cleanups --- platformio/managers/core.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/platformio/managers/core.py b/platformio/managers/core.py index 92faa2e9..95c8fa4c 100644 --- a/platformio/managers/core.py +++ b/platformio/managers/core.py @@ -52,16 +52,6 @@ class CorePackageManager(PackageManager): self.cleanup_packages() return result - def uninstall(self, package, requirements=None, trigger_event=True): - result = PackageManager.uninstall(self, package, requirements, - trigger_event) - # @Hook: when 'update' operation (trigger_event is False), - # don't cleanup packages or install them - if not trigger_event: - return result - self.cleanup_packages() - return result - def cleanup_packages(self): self.cache_reset() best_pkg_versions = {} From e26372075db47a63ed4375a6c6fd6f62e074789b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 26 Jun 2017 19:51:57 +0300 Subject: [PATCH 153/155] Update README --- README.rst | 139 ++++++++++++++--------------------------------------- setup.py | 11 ++--- 2 files changed, 40 insertions(+), 110 deletions(-) diff --git a/README.rst b/README.rst index 3b136a36..8f167418 100644 --- a/README.rst +++ b/README.rst @@ -41,115 +41,43 @@ PlatformIO :target: http://platformio.org `PlatformIO `_ is an open source ecosystem for IoT -development. Cross-platform IDE and unified debugger. Remote unit testing and firmware updates. +development. Cross-platform IDE and unified debugger. Remote unit testing and +firmware updates. -* **PlatformIO IDE** - The next-generation integrated development environment for IoT. - C/C++ Intelligent Code Completion and Smart Code Linter for the super-fast coding. - Multi-projects workflow with Multiple Panes. Themes Support with dark and light colors. - Built-in Terminal with PlatformIO Core tool and support for the powerful Serial Port Monitor. - All advanced instruments without leaving your favourite development environment. -* **Development Platforms** - Embedded and Desktop development platforms with - pre-built toolchains, debuggers, uploaders and frameworks which work under - popular host OS: Mac, Windows, Linux (+ARM) -* **Embedded Boards** - Rapid Embedded Programming, IDE and Continuous - Integration in a few steps with PlatformIO thanks to built-in project - generator for the most popular embedded boards and IDE -* **Library Manager** - Hundreds Popular Libraries are organized into single - Web 2.0 platform: list by categories, keywords, authors, compatible - platforms and frameworks; learn via examples; be up-to-date with the latest - version. +Get Started +----------- -*Atmel AVR & SAM, Espressif 8266 & 32, Freescale Kinetis, Intel ARC32, Lattice iCE40, -Microchip PIC32, Nordic nRF51, NXP LPC, Silicon Labs EFM32, ST STM32, -TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc.* +* `What is PlatformIO? `_ + +Products +-------- -* `PlatformIO Plus and professional solutions `_ * `PlatformIO IDE `_ -* `Get Started `_ -* `Library Search and Registry `_ +* `PlatformIO Core `_ +* `PIO Remote™ `_ +* `PIO Unified Debugger `_ +* `PIO Unit Testing `_ +* `PIO Delivery™ `_ +* `Cloud Builder `_ + +Registry +-------- + +* `Libraries `_ * `Development Platforms `_ * `Frameworks `_ -* `Embedded Boards Explorer `_ -* `Library Manager `_ -* `User Guide `_ -* `Continuous Integration `_ -* `IDE Integration `_ -* `Articles about us `_ -* `FAQ `_ -* `Release Notes `_ +* `Embedded Boards `_ -Use whenever. *Run everywhere.* -------------------------------- -*PlatformIO* is written in pure *Python* and **doesn't depend** on any -additional libraries/tools from an operating system. It allows you to use -*PlatformIO* beginning from *PC (Mac, Linux, Win)* and ending with credit-card -sized computers (`Raspberry Pi `_, -`BeagleBone `_, -`CubieBoard `_). +Solutions +--------- -Embedded Development. *Easier Than Ever.* ------------------------------------------ -*PlatformIO* is well suited for embedded development and has pre-configured -settings for most popular `Embedded Boards `_. +* `Library Manager `_ +* `Cloud IDEs Integration `_ +* `Standalone IDEs Integration `_ +* `Continuous Integration `_ -* Colourful `command-line output `_ -* `IDE Integration `_ with - *Cloud9, Codeanywhere, Eclipse Che, Atom, CLion, CodeBlocks, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, Vim, Visual Studio* -* Cloud compiling and `Continuous Integration `_ - with *AppVeyor, Circle CI, Drone, Shippable, Travis CI* -* Built-in `Serial Port Monitor `_ and configurable - `build -flags/-options `_ -* Automatic **firmware uploading** -* Pre-built tool chains, frameworks for the popular `development platforms `_ - -.. image:: https://raw.githubusercontent.com/platformio/platformio-web/develop/app/images/platformio-embedded-development.png - :target: http://platformio.org - :alt: PlatformIO Embedded Development Process - -The Missing Library Manager. *It's here!* ------------------------------------------ -*PlatformIO Library Manager* is the missing library manager for development -platforms which allows you to organize and have up-to-date external libraries. - -* Friendly `Command-Line Interface `_ -* Modern `Web 2.0 Library Portal `_ -* Open Source `Library Registry API `_ -* Library Crawler based on `library.json `_ - specification -* Project Dependency Manager with `Semantic Versioning `_ requirements - -.. image:: https://raw.githubusercontent.com/platformio/platformio-web/develop/app/images/platformio-library-manager.png - :target: http://platformio.org - :alt: PlatformIO Library Manager Architecture - -Smart Build System. *Fast and Reliable.* ----------------------------------------- -*PlatformIO Code Builder* is built-on a next-generation software construction -tool named `SCons `_. Think of *SCons* as an improved, -cross-platform substitute for the classic *Make* utility. - -* Reliable, automatic *dependency analysis* -* Reliable detection of *build changes* -* Improved support for *parallel builds* -* Ability to share *built files in a cache* -* Lookup for external libraries which are installed via `Library Manager `_ - -.. image:: https://raw.githubusercontent.com/platformio/platformio-web/develop/app/images/platformio-scons-builder.png - :target: http://platformio.org - :alt: PlatformIO Build System Architecture - -Single source code. *Multiple platforms.* ------------------------------------------ -*PlatformIO* allows the developer to compile the same code with different -development platforms using only *One Command* -`platformio run `_. -This happens due to -`Project Configuration File (platformio.ini) `_ -where you can setup different environments with specific options (platform -type, firmware uploading settings, pre-built framework, build flags and many -more). - -It has support for the most popular embedded platforms: +Development Platforms +--------------------- * `Atmel AVR `_ * `Atmel SAM `_ @@ -158,16 +86,20 @@ It has support for the most popular embedded platforms: * `Freescale Kinetis `_ * `Intel ARC32 `_ * `Lattice iCE40 `_ +* `Maxim 32 `_ * `Microchip PIC32 `_ * `Nordic nRF51 `_ +* `Nordic nRF52 `_ * `NXP LPC `_ -* `ST STM32 `_ * `Silicon Labs EFM32 `_ +* `ST STM32 `_ * `Teensy `_ * `TI MSP430 `_ * `TI TivaVA C `_ +* `WIZNet W7500 `_ -Frameworks: +Frameworks +---------- * `Arduino `_ * `ARTIK SDK `_ @@ -179,10 +111,9 @@ Frameworks: * `Pumbaa `_ * `Simba `_ * `SPL `_ +* `STM32Cube `_ * `WiringPi `_ -For further details, please refer to `What is PlatformIO? `_ - Contributing ------------ diff --git a/setup.py b/setup.py index 19f50ea5..116656cc 100644 --- a/setup.py +++ b/setup.py @@ -68,9 +68,8 @@ setup( "Topic :: Software Development :: Compilers" ], keywords=[ - "iot", "ide", "build", "compile", "library manager", - "embedded", "ci", "continuous integration", "arduino", "mbed", - "esp8266", "framework", "ide", "ide integration", "library.json", - "make", "cmake", "makefile", "mk", "pic32", "fpga", "artik" - ] -) + "iot", "embedded", "arduino", "mbed", "esp8266", "esp32", "fpga", + "firmware", "continuous-integration", "cloud-ide", "avr", "arm", + "ide", "unit-testing", "hardware", "verilog", "microcontroller", + "debug" + ]) From 7afbbadef1785e6a1cf30083af29eaa143d7bb68 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 26 Jun 2017 19:53:51 +0300 Subject: [PATCH 154/155] Fix URL for PIO Unified Debugger --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 8f167418..a11a77ca 100644 --- a/README.rst +++ b/README.rst @@ -55,7 +55,7 @@ Products * `PlatformIO IDE `_ * `PlatformIO Core `_ * `PIO Remote™ `_ -* `PIO Unified Debugger `_ +* `PIO Unified Debugger `_ * `PIO Unit Testing `_ * `PIO Delivery™ `_ * `Cloud Builder `_ From 43ebff2a848cdaeae665b9b2d76dcb272b006399 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 26 Jun 2017 19:58:21 +0300 Subject: [PATCH 155/155] Bump version to 3.4.0 --- HISTORY.rst | 2 +- platformio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index cfcaedee..9f73d3cd 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,7 +4,7 @@ Release Notes PlatformIO 3.0 -------------- -3.4.0 (2017-??-??) +3.4.0 (2017-06-26) ~~~~~~~~~~~~~~~~~~ * `PIO Unified Debugger `__ diff --git a/platformio/__init__.py b/platformio/__init__.py index 5f9a3025..0c26d0af 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 4, "0rc1") +VERSION = (3, 4, 0) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio"