From 44bf3e8479e4d78e22eb3129a6e880aa3bd94f8b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 1 Jan 2015 21:04:27 +0200 Subject: [PATCH 01/10] Start 0.11.0-dev --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index acddb2e5..4b35f3f7 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (0, 10, 0) +VERSION = (0, 11, "0-dev") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From f172019edcc74f18cfb0a12dd5666eeecbf2ebaf Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 1 Jan 2015 22:57:02 +0200 Subject: [PATCH 02/10] Disable blink for "thanks" --- platformio/maintenance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/maintenance.py b/platformio/maintenance.py index dae2b648..f0f2123f 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -98,7 +98,7 @@ def after_upgrade(ctx): click.style("give", fg="cyan"), click.style("https://github.com/ivankravets/platformio", fg="cyan") )) - click.secho("Thanks a lot!\n", fg="green", blink=True) + click.secho("Thanks a lot!\n", fg="green") if not isdir(get_home_dir()): return From 8c2dd44f44f0eb8e32141047fc51b45b6fc1b48d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 2 Jan 2015 00:16:29 +0200 Subject: [PATCH 03/10] Update platformio.ini for the examples --- .../arduino-adafruit-library/platformio.ini | 20 ++++++++++-- .../arduino-internal-library/platformio.ini | 20 ++++++++++-- examples/atmelavr-native-blink/platformio.ini | 22 ++++++++++--- .../ide-eclipse/arduino_pro5/platformio.ini | 20 ++++++++++-- .../atmelavr_atmega168/platformio.ini | 24 ++++++++++---- .../tilaunchpad_msp430g2/platformio.ini | 20 ++++++++++-- .../ide-eclipse/titiva_lm4f120/platformio.ini | 21 +++++++++++-- examples/timsp430-native-blink/platformio.ini | 20 ++++++++++-- examples/titiva-native-blink/platformio.ini | 20 ++++++++++-- examples/wiring-blink/platformio.ini | 31 ++++++++++++++----- .../wiring-blink/src/{main.c => main.cpp} | 0 11 files changed, 185 insertions(+), 33 deletions(-) rename examples/wiring-blink/src/{main.c => main.cpp} (100%) diff --git a/examples/arduino-adafruit-library/platformio.ini b/examples/arduino-adafruit-library/platformio.ini index 109c539a..e26aeb1a 100644 --- a/examples/arduino-adafruit-library/platformio.ini +++ b/examples/arduino-adafruit-library/platformio.ini @@ -1,5 +1,21 @@ -# Copyright (C) Ivan Kravets -# See LICENSE for details. +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload [env:microduino] platform = atmelavr diff --git a/examples/arduino-internal-library/platformio.ini b/examples/arduino-internal-library/platformio.ini index 3e4373c7..4b5f4dd0 100644 --- a/examples/arduino-internal-library/platformio.ini +++ b/examples/arduino-internal-library/platformio.ini @@ -1,5 +1,21 @@ -# Copyright (C) Ivan Kravets -# See LICENSE for details. +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload [env:arduino_pro5v] platform = atmelavr diff --git a/examples/atmelavr-native-blink/platformio.ini b/examples/atmelavr-native-blink/platformio.ini index 6c73192c..be19d15a 100644 --- a/examples/atmelavr-native-blink/platformio.ini +++ b/examples/atmelavr-native-blink/platformio.ini @@ -1,13 +1,27 @@ -# Copyright (C) Ivan Kravets -# See LICENSE for details. +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload [env:arduino_pro5v] platform = atmelavr board_mcu = atmega168 board_f_cpu = 16000000L -upload_port = /dev/tty.SLAB_USBtoUART -# upload_port = COM3 upload_protocol = arduino upload_speed = 19200 diff --git a/examples/ide-eclipse/arduino_pro5/platformio.ini b/examples/ide-eclipse/arduino_pro5/platformio.ini index b5289605..1cb3136c 100644 --- a/examples/ide-eclipse/arduino_pro5/platformio.ini +++ b/examples/ide-eclipse/arduino_pro5/platformio.ini @@ -1,5 +1,21 @@ -# Copyright (C) Ivan Kravets -# See LICENSE for details. +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload [env:arduino_pro5v] platform = atmelavr diff --git a/examples/ide-eclipse/atmelavr_atmega168/platformio.ini b/examples/ide-eclipse/atmelavr_atmega168/platformio.ini index c974d6e3..d4ab33fc 100644 --- a/examples/ide-eclipse/atmelavr_atmega168/platformio.ini +++ b/examples/ide-eclipse/atmelavr_atmega168/platformio.ini @@ -1,14 +1,26 @@ -# Copyright (C) Ivan Kravets -# See LICENSE for details. +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload [env:atmelavr_atmega168] platform = atmelavr board_mcu = atmega168 board_f_cpu = 16000000L -# Allow autodetection for upload port or uncomment line below -# upload_port = /dev/ttyUSB0 -# upload_port = COM3 - upload_protocol = arduino upload_speed = 19200 diff --git a/examples/ide-eclipse/tilaunchpad_msp430g2/platformio.ini b/examples/ide-eclipse/tilaunchpad_msp430g2/platformio.ini index 55a857bc..14fed867 100644 --- a/examples/ide-eclipse/tilaunchpad_msp430g2/platformio.ini +++ b/examples/ide-eclipse/tilaunchpad_msp430g2/platformio.ini @@ -1,5 +1,21 @@ -# Copyright (C) Ivan Kravets -# See LICENSE for details. +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload [env:launchpad_msp430g2] platform = timsp430 diff --git a/examples/ide-eclipse/titiva_lm4f120/platformio.ini b/examples/ide-eclipse/titiva_lm4f120/platformio.ini index 7e915752..9c9493dd 100644 --- a/examples/ide-eclipse/titiva_lm4f120/platformio.ini +++ b/examples/ide-eclipse/titiva_lm4f120/platformio.ini @@ -1,8 +1,23 @@ -# Copyright (C) Ivan Kravets -# See LICENSE for details. +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload [env:launchpad_lm4f120] platform = titiva framework = energia board = lplm4f120h5qr -targets = upload diff --git a/examples/timsp430-native-blink/platformio.ini b/examples/timsp430-native-blink/platformio.ini index e1343405..74e9155d 100644 --- a/examples/timsp430-native-blink/platformio.ini +++ b/examples/timsp430-native-blink/platformio.ini @@ -1,5 +1,21 @@ -# Copyright (C) Ivan Kravets -# See LICENSE for details. +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload [env:launchpad_msp430g2] platform = timsp430 diff --git a/examples/titiva-native-blink/platformio.ini b/examples/titiva-native-blink/platformio.ini index 7e915752..e4c123dd 100644 --- a/examples/titiva-native-blink/platformio.ini +++ b/examples/titiva-native-blink/platformio.ini @@ -1,5 +1,21 @@ -# Copyright (C) Ivan Kravets -# See LICENSE for details. +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload [env:launchpad_lm4f120] platform = titiva diff --git a/examples/wiring-blink/platformio.ini b/examples/wiring-blink/platformio.ini index 096d1349..a02c950d 100644 --- a/examples/wiring-blink/platformio.ini +++ b/examples/wiring-blink/platformio.ini @@ -1,19 +1,34 @@ -# Copyright (C) Ivan Kravets -# See LICENSE for details. +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# -[env:arduino_pro5v] +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload + +[env:arduino_uno] platform = atmelavr framework = arduino -board = pro16MHzatmega168 -upload_port = /dev/tty.SLAB_USBtoUART +board = uno [env:launchpad_msp430g2] platform = timsp430 framework = energia board = lpmsp430g2553 -[env:launchpad_lm4f120] +[env:launchpad_tm4c1230c3pm] platform = titiva framework = energia -board = lplm4f120h5qr -build_flags = "-DLED_PIN=GREEN_LED" +board = lptm4c1230c3pm +build_flags = -DLED_PIN=GREEN_LED diff --git a/examples/wiring-blink/src/main.c b/examples/wiring-blink/src/main.cpp similarity index 100% rename from examples/wiring-blink/src/main.c rename to examples/wiring-blink/src/main.cpp From 79b8e6c24e777668bed78a9465bf09ad2e796bc4 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 2 Jan 2015 15:19:44 +0200 Subject: [PATCH 04/10] Mention "boards" command on QuickStart page --- docs/quickstart.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 26d6a656..a4dbd852 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -1,6 +1,6 @@ .. _quickstart: -Quickstart +QuickStart ========== .. note:: @@ -9,15 +9,14 @@ Quickstart 1. :ref:`Install PlatformIO `. -2. Find board ``type`` from :ref:`platforms` (you can choose multiple board - types). +2. Find board ``type`` from :ref:`platforms` or via :ref:`cmd_boards` command. 3. Initialize new PlatformIO based project with the pre-configured environments for your boards: .. code-block:: bash - $ platformio init --board=TYPE1 --board=TYPE2 + $ platformio init --board=TYPE_1 --board=TYPE_2 --board=TYPE_N The current working directory *** will be used for the new project. You can specify another project directory via From 8686936a07ad3716b1ad15fa27ec43ebc285dca5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 2 Jan 2015 17:18:32 +0200 Subject: [PATCH 05/10] Revert lowercase to Quickstart --- docs/quickstart.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index a4dbd852..a827406b 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -1,6 +1,6 @@ .. _quickstart: -QuickStart +Quickstart ========== .. note:: From 418b693fe0ecc7eaa2cba39f7b3ebc7e432dde63 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 2 Jan 2015 20:25:30 +0200 Subject: [PATCH 06/10] Fix missing auto-uploading by default within init command --- HISTORY.rst | 9 +++++++-- platformio/commands/init.py | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index b09e2216..1d50de3e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,12 @@ Release History =============== +0.10.1 (?) +---------- + +* Fixed missing auto-uploading by default within `platformio init `__ + command + 0.10.0 (2015-01-01) Happy New Year! ----------------------------------- @@ -9,7 +15,7 @@ Release History * Added support of *Engduino* boards for `atmelavr `__ platform (`issue #38 `_) -* Added ``--board`` option to `platformio init `_ +* Added ``--board`` option to `platformio init `__ command which allows to initialise project with the specified embedded boards (`issue #21 `_) * Added `example with uploading firmware `_ @@ -22,7 +28,6 @@ Release History * Fixed urllib3's *SSL* warning under Python <= 2.7.2 (`issue #39 `_) * Fixed bug with *Arduino USB* boards (`issue #40 `_) - 0.9.2 (2014-12-10) ------------------ diff --git a/platformio/commands/init.py b/platformio/commands/init.py index 10e0fb2f..5b93cad1 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -89,8 +89,8 @@ def fill_project_envs(project_file, board_types, disable_auto_uploading): content.append("framework = %s" % framework) content.append("board = %s" % type_) - content.append("%stargets = upload" % "# " if disable_auto_uploading - else "") + content.append("%stargets = upload" % ("# " if disable_auto_uploading + else "")) with open(project_file, "a") as f: f.write("\n".join(content)) From 2566879a99ad309ff8f41fbedada9d10d42ce9eb Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 2 Jan 2015 20:27:34 +0200 Subject: [PATCH 07/10] Fix indention --- platformio/commands/init.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/commands/init.py b/platformio/commands/init.py index 5b93cad1..bef4c690 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -90,7 +90,7 @@ def fill_project_envs(project_file, board_types, disable_auto_uploading): content.append("board = %s" % type_) content.append("%stargets = upload" % ("# " if disable_auto_uploading - else "")) + else "")) with open(project_file, "a") as f: f.write("\n".join(content)) From 01f8795981c0fb4bb483d70cc93fdf0f8042da99 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 2 Jan 2015 21:03:14 +0200 Subject: [PATCH 08/10] Add "--json-output" option to "platformio list", "platformio serialports list" and "platformio lib list" cmds // Resolve #42 --- HISTORY.rst | 14 +++++++++++--- docs/quickstart.rst | 3 ++- docs/userguide/cmd_list.rst | 9 ++++++++- docs/userguide/cmd_serialports.rst | 10 +++++++++- docs/userguide/lib/cmd_list.rst | 9 ++++++++- platformio/commands/init.py | 2 +- platformio/commands/lib.py | 8 +++++++- platformio/commands/list.py | 21 ++++++++++++++++----- platformio/commands/serialports.py | 7 ++++++- 9 files changed, 68 insertions(+), 15 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 1d50de3e..68da21a9 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,11 +4,19 @@ Release History 0.10.1 (?) ---------- -* Fixed missing auto-uploading by default within `platformio init `__ +* Added ``--json-output`` option to + `platformio list `__, + `platformio serialports list `__ and + `platformio lib list `__ + commands which allows to return the output in `JSON `_ format + (`issue #42 `_) +* Fixed missing auto-uploading by default after `platformio init `__ command -0.10.0 (2015-01-01) Happy New Year! ------------------------------------ +0.10.0 (2015-01-01) +------------------- + +**Happy New Year!** * Implemented `platformio boards `_ command (`issue #11 `_) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index a827406b..2d19807f 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -9,7 +9,8 @@ Quickstart 1. :ref:`Install PlatformIO `. -2. Find board ``type`` from :ref:`platforms` or via :ref:`cmd_boards` command. +2. Find board ``type`` on this :ref:`Embedded Boards ` page or + via :ref:`cmd_boards` command. 3. Initialize new PlatformIO based project with the pre-configured environments for your boards: diff --git a/docs/userguide/cmd_list.rst b/docs/userguide/cmd_list.rst index 91ccf3d4..bbbf7197 100644 --- a/docs/userguide/cmd_list.rst +++ b/docs/userguide/cmd_list.rst @@ -10,7 +10,7 @@ Usage .. code-block:: bash - platformio list + platformio list [OPTIONS] Description @@ -18,6 +18,13 @@ Description List installed :ref:`Platforms ` +Options +~~~~~~~ + +.. option:: + --json-output + +Return the output in `JSON `_ format Examples -------- diff --git a/docs/userguide/cmd_serialports.rst b/docs/userguide/cmd_serialports.rst index 83e476d8..612429b3 100644 --- a/docs/userguide/cmd_serialports.rst +++ b/docs/userguide/cmd_serialports.rst @@ -13,7 +13,7 @@ Usage .. code-block:: bash - platformio serialports list + platformio serialports list [OPTIONS] Description @@ -21,6 +21,14 @@ Description List available `Serial Ports `_ +Options +~~~~~~~ + +.. option:: + --json-output + +Return the output in `JSON `_ format + Examples ~~~~~~~~ diff --git a/docs/userguide/lib/cmd_list.rst b/docs/userguide/lib/cmd_list.rst index 5ab7e0dc..2551704b 100644 --- a/docs/userguide/lib/cmd_list.rst +++ b/docs/userguide/lib/cmd_list.rst @@ -10,7 +10,7 @@ Usage .. code-block:: bash - platformio lib list + platformio lib list [OPTIONS] Description @@ -18,6 +18,13 @@ Description List installed libraries +Options +~~~~~~~ + +.. option:: + --json-output + +Return the output in `JSON `_ format Examples -------- diff --git a/platformio/commands/init.py b/platformio/commands/init.py index bef4c690..f81cf5e4 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -17,7 +17,7 @@ from platformio.util import get_boards, get_source_dir type=click.Path(exists=True, file_okay=False, dir_okay=True, writable=True, resolve_path=True)) @click.option("--board", "-b", multiple=True, metavar="TYPE") -@click.option('--disable-auto-uploading', is_flag=True) +@click.option("--disable-auto-uploading", is_flag=True) def cli(project_dir, board, disable_auto_uploading): project_file = join(project_dir, "platformio.ini") diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index 1c4bebde..f3b87445 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -154,9 +154,15 @@ def lib_uninstall(libid): @cli.command("list", short_help="List installed libraries") -def lib_list(): +@click.option("--json-output", is_flag=True) +def lib_list(json_output): lm = LibraryManager(get_lib_dir()) items = lm.get_installed().values() + + if json_output: + click.echo(items) + return + if not items: return diff --git a/platformio/commands/list.py b/platformio/commands/list.py index ed7ffad2..3520d2ad 100644 --- a/platformio/commands/list.py +++ b/platformio/commands/list.py @@ -7,15 +7,26 @@ from platformio.platforms.base import PlatformFactory @click.command("list", short_help="List installed platforms") -def cli(): +@click.option("--json-output", is_flag=True) +def cli(json_output): installed_platforms = PlatformFactory.get_platforms( installed=True).keys() installed_platforms.sort() + data = [] for platform in installed_platforms: p = PlatformFactory.newPlatform(platform) - click.echo("{name:<20} with packages: {pkgs}".format( - name=click.style(p.get_name(), fg="cyan"), - pkgs=", ".join(p.get_installed_packages()) - )) + data.append({ + "name": platform, + "packages": p.get_installed_packages() + }) + + if json_output: + click.echo(data) + else: + for item in data: + click.echo("{name:<20} with packages: {pkgs}".format( + name=click.style(item['name'], fg="cyan"), + pkgs=", ".join(item['packages']) + )) diff --git a/platformio/commands/serialports.py b/platformio/commands/serialports.py index d75eba85..d62d9482 100644 --- a/platformio/commands/serialports.py +++ b/platformio/commands/serialports.py @@ -15,7 +15,12 @@ def cli(): @cli.command("list", short_help="List Serial ports") -def serialports_list(): +@click.option("--json-output", is_flag=True) +def serialports_list(json_output): + + if json_output: + click.echo(get_serialports()) + return for item in get_serialports(): click.secho(item['port'], fg="cyan") From ca312309280c84f917f75f1c7fca030be4a3c641 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 2 Jan 2015 23:14:45 +0200 Subject: [PATCH 09/10] Improve lib scanner --- platformio/builder/tools/platformio.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index d76eea5f..732d71b8 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -35,9 +35,7 @@ def BuildFirmware(env, corelibs): join("$BUILD_DIR", "src"), join("$PROJECT_DIR", "src")) # build dependent libs - deplibs = [] - for vdir in vdirs: - deplibs += src.BuildDependentLibraries(vdir) + deplibs = src.BuildDependentLibraries(vdirs) src.MergeFlags(getenv("PIOSRCBUILD_FLAGS", "$SRCBUILD_FLAGS")) @@ -67,9 +65,9 @@ def BuildLibrary(env, variant_dir, library_dir): ) -def BuildDependentLibraries(env, src_dir): +def BuildDependentLibraries(env, src_dirs): libs = [] - deplibs = env.GetDependentLibraries(src_dir) + deplibs = env.GetDependentLibraries(src_dirs) env.Append(CPPPATH=[join("$BUILD_DIR", l) for (l, _) in deplibs]) for (libname, inc_dir) in deplibs: @@ -80,10 +78,15 @@ def BuildDependentLibraries(env, src_dir): return libs -def GetDependentLibraries(env, src_dir): +def GetDependentLibraries(env, src_dirs): includes = {} + nodes = [] regexp = re.compile(r"^\s*#include\s+(?:\<|\")([^\>\"\']+)(?:\>|\")", re.M) - nodes = env.GlobCXXFiles(src_dir) + env.Glob(join(src_dir, "*.h")) + + for item in src_dirs: + nodes += env.GlobCXXFiles(item) + nodes += env.Glob(join(item, "*.h")) + for node in nodes: env.ParseIncludesRecurive(regexp, node, includes) includes = sorted(includes.items(), key=lambda s: s[0]) @@ -108,10 +111,12 @@ def ParseIncludesRecurive(env, regexp, source_file, includes): for inc_fname in matches: if inc_fname in includes: continue + for lsd_dir in env['LIBSOURCE_DIRS']: lsd_dir = env.subst(lsd_dir) if not isdir(lsd_dir): continue + for libname in listdir(lsd_dir): inc_dir = join(lsd_dir, libname) inc_file = join(inc_dir, inc_fname) @@ -121,6 +126,7 @@ def ParseIncludesRecurive(env, regexp, source_file, includes): inc_file = join(inc_dir, inc_fname) if not isfile(inc_file): continue + includes[inc_fname] = (len(includes) + 1, libname, inc_dir) env.ParseIncludesRecurive(regexp, env.File(inc_file), includes) From 6c86bb41676fd347d7c703d52b6355d3916aed02 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 2 Jan 2015 23:17:30 +0200 Subject: [PATCH 10/10] Bump to 0.10.1 (resolve issue #42) --- HISTORY.rst | 4 ++-- platformio/__init__.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 68da21a9..ca81838c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,8 +1,8 @@ Release History =============== -0.10.1 (?) ----------- +0.10.1 (2015-01-02) +------------------- * Added ``--json-output`` option to `platformio list `__, diff --git a/platformio/__init__.py b/platformio/__init__.py index 4b35f3f7..6fdb367f 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (0, 11, "0-dev") +VERSION = (0, 10, 1) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio"